🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

tokentracker-cli

Package Overview
Dependencies
Maintainers
1
Versions
324
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tokentracker-cli - npm Package Compare versions

Comparing version
0.84.1
to
0.84.2
dashboard/dist/assets/__vite-browser-external-CuMc3dqk.js

Sorry, the diff of this file is too big to display

+1
import{l as o,R as N,j as r}from"./__vite-browser-external-CuMc3dqk.js";import{Z as $}from"./zap-CcqNcNpw.js";import{F as A}from"./flame-VQYtrvgY.js";const j=[["path",{d:"M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2",key:"1ah6g2"}],["rect",{x:"14",y:"2",width:"8",height:"8",rx:"1",key:"88lufb"}]],E=o("blocks",j);const L=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],C=o("brain",L);const T=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]],z=o("calendar-days",T);const B=[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]],R=o("crown",B);const q=[["path",{d:"M12.67 19a2 2 0 0 0 1.416-.588l6.154-6.172a6 6 0 0 0-8.49-8.49L5.586 9.914A2 2 0 0 0 5 11.328V18a1 1 0 0 0 1 1z",key:"18jl4k"}],["path",{d:"M16 8 2 22",key:"vp34q"}],["path",{d:"M17.5 15H9",key:"1oz8nu"}]],H=o("feather",q);const D=[["path",{d:"M18 19a5 5 0 0 1-5-5v8",key:"sz5oeg"}],["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]],F=o("folder-git-2",D);const I=[["path",{d:"M4 16v-2.38C4 11.5 2.97 10.5 3 8c.03-2.72 1.49-6 4.5-6C9.37 2 10 3.8 10 5.5c0 3.11-2 5.66-2 8.68V16a2 2 0 1 1-4 0Z",key:"1dudjm"}],["path",{d:"M20 20v-2.38c0-2.12 1.03-3.12 1-5.62-.03-2.72-1.49-6-4.5-6C14.63 6 14 7.8 14 9.5c0 3.11 2 5.66 2 8.68V20a2 2 0 1 0 4 0Z",key:"l2t8xc"}],["path",{d:"M16 17h4",key:"1dejxt"}],["path",{d:"M4 13h4",key:"1bwh8b"}]],G=o("footprints",I);const V=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],S=o("heart",V);const Z=[["path",{d:"M7.21 15 2.66 7.14a2 2 0 0 1 .13-2.2L4.4 2.8A2 2 0 0 1 6 2h12a2 2 0 0 1 1.6.8l1.6 2.14a2 2 0 0 1 .14 2.2L16.79 15",key:"143lza"}],["path",{d:"M11 12 5.12 2.2",key:"qhuxz6"}],["path",{d:"m13 12 5.88-9.8",key:"hbye0f"}],["path",{d:"M8 7h8",key:"i86dvs"}],["circle",{cx:"12",cy:"17",r:"5",key:"qbz8iq"}],["path",{d:"M12 18v-2h-.5",key:"fawc4q"}]],O=o("medal",Z);const P=[["path",{d:"M18 5h4",key:"1lhgn2"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],X=o("moon-star",P);const K=[["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}],["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09",key:"u4xsad"}],["path",{d:"M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z",key:"676m9"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05",key:"92ym6u"}]],U=o("rocket",K);const W=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Y=o("shield-check",W);const J=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],Q=o("trending-up",J),k=[{id:"token_titan",scope:"cloud",icon:R,format:"tokens",art:"/achievements/token-titan.png"},{id:"big_day",scope:"cloud",icon:$,format:"tokens",art:"/achievements/big-day.png"},{id:"wordsmith",scope:"cloud",icon:H,format:"tokens",art:"/achievements/wordsmith.png"},{id:"marathoner",scope:"cloud",icon:G,format:"days",art:"/achievements/marathoner.png"},{id:"streak",scope:"cloud",icon:A,format:"days",art:"/achievements/streak.png"},{id:"weekend_warrior",scope:"cloud",icon:z,format:"days",art:"/achievements/weekend-warrior.png"},{id:"momentum",scope:"cloud",icon:Q,format:"multiplier",art:"/achievements/momentum.png"},{id:"polyglot",scope:"cloud",icon:C,format:"count",art:"/achievements/polyglot.png"},{id:"trendsetter",scope:"cloud",icon:U,format:"count",art:"/achievements/trendsetter.png"},{id:"multitool",scope:"cloud",icon:E,format:"count",art:"/achievements/multitool.png"},{id:"podium",scope:"cloud",icon:O,format:"rank",art:"/achievements/podium.png"},{id:"veteran",scope:"cloud",icon:Y,format:"days",art:"/achievements/veteran.png"},{id:"project_hopper",scope:"local",icon:F,format:"count",art:"/achievements/project-hopper.png"},{id:"project_devotion",scope:"local",icon:S,format:"tokens",art:"/achievements/project-devotion.png"},{id:"night_owl",scope:"local",icon:X,format:"count",art:"/achievements/night-owl.png"}],u=new Map(k.map(e=>[e.id,e])),m=new Map(k.map((e,a)=>[e.id,a]));function de(e,a){return`achievements.badge.${e}.${a}`}function ee(e){return[...e||[]].sort((a,t)=>{const c=(t?.tier||0)-(a?.tier||0);return c!==0?c:(m.get(a?.id)??99)-(m.get(t?.id)??99)})}function re(e){const a=(e||[]).filter(t=>t&&(t.tier||0)>=1&&u.has(t.id));return a.length===0?null:ee(a)[0]}const v={1:"bronze",2:"silver",3:"gold",4:"diamond"},ie=["bronze","silver","gold","diamond"],ae={bronze:{rim:["#a06a44","#5c3a22"],face:["#d29a6c","#96602f"],glyph:"#3f2817",ring:"#e8c3a0",sheen:"rgba(255, 236, 220, 0.45)",label:"#a06a44"},silver:{rim:["#aab3bb","#67707b"],face:["#dde2e7","#9ba5ae"],glyph:"#39424b",ring:"#f2f5f7",sheen:"rgba(255, 255, 255, 0.55)",label:"#8b959f"},gold:{rim:["#c9971c","#8a6508"],face:["#f2ca52","#cf9c26"],glyph:"#5c430e",ring:"#ffe9a8",sheen:"rgba(255, 248, 214, 0.55)",label:"#b8860b"},diamond:{rim:["#62b1e0","#7c6fd9"],face:["#c8ecf6","#84b4ea"],glyph:"#27496d",ring:"#eafcff",sheen:"rgba(255, 255, 255, 0.65)",label:"#5a9bd8"}},y={rim:["#a8ada9","#7c817d"],face:["#cdd2ce","#a3a8a4"],glyph:"#6a706c",ring:"#dde1de",sheen:"rgba(255, 255, 255, 0.25)",label:"#8b908c"};function te(e,a=!1){return a||!e||e<1?y:ae[v[Math.min(e,4)]]||y}function se(e){return v[e]||null}const g={xs:18,sm:24,md:44,xl:88,lg:108},f={xs:.75,sm:1,md:1.5,xl:2,lg:2};function le({badgeId:e,tier:a=0,size:t="md",locked:c=!1,label:i,className:M=""}){const s=u.get(e),h=c||!a||a<1,n=te(a,h),d=t==="fill",l=d?"100%":g[t]||g.md,b=d?4:f[t]||f.md,[_,x]=N.useState(!1),p=s?.icon||null,w=!!s?.art&&!_;return r.jsx("span",{role:i?"img":void 0,"aria-label":i||void 0,"aria-hidden":i?void 0:!0,className:`inline-flex shrink-0 rounded-full ${M}`,style:{width:l,height:l,padding:b,background:`linear-gradient(135deg, ${n.rim[0]} 0%, ${n.ring} 42%, ${n.rim[1]} 100%)`,boxShadow:d||t==="md"||t==="xl"||t==="lg"?"0 0 0 1px rgba(10, 15, 12, 0.06), 0 1px 2px rgba(10, 15, 12, 0.08)":void 0},children:w?r.jsx("img",{src:s.art,alt:"",draggable:!1,loading:"lazy",onError:()=>x(!0),className:"h-full w-full rounded-full object-cover",style:h?{filter:"grayscale(1)",opacity:.55}:void 0}):r.jsx("span",{className:"flex h-full w-full items-center justify-center rounded-full",style:{background:`linear-gradient(145deg, ${n.face[0]}, ${n.face[1]})`},children:p?r.jsx(p,{size:d?64:Math.round(l*.5),color:n.glyph,strokeWidth:2}):null})})}export{le as A,k as B,S as H,Q as T,ae as a,de as b,u as c,ie as d,re as h,te as p,ee as s,se as t};
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/BadgeDetailModal-lw1e7EvA.js","assets/__vite-browser-external-CuMc3dqk.js","assets/__vite-browser-external-WKilYZnq.css","assets/react-B80AX8fE.js","assets/AchievementBadge-DvulAUrw.js","assets/zap-CcqNcNpw.js","assets/flame-VQYtrvgY.js","assets/use-transform-Dza9-ZQl.js","assets/use-reduced-motion-BEAopWkx.js","assets/AchievementsSection-CgiOHh54.js","assets/format-tokens-173-9MpR.js","assets/DialogTitle-KxLDeLzC.js","assets/useScrollLock-DmM-LeMm.js","assets/store-NtnkxrS2.js"])))=>i.map(i=>d[i]);
import{r as l,G as x,H as f,I as v,j as e,c,L as p,R as g,a as y,J as b,K as k,_ as j}from"./__vite-browser-external-CuMc3dqk.js";import{A as w}from"./AchievementsSection-CgiOHh54.js";import{B as h}from"./AchievementBadge-DvulAUrw.js";import"./react-B80AX8fE.js";import"./format-tokens-173-9MpR.js";import"./use-reduced-motion-BEAopWkx.js";import"./zap-CcqNcNpw.js";import"./flame-VQYtrvgY.js";function N({enabled:a=!0}={}){const[r,t]=l.useState({status:"loading",achievements:[],error:null}),s=l.useMemo(()=>x(),[]);return l.useEffect(()=>{if(!a){t({status:"disabled",achievements:[],error:null});return}let i=!1;return t(n=>({...n,status:"loading"})),f({timeZone:s,tzOffsetMinutes:v()}).then(n=>{i||t({status:"ready",achievements:Array.isArray(n?.achievements)?n.achievements:[],error:null})}).catch(n=>{i||t({status:"error",achievements:[],error:n})}),()=>{i=!0}},[a,s]),r}const A=g.lazy(()=>j(()=>import("./BadgeDetailModal-lw1e7EvA.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])));function I({authLoading:a,authEnabled:r,authUserId:t,mockEnabled:s}){if(s)return{authLoading:!1,signedIn:!0,userId:"mock-user"};const i=!!(r&&t);return{authLoading:!!a,signedIn:i,userId:i?t:null}}function B(){const a=y(),[r,t]=l.useState({status:"loading",achievements:[],userId:null}),s=b(),{authLoading:i,signedIn:n,userId:o}=I({authLoading:a?.loading,authEnabled:a?.enabled,authUserId:a?.user?.id,mockEnabled:s});return l.useEffect(()=>{if(i){t({status:"loading",achievements:[],userId:null});return}if(!n){t({status:"signed-out",achievements:[],userId:null});return}let d=!1;return t({status:"loading",achievements:[],userId:o}),(async()=>{try{const u=s?null:await a.getAccessToken?.(),m=await k({accessToken:u,userId:o});if(d)return;t({status:"ready",achievements:Array.isArray(m?.badges)?m.badges:[],userId:o})}catch{d||t({status:"error",achievements:[],userId:o})}})(),()=>{d=!0}},[i,s,n,o]),{...r,signedIn:n,settled:_({authLoading:i,signedIn:n,userId:o,state:r})}}function _({authLoading:a,signedIn:r,userId:t,state:s}){return a?!1:r?s.userId===t&&(s.status==="ready"||s.status==="error"):s.status==="signed-out"}function S(){return e.jsx("div",{className:"mx-0 grid animate-pulse grid-cols-[repeat(3,max-content)] justify-between gap-y-7 sm:-mx-2 sm:grid-cols-[repeat(4,max-content)] lg:grid-cols-[repeat(5,max-content)]","aria-hidden":!0,children:Array.from({length:h.length}).map((a,r)=>e.jsxs("div",{className:"flex w-[6.75rem] flex-col items-center px-0 pb-3 pt-4 sm:w-[7.75rem]",children:[e.jsx("div",{className:"h-[108px] w-[108px] rounded-full bg-oai-gray-200 dark:bg-oai-gray-800"}),e.jsx("div",{className:"mt-3 h-3 w-16 rounded bg-oai-gray-200 dark:bg-oai-gray-800"}),e.jsx("div",{className:"mt-2 h-2 w-10 rounded bg-oai-gray-100 dark:bg-oai-gray-800/60"})]},r))})}function z(){const a=N(),r=B(),[t,s]=l.useState(null),i=a.status==="loading"||!r.settled,n=l.useMemo(()=>[...r.achievements||[],...a.achievements||[]],[r.achievements,a.achievements]),o=l.useMemo(()=>n.filter(u=>(u?.tier||0)>=1).length,[n]),d=h.length;return e.jsxs("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:[e.jsx("main",{className:"flex-1 pb-12 pt-8 sm:pb-16 sm:pt-10",children:e.jsxs("div",{className:"mx-auto max-w-4xl px-4 sm:px-6",children:[e.jsxs("div",{className:"mb-7 flex items-baseline justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:c("achievements.page.title")}),e.jsx("p",{className:"mt-1.5 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:c("achievements.page.local_note")})]}),!i&&e.jsxs("div",{className:"shrink-0 text-right",children:[e.jsxs("div",{className:"font-mono text-2xl font-semibold leading-none tabular-nums text-oai-black dark:text-white",children:[o,e.jsxs("span",{className:"text-oai-gray-400 dark:text-oai-gray-600",children:["/",d]})]}),e.jsx("div",{className:"mt-2 h-1 w-24 overflow-hidden rounded-full bg-oai-gray-200 dark:bg-oai-gray-800",children:e.jsx("div",{className:"h-full rounded-full bg-oai-brand-600 transition-[width] duration-500",style:{width:`${Math.round(o/d*100)}%`}})})]})]}),!r.signedIn&&!i&&e.jsxs("div",{className:"mb-6 flex flex-wrap items-center justify-between gap-x-4 gap-y-2 rounded-xl border border-oai-gray-200 bg-oai-gray-50 px-4 py-3 dark:border-oai-gray-800 dark:bg-oai-gray-900/60",children:[e.jsx("p",{className:"text-sm text-oai-gray-600 dark:text-oai-gray-300",children:c("achievements.signin.prompt")}),e.jsx(p,{to:"/login",className:"shrink-0 rounded-lg bg-oai-brand-600 px-3 py-1.5 text-sm font-medium text-white transition-colors duration-200 hover:bg-oai-brand-700 active:scale-[0.98]",children:c("achievements.signin.action")})]}),i?e.jsx(S,{}):e.jsxs(e.Fragment,{children:[e.jsx(w,{achievements:n,isOwn:!0,columns:"wide",size:"lg",animateIn:!0,onSelect:s}),e.jsxs("p",{className:"mt-10 text-center text-xs text-oai-gray-400 dark:text-oai-gray-500",children:[c("achievements.page.suggest")," ",e.jsx("a",{href:"https://github.com/mm7894215/TokenTracker/issues",target:"_blank",rel:"noopener noreferrer",className:"underline decoration-oai-gray-300 underline-offset-2 transition-colors hover:text-oai-gray-700 hover:decoration-oai-gray-500 dark:decoration-oai-gray-600 dark:hover:text-oai-gray-300",children:c("achievements.page.suggest_link")})]})]})]})}),t&&e.jsx(g.Suspense,{fallback:null,children:e.jsx(A,{badge:t,onClose:()=>s(null)})})]})}export{_ as cloudBadgesSettled,z as default,I as resolveCloudBadgeIdentity};
import{l as _,j as s,c as l}from"./__vite-browser-external-CuMc3dqk.js";import{m as $}from"./react-B80AX8fE.js";import{B as x,s as b,b as C,t as T,A as B,a as E}from"./AchievementBadge-DvulAUrw.js";import{f as L}from"./format-tokens-173-9MpR.js";import{u as I}from"./use-reduced-motion-BEAopWkx.js";const D=[["path",{d:"M10 16h.01",key:"1bzywj"}],["path",{d:"M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"18tbho"}],["path",{d:"M21.946 12.013H2.054",key:"zqlbp7"}],["path",{d:"M6 16h.01",key:"1pmjb7"}]],F=_("hard-drive",D);function V(r,i){const t=Number(i)||0;switch(r){case"tokens":return L(t);case"rank":return`#${Math.round(t)}`;case"multiplier":return`${(Math.round(t*10)/10).toString()}×`;default:return Math.round(t).toLocaleString()}}function H(r){if(!r)return 0;const i=Number(r.next_threshold),t=Number(r.metric_value??r.value);if(!Number.isFinite(i)||i<=0)return r.tier>=4?1:0;if(!Number.isFinite(t)||t<=0)return 0;const o=r.lower_is_better?i/t:t/i;return Math.max(0,Math.min(1,o))}function q(r){const i=r?.achieved||{},t=Object.values(i).map(o=>o?Date.parse(o):NaN).filter(o=>Number.isFinite(o));return t.length>0?Math.max(...t):null}function K({achievements:r,isOwn:i=!1,scope:t,onSelect:o,size:m="xl",columns:v="default",animateIn:y=!1,className:N=""}){const k=I(),u=y&&!k,p=new Map;for(const e of Array.isArray(r)?r:[])e&&e.id&&p.set(e.id,e);const g=t?x.filter(e=>e.scope===t):x;let c;if(i){const e=g.map(a=>({entry:a,record:p.get(a.id)||{id:a.id,tier:0}})),n=b(e.filter(a=>(a.record.tier||0)>=1).map(a=>({...a,id:a.entry.id,tier:a.record.tier}))),h=e.filter(a=>(a.record.tier||0)<1);c=[...n,...h]}else c=b(g.map(e=>({entry:e,record:p.get(e.id)})).filter(e=>e.record&&(e.record.tier||0)>=1).map(e=>({...e,id:e.entry.id,tier:e.record.tier}))).map(({entry:e,record:n})=>({entry:e,record:n}));if(c.length===0)return null;const j=v==="wide"?"grid-cols-[repeat(3,max-content)] sm:grid-cols-[repeat(4,max-content)] lg:grid-cols-[repeat(5,max-content)]":"grid-cols-[repeat(3,max-content)] sm:grid-cols-[repeat(4,max-content)]",w=m==="lg"?"mx-0 sm:-mx-2":"-mx-2 sm:-mx-4",M=m==="lg"?"px-0":"px-1";return s.jsx("div",{className:`${w} grid justify-between gap-y-7 ${j} ${N}`,children:c.map(({entry:e,record:n},h)=>{const a=(n.tier||0)>=1,f=l(C(e.id,"name")),d=a?T(n.tier):null,A=H(n);return s.jsxs($.button,{type:"button",initial:u?{opacity:0,y:16,scale:.9}:!1,animate:u?{opacity:1,y:0,scale:1}:void 0,whileTap:u?{scale:.97}:void 0,transition:{delay:.05+h*.035,duration:.45,ease:[.16,1,.3,1]},onClick:o?()=>o({...n,id:e.id}):void 0,className:`group flex w-[6.75rem] flex-col items-center rounded-xl ${M} pb-3 pt-4 text-center transition-[background-color,transform] duration-200 ease-out hover:bg-oai-gray-50 active:scale-[0.97] dark:hover:bg-oai-gray-900/70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand/60 sm:w-[7.75rem]`,"aria-label":l("achievements.badge.aria",{name:f,tier:d?l(`achievements.tier.${d}`):l("achievements.modal.locked")}),children:[s.jsx(B,{badgeId:e.id,tier:n.tier,locked:!a,size:m,className:"transition-transform duration-200 ease-out group-hover:-translate-y-0.5 group-hover:scale-105"}),s.jsxs("span",{className:"mt-2.5 flex w-full items-center justify-center gap-1",children:[s.jsx("span",{title:f,className:"min-w-0 truncate text-xs font-medium leading-tight text-oai-gray-800 dark:text-oai-gray-200",children:f}),e.scope==="local"&&s.jsx("span",{title:l("achievements.page.local_note"),"aria-label":l("achievements.scope.local"),className:"inline-flex shrink-0 text-oai-gray-400 dark:text-oai-gray-500",children:s.jsx(F,{size:11,strokeWidth:2,"aria-hidden":!0})})]}),s.jsx("span",{className:"mt-1 flex h-4 w-full items-center justify-center",children:a?s.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-[0.08em]",style:{color:E[d]?.label},children:l(`achievements.tier.${d}`)}):i?s.jsx("span",{className:"h-[3px] w-14 overflow-hidden rounded-full bg-oai-gray-200 dark:bg-oai-gray-800",children:s.jsx("span",{className:"block h-full rounded-full bg-oai-brand/70",style:{width:`${Math.round(A*100)}%`}})}):null})]},e.id)})})}export{K as A,H as b,V as f,q as l};
import{r as s,j as t,R as g}from"./__vite-browser-external-CuMc3dqk.js";import{m as v}from"./react-B80AX8fE.js";import{P as x}from"./ProviderIcon-B6sgfDtI.js";import{A as y}from"./index-jpsn86uT.js";function C(a){const e=[...a];for(let o=e.length-1;o>0;o--){const r=Math.floor(Math.random()*(o+1));[e[o],e[r]]=[e[r],e[o]]}return e}function j(a,e){const o=C(a),r=Array.from({length:e},()=>[]);o.forEach((i,m)=>{r[m%e].push(i)});const c=Math.max(...r.map(i=>i.length));return r.forEach(i=>{for(;i.length<c;)i.push(o[Math.floor(Math.random()*o.length)])}),r}const w=g.memo(function({logos:e,index:o,currentTime:r,onHoverChange:c}){const[i,m]=s.useState(!1),l=4e3,p=o*400,n=(r+p)%(l*e.length),d=Math.floor(n/l),u=e[d],h=f=>{m(f),c(f)};return t.jsxs("div",{className:"relative flex flex-col items-center",onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),children:[t.jsx(v.div,{className:"relative h-8 w-8 sm:h-10 sm:w-10 md:h-12 md:w-12 overflow-hidden",initial:{opacity:0,y:50},animate:{opacity:1,y:0},transition:{delay:o*.1,duration:.5,ease:"easeOut"},children:t.jsx(y,{mode:"wait",children:t.jsx(v.div,{className:"absolute inset-0 flex items-center justify-center",initial:{y:"18%",opacity:0,filter:"blur(4px)"},animate:{y:"0%",opacity:1,filter:"blur(0px)",transition:{type:"tween",ease:[.22,1,.36,1],duration:.9}},exit:{y:"-18%",opacity:0,filter:"blur(4px)",transition:{type:"tween",ease:[.4,0,1,1],duration:.55}},children:t.jsx(x,{provider:u.provider,size:24,className:"object-contain"})},`${u.id}-${d}`)})}),t.jsx(y,{children:i&&t.jsx(v.span,{className:"pointer-events-none absolute -bottom-7 z-10 whitespace-nowrap rounded bg-oai-gray-800 px-2 py-0.5 text-xs font-medium text-oai-gray-100 shadow-lg ring-1 ring-oai-gray-700",initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},children:u.name})})]})});function E({logos:a,columnCount:e=2}){const[o,r]=s.useState([]),[c,i]=s.useState(0),[m,l]=s.useState(!1);s.useEffect(()=>{r(j(a,e))},[a,e]),s.useEffect(()=>{if(m)return;const n=setInterval(()=>i(d=>d+400),400);return()=>clearInterval(n)},[m]);const p=s.useCallback(n=>{l(n)},[]);return t.jsx("div",{className:"flex gap-2.5 sm:gap-4 text-oai-gray-200",children:o.map((n,d)=>t.jsx(w,{logos:n,index:d,currentTime:c,onHoverChange:p},d))})}const A=[{id:1,name:"Claude Code",provider:"claude"},{id:2,name:"Codex",provider:"codex"},{id:3,name:"Cursor",provider:"cursor"},{id:4,name:"Gemini",provider:"gemini"},{id:5,name:"Antigravity",provider:"antigravity"},{id:6,name:"Kiro",provider:"kiro"},{id:7,name:"OpenCode",provider:"opencode"},{id:8,name:"OpenClaw",provider:"openclaw"},{id:9,name:"Every Code",provider:"every-code"},{id:10,name:"Hermes",provider:"hermes"},{id:11,name:"GitHub Copilot",provider:"copilot"},{id:12,name:"Kimi",provider:"kimi"},{id:13,name:"CodeBuddy",provider:"codebuddy"},{id:14,name:"WorkBuddy",provider:"workbuddy"},{id:15,name:"Grok",provider:"grok"},{id:16,name:"oh-my-pi",provider:"omp"},{id:17,name:"Pi",provider:"pi"},{id:18,name:"Craft",provider:"craft"},{id:19,name:"Kilo CLI",provider:"kilo-cli"},{id:20,name:"Kilo Code",provider:"kilocode"},{id:21,name:"Roo Code",provider:"roocode"},{id:22,name:"Zed",provider:"zed"},{id:23,name:"Goose",provider:"goose"},{id:24,name:"Droid",provider:"droid"},{id:25,name:"Mimo",provider:"mimo"},{id:26,name:"ZCode",provider:"zcode"},{id:27,name:"AnythingLLM",provider:"anythingllm"}];export{A,E as L};
import{l as o}from"./__vite-browser-external-CuMc3dqk.js";const t=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],a=o("arrow-up-right",t);export{a as A};
import{r as L,j as a,bb as De,c as h,d as ye,X as Ie}from"./__vite-browser-external-CuMc3dqk.js";import{k as _e,V as Me,l as Ve,r as Te,n as $e,o as be,q as ve,s as Oe,t as Re,v as Be,w as Pe,x as Ke,y as Ce,z as Fe,A as Le,B as Xe,S as Ge,H as We,C as G,D as ze,E as Ue,e as Ye,F as He,m as C}from"./react-B80AX8fE.js";import{c as je,A as Ze,p as qe,b as U,t as le,a as T,d as Je}from"./AchievementBadge-DvulAUrw.js";import{u as Qe,a as z}from"./use-transform-Dza9-ZQl.js";import{u as et}from"./use-reduced-motion-BEAopWkx.js";import{l as ce,f as ue,b as tt}from"./AchievementsSection-CgiOHh54.js";import{D as nt,a as rt,b as at,c as st,d as it,e as ot}from"./DialogTitle-KxLDeLzC.js";import"./zap-CcqNcNpw.js";import"./flame-VQYtrvgY.js";import"./format-tokens-173-9MpR.js";import"./useScrollLock-DmM-LeMm.js";import"./store-NtnkxrS2.js";const lt=(e,t,n)=>{const r=t-e;return((n-e)%r+r)%r+e};function Ne(e,t){return _e(e)?e[lt(0,e.length,t)]:e}class ct{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>t.finished))}getAll(t){return this.animations[0][t]}setAll(t,n){for(let r=0;r<this.animations.length;r++)this.animations[r][t]=n}attachTimeline(t){const n=this.animations.map(r=>r.attachTimeline(t));return()=>{n.forEach((r,s)=>{r&&r(),this.animations[s].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get state(){return this.getAll("state")}get startTime(){return this.getAll("startTime")}get duration(){return de(this.animations,"duration")}get iterationDuration(){return de(this.animations,"iterationDuration")}runAll(t){this.animations.forEach(n=>n[t]())}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}function de(e,t){let n=0;for(let r=0;r<e.length;r++){const s=e[r][t];s!==null&&s>n&&(n=s)}return n}class ut extends ct{then(t,n){return this.finished.finally(t).then(()=>{})}}function dt(e,t){return e in t}class mt extends Me{constructor(){super(...arguments),this.type="object"}readValueFromInstance(t,n){if(dt(n,t)){const r=t[n];if(typeof r=="string"||typeof r=="number")return r}}getBaseTargetFromProps(){}removeValueFromRenderState(t,n){delete n.output[t]}measureInstanceViewportBox(){return Ve()}build(t,n){Object.assign(t.output,n)}renderInstance(t,{output:n}){Object.assign(t,n)}sortInstanceNodePosition(){return 0}}function Y(e){return typeof e=="object"&&!Array.isArray(e)}function ke(e,t,n,r){return e==null?[]:typeof e=="string"&&Y(t)?Te(e,n,r):e instanceof NodeList?Array.from(e):Array.isArray(e)?e.filter(s=>s!=null):[e]}function ft(e,t,n){return e*(t+1)+n*t}function me(e,t,n,r){return typeof t=="number"?t:t.startsWith("-")||t.startsWith("+")?Math.max(0,e+parseFloat(t)):t==="<"?n:t.startsWith("<")?Math.max(0,n+parseFloat(t.slice(1))):r.get(t)??e}function pt(e,t,n){for(let r=0;r<e.length;r++){const s=e[r];s.at>t&&s.at<n&&(be(e,s),r--)}}function ht(e,t,n,r,s,c){pt(e,s,c);for(let i=0;i<t.length;i++)e.push({value:t[i],at:$e(s,c,r[i]),easing:Ne(n,i)})}function gt(e,t,n=0){const r=t+1+t*n;for(let s=0;s<e.length;s++)e[s]=e[s]/r}function xt(e,t){return e.at===t.at?e.value===null?1:t.value===null?-1:0:e.at-t.at}const yt="easeInOut",bt=20;function vt(e,{defaultTransition:t={},...n}={},r,s){const c=t.duration||.3,i=new Map,f=new Map,m={},p=new Map;let g=0,u=0,x=0;for(let N=0;N<e.length;N++){const k=e[N];if(typeof k=="string"){p.set(k,u);continue}else if(!Array.isArray(k)){p.set(k.name,me(u,k.at,g,p));continue}let[E,b,v={}]=k;v.at!==void 0&&(u=me(u,v.at,g,p));let j=0;const _=(w,M,A,o=0,l=0)=>{const d=jt(w),{delay:D=0,times:y=Oe(d),type:R=t.type||"keyframes",repeat:B,repeatType:W,repeatDelay:H=0,...Se}=M;let{ease:I=t.ease||"easeOut",duration:S}=M;const Z=typeof D=="function"?D(o,l):D,q=d.length,J=Ke(R)?R:s?.[R||"keyframes"];if(q<=2&&J){let $=100;if(q===2&&wt(d)){const P=d[1]-d[0];$=Math.abs(P)}const O={...t,...Se};S!==void 0&&(O.duration=Ce(S));const X=Re(O,$,J);I=X.ease,S=X.duration}S??(S=c);const Q=u+Z;y.length===1&&y[0]===0&&(y[1]=1);const ee=y.length-d.length;if(ee>0&&Be(y,ee),d.length===1&&d.unshift(null),B&&B<bt){const $=S>0?H/S:0;S=ft(S,B,H);const O=[...d],X=[...y];I=Array.isArray(I)?[...I]:[I];const P=[...I],ne=W==="reverse"||W==="mirror";let re=O,ae=P;ne&&(re=[...O].reverse(),W==="reverse"&&(ae=[...P].reverse().map(V=>typeof V=="function"?Pe(V):V)));for(let V=0;V<B;V++){const se=ne&&V%2===0,ie=se?re:O,Ee=se?ae:P,oe=(V+1)*(1+$);$>0&&(d.push(d[d.length-1]),y.push(oe),I.push("linear")),d.push(...ie);for(let K=0;K<ie.length;K++)y.push(X[K]+oe),I.push(K===0?"linear":Ne(Ee,K-1))}gt(y,B,$)}const te=Q+S;ht(A,d,I,y,Q,te),j=Math.max(Z+S,j),x=Math.max(te,x)};if(ve(E)){const w=fe(E,f);_(b,v,pe("default",w))}else{const w=ke(E,b,r,m),M=w.length;for(let A=0;A<M;A++){b=b,v=v;const o=w[A],l=fe(o,f);for(const d in b)_(b[d],Nt(v,d),pe(d,l),A,M)}}g=u,u+=j}return f.forEach((N,k)=>{for(const E in N){const b=N[E];b.sort(xt);const v=[],j=[],_=[];for(let o=0;o<b.length;o++){const{at:l,value:d,easing:D}=b[o];v.push(d),j.push(Fe(0,x,l)),_.push(D||"easeOut")}j[0]!==0&&(j.unshift(0),v.unshift(v[0]),_.unshift(yt)),j[j.length-1]!==1&&(j.push(1),v.push(null)),i.has(k)||i.set(k,{keyframes:{},transition:{}});const w=i.get(k);w.keyframes[E]=v;const{type:M,...A}=t;w.transition[E]={...A,duration:x,ease:_,times:j,...n}}}),i}function fe(e,t){return!t.has(e)&&t.set(e,{}),t.get(e)}function pe(e,t){return t[e]||(t[e]=[]),t[e]}function jt(e){return Array.isArray(e)?e:[e]}function Nt(e,t){return e&&e[t]?{...e,...e[t]}:{...e}}const kt=e=>typeof e=="number",wt=e=>e.every(kt);function At(e){const t={presenceContext:null,props:{},visualState:{renderState:{transform:{},transformOrigin:{},style:{},vars:{},attrs:{}},latestValues:{}}},n=Le(e)&&!Xe(e)?new Ge(t):new We(t);n.mount(e),G.set(e,n)}function St(e){const t={presenceContext:null,props:{},visualState:{renderState:{output:{}},latestValues:{}}},n=new mt(t);n.mount(e),G.set(e,n)}function Et(e,t){return ve(e)||typeof e=="number"||typeof e=="string"&&!Y(t)}function we(e,t,n,r){const s=[];if(Et(e,t))s.push(ze(e,Y(t)&&t.default||t,n&&(n.default||n)));else{if(e==null)return s;const c=ke(e,t,r),i=c.length;for(let f=0;f<i;f++){const m=c[f],p=m instanceof Element?At:St;G.has(m)||p(m);const g=G.get(m),u={...n};"delay"in u&&typeof u.delay=="function"&&(u.delay=u.delay(f,i)),s.push(...Ue(g,{...t,transition:u},{}))}}return s}function Dt(e,t,n){const r=[],s=e.map(i=>{if(Array.isArray(i)&&typeof i[0]=="function"){const f=i[0],m=Ye(0);return m.on("change",f),i.length===1?[m,[0,1]]:i.length===2?[m,[0,1],i[1]]:[m,i[1],i[2]]}return i});return vt(s,t,n,{spring:He}).forEach(({keyframes:i,transition:f},m)=>{r.push(...we(m,i,f))}),r}function It(e){return Array.isArray(e)&&e.some(Array.isArray)}function _t(e={}){const{scope:t,reduceMotion:n,skipAnimations:r}=e;function s(c,i,f){let m=[],p;const g={};if(n!==void 0&&(g.reduceMotion=n),r!==void 0&&(g.skipAnimations=r),It(c)){const{onComplete:x,...N}=i||{};typeof x=="function"&&(p=x),m=Dt(c,{...g,...N},t)}else{const{onComplete:x,...N}=f||{};typeof x=="function"&&(p=x),m=we(c,i,{...g,...N},t)}const u=new ut(m);return p&&u.finished.then(p),t&&(t.animations.push(u),u.finished.then(()=>{be(t.animations,u)})),u}return s}const F=_t(),he=8;function Mt({badgeId:e,tier:t,locked:n=!1,size:r=176,backLines:s=[],label:c}){const i=Qe(0),f=et(),m=L.useRef(null),p=L.useRef(null),g=L.useRef(!1),u=qe(t,n),x=je.get(e)?.icon||null,N=z(i,o=>`${(o%360+360)%360/360*160-80}%`),k=z(i,o=>`${80-(o%360+360)%360/360*160}%`),E=z(i,o=>{const l=Math.abs(Math.sin(o*Math.PI/180));return Math.max(0,(l-.35)/.65)*.3}),b=()=>{p.current?.stop?.(),p.current=null};L.useEffect(()=>{if(f||g.current)return;let o=!1;i.set(-360);const l=F(i,0,{duration:.9,ease:[.16,1,.3,1]});return p.current=l,l.then(()=>{o||g.current||(p.current=F(i,[0,-14,14,0],{duration:4.5,repeat:1/0,ease:"easeInOut"}))}),()=>{o=!0,b()}},[f,i]);const v=o=>{const l=i.get();if(f){const y=Math.round(l/180)*180;p.current=F(i,y,{duration:.2,ease:"easeOut"});return}const d=l+o*.35,D=Math.round(d/180)*180;p.current=F(i,D,{type:"spring",velocity:o,stiffness:58,damping:13.5,mass:1})},j=o=>{g.current=!0,b(),o.currentTarget.setPointerCapture?.(o.pointerId),m.current={pointerId:o.pointerId,startX:o.clientX,startRot:i.get(),samples:[{t:o.timeStamp,x:o.clientX}]}},_=o=>{const l=m.current;!l||l.pointerId!==o.pointerId||(i.set(l.startRot+(o.clientX-l.startX)*.55),l.samples.push({t:o.timeStamp,x:o.clientX}),l.samples.length>5&&l.samples.shift())},w=o=>{const l=m.current;if(!l||l.pointerId!==o.pointerId)return;m.current=null;const d=l.samples[0],D=l.samples[l.samples.length-1],y=D.t-d.t,R=y>0?(D.x-d.x)*.55*1e3/y:0;v(R)},M=o=>{if(o.key!=="ArrowLeft"&&o.key!=="ArrowRight")return;o.preventDefault(),g.current=!0,b();const l=o.key==="ArrowRight"?30:-30;p.current=F(i,i.get()+l,{duration:.15,ease:"easeOut"})},A={backfaceVisibility:"hidden",WebkitBackfaceVisibility:"hidden"};return a.jsx("div",{role:"img","aria-label":c,tabIndex:0,onPointerDown:j,onPointerMove:_,onPointerUp:w,onPointerCancel:w,onKeyDown:M,className:"inline-flex cursor-grab select-none items-center justify-center outline-none focus-visible:ring-2 focus-visible:ring-oai-brand/60 rounded-full active:cursor-grabbing",style:{perspective:900,touchAction:"pan-y"},children:a.jsxs("div",{className:"relative",style:{transform:"rotateX(-8deg)",transformStyle:"preserve-3d"},children:[a.jsxs(C.div,{className:"relative",style:{rotateY:i,transformStyle:"preserve-3d",width:r,height:r},children:[[-3,-1.5,0,1.5,3].map(o=>a.jsx("div",{"aria-hidden":!0,className:"absolute inset-0 rounded-full",style:{transform:`translateZ(${o}px)`,background:u.rim[1]}},o)),a.jsxs("div",{className:"absolute inset-0 overflow-hidden rounded-full",style:{...A,transform:`translateZ(${he/2}px)`},children:[a.jsx(Ze,{badgeId:e,tier:t,locked:n,size:"fill",className:"brightness-105 saturate-[1.08]"}),a.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 rounded-full",style:{background:"radial-gradient(circle at 30% 20%, rgba(255,255,255,0.45), rgba(255,255,255,0) 42%), linear-gradient(172deg, rgba(255,255,255,0.14) 0%, rgba(255,255,255,0) 38%, rgba(0,0,0,0.08) 100%)",boxShadow:"inset 0 3px 7px rgba(255,255,255,0.5), inset 0 -3px 8px rgba(0,0,0,0.15)"}}),a.jsx(C.div,{"aria-hidden":!0,className:"pointer-events-none absolute inset-0",style:{x:N,background:"linear-gradient(105deg, transparent 34%, rgba(255,255,255,0.5) 50%, transparent 66%)"}}),a.jsx(C.div,{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 rounded-full",style:{opacity:E,background:"rgba(8, 12, 10, 0.9)"}})]}),a.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-1 overflow-hidden rounded-full px-6 text-center",style:{...A,transform:`rotateY(180deg) translateZ(${he/2}px)`,background:`linear-gradient(145deg, ${u.face[0]}, ${u.face[1]})`,boxShadow:`inset 0 0 0 6px ${u.rim[1]}, inset 0 0 0 7.5px rgba(255,255,255,0.22), inset 0 3px 7px rgba(255,255,255,0.4), inset 0 -4px 12px rgba(0,0,0,0.22)`},children:[a.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 rounded-full",style:{background:"repeating-radial-gradient(circle at 50% 50%, rgba(255,255,255,0.06) 0px, rgba(255,255,255,0.06) 1px, transparent 1px, transparent 4px)"}}),x?a.jsx(x,{"aria-hidden":!0,size:Math.round(r*.62),strokeWidth:1.1,color:u.glyph,className:"pointer-events-none absolute opacity-[0.13]",style:{filter:"drop-shadow(0 1px 0 rgba(255,255,255,0.3)) drop-shadow(0 -1px 0 rgba(0,0,0,0.35))"}}):null,a.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 rounded-full",style:{background:"radial-gradient(circle at 70% 20%, rgba(255,255,255,0.4), rgba(255,255,255,0) 44%), linear-gradient(188deg, rgba(255,255,255,0.12) 0%, rgba(255,255,255,0) 38%, rgba(0,0,0,0.10) 100%)"}}),s.map((o,l)=>a.jsx("div",{className:`font-mono tabular-nums ${l===0?"text-[10px] uppercase tracking-[0.18em]":l===1?"text-lg font-bold":"text-[11px]"}`,style:{color:u.glyph,textShadow:"0 1px 0 rgba(255,255,255,0.28), 0 -1px 0 rgba(0,0,0,0.3)"},children:o},`${l}-${o}`)),a.jsx(C.div,{"aria-hidden":!0,className:"pointer-events-none absolute inset-0",style:{x:k,background:"linear-gradient(105deg, transparent 34%, rgba(255,255,255,0.45) 50%, transparent 66%)"}}),a.jsx(C.div,{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 rounded-full",style:{opacity:E,background:"rgba(8, 12, 10, 0.9)"}})]})]}),a.jsx("div",{"aria-hidden":!0,className:"absolute left-1/2 h-3 w-3/5 rounded-[100%] bg-black/20 blur-md dark:bg-black/45",style:{bottom:-20,transform:"translateX(-50%)"}})]})})}function Ae(e){if(!e)return null;const t=Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleDateString():null}function Vt(e){const t=Number(e);return!Number.isSafeInteger(t)||t<1?null:String(t).padStart(6,"0")}function Tt(e,t,n){if(t?.scope!=="cloud"||!n)return null;const r=Number(e?.serials?.[n]);return Number.isSafeInteger(r)&&r>=1?r:null}function $t({badge:e}){return a.jsx("div",{className:"flex items-center gap-1",children:Je.map((t,n)=>{const r=(e.tier||0)>=n+1,s=Ae(e.achieved?.[t]),c=T[t];return a.jsx("span",{title:s?`${h(`achievements.tier.${t}`)} · ${s}`:h(`achievements.tier.${t}`),className:"inline-flex h-2 w-8 rounded-full",style:r?{background:`linear-gradient(120deg, ${c.rim[0]} 0%, ${c.ring} 55%, ${c.rim[1]} 100%)`,boxShadow:"inset 0 1px 1px rgba(255,255,255,0.4), 0 0 0 1px rgba(10,15,12,0.05)"}:void 0,children:!r&&a.jsx("span",{className:"h-full w-full rounded-full bg-oai-gray-200 dark:bg-oai-gray-800"})},t)})})}function ge({badge:e,onClose:t}){const n=je.get(e.id),r=h(U(e.id,"name")),s=(e.tier||0)>=1,c=s?le(e.tier):null,i=Ae(s?e.achieved?.[c]||(ce(e)?new Date(ce(e)).toISOString():null):null),f=ue(n?.format,e.metric_value),m=tt(e),p=e.tier<4?le((e.tier||0)+1):null,g=Tt(e,n,c),u=Vt(g),x=u?[h("achievements.modal.achieved_label"),h("achievements.modal.issue_number",{number:u}),i||r]:[s?h("achievements.modal.achieved_label"):h("achievements.modal.locked"),s?f:"···",s&&i?i:r];return a.jsxs("div",{className:"flex flex-col items-center px-6 pb-6 pt-5 text-center",children:[a.jsxs("div",{className:"flex w-full items-start justify-between gap-3",children:[a.jsxs("div",{className:"min-w-0 flex-1 text-left",children:[a.jsx("h2",{className:"truncate text-lg font-semibold tracking-tight text-oai-black dark:text-white",children:r}),a.jsx("p",{className:"mt-0.5 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:h(U(e.id,"desc"))})]}),a.jsx("button",{type:"button",onClick:t,"aria-label":h("achievements.modal.close"),className:"shrink-0 rounded-md p-1.5 text-oai-gray-400 transition-colors hover:bg-oai-gray-100 hover:text-oai-gray-700 dark:hover:bg-oai-gray-900 dark:hover:text-oai-gray-200",children:a.jsx(Ie,{size:16})})]}),a.jsx("div",{className:"mt-5 mb-7",children:a.jsx(Mt,{badgeId:e.id,tier:e.tier,locked:!s,backLines:x,label:h("achievements.modal.coin_aria",{name:r})})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"rounded-full px-2.5 py-0.5 text-[11px] font-semibold uppercase tracking-wide",style:s?{background:`linear-gradient(120deg, ${T[c].rim[0]} 0%, ${T[c].ring} 55%, ${T[c].rim[1]} 100%)`,color:T[c].glyph,textShadow:"0 1px 0 rgba(255,255,255,0.35)",boxShadow:"inset 0 1px 1px rgba(255,255,255,0.4), 0 0 0 1px rgba(10,15,12,0.06)"}:{background:"rgba(128,134,130,0.75)",color:"rgba(250,250,250,0.95)"},children:s?h(`achievements.tier.${c}`):h("achievements.modal.locked")}),s&&i?a.jsx("span",{className:"text-xs tabular-nums text-oai-gray-500 dark:text-oai-gray-400",children:i}):null]}),a.jsxs("dl",{className:"mt-5 w-full space-y-3 border-t border-oai-gray-200/70 pt-4 text-left dark:border-oai-gray-800/60",children:[a.jsxs("div",{className:"flex items-baseline justify-between gap-3 text-sm",children:[a.jsx("dt",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:h("achievements.modal.value_label")}),a.jsx("dd",{className:"font-mono font-semibold tabular-nums text-oai-black dark:text-white",children:f})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-baseline justify-between gap-3 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:[a.jsx("span",{children:e.tier>=4?h("achievements.modal.max_tier"):h("achievements.modal.progress_to_next",{tier:h(`achievements.tier.${p}`)})}),e.tier<4&&e.next_threshold!=null?a.jsxs("span",{className:"font-mono tabular-nums",children:[f," ",e.lower_is_better?"→":"/"," ",ue(n?.format,e.next_threshold)]}):null]}),a.jsx("div",{className:"mt-1.5 h-1.5 w-full overflow-hidden rounded-full bg-oai-gray-200 dark:bg-oai-gray-800",children:a.jsx("div",{className:"h-full rounded-full transition-[width] duration-500",style:{width:`${Math.round((e.tier>=4?1:m)*100)}%`,background:s?`linear-gradient(90deg, ${T[c].rim[0]} 0%, ${T[c].ring} 55%, ${T[c].rim[1]} 100%)`:"rgba(128,134,130,0.75)",boxShadow:s?"inset 0 1px 1px rgba(255,255,255,0.35)":void 0}})})]}),a.jsxs("div",{className:"flex items-center justify-between gap-3 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:[a.jsx("span",{children:h("achievements.modal.tier_history")}),a.jsx($t,{badge:e})]})]})]})}const xe=ye("relative w-full max-w-[380px] 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","dark:border-t dark:border-white/[0.08]");function Ut({badge:e,onClose:t}){const n=De(),r=!!e;return L.useEffect(()=>{if(!n||!r)return;const s=c=>{c.key==="Escape"&&(c.stopPropagation(),t?.())};return window.addEventListener("keydown",s,!0),()=>window.removeEventListener("keydown",s,!0)},[n,r,t]),r?n?a.jsxs("div",{className:"fixed inset-0 z-[120] flex items-center justify-center p-4",children:[a.jsx("div",{className:"absolute inset-0 bg-black/40 backdrop-blur-[2px]",onClick:t,"aria-hidden":!0}),a.jsx("div",{className:xe,children:a.jsx(ge,{badge:e,onClose:t})})]}):a.jsx(nt,{open:!0,onOpenChange:s=>{s||t?.()},children:a.jsxs(rt,{children:[a.jsx(at,{className:"cost-modal-backdrop z-[110]"}),a.jsx(st,{className:"fixed inset-0 z-[120] flex items-center justify-center p-4",children:a.jsxs(it,{className:ye("cost-modal-popup",xe),children:[a.jsx(ot,{render:a.jsx("h2",{className:"sr-only"}),children:h(U(e.id,"name"))}),a.jsx(ge,{badge:e,onClose:t})]})})]})}):null}export{Ut as BadgeDetailModal,Tt as currentBadgeIssueNumber,Ut as default,Vt as formatIssueNumber};
import{j as r,d as e}from"./__vite-browser-external-CuMc3dqk.js";function n({children:i,title:a,subtitle:o,className:s="",bodyClassName:d=""}){return r.jsxs("div",{className:e("rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 transition-colors duration-200",s),children:[(a||o)&&r.jsxs("div",{className:"px-5 py-4 border-b border-oai-gray-200 dark:border-oai-gray-800 transition-colors duration-200",children:[a&&r.jsx("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide transition-colors duration-200",children:a}),o&&r.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-300 mt-1 transition-colors duration-200",children:o})]}),r.jsx("div",{className:`p-5 ${d}`,children:i})]})}export{n as C};
import{l as c}from"./__vite-browser-external-CuMc3dqk.js";const e=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],t=c("check",e);export{t as C};
import{l as o}from"./__vite-browser-external-CuMc3dqk.js";const t=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],c=o("chevron-right",t);export{c as C};
import{r,j as f}from"./__vite-browser-external-CuMc3dqk.js";function p(e){const n=String(e||"").trim().toLowerCase();return/^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$/.test(n)?n:"clawd"}const C=.84;function L(e){return p(e)==="clawd"?C:1}const z={idle:{row:0,durations:[280,110,110,140,140,320]},"running-right":{row:1,durations:[120,120,120,120,120,120,120,220]},"running-left":{row:2,durations:[120,120,120,120,120,120,120,220]},waving:{row:3,durations:[140,140,140,280]},jumping:{row:4,durations:[140,140,140,140,280]},failed:{row:5,durations:[140,140,140,140,140,140,140,240]},waiting:{row:6,durations:[150,150,150,150,150,260]},running:{row:7,durations:[120,120,120,120,120,220]},review:{row:8,durations:[150,150,150,150,150,280]}};function T(e){return["error","disconnected","working-overheated"].includes(e)?"failed":["happy","waking","mini-happy","jumping"].includes(e)?"jumping":["working-typing","working-ultrathink","working-juggling","running"].includes(e)?"running":["working-thinking","working-wizard","review"].includes(e)?"review":["sleeping","idle-doze","mini-sleep","waiting"].includes(e)?"waiting":["mini-peek","waving"].includes(e)?"waving":e==="running-left"||e==="running-right"?e:"idle"}function V(){const[e,n]=r.useState(()=>typeof document>"u"?!0:document.visibilityState!=="hidden");return r.useEffect(()=>{if(typeof document>"u")return;const t=()=>n(document.visibilityState!=="hidden");return document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},[]),e}function _(){const[e,n]=r.useState(()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches);return r.useEffect(()=>{if(typeof window.matchMedia!="function")return;const t=window.matchMedia("(prefers-reduced-motion: reduce)"),i=o=>n(o.matches);return t.addEventListener("change",i),()=>t.removeEventListener("change",i)},[]),e}function I({character:e,pet:n=null,state:t="idle-living",dragState:i=null,size:o=48,className:d="",lookDirectionIndex:u=null}){const l=p(e),g=i==="running-left"||i==="running-right"?i:T(t),a=z[g],s=n?.spriteVersionNumber===2?2:1,w=s===2?11:9,c=s===2&&g==="idle"&&Number.isInteger(u)?(u%16+16)%16:null,h=c==null?a.row:9+Math.floor(c/8),m=c==null?null:c%8,k=_(),y=V(),[b,S]=r.useState(0);r.useEffect(()=>{if(S(0),k||!y||c!=null)return;let M=!1,x=0;const E=$=>{x=window.setTimeout(()=>{if(M)return;const j=($+1)%a.durations.length;S(j),E(j)},a.durations[$])};return E(0),()=>{M=!0,window.clearTimeout(x)}},[c,k,y,a]);const A=r.useMemo(()=>({width:o*(192/208),height:o,backgroundImage:`url(${n?.assetUrl||`/pets/${l}/spritesheet.webp`})`,backgroundRepeat:"no-repeat",backgroundSize:`800% ${w*100}%`,backgroundPosition:`${(m??b)/7*100}% ${h/(w-1)*100}%`,imageRendering:"pixelated"}),[w,m,h,b,l,n?.assetUrl,o]);return f.jsx("div",{"aria-hidden":"true",className:`pet-atlas-animated ${d}`,style:A})}const R={"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"},v=new Map;async function P(e){if(v.has(e))return v.get(e);if(typeof fetch!="function")return null;let n;try{n=await fetch(`/clawd/${e}`)}catch{return null}if(!n.ok)return null;const i=(await n.text()).replace(/<svg([^>]*)>/,(o,d)=>`<svg${d.replace(/\s+width="[^"]*"/g,"").replace(/\s+height="[^"]*"/g,"")} width="100%" height="100%">`);return v.set(e,i),i}function H({state:e="idle-living",size:n=48,className:t=""}){const[i,o]=r.useState(""),d=r.useRef(null),l=N()?"static-base":e,g=R[l]||R["static-base"];return r.useEffect(()=>{let a=!1;return P(g).then(s=>{!a&&s&&o(s)}),()=>{a=!0}},[g]),r.useEffect(()=>{const a=d.current?.querySelector("svg");if(a)try{const s=a.getBBox();s.width>0&&s.height>0&&a.setAttribute("viewBox",`${s.x-2} ${s.y-2} ${s.width+4} ${s.height+4}`)}catch{}},[i]),f.jsx("div",{ref:d,"aria-hidden":"true",className:`clawd-animated ${t}`,style:{width:n,height:n,display:"inline-flex",alignItems:"center",justifyContent:"center",overflow:"hidden"},dangerouslySetInnerHTML:{__html:i}})}function B({state:e="idle-living",size:n=48,className:t="",character:i="clawd",pet:o=null,lookDirectionIndex:d=null}){const u=p(i);return u!=="clawd"?f.jsx(I,{character:u,pet:o,state:e,size:n,className:t,lookDirectionIndex:d}):f.jsx(H,{state:e,size:n*L(u),className:t})}function N(){const[e,n]=r.useState(()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches);return r.useEffect(()=>{if(typeof window.matchMedia!="function")return;const t=window.matchMedia("(prefers-reduced-motion: reduce)"),i=o=>n(o.matches);return t.addEventListener("change",i),()=>t.removeEventListener("change",i)},[]),e}export{B as C,p as n};
import{l as M,e as D,r,F as E,c as i,j as o,d as I}from"./__vite-browser-external-CuMc3dqk.js";import{m as j}from"./react-B80AX8fE.js";import{P as L}from"./ProviderIcon-B6sgfDtI.js";import{g as A}from"./skills-api-CGL-iHOO.js";import{S as $}from"./search-DtGZgKCk.js";import{u as R}from"./use-reduced-motion-BEAopWkx.js";import{A as K}from"./index-jpsn86uT.js";const q=[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]],O=M("corner-down-left",q),T=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");function Q(){const f=D(),d=R(),[u,g]=r.useState(!1),[x,h]=r.useState(""),[n,l]=r.useState(0),[p,k]=r.useState([]),b=r.useRef(null),w=r.useRef(null);r.useEffect(()=>{const e=t=>{(t.metaKey||t.ctrlKey)&&(t.key==="k"||t.key==="K")&&(t.preventDefault(),g(c=>!c))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]),r.useEffect(()=>{if(!u)return;h(""),l(0);const e=requestAnimationFrame(()=>b.current?.focus());return T&&!p.length&&A().then(t=>k(t?.skills||[])).catch(()=>k([])),()=>cancelAnimationFrame(e)},[u,p.length]);const y=r.useMemo(()=>{const e=E().flatMap(a=>a.items.map(c=>({kind:"page",id:`page:${c.id}`,label:c.label,sub:i("cmdk.group.pages"),Icon:c.icon,run:()=>f(c.to)}))),t=(p||[]).map(a=>({kind:"skill",id:`skill:${a.id||a.directory}`,label:a.name||a.directory,sub:a.repoOwner&&a.repoName?`${a.repoOwner}/${a.repoName}`:i("cmdk.group.skills"),provider:(a.targets||[])[0]||"claude",run:()=>f(`/skills?skill=${encodeURIComponent(a.directory||a.id)}`)}));return[...e,...t]},[f,p]),s=r.useMemo(()=>{const e=x.trim().toLowerCase();return e?y.filter(t=>t.label.toLowerCase().includes(e)||String(t.sub||"").toLowerCase().includes(e)):y},[y,x]);r.useEffect(()=>{n>=s.length&&l(s.length?s.length-1:0)},[n,s.length]),r.useEffect(()=>{if(!u)return;w.current?.querySelector(`[data-cmdk-index="${n}"]`)?.scrollIntoView({block:"nearest"})},[n,u]);const m=r.useCallback(()=>g(!1),[]),v=r.useCallback(e=>{e&&(m(),e.run())},[m]),N=e=>{e.key==="ArrowDown"?(e.preventDefault(),l(t=>Math.min(t+1,Math.max(0,s.length-1)))):e.key==="ArrowUp"?(e.preventDefault(),l(t=>Math.max(t-1,0))):e.key==="Enter"?(e.preventDefault(),v(s[n])):e.key==="Escape"&&(e.preventDefault(),m())},C={duration:d?0:.12},S=d?{duration:0}:{type:"spring",stiffness:460,damping:34,mass:.6};return o.jsx(K,{children:u?o.jsxs(j.div,{className:"fixed inset-0 z-[120] flex items-start justify-center px-4 pt-[16vh]",initial:d?!1:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:C,children:[o.jsx("button",{type:"button","aria-label":i("cmdk.close"),onClick:m,className:"absolute inset-0 cursor-default bg-oai-black/40"}),o.jsxs(j.div,{role:"dialog","aria-modal":"true","aria-label":i("cmdk.open_aria"),initial:d?!1:{opacity:0,y:-8,scale:.985},animate:{opacity:1,y:0,scale:1},exit:d?{opacity:0}:{opacity:0,y:-8,scale:.985},transition:S,className:"relative w-full max-w-xl overflow-hidden rounded-2xl border border-oai-gray-200 bg-oai-white shadow-2xl dark:border-oai-gray-800 dark:bg-oai-gray-950",children:[o.jsxs("div",{className:"flex items-center gap-2.5 border-b border-oai-gray-200 px-4 dark:border-oai-gray-800",children:[o.jsx($,{className:"h-4 w-4 shrink-0 text-oai-gray-400","aria-hidden":!0}),o.jsx("input",{ref:b,type:"text",value:x,onChange:e=>{h(e.target.value),l(0)},onKeyDown:N,"aria-label":i("cmdk.placeholder"),"aria-controls":"cmdk-listbox","aria-activedescendant":s[n]?`cmdk-opt-${n}`:void 0,role:"combobox","aria-expanded":"true",placeholder:i("cmdk.placeholder"),className:"h-12 w-full bg-transparent text-sm text-oai-black placeholder:text-oai-gray-400 focus:outline-none dark:text-white"})]}),o.jsx("div",{ref:w,id:"cmdk-listbox",role:"listbox",className:"max-h-[min(56vh,22rem)] overflow-y-auto p-1.5",children:s.length===0?o.jsx("div",{className:"px-3 py-8 text-center text-sm text-oai-gray-500 dark:text-oai-gray-400",children:i("cmdk.empty")}):s.map((e,t)=>{const a=t===n;return o.jsxs("button",{type:"button",role:"option",id:`cmdk-opt-${t}`,"data-cmdk-index":t,"aria-selected":a,onMouseMove:()=>l(t),onClick:()=>v(e),className:I("flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-sm transition-colors",a?"bg-oai-gray-100 text-oai-black dark:bg-oai-gray-800/70 dark:text-white":"text-oai-gray-700 dark:text-oai-gray-200"),children:[o.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center text-oai-gray-500 dark:text-oai-gray-400",children:e.kind==="skill"?o.jsx(L,{provider:e.provider,size:16}):o.jsx(e.Icon,{className:"h-4 w-4","aria-hidden":!0})}),o.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:e.label}),o.jsx("span",{className:"shrink-0 truncate text-xs text-oai-gray-400 dark:text-oai-gray-500",children:e.sub}),a?o.jsx(O,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-400","aria-hidden":!0}):null]},e.id)})})]})]}):null})}export{Q as CommandPalette};
import{l as L,j as e,U as R,m as P,r as D,c as n,X as z,k as S}from"./__vite-browser-external-CuMc3dqk.js";import{m as M}from"./react-B80AX8fE.js";import{A as K,W as U}from"./icons-D2Ro70sQ.js";import{u as B}from"./useTokenFormat-BkFEXBXZ.js";import{P as F}from"./ProviderIcon-B6sgfDtI.js";import{T as G}from"./TrendMonitor-Bxy1Vnax.js";import{T as W}from"./AchievementBadge-DvulAUrw.js";import{T as V}from"./terminal-d0IOaeZn.js";import{D as X,a as Y,b as Z,c as H,d as q,e as J}from"./DialogTitle-KxLDeLzC.js";import{D as Q}from"./DialogDescription-BgYqW0_C.js";import{D as ee}from"./DialogClose-DmGnH7p-.js";import"./useCurrency-DdWYV5RR.js";import"./chevron-right-D1F23F5W.js";import"./PopoverPopup-B6oEN7QL.js";import"./useScrollLock-DmM-LeMm.js";import"./store-NtnkxrS2.js";import"./ToolbarRootContext-xOR5ZEzv.js";import"./maximize-2-BZX57ABx.js";import"./use-reduced-motion-BEAopWkx.js";import"./zap-CcqNcNpw.js";import"./flame-VQYtrvgY.js";const ae=[["path",{d:"M16 17h6v-6",key:"t6n2it"}],["path",{d:"m22 17-8.5-8.5-5 5L2 7",key:"x473p"}]],te=L("trending-down",ae),O=10,_={input:"var(--community-token-input)",cache_read:"var(--community-token-cache-read)",cache_write:"var(--community-token-cache-write)",output:"var(--community-token-output)",reasoning:"var(--community-token-reasoning)"},re={CLAUDE:"var(--community-claude)",CODEX:"var(--community-codex)",GEMINI:"var(--community-gemini)",CURSOR:"var(--community-cursor)",OPENCODE:"var(--community-opencode)",HERMES:"var(--community-hermes)",KIMI:"var(--community-kimi)",MIMO:"var(--community-mimo)",COPILOT:"var(--community-copilot)",KIRO:"var(--community-kiro)",GROK:"var(--community-grok)",DEEPSEEK:"var(--community-deepseek)",ZCODE:"var(--community-zcode)",WORKBUDDY:"var(--community-workbuddy)",MINIMAX:"var(--community-minimax)",DROID:"var(--community-droid)"};function ie(t){return re[String(t||"").toUpperCase()]||"var(--community-muted)"}const se=[[/claude|fable|opus|sonnet|haiku/,"CLAUDE"],[/gpt|codex|o3|o4/,"CODEX"],[/gemini/,"GEMINI"],[/composer|cursor/,"CURSOR"],[/kimi/,"KIMI"],[/mimo/,"MIMO"],[/copilot/,"COPILOT"],[/kiro/,"KIRO"],[/grok/,"GROK"],[/deepseek/,"DEEPSEEK"],[/glm/,"ZCODE"],[/hy3/,"WORKBUDDY"],[/minimax/,"MINIMAX"]],g=["overview","providers","community","models"];function oe(t){const s=String(t||"").toLowerCase(),a=se.find(([i])=>i.test(s));return a?a[1]:""}function u(t){const s=Number(t);return Number.isFinite(s)?`${s.toFixed(1)}%`:"—"}function p(t){return S(Number(t)||0)}function ne(t){return t?new Date(`${t}T00:00:00Z`).toLocaleDateString(void 0,{month:"short",day:"numeric",timeZone:"UTC"}):""}function k(){return e.jsx("div",{className:"flex h-full min-h-40 items-center justify-center text-xs text-oai-gray-400",children:n("leaderboard.community.modal.no_data")})}function b({children:t,detail:s}){return e.jsxs("div",{className:"mb-3 flex items-baseline justify-between gap-4",children:[e.jsx("h3",{className:"text-xs font-medium uppercase tracking-wide text-oai-gray-500 dark:text-oai-gray-400",children:t}),s?e.jsx("span",{className:"text-xs text-oai-gray-400",children:s}):null]})}function C({value:t,label:s}){const a=Number(t);if(!Number.isFinite(a))return null;const i=Math.sign(a)!==-1,r=i?W:te;return e.jsxs("span",{className:`inline-flex items-center gap-1 text-xs font-medium tabular-nums ${i?"text-emerald-600 dark:text-emerald-400":"text-rose-600 dark:text-rose-400"}`,title:s,children:[e.jsx(r,{className:"size-3","aria-hidden":"true"}),i?"+":"",a.toFixed(1),"%"]})}function j({label:t,value:s,title:a,delta:i,deltaLabel:r}){return e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-xs font-medium text-oai-gray-500 dark:text-oai-gray-400",children:t}),e.jsxs("div",{className:"mt-1 flex min-w-0 items-baseline gap-2",children:[e.jsx("span",{className:"truncate text-xl font-semibold leading-none tracking-tight text-oai-black tabular-nums dark:text-white",title:a,children:s}),e.jsx(C,{value:i,label:r})]})]})}function I({fillWidth:t,share:s,color:a="var(--oai-blue)",ariaLabel:i,dataAttrs:r,children:o}){return e.jsxs("div",{...r,className:"group relative grid min-h-11 grid-cols-[minmax(0,1fr)_auto] items-center gap-3 overflow-hidden px-2.5 transition-colors hover:bg-oai-gray-50 dark:hover:bg-oai-gray-900/60",children:[e.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-0 opacity-[0.15] transition-opacity group-hover:opacity-[0.22] dark:opacity-[0.24] dark:group-hover:opacity-[0.32]",style:{width:`${t}%`,backgroundColor:a},role:"progressbar","aria-label":i,"aria-valuemin":"0","aria-valuemax":"100","aria-valuenow":Number(s)||0}),o]})}function A({rank:t,provider:s,name:a,fillWidth:i,share:r,tokens:o,tokensTitle:l,dataAttrs:c}){return e.jsxs(I,{fillWidth:i,share:r,color:ie(s),ariaLabel:`${a} ${u(r)}`,dataAttrs:c,children:[e.jsxs("div",{className:"relative flex min-w-0 items-center gap-2.5",children:[e.jsx("span",{className:`w-5 shrink-0 text-xs tabular-nums ${t<=3?"font-semibold text-oai-gray-700 dark:text-oai-gray-200":"text-oai-gray-400"}`,children:t}),e.jsx("span",{className:"grid size-6 shrink-0 place-items-center text-oai-gray-700 dark:text-oai-gray-200",children:e.jsx(F,{provider:s,size:15})}),e.jsx("span",{className:"truncate text-xs font-medium text-oai-gray-700 dark:text-oai-gray-200",title:a,children:a})]}),e.jsxs("div",{className:"relative min-w-[4.5rem] text-right",children:[e.jsx("div",{className:"text-xs font-semibold text-oai-black tabular-nums dark:text-white",title:l,children:o}),e.jsx("div",{className:"text-xs text-oai-gray-500 tabular-nums dark:text-oai-gray-400",children:u(r)})]})]})}function le({rows:t,formatTokensTooltip:s}){return t.length?e.jsxs("div",{className:"mt-7",children:[e.jsx(b,{children:n("leaderboard.community.modal.token_mix")}),e.jsx("div",{className:"flex h-1.5 overflow-hidden bg-oai-gray-100 dark:bg-oai-gray-800",children:t.map(a=>e.jsx("div",{style:{width:`${Math.max(Number(a.share)||0,0)}%`,backgroundColor:_[a.key]||"var(--community-muted)"},title:`${n(`leaderboard.community.modal.token_mix.${a.key}`)} · ${u(a.share)}`},a.key))}),e.jsx("div",{className:"mt-3 flex flex-wrap gap-x-5 gap-y-1.5",children:t.map(a=>e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs text-oai-gray-500 dark:text-oai-gray-400",title:s(a.tokens),children:[e.jsx("span",{className:"size-2",style:{backgroundColor:_[a.key]||"var(--community-muted)"}}),n(`leaderboard.community.modal.token_mix.${a.key}`),e.jsx("span",{className:"tabular-nums text-oai-gray-700 dark:text-oai-gray-200",children:u(a.share)})]},a.key))})]}):null}function f({label:t,value:s,title:a,delta:i,deltaLabel:r,className:o=""}){return e.jsxs("div",{className:`min-w-0 ${o}`,children:[e.jsx("div",{className:"truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:t}),e.jsxs("div",{className:"mt-1 flex min-w-0 items-baseline gap-2",children:[e.jsx("span",{className:"truncate text-base font-semibold leading-none tracking-tight tabular-nums text-oai-black dark:text-white",title:a,children:s}),e.jsx(C,{value:i,label:r})]})]})}function de({trendRows:t,activeDevelopers30d:s,developerGrowthPct:a,formatTokens:i,formatTokensTooltip:r}){if(!t.length)return null;const o=t.reduce((m,h)=>m+h.value,0),l=t.reduce((m,h)=>m.value<h.value?h:m,t[0]),c=o/t.length;return e.jsxs("div",{className:"mt-5 grid grid-cols-3 divide-x divide-oai-gray-100 border-y border-oai-gray-100 py-3.5 dark:divide-oai-gray-800/80 dark:border-oai-gray-800/80",children:[e.jsx(f,{className:"pr-4",label:n("leaderboard.community.modal.daily_average"),value:i(c),title:r(c)}),e.jsx(f,{className:"px-4",label:`${n("leaderboard.community.modal.peak_day")} · ${l.day}`,value:i(l.value),title:r(l.value)}),e.jsx(f,{className:"pl-4",label:n("leaderboard.community.modal.active_30d"),value:p(s),title:Number(s).toLocaleString(),delta:a,deltaLabel:n("leaderboard.community.modal.vs_previous_week")})]})}function me({trendRows:t,mix:s,activeDevelopers30d:a,developerGrowthPct:i,formatTokens:r,formatTokensTooltip:o}){return!t.length&&!s.length?e.jsx(k,{}):e.jsxs("div",{children:[e.jsx(b,{detail:n("leaderboard.community.modal.utc_note"),children:n("leaderboard.community.modal.community_activity")}),e.jsx(G,{embedded:!0,rows:t,from:t[0]?.day,to:t.at(-1)?.day,chartHeightClass:"h-44"}),e.jsx(de,{trendRows:t,activeDevelopers30d:a,developerGrowthPct:i,formatTokens:r,formatTokensTooltip:o}),e.jsx(le,{rows:s,formatTokensTooltip:o})]})}function ce({rows:t,maxShare:s,formatTokens:a,formatTokensTooltip:i}){return t.length?e.jsx("div",{className:"space-y-0.5",children:t.map((r,o)=>e.jsx(A,{rank:o+1,dataAttrs:{"data-provider-rank":o+1,"data-provider-name":r.name},provider:String(r.name).toUpperCase(),name:r.name,fillWidth:Math.max((Number(r.share)||0)/s*100,2),share:r.share,tokens:a(r.tokens),tokensTitle:i(r.tokens)},r.name))}):e.jsx(k,{})}function xe({rows:t,maxShare:s,formatTokens:a,formatTokensTooltip:i}){return t.length?e.jsx("div",{className:"space-y-0.5",children:t.map((r,o)=>{const l=Number(r.share)||0;return e.jsx(A,{rank:o+1,dataAttrs:{"data-model-rank":o+1,"data-model-name":r.name},provider:oe(r.name),name:r.name,fillWidth:Math.max(l/s*100,2),share:l,tokens:a(r.tokens),tokensTitle:i(r.tokens)},r.name)})}):e.jsx(k,{})}function ue({name:t}){const s=String(t||"").toLowerCase();return s==="darwin"?e.jsx(K,{className:"size-3.5"}):s==="win32"?e.jsx(U,{className:"size-3.5"}):e.jsx(V,{className:"size-4","aria-hidden":"true"})}const he=.175,ye=.3;function ge({bands:t,formatTokensTooltip:s}){const a=t.reduce((r,o)=>Math.max(r,Number(o.developer_share)||0),0)||1,i=r=>`${n(`leaderboard.community.modal.band.${r.key}`)} · ${n("leaderboard.community.modal.developer_count",{count:p(r.developers)})} (${s(r.tokens)})`;return e.jsxs("div",{children:[e.jsx("div",{className:"flex gap-2 border-b border-oai-gray-200 dark:border-oai-gray-800",children:t.map((r,o)=>{const l=Number(r.developer_share)||0,c=Math.max(l/a*80,2);return e.jsxs("div",{className:"relative h-32 min-w-0 flex-1",title:i(r),children:[e.jsx("div",{role:"progressbar","aria-label":n("leaderboard.community.modal.developer_share_title",{share:u(l)}),"aria-valuemin":"0","aria-valuemax":"100","aria-valuenow":l,className:"absolute inset-x-0 bottom-0",style:{height:`${c}%`,backgroundColor:"var(--oai-blue)",opacity:ye+o*he}}),e.jsx("div",{className:"absolute inset-x-0 text-center text-xs font-medium tabular-nums text-oai-gray-700 dark:text-oai-gray-200",style:{bottom:`calc(${c}% + 4px)`},children:u(l)})]},r.key)})}),e.jsx("div",{className:"mt-2 flex gap-2",children:t.map(r=>e.jsxs("div",{className:"min-w-0 flex-1 text-center",title:i(r),children:[e.jsx("div",{className:"truncate text-xs font-medium text-oai-gray-700 dark:text-oai-gray-200",children:n(`leaderboard.community.modal.band.${r.key}`)}),e.jsx("div",{className:"truncate text-xs tabular-nums text-oai-gray-500 dark:text-oai-gray-400",children:p(r.developers)})]},r.key))})]})}function pe({bands:t,platforms:s,formatTokensTooltip:a}){return!t.length&&!s.length?e.jsx(k,{}):e.jsxs("div",{className:"space-y-8",children:[t.length?e.jsxs("div",{children:[e.jsx(b,{children:n("leaderboard.community.modal.usage_distribution")}),e.jsx(ge,{bands:t,formatTokensTooltip:a})]}):null,s.length?e.jsxs("div",{children:[e.jsx(b,{children:n("leaderboard.community.modal.platforms")}),e.jsx("div",{className:"space-y-0.5",children:s.map(i=>e.jsxs(I,{fillWidth:Math.max(Number(i.share)||0,1),share:i.share,ariaLabel:`${n(`leaderboard.community.modal.platform.${i.name}`)} ${u(i.share)}`,children:[e.jsxs("div",{className:"relative flex min-w-0 items-center gap-2.5",children:[e.jsx("span",{className:"grid size-6 shrink-0 place-items-center text-oai-gray-700 dark:text-oai-gray-200",children:e.jsx(ue,{name:i.name})}),e.jsx("span",{className:"truncate text-xs font-medium text-oai-gray-700 dark:text-oai-gray-200",children:n(`leaderboard.community.modal.platform.${i.name}`)})]}),e.jsxs("div",{className:"relative min-w-[4.5rem] text-right",children:[e.jsx("div",{className:"text-xs font-semibold text-oai-black tabular-nums dark:text-white",children:u(i.share)}),e.jsx("div",{className:"text-xs text-oai-gray-500 tabular-nums dark:text-oai-gray-400",title:Number(i.machines||0).toLocaleString(),children:n("leaderboard.community.modal.machine_count",{count:p(i.machines)})})]})]},i.name))})]}):null]})}function ve({isOpen:t,onClose:s,communityStats:a}){const{formatTokens:i,formatTokensTooltip:r}=B(),[o,l]=D.useState("overview"),c=a?.status==="ready",m=D.useMemo(()=>{if(!c)return null;const d=(Array.isArray(a.providers)?a.providers:[]).slice(0,O),x=(Array.isArray(a.topModels)?a.topModels:[]).slice(0,O),y=v=>v.reduce((E,$)=>Math.max(E,Number($.share)||0),0)||1;return{providers:d,models:x,providersMaxShare:y(d),modelsMaxShare:y(x),trendRows:(Array.isArray(a.dailyGrowth)?a.dailyGrowth:[]).map(v=>({day:ne(v.day),value:Number(v.tokens)||0})),mix:Array.isArray(a.tokenMix)?a.tokenMix:[],bands:Array.isArray(a.userDistribution)?a.userDistribution:[],platforms:Array.isArray(a.platforms)?a.platforms:[]}},[c,a]);if(!m)return null;const h=Number(a.tokenFloor)||0,N=Number(a.activeDevelopersTotal)||Number(a.totalEntries)||0,w=Number(a.tokens30d)||0,T=d=>{if(d.key!=="ArrowRight"&&d.key!=="ArrowLeft")return;d.preventDefault();const x=d.key==="ArrowRight"?1:-1,y=g[(g.indexOf(o)+x+g.length)%g.length];l(y),d.currentTarget.querySelector(`[data-tab-id="${y}"]`)?.focus()};return e.jsx(X,{open:t,onOpenChange:d=>!d&&s(),children:e.jsxs(Y,{children:[e.jsx(Z,{className:"fixed inset-0 z-[100] bg-black/50 backdrop-blur-[3px] transition-opacity duration-200 ease-out data-[ending-style]:opacity-0 data-[starting-style]:opacity-0"}),e.jsx(H,{className:"fixed inset-0 z-[101] flex items-center justify-center p-2 sm:p-5",children:e.jsxs(q,{className:"relative flex h-[min(42rem,92vh)] w-full max-w-xl flex-col overflow-hidden rounded-2xl bg-white shadow-2xl ring-1 ring-black/10 transition-[opacity,transform] duration-[220ms] ease-[cubic-bezier(0.16,1,0.3,1)] data-[ending-style]:translate-y-3 data-[ending-style]:scale-[0.98] data-[ending-style]:opacity-0 data-[starting-style]:translate-y-3 data-[starting-style]:scale-[0.98] data-[starting-style]:opacity-0 dark:bg-oai-gray-950 dark:ring-white/10",children:[e.jsxs("header",{"data-testid":"community-metrics-header",className:"shrink-0 px-5 pt-5 sm:px-6",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx(J,{className:"text-lg font-semibold tracking-[-0.02em] text-oai-black dark:text-white",children:n("leaderboard.community.modal.title")}),e.jsx(Q,{className:"sr-only",children:n("leaderboard.community.modal.description")})]}),e.jsx(ee,{className:"-mr-1 -mt-1 grid size-8 place-items-center rounded-full text-oai-gray-400 transition-colors hover:bg-black/5 hover:text-oai-black dark:hover:bg-white/10 dark:hover:text-white","aria-label":n("shared.dialog.close"),children:e.jsx(z,{className:"size-4"})})]}),e.jsxs("div",{className:"mt-4 grid grid-cols-3 gap-x-5",children:[e.jsx(j,{label:n("leaderboard.community.modal.total_tokens"),value:i(h),title:r(h)}),e.jsx(j,{label:n("leaderboard.community.modal.tokens_30d"),value:i(w),title:r(w),delta:a.tokenGrowthPct,deltaLabel:n("leaderboard.community.modal.vs_previous_week")}),e.jsx(j,{label:n("leaderboard.community.modal.contributors"),value:p(N),title:N.toLocaleString()})]}),e.jsx("div",{className:"mt-4 flex items-end overflow-x-auto border-b border-oai-gray-100 dark:border-oai-gray-900",role:"tablist","aria-label":n("leaderboard.community.modal.views"),onKeyDown:T,children:g.map(d=>{const x=o===d;return e.jsxs("button",{type:"button",role:"tab","data-tab-id":d,"aria-selected":x,tabIndex:x?0:-1,onClick:()=>l(d),className:`relative mr-5 h-10 shrink-0 text-sm font-medium transition-colors last:mr-0 ${x?"text-oai-black dark:text-white":"text-oai-gray-500 hover:text-oai-gray-700 dark:text-oai-gray-400 dark:hover:text-oai-gray-200"}`,children:[n(`leaderboard.community.modal.tab.${d}`),x?e.jsx(M.span,{layoutId:"community-metrics-tab-underline",className:"absolute inset-x-0 -bottom-px h-0.5 rounded-full bg-oai-black dark:bg-white",transition:{type:"spring",stiffness:420,damping:34}}):null]},d)})})]}),e.jsx("div",{"data-testid":"community-metrics-content",className:"min-h-0 flex-1 overflow-y-auto px-5 py-5 sm:px-6",children:e.jsxs(M.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},transition:{duration:.18,ease:[.16,1,.3,1]},className:"h-full",children:[o==="overview"?e.jsx(me,{trendRows:m.trendRows,mix:m.mix,activeDevelopers30d:Number(a.activeDevelopers30d)||0,developerGrowthPct:a.developerGrowthPct,formatTokens:i,formatTokensTooltip:r}):null,o==="providers"?e.jsx(ce,{rows:m.providers,maxShare:m.providersMaxShare,formatTokens:i,formatTokensTooltip:r}):null,o==="community"?e.jsx(pe,{bands:m.bands,platforms:m.platforms,formatTokensTooltip:r}):null,o==="models"?e.jsx(xe,{rows:m.models,maxShare:m.modelsMaxShare,formatTokens:i,formatTokensTooltip:r}):null]},o)})]})})]})})}function Ke(t){return e.jsx(R,{mode:P.COMPACT,children:e.jsx(ve,{...t})})}export{Ke as CommunityStatsModal};
import{j as a,B as i,d as x}from"./__vite-browser-external-CuMc3dqk.js";import{D as p,a as m,b as y,c as b,d as f,e as u}from"./DialogTitle-KxLDeLzC.js";import{D as h}from"./DialogDescription-BgYqW0_C.js";function _({open:r,title:l,description:t,confirmLabel:o,cancelLabel:n,destructive:d=!1,busy:e=!1,onConfirm:c,onCancel:s}){return a.jsx(p,{open:r,onOpenChange:g=>{!g&&!e&&s?.()},children:a.jsxs(m,{children:[a.jsx(y,{className:"fixed inset-0 z-[100] bg-black/40 backdrop-blur-[2px] transition-opacity duration-200 ease-out data-[ending-style]:opacity-0 data-[starting-style]:opacity-0"}),a.jsx(b,{className:"fixed inset-0 z-[101] flex items-center justify-center p-4",children:a.jsxs(f,{className:"relative w-full max-w-md rounded-2xl bg-white p-6 shadow-[0_20px_60px_-20px_rgba(0,0,0,0.25)] ring-1 ring-oai-gray-200 transition-[opacity,transform] duration-[220ms] ease-[cubic-bezier(0.16,1,0.3,1)] data-[ending-style]:translate-y-2 data-[ending-style]:scale-[0.96] data-[ending-style]:opacity-0 data-[starting-style]:translate-y-2 data-[starting-style]:scale-[0.96] data-[starting-style]:opacity-0 dark:bg-oai-gray-950 dark:shadow-[0_20px_60px_-10px_rgba(0,0,0,0.65)] dark:ring-oai-gray-800",children:[a.jsx(u,{className:"text-base font-semibold text-oai-black dark:text-white",children:l}),t?a.jsx(h,{className:"mt-2 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:t}):null,a.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[a.jsx(i,{type:"button",variant:"secondary",size:"sm",disabled:e,onClick:()=>s?.(),children:n}),a.jsx(i,{type:"button",size:"sm",disabled:e,onClick:()=>c?.(),className:x(d&&"!bg-red-600 hover:!bg-red-700 focus-visible:!outline-red-600 dark:!bg-red-600 dark:hover:!bg-red-500"),children:o})]})]})})]})})}export{_ as C};
import{l as c}from"./__vite-browser-external-CuMc3dqk.js";const e=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],t=c("copy",e);export{t as C};

Sorry, the diff of this file is too big to display

import{a as b,r as l,j as r,c as e,h as v}from"./__vite-browser-external-CuMc3dqk.js";const x={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_APP_VERSION:"0.84.2",VITE_INSFORGE_ANON_KEY:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3OC0xMjM0LTU2NzgtOTBhYi1jZGVmMTIzNDU2NzgiLCJlbWFpbCI6ImFub25AaW5zZm9yZ2UuY29tIiwicm9sZSI6ImFub24iLCJpYXQiOjE3ODExNDU5NDd9.T0auta_IrVIh0uXW1bob5QSnzvsnJmN28r5XkSGEuQY",VITE_INSFORGE_BASE_URL:"https://srctyff5.us-east.insforge.app"};function f(){return v(),`${(x&&"https://srctyff5.us-east.insforge.app"||"https://srctyff5.us-east.insforge.app").replace(/\/$/,"")}/functions/tokentracker-device-flow-grant`}function p(s){return(s||"").toUpperCase().replace(/\s+/g,"").replace(/[^A-Z0-9-]/g,"")}function h(){const s=b(),[m,g]=l.useState(""),[i,a]=l.useState({kind:"idle",message:""});l.useEffect(()=>{try{const d=new URLSearchParams(window.location.search).get("user_code");d&&g(p(d))}catch{}},[]);async function u(c){if(c?.preventDefault?.(),!s?.signedIn){a({kind:"error",message:e("device.approval.error.sign_in")});return}const d=p(m);if(!/^[A-HJKMNP-Z2-9]{4}-[A-HJKMNP-Z2-9]{4}$/.test(d)){a({kind:"error",message:e("device.approval.error.invalid_code")});return}a({kind:"working",message:e("device.approval.action.approving")});try{const n=await s.getAccessToken?.();if(!n){a({kind:"error",message:e("device.approval.error.no_token")});return}const o=await fetch(f(),{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify({user_code:d})}),t=await o.json().catch(()=>({}));o.ok?a({kind:"success",message:t.status==="already_approved"?t.client_info?e("device.approval.success.already_client",{client:t.client_info}):e("device.approval.success.already"):t.client_info?e("device.approval.success.approved_client",{client:t.client_info}):e("device.approval.success.approved")}):o.status===404?a({kind:"error",message:e("device.approval.error.not_found")}):o.status===410?a({kind:"error",message:e("device.approval.error.expired")}):o.status===401?a({kind:"error",message:e("device.approval.error.session_expired")}):a({kind:"error",message:t?.error?e("device.approval.error.server_detail",{message:t.error}):e("device.approval.error.server",{status:o.status})})}catch(n){a({kind:"error",message:e("device.approval.error.network",{message:n?.message||n})})}}return r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-white dark:bg-oai-gray-950 px-6 py-12",children:r.jsxs("div",{className:"w-full max-w-md rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-8",children:[r.jsx("h1",{className:"text-2xl font-semibold text-oai-gray-900 dark:text-white mb-2",children:e("device.approval.title")}),r.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400 mb-6",children:e("device.approval.description")}),s?.signedIn?null:r.jsx("div",{className:"rounded-md border border-amber-200 bg-amber-50 dark:bg-amber-900/20 dark:border-amber-800 p-4 mb-4",children:r.jsx("p",{className:"text-sm text-amber-700 dark:text-amber-300",children:e("device.approval.sign_in_banner")})}),r.jsxs("form",{onSubmit:u,className:"space-y-4",children:[r.jsxs("label",{className:"block",children:[r.jsx("span",{className:"block text-xs font-medium uppercase tracking-wide text-oai-gray-500 dark:text-oai-gray-400 mb-1",children:e("device.approval.code_label")}),r.jsx("input",{type:"text",value:m,onChange:c=>g(p(c.target.value)),placeholder:"XXXX-XXXX",spellCheck:!1,autoCapitalize:"characters",maxLength:9,className:"w-full font-mono text-xl tracking-widest text-center rounded-md border border-oai-gray-300 dark:border-oai-gray-700 bg-white dark:bg-oai-gray-900 text-oai-gray-900 dark:text-white px-4 py-3 focus:outline-none focus:ring-inset focus:ring-2 focus:ring-emerald-600"})]}),r.jsx("button",{type:"submit",disabled:i.kind==="working"||!s?.signedIn,className:"w-full rounded-md bg-emerald-600 hover:bg-emerald-500 disabled:bg-oai-gray-300 disabled:cursor-not-allowed text-white font-medium py-3 transition-colors",children:i.kind==="working"?e("device.approval.action.approving"):e("device.approval.action.approve")})]}),i.kind==="success"&&r.jsx("div",{className:"mt-4 rounded-md border border-emerald-200 bg-emerald-50 dark:bg-emerald-900/20 dark:border-emerald-800 p-4",children:r.jsx("p",{className:"text-sm text-emerald-700 dark:text-emerald-300",children:i.message})}),i.kind==="error"&&r.jsx("div",{className:"mt-4 rounded-md border border-red-200 bg-red-50 dark:bg-red-900/20 dark:border-red-800 p-4",children:r.jsx("p",{className:"text-sm text-red-700 dark:text-red-300",children:i.message})})]})})}export{h as default};
import{r as p,y as d,z as m,A as C,E as g}from"./__vite-browser-external-CuMc3dqk.js";import{u as v}from"./DialogTitle-KxLDeLzC.js";const h=p.forwardRef(function(e,o){const{render:E,className:R,style:b,disabled:t=!1,nativeButton:n=!0,...a}=e,{store:s}=v(),r=s.useState("open"),{getButtonProps:l,buttonRef:i}=d({disabled:t,native:n}),u={disabled:t};function c(f){r&&s.setOpen(!1,C(g,f.nativeEvent))}return m("button",e,{state:u,ref:[o,i],props:[{onClick:c},a,l]})});export{h as D};
import{r as n,z as a}from"./__vite-browser-external-CuMc3dqk.js";import{u as p}from"./DialogTitle-KxLDeLzC.js";import{u as c}from"./useScrollLock-DmM-LeMm.js";const x=n.forwardRef(function(e,r){const{render:l,className:u,style:m,id:s,...t}=e,{store:i}=p(),o=c(s);return i.useSyncedValueWithCleanup("descriptionElementId",o),a("p",e,{ref:r,props:[{id:o},t]})});export{x as D};
import{r as l,ax as _,z as v,ay as F,az as J,j as E,aA as q,aB as G,A as Q,aC as X,aD as Z,aE as V,W as N,aF as A,V as h}from"./__vite-browser-external-CuMc3dqk.js";import{p as B,C as P,c as ee,a as te,b as ne,d as oe,I as se,e as ae,f as re,g as le,h as ie,i as de,j as ce,P as ue,s as pe,k as ge,l as fe,u as me}from"./useScrollLock-DmM-LeMm.js";import{c as Se,p as Ce,a as Re}from"./store-NtnkxrS2.js";const z=l.createContext(!1),L=l.createContext(void 0);function D(e){const t=l.useContext(L);if(e===!1&&t===void 0)throw new Error(_(27));return t}const he={...B,...F},Ne=l.forwardRef(function(t,o){const{render:s,className:i,style:a,forceRender:c=!1,...u}=t,{store:r}=D(),n=r.useState("open"),f=r.useState("nested"),S=r.useState("mounted"),m=r.useState("transitionStatus");return v("div",t,{state:{open:n,transitionStatus:m},ref:[r.context.backdropRef,o],stateAttributesMapping:he,props:[{role:"presentation",hidden:!S,style:{userSelect:"none",WebkitUserSelect:"none"}},u],enabled:c||!f})});let Oe=(function(e){return e.nestedDialogs="--nested-dialogs",e})({}),Pe=(function(e){return e[e.open=P.open]="open",e[e.closed=P.closed]="closed",e[e.startingStyle=P.startingStyle]="startingStyle",e[e.endingStyle=P.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const Y=l.createContext(void 0);function $(){const e=l.useContext(Y);if(e===void 0)throw new Error(_(26));return e}const xe={...B,...F,nestedDialogOpen(e){return e?{[Pe.nestedDialogOpen]:""}:null}},Fe=l.forwardRef(function(t,o){const{render:s,className:i,style:a,finalFocus:c,initialFocus:u,...r}=t,{store:n}=D(),f=n.useState("descriptionElementId"),S=n.useState("disablePointerDismissal"),m=n.useState("floatingRootContext"),R=n.useState("popupProps"),C=n.useState("modal"),O=n.useState("mounted"),x=n.useState("nested"),g=n.useState("nestedOpenDialogCount"),p=n.useState("open"),U=n.useState("openMethod"),I=n.useState("titleElementId"),d=n.useState("transitionStatus"),b=n.useState("role"),k=m.useState("floatingId"),w=r.id??k;$(),J({open:p,ref:n.context.popupRef,onComplete(){p&&n.context.onOpenChangeComplete?.(!0)}});const M=u===void 0?ee(n.context.popupRef):u,T=g>0,y=n.useStateSetter("popupElement"),H=v("div",t,{state:{open:p,nested:x,transitionStatus:d,nestedDialogOpen:T},props:[R,{id:w,"aria-labelledby":I??void 0,"aria-describedby":f??void 0,role:b,...te,hidden:!O,onKeyDown(K){ne.has(K.key)&&K.stopPropagation()},style:{[Oe.nestedDialogs]:g}},r],ref:[o,n.context.popupRef,y],stateAttributesMapping:xe});return E.jsx(oe,{context:m,openInteractionType:U,disabled:!O,closeOnFocusOut:!S,initialFocus:M,returnFocus:c,modal:C!==!1,restoreFocus:"popup",children:H})}),Be=l.forwardRef(function(t,o){const{keepMounted:s=!1,...i}=t,{store:a}=D(),c=a.useState("mounted"),u=a.useState("modal"),r=a.useState("open");return c||s?E.jsx(Y.Provider,{value:s,children:E.jsxs(q,{ref:o,...i,children:[c&&u===!0&&E.jsx(se,{ref:a.context.internalBackdropRef,inert:G(!r)}),t.children]})}):null});function Ee(e){const{store:t,actionsRef:o}=e,s=t.useState("open");ae(t,s),re(t);const{forceUnmount:i}=le(s,t),a=l.useCallback(()=>{t.setOpen(!1,Q(X))},[t]);l.useImperativeHandle(o,()=>({unmount:i,close:a}),[i,a])}function Ie({store:e,parentContext:t,isDrawer:o}){const s=e.useState("open"),i=e.useState("disablePointerDismissal"),a=e.useState("modal"),c=e.useState("popupElement"),u=e.useState("floatingRootContext"),[r,n]=l.useState(0),[f,S]=l.useState(0),m=r===0,R=ie(u,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?"intentional":{mouse:a==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(g){if(!e.context.outsidePressEnabledRef.current||"button"in g&&g.button!==0||"touches"in g&&g.touches.length!==1)return!1;const p=Z(g);return m&&!i?a&&(e.context.internalBackdropRef.current||e.context.backdropRef.current)?e.context.internalBackdropRef.current===p||e.context.backdropRef.current===p||V(p,c)&&!p?.hasAttribute("data-base-ui-portal"):!0:!1},escapeKey:m});de(s&&a===!0,c),e.useContextCallback("onNestedDialogOpen",(g,p)=>{n(g),S(p)}),e.useContextCallback("onNestedDialogClose",()=>{n(0),S(0)}),l.useEffect(()=>(t?.onNestedDialogOpen&&s&&t.onNestedDialogOpen(r+1,f+(o?1:0)),t?.onNestedDialogClose&&!s&&t.onNestedDialogClose(),()=>{t?.onNestedDialogClose&&s&&t.onNestedDialogClose()}),[o,s,r,f,t]);const C=R.reference??N,O=R.trigger??N,x=R.floating??N;return ce(e,{activeTriggerProps:C,inactiveTriggerProps:O,popupProps:x,nestedOpenDialogCount:r,nestedOpenDrawerCount:f}),null}const ye={...Ce,modal:h(e=>e.modal),nested:h(e=>e.nested),nestedOpenDialogCount:h(e=>e.nestedOpenDialogCount),nestedOpenDrawerCount:h(e=>e.nestedOpenDrawerCount),disablePointerDismissal:h(e=>e.disablePointerDismissal),openMethod:h(e=>e.openMethod),descriptionElementId:h(e=>e.descriptionElementId),titleElementId:h(e=>e.titleElementId),viewportElement:h(e=>e.viewportElement),role:h(e=>e.role)};class j extends A{constructor(t,o,s=!1){const i=new ue,a=De(t);a.floatingRootContext=Se(i,o,s),super(a,{popupRef:l.createRef(),backdropRef:l.createRef(),internalBackdropRef:l.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:i,onOpenChange:void 0,onOpenChangeComplete:void 0},ye)}setOpen=(t,o)=>{if(o.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!t&&o.trigger==null&&this.state.activeTriggerId!=null&&(o.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(t,o),o.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(t,o);const s={open:t};pe(s,t,o.trigger),this.update(s)};static useStore(t,o){return ge(t,(i,a)=>new j(o,i,a),!0).store}}function De(e={}){return{...Re(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:"dialog",...e}}function ve(e,t="dialog"){const{children:o,open:s,defaultOpen:i=!1,onOpenChange:a,onOpenChangeComplete:c,disablePointerDismissal:u=!1,modal:r=!0,actionsRef:n,handle:f,triggerId:S,defaultTriggerId:m=null}=e,R=t==="drawer",C=t==="alert-dialog",O=C?!0:r,x=C||u,g=C?"alertdialog":"dialog",p=D(!0),I={modal:O,disablePointerDismissal:x,nested:!!p,role:g},d=j.useStore(f?.store,{open:i,openProp:s,activeTriggerId:m,triggerIdProp:S,...I});fe(()=>{const y=s===void 0&&d.state.open===!1&&i===!0?{open:!0,activeTriggerId:m}:null;C?d.update(y?{...I,...y}:I):y&&d.update(y)}),d.useControlledProp("openProp",s),d.useControlledProp("triggerIdProp",S),d.useSyncedValues(I),d.useContextCallback("onOpenChange",a),d.useContextCallback("onOpenChangeComplete",c);const b=d.useState("open"),k=d.useState("mounted"),w=d.useState("payload");Ee({store:d,actionsRef:n});const M=b||k,T=l.useMemo(()=>({store:d}),[d]);return E.jsx(z.Provider,{value:!1,children:E.jsxs(L.Provider,{value:T,children:[M&&E.jsx(Ie,{store:d,parentContext:p?.store.context,isDrawer:R}),typeof o=="function"?o({payload:w}):o]})})}function je(e){const t=l.useContext(z)?"drawer":"dialog";return ve(e,t)}let W=(function(e){return e[e.open=P.open]="open",e[e.closed=P.closed]="closed",e[e.startingStyle=P.startingStyle]="startingStyle",e[e.endingStyle=P.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const be={...B,...F,nested(e){return e?{[W.nested]:""}:null},nestedDialogOpen(e){return e?{[W.nestedDialogOpen]:""}:null}},Ue=l.forwardRef(function(t,o){const{render:s,className:i,style:a,children:c,...u}=t,r=$(),{store:n}=D(),f=n.useState("open"),S=n.useState("nested"),m=n.useState("transitionStatus"),R=n.useState("nestedOpenDialogCount"),C=n.useState("mounted"),O=n.useStateSetter("viewportElement"),x=R>0;return v("div",t,{enabled:r||C,state:{open:f,nested:S,transitionStatus:m,nestedDialogOpen:x},ref:[o,O],stateAttributesMapping:be,props:[{role:"presentation",hidden:!C,style:{pointerEvents:f?void 0:"none"},children:c},u]})}),Ke=l.forwardRef(function(t,o){const{render:s,className:i,style:a,id:c,...u}=t,{store:r}=D(),n=me(c);return r.useSyncedValueWithCleanup("titleElementId",n),v("h2",t,{ref:o,props:[{id:n},u]})});export{je as D,Be as a,Ne as b,Ue as c,Fe as d,Ke as e,D as u};
import{l as o}from"./__vite-browser-external-CuMc3dqk.js";const a=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],e=o("download",a);export{e as D};
import{j as o}from"./__vite-browser-external-CuMc3dqk.js";import{m as s}from"./react-B80AX8fE.js";import{u as d}from"./use-reduced-motion-BEAopWkx.js";function m({children:i,delay:t=0,duration:n=.35,y:e=12,className:r="",once:a=!0}){return d()?o.jsx("div",{className:r,children:i}):o.jsx(s.div,{initial:{opacity:0,y:e},animate:{opacity:1,y:0},transition:{duration:n,delay:t,ease:[.16,1,.3,1]},className:r,children:i})}function p({children:i,staggerDelay:t=.1,initialDelay:n=0,className:e=""}){return d()?o.jsx("div",{className:e,children:i}):o.jsx(s.div,{initial:"hidden",animate:"visible",variants:{hidden:{},visible:{transition:{staggerChildren:t,delayChildren:n}}},className:e,children:i})}function x({children:i,className:t="",y:n=12}){return d()?o.jsx("div",{className:t,children:i}):o.jsx(s.div,{variants:{hidden:{opacity:0,y:n},visible:{opacity:1,y:0,transition:{duration:.35,ease:[.16,1,.3,1]}}},className:t,children:i})}export{m as F,p as S,x as a};
import{l as c}from"./__vite-browser-external-CuMc3dqk.js";const e=[["path",{d:"M12 3q1 4 4 6.5t3 5.5a1 1 0 0 1-14 0 5 5 0 0 1 1-3 1 1 0 0 0 5 0c0-2-1.5-3-1.5-5q0-2 2.5-4",key:"1slcih"}]],a=c("flame",e);export{a as F};
import{k as r}from"./__vite-browser-external-CuMc3dqk.js";function n(o){const t=Number(o)||0;return t>=1e12?`${Number((t/1e12).toFixed(2)).toString()}T`:r(t)}export{n as f};
import{r as s,s as c,j as t,c as d}from"./__vite-browser-external-CuMc3dqk.js";function u({repo:r="mm7894215/TokenTracker"}){const[a,o]=s.useState(null);return s.useEffect(()=>{if(typeof window>"u")return;const n=typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,i=typeof document<"u"&&(document.documentElement?.classList.contains("screenshot-capture")||document.body?.classList.contains("screenshot-capture"));c({prefersReducedMotion:n,screenshotCapture:i})&&fetch(`https://api.github.com/repos/${r}`).then(e=>e.json()).then(e=>{e&&typeof e.stargazers_count=="number"&&o(e.stargazers_count)}).catch(()=>{})},[r]),t.jsxs("a",{href:`https://github.com/${r}`,target:"_blank",rel:"noopener noreferrer",className:"inline-flex shrink-0 items-center gap-2 px-3 py-1.5 rounded-md border border-oai-gray-200 dark:border-oai-gray-700 bg-oai-gray-50 dark:bg-oai-gray-800 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-700 transition-colors no-underline",children:[t.jsx("svg",{height:"16",viewBox:"0 0 16 16",width:"16",className:"shrink-0 fill-oai-gray-700 dark:fill-oai-gray-300",children:t.jsx("path",{d:"M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"})}),t.jsx("span",{className:"text-xs font-medium text-oai-gray-700 dark:text-oai-gray-300 whitespace-nowrap",children:d("shared.github.star")}),a!==null&&t.jsx("span",{className:"text-xs font-semibold text-oai-gray-900 dark:text-oai-white tabular-nums whitespace-nowrap",children:a})]})}export{u as H};
import{j as t,d as a}from"./__vite-browser-external-CuMc3dqk.js";function i({text:o,placement:r="top"}){return o?t.jsx("div",{role:"tooltip",className:a("pointer-events-none absolute left-1/2 z-10 w-max max-w-[260px] -translate-x-1/2 whitespace-pre-line rounded-xl border border-oai-gray-200/50 dark:border-oai-gray-800/50 bg-white/90 dark:bg-oai-gray-900/90 backdrop-blur-md px-2.5 py-1.5 text-[10.5px] leading-snug text-oai-gray-700 dark:text-oai-gray-200 shadow-xl opacity-0 transition-opacity duration-150 group-hover:opacity-100",r==="bottom"?"top-full mt-2":"bottom-full mb-2"),children:o}):null}export{i as H};
import{j as r}from"./__vite-browser-external-CuMc3dqk.js";function e({className:n}){return r.jsx("svg",{viewBox:"0 0 384 512",className:n,fill:"currentColor","aria-hidden":"true",children:r.jsx("path",{d:"M318.7 268.7c-.2-36.7 16.4-64.4 50-84.8-18.8-26.9-47.2-41.7-84.7-44.6-35.5-2.8-74.3 20.7-88.5 20.7-15 0-49.4-19.7-76.4-19.7C63.3 141.2 4 184.8 4 273.5q0 39.3 14.4 81.2c12.8 36.7 59 126.7 107.2 125.2 25.2-.6 43-17.9 75.8-17.9 31.8 0 48.3 17.9 76.4 17.9 48.6-.7 90.4-82.5 102.6-119.3-65.2-30.7-61.7-90-61.7-91.9zm-56.6-164.2c27.3-32.4 24.8-61.9 24-72.5-24.1 1.4-52 16.4-67.9 34.9-17.5 19.8-27.8 44.3-25.6 71.9 26.1 2 49.9-11.4 69.5-34.3z"})})}function o({className:n}){return r.jsx("svg",{viewBox:"0 0 16 16",className:n,fill:"currentColor","aria-hidden":"true",children:r.jsx("path",{d:"M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"})})}function t({className:n}){return r.jsx("svg",{viewBox:"0 0 24 24",className:n,fill:"currentColor","aria-hidden":"true",children:r.jsx("path",{d:"M3 5.46 10.2 4.5v6.92H3V5.46Zm0 13.08 7.2.96v-6.84H3v5.88Zm8.04 1.08L21 21V12.46h-9.96v7.16ZM11.04 4.38 21 3v8.46h-9.96V4.38Z"})})}export{e as A,o as G,t as W};
import{r as u}from"./__vite-browser-external-CuMc3dqk.js";var c={},p=()=>{window.va||(window.va=function(...r){window.vaq||(window.vaq=[]),window.vaq.push(r)})},m="@vercel/analytics",E="2.0.1";function l(){return typeof window<"u"}function w(){try{const e="production"}catch{}return"production"}function y(e="auto"){if(e==="auto"){window.vam=w();return}window.vam=e}function h(){return(l()?window.vam:w())||"production"}function v(){return h()==="production"}function d(){return h()==="development"}function g(e,{[e]:r,...i}){return i}function _(e,r){if(!e)return;let i=e;const n=[];for(const[t,o]of Object.entries(e))typeof o=="object"&&o!==null&&(r.strip?i=g(t,i):n.push(t));if(n.length>0&&!r.strip)throw Error(`The following properties are not valid: ${n.join(", ")}. Only strings, numbers, booleans, and null are allowed.`);return i}function S(e){return e.scriptSrc?a(e.scriptSrc):d()?"https://va.vercel-scripts.com/v1/script.debug.js":e.basePath?a(`${e.basePath}/insights/script.js`):"/_vercel/insights/script.js"}function k(e,r){var i;let n=e;if(r)try{n={...(i=JSON.parse(r))==null?void 0:i.analytics,...e}}catch{}y(n.mode);const t={sdkn:m+(n.framework?`/${n.framework}`:""),sdkv:E};return n.disableAutoTrack&&(t.disableAutoTrack="1"),n.viewEndpoint&&(t.viewEndpoint=a(n.viewEndpoint)),n.eventEndpoint&&(t.eventEndpoint=a(n.eventEndpoint)),n.sessionEndpoint&&(t.sessionEndpoint=a(n.sessionEndpoint)),d()&&n.debug===!1&&(t.debug="false"),n.dsn&&(t.dsn=n.dsn),n.endpoint?t.endpoint=n.endpoint:n.basePath&&(t.endpoint=a(`${n.basePath}/insights`)),{beforeSend:n.beforeSend,src:S(n),dataset:t}}function a(e){return e.startsWith("http://")||e.startsWith("https://")||e.startsWith("/")?e:`/${e}`}function P(e={debug:!0},r){var i;if(!l())return;const{beforeSend:n,src:t,dataset:o}=k(e,r);if(p(),n&&((i=window.va)==null||i.call(window,"beforeSend",n)),document.head.querySelector(`script[src*="${t}"]`))return;const s=document.createElement("script");s.src=t;for(const[f,b]of Object.entries(o))s.dataset[f]=b;s.defer=!0,s.onerror=()=>{const f=d()?"Please check if any ad blockers are enabled and try again.":"Be sure to enable Web Analytics for your project and deploy again. See https://vercel.com/docs/analytics/quickstart for more information.";console.log(`[Vercel Web Analytics] Failed to load script from ${t}. ${f}`)},document.head.appendChild(s)}function C(e,r,i){var n,t;if(!l()){const o="[Vercel Web Analytics] Please import `track` from `@vercel/analytics/server` when using this function in a server environment";if(v())console.warn(o);else throw new Error(o);return}if(!r){(n=window.va)==null||n.call(window,"event",{name:e,options:i});return}try{const o=_(r,{strip:v()});(t=window.va)==null||t.call(window,"event",{name:e,data:o,options:i})}catch(o){o instanceof Error&&d()&&console.error(o)}}function A({route:e,path:r}){var i;(i=window.va)==null||i.call(window,"pageview",{route:e,path:r})}function T(){if(!(typeof process>"u"||typeof c>"u"))return c.REACT_APP_VERCEL_OBSERVABILITY_BASEPATH}function j(){if(!(typeof process>"u"||typeof c>"u"))return c.REACT_APP_VERCEL_OBSERVABILITY_CLIENT_CONFIG}function $(e){return u.useEffect(()=>{var r;e.beforeSend&&((r=window.va)==null||r.call(window,"beforeSend",e.beforeSend))},[e.beforeSend]),u.useEffect(()=>{P({framework:e.framework||"react",basePath:e.basePath??T(),...e.route!==void 0&&{disableAutoTrack:!0},...e},e.configString??j())},[]),u.useEffect(()=>{e.route&&e.path&&A({route:e.route,path:e.path})},[e.route,e.path]),null}export{$ as Analytics,C as track};
import{r as n,j as $}from"./__vite-browser-external-CuMc3dqk.js";import{M as D,a as S,u as A,b as F,P as K,c as U,L as W}from"./react-B80AX8fE.js";function I(e,r){if(typeof e=="function")return e(r);e!=null&&(e.current=r)}function B(...e){return r=>{let t=!1;const o=e.map(l=>{const c=I(l,r);return!t&&typeof c=="function"&&(t=!0),c});if(t)return()=>{for(let l=0;l<o.length;l++){const c=o[l];typeof c=="function"?c():I(e[l],null)}}}}function G(...e){return n.useCallback(B(...e),e)}class V extends n.Component{getSnapshotBeforeUpdate(r){const t=this.props.childRef.current;if(S(t)&&r.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const o=t.offsetParent,l=S(o)&&o.offsetWidth||0,c=S(o)&&o.offsetHeight||0,p=getComputedStyle(t),s=this.props.sizeRef.current;s.height=parseFloat(p.height),s.width=parseFloat(p.width),s.top=t.offsetTop,s.left=t.offsetLeft,s.right=l-s.width-s.left,s.bottom=c-s.height-s.top,s.direction=p.direction}return null}componentDidUpdate(){}render(){return this.props.children}}function X({children:e,isPresent:r,anchorX:t,anchorY:o,root:l,pop:c}){const p=n.useId(),s=n.useRef(null),y=n.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:"ltr"}),{nonce:E}=n.useContext(D),a=e.props?.ref??e?.ref,M=G(s,a);return n.useInsertionEffect(()=>{const{width:u,height:d,top:x,left:C,right:f,bottom:R,direction:L}=y.current;if(r||c===!1||!s.current||!u||!d)return;const b=L==="rtl",g=t==="left"?b?`right: ${f}`:`left: ${C}`:b?`left: ${C}`:`right: ${f}`,j=o==="bottom"?`bottom: ${R}`:`top: ${x}`;s.current.dataset.motionPopId=p;const h=document.createElement("style");E&&(h.nonce=E);const P=l??document.head;return P.appendChild(h),h.sheet&&h.sheet.insertRule(`
[data-motion-pop-id="${p}"] {
position: absolute !important;
width: ${u}px !important;
height: ${d}px !important;
${g}px !important;
${j}px !important;
}
`),()=>{s.current?.removeAttribute("data-motion-pop-id"),P.contains(h)&&P.removeChild(h)}},[r]),$.jsx(V,{isPresent:r,childRef:s,sizeRef:y,pop:c,children:c===!1?e:n.cloneElement(e,{ref:M})})}const Y=({children:e,initial:r,isPresent:t,onExitComplete:o,custom:l,presenceAffectsLayout:c,mode:p,anchorX:s,anchorY:y,root:E})=>{const a=A(_),M=n.useId(),u=n.useRef(t),d=n.useRef(o);F(()=>{u.current=t,d.current=o});let x=!0,C=n.useMemo(()=>(x=!1,{id:M,initial:r,isPresent:t,custom:l,onExitComplete:f=>{a.set(f,!0);for(const R of a.values())if(!R)return;o&&o()},register:f=>(a.set(f,!1),()=>{a.delete(f),!u.current&&!a.size&&d.current?.()})}),[t,a,o]);return c&&x&&(C={...C}),n.useMemo(()=>{a.forEach((f,R)=>a.set(R,!1))},[t]),n.useEffect(()=>{!t&&!a.size&&o&&o()},[t]),e=$.jsx(X,{pop:p==="popLayout",isPresent:t,anchorX:s,anchorY:y,root:E,children:e}),$.jsx(K.Provider,{value:C,children:e})};function _(){return new Map}const v=e=>e.key||"";function T(e){const r=[];return n.Children.forEach(e,t=>{n.isValidElement(t)&&r.push(t)}),r}const N=({children:e,custom:r,initial:t=!0,onExitComplete:o,presenceAffectsLayout:l=!0,mode:c="sync",propagate:p=!1,anchorX:s="left",anchorY:y="top",root:E})=>{const[a,M]=U(p),u=n.useMemo(()=>T(e),[e]),d=p&&!a?[]:u.map(v),x=n.useRef(!0),C=n.useRef(u),f=A(()=>new Map),R=n.useRef(new Set),[L,b]=n.useState(u),[g,j]=n.useState(u);F(()=>{x.current=!1,C.current=u;for(let m=0;m<g.length;m++){const i=v(g[m]);d.includes(i)?(f.delete(i),R.current.delete(i)):f.get(i)!==!0&&f.set(i,!1)}},[g,d.length,d.join("-")]);const h=[];if(u!==L){let m=[...u];for(let i=0;i<g.length;i++){const w=g[i],z=v(w);d.includes(z)||(m.splice(i,0,w),h.push(w))}return c==="wait"&&h.length&&(m=h),j(T(m)),b(u),null}const{forceRender:P}=n.useContext(W);return $.jsx($.Fragment,{children:g.map(m=>{const i=v(m),w=p&&!a?!1:u===g||d.includes(i),z=()=>{if(R.current.has(i))return;if(f.has(i))R.current.add(i),f.set(i,!0);else return;let k=!0;f.forEach(H=>{H||(k=!1)}),k&&(P?.(),j(C.current),p&&M?.(),o&&o())};return $.jsx(Y,{isPresent:w,initial:!x.current||t?void 0:!1,custom:r,presenceAffectsLayout:l,mode:c,root:E,onExitComplete:w?void 0:z,anchorX:s,anchorY:y,children:m},i)})})};export{N as A};
import{r as c}from"./__vite-browser-external-CuMc3dqk.js";var u={},p=()=>{window.si||(window.si=function(...i){window.siq=window.siq||[],window.siq.push(i)})},h="@vercel/speed-insights",g="2.0.0";function w(){return typeof window<"u"}function S(){try{const e="production"}catch{}return"production"}function l(){return S()==="development"}function k(e,i){if(!e||!i)return e;let n=e;try{const t=Object.entries(i);for(const[r,o]of t)if(!Array.isArray(o)){const s=d(o);s.test(n)&&(n=n.replace(s,`/[${r}]`))}for(const[r,o]of t)if(Array.isArray(o)){const s=d(o.join("/"));s.test(n)&&(n=n.replace(s,`/[...${r}]`))}return n}catch{return e}}function d(e){return new RegExp(`/${b(e)}(?=[/?#]|$)`)}function b(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function m(e){return e.scriptSrc?f(e.scriptSrc):l()?"https://va.vercel-scripts.com/v1/speed-insights/script.debug.js":e.dsn?"https://va.vercel-scripts.com/v1/speed-insights/script.js":e.basePath?f(`${e.basePath}/speed-insights/script.js`):"/_vercel/speed-insights/script.js"}function E(e,i){var n;let t=e;if(i)try{t={...(n=JSON.parse(i))==null?void 0:n.speedInsights,...e}}catch{}const r={sdkn:h+(t.framework?`/${t.framework}`:""),sdkv:g};return t.sampleRate&&(r.sampleRate=t.sampleRate.toString()),t.route&&(r.route=t.route),l()&&t.debug===!1&&(r.debug="false"),t.dsn&&(r.dsn=t.dsn),t.endpoint?r.endpoint=f(t.endpoint):t.basePath&&(r.endpoint=f(`${t.basePath}/speed-insights/vitals`)),{src:m(t),beforeSend:t.beforeSend,dataset:r}}function f(e){return e.startsWith("http://")||e.startsWith("https://")||e.startsWith("/")?e:`/${e}`}function y(e={},i){var n;if(!w()||e.route===null)return null;p();const{beforeSend:t,src:r,dataset:o}=E(e,i);if(document.head.querySelector(`script[src*="${r}"]`))return null;t&&((n=window.si)==null||n.call(window,"beforeSend",t));const s=document.createElement("script");s.src=r,s.defer=!0;for(const[a,v]of Object.entries(o))s.dataset[a]=v;return s.onerror=()=>{console.log(`[Vercel Speed Insights] Failed to load script from ${r}. Please check if any content blockers are enabled and try again.`)},document.head.appendChild(s),{setRoute:a=>{s.dataset.route=a??void 0}}}function R(){if(!(typeof process>"u"||typeof u>"u"))return u.REACT_APP_VERCEL_OBSERVABILITY_BASEPATH}function _(){if(!(typeof process>"u"||typeof u>"u"))return u.REACT_APP_VERCEL_OBSERVABILITY_CLIENT_CONFIG}function P(e){c.useEffect(()=>{var n;e.beforeSend&&((n=window.si)==null||n.call(window,"beforeSend",e.beforeSend))},[e.beforeSend]);const i=c.useRef(null);return c.useEffect(()=>{if(!i.current){const n=y({framework:e.framework??"react",basePath:e.basePath??R(),...e},e.configString??_());n&&(i.current=n.setRoute)}},[e]),c.useEffect(()=>{i.current&&e.route&&i.current(e.route)},[e.route]),null}export{P as SpeedInsights,k as computeRoute};
import{l as o}from"./__vite-browser-external-CuMc3dqk.js";const c=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],t=o("info",c);export{t as I};
import{r as ge,c as t,j as n}from"./__vite-browser-external-CuMc3dqk.js";const Ge=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),j=Ge?"/proxy/ipcheck":"https://ip.net.coffee",fe="claude_ip_history",Se=6,Ue=["CN","HK","MO","RU","KP","IR","SY","CU","BY","VE"],ze={CN:"Asia/Shanghai",TW:"Asia/Taipei",HK:"Asia/Hong_Kong",MO:"Asia/Macau",JP:"Asia/Tokyo",KR:"Asia/Seoul",SG:"Asia/Singapore",MY:"Asia/Kuala_Lumpur",TH:"Asia/Bangkok",VN:"Asia/Ho_Chi_Minh",ID:"Asia/Jakarta",PH:"Asia/Manila",IN:"Asia/Kolkata",PK:"Asia/Karachi",BD:"Asia/Dhaka",IR:"Asia/Tehran",IL:"Asia/Jerusalem",AE:"Asia/Dubai",SA:"Asia/Riyadh",TR:"Europe/Istanbul",RU:"Europe/Moscow",UA:"Europe/Kyiv",GB:"Europe/London",IE:"Europe/Dublin",FR:"Europe/Paris",DE:"Europe/Berlin",IT:"Europe/Rome",ES:"Europe/Madrid",PT:"Europe/Lisbon",NL:"Europe/Amsterdam",BE:"Europe/Brussels",CH:"Europe/Zurich",AT:"Europe/Vienna",SE:"Europe/Stockholm",NO:"Europe/Oslo",DK:"Europe/Copenhagen",FI:"Europe/Helsinki",PL:"Europe/Warsaw",CZ:"Europe/Prague",GR:"Europe/Athens",RO:"Europe/Bucharest",US:"America/Los_Angeles",CA:"America/Toronto",MX:"America/Mexico_City",BR:"America/Sao_Paulo",AR:"America/Argentina/Buenos_Aires",CL:"America/Santiago",AU:"Australia/Sydney",NZ:"Pacific/Auckland",ZA:"Africa/Johannesburg",EG:"Africa/Cairo",NG:"Africa/Lagos",KE:"Africa/Nairobi"},We={CN:["zh"],TW:["zh"],HK:["zh","en"],MO:["zh","en"],JP:["ja"],KR:["ko"],TH:["th"],VN:["vi"],SG:["en","zh","ms","ta"],MY:["ms","en","zh","ta"],ID:["id","en"],PH:["en","tl","fil"],IN:["en","hi"],PK:["ur","en"],BD:["bn","en"],LK:["si","ta","en"],NP:["ne","en"],US:["en"],GB:["en"],IE:["en","ga"],AU:["en"],NZ:["en","mi"],CA:["en","fr"],DE:["de"],AT:["de"],CH:["de","fr","it","rm"],BE:["nl","fr","de"],FR:["fr"],IT:["it"],ES:["es","ca","gl","eu"],PT:["pt"],NL:["nl","fy"],LU:["lb","fr","de"],SE:["sv"],NO:["no","nb","nn"],DK:["da"],FI:["fi","sv"],IS:["is","en"],PL:["pl"],CZ:["cs"],SK:["sk"],HU:["hu"],RO:["ro"],BG:["bg"],GR:["el"],RU:["ru"],UA:["uk","ru"],BY:["be","ru"],TR:["tr"],IL:["he","ar","en"],SA:["ar"],AE:["ar","en"],EG:["ar"],IR:["fa"],IQ:["ar","ku"],ZA:["en","af","zu","xh"],KE:["en","sw"],NG:["en"],ET:["am","en"],BR:["pt"],AR:["es"],MX:["es"],CL:["es"],CO:["es"],PE:["es"],VE:["es"]},Be={jp:"Japan",tw:"Taiwan",hk:"Hong Kong",sg:"Singapore",us:"United States",de:"Germany",kr:"South Korea",fr:"France",nl:"Netherlands",gb:"United Kingdom",au:"Australia",ca:"Canada",br:"Brazil",in:"India"};function Z(p){return!!p&&p.includes(":")}function Ke(p){return!Z(p)||p.length<=20?p:p.substring(0,18)+"..."}function w(p){return p==null?"":String(p).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function B(p){if(!p||!/^[a-zA-Z]{2}$/.test(p))return"";const b=p.toLowerCase();return`<img src="${b==="cn"?`${j}/favicons/cn.png`:b==="tw"?`${j}/favicons/flags/tw.png`:`${j}/favicons/flags/${b}.png`}" alt="${b}" class="inline-block h-4 w-auto align-[-2px]" onerror="this.onerror=null;this.style.display='none'">`}function Fe(p){if(!p)return"";const b=String(p).trim();if(/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(b)){const S=b.split(".");return S[0]+"."+S[1]+".*.*"}if(b.includes("…")){const S=b.lastIndexOf("…");return b.substring(0,S+1)+"*"}if(b.includes(":")){const S=b.split(":");if(S.length>=2)return S[0]+":"+S[1]+":*"}return b}function Ve(p){if(!p)return null;try{const S=new Intl.DateTimeFormat("en-US",{timeZone:p,timeZoneName:"longOffset"}).formatToParts(new Date).find(q=>q.type==="timeZoneName");if(!S)return null;if(S.value==="GMT"||S.value==="UTC")return 0;const M=S.value.match(/GMT([+-])(\d{1,2}):?(\d{0,2})/);return M?(M[1]==="+"?1:-1)*(parseInt(M[2],10)*60+parseInt(M[3]||"0",10)):null}catch{return null}}function Ye(p){if(p==null)return"";const b=p>=0?"+":"-",S=Math.abs(p),M=Math.floor(S/60),D=S%60;return"UTC"+b+M+(D?":"+String(D).padStart(2,"0"):"")}const Te={safe:"bg-emerald-50 text-emerald-700 dark:bg-emerald-500/15 dark:text-emerald-300",warn:"bg-amber-50 text-amber-800 dark:bg-amber-500/15 dark:text-amber-300",danger:"bg-red-50 text-red-700 dark:bg-red-500/15 dark:text-red-300",info:"bg-blue-50 text-blue-700 dark:bg-blue-500/15 dark:text-blue-300",neutral:"bg-oai-gray-100 text-oai-gray-600 dark:bg-oai-gray-800 dark:text-oai-gray-400"};function Je(){const p=ge.useRef(null),[b,S]=ge.useState(!1);ge.useEffect(()=>{const _=p.current;if(!_)return;const C=a=>_.querySelector(`#${a}`);let se=!1;const e={unknown:t("ipcheck.common.unknown"),failed:t("ipcheck.ip.failed"),regionAccessible:t("ipcheck.trust.region.accessible"),regionWarnTitle:a=>t("ipcheck.trust.region_warn.title",{region:a}),regionWarnBody:t("ipcheck.trust.region_warn.body"),regionRestrictedText:t("ipcheck.trust.text.restricted"),noData:t("ipcheck.trust.no_data"),noIp:t("ipcheck.trust.no_ip"),noScore:t("ipcheck.trust.no_score"),score:{pristine:t("ipcheck.trust.label.pristine"),clean:t("ipcheck.trust.label.clean"),good:t("ipcheck.trust.label.good"),neutral:t("ipcheck.trust.label.neutral"),suspicious:t("ipcheck.trust.label.suspicious"),unreachable:t("ipcheck.trust.label.unreachable")},scoreText:{excellent:t("ipcheck.trust.text.excellent"),great:t("ipcheck.trust.text.great"),minor:t("ipcheck.trust.text.minor"),moderate:t("ipcheck.trust.text.moderate"),severe:t("ipcheck.trust.text.severe")},propsRegion:t("ipcheck.props.region"),propsCity:t("ipcheck.props.city"),propsType:t("ipcheck.props.type"),propsAsn:t("ipcheck.props.asn"),propsOrg:t("ipcheck.props.org"),propsResidential:t("ipcheck.props.residential"),propsDatacenter:t("ipcheck.props.datacenter"),secVpn:t("ipcheck.security.vpn"),secProxy:t("ipcheck.security.proxy"),secTor:t("ipcheck.security.tor"),secCrawler:t("ipcheck.security.crawler"),secAbuser:t("ipcheck.security.abuser"),secProxyFlag:t("ipcheck.security.proxy_flag"),secCrawlerYes:t("ipcheck.security.crawler_yes"),secCrawlerNo:t("ipcheck.security.crawler_no"),secAbuserYes:t("ipcheck.security.abuser_yes"),secAbuserNo:t("ipcheck.security.abuser_no"),secClean:t("ipcheck.security.clean"),availSvc:t("ipcheck.avail.svc_row"),availLat:{normal:t("ipcheck.avail.latency.normal"),good:t("ipcheck.avail.latency.good"),slow:t("ipcheck.avail.latency.slow"),unreachable:t("ipcheck.avail.latency.unreachable")},availSvcStatus:{none:t("ipcheck.avail.svc.none"),minor:t("ipcheck.avail.svc.minor"),major:t("ipcheck.avail.svc.major"),critical:t("ipcheck.avail.svc.critical"),maintenance:t("ipcheck.avail.svc.maintenance"),other:t("ipcheck.avail.svc.other")},dnsStatus:t("ipcheck.dns.status"),dnsOutlet:t("ipcheck.dns.outlet"),dnsOutletIp:t("ipcheck.dns.outlet_ip"),dnsIsp:t("ipcheck.dns.isp"),dnsLeaked:t("ipcheck.dns.leaked"),dnsNoLeak:t("ipcheck.dns.no_leak"),dnsEncrypted:t("ipcheck.dns.encrypted"),dnsCnTag:t("ipcheck.dns.cn_tag"),udpStatus:t("ipcheck.udp.status"),udpOutlet:t("ipcheck.udp.outlet"),udpOutletIp:t("ipcheck.udp.outlet_ip"),udpOrigin:t("ipcheck.udp.origin"),udpDisabled:t("ipcheck.udp.disabled"),udpNoLeak:t("ipcheck.udp.no_leak"),udpLeaked:t("ipcheck.udp.leaked"),udpAnomaly:t("ipcheck.udp.anomaly"),devTz:t("ipcheck.device.tz"),devLang:t("ipcheck.device.lang"),devOs:t("ipcheck.device.os"),devTouch:t("ipcheck.device.touch"),devNet:t("ipcheck.device.net"),devDnt:t("ipcheck.device.dnt"),devWebglRender:t("ipcheck.device.webgl_render"),devCanvasFp:t("ipcheck.device.canvas_fp"),devWebglFp:t("ipcheck.device.webgl_fp"),devMatch:t("ipcheck.device.match"),devMismatch:t("ipcheck.device.mismatch"),devLocal:t("ipcheck.device.local"),devEstSuffix:t("ipcheck.device.estimate_suffix"),devDiffEqual:t("ipcheck.device.diff_equal"),devDiffAhead:a=>t("ipcheck.device.diff_ahead",{h:a}),devDiffBehind:a=>t("ipcheck.device.diff_behind",{h:a}),devLangExpected:t("ipcheck.device.lang_expected"),devTouchYes:t("ipcheck.device.touch_yes"),devTouchNo:t("ipcheck.device.touch_no"),devDntOn:t("ipcheck.device.dnt_on"),devDntOff:t("ipcheck.device.dnt_off"),devDntUnset:t("ipcheck.device.dnt_unset"),devNetUnsupported:t("ipcheck.device.net_unsupported"),devUnsupported:t("ipcheck.device.unsupported"),histEmpty:t("ipcheck.history.empty"),histCurrent:t("ipcheck.history.current"),histLoading:t("ipcheck.ip.loading")};function f(a,i="neutral"){return`<span class="inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium ${Te[i]||Te.neutral}">${a}</span>`}function J(a,i,r){return a===!0?f(i,"danger"):a===!1?f(r,"safe"):f(e.unknown,"neutral")}function he(a){if(!a)return`<span class="text-oai-gray-400 dark:text-oai-gray-500">${w(e.failed)}</span>`;const i=w(a);return Z(a)?`<span class="ip-mask-target truncate" title="${i}">${w(Ke(a))}</span>`:`<span class="ip-mask-target">${i}</span>`}function K(a){return a?`<span class="ip-link">${he(a)}</span>`:`<span class="text-oai-gray-400 dark:text-oai-gray-500">${w(e.failed)}</span>`}function d(a,i,r=!1){let u=i;return i===void 0?r?u=`<div class="inline-flex items-center gap-1.5 text-xs text-oai-gray-400">
<svg class="animate-spin-subtle h-3.5 w-3.5" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="3"></circle>
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
</svg>
</div>`:u='<span class="block h-3 w-20 rounded bg-oai-gray-100 dark:bg-oai-gray-800 shimmer"></span>':u=`<div class="animate-scale-up-fade">${i}</div>`,`<div class="flex items-center justify-between py-2.5 gap-3">
<span class="text-sm text-oai-gray-500 dark:text-oai-gray-400 shrink-0">${a}</span>
<span class="text-sm font-medium text-oai-black dark:text-white text-right min-w-0">${u}</span>
</div>`}function re(a){return a.map(i=>d(i,void 0)).join("")}function oe(){return'<div class="h-7 w-44 rounded bg-oai-gray-100 dark:bg-oai-gray-800 shimmer"></div>'}function ce(){return'<div class="h-3 w-52 mt-2 rounded bg-oai-gray-100 dark:bg-oai-gray-800 shimmer"></div>'}function _e(a){return a>=95?{text:e.score.pristine,variant:"safe"}:a>=80?{text:e.score.clean,variant:"safe"}:a>=50?{text:e.score.good,variant:"info"}:a>=25?{text:e.score.neutral,variant:"warn"}:{text:e.score.suspicious,variant:"danger"}}const m={ip:null,ippure:null,ipapis:null,claudeGeo:null,claudeRisk:null,cfGeo:"",scoreAnimId:null,lastScore:0};function xe(){const a=(m.claudeRisk?.countryCode||"").toUpperCase();return!a||!Ue.includes(a)?null:t(`ipcheck.region.${a}`)}function le(){const a=C("ipv6Warn");a&&a.classList.remove("hidden")}function te(a,i){const r=C(a);r&&(r.textContent=i||"",r.classList.remove("animate-pulse","bg-oai-gray-200","dark:bg-oai-gray-800","w-52","h-3","mt-2","rounded"))}const Le={gaugeScore:'<span class="block h-8 w-16 rounded bg-oai-gray-100 dark:bg-oai-gray-800 shimmer"></span>',ipAddrCN:oe(),ipGeoCN:ce(),ipAddr:oe(),ipGeo:ce(),ipAddrClaude:oe(),ipGeoClaude:ce(),propsContent:re([e.propsRegion,e.propsCity,e.propsType,e.propsAsn,e.propsOrg]),securityContent:re([e.secVpn,e.secProxy,e.secTor,e.secCrawler,e.secAbuser]),claudeAvailContent:d("claude.ai",void 0,!0)+d("anthropic.com",void 0,!0),dnsLeakContent:d(e.dnsStatus,void 0,!0)+d(e.dnsOutletIp,void 0,!0),udpLeakContent:d(e.udpStatus,void 0,!0)+d(e.udpOutletIp,void 0,!0),deviceContent:re([e.devTz,e.devLang,e.devOs,e.devTouch,e.devNet,e.devDnt,e.devWebglRender,e.devCanvasFp]),ipHistoryContent:`<span class="text-sm text-oai-gray-400 dark:text-oai-gray-500">${e.histLoading}</span>`};Object.entries(Le).forEach(([a,i])=>{const r=C(a);r&&(r.innerHTML=i)});let ye=!1;function Ne(a){if(!a)return;a.dataset.realText||(a.dataset.realText=(a.textContent||"").trim());const i=a.dataset.realText,r=ye?Fe(i):i;a.textContent!==r&&(a.textContent=r)}function ke(){_.querySelectorAll(".ip-link, .ip-mask-target").forEach(Ne)}const ve=new MutationObserver(()=>requestAnimationFrame(ke));["ipHeroCN","ipHero","ipHeroClaude","ipHistoryContent","dnsLeakContent","udpLeakContent"].forEach(a=>{const i=C(a);i&&ve.observe(i,{childList:!0,subtree:!0})}),_.__setMaskOn=a=>{ye=!!a,ke()};async function $e(){try{const r=(await(await fetch("https://1.1.1.1/cdn-cgi/trace",{signal:AbortSignal.timeout(5e3)})).text()).match(/ip=([^\n]+)/);r&&(m.ip=r[1].trim())}catch{}}async function je(){try{const i=await(await fetch("https://claude.ai/cdn-cgi/trace",{cache:"no-store",signal:AbortSignal.timeout(8e3)})).text(),r=Object.fromEntries(i.trim().split(`
`).map(u=>u.split("=")));return{ip:r.ip||null,loc:r.loc?.toLowerCase()||null}}catch{return null}}async function Me(){try{const r=(await(await fetch("https://2026.ip138.com/",{signal:AbortSignal.timeout(5e3)})).text()).match(/(\d+\.\d+\.\d+\.\d+)/);if(r)return{ip:r[1]}}catch{}try{const r=(await(await fetch("https://my.ip.cn/",{signal:AbortSignal.timeout(5e3)})).text()).match(/(\d+\.\d+\.\d+\.\d+)/);if(r)return{ip:r[1]}}catch{}return null}async function Ee(a,i,r,u){const g=C(a),o=C(i);if(!(!g||!o)){if(!r){g.innerHTML=`<span class="text-oai-gray-400 dark:text-oai-gray-500">${e.failed}</span>`,o.textContent="";return}Z(r)&&le(),g.innerHTML=`${B(u)+" "}${K(r)}`;try{const l=await fetch(`${j}/api/geoip/${r}`,{signal:AbortSignal.timeout(5e3)});if(l.ok){const h=await l.json(),s=[h.country,h.region,h.city,h.isp].filter(Boolean).join(" · "),x=h.country_code||u||"";g.innerHTML=`${B(x)} ${K(r)}`,te(i,s)}}catch{}}}function Ie(){const a=m.ippure,i=m.claudeRisk,r=m.claudeGeo,u=m.ipapis,g=i?.asn||a?.asn||"",o=i?.asOrganization||a?.asOrganization||u?.company?.name||"",l=xe(),h=!!(i&&i.ip);let s,x=null;h?l?(s=0,x=e.regionRestrictedText):s=typeof i.trust_score=="number"?i.trust_score:null:s=null;const v=C("gaugePointer"),c=C("gaugeScore"),P=C("gaugeText");if(s===null)c.innerHTML=`<span class="text-4xl font-bold tracking-tight tabular-nums text-oai-gray-400 dark:text-oai-gray-500">—</span> ${f(e.noData,"neutral")}`,v.style.left="0%",v.style.opacity="0.3",v.style.borderColor="",v.style.boxShadow="",P.textContent=h?e.noScore:e.noIp;else{const A=l?{text:e.score.unreachable,variant:"danger"}:_e(s),L=s>=50?"text-emerald-500":s>=25?"text-amber-500":"text-red-500",X=s>=50?"#10b981":s>=25?"#f59e0b":"#ef4444";if(m.lastScore!==s){m.scoreAnimId&&cancelAnimationFrame(m.scoreAnimId);const Q=m.lastScore||0;m.lastScore=s;const de=performance.now(),ee=800,ne=ue=>{const N=ue-de,k=Math.min(N/ee,1),$=k*(2-k),I=Math.round(Q+(s-Q)*$),Y=I>=50?"text-emerald-500":I>=25?"text-amber-500":"text-red-500";c&&(c.innerHTML=`<span class="text-4xl font-bold tracking-tight tabular-nums ${Y}">${I}</span> ${f(A.text,A.variant)}`),k<1?m.scoreAnimId=requestAnimationFrame(ne):m.scoreAnimId=null};m.scoreAnimId=requestAnimationFrame(ne)}else c.innerHTML=`<span class="text-4xl font-bold tracking-tight tabular-nums ${L}">${s}</span> ${f(A.text,A.variant)}`;requestAnimationFrame(()=>{requestAnimationFrame(()=>{v&&(v.style.left=Math.min(s,100)+"%",v.style.opacity="1",v.style.borderColor=X,v.style.boxShadow=`0 0 10px ${X}80, 0 2px 6px rgba(0,0,0,0.15)`)})}),P.textContent=x||(s>=95?e.scoreText.excellent:s>=80?e.scoreText.great:s>=50?e.scoreText.minor:s>=25?e.scoreText.moderate:e.scoreText.severe)}const y=C("statusDotClaude");if(y){let A,L;s===null?(A="animate-ping absolute inline-flex h-full w-full rounded-full bg-oai-gray-300 dark:bg-oai-gray-600 opacity-75",L="relative inline-flex h-2 w-2 rounded-full bg-oai-gray-400 dark:bg-oai-gray-500"):l||s<25?(A="animate-ping absolute inline-flex h-full w-full rounded-full bg-red-400 opacity-75",L="relative inline-flex h-2 w-2 rounded-full bg-red-500"):s<50?(A="animate-ping absolute inline-flex h-full w-full rounded-full bg-amber-400 opacity-75",L="relative inline-flex h-2 w-2 rounded-full bg-amber-500"):(A="animate-ping absolute inline-flex h-full w-full rounded-full bg-emerald-400 opacity-75",L="relative inline-flex h-2 w-2 rounded-full bg-emerald-500"),y.innerHTML=`<span class="${A}"></span><span class="${L}"></span>`}const H=C("regionWarn");H&&(l?(H.innerHTML=`<span class="font-medium">⚠️ ${e.regionWarnTitle(l)}</span><br><span class="text-[13px] font-normal mt-1 block opacity-90">${e.regionWarnBody}</span>`,H.classList.remove("hidden")):H.classList.add("hidden"));const G=C("claudeRegionSupportRow"),F=C("claudeRegionSupport");if(G&&F)if(l)G.classList.add("hidden");else{const A=!!(i&&i.ip),L=!!(i&&i.countryCode);F.innerHTML=!A||!L?f(e.unknown,"neutral"):f(e.regionAccessible,"safe"),G.classList.remove("hidden")}const U=i?.isResidential??(u?!u.is_datacenter:null),O=u?.company?.type||"",z=r?.country||i?.country||"",W=r?.city||i?.city||"";let T;if(U===!0?T=f(e.propsResidential,"safe"):U===!1?T=f(e.propsDatacenter,"warn"):T=f(e.unknown,"neutral"),O){const L={hosting:"Hosting",isp:"ISP",business:"Business",education:"Education"}[O]||w(O);T+=` <span class="text-xs text-oai-gray-500 dark:text-oai-gray-400">${L}</span>`}C("propsContent").innerHTML=d(e.propsRegion,z?w(z):f(e.unknown,"neutral"))+d(e.propsCity,W?w(W):f(e.unknown,"neutral"))+d(e.propsType,T)+d(e.propsAsn,g?`<span class="font-mono tabular-nums">AS${w(g)}</span>`:f(e.unknown,"neutral"))+d(e.propsOrg,o?w(o):f(e.unknown,"neutral"));const E=u||{};C("securityContent").innerHTML=d(e.secVpn,J(E.is_vpn,e.secVpn,e.secClean))+d(e.secProxy,J(E.is_proxy,e.secProxyFlag,e.secClean))+d(e.secTor,J(E.is_tor,e.secTor,e.secClean))+d(e.secCrawler,J(E.is_crawler,e.secCrawlerYes,e.secCrawlerNo))+d(e.secAbuser,J(E.is_abuser,e.secAbuserYes,e.secAbuserNo))}async function Re(){const a=C("dnsLeakContent");if(!a)return;a.innerHTML=d(e.dnsStatus,void 0,!0)+d(e.dnsOutletIp,void 0,!0);const i=Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2);for(let s=1;s<=2;s++)await new Promise(x=>{const v=new Image,c=setTimeout(x,2e3);v.onload=v.onerror=()=>{clearTimeout(c),x()},v.src=`http://${i}-${s}.d.ip.net.coffee/pixel.gif?_=${Date.now()}`});await new Promise(s=>setTimeout(s,1500));let r=[];for(let s=0;s<2;s++){try{const x=await fetch(`${j}/api/dns/result/${i}`,{signal:AbortSignal.timeout(3e3)});if(x.ok&&(r=(await x.json()).dns_servers||[],r.length>0))break}catch{}s===0&&await new Promise(x=>setTimeout(x,1500))}if(r.length===0){a.innerHTML=d(e.dnsStatus,f(e.dnsEncrypted,"safe"));return}const u=(m.claudeRisk?.country||"").toLowerCase(),g=u.includes("china")||u.includes("中国");let o=null,l=!1;for(const s of r){let x=null;try{const y=await fetch(`${j}/api/geoip/${s}`,{signal:AbortSignal.timeout(3e3)});y.ok&&(x=await y.json())}catch{}const v=x?.country_code||"",c=x?.isp||"";if(v==="cn"&&!g){o={ip:s,cc:v,isp:c,leaked:!0},l=!0;break}o||(o={ip:s,cc:v,isp:c,leaked:!1})}let h=d(e.dnsStatus,l?f(e.dnsLeaked,"warn"):f(e.dnsNoLeak,"safe"));if(o){const s=`${B(o.cc)} <span class="ip-mask-target ${o.leaked?"text-amber-600 dark:text-amber-400 font-medium":""}">${w(o.ip)}</span>${o.leaked?" "+f(e.dnsCnTag,"warn"):""}`;h+=d(e.dnsOutlet,s),o.isp&&(h+=d(e.dnsIsp,`<span class="text-xs text-oai-gray-500 dark:text-oai-gray-400 font-normal truncate inline-block max-w-[12rem] align-bottom">${w(o.isp)}</span>`))}a.innerHTML=h}async function He(){const a=C("udpLeakContent");if(!a)return;a.innerHTML=d(e.udpStatus,void 0,!0)+d(e.udpOutletIp,void 0,!0);const i=new Set;try{const y=new RTCPeerConnection({iceServers:[{urls:"stun:stun.l.google.com:19302"},{urls:"stun:stun.cloudflare.com:3478"}]});y.createDataChannel("");const H=await y.createOffer();await y.setLocalDescription(H),await new Promise(G=>{const F=setTimeout(()=>{y.close(),G()},5e3);y.onicecandidate=U=>{if(!U.candidate){clearTimeout(F),y.close(),G();return}const O=U.candidate.candidate.match(/([0-9]{1,3}\.){3}[0-9]{1,3}/);if(O){const W=O[0];!W.startsWith("0.")&&!W.startsWith("127.")&&W!=="0.0.0.0"&&i.add(W)}const z=U.candidate.candidate.match(/([a-f0-9]{1,4}:){2,7}[a-f0-9]{1,4}/i);z&&i.add(z[0])}})}catch{}const r=m.claudeRisk?.ip||"",u=[...i],g=u.filter(y=>!Z(y)&&!y.startsWith("192.168.")&&!y.startsWith("10.")&&!y.startsWith("172.")&&!y.startsWith("198.18.")&&!y.startsWith("198.19.")&&!y.startsWith("100.64.")&&!y.startsWith("127.")&&!y.startsWith("0."));if(g.length===0&&u.length===0){a.innerHTML=d(e.udpStatus,f(e.udpDisabled,"safe"));return}if(g.length===0){a.innerHTML=d(e.udpStatus,f(e.udpNoLeak,"safe"));return}let o=g.find(y=>y===r)||g[0];const l=new Set(g).size>1,h=o===r,s=l&&!h;let x=d(e.udpStatus,s?f(e.udpLeaked,"warn"):f(e.udpNoLeak,"safe")),v="",c="";try{const y=await fetch(`${j}/api/geoip/${o}`,{signal:AbortSignal.timeout(5e3)});if(y.ok){const H=await y.json();v=H.country_code||"",c=H.country||""}}catch{}const P=`${B(v)} <span class="${s?"text-amber-600 dark:text-amber-400 font-medium":""}">${he(o)}</span>${h?"":s?" "+f(e.udpAnomaly,"warn"):""}`;x+=d(e.udpOutlet,P),c&&(x+=d(e.udpOrigin,`<span class="text-xs text-oai-gray-500 dark:text-oai-gray-400 font-normal">${w(c)}</span>`)),a.innerHTML=x}async function be(){const a=C("claudeAvailContent");if(!a)return;a.innerHTML=d("claude.ai",void 0,!0)+d("anthropic.com",void 0,!0);const i=[{name:"claude.ai",url:"https://claude.ai/cdn-cgi/trace"},{name:"anthropic.com",url:"https://www.anthropic.com/favicon.ico"}],r=await Promise.allSettled(i.map(async o=>{const l=performance.now();try{return await fetch(o.url,{mode:"no-cors",signal:AbortSignal.timeout(6e3)}),{name:o.name,ms:Math.round(performance.now()-l),ok:!0}}catch{return{name:o.name,ms:-1,ok:!1}}})),u=xe();let g="";r.forEach(o=>{const l=o.value;if(u)g+=d(l.name,f(e.availLat.unreachable,"danger"));else if(l.ok){const h=l.ms<250?"safe":l.ms<500?"info":"warn",s=l.ms<250?e.availLat.normal:l.ms<500?e.availLat.good:e.availLat.slow;g+=d(l.name,`${f(s,h)} <span class="text-xs text-oai-gray-500 dark:text-oai-gray-400 font-normal">${l.ms}ms</span>`)}else g+=d(l.name,f(e.availLat.unreachable,"danger"))});try{const o=await fetch(`${j}/claude/status.json`,{signal:AbortSignal.timeout(3e3)});if(o.ok){const h=(await o.json()).overall_indicator||"none",s=e.availSvcStatus[h]||e.availSvcStatus.other,x={none:"safe",minor:"warn",major:"danger",critical:"danger",maintenance:"warn"};g+=d(e.availSvc,f(s,x[h]||"warn"))}}catch{}a.innerHTML=g}_.__detectClaudeAvail=be;function Oe(){const a=Intl.DateTimeFormat().resolvedOptions().timeZone||e.unknown,i=-(new Date().getTimezoneOffset()/60),r="UTC"+(i>=0?"+":"")+i,u=m.claudeRisk,g=(u?.countryCode||"").toUpperCase(),o=u?.timezone||ze[g]||"",l=!!u?.timezone,h=Ve(o),s=-new Date().getTimezoneOffset();let x=null;o&&h!=null&&(x=Math.abs(h-s)<=60);let v;const c=w(a),P=w(o);if(x===!0)v=`${f(e.devMatch,"safe")} <span class="text-xs text-oai-gray-500 dark:text-oai-gray-400">${c} (${r})</span>`;else if(x===!1){const N=Ye(h),k=Math.round((h-s)/60),$=k===0?e.devDiffEqual:k>0?e.devDiffAhead(k):e.devDiffBehind(-k),I=l?P:`${P} ${e.devEstSuffix}`;v=`${f(e.devMismatch,"warn")}<br><span class="text-xs text-oai-gray-500 dark:text-oai-gray-400 font-normal">${e.devLocal} ${c} (${r})<br>Claude ${I} (${N}) · ${$}</span>`}else v=`<span class="text-xs text-oai-gray-500 dark:text-oai-gray-400 font-normal">${c} (${r})</span>`;const y=navigator.languages||[navigator.language],H=y.join(", ")||e.unknown,G=(y[0]||"").split("-")[0].toLowerCase(),F=We[g]||[],U=G&&F.length?F.includes(G):null;let O;const z=w(H),W=w(F.join(" / "));U===!0?O=`${f(e.devMatch,"safe")} <span class="text-xs text-oai-gray-500 dark:text-oai-gray-400">${z}</span>`:U===!1?O=`${f(e.devMismatch,"warn")}<br><span class="text-xs text-oai-gray-500 dark:text-oai-gray-400 font-normal">${e.devLocal} ${z}<br>${e.devLangExpected} ${W}</span>`:O=`<span class="text-xs text-oai-gray-500 dark:text-oai-gray-400 font-normal">${z}</span>`;const T=navigator.userAgent;let E=e.unknown,A=e.unknown;T.includes("Windows")?E="Windows":T.includes("Mac OS")?E="macOS":T.includes("iPhone")||T.includes("iPad")?E="iOS":T.includes("Android")?E="Android":T.includes("Linux")&&(E="Linux"),T.includes("Edg/")?A="Edge "+(T.match(/Edg\/([\d.]+)/)||[])[1]:T.includes("Chrome/")?A="Chrome "+(T.match(/Chrome\/([\d.]+)/)||[])[1]:T.includes("Firefox/")?A="Firefox "+(T.match(/Firefox\/([\d.]+)/)||[])[1]:T.includes("Safari/")&&!T.includes("Chrome")&&(A="Safari "+(T.match(/Version\/([\d.]+)/)||[])[1]);let L=e.devUnsupported;try{const N=document.createElement("canvas"),k=N.getContext("webgl")||N.getContext("experimental-webgl");if(k){const $=k.getExtension("WEBGL_debug_renderer_info");$&&(L=k.getParameter($.UNMASKED_RENDERER_WEBGL))}}catch{}let X=e.devUnsupported;try{const N=document.createElement("canvas"),k=N.getContext("webgl")||N.getContext("experimental-webgl");if(k){const $=k.getExtension("WEBGL_debug_renderer_info"),I=$?k.getParameter($.UNMASKED_VENDOR_WEBGL):"",Y=$?k.getParameter($.UNMASKED_RENDERER_WEBGL):"",Ce=I+"~"+Y+"~"+k.getParameter(k.VERSION)+"~"+k.getParameter(k.SHADING_LANGUAGE_VERSION);let ie=0;for(let pe=0;pe<Ce.length;pe++)ie=(ie<<5)-ie+Ce.charCodeAt(pe)|0;X=(ie>>>0).toString(16).toUpperCase()}}catch{}let Q=e.devUnsupported;try{const N=document.createElement("canvas");N.width=200,N.height=50;const k=N.getContext("2d");k.textBaseline="top",k.font="14px Arial",k.fillStyle="#f60",k.fillRect(50,0,100,50),k.fillStyle="#069",k.fillText("net.coffee",2,15),k.fillStyle="rgba(102,204,0,0.7)",k.fillText("canvas fp",4,30);const $=N.toDataURL();let I=0;for(let Y=0;Y<$.length;Y++)I=(I<<5)-I+$.charCodeAt(Y)|0;Q=(I>>>0).toString(16).toUpperCase()}catch{}const de=navigator.maxTouchPoints>0,ee=navigator.connection||navigator.mozConnection||navigator.webkitConnection,ne=ee?ee.effectiveType||ee.type||e.unknown:e.devNetUnsupported,ue=navigator.doNotTrack==="1"?e.devDntOn:navigator.doNotTrack==="0"?e.devDntOff:e.devDntUnset;C("deviceContent").innerHTML=d(e.devTz,v)+d(e.devLang,O)+d(e.devOs,`${w(E)} <span class="text-oai-gray-400 dark:text-oai-gray-500">/</span> ${w(A)}`)+d(e.devTouch,de?f(e.devTouchYes,"info"):f(e.devTouchNo,"neutral"))+d(e.devNet,`<span class="font-mono uppercase">${w(ne)}</span>`)+d(e.devDnt,w(ue))+d(e.devWebglRender,`<span class="text-xs font-normal text-oai-gray-600 dark:text-oai-gray-400 break-all">${w(L)}</span>`)+d(e.devCanvasFp,`<span class="font-mono text-oai-gray-700 dark:text-oai-gray-300">${w(Q)}</span>`)+d(e.devWebglFp,`<span class="font-mono text-oai-gray-700 dark:text-oai-gray-300">${w(X)}</span>`)}function we(){try{return JSON.parse(localStorage.getItem(fe))||[]}catch{return[]}}function Pe(){const a=m.claudeRisk?.ip||"",i=(m.claudeRisk?.countryCode||"").toLowerCase(),r=m.claudeRisk?.city||"";if(!a){ae();return}const u=we(),g=new Date,o={ip:a,cc:i,geo:r,time:g.toISOString()};if(u.length>0){const l=u[0],h=(g-new Date(l.time))/(1e3*60*60);if(l.ip===a&&h<24){ae();return}}u.unshift(o),u.length>Se&&(u.length=Se),localStorage.setItem(fe,JSON.stringify(u)),ae()}function ae(){const a=C("ipHistoryContent");if(!a)return;const i=we();if(i.length===0){a.innerHTML=`<span class="text-sm text-oai-gray-500 dark:text-oai-gray-400">${e.histEmpty}</span>`;return}a.innerHTML=`<ul class="divide-y divide-oai-gray-100 dark:divide-oai-gray-800">${i.map((r,u)=>{const g=new Date(r.time),o=`${g.getMonth()+1}-${g.getDate()} ${String(g.getHours()).padStart(2,"0")}:${String(g.getMinutes()).padStart(2,"0")}`,l=u===0;return`<li class="flex items-center justify-between py-3 gap-4">
<div class="flex items-center gap-2 min-w-0">
<span class="text-sm ${l?"text-oai-black dark:text-white":"text-oai-gray-500 dark:text-oai-gray-400"}">${o}</span>
${l?`<span class="inline-flex items-center rounded-full bg-emerald-50 text-emerald-700 dark:bg-emerald-500/15 dark:text-emerald-300 px-1.5 py-0.5 text-[10px] font-medium">${w(e.histCurrent)}</span>`:""}
</div>
<div class="flex items-center gap-2 text-sm font-medium text-oai-black dark:text-white min-w-0">
${B(r.cc)}
${K(r.ip)}
${r.geo?`<span class="text-xs text-oai-gray-500 dark:text-oai-gray-400 font-normal truncate">${w(r.geo)}</span>`:""}
</div>
</li>`}).join("")}</ul>`}_.__clearIPHistory=()=>{localStorage.removeItem(fe),ae()};async function De(){const[,a,i]=await Promise.allSettled([$e(),Me(),je()]);if(se)return;const r=a.status==="fulfilled"?a.value:null,u=i.status==="fulfilled"?i.value:null,g=[];g.push(Ee("ipAddrCN","ipGeoCN",r?.ip,"cn")),g.push((async()=>{const o=C("ipAddr"),l=C("ipGeo");if(!m.ip){o&&(o.innerHTML=`<span class="text-oai-gray-400 dark:text-oai-gray-500">${e.failed}</span>`),l&&(l.textContent="");return}Z(m.ip)&&le(),o&&(o.innerHTML=K(m.ip));try{const h=await fetch(`${j}/api/geoip/${m.ip}`,{signal:AbortSignal.timeout(5e3)});if(h.ok){const s=await h.json(),x=(s.country_code||"").toLowerCase();m.ippure={ip:m.ip,country:s.country,countryCode:(s.country_code||"").toUpperCase(),region:s.region,city:s.city},m.cfGeo=[s.country,s.region,s.city,s.isp].filter(Boolean).join(" · "),o&&(o.innerHTML=`${B(x)} ${K(m.ip)}`),te("ipGeo",m.cfGeo)}}catch{}})()),g.push((async()=>{const o=u?.ip,l=C("ipAddrClaude"),h=C("ipGeoClaude");if(!o){l&&(l.innerHTML=`<span class="text-oai-gray-400 dark:text-oai-gray-500">${e.failed}</span>`),h&&(h.textContent="");return}Z(o)&&le(),l&&(l.innerHTML=`${B(u.loc||"")} ${K(o)}`);const[s,x]=await Promise.allSettled([fetch(`${j}/api/iprisk/${o}`,{signal:AbortSignal.timeout(1e4)}),fetch(`${j}/api/geoip/${o}`,{signal:AbortSignal.timeout(5e3)})]);let v=!1;if(x.status==="fulfilled"&&x.value.ok)try{const c=await x.value.json();if(c.country){m.claudeGeo={country:c.country,region:c.region,city:c.city,isp:c.isp,country_code:c.country_code};const P=[c.country,c.region,c.city,c.isp].filter(Boolean).join(" · ");l&&(l.innerHTML=`${B(c.country_code||u.loc||"")} ${K(o)}`),te("ipGeoClaude",P),v=!0}}catch{}if(!v&&u.loc&&(l&&(l.innerHTML=`${B(u.loc)} ${K(o)}`),te("ipGeoClaude",Be[u.loc]||u.loc.toUpperCase())),s.status==="fulfilled"&&s.value.ok){const c=await s.value.json();m.ipapis={is_datacenter:c.is_datacenter,is_vpn:c.is_vpn,is_proxy:c.is_proxy,is_tor:c.is_tor,is_crawler:c.is_crawler,is_abuser:c.is_abuser,is_mobile:c.is_mobile,company:{type:c.company_type,name:c.company_name},abuser_score:c.abuser_score,datacenter_name:c.datacenter_name},m.claudeRisk={ip:o,asn:c.asn,asOrganization:c.asOrganization,country:c.country,countryCode:c.countryCode,region:c.region,city:c.city,isResidential:c.isResidential,isBroadcast:c.isBroadcast,trust_score:c.trust_score,timezone:c.timezone}}})()),await Promise.allSettled(g),!se&&(Ie(),Promise.allSettled([Re(),He(),be()]),Oe(),Pe())}return De(),()=>{se=!0,ve.disconnect(),m.scoreAnimId&&cancelAnimationFrame(m.scoreAnimId),delete _.__setMaskOn,delete _.__clearIPHistory,delete _.__detectClaudeAvail}},[]);const M=_=>{S(_),p.current?.__setMaskOn?.(_)},D=()=>p.current?.__clearIPHistory?.(),q=()=>p.current?.__detectClaudeAvail?.(),R={__html:""};return n.jsx("div",{ref:p,className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:n.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:n.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[n.jsxs("div",{className:"flex items-start justify-between gap-4 mb-8",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white mb-3",children:t("ipcheck.page.title")}),n.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base max-w-3xl text-pretty",children:t("ipcheck.page.subtitle")})]}),n.jsxs("label",{className:"shrink-0 inline-flex items-center gap-2.5 cursor-pointer select-none group",children:[n.jsx("div",{className:"text-oai-gray-400 group-hover:text-oai-gray-600 dark:text-oai-gray-500 dark:group-hover:text-oai-gray-300 transition-colors duration-200",children:b?n.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"h-4.5 w-4.5 animate-scale-up-fade",children:[n.jsx("path",{d:"M9.88 9.88a3 3 0 1 0 4.24 4.24"}),n.jsx("path",{d:"M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68"}),n.jsx("path",{d:"M6.61 6.61A13.52 13.52 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61"}),n.jsx("line",{x1:"2",y1:"2",x2:"22",y2:"22"})]}):n.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"h-4.5 w-4.5 animate-scale-up-fade",children:[n.jsx("path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"}),n.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}),n.jsx("span",{className:"text-xs font-medium text-oai-gray-500 group-hover:text-oai-gray-700 dark:text-oai-gray-400 dark:group-hover:text-oai-gray-200 transition-colors duration-200",children:t("ipcheck.mask.toggle")}),n.jsxs("span",{className:"relative inline-block w-9 h-5",children:[n.jsx("input",{type:"checkbox",checked:b,onChange:_=>M(_.target.checked),className:"peer sr-only"}),n.jsx("span",{className:"absolute inset-0 rounded-full bg-oai-gray-200 dark:bg-oai-gray-800 peer-checked:bg-oai-brand-500 transition-colors duration-200"}),n.jsx("span",{className:"absolute top-0.5 left-0.5 h-4 w-4 rounded-full bg-white shadow-sm transition-transform duration-200 peer-checked:translate-x-4"})]})]})]}),n.jsx("div",{id:"ipv6Warn",className:"hidden mb-4 rounded-lg border border-amber-200 bg-amber-50 dark:border-amber-500/30 dark:bg-amber-500/10 px-4 py-3 text-sm text-amber-800 dark:text-amber-200",children:t("ipcheck.ipv6.warn")}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[n.jsx(me,{id:"CN",label:t("ipcheck.ip.cn"),icon:null,className:"animate-fade-in-up stagger-1"}),n.jsx(me,{id:"",label:t("ipcheck.ip.cloudflare"),icon:n.jsx("img",{src:`${j}/favicons/cloudflare.webp`,alt:"",className:"h-4 w-4"}),className:"animate-fade-in-up stagger-2"}),n.jsx(me,{id:"Claude",label:t("ipcheck.ip.claude"),icon:n.jsx("img",{src:`${j}/favicons/claude.webp`,alt:"",className:"h-4 w-4"}),statusDot:!0,className:"animate-fade-in-up stagger-3"})]}),n.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[n.jsx(V,{title:t("ipcheck.trust.title"),subtitle:t("ipcheck.trust.subtitle"),className:"animate-fade-in-up stagger-4",children:n.jsxs("div",{className:"px-1 py-2",children:[n.jsx("div",{className:"flex items-baseline justify-between mb-2 gap-3",children:n.jsx("div",{id:"gaugeScore",className:"flex items-baseline gap-2 min-h-[2.5rem]",dangerouslySetInnerHTML:R})}),n.jsx("div",{id:"gaugeText",className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 mb-4 min-h-[1rem]"}),n.jsxs("div",{children:[n.jsxs("div",{className:"relative",children:[n.jsx("div",{className:"h-1.5 rounded-full",style:{background:"linear-gradient(90deg, #ef4444 0%, #f59e0b 50%, #10b981 100%)"}}),n.jsx("span",{id:"gaugePointer",className:"absolute top-1/2 -translate-y-1/2 h-3.5 w-3.5 rounded-full bg-white dark:bg-oai-gray-900 border-2 border-oai-gray-300 dark:border-oai-gray-700 shadow-[0_2px_6px_rgba(0,0,0,0.15)] dark:shadow-[0_2px_6px_rgba(0,0,0,0.4)] -translate-x-1/2 transition-[left,border-color] duration-700 ease-out",style:{left:"0%"}})]}),n.jsxs("div",{className:"mt-2 flex justify-between text-[10px] uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500 font-medium",children:[n.jsx("span",{children:t("ipcheck.trust.gauge.low")}),n.jsx("span",{className:"tracking-normal",children:"25"}),n.jsx("span",{className:"tracking-normal",children:"50"}),n.jsx("span",{className:"tracking-normal",children:"75"}),n.jsx("span",{children:t("ipcheck.trust.gauge.high")})]})]}),n.jsx("div",{id:"regionWarn",className:"hidden mt-4 rounded-lg border border-red-200 bg-red-50 dark:border-red-500/30 dark:bg-red-500/10 px-3 py-2 text-xs text-red-800 dark:text-red-300"}),n.jsxs("div",{id:"claudeRegionSupportRow",className:"hidden mt-4 pt-4 border-t border-oai-gray-100 dark:border-oai-gray-800 flex items-center justify-between",children:[n.jsx("span",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:t("ipcheck.trust.region_support")}),n.jsx("span",{id:"claudeRegionSupport",className:"text-sm font-medium text-oai-black dark:text-white",dangerouslySetInnerHTML:R})]})]})}),n.jsx(V,{title:t("ipcheck.props.title"),className:"animate-fade-in-up stagger-4",children:n.jsx("div",{id:"propsContent",className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800 pt-1",dangerouslySetInnerHTML:R})}),n.jsx(V,{title:t("ipcheck.security.title"),className:"animate-fade-in-up stagger-4",children:n.jsx("div",{id:"securityContent",className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800 pt-1",dangerouslySetInnerHTML:R})})]}),n.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[n.jsx(V,{title:n.jsxs("span",{className:"flex items-center gap-1.5",children:[t("ipcheck.avail.title"),n.jsx(Ze,{text:t("ipcheck.avail.tooltip")})]}),action:n.jsx(Ae,{label:t("ipcheck.avail.refresh"),onClick:q}),className:"animate-fade-in-up stagger-5",children:n.jsx("div",{id:"claudeAvailContent",className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800 pt-1",dangerouslySetInnerHTML:R})}),n.jsx(V,{title:t("ipcheck.dns.title"),className:"animate-fade-in-up stagger-5",children:n.jsx("div",{id:"dnsLeakContent",className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800 pt-1",dangerouslySetInnerHTML:R})}),n.jsx(V,{title:t("ipcheck.udp.title"),className:"animate-fade-in-up stagger-5",children:n.jsx("div",{id:"udpLeakContent",className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800 pt-1",dangerouslySetInnerHTML:R})})]}),n.jsx(V,{title:t("ipcheck.device.title"),className:"animate-fade-in-up stagger-6",children:n.jsx("div",{id:"deviceContent",className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800 pt-1",dangerouslySetInnerHTML:R})}),n.jsx(V,{title:t("ipcheck.history.title"),subtitle:t("ipcheck.history.subtitle"),action:n.jsx(Ae,{label:t("ipcheck.history.clear"),onClick:D}),className:"animate-fade-in-up stagger-6",children:n.jsx("div",{id:"ipHistoryContent",dangerouslySetInnerHTML:R})})]})]})})})}function V({title:p,subtitle:b,action:S,children:M,className:D=""}){return n.jsxs("section",{className:`rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-5 sm:p-6 transition-colors duration-200 ${D}`,children:[n.jsxs("div",{className:"flex items-start justify-between gap-3 mb-4",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("h2",{className:"text-[15px] font-semibold text-oai-black dark:text-white",children:p}),b?n.jsx("p",{className:"mt-0.5 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:b}):null]}),S]}),M]})}function Ae({label:p,onClick:b}){return n.jsx("button",{type:"button",onClick:b,className:"shrink-0 inline-flex h-7 items-center px-2.5 rounded-md text-xs font-medium text-oai-gray-600 dark:text-oai-gray-300 border border-oai-gray-200 dark:border-oai-gray-700 hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",children:p})}function Ze({text:p}){return n.jsxs("span",{className:"relative inline-flex items-center group",children:[n.jsx("svg",{viewBox:"0 0 16 16",className:"h-3.5 w-3.5 text-oai-gray-400 dark:text-oai-gray-500",fill:"currentColor","aria-hidden":!0,children:n.jsx("path",{d:"M8 1.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13zM7.25 6.75a.75.75 0 0 1 1.5 0V11a.75.75 0 0 1-1.5 0V6.75zM8 4a.85.85 0 1 1 0 1.7A.85.85 0 0 1 8 4z"})}),n.jsx("span",{className:"pointer-events-none absolute left-1/2 top-full z-10 mt-1.5 -translate-x-1/2 w-56 rounded-md bg-oai-gray-900 dark:bg-oai-gray-800 px-2.5 py-2 text-[11px] font-normal text-white opacity-0 scale-95 translate-y-1 group-hover:opacity-100 group-hover:scale-100 group-hover:translate-y-0 transition-all duration-200 cubic-bezier(0.16, 1, 0.3, 1) leading-relaxed shadow-lg origin-top",children:p})]})}function me({id:p,label:b,icon:S,statusDot:M,className:D=""}){const q=`ipAddr${p}`,R=`ipGeo${p}`;return n.jsxs("article",{id:`ipHero${p}`,className:`rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-5 sm:p-6 cursor-default transition-colors duration-200 ${D}`,children:[n.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] uppercase tracking-wider font-medium text-oai-gray-500 dark:text-oai-gray-400 mb-2",children:[S,n.jsx("span",{children:b}),M?n.jsxs("span",{id:`statusDot${p}`,className:"relative inline-flex h-2 w-2 ml-1.5","aria-hidden":!0,children:[n.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-oai-gray-300 dark:bg-oai-gray-600 opacity-75"}),n.jsx("span",{className:"relative inline-flex h-2 w-2 rounded-full bg-oai-gray-400 dark:bg-oai-gray-500"})]}):null]}),n.jsx("div",{id:q,className:"text-xl sm:text-2xl font-semibold text-oai-black dark:text-white flex items-center gap-2 min-h-[2rem]",dangerouslySetInnerHTML:{__html:""}}),n.jsx("div",{id:R,className:"mt-1 text-xs text-oai-gray-500 dark:text-oai-gray-400 truncate min-h-[1rem]"})]})}export{Je as default};

Sorry, the diff of this file is too big to display

import{R as l,j as c,d as h}from"./__vite-browser-external-CuMc3dqk.js";function d(n){let t=0;const e=String(n??"");for(let r=0;r<e.length;r+=1)t=Math.imul(31,t)+e.charCodeAt(r)|0;return Math.abs(t)%360}function x(n){const t=String(n??"").trim();if(!t)return"?";const e=t.split(/\s+/).filter(Boolean);if(e.length>=2){const r=e[0][0]||"",i=e[1][0]||"";return`${r}${i}`.toUpperCase()}return t.slice(0,2).toUpperCase()}const m={sm:"h-7 w-7 min-h-7 min-w-7 text-[10px]",md:"h-8 w-8 min-h-8 min-w-8 text-[11px]",lg:"h-14 w-14 min-h-14 min-w-14 text-base",xl:"h-[68px] w-[68px] min-h-[68px] min-w-[68px] text-xl"};function g({avatarUrl:n,displayName:t,seed:e,size:r="md",className:i}){const o=m[r]||m.md,f=d(e??t??""),s=typeof n=="string"?n.trim():"",[u,a]=l.useState(!1);return l.useEffect(()=>{a(!1)},[s]),s&&!u?c.jsx("img",{src:s,alt:"",referrerPolicy:"no-referrer",onError:()=>a(!0),className:h("rounded-full object-cover ring-1 ring-white/10",o,i)}):c.jsx("div",{className:h("flex shrink-0 items-center justify-center rounded-full font-semibold text-white ring-1 ring-white/10",o,i),style:{backgroundColor:`hsl(${f} 42% 34%)`},"aria-hidden":!0,children:x(t)})}export{g as L};
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/LeaderboardProfileModal-TF73oBuo.js","assets/__vite-browser-external-CuMc3dqk.js","assets/__vite-browser-external-WKilYZnq.css","assets/provider-display-Cn2q9F2Z.js","assets/useCurrency-DdWYV5RR.js","assets/useTokenFormat-BkFEXBXZ.js","assets/maximize-2-BZX57ABx.js","assets/terminal-d0IOaeZn.js","assets/info-CDTfOJ13.js","assets/LeaderboardAvatar-DKH9A5GV.js","assets/ProviderIcon-B6sgfDtI.js","assets/AchievementBadge-DvulAUrw.js","assets/zap-CcqNcNpw.js","assets/flame-VQYtrvgY.js","assets/AchievementsSection-CgiOHh54.js","assets/react-B80AX8fE.js","assets/format-tokens-173-9MpR.js","assets/use-reduced-motion-BEAopWkx.js","assets/arrow-up-right-D2tCxxHL.js","assets/link-2-CmjxdvpK.js","assets/check-Dy8VgHZ8.js","assets/DialogTitle-KxLDeLzC.js","assets/useScrollLock-DmM-LeMm.js","assets/store-NtnkxrS2.js","assets/CommunityStatsModal-39LI1iYz.js","assets/icons-D2Ro70sQ.js","assets/TrendMonitor-Bxy1Vnax.js","assets/chevron-right-D1F23F5W.js","assets/PopoverPopup-B6oEN7QL.js","assets/ToolbarRootContext-xOR5ZEzv.js","assets/DialogDescription-BgYqW0_C.js","assets/DialogClose-DmGnH7p-.js"])))=>i.map(i=>d[i]);
import{l as ua,j as e,R as xa,c as s,d,r as c,am as ga,e as ba,u as pa,a as ha,an as fa,J as ya,ao as ka,ap as wa,aq as ze,ar as ja,as as ne,g as va,at as Na,L as _a,au as Sa,k as Ca,av as La,aw as Ea,a7 as Ta,_ as Fe,i as Aa,x as Ma}from"./__vite-browser-external-CuMc3dqk.js";import{S as Pa}from"./Select-C6oiyYQ_.js";import{m as Ka}from"./react-B80AX8fE.js";import{u as Ra,C as Ia,a as za,b as Ba,c as Be,D as Da,d as $a,S as Ua,h as Oa,s as Fa,K as Ga,P as Ha}from"./use-ordered-list-DlXnvIC-.js";import{P as he}from"./ProviderIcon-B6sgfDtI.js";import{u as Ya}from"./useCurrency-DdWYV5RR.js";import{u as Q}from"./useTokenFormat-BkFEXBXZ.js";import{L as Z}from"./LeaderboardAvatar-DKH9A5GV.js";import{s as Wa,c as Va,A as Ja,t as qa,b as Za}from"./AchievementBadge-DvulAUrw.js";import{u as Xa}from"./use-community-stats-BBYRffIf.js";import"./ToolbarRootContext-xOR5ZEzv.js";import"./useScrollLock-DmM-LeMm.js";import"./check-Dy8VgHZ8.js";import"./SelectItemText-DrcW545o.js";import"./zap-CcqNcNpw.js";import"./flame-VQYtrvgY.js";const Qa=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],er=ua("arrow-right",Qa),ar=a=>{let{transform:r}=a;return{...r,y:0}};function H(a,{min:r,max:o,fallback:n}){const l=Number(a);if(!Number.isFinite(l))return n;const i=Math.floor(l);return i<r?r:i>o?o:i}function rr(a,r){const o=H(r,{min:0,max:1e6,fallback:0}),n=H(a,{min:1,max:Math.max(1,o||1),fallback:1});if(o<=1)return[1];const l=new Set([1,o,n-2,n-1,n,n+1,n+2]),i=Array.from(l).filter(x=>Number.isInteger(x)&&x>=1&&x<=o).sort((x,p)=>x-p),m=[];let b=null;for(const x of i)b!=null&&x-b>1&&m.push(null),m.push(x),b=x;return m}function tr({page:a,totalPages:r}){const o=typeof r=="number"&&Number.isFinite(r)&&r>=0,n=o?H(r,{min:0,max:1e6,fallback:0}):null,l=H(a,{min:1,max:o?Math.max(1,n||1):1e6,fallback:1}),i=l>1,m=o?l<n:!0;return{canPrev:i,canNext:m,safePage:l,safeTotal:n}}function or({entries:a,me:r,meLabel:o}){const n=Array.isArray(a)?a:[],l=r&&typeof r.rank=="number"?r.rank:null;return!l||n.some(m=>!!m?.is_me)?n:[{rank:l,is_me:!0,is_pinned:!0,user_id:r?.user_id??null,display_name:o,avatar_url:r?.avatar_url??null,github_url:null,is_public:!1,gpt_tokens:r?.gpt_tokens??"0",claude_tokens:r?.claude_tokens??"0",gemini_tokens:r?.gemini_tokens??"0",cursor_tokens:r?.cursor_tokens??"0",opencode_tokens:r?.opencode_tokens??"0",openclaw_tokens:r?.openclaw_tokens??"0",hermes_tokens:r?.hermes_tokens??"0",kiro_tokens:r?.kiro_tokens??"0",copilot_tokens:r?.copilot_tokens??"0",kimi_tokens:r?.kimi_tokens??"0",other_tokens:r?.other_tokens??"0",total_tokens:r?.total_tokens??"0",estimated_cost_usd:r?.estimated_cost_usd??null,badges:Array.isArray(r?.badges)?r.badges:[]},...n]}function sr(a,r){const o=Number(a),n=Number(r);return!Number.isFinite(o)||o<1||!Number.isFinite(n)||n<1?null:Math.ceil(o/n)}const nr=new Set(["/brand-logos/cursor.svg","/brand-logos/kimi.svg","/brand-logos/kiro.svg","/brand-logos/copilot.svg","/brand-logos/hermes.svg"]);function ir({iconSrc:a,label:r}){return e.jsxs("span",{className:"inline-flex items-center gap-3",children:[a?e.jsx("img",{src:a,alt:"",width:16,height:16,className:`h-4 w-4 shrink-0 object-contain opacity-90 ${nr.has(a)?"dark:invert":""}`}):null,e.jsx("span",{className:"whitespace-nowrap",children:r})]})}const ie=xa.memo(function({badges:r,max:o=3,className:n=""}){const l=Wa((r||[]).filter(i=>i&&Va.has(i.id)&&(i.tier||0)>=1)).slice(0,o);return l.length===0?null:e.jsx("span",{className:`pointer-events-none inline-flex shrink-0 items-center ${n}`,children:l.map((i,m)=>e.jsx("span",{title:s("achievements.mini.tooltip",{name:s(Za(i.id,"name")),tier:s(`achievements.tier.${qa(i.tier)}`)}),style:{zIndex:l.length-m},className:`pointer-events-auto relative inline-flex ${m>0?"-ml-1.5":""}`,children:e.jsx(Ja,{badgeId:i.id,tier:i.tier,size:"xs",className:"rounded-full ring-[1.5px] ring-white dark:ring-oai-gray-950"})},i.id))})}),X=[{key:"gpt_tokens",copyKey:"leaderboard.column.codex",icon:"/brand-logos/codex.svg"},{key:"claude_tokens",copyKey:"leaderboard.column.claude",icon:"/brand-logos/claude-code.svg"},{key:"gemini_tokens",copyKey:"leaderboard.column.gemini",icon:"/brand-logos/gemini.svg"},{key:"cursor_tokens",copyKey:"leaderboard.column.cursor",icon:"/brand-logos/cursor.svg"},{key:"kiro_tokens",copyKey:"leaderboard.column.kiro",icon:"/brand-logos/kiro.svg"},{key:"copilot_tokens",copyKey:"leaderboard.column.copilot",icon:"/brand-logos/copilot.svg"},{key:"kimi_tokens",copyKey:"leaderboard.column.kimi",icon:"/brand-logos/kimi.svg"},{key:"opencode_tokens",copyKey:"leaderboard.column.opencode",icon:"/brand-logos/opencode.svg"},{key:"openclaw_tokens",copyKey:"leaderboard.column.openclaw",icon:"/brand-logos/openclaw.svg"},{key:"hermes_tokens",copyKey:"leaderboard.column.hermes",icon:"/brand-logos/hermes.svg"},{key:"other_tokens",copyKey:"leaderboard.column.supplemental",icon:null}],Ge="sticky left-0 z-40 w-14 min-w-14 max-w-14 sm:w-[72px] sm:min-w-[72px] sm:max-w-[72px] bg-white dark:bg-oai-gray-950 px-2.5 sm:px-4 py-4 align-middle",He="sticky left-[55px] sm:left-[71px] z-40 min-w-[96px] sm:min-w-[200px] max-w-[170px] sm:max-w-[min(260px,45vw)] border-l border-r border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-950 px-3 sm:px-4 py-4 align-middle";function le(a){return d("sticky left-0 z-30 w-14 min-w-14 max-w-14 sm:w-[72px] sm:min-w-[72px] sm:max-w-[72px] px-2.5 sm:px-4 py-4 whitespace-nowrap",a?"bg-oai-brand-50 dark:bg-emerald-950":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900")}function de(a){return d("sticky left-[55px] sm:left-[71px] z-30 hover:z-50 min-w-[96px] sm:min-w-[200px] max-w-[170px] sm:max-w-[min(260px,45vw)] border-l border-r border-oai-gray-200 dark:border-oai-gray-800 px-3 sm:px-4 py-4 min-w-0",a?"bg-oai-brand-50 dark:bg-emerald-950":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900")}function y({className:a}){return e.jsx("div",{className:d("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",a)})}function lr({index:a}){const r=a<3?"w-24":a<8?"w-20":"w-16",o=a<3?"w-16":"w-12",n=a<5?"w-14":"w-10";return e.jsxs("tr",{className:"group",children:[e.jsx("td",{className:d(le(!1),"!group-hover:bg-transparent"),children:e.jsx(y,{className:"h-4 w-6"})}),e.jsx("td",{className:d(de(!1),"!group-hover:bg-transparent"),children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(y,{className:"h-8 w-8 min-w-8 rounded-full"}),e.jsx(y,{className:d("h-4",r)})]})}),e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(y,{className:d("h-4",o)})}),e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(y,{className:"h-4 w-12"})}),X.map(l=>e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(y,{className:d("h-4",n)})},l.key))]})}function dr({index:a}){const r=a<3?"w-24":a<8?"w-20":"w-16",o=a%3===0?3:a%3===1?2:1;return e.jsxs("div",{className:"mx-0 my-1 rounded-xl bg-white dark:bg-oai-gray-950 border border-oai-gray-100 dark:border-oai-gray-800/60 px-3.5 py-3 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(y,{className:"h-4 w-3 shrink-0 rounded"}),e.jsx(y,{className:"h-9 w-9 shrink-0 rounded-full"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx(y,{className:d("h-4",r)}),e.jsx(y,{className:"mt-2 h-3.5 w-20"})]}),e.jsxs("div",{className:"shrink-0 text-right",children:[e.jsx(y,{className:"ml-auto h-3 w-8"}),e.jsx(y,{className:"mt-1.5 ml-auto h-4 w-14"})]})]}),e.jsx("div",{className:"mt-3 flex flex-wrap items-center gap-2 border-t border-oai-gray-100 pt-2.5 dark:border-oai-gray-800/70",children:Array.from({length:o},(n,l)=>e.jsx(y,{className:"h-5 w-12 rounded-full"},l))})]})}function cr({rows:a=10}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"hidden w-full overflow-x-auto sm:block",children:e.jsxs("table",{className:"min-w-max w-full text-left text-sm",children:[e.jsx("thead",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800",children:e.jsxs("tr",{children:[e.jsx("th",{className:d(Ge,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx(y,{className:"h-3.5 w-6"})}),e.jsx("th",{className:d(He,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx(y,{className:"h-3.5 w-12"})}),e.jsx("th",{className:"px-4 py-4",children:e.jsx(y,{className:"h-3.5 w-10"})}),e.jsx("th",{className:"px-4 py-4",children:e.jsx(y,{className:"h-3.5 w-14"})}),X.map(r=>e.jsx("th",{className:"px-4 py-4",children:e.jsx(y,{className:"h-3.5 w-12"})},r.key))]})}),e.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:Array.from({length:a},(r,o)=>e.jsx(lr,{index:o},o))})]})}),e.jsx("div",{className:"flex flex-col py-1 sm:hidden",children:Array.from({length:a},(r,o)=>e.jsx(dr,{index:o},o))})]})}function mr({id:a,thClassName:r,children:o}){const{attributes:n,listeners:l,setNodeRef:i,transform:m,transition:b,isDragging:x}=Ra({id:a}),p=Ia.Transform.toString(m)||"";c.useLayoutEffect(()=>{const f=document.querySelectorAll(`td[data-column-key="${a}"]`),h="0 2px 10px rgba(15, 23, 42, 0.10), 0 1px 3px rgba(15, 23, 42, 0.06)";return f.forEach(g=>{g.style.transform=p,g.style.transition=b||"",g.style.zIndex=x?"20":"",g.style.position=p?"relative":"",g.style.boxShadow=x?h:""}),()=>{f.forEach(g=>{g.style.transform="",g.style.transition="",g.style.zIndex="",g.style.position="",g.style.boxShadow=""})}},[a,p,b,x]);const j={transform:p,transition:b,position:p?"relative":void 0,zIndex:x?20:void 0,boxShadow:x?"0 2px 10px rgba(15, 23, 42, 0.10), 0 1px 3px rgba(15, 23, 42, 0.06)":void 0};return e.jsx("th",{ref:i,style:j,className:d(r,"group/col select-none cursor-grab active:cursor-grabbing touch-none"),...n,...l,children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx("span",{"aria-hidden":"true",className:d("-mr-1 inline-flex h-4 w-3 shrink-0 items-center justify-center text-oai-gray-400 dark:text-oai-gray-600","opacity-0 transition-opacity duration-150 group-hover/col:opacity-100",x&&"opacity-100"),children:e.jsxs("svg",{viewBox:"0 0 8 14",width:"8",height:"14",fill:"currentColor","aria-hidden":"true",children:[e.jsx("circle",{cx:"2",cy:"2",r:"1"}),e.jsx("circle",{cx:"6",cy:"2",r:"1"}),e.jsx("circle",{cx:"2",cy:"7",r:"1"}),e.jsx("circle",{cx:"6",cy:"7",r:"1"}),e.jsx("circle",{cx:"2",cy:"12",r:"1"}),e.jsx("circle",{cx:"6",cy:"12",r:"1"})]})}),o]})})}const ur="tokentracker.leaderboard.columnOrder.v1";function xr(a){return za(ur,a)}const gr=50;function br(a,r){const o=Number(a),n=Number(r);return!Number.isFinite(o)||o<1||!Number.isFinite(n)||n<1?null:Math.min(100,Math.max(1,Math.ceil(o/n*100)))}function Ye(a){return typeof a=="string"?a.trim():""}function pr(a){const r=Ye(a);return r?r.toLowerCase()==="anonymous":!0}function hr({me:a,totalEntries:r,meLabel:o,onOpenProfile:n,onJumpToMe:l,canJump:i,className:m}){const b=a&&typeof a.rank=="number"?a.rank:null;if(!b)return null;const x=Number(r)||0,p=br(b,x),j=Ye(a?.display_name),f=!j||pr(j)?o||"You":j,h=a?.user_id||f,g=n||(i?l:null),T=typeof g=="function",C=T?"button":"div",ee=T?{type:"button",onClick:g,"aria-label":s(n?"leaderboard.summary.view_profile":"leaderboard.summary.jump_to_me")}:{};return e.jsxs(C,{...ee,className:d("group inline-flex h-9 items-center gap-2.5 rounded-full border pl-1 pr-3.5 transition-all duration-300 select-none",T?"border-oai-gray-200 hover:border-oai-brand-400 dark:border-oai-gray-800 dark:hover:border-oai-brand-500/80 bg-oai-gray-50/50 dark:bg-white/[0.02] backdrop-blur-md hover:bg-oai-brand-50/40 dark:hover:bg-oai-brand-950/20 active:scale-[0.97] dark:ring-1 dark:ring-white/[0.04] dark:hover:ring-white/[0.08]":"border-oai-gray-100 dark:border-oai-gray-800/60 bg-oai-gray-50/20 dark:bg-white/[0.01] backdrop-blur-sm dark:ring-1 dark:ring-white/[0.02]",m),children:[e.jsx(Z,{size:"sm",avatarUrl:a?.avatar_url,displayName:f,seed:h}),e.jsx("span",{className:"hidden sm:inline max-w-[120px] truncate text-xs font-semibold text-oai-black dark:text-oai-gray-200 group-hover:text-oai-brand-600 dark:group-hover:text-oai-brand-400 transition-colors",children:f}),e.jsxs("span",{className:"text-xs font-bold tabular-nums text-oai-gray-800 dark:text-white",children:["#",b.toLocaleString()]}),p!=null&&p<=gr&&e.jsx("span",{className:d("hidden sm:inline-flex items-center rounded-full px-2 py-0.5 text-[9px] font-extrabold tracking-wider tabular-nums uppercase transition-colors duration-300 ring-1",p<=10?"bg-amber-500/10 text-amber-600 dark:bg-amber-500/15 dark:text-amber-400 ring-amber-500/20":"bg-oai-brand-100/50 text-oai-brand-700 dark:bg-oai-brand-500/10 dark:text-oai-brand-400 ring-oai-brand-500/10"),children:s("leaderboard.summary.percentile",{p:String(p)})}),T?e.jsx(er,{"aria-hidden":!0,className:"size-3 text-oai-gray-400 transition-all duration-300 group-hover:text-oai-brand-500 dark:text-oai-gray-500 group-hover:translate-x-0.5 group-hover:scale-110"}):e.jsxs("span",{className:"relative flex h-1.5 w-1.5 shrink-0 items-center justify-center ml-1",title:"You are here",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-emerald-400 opacity-75 duration-1000"}),e.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-emerald-500"})]})]})}const fr=c.lazy(()=>Fe(()=>import("./LeaderboardProfileModal-TF73oBuo.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23])).then(a=>({default:a.LeaderboardProfileModal}))),yr=c.lazy(()=>Fe(()=>import("./CommunityStatsModal-39LI1iYz.js"),__vite__mapDeps([24,1,2,15,25,5,10,26,4,7,27,28,22,23,29,6,17,11,12,13,21,30,31])).then(a=>({default:a.CommunityStatsModal}))),ce=[10,20,50,100],me=20,We="tokentracker:leaderboard:pageSize";function kr(){if(typeof window>"u")return me;try{const a=window.localStorage.getItem(We),r=Number(a);if(ce.includes(r))return r}catch{}return me}function ue(a,r,o){const n=Number(a);if(!Number.isFinite(n)||n<=0)return"-";const l=Sa(r),i=r===Ma?n:n*o;return i>=1e3?`${l}${Math.round(i).toLocaleString()}`:i>=10?`${l}${Math.round(i)}`:`${l}${i.toFixed(2)}`}function wr(a){if(typeof a!="string"||!a.trim())return null;const r=new Date(a);if(!Number.isFinite(r.getTime()))return null;const o=Aa();return{dateTime:r.toISOString(),display:new Intl.DateTimeFormat(o,{dateStyle:"medium",timeStyle:"short"}).format(r),exact:new Intl.DateTimeFormat(o,{dateStyle:"full",timeStyle:"long"}).format(r)}}function xe({value:a}){const{formatTokens:r,formatTokensTooltip:o}=Q();return e.jsx("span",{title:o(a),children:r(a)})}function jr({communityStats:a,onClick:r}){const{formatTokens:o,formatTokensTooltip:n}=Q();return a.status!=="ready"?null:e.jsxs("button",{type:"button",onClick:r,className:"inline-flex min-w-0 max-w-full flex-1 items-center gap-1.5 whitespace-nowrap rounded-xl border border-oai-gray-200 bg-oai-gray-50/50 px-2.5 py-2 text-xs text-oai-gray-500 backdrop-blur-md transition-all duration-300 hover:border-oai-brand-400 hover:bg-oai-brand-50/40 active:scale-[0.97] dark:border-oai-gray-800 dark:bg-white/[0.02] dark:text-oai-gray-400 dark:hover:border-oai-brand-500/80 dark:hover:bg-oai-brand-950/20 sm:h-9 sm:flex-none sm:gap-2.5 sm:rounded-full sm:px-3.5 sm:py-0",title:s("leaderboard.community.view_stats"),children:[e.jsxs("span",{className:"relative flex h-1.5 w-1.5 shrink-0","aria-hidden":"true",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-emerald-500/80 opacity-75 duration-1000"}),e.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-emerald-500"})]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"font-semibold text-oai-black dark:text-white tabular-nums",children:e.jsx("span",{title:n(a.tokenFloor),children:o(a.tokenFloor)})}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:s("leaderboard.community.tokens_chip")})]}),e.jsx("span",{className:"text-oai-gray-200 dark:text-oai-gray-800 select-none",children:"·"}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsxs("span",{className:"font-semibold text-oai-black dark:text-white tabular-nums",children:[e.jsx("span",{className:"sm:hidden",children:Ca(a.totalEntries)}),e.jsx("span",{className:"hidden sm:inline",children:(Number(a.totalEntries)||0).toLocaleString("en-US")})]}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:s("leaderboard.community.devs_chip")})]})]})}function De({entry:a,isMe:r,orderedColumns:o}){const{formatTokens:n,formatTokensTooltip:l}=Q(),i=r?"text-oai-gray-700 dark:text-oai-gray-300":"text-oai-gray-500 dark:text-oai-gray-400",m=r?"bg-oai-brand-50 dark:bg-oai-brand-900/10":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900";return o.map(b=>e.jsx("td",{"data-column-key":b.key,title:l(a?.[b.key]),className:d("hidden sm:table-cell px-3 sm:px-4 py-4 whitespace-nowrap text-right tabular-nums",i,m),children:n(a?.[b.key])},b.key))}function vr(a){return a?.key==="gpt_tokens"?"CODEX":a?.key==="claude_tokens"?"CLAUDE":(a?.icon?.split("/").pop()||"").replace(/\.svg$/i,"").toUpperCase()||"OTHER"}const Nr={1:"ring-2 ring-amber-400 dark:ring-amber-500/80 shadow-[0_0_8px_rgba(245,158,11,0.25)]",2:"ring-2 ring-slate-350 dark:ring-slate-450 shadow-[0_0_8px_rgba(148,163,184,0.2)]",3:"ring-2 ring-orange-400 dark:ring-orange-500/70 shadow-[0_0_8px_rgba(249,115,22,0.25)]"};function _r({rank:a,placeholder:r}){return a===1?e.jsx("span",{className:"text-base font-extrabold italic text-amber-500 dark:text-amber-400 tracking-tighter",children:"1"}):a===2?e.jsx("span",{className:"text-base font-extrabold italic text-slate-400 dark:text-slate-350 tracking-tighter",children:"2"}):a===3?e.jsx("span",{className:"text-base font-extrabold italic text-orange-500 dark:text-orange-400 tracking-tighter",children:"3"}):e.jsx("span",{className:"text-[13px] font-bold tabular-nums text-oai-gray-400 dark:text-oai-gray-500",children:a==null?r:`#${a}`})}function Sr({githubUrl:a}){return e.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",onClick:r=>r.stopPropagation(),"aria-label":"GitHub profile",className:"absolute bottom-0 right-0 translate-x-1 translate-y-1 flex h-4.5 w-4.5 items-center justify-center rounded-full bg-white dark:bg-oai-gray-950 text-oai-black dark:text-oai-gray-100 shadow border border-oai-gray-100 dark:border-oai-gray-800 transition-transform active:scale-110",children:e.jsx(he,{provider:"GITHUB",size:11})})}function Cr({entry:a,orderedColumns:r}){const{formatTokens:o,formatTokensTooltip:n}=Q(),l=r.filter(i=>{const m=Number(a?.[i.key]);return Number.isFinite(m)&&m>0});return l.length===0?null:e.jsx("div",{className:"mt-3 flex flex-wrap items-center gap-x-1.5 gap-y-2 border-t border-oai-gray-100/70 pt-3 dark:border-oai-gray-800/60",children:l.map(i=>{const m=s(i.copyKey);return e.jsxs("span",{title:m,"aria-label":`${m}: ${n(a?.[i.key])}`,className:"inline-flex shrink-0 items-center gap-1 rounded-full bg-oai-gray-50/80 dark:bg-oai-gray-900/60 px-2 py-0.5 border border-oai-gray-100/80 dark:border-oai-gray-800/40 text-[10px] font-medium text-oai-gray-600 dark:text-oai-gray-300 transition-colors",children:[e.jsx(he,{provider:vr(i),size:12,className:"shrink-0 opacity-90"}),e.jsx("span",{className:"tabular-nums",children:o(a?.[i.key])})]},i.key)})})}function Lr({entry:a,entryIdx:r,name:o,meLabel:n,currency:l,rate:i,orderedColumns:m,placeholder:b,onOpenProfile:x}){if(a?.is_ellipsis)return e.jsx("div",{"aria-hidden":"true",className:"px-4 py-2 text-center text-xs tracking-[0.4em] text-oai-gray-400 dark:text-oai-gray-600",children:"···"},`mobile-ellipsis-${r}`);const p=!!a?.is_me,j=!p&&be(a?.display_name),f=typeof a?.user_id=="string"?a.user_id:null,h=!!f,g=p?n:o,T=C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),x(f))};return e.jsxs("div",{role:h?"button":void 0,tabIndex:h?0:void 0,onClick:h?()=>x(f):void 0,onKeyDown:h?T:void 0,"aria-label":h?s("leaderboard.profile_modal.row_aria",{name:g}):void 0,className:d("relative mx-0 my-1 rounded-xl px-3.5 py-3 transition-all duration-200 border shadow-sm select-none",p?"bg-gradient-to-br from-oai-brand-50/70 via-oai-brand-50/20 to-transparent dark:from-oai-brand-950/20 dark:via-oai-brand-950/5 dark:to-transparent border-oai-brand-200/60 dark:border-oai-brand-500/25":j?"bg-white/90 dark:bg-oai-gray-950/90 border-oai-gray-100/70 dark:border-oai-gray-800/40":"bg-white dark:bg-oai-gray-950 border-oai-gray-100 dark:border-oai-gray-800/60",h&&"cursor-pointer hover:border-oai-gray-200 dark:hover:border-oai-gray-700/80 active:scale-[0.985] active:bg-oai-gray-50/60 dark:active:bg-oai-gray-900/40 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-oai-brand-500/60"),children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e.jsx("span",{className:"flex w-5 shrink-0 items-center justify-center",children:e.jsx(_r,{rank:a?.rank,placeholder:b})}),e.jsxs("span",{className:"relative inline-flex shrink-0",children:[e.jsx("span",{className:d("inline-flex rounded-full p-0.5 transition-all duration-300",Nr[a?.rank]||"ring-1 ring-oai-gray-200 dark:ring-oai-gray-800/80",j&&"opacity-60 grayscale-[15%]"),children:e.jsx(Z,{size:"md",avatarUrl:a?.avatar_url,displayName:g,seed:pe(a,g)})}),a?.github_url&&e.jsx(Sr,{githubUrl:a.github_url})]}),e.jsxs("div",{className:"min-w-0 flex-1 pl-1",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[e.jsx("span",{className:d("min-w-0 truncate text-sm tracking-tight",p?"font-semibold text-oai-black dark:text-oai-white":j?"font-normal text-oai-gray-400 dark:text-oai-gray-500":"font-medium text-oai-gray-800 dark:text-oai-gray-200"),children:g}),e.jsx(ie,{badges:a?.badges,className:"shrink-0 scale-95"})]}),e.jsxs("div",{className:"mt-1 text-[11px] text-oai-gray-400 dark:text-oai-gray-500",children:[e.jsx("span",{children:s("leaderboard.column.est_cost")}),e.jsx("span",{className:d("ml-1 tabular-nums font-medium",j?"text-oai-gray-400/80 dark:text-oai-gray-500/80":"text-oai-gray-600 dark:text-oai-gray-300"),children:ue(a?.estimated_cost_usd,l,i)})]})]}),e.jsxs("div",{className:"shrink-0 text-right",children:[e.jsx("div",{className:"text-[9px] font-semibold uppercase tracking-[0.08em] text-oai-gray-400 dark:text-oai-gray-500",children:s("leaderboard.column.total")}),e.jsx("div",{className:d("mt-0.5 text-sm font-semibold tabular-nums tracking-tight",p?"text-oai-black dark:text-oai-white":j?"text-oai-gray-400 dark:text-oai-gray-500":"text-oai-gray-800 dark:text-oai-gray-200"),children:e.jsx(xe,{value:a?.total_tokens})})]})]}),e.jsx(Cr,{entry:a,orderedColumns:m})]},`mobile-row-${a?.rank}-${g}`)}const Er={1:{text:"text-amber-600 dark:text-amber-400",badge:"bg-amber-50 dark:bg-amber-900/20"},2:{text:"text-gray-500 dark:text-gray-300",badge:"bg-gray-50 dark:bg-gray-800/40"},3:{text:"text-orange-700 dark:text-orange-400",badge:"bg-orange-50 dark:bg-orange-900/20"}};function $e({rank:a,placeholder:r}){const o=Er[a];return o?e.jsx("span",{className:d("inline-flex items-center justify-center h-7 w-7 rounded-full text-xs font-bold",o.text,o.badge),children:a}):e.jsx("span",{className:"inline-flex items-center justify-center h-7 w-7 text-sm",children:a??r})}function Ue(a){if(typeof a!="string")return null;const r=a.trim().toLowerCase();return r==="week"||r==="month"||r==="total"?r:null}function Tr(a){if(!a)return s("shared.error.prefix",{error:s("leaderboard.error.unknown")});const r=a?.message||String(a),o=String(r||"").trim()||s("leaderboard.error.unknown");return s("shared.error.prefix",{error:o})}function ge(a){return typeof a!="string"?"":a.trim()}function be(a){const r=ge(a);return r?r.toLowerCase()==="anonymous":!0}function pe(a,r){const o=typeof a?.user_id=="string"?a.user_id.trim():"";return o||`${a?.rank??""}:${r}`}function Oe({githubUrl:a}){return e.jsxs("span",{className:"absolute left-1/2 top-full -translate-x-1/2 -translate-y-1/2 inline-flex group/gh",children:[e.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",onClick:r=>r.stopPropagation(),"aria-label":s("leaderboard.github.aria"),className:"flex h-4 w-4 items-center justify-center rounded-full bg-white dark:bg-oai-gray-950 text-oai-black dark:text-oai-gray-100 transition-transform hover:scale-110",children:e.jsx(he,{provider:"GITHUB",size:14})}),e.jsxs("span",{role:"tooltip",className:"invisible opacity-0 group-hover/gh:visible group-hover/gh:opacity-100 absolute left-0 bottom-full mb-2 whitespace-nowrap rounded-md bg-oai-black dark:bg-oai-gray-700 px-2.5 py-1.5 text-[11px] leading-relaxed text-white shadow-lg transition-opacity duration-150 z-50 before:content-[''] before:absolute before:inset-x-0 before:top-full before:h-2.5",children:[e.jsx("span",{className:"block",children:s("leaderboard.github.tooltipAction")}),e.jsxs("span",{className:"block text-oai-gray-300 dark:text-oai-gray-400",children:[s("leaderboard.github.tooltipPrefix")," ",e.jsx(_a,{to:"/settings",onClick:r=>r.stopPropagation(),className:"text-white underline underline-offset-2 decoration-oai-gray-400 hover:text-oai-brand-300 hover:decoration-oai-brand-300",children:s("leaderboard.github.tooltipSettingsLink")})," ",s("leaderboard.github.tooltipSuffix")]})]})]})}function Jr({auth:a,signedIn:r,sessionSoftExpired:o}){const n=ga(),l=ba(),{openLoginModal:i}=pa(),{signedIn:m,loading:b,user:x}=ha(),{currency:p,rate:j}=Ya(),f=c.useMemo(()=>fa(),[]),h=ya(),g=r&&!o,T=c.useMemo(()=>g&&(typeof a=="function"||typeof a=="string"||a&&typeof a=="object")?a:null,[a,g]),C=g?T:null,ee=g&&ka(C),ae=s("shared.placeholder.short"),Ve=c.useMemo(()=>X.map(t=>t.key),[]),{order:re,reorder:fe}=xr(Ve),ye=c.useMemo(()=>{const t=new Map;for(const u of X)t.set(u.key,u);return t},[]),B=c.useMemo(()=>re.map(t=>ye.get(t)).filter(Boolean),[re,ye]),Je=Ba(Be(Ha,{activationConstraint:{distance:6}}),Be(Ga,{coordinateGetter:Fa})),qe=c.useCallback(t=>{const{active:u,over:w}=t;!w||u.id===w.id||fe(String(u.id),String(w.id))},[fe]),[te,M]=c.useState(1),[_,Ze]=c.useState(kr),[ke,we]=c.useState(null),[Xe,je]=c.useState(!1),Y=c.useCallback(t=>{typeof t=="string"&&t.trim()&&we(t.trim())},[]),Qe=c.useCallback(()=>we(null),[]),ea=c.useCallback(t=>{const u=ce.includes(t)?t:me;Ze(u),M(1);try{window.localStorage.setItem(We,String(u))}catch{}},[]),[ve,aa]=c.useState(0),[ra,ta]=c.useState(()=>wa()),[Ne,_e]=c.useState(!1);c.useEffect(()=>{if(typeof window>"u")return;const t=()=>{aa(u=>u+1)};return window.addEventListener(ze,t),()=>{window.removeEventListener(ze,t)}},[]);const N=c.useMemo(()=>{const t=new URLSearchParams(n?.search||"");return Ue(t.get("period"))||"total"},[n?.search]),oa=t=>{const u=Ue(t);if(!u||u===N)return;const w=new URLSearchParams(n?.search||"");w.set("period",u),M(1),l(`${n?.pathname||"/leaderboard"}?${w.toString()}`,{replace:!0})};c.useEffect(()=>{b||h||m||i()},[m,b,h,i]),c.useEffect(()=>{M(1)},[N]);const W=c.useMemo(()=>(H(te,{min:1,max:1e6,fallback:1})-1)*_,[te,_]),R=c.useMemo(()=>h?"mock":b?"unavailable":m?"cloud":r?"local":f?"public":"unavailable",[b,m,f,h,r]),k=c.useMemo(()=>ja({accessMode:R,baseUrl:f,mockEnabled:h,userId:x?.id||null,period:N,pageSize:_,offset:W}),[x?.id,R,f,W,h,_,N]),[D,$]=c.useState(()=>{const t=ne(k);return t?{loading:!1,error:null,data:t.data,contextKey:k}:{loading:!1,error:null,data:null,contextKey:null}});c.useEffect(()=>{if(!f&&!h||!h&&R==="unavailable"){$({loading:!1,error:null,data:null,contextKey:null});return}const t=ne(k);let u=!0;return $(t?{loading:!1,error:null,data:t.data,contextKey:k}:{loading:!0,error:null,data:null,contextKey:null}),(async()=>{const w=await va({userId:x?.id||null,period:N,limit:_,offset:W});u&&(Na(w,{activeContextKey:k,contextKey:k,source:ve>0?"manual-refresh":"page-load"}),$({loading:!1,error:null,data:w,contextKey:k}))})().catch(w=>{if(!u)return;const A=Tr(w);$(F=>F.contextKey===k?{...F,loading:!1,error:A}:{loading:!1,error:A,data:null,contextKey:k})}),()=>{u=!1}},[f,R,x?.id,k,W,ve,h,N,_]);const oe=c.useMemo(()=>D.contextKey===k?null:ne(k),[k,D.contextKey]),v=c.useMemo(()=>D.contextKey===k?D:oe?{loading:!1,error:null,data:oe.data,contextKey:k}:{loading:!!(f||h)&&R!=="unavailable",error:null,data:null,contextKey:k},[R,f,k,D,h,oe]),S=v.data,U=S?.total_pages??null,sa=S?.total_entries??0,P=S?.page??te,na=c.useMemo(()=>rr(P,U),[P,U]),Se=S?.from||null,Ce=S?.to||null,ia=S?.generated_at||null,V=wr(ia),Le=Xa(),K=S?.me||null,I=s("leaderboard.me_label"),Ee=s("leaderboard.anon_label"),Te=s("leaderboard.period.week"),Ae=s("leaderboard.period.month"),Me=s("leaderboard.period.total"),Pe=N==="month"?Ae:N==="total"?Me:Te,J=c.useMemo(()=>{const t=Array.isArray(S?.entries)?S.entries:[];return or({entries:t,me:K,meLabel:I})},[S?.entries,K,I]),z=c.useMemo(()=>sr(K?.rank,_),[K?.rank,_]),la=z!=null&&z===P,da=c.useCallback(()=>{z!=null&&M(z)},[z]),ca=async()=>{_e(!0);try{La(!0),ta(!0),await Ea(()=>Ta(C))}catch(t){console.warn("[tokentracker] sync:",t)}finally{_e(!1)}},{canPrev:Ke,canNext:Re}=tr({page:P,totalPages:U}),q=Array.isArray(J)&&J.length!==0;let O=null;v.loading&&!q?O=e.jsx(cr,{rows:_}):v.error&&!q?O=e.jsx("div",{className:"px-6 py-12 text-center",children:e.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:v.error})}):q?O=e.jsxs(Da,{sensors:Je,collisionDetection:$a,modifiers:[ar],onDragEnd:qe,children:[e.jsx("div",{className:"hidden w-full overflow-x-auto sm:block",children:e.jsxs("table",{className:"min-w-full w-full text-left text-sm sm:min-w-max",children:[e.jsx("thead",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800",children:e.jsxs("tr",{children:[e.jsx("th",{className:d(Ge,"text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500"),children:s("leaderboard.column.rank")}),e.jsx("th",{className:d(He,"text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500"),children:s("leaderboard.column.user")}),e.jsx("th",{className:"px-3 sm:px-4 py-4 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500 whitespace-nowrap text-right align-middle",children:s("leaderboard.column.total")}),e.jsx("th",{className:"hidden sm:table-cell px-3 sm:px-4 py-4 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500 whitespace-nowrap text-right align-middle",title:"Based on estimated API pricing, not actual billing",children:s("leaderboard.column.est_cost")}),e.jsx(Ua,{items:re,strategy:Oa,children:B.map(t=>e.jsx(mr,{id:t.key,thClassName:"hidden sm:table-cell px-3 sm:px-4 py-4 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500 whitespace-nowrap align-middle",children:e.jsx(ir,{iconSrc:t.icon,label:s(t.copyKey)})},t.key))})]})}),e.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:J.map((t,u)=>{if(t?.is_ellipsis){const E=4+B.length;return e.jsx("tr",{"aria-hidden":"true",children:e.jsx("td",{colSpan:E,className:"px-4 py-2 text-center text-oai-gray-400 dark:text-oai-gray-600 bg-white dark:bg-oai-gray-950 select-none tracking-[0.4em] text-xs",children:"···"})},`ellipsis-${u}`)}const w=!!t?.is_me,A=typeof t?.user_id=="string"?t.user_id:null,F=ge(t?.display_name),ma=be(F)?Ee:F,L=w?I:ma,G=!!A,Ie=G?{role:"button",tabIndex:0,onClick:G?()=>Y(A):void 0,onKeyDown:G?E=>{(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),Y(A))}:void 0,"aria-label":s("leaderboard.profile_modal.row_aria",{name:L})}:{};if(w){const E=!!t?.is_pinned;return e.jsxs("tr",{...Ie,className:d("bg-oai-brand-50 dark:bg-oai-brand-900/10 transition-colors",E?"border-t border-b border-oai-brand-300/40 dark:border-oai-brand-500/20":"border-y border-oai-brand-300/40 dark:border-oai-brand-500/30",G&&"cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500/60"),children:[e.jsx("td",{className:d(le(!0),"font-semibold text-oai-brand-600 dark:text-oai-brand-400",E&&"before:absolute before:left-0 before:top-[15%] before:h-[70%] before:w-[3px] before:rounded-r before:bg-oai-brand-500 dark:before:bg-oai-brand-400"),children:e.jsx($e,{rank:t?.rank,placeholder:ae})}),e.jsx("td",{className:de(!0),children:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsxs("span",{className:d("relative inline-flex shrink-0 rounded-full p-[2px]",t?.github_url&&"gh-avatar-frame"),children:[e.jsx("span",{className:d("inline-flex rounded-full p-px",t?.github_url&&"bg-white dark:bg-oai-gray-950"),children:e.jsx(Z,{avatarUrl:t?.avatar_url,displayName:L,seed:pe(t,L)})}),t?.github_url&&e.jsx(Oe,{githubUrl:t.github_url})]}),e.jsx("span",{className:"truncate font-semibold text-oai-black dark:text-oai-white",children:L}),e.jsx(ie,{badges:t?.badges,className:"hidden sm:inline-flex"})]})}),e.jsx("td",{className:"px-3 sm:px-4 py-4 font-medium text-oai-black dark:text-oai-white whitespace-nowrap text-right tabular-nums bg-oai-brand-50 dark:bg-oai-brand-900/10",children:e.jsx(xe,{value:t?.total_tokens})}),e.jsx("td",{className:"hidden sm:table-cell px-3 sm:px-4 py-4 font-medium text-oai-brand-600 dark:text-oai-brand-400 whitespace-nowrap text-right tabular-nums bg-oai-brand-50 dark:bg-oai-brand-900/10",title:"Based on estimated API pricing, not actual billing",children:ue(t?.estimated_cost_usd,p,j)}),e.jsx(De,{entry:t,isMe:!0,orderedColumns:B})]},`row-${t?.rank}-${L}${E?"-pin":""}`)}return e.jsxs("tr",{...Ie,className:d("group transition-colors",G&&"cursor-pointer hover:bg-oai-gray-50 dark:hover:bg-oai-gray-900/60 focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500/60"),children:[e.jsx("td",{className:d(le(!1),"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx($e,{rank:t?.rank,placeholder:ae})}),e.jsx("td",{className:de(!1),children:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsxs("span",{className:d("relative inline-flex shrink-0 rounded-full p-[2px]",t?.github_url&&"gh-avatar-frame"),children:[e.jsx("span",{className:d("inline-flex rounded-full p-px",t?.github_url&&"bg-white dark:bg-oai-gray-950"),children:e.jsx(Z,{avatarUrl:t?.avatar_url,displayName:L,seed:pe(t,L)})}),t?.github_url&&e.jsx(Oe,{githubUrl:t.github_url})]}),e.jsx("span",{className:"truncate font-medium text-oai-gray-800 dark:text-oai-gray-200",children:L}),e.jsx(ie,{badges:t?.badges,className:"hidden sm:inline-flex"})]})}),e.jsx("td",{className:"px-3 sm:px-4 py-4 font-semibold text-oai-gray-800 dark:text-oai-gray-200 whitespace-nowrap text-right tabular-nums bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60",children:e.jsx(xe,{value:t?.total_tokens})}),e.jsx("td",{className:"hidden sm:table-cell px-3 sm:px-4 py-4 text-oai-gray-500 dark:text-oai-gray-400 whitespace-nowrap text-right tabular-nums bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60",title:"Based on estimated API pricing, not actual billing",children:ue(t?.estimated_cost_usd,p,j)}),e.jsx(De,{entry:t,isMe:!1,orderedColumns:B})]},`row-${t?.rank}-${L}`)})})]})}),e.jsx("div",{className:"flex flex-col py-1.5 sm:hidden",children:J.map((t,u)=>{const w=ge(t?.display_name),A=be(w)?Ee:w;return e.jsx(Lr,{entry:t,entryIdx:u,name:t?.is_me?I:A,meLabel:I,currency:p,rate:j,orderedColumns:B,placeholder:ae,onOpenProfile:Y},`mobile-${t?.rank??"ellipsis"}-${u}`)})})]}):O=e.jsx("div",{className:"px-6 py-12 text-center",children:e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("leaderboard.empty")})});let se=null;return typeof U=="number"?se=na.map((t,u)=>t==null?e.jsx("span",{className:"px-2 text-oai-gray-400 dark:text-oai-gray-500",children:s("leaderboard.pagination.ellipsis")},`ellipsis-${u}`):e.jsx("button",{className:d("flex h-8 w-8 items-center justify-center rounded-md text-sm font-medium transition-colors",t===P?"bg-oai-gray-200 dark:bg-oai-gray-800 text-oai-black dark:text-white":"text-oai-gray-500 dark:text-oai-gray-400 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white"),onClick:()=>M(t),disabled:v.loading,children:String(t)},`page-${t}`)):se=e.jsx("span",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("leaderboard.pagination.page_unknown",{page:String(P)})}),e.jsxs("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:[e.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:e.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[e.jsxs("div",{className:"mb-4 grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 gap-y-3.5 sm:mb-8 sm:grid-cols-[minmax(0,1fr)_auto] sm:gap-4",children:[e.jsx("h1",{className:"col-start-1 row-start-1 min-w-0 whitespace-nowrap text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:col-span-2 sm:row-start-1 sm:text-4xl",children:s("leaderboard.title")}),e.jsxs("p",{className:"col-span-2 row-start-2 hidden text-sm text-oai-gray-500 dark:text-oai-gray-400 sm:block sm:row-start-2 sm:text-base",children:[N==="total"?s("leaderboard.range.total"):Se&&Ce?s("leaderboard.range",{period:Pe,from:Se,to:Ce}):s("leaderboard.range_loading",{period:Pe}),V&&e.jsx("time",{dateTime:V.dateTime,title:s("leaderboard.generated_at",{ts:V.exact}),className:"ml-2 hidden border-l border-oai-gray-200 pl-2 text-xs text-oai-gray-500 dark:border-oai-gray-800 dark:text-oai-gray-400 sm:inline-block",children:s("leaderboard.generated_at",{ts:V.display})})]}),e.jsx("div",{className:"col-start-2 row-start-1 inline-flex h-9 shrink-0 items-center rounded-full border border-oai-gray-200 p-1 dark:border-oai-gray-800 sm:col-start-1 sm:row-start-3 sm:justify-self-start",children:["week","month","total"].map(t=>{const u=N===t;return e.jsxs("button",{onClick:()=>oa(t),disabled:v.loading,className:d("px-3 sm:px-4 h-7 text-sm font-medium rounded-full flex items-center justify-center transition-colors relative",u?"text-oai-black dark:text-white":"text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-800 dark:hover:text-oai-gray-200"),children:[e.jsx("span",{className:"relative z-10",children:t==="week"?Te:t==="month"?Ae:Me}),u&&e.jsx(Ka.div,{layoutId:"leaderboard-period-active-bg",className:"absolute inset-0 bg-oai-gray-200 dark:bg-oai-gray-800 rounded-full z-0",transition:{type:"spring",stiffness:380,damping:30}})]},t)})}),e.jsxs("div",{className:"col-span-2 row-start-2 mb-0 flex w-full min-w-0 items-center justify-between sm:justify-end gap-2.5 sm:col-span-1 sm:col-start-2 sm:row-start-3 sm:mb-0 sm:w-auto sm:shrink-0",children:[e.jsx(jr,{communityStats:Le,onClick:()=>je(!0)}),e.jsx(hr,{me:K,totalEntries:sa,meLabel:I,onOpenProfile:K?.user_id?()=>Y(K.user_id):void 0,onJumpToMe:da,canJump:z!=null&&!la&&!v.loading,className:"shrink-0"})]})]}),!r&&e.jsxs("div",{className:"mb-6 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between text-sm",children:[e.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:s("leaderboard.signin_prompt")}),e.jsx("button",{onClick:i,className:"shrink-0 whitespace-nowrap self-start sm:self-auto px-3 py-1.5 text-sm font-medium text-oai-gray-600 dark:text-oai-gray-300 border border-oai-gray-300 dark:border-oai-gray-700 rounded-md hover:text-oai-black dark:hover:text-white hover:border-oai-gray-400 dark:hover:border-oai-gray-600 transition-colors",children:s("leaderboard.signin_button")})]}),g&&ee&&!ra&&e.jsxs("div",{className:"mb-6 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between text-sm",children:[e.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:s("leaderboard.sync_prompt")}),e.jsx("button",{onClick:ca,disabled:Ne,className:"shrink-0 whitespace-nowrap self-start sm:self-auto px-3 py-1.5 text-sm font-medium text-oai-gray-600 dark:text-oai-gray-300 border border-oai-gray-300 dark:border-oai-gray-700 rounded-md hover:text-oai-black dark:hover:text-white hover:border-oai-gray-400 dark:hover:border-oai-gray-600 disabled:opacity-50 transition-colors",children:Ne?s("leaderboard.sync_button.busy"):s("leaderboard.sync_button.idle")})]}),e.jsxs("div",{className:"sm:rounded-xl sm:border sm:border-oai-gray-200 sm:dark:border-oai-gray-800 sm:overflow-hidden border-none bg-transparent",children:[v.error&&q?e.jsx("div",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800 px-6 py-3",children:e.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:v.error})}):null,O,e.jsxs("div",{className:"flex flex-col gap-3 sm:border-t border-oai-gray-200 px-4 py-3 sm:flex-row sm:items-center sm:justify-end sm:gap-x-4 sm:px-6 dark:border-oai-gray-800 border-none mt-2.5 sm:mt-0",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 text-sm text-oai-gray-500 dark:text-oai-gray-400 sm:justify-start",children:[e.jsx("label",{htmlFor:"leaderboard-page-size",className:"whitespace-nowrap",children:s("leaderboard.pagination.page_size_label")}),e.jsx(Pa,{id:"leaderboard-page-size",value:_,onValueChange:t=>ea(Number(t)),disabled:v.loading,ariaLabel:s("leaderboard.pagination.page_size_label"),options:ce.map(t=>({value:t,label:String(t)})),align:"end",className:"px-3 py-1 text-oai-gray-700 dark:text-oai-gray-300"})]}),e.jsx("div",{className:"hidden h-5 w-px bg-oai-gray-200 dark:bg-oai-gray-800 sm:block","aria-hidden":"true"}),e.jsxs("div",{className:"flex w-full items-center justify-between sm:w-auto sm:justify-end gap-1.5",children:[e.jsx("button",{className:d("whitespace-nowrap rounded-xl border border-oai-gray-100 bg-oai-gray-50/50 px-3.5 py-2 text-xs font-medium text-oai-gray-500 dark:border-oai-gray-800/80 dark:bg-white/[0.01] dark:text-oai-gray-400 transition-all duration-200 active:scale-[0.97] sm:rounded-md sm:border-0 sm:bg-transparent sm:px-3 sm:py-1.5 sm:text-sm sm:font-medium sm:active:scale-100",Ke&&!v.loading?"hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white":"opacity-50 cursor-not-allowed"),onClick:()=>M(t=>Math.max(1,t-1)),disabled:!Ke||v.loading,children:s("leaderboard.pagination.prev")}),e.jsxs("span",{className:"text-xs font-semibold tabular-nums text-oai-gray-500 dark:text-oai-gray-455 px-2 sm:hidden",children:[P," / ",U||"?"]}),e.jsx("div",{className:"hidden sm:flex items-center gap-1",children:se}),e.jsx("button",{className:d("whitespace-nowrap rounded-xl border border-oai-gray-100 bg-oai-gray-50/50 px-3.5 py-2 text-xs font-medium text-oai-gray-500 dark:border-oai-gray-800/80 dark:bg-white/[0.01] dark:text-oai-gray-400 transition-all duration-200 active:scale-[0.97] sm:rounded-md sm:border-0 sm:bg-transparent sm:px-3 sm:py-1.5 sm:text-sm sm:font-medium sm:active:scale-100",Re&&!v.loading?"hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white":"opacity-50 cursor-not-allowed"),onClick:()=>M(t=>t+1),disabled:!Re||v.loading,children:s("leaderboard.pagination.next")})]})]})]})]})}),e.jsx("footer",{className:"border-t border-oai-gray-200 dark:border-oai-gray-900 py-8 transition-colors duration-200",children:e.jsxs("div",{className:"mx-auto flex max-w-6xl items-center justify-between px-4 sm:px-6 text-sm text-oai-gray-400 dark:text-oai-gray-500",children:[e.jsx("p",{children:s("landing.v2.footer.line")}),e.jsx("a",{href:"https://github.com/mm7894215/TokenTracker",className:"text-oai-gray-400 dark:text-oai-gray-500 hover:text-oai-black dark:hover:text-white transition-colors",target:"_blank",rel:"noopener noreferrer",children:s("landing.v2.nav.github")})]})}),e.jsxs(c.Suspense,{fallback:null,children:[e.jsx(fr,{isOpen:!!ke,userId:ke,period:N,accessToken:C,onClose:Qe}),e.jsx(yr,{isOpen:Xe,onClose:()=>je(!1),communityStats:Le})]})]})}export{Jr as LeaderboardPage};
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/BadgeDetailModal-lw1e7EvA.js","assets/__vite-browser-external-CuMc3dqk.js","assets/__vite-browser-external-WKilYZnq.css","assets/react-B80AX8fE.js","assets/AchievementBadge-DvulAUrw.js","assets/zap-CcqNcNpw.js","assets/flame-VQYtrvgY.js","assets/use-transform-Dza9-ZQl.js","assets/use-reduced-motion-BEAopWkx.js","assets/AchievementsSection-CgiOHh54.js","assets/format-tokens-173-9MpR.js","assets/DialogTitle-KxLDeLzC.js","assets/useScrollLock-DmM-LeMm.js","assets/store-NtnkxrS2.js"])))=>i.map(i=>d[i]);
import{l as te,a as O,r as h,a5 as se,j as e,c as n,a6 as ie,a7 as oe,a8 as ne,d as c,a9 as le,Q as de,L as ce,R as W,U as me,m as xe,aa as ge,X as pe,k as he,_ as ue,a3 as fe,ab as be}from"./__vite-browser-external-CuMc3dqk.js";import{A as ye,f as ke}from"./provider-display-Cn2q9F2Z.js";import{u as ve}from"./useCurrency-DdWYV5RR.js";import{u as G}from"./useTokenFormat-BkFEXBXZ.js";import{L as X}from"./LeaderboardAvatar-DKH9A5GV.js";import{P as $}from"./ProviderIcon-B6sgfDtI.js";import{H as je,A as Y,s as Ne,c as _e,b as we,t as Ae,h as Se}from"./AchievementBadge-DvulAUrw.js";import{A as ze}from"./AchievementsSection-CgiOHh54.js";import{A as B}from"./arrow-up-right-D2tCxxHL.js";import{L as Ce}from"./link-2-CmjxdvpK.js";import{C as Me}from"./check-Dy8VgHZ8.js";import{D as Ie,a as Pe,b as De,c as Le,d as Te,e as $e}from"./DialogTitle-KxLDeLzC.js";import"./maximize-2-BZX57ABx.js";import"./terminal-d0IOaeZn.js";import"./info-CDTfOJ13.js";import"./zap-CcqNcNpw.js";import"./flame-VQYtrvgY.js";import"./react-B80AX8fE.js";import"./format-tokens-173-9MpR.js";import"./use-reduced-motion-BEAopWkx.js";import"./useScrollLock-DmM-LeMm.js";import"./store-NtnkxrS2.js";const Be=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],Ue=te("code-xml",Be),U="tokentracker_anon_id";let A=null;function R(){try{if(typeof crypto<"u"&&crypto.randomUUID)return crypto.randomUUID()}catch{}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,a=>{const r=Math.random()*16|0;return(a==="x"?r:r&3|8).toString(16)})}function F(){if(A)return A;try{let a=localStorage.getItem(U);return a||(a=R(),localStorage.setItem(U,a)),A=a,a}catch{return A=R(),A}}function K({userId:a}){const{signedIn:r,getAccessToken:i}=O(),[t,s]=h.useState(!1),[l,x]=h.useState(0),[o,g]=h.useState(!1),[f,b]=h.useState(!1),[S,z]=h.useState(!1),[C,D]=h.useState([]),[j,N]=h.useState(!1),M=h.useRef(0),y=h.useCallback(async()=>{if(r)try{const d=await i();if(d)return{accessToken:d,anonId:F()}}catch{}return{anonId:F()}},[r,i]);h.useEffect(()=>{let d=!1;return a?(g(!1),(async()=>{const m=await y();try{const p=await se({userId:a,...m});if(d)return;x(Number(p?.count)||0),s(!!p?.liked),g(!0)}catch{if(d)return;x(0),s(!1),g(!0)}})(),()=>{d=!0}):(g(!1),()=>{d=!0})},[a,y]);const k=()=>{z(!0),setTimeout(()=>z(!1),450),N(!0),setTimeout(()=>N(!1),500);const d=["#ff4757","#ff6b81","#ffa502","#70a1ff","#2ed573","#a29bfe"],m=["circle","heart"],p=[];for(let u=0;u<12;u++){const v=(u*30+Math.random()*20-10)*(Math.PI/180),I=45+Math.random()*45,V=Math.cos(v)*I,Z=Math.sin(v)*I-(10+Math.random()*15),Q=Math.random()*360-180,J=6+Math.random()*8,ee=d[Math.floor(Math.random()*d.length)],ae=m[Math.floor(Math.random()*m.length)],re=++M.current;p.push({id:re,tx:V,ty:Z,rot:Q,size:J,color:ee,shape:ae})}D(u=>[...u,...p]),setTimeout(()=>{D(u=>u.filter(v=>!p.find(I=>I.id===v.id)))},850)},_=async d=>{b(!0);try{const m=await y(),p=await ie({userId:a,action:d,...m});p&&Number.isFinite(Number(p.count))&&x(Number(p.count)),p&&typeof p.liked=="boolean"&&s(p.liked)}catch{s(m=>!m),x(m=>d==="like"?Math.max(0,m-1):m+1)}finally{b(!1)}},w=d=>{d.stopPropagation(),!(!a||!o||f)&&(t?(s(!1),x(m=>Math.max(0,m-1)),_("unlike")):(s(!0),x(m=>m+1),k(),_("like")))};return e.jsxs("div",{className:"relative inline-flex items-center select-none z-10",children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:`
@keyframes tt-like-pop {
0% { transform: scale(1); }
25% { transform: scale(0.75); }
50% { transform: scale(1.35); }
75% { transform: scale(0.9); }
100% { transform: scale(1); }
}
@keyframes tt-particle-fly {
0% {
transform: translate(0, 0) scale(1) rotate(0deg);
opacity: 1;
}
70% {
opacity: 0.8;
}
100% {
transform: translate(var(--tx), var(--ty)) scale(0.2) rotate(var(--rot));
opacity: 0;
}
}
@keyframes tt-num-scroll {
0% { transform: translateY(8px); opacity: 0; }
100% { transform: translateY(0); opacity: 1; }
}
.tt-animate-pop {
animation: tt-like-pop 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
.tt-particle {
position: absolute;
top: 50%;
left: 50%;
margin-top: -6px;
margin-left: -6px;
pointer-events: none;
z-index: 50;
}
.tt-num-anim {
animation: tt-num-scroll 0.25s ease-out forwards;
}
`}}),C.map(d=>e.jsx("span",{className:"tt-particle",style:{"--tx":`${d.tx}px`,"--ty":`${d.ty}px`,"--rot":`${d.rot}deg`,width:`${d.size}px`,height:`${d.size}px`,backgroundColor:d.shape==="circle"?d.color:"transparent",borderRadius:d.shape==="circle"?"50%":"0",animation:"tt-particle-fly 0.8s cubic-bezier(0.1, 0.8, 0.3, 1) forwards"},children:d.shape==="heart"&&e.jsx("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:d.color,className:"w-full h-full",children:e.jsx("path",{d:"M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"})})},d.id)),e.jsxs("button",{type:"button",onClick:w,disabled:!o||f,"aria-label":t?n("leaderboard.profile.like.aria_unlike"):n("leaderboard.profile.like.aria_like"),className:`group flex items-center justify-center gap-1.5 h-8 min-w-[48px] px-2.5 rounded-full border transition-all duration-300 outline-none focus-visible:ring-2 focus-visible:ring-rose-500/50 disabled:opacity-60 disabled:cursor-default ${t?"bg-rose-50/60 border-rose-200/80 text-rose-500 dark:bg-rose-950/20 dark:border-rose-900/40 dark:text-rose-400 shadow-sm":"bg-white/80 border-oai-gray-200 text-oai-gray-500 hover:border-rose-200 hover:text-rose-500 hover:bg-rose-50/30 dark:bg-oai-gray-950/50 dark:border-white/10 dark:text-oai-gray-400 dark:hover:border-rose-900/50 dark:hover:text-rose-400 dark:hover:bg-rose-950/5"}`,children:[e.jsx("span",{className:S?"tt-animate-pop":"group-active:scale-90 transition-transform duration-100",children:e.jsx(je,{size:14,className:`transition-all duration-300 ${t?"fill-rose-500 text-rose-500 dark:fill-rose-400 dark:text-rose-400":"fill-transparent"}`})}),e.jsx("span",{className:`text-[12px] font-bold font-mono tabular-nums tracking-tight ${t?"text-rose-600 dark:text-rose-400":"text-oai-gray-600 dark:text-oai-gray-400"} ${j?"tt-num-anim":""}`,children:o?l:"·"})]})]})}function Re({badge:a,badgeLabel:r,className:i="",...t}){return e.jsxs("div",{className:`relative inline-flex shrink-0 ${i}`,children:[e.jsx(X,{...t}),a?e.jsx("span",{className:"absolute -bottom-1 -right-1 inline-flex rounded-full ring-2 ring-white dark:ring-oai-gray-950",children:e.jsx(Y,{badgeId:a.id,tier:a.tier,size:"sm",label:r})}):null]})}function Fe({badges:a,isOwn:r=!1,onSelect:i,className:t=""}){const s=Ne((Array.isArray(a)?a:[]).filter(l=>l&&_e.has(l.id))).filter(l=>r||(l.tier||0)>=1);return s.length===0?null:e.jsx("div",{className:`flex flex-wrap items-center pr-2.5 ${t}`,children:s.map((l,x)=>{const o=(l.tier||0)>=1,g=n(we(l.id,"name")),f=o?n(`achievements.tier.${Ae(l.tier)}`):n("achievements.modal.locked");return e.jsx("button",{type:"button",onClick:i?()=>i(l):void 0,title:`${g} · ${f}`,"aria-label":n("achievements.badge.aria",{name:g,tier:f}),style:{zIndex:s.length-x},className:"group relative shrink-0 -mr-2.5 rounded-full transition-transform duration-200 ease-out hover:z-30 hover:-translate-y-1 active:scale-95 focus-visible:z-30 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand/60",children:e.jsx(Y,{badgeId:l.id,tier:l.tier,locked:!o,size:"md",className:"rounded-full ring-2 ring-white transition-shadow duration-200 group-hover:shadow-md dark:ring-oai-gray-950"})},l.id)})})}const He=W.lazy(()=>ue(()=>import("./BadgeDetailModal-lw1e7EvA.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])));function Ee(a,r,i){const t=Number(a);return!Number.isFinite(t)||t<0?"—":t>0&&t<.01?`<${r==="USD"?"$":""}0.01`:fe(t,{decimals:2,currency:r,rate:i})}function H(a,r,i){const t=Number(a);if(!Number.isFinite(t)||t<0)return"—";if(t<1e3)return Ee(t,r,i);const s=r==="USD"?t:t*(i||1);return`${r==="USD"?"$":""}${he(s,{decimals:1})}`}function Oe(a){const r=Array.isArray(a)?a:[];if(r.length===0)return null;const i=r.map(s=>({day:s.date,total_tokens:s.total_tokens,models:s.models||null})),t=r[r.length-1]?.date;return ge({dailyRows:i,weeks:52,to:t})}const We=`
@keyframes tt-shimmer {
100% { transform: translateX(100%); }
}
.tt-shimmer-bar {
position: relative;
overflow: hidden;
}
.tt-shimmer-bar::after {
position: absolute;
top: 0; right: 0; bottom: 0; left: 0;
transform: translateX(-100%);
background-image: linear-gradient(
90deg,
rgba(0, 0, 0, 0) 0%,
rgba(0, 0, 0, 0.02) 20%,
rgba(0, 0, 0, 0.06) 60%,
rgba(0, 0, 0, 0) 100%
);
animation: tt-shimmer 1.6s infinite;
content: '';
}
.dark .tt-shimmer-bar::after {
background-image: linear-gradient(
90deg,
rgba(255, 255, 255, 0) 0%,
rgba(255, 255, 255, 0.02) 20%,
rgba(255, 255, 255, 0.06) 60%,
rgba(255, 255, 255, 0) 100%
);
}
`;function Ge({variant:a="modal"}){const r="rounded bg-oai-gray-200/50 dark:bg-oai-gray-800/40 tt-shimmer-bar",i=a==="page";return e.jsxs("div",{children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:We}}),i?e.jsxs("div",{className:"flex items-start gap-5 px-6 sm:px-8 pt-8 pb-7 animate-fade-in",children:[e.jsx("div",{className:"h-[68px] w-[68px] rounded-full bg-oai-gray-200/50 dark:bg-oai-gray-800/40 tt-shimmer-bar shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0 flex items-start justify-between gap-4 pt-0.5",children:[e.jsxs("div",{className:"min-w-0 space-y-2.5",children:[e.jsx("div",{className:c(r,"h-7 w-48")}),e.jsx("div",{className:c(r,"h-3.5 w-32")})]}),e.jsxs("div",{className:"shrink-0 space-y-1.5 flex flex-col items-end",children:[e.jsx("div",{className:c(r,"h-2.5 w-8")}),e.jsx("div",{className:c(r,"h-7 w-12")})]})]})]}):e.jsxs("div",{className:"flex items-start gap-4 px-6 pt-6 pb-5 border-b border-oai-gray-200/80 dark:border-oai-gray-800/60 animate-fade-in",children:[e.jsx("div",{className:"h-14 w-14 rounded-full bg-oai-gray-200/50 dark:bg-oai-gray-800/40 tt-shimmer-bar shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0 space-y-2 pt-1",children:[e.jsx("div",{className:c(r,"h-4 w-40")}),e.jsx("div",{className:c(r,"h-3 w-56")})]}),e.jsx("div",{className:c(r,"h-4 w-4 shrink-0 mt-1")})]}),e.jsxs("div",{className:c("space-y-6",i?"px-6 sm:px-8 pt-6 pb-8 border-t border-oai-gray-200/80 dark:border-oai-gray-800/60":"px-6 py-5"),children:[e.jsx("div",{className:"grid grid-cols-4 gap-x-6 gap-y-4",children:Array.from({length:4}).map((t,s)=>e.jsxs("div",{children:[e.jsx("div",{className:c(r,"h-6 w-20")}),e.jsx("div",{className:c(r,"mt-2 h-3 w-14")})]},s))}),e.jsx("div",{className:"space-y-3 border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:Array.from({length:3}).map((t,s)=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:c(r,"h-3 w-24")}),e.jsx("div",{className:c(r,"h-3 w-44")})]},s))}),e.jsxs("div",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[e.jsx("div",{className:c(r,"h-3 w-44 mb-4")}),e.jsx("div",{className:"grid grid-cols-[repeat(52,1fr)] gap-[2px]",children:Array.from({length:364}).map((t,s)=>e.jsx("div",{className:"aspect-square rounded-[2px] bg-oai-gray-200/40 dark:bg-oai-gray-800/30 tt-shimmer-bar"},s))})]}),e.jsxs("div",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[e.jsx("div",{className:c(r,"h-3 w-28 mb-3")}),e.jsx("div",{className:"space-y-2.5",children:Array.from({length:5}).map((t,s)=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:c(r,"h-4 w-4")}),e.jsx("div",{className:c(r,"h-3 w-16")}),e.jsx("div",{className:c(r,"h-[3px] flex-1")}),e.jsx("div",{className:c(r,"h-3 w-12")})]},s))})]})]})]})}function q(a){if(!a)return null;const r=String(a).match(/github\.com\/([A-Za-z0-9][A-Za-z0-9-]{0,38})/i);return r?r[1]:null}function L({children:a}){return e.jsx("h3",{className:"text-[11px] uppercase tracking-[0.08em] text-oai-gray-500 dark:text-oai-gray-400 mb-3",children:a})}function P({value:a,label:r,title:i}){return e.jsxs("div",{children:[e.jsx("div",{title:i,className:"text-2xl font-black tabular-nums tracking-tight leading-none text-oai-black dark:text-white",style:{fontFamily:'"DIN Alternate-Bold", "DIN Alternate", "DIN Condensed-Bold", "Impact", -apple-system, sans-serif',fontWeight:900},children:a}),e.jsx("div",{className:"mt-1.5 text-[11px] text-oai-gray-500 dark:text-oai-gray-400",children:r})]})}function T({label:a,children:r}){return e.jsxs("div",{className:"flex items-baseline gap-3 text-sm",children:[e.jsx("dt",{className:"shrink-0 w-28 whitespace-nowrap text-oai-gray-500 dark:text-oai-gray-400",children:a}),e.jsx("dd",{className:"min-w-0 flex-1 text-oai-gray-900 dark:text-oai-gray-100 tabular-nums truncate flex items-baseline gap-2 flex-wrap",children:r})]})}function Xe({user:a,onClose:r}){const i=q(a?.github_url);return e.jsxs("div",{className:"flex items-center gap-4 px-6 pt-6 pb-5 border-b border-oai-gray-200/80 dark:border-oai-gray-800/60",children:[e.jsx(X,{avatarUrl:a?.avatar_url,displayName:a?.display_name||"",seed:a?.user_id||a?.display_name,size:"lg",className:"shrink-0 ring-1 ring-oai-gray-200 dark:ring-oai-gray-800"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"truncate text-base font-semibold text-oai-black dark:text-white",children:a?.display_name||"—"}),a?.rank?e.jsx("span",{className:c("shrink-0 inline-flex items-center px-2 py-0.5 rounded text-xs font-bold font-mono uppercase tracking-wider border shadow-sm",a.rank===1&&"bg-amber-500/10 text-amber-600 border-amber-500/20 dark:text-amber-400 dark:bg-amber-400/10",a.rank===2&&"bg-slate-500/10 text-slate-600 border-slate-500/20 dark:text-slate-400 dark:bg-slate-400/10",a.rank===3&&"bg-orange-500/10 text-orange-700 border-orange-500/20 dark:text-orange-400 dark:bg-orange-400/10",a.rank>3&&"bg-oai-gray-100 dark:bg-oai-gray-900/60 text-oai-gray-500 dark:text-oai-gray-400 border-oai-gray-200/60 dark:border-oai-gray-800"),children:n("leaderboard.profile_modal.rank",{rank:a.rank})}):null]}),i&&e.jsxs("a",{href:a.github_url,target:"_blank",rel:"noopener noreferrer",className:"mt-1 inline-flex items-center gap-1 text-[12px] text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-800 dark:hover:text-oai-gray-200 transition-colors",children:[e.jsx($,{provider:"GITHUB",size:11}),e.jsxs("span",{children:["@",i]})]})]}),a?.user_id&&e.jsx("div",{className:"shrink-0 flex items-center justify-center",children:e.jsx(K,{userId:a.user_id})}),r&&e.jsx("button",{type:"button",onClick:r,className:"shrink-0 -mr-1 -mt-1 flex h-8 w-8 items-center justify-center rounded-md text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-900 dark:hover:text-white 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 group","aria-label":n("leaderboard.profile_modal.close"),children:e.jsx(pe,{size:16,strokeWidth:2,"aria-hidden":!0,className:"transition-transform duration-200 group-hover:rotate-90 group-active:scale-90"})})]})}function Ye({user:a,topBadge:r}){const i=q(a?.github_url),t=Number(a?.rank)||0,s=t===1?"text-amber-500 dark:text-amber-400":t===2?"text-slate-500 dark:text-slate-300":t===3?"text-orange-600 dark:text-orange-400":"text-oai-gray-400 dark:text-oai-gray-500";return e.jsxs("div",{className:"flex items-center gap-5 px-6 sm:px-8 pt-8 pb-7",children:[e.jsx(Re,{badge:r,avatarUrl:a?.avatar_url,displayName:a?.display_name||"",seed:a?.user_id||a?.display_name,size:"xl",className:"shrink-0 ring-1 ring-oai-gray-200 dark:ring-oai-gray-800 rounded-full"}),e.jsxs("div",{className:"min-w-0 flex-1 flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsx("h1",{className:"truncate text-2xl sm:text-[28px] font-semibold tracking-tight leading-tight text-oai-black dark:text-white",children:a?.display_name||"—"}),a?.user_id&&e.jsx(K,{userId:a.user_id})]}),i?e.jsxs("a",{href:a.github_url,target:"_blank",rel:"noopener noreferrer",className:"mt-2 inline-flex items-center gap-1.5 text-sm text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-900 dark:hover:text-white transition-colors",children:[e.jsx($,{provider:"GITHUB",size:13}),e.jsxs("span",{children:["@",i]})]}):null]}),t?e.jsxs("div",{className:"shrink-0 text-right leading-none",children:[e.jsx("div",{className:"text-[10px] font-medium uppercase tracking-[0.14em] text-oai-gray-400 dark:text-oai-gray-500",children:n("leaderboard.profile.hero.rank_label")}),e.jsx("div",{className:c("mt-1.5 text-3xl font-black tabular-nums tracking-tight",s),children:n("leaderboard.profile_modal.rank",{rank:t})})]}):null]})]})}function Ke({data:a}){const{formatTokens:r,formatTokensTooltip:i}=G(),t=Array.isArray(a)?a:[];return t.length===0?e.jsx("p",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400",children:n("leaderboard.profile_modal.providers.none")}):e.jsx("ul",{className:"space-y-2",children:t.map(s=>{const l=Math.max(0,Math.min(1,Number(s?.percent)||0));return e.jsxs("li",{className:"flex items-center gap-3 text-xs",children:[e.jsx("span",{className:"shrink-0 inline-flex items-center justify-center w-4 h-4",children:e.jsx($,{provider:String(s.source).toUpperCase(),size:14})}),e.jsx("span",{className:"w-20 shrink-0 text-oai-gray-700 dark:text-oai-gray-300",children:ke(s.source)}),e.jsx("span",{className:"flex-1 h-[3px] rounded-full bg-oai-gray-200/60 dark:bg-oai-gray-800/80 overflow-hidden",children:e.jsx("span",{className:"block h-full bg-oai-brand-500 dark:bg-oai-brand-400",style:{width:`${(l*100).toFixed(1)}%`}})}),e.jsx("span",{title:i(s.total_tokens),className:"shrink-0 w-14 text-right tabular-nums text-oai-gray-700 dark:text-oai-gray-300",children:r(s.total_tokens)}),e.jsxs("span",{className:"shrink-0 w-10 text-right tabular-nums text-oai-gray-500 dark:text-oai-gray-400",children:[(l*100).toFixed(0),"%"]})]},s.source)})})}function E({icon:a,label:r,value:i}){const[t,s]=h.useState(!1),l=async()=>{await be(i)&&(s(!0),setTimeout(()=>s(!1),1600))};return e.jsxs("button",{type:"button",onClick:l,className:c("inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1 text-xs font-medium transition-colors",t?"border-emerald-500/30 text-emerald-600 dark:text-emerald-400 bg-emerald-500/[0.06]":"border-oai-gray-200 dark:border-oai-gray-800 text-oai-gray-600 dark:text-oai-gray-300 hover:text-oai-gray-900 dark:hover:text-oai-gray-100 hover:border-oai-gray-300 dark:hover:border-oai-gray-700 hover:bg-oai-gray-50 dark:hover:bg-oai-gray-900/40"),children:[t?e.jsx(Me,{size:13,strokeWidth:2,"aria-hidden":!0}):e.jsx(a,{size:13,strokeWidth:2,"aria-hidden":!0}),e.jsx("span",{children:t?n("leaderboard.profile_modal.badge.copied"):r})]})}function qe({data:a,currency:r,rate:i,onClose:t,variant:s="modal"}){const{formatTokens:l,formatTokensTooltip:x}=G(),{user:o,totals:g,streak:f,best_day:b,models:S,by_provider:z,heatmap:C,period:D}=a,j=s==="page",N=h.useMemo(()=>Oe(C),[C]),M=S?.favorite?.model_name,y=Number(S?.count)||0,k=Array.isArray(a.badges)?a.badges:[],[_,w]=h.useState(null),d=O(),m=!!(d?.user?.id&&o?.user_id&&d.user.id===o.user_id),p=o?.user_id?`https://www.tokentracker.cc/u/${o.user_id}`:null,u=o?.user_id?`[![My AI coding usage](${le()}/functions/tokentracker-embed-svg?user_id=${o.user_id}&theme=dark)](${p}?ref=readme)`:null;return e.jsxs(e.Fragment,{children:[j?e.jsx(Ye,{user:o,topBadge:Se(k)}):e.jsx(Xe,{user:o,onClose:t}),e.jsxs("div",{className:c("space-y-6",j?"px-6 sm:px-8 pt-6 pb-8 border-t border-oai-gray-200/80 dark:border-oai-gray-800/60":"flex-1 min-h-0 overflow-y-auto oai-scrollbar px-6 py-5"),children:[e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-x-6 gap-y-4",children:[e.jsx(P,{value:l(g?.total_tokens),title:x(g?.total_tokens),label:n("leaderboard.profile_modal.stat.total_tokens")}),e.jsx(P,{value:H(g?.estimated_cost_usd,r,i),label:n("leaderboard.profile_modal.stat.total_cost")}),e.jsx(P,{value:String(g?.active_days??0),label:n("leaderboard.profile_modal.stat.active_days")}),e.jsx(P,{value:H(g?.avg_per_day_usd,r,i),label:n("leaderboard.profile_modal.stat.avg_per_day")})]}),e.jsxs("dl",{className:"space-y-2 border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[e.jsxs(T,{label:n("leaderboard.profile_modal.streak.current"),children:[e.jsx("span",{className:"font-mono text-xs tracking-tight bg-oai-gray-100/60 dark:bg-oai-gray-900/50 px-1.5 py-0.5 rounded border border-oai-gray-200/30 dark:border-oai-gray-800/30",children:n("leaderboard.profile_modal.streak.days",{count:f?.current_days??0})}),e.jsxs("span",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 font-mono",children:["(max ",f?.longest_days??0,")"]})]}),e.jsx(T,{label:n("leaderboard.profile_modal.best_day.title"),children:b?e.jsxs(e.Fragment,{children:[e.jsx("span",{title:x(b.total_tokens),className:"font-mono text-xs tracking-tight bg-oai-gray-100/60 dark:bg-oai-gray-900/50 px-1.5 py-0.5 rounded border border-oai-gray-200/30 dark:border-oai-gray-800/30",children:l(b.total_tokens)}),e.jsxs("span",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 font-mono",children:["on ",b.date]})]}):e.jsx("span",{className:"text-xs text-oai-gray-400 dark:text-oai-gray-500 font-mono",children:n("leaderboard.profile_modal.best_day.none")})}),e.jsx(T,{label:n("leaderboard.profile_modal.models.favorite"),children:M?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-mono text-xs tracking-tight bg-oai-gray-100/60 dark:bg-oai-gray-900/50 px-1.5 py-0.5 rounded border border-oai-gray-200/30 dark:border-oai-gray-800/30 truncate max-w-[200px] inline-block align-bottom",children:M}),y>1&&e.jsx("span",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 font-mono",children:n("leaderboard.profile_modal.models.count",{count:y})})]}):e.jsx("span",{className:"text-xs text-oai-gray-400 dark:text-oai-gray-500 font-mono",children:n("leaderboard.profile_modal.models.none")})})]}),(m||k.some(v=>(v?.tier||0)>=1))&&e.jsxs("section",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[e.jsx(L,{children:n("achievements.section.title")}),j?e.jsx(ze,{achievements:k,isOwn:m&&!!a.badges_include_unearned,scope:"cloud",onSelect:w}):e.jsx(Fe,{badges:k,isOwn:m&&!!a.badges_include_unearned,onSelect:w})]}),N&&e.jsxs("section",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[e.jsx(L,{children:n("leaderboard.profile_modal.heatmap.title")}),e.jsx("div",{className:"min-w-0",children:e.jsx(ye,{heatmap:N,hideLegend:!0,embedded:!0})})]}),e.jsxs("section",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[e.jsx(L,{children:n("leaderboard.profile_modal.providers.title")}),e.jsx(Ke,{data:z})]}),o?.user_id&&(t||m)&&e.jsxs("div",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-4 flex flex-wrap items-center justify-between gap-x-4 gap-y-3",children:[t&&(de()?e.jsxs("a",{href:p,target:"_blank",rel:"noopener noreferrer",onClick:t,className:"group inline-flex items-center gap-1 text-xs font-medium text-oai-gray-700 hover:text-oai-gray-950 dark:text-oai-gray-300 dark:hover:text-oai-white transition-colors",children:[e.jsx("span",{children:n("leaderboard.profile_modal.view_full")}),e.jsx(B,{size:13,strokeWidth:2,"aria-hidden":!0,className:"transition-transform duration-200 group-hover:translate-x-0.5 group-hover:-translate-y-0.5"})]}):e.jsxs(ce,{to:`/u/${o.user_id}`,onClick:t,className:"group inline-flex items-center gap-1 text-xs font-medium text-oai-gray-700 hover:text-oai-gray-950 dark:text-oai-gray-300 dark:hover:text-oai-white transition-colors",children:[e.jsx("span",{children:n("leaderboard.profile_modal.view_full")}),e.jsx(B,{size:13,strokeWidth:2,"aria-hidden":!0,className:"transition-transform duration-200 group-hover:translate-x-0.5 group-hover:-translate-y-0.5"})]})),m&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(E,{icon:Ce,label:n("leaderboard.profile_modal.badge.copy_url"),value:p}),e.jsx(E,{icon:Ue,label:n("leaderboard.profile_modal.badge.copy"),value:u})]})]})]}),_&&e.jsx(W.Suspense,{fallback:null,children:e.jsx(He,{badge:_,onClose:()=>w(null)})})]})}function Ve({userId:a,period:r,accessToken:i,enabled:t=!0}){const[s,l]=h.useState({loading:!1,error:null,data:null});return h.useEffect(()=>{if(!t||!a)return;let x=!0;return l({loading:!0,error:null,data:null}),(async()=>{try{const o=i?await oe(i):null;if(!x)return;const g=await ne({accessToken:o,userId:a,period:r||"week"});if(!x)return;l({loading:!1,error:null,data:g})}catch(o){if(!x)return;o?.status===404?l({loading:!1,error:null,data:null}):l({loading:!1,error:o?.message||String(o),data:null})}})(),()=>{x=!1}},[t,a,r,i]),s}function ya({isOpen:a,onClose:r,userId:i,period:t,accessToken:s}){const{currency:l,rate:x}=ve(),o=Ve({userId:i,period:t,accessToken:s,enabled:a});return e.jsx(Ie,{open:a,onOpenChange:g=>{g||r?.()},children:e.jsxs(Pe,{children:[e.jsx(De,{className:"cost-modal-backdrop"}),e.jsx(Le,{className:"fixed inset-0 z-[101] flex items-center justify-center p-4",children:e.jsxs(Te,{className:c("cost-modal-popup","relative w-full max-w-[540px] 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","dark:border-t dark:border-white/[0.08]"),children:[e.jsx($e,{render:e.jsx("h2",{className:"sr-only"}),children:o.data?.user?.display_name||n("leaderboard.profile_modal.loading")}),o.loading&&e.jsx(Ge,{}),!o.loading&&o.error&&e.jsx("div",{className:"flex-1 flex items-center justify-center min-h-[280px]",children:e.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:n("leaderboard.profile_modal.error")})}),!o.loading&&!o.error&&!o.data&&e.jsx("div",{className:"flex-1 flex items-center justify-center min-h-[280px]",children:e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:n("leaderboard.profile_modal.empty")})}),!o.loading&&!o.error&&o.data&&e.jsx(me,{mode:xe.COMPACT,children:e.jsx(qe,{data:o.data,currency:l,rate:x,onClose:r})})]})})]})})}export{ya as LeaderboardProfileModal,qe as ProfileContent,Ge as ProfileSkeleton,Ve as useLeaderboardProfileData};
import{r as _,j as p,Y as xe,u as ge,a as ve,Q as be,L as Tt,Z as we,c as Y,$ as ye}from"./__vite-browser-external-CuMc3dqk.js";import{u as ke}from"./useCurrency-DdWYV5RR.js";import{H as Me}from"./HeaderGithubStar-BUS3-SIo.js";import{useLeaderboardProfileData as _e,ProfileSkeleton as Ce,ProfileContent as Se}from"./LeaderboardProfileModal-TF73oBuo.js";import{D as Te}from"./download-zNMgxXgK.js";import"./provider-display-Cn2q9F2Z.js";import"./useTokenFormat-BkFEXBXZ.js";import"./maximize-2-BZX57ABx.js";import"./terminal-d0IOaeZn.js";import"./info-CDTfOJ13.js";import"./LeaderboardAvatar-DKH9A5GV.js";import"./ProviderIcon-B6sgfDtI.js";import"./AchievementBadge-DvulAUrw.js";import"./zap-CcqNcNpw.js";import"./flame-VQYtrvgY.js";import"./AchievementsSection-CgiOHh54.js";import"./react-B80AX8fE.js";import"./format-tokens-173-9MpR.js";import"./use-reduced-motion-BEAopWkx.js";import"./arrow-up-right-D2tCxxHL.js";import"./link-2-CmjxdvpK.js";import"./check-Dy8VgHZ8.js";import"./DialogTitle-KxLDeLzC.js";import"./useScrollLock-DmM-LeMm.js";import"./store-NtnkxrS2.js";function $e(t){let e=t.replace("#","");return e.length===3&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),[parseInt(e.slice(0,2),16)/255,parseInt(e.slice(2,4),16)/255,parseInt(e.slice(4,6),16)/255]}function Re(t,e,a){t/=255,e/=255,a/=255;const r=Math.max(t,e,a),o=Math.min(t,e,a),n=r-o;let i=0;const u=r===0?0:n/r;return n!==0&&(r===t?i=((e-a)/n+6)%6:r===e?i=(a-t)/n+2:i=(t-e)/n+4,i/=6),[i,u,r]}function Fe(t,e,a){const r=Math.floor(t*6),o=t*6-r,n=a*(1-e),i=a*(1-o*e),u=a*(1-(1-o)*e);let l=0,c=0,h=0;switch(r%6){case 0:l=a,c=u,h=n;break;case 1:l=i,c=a,h=n;break;case 2:l=n,c=a,h=u;break;case 3:l=n,c=i,h=a;break;case 4:l=u,c=n,h=a;break;case 5:l=a,c=n,h=i;break}return[Math.round(l*255),Math.round(c*255),Math.round(h*255)]}const Ie=66,Oe=66,Pe=1500,Ae=1,$t=16,je=16,Ee=8,Le=96,Ne=2,We={name:"chromatic",modes:{dark:{colors:["#000000","#aae8ff","#c5fe9e","#f7888d","#0d0d0d","#fffdc3","#007cff"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:1.6,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.26,vigOpacity:.6,shaderOpacity:1},light:{colors:["#ffffff","#ffffff","#ffffff","#ffb3b3","#adadad","#f5ff70","#007cff"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.24,vigOpacity:.16,shaderOpacity:1}}},Be={name:"silver",modes:{dark:{colors:["#000000","#dedede","#747270","#e5e5e5","#0d0d0d","#ffffff","#e6e6e6"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.26,vigOpacity:.6,shaderOpacity:.88},light:{colors:["#f6f6f6","#ffffff","#ffffff","#f7f7f7","#c9c9c9","#d0d0d0","#d1d1d1"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.2,vigOpacity:.26,shaderOpacity:1}}},ze={name:"gold",modes:{dark:{colors:["#000000","#ffffff","#ffffff","#f7d488","#0d0d0d","#fffdc3","#ffffff"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.26,vigOpacity:.6,shaderOpacity:.92},light:{colors:["#fff8e1","#fffbe0","#ffffff","#fff6d6","#d2c7a7","#dcd2bc","#f9f7e5"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.22,vigOpacity:.24,shaderOpacity:1}}},Xt={chromatic:We,silver:Be,gold:ze},He=`
attribute vec2 a_position;
void main() { gl_Position = vec4(a_position, 0.0, 1.0); }
`,Ge=`
precision highp float;
uniform vec2 u_resolution;
uniform float u_time;
uniform vec3 u_color1, u_color2, u_color3, u_color4, u_color5, u_color6, u_color7;
uniform float u_alpha1, u_alpha2, u_alpha3, u_alpha4, u_alpha5, u_alpha6, u_alpha7;
uniform float u_intensity, u_scale, u_direction;
uniform float u_softness, u_distortion, u_complexity, u_shape;
uniform float u_vignette, u_vigOpacity, u_blur, u_shaderOpacity;
vec3 mod289(vec3 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }
vec2 mod289v2(vec2 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }
vec3 permute(vec3 x) { return mod289((x * 34.0 + 1.0) * x); }
float snoise(vec2 v) {
const vec4 C = vec4(0.211324865405187, 0.366025403784439,
-0.577350269189626, 0.024390243902439);
vec2 i = floor(v + dot(v, C.yy));
vec2 x0 = v - i + dot(i, C.xx);
vec2 i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);
vec4 x12 = x0.xyxy + C.xxzz;
x12.xy -= i1;
i = mod289v2(i);
vec3 p = permute(permute(i.y + vec3(0.0, i1.y, 1.0)) + i.x + vec3(0.0, i1.x, 1.0));
vec3 m = max(0.5 - vec3(dot(x0, x0), dot(x12.xy, x12.xy), dot(x12.zw, x12.zw)), 0.0);
m = m * m; m = m * m;
vec3 x_ = 2.0 * fract(p * C.www) - 1.0;
vec3 h = abs(x_) - 0.5;
vec3 ox = floor(x_ + 0.5);
vec3 a0 = x_ - ox;
m *= 1.79284291400159 - 0.85373472095314 * (a0 * a0 + h * h);
vec3 g;
g.x = a0.x * x0.x + h.x * x0.y;
g.yz = a0.yz * x12.xz + h.yz * x12.yw;
return 130.0 * dot(m, g);
}
float fbm(vec2 p, float oct) {
float val = 0.0, amp = 0.5;
int n = int(oct);
for (int i = 0; i < 7; i++) {
if (i >= n) break;
val += amp * snoise(p);
p *= 2.0;
amp *= 0.5;
}
return val;
}
float nfbm(vec2 p) { return fbm(p, 3.0 + u_complexity * 4.0); }
/* 5-stop palette used by effect 1 (Plasma) — direct port of \`palette\` from
* the canonical engine. Stops at t = 0, 0.25, 0.5, 0.75, 1.0. */
vec3 palette(float t) {
t = clamp(t, 0.0, 1.0);
t = t * t * (3.0 - 2.0 * t);
float k = 64.0;
float w1 = u_alpha1 * exp(-k * t * t);
float w2 = u_alpha2 * exp(-k * (t - 0.25) * (t - 0.25));
float w3 = u_alpha3 * exp(-k * (t - 0.5) * (t - 0.5));
float w4 = u_alpha4 * exp(-k * (t - 0.75) * (t - 0.75));
float w5 = u_alpha5 * exp(-k * (t - 1.0) * (t - 1.0));
float total = w1 + w2 + w3 + w4 + w5 + 0.0001;
return (u_color1 * w1 + u_color2 * w2 + u_color3 * w3 +
u_color4 * w4 + u_color5 * w5) / total;
}
/* Per-pixel alpha that re-introduces transparency when the user dials any
* palette stop's alpha below 1. Same \`paletteAlpha\` from the canonical
* engine. With every preset shipping all-1 alphas, this returns ~1 for every
* pixel — but mirroring it keeps custom-preset behaviour identical. */
float paletteAlpha(float t) {
t = clamp(t, 0.0, 1.0);
t = t * t * (3.0 - 2.0 * t);
float k = 64.0;
float w1 = u_alpha1 * exp(-k * t * t);
float w2 = u_alpha2 * exp(-k * (t - 0.25) * (t - 0.25));
float w3 = u_alpha3 * exp(-k * (t - 0.5) * (t - 0.5));
float w4 = u_alpha4 * exp(-k * (t - 0.75) * (t - 0.75));
float w5 = u_alpha5 * exp(-k * (t - 1.0) * (t - 1.0));
float totalW = w1 + w2 + w3 + w4 + w5 + 0.0001;
float rawW = exp(-k * t * t)
+ exp(-k * (t - 0.25) * (t - 0.25))
+ exp(-k * (t - 0.5) * (t - 0.5))
+ exp(-k * (t - 0.75) * (t - 0.75))
+ exp(-k * (t - 1.0) * (t - 1.0))
+ 0.0001;
return totalW / rawW;
}
vec2 warp(vec2 p, float t) {
float str = u_distortion * 2.0;
return vec2(
nfbm(p + vec2(t * 0.1, 0.0)),
nfbm(p + vec2(0.0, t * 0.12) + 5.0)
) * str;
}
/* Plasma: four sine bands warped by an FBM field, mapped through the
* 5-stop palette. Identical to effect 1 in the canonical engine. */
vec3 computeEffect(vec2 uv, float aspect, float t, float dist, float cpx) {
vec2 p = (uv - 0.5) * u_scale;
p.x *= aspect;
p += vec2(cos(u_direction), sin(u_direction)) * t * 0.15;
float freq = 3.0 + cpx * 8.0;
float val = 0.0;
val += sin(p.x * freq + t);
val += sin(p.y * freq + t * 1.3);
val += sin((p.x + p.y) * freq * 0.7 + t * 0.7);
val += sin(length(p) * freq * 0.8 - t * 1.5);
vec2 w = warp(p, t);
val += (w.x + w.y) * dist;
val = val * 0.2 * u_intensity + 0.5;
return palette(clamp(val, 0.0, 1.0));
}
void main() {
vec2 uv = gl_FragCoord.xy / u_resolution;
float aspect = u_resolution.x / u_resolution.y;
float t = u_time; // JS already multiplied u_time by preset.speed.
float dist = u_distortion;
float cpx = u_complexity;
/* 5-tap cross blur (center + cardinal offsets). The chromatic/silver/gold
* presets all ship with blur=1 so this path is always active. 5 taps
* instead of the canonical engine's 9 saves ~44% fragment work; the
* perceptual difference is nil because the output is already soft from
* the plasma's low spatial frequency and CSS blur on reflections. */
vec3 col;
if (u_blur < 0.01) {
col = computeEffect(uv, aspect, t, dist, cpx);
} else {
float r = u_blur * 0.02;
col = computeEffect(uv, aspect, t, dist, cpx) * 0.4;
col += computeEffect(uv + vec2( r, 0.0), aspect, t, dist, cpx) * 0.15;
col += computeEffect(uv + vec2(-r, 0.0), aspect, t, dist, cpx) * 0.15;
col += computeEffect(uv + vec2(0.0, r), aspect, t, dist, cpx) * 0.15;
col += computeEffect(uv + vec2(0.0, -r), aspect, t, dist, cpx) * 0.15;
}
/* Gamma punch — adds the contrast pop that defines the chromatic
* highlights. From the canonical engine: \`col = pow(col, vec3(1.3))\`. */
col = pow(col, vec3(1.3));
/* Vignette — soft edge darkening so corners read as recessed. The 40-px
* scale at the bottom of the formula is hard-coded in the canonical
* engine; we keep it for visual parity. */
float edgeDist = min(min(uv.x, 1.0 - uv.x), min(uv.y, 1.0 - uv.y));
float vigPx = 40.0 / min(u_resolution.x, u_resolution.y);
float vigRange = vigPx * (1.0 + u_vignette * 3.0);
float vig = edgeDist * edgeDist / (vigRange * vigRange);
vig = smoothstep(0.0, 1.0, vig);
col *= mix(1.0, vig, u_vignette * u_vigOpacity);
/* Per-pixel alpha. With all-1 alphas the formula collapses to ~1 but the
* computation matches the canonical engine so custom presets behave the
* same. */
float colorAlpha = (u_alpha1 + u_alpha2 + u_alpha3 + u_alpha4 + u_alpha5) / 5.0;
if (colorAlpha < 0.999) {
vec3 c1d = col - u_color1, c2d = col - u_color2, c3d = col - u_color3,
c4d = col - u_color4, c5d = col - u_color5;
float prox1 = exp(-8.0 * dot(c1d, c1d));
float prox2 = exp(-8.0 * dot(c2d, c2d));
float prox3 = exp(-8.0 * dot(c3d, c3d));
float prox4 = exp(-8.0 * dot(c4d, c4d));
float prox5 = exp(-8.0 * dot(c5d, c5d));
float pTotal = prox1 + prox2 + prox3 + prox4 + prox5 + 0.0001;
colorAlpha = (prox1 * u_alpha1 + prox2 * u_alpha2 + prox3 * u_alpha3 +
prox4 * u_alpha4 + prox5 * u_alpha5) / pTotal;
}
float alpha = colorAlpha;
/* Touch the unused-at-effect-1 uniforms so GL drivers that complain about
* declared-but-unread uniforms (some Mali / Adreno builds do) keep them
* live. The contribution is provably zero. */
alpha += 0.0 * (u_softness + u_shape +
u_alpha6 + u_alpha7 +
u_color6.x + u_color7.x);
gl_FragColor = vec4(col, alpha * u_shaderOpacity);
}
`;function Rt(t,e,a){const r=t.createShader(e);if(!r)throw new Error("metal-fx: gl.createShader returned null");if(t.shaderSource(r,a),t.compileShader(r),!t.getShaderParameter(r,t.COMPILE_STATUS)){const o=t.getShaderInfoLog(r);throw t.deleteShader(r),new Error(`metal-fx: shader compile failed: ${o??"(no info log)"}`)}return r}function De(t,e,a){const r=t.createProgram();if(!r)throw new Error("metal-fx: gl.createProgram returned null");if(t.attachShader(r,e),t.attachShader(r,a),t.linkProgram(r),!t.getProgramParameter(r,t.LINK_STATUS)){const o=t.getProgramInfoLog(r);throw t.deleteProgram(r),new Error(`metal-fx: program link failed: ${o??"(no info log)"}`)}return r}const Yt=140,Zt=40,Kt=1.6,Jt=1.3;let s=null,bt=null;function Ue(t){bt=t}const qe=["u_resolution","u_time","u_color1","u_color2","u_color3","u_color4","u_color5","u_color6","u_color7","u_alpha1","u_alpha2","u_alpha3","u_alpha4","u_alpha5","u_alpha6","u_alpha7","u_intensity","u_scale","u_direction","u_softness","u_distortion","u_complexity","u_shape","u_vignette","u_vigOpacity","u_blur","u_shaderOpacity"];function Ft(t){t.enable(t.BLEND),t.blendFunc(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA);const e=Rt(t,t.VERTEX_SHADER,He),a=Rt(t,t.FRAGMENT_SHADER,Ge),r=De(t,e,a);t.useProgram(r);const o=t.createBuffer();if(!o)throw new Error("metal-fx: gl.createBuffer returned null");t.bindBuffer(t.ARRAY_BUFFER,o),t.bufferData(t.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]),t.STATIC_DRAW);const n=t.getAttribLocation(r,"a_position");t.enableVertexAttribArray(n),t.vertexAttribPointer(n,2,t.FLOAT,!1,0,0);const i={};for(const u of qe)i[u]=t.getUniformLocation(r,u);return{program:r,buffer:o,uniforms:i}}function te(){if(s)return s;const t=Math.min(Ne,typeof window<"u"&&window.devicePixelRatio||1),e=Math.round(Le*t),a=typeof OffscreenCanvas<"u";let r,o;if(a)r=new OffscreenCanvas(e,e),o=r.getContext("webgl",{alpha:!0,premultipliedAlpha:!1,antialias:!1});else{const h=document.createElement("canvas");h.width=e,h.height=e,o=h.getContext("webgl",{alpha:!0,premultipliedAlpha:!1,antialias:!1,preserveDrawingBuffer:!0})??h.getContext("experimental-webgl"),r=h}if(!o)throw new Error("metal-fx: WebGL not supported");const{program:n,buffer:i,uniforms:u}=Ft(o),l=h=>{h.preventDefault(),s&&(s.contextLost=!0)},c=()=>{if(!s)return;const h=Ft(s.gl);s.program=h.program,s.buffer=h.buffer,s.uniforms=h.uniforms,s.presetDirty=!0,s.contextLost=!1,bt?.()};return r.addEventListener("webglcontextlost",l,!1),r.addEventListener("webglcontextrestored",c,!1),s={glCanvas:r,gl:o,program:n,buffer:i,uniforms:u,preset:Xt.chromatic.modes.dark,presetDirty:!0,contextLost:!1,useOffscreen:a,frameBitmap:null,startMs:performance.now(),pausedMs:0,pausedAtMs:null,rafId:0,dpr:t,instances:new Set,frameCount:0,glowQueue:[],glowIdx:0,glowSkip:0,glowPixels:new Uint8Array(e*e*4),glowPixelsW:e,glowPixelsH:e},s}function Qe(){var t;if(!s)return;const{gl:e,program:a,buffer:r,frameBitmap:o}=s;try{o?.close(),e.deleteBuffer(r),e.deleteProgram(a),(t=e.getExtension("WEBGL_lose_context"))==null||t.loseContext()}catch{}s=null}let It=0;function dt(){if(!s)return;const t=performance.now();if(t-It<Pe)return;It=t;const{gl:e,glCanvas:a}=s,r=a.width,o=a.height;(s.glowPixelsW!==r||s.glowPixelsH!==o)&&(s.glowPixelsW=r,s.glowPixelsH=o,s.glowPixels=new Uint8Array(r*o*4)),e.readPixels(0,0,r,o,e.RGBA,e.UNSIGNED_BYTE,s.glowPixels)}const Z={bx:0,by:0};function kt(t,e,a){if(!s)return Z.bx=0,Z.by=0,Z;const{glCanvas:r}=s,o=r.width,n=r.height,i=t.dpr,u=t.cssWidth*i,l=t.cssHeight*i,c=Yt*i,h=Zt*i;let f=u*(o/c)/t.shaderScale,d=l*(n/h)/t.shaderScale;f>o&&(f=o),d>n&&(d=n);const g=(o-f)/2,x=(n-d)/2,m=g+e/t.cssWidth*f,F=x+a/t.cssHeight*d;return Z.bx=Math.round(m),Z.by=Math.round(n-1-F),Z}const G={r:0,g:0,b:0,lum:0,count:0};function ee(t,e,a,r,o,n){const i=Math.max(1,n|0),u=Math.max(0,r-i),l=Math.min(e,r+i+1),c=Math.max(0,o-i),h=Math.min(a,o+i+1);G.r=0,G.g=0,G.b=0,G.lum=0,G.count=0;for(let f=c;f<h;f++){const d=f*e;for(let g=u;g<l;g++){const x=(d+g)*4;G.r+=t[x],G.g+=t[x+1],G.b+=t[x+2],G.lum+=(.2126*t[x]+.7152*t[x+1]+.0722*t[x+2])/255,G.count++}}return G}const R={r:255,g:255,b:255};function Ot(t,e,a,r){if(!s)return 0;dt();const o=kt(t,e,a),n=ee(s.glowPixels,s.glowPixelsW,s.glowPixelsH,o.bx,o.by,r);return n.count>0?n.lum/n.count:0}function Ve(t,e,a,r){if(!s)return R.r=255,R.g=255,R.b=255,R;dt();const o=kt(t,e,a),n=ee(s.glowPixels,s.glowPixelsW,s.glowPixelsH,o.bx,o.by,r);return n.count===0?(R.r=255,R.g=255,R.b=255,R):(R.r=n.r/n.count,R.g=n.g/n.count,R.b=n.b/n.count,R)}function Xe(t,e,a,r){if(!s)return R.r=255,R.g=255,R.b=255,R;dt();const o=kt(t,e,a),{glowPixels:n,glowPixelsW:i,glowPixelsH:u}=s,l=Math.max(1,r|0),c=Math.max(0,o.bx-l),h=Math.min(i,o.bx+l+1),f=Math.max(0,o.by-l),d=Math.min(u,o.by+l+1);let g=-1;R.r=255,R.g=255,R.b=255;for(let x=f;x<d;x++){const m=x*i;for(let F=c;F<h;F++){const b=(m+F)*4,P=n[b],j=n[b+1],L=n[b+2],C=Math.max(P,j,L),E=Math.min(P,j,L),z=(C>0?(C-E)/C:0)*(.35+.65*(C/255));z>g&&(g=z,R.r=P,R.g=j,R.b=L)}}return R}Ue(()=>{s&&s.instances.size>0&&s.pausedAtMs===null&&nt()});typeof document<"u"&&document.addEventListener("visibilitychange",()=>{!s||s.pausedAtMs!==null||s.contextLost||(document.hidden?oe():s.instances.size>0&&nt())});function Ye(t){const e=te(),a=t.hostCanvas.getContext("2d",{alpha:!0});if(!a)throw new Error("metal-fx: canvas 2D context unavailable");const r=t.scale??1,o={canvas:t.hostCanvas,ctx:a,cssWidth:t.cssWidth,cssHeight:t.cssHeight,cornerRadius:t.cornerRadius,kind:t.kind,ringCssPx:t.ringCssPx??(t.kind==="circle"?2:1)*r,shaderScale:t.shaderScale??(t.kind==="circle"?Jt:Kt)*r,opacityMul:t.opacityMul??1,visible:!0,paused:t.paused??!1,everCopied:!1,dpr:typeof window<"u"&&window.devicePixelRatio||1,scale:r,onAfterFrame:t.onAfterFrame,onFirstCopy:t.onFirstCopy};return ae(o),e.instances.add(o),e.rafId===0&&e.pausedAtMs===null&&nt(),o}function Ze(t){if(!s)return;s.instances.delete(t);const e=s.glowQueue.indexOf(t);e!==-1&&s.glowQueue.splice(e,1),s.instances.size===0&&(oe(),Qe())}function Ke(t){s&&(s.glowQueue.includes(t)||s.glowQueue.push(t))}function Je(t){if(!s)return;const e=s.glowQueue.indexOf(t);e!==-1&&s.glowQueue.splice(e,1)}function rt(t,e){let a=!1;e.cssWidth!==void 0&&e.cssWidth!==t.cssWidth&&(t.cssWidth=e.cssWidth,a=!0),e.cssHeight!==void 0&&e.cssHeight!==t.cssHeight&&(t.cssHeight=e.cssHeight,a=!0),e.cornerRadius!==void 0&&(t.cornerRadius=e.cornerRadius),e.scale!==void 0&&(t.scale=e.scale),e.kind!==void 0&&e.kind!==t.kind&&(t.kind=e.kind,e.shaderScale===void 0&&(t.shaderScale=(e.kind==="circle"?Jt:Kt)*t.scale),e.ringCssPx===void 0&&(t.ringCssPx=(e.kind==="circle"?2:1)*t.scale)),e.shaderScale!==void 0&&(t.shaderScale=e.shaderScale),e.ringCssPx!==void 0&&(t.ringCssPx=e.ringCssPx),e.opacityMul!==void 0&&(t.opacityMul=e.opacityMul),e.paused!==void 0&&e.paused!==t.paused&&(t.paused=e.paused,!e.paused&&s&&s.rafId===0&&s.pausedAtMs===null&&!s.contextLost&&nt()),a&&ae(t)}function ta(t,e){t.visible=e,e&&s&&s.rafId===0&&s.pausedAtMs===null&&!s.contextLost&&nt()}function ea(t,e){const a=te();a.preset=Xt[t].modes[e],a.presetDirty=!0}let wt=null;function aa(t){wt=t}function ae(t){t.dpr=typeof window<"u"&&window.devicePixelRatio||1;const e=Math.max(1,Math.round(t.cssWidth*t.dpr)),a=Math.max(1,Math.round(t.cssHeight*t.dpr));t.canvas.width!==e&&(t.canvas.width=e),t.canvas.height!==a&&(t.canvas.height=a)}function ra(t){const{ctx:e,dpr:a,canvas:r}=t,o=t.ringCssPx*a,n=r.width,i=r.height,u=Math.max(0,(t.cornerRadius-t.ringCssPx)*a);e.save(),e.globalCompositeOperation="destination-out",e.fillStyle="#000",e.beginPath(),e.roundRect(o,o,n-2*o,i-2*o,u),e.fill(),e.restore()}function oa(t){var e;if(!s)return;const a=s.frameBitmap??s.glCanvas,r=t.dpr,o=t.canvas.width,n=t.canvas.height;if(o<1||n<1)return;const i=s.glCanvas.width,u=s.glCanvas.height,l=Yt*r,c=Zt*r;let h=o*(i/l)/t.shaderScale,f=n*(u/c)/t.shaderScale;h>i&&(h=i),f>u&&(f=u);const d=Math.max(0,(i-h)/2),g=Math.max(0,(u-f)/2);if(t.ctx.clearRect(0,0,o,n),t.opacityMul<1&&(t.ctx.globalAlpha=t.opacityMul),t.ctx.drawImage(a,d,g,h,f,0,0,o,n),t.opacityMul<1&&(t.ctx.globalAlpha=1),ra(t),t.onFirstCopy){const x=t.onFirstCopy;t.onFirstCopy=void 0,x()}(e=t.onAfterFrame)==null||e.call(t)}function na(){if(!s)return;const{gl:t,uniforms:e,preset:a,glCanvas:r}=s;e.u_resolution&&t.uniform2f(e.u_resolution,r.width,r.height);for(let o=0;o<7;o++){const n=e[`u_color${o+1}`];if(n){const[u,l,c]=$e(a.colors[o]);t.uniform3f(n,u,l,c)}const i=e[`u_alpha${o+1}`];i&&t.uniform1f(i,a.alphas[o])}e.u_intensity&&t.uniform1f(e.u_intensity,a.intensity),e.u_scale&&t.uniform1f(e.u_scale,a.scale),e.u_direction&&t.uniform1f(e.u_direction,a.direction*Math.PI/180),e.u_softness&&t.uniform1f(e.u_softness,a.softness),e.u_distortion&&t.uniform1f(e.u_distortion,a.distortion),e.u_complexity&&t.uniform1f(e.u_complexity,a.complexity),e.u_shape&&t.uniform1f(e.u_shape,a.shape),e.u_vignette&&t.uniform1f(e.u_vignette,a.vignette),e.u_vigOpacity&&t.uniform1f(e.u_vigOpacity,a.vigOpacity),e.u_blur&&t.uniform1f(e.u_blur,a.blur),e.u_shaderOpacity&&t.uniform1f(e.u_shaderOpacity,a.shaderOpacity),s.presetDirty=!1}function ia(t){if(!s)return;const{gl:e,uniforms:a,preset:r,glCanvas:o}=s,n=(t-s.startMs-s.pausedMs)/1e3*r.speed;e.viewport(0,0,o.width,o.height),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),s.presetDirty&&na(),a.u_time&&e.uniform1f(a.u_time,n),e.drawArrays(e.TRIANGLES,0,6),s.frameCount++}let Pt=0;function re(t){var e;if(!s)return;if(s.contextLost){s.rafId=0;return}let a=!1;for(const r of s.instances)if(r.visible&&(!r.paused||!r.everCopied)){a=!0;break}if(!a){s.rafId=0;return}if(s.rafId=requestAnimationFrame(re),!(t-Pt<Ie)){Pt=t,ia(t),s.useOffscreen&&(s.glowQueue.length>0&&dt(),(e=s.frameBitmap)==null||e.close(),s.frameBitmap=s.glCanvas.transferToImageBitmap());for(const r of s.instances)r.visible&&(r.paused&&r.everCopied||(oa(r),r.everCopied=!0));if(wt&&s.glowQueue.length>0&&++s.glowSkip%Ae===0){const r=s.glowQueue;s.glowIdx>=r.length&&(s.glowIdx=0);const o=r[s.glowIdx];o.visible&&!o.paused&&wt(o,t),s.glowIdx++}}}function nt(){!s||s.rafId!==0||(s.rafId=requestAnimationFrame(re))}function oe(){s&&(s.rafId!==0&&cancelAnimationFrame(s.rafId),s.rafId=0)}const lt={linear:t=>t,smoothstep:t=>t*t*(3-2*t)};function K(t,e,a,r=lt.linear){return{from:t,to:e,dur:a,ease:r,startMs:-1,val:t,done:!1}}function J(t,e){t.startMs=e,t.val=t.from,t.done=!1}function At(t,e){if(t.done||t.startMs<0)return t.val;const a=Math.min(1,(e-t.startMs)/t.dur);return t.val=t.from+(t.to-t.from)*t.ease(a),a>=1&&(t.done=!0),t.val}const sa=1.5,it=1/3,la=4*it,ca=2*it,da=2*it,ua=1.35*it,ha=13*it;function Mt(t,e,a){const r=Math.max(0,Math.min(a,Math.min(t,e)/2));return 2*Math.max(0,t-2*r)+2*Math.max(0,e-2*r)+2*Math.PI*r}function _t(t,e,a,r){return r==="circle"?2*Math.PI*Math.max(0,Math.min(a,Math.min(t,e)/2)):Mt(t,e,a)}function ot(t,e,a,r,o,n,i,u){const l=u||{x:0,y:0},c=Math.max(0,Math.min(r,Math.min(e,a)/2));if(i==="circle"){const b=2*Math.PI*c;if(b<=1e-4)return l.x=e*.5,l.y=a*.5,l;t=(t%b+b)%b;const P=-Math.PI/2+t/b*Math.PI*2,j=Math.max(0,c-o+n);return l.x=e*.5+j*Math.cos(P),l.y=a*.5+j*Math.sin(P),l}const h=Math.max(0,e-2*c),f=Math.max(0,a-2*c),d=Math.PI*c/2,g=2*(h+f)+4*d;t=(t%g+g)%g;const x=Math.max(0,c-o+n);let m=t;if(m<h)return l.x=c+m,l.y=o-n,l;if(m-=h,m<d){const b=-Math.PI/2+(d>0?m/d:0)*(Math.PI/2);return l.x=e-c+x*Math.cos(b),l.y=c+x*Math.sin(b),l}if(m-=d,m<f)return l.x=e-o+n,l.y=c+m,l;if(m-=f,m<d){const b=(d>0?m/d:0)*(Math.PI/2);return l.x=e-c+x*Math.cos(b),l.y=a-c+x*Math.sin(b),l}if(m-=d,m<h)return l.x=e-c-m,l.y=a-o+n,l;if(m-=h,m<d){const b=Math.PI/2+(d>0?m/d:0)*(Math.PI/2);return l.x=c+x*Math.cos(b),l.y=a-c+x*Math.sin(b),l}if(m-=d,m<f)return l.x=o-n,l.y=a-c-m,l;m-=f;const F=Math.PI+(d>0?m/d:0)*(Math.PI/2);return l.x=c+x*Math.cos(F),l.y=c+x*Math.sin(F),l}function jt(t,e){const a=t*2/e;let r="";for(let o=0;o<=e;o++){const n=-t+o*a;r+=(o===0?"M ":"L ")+n.toFixed(3)+" 0 "}return r}const ft={x:0,y:0},pt={x:0,y:0};function fa(t,e,a,r,o,n){return ot(t-.1,e,a,r,o,0,n,ft),ot(t+.1,e,a,r,o,0,n,pt),Math.atan2(pt.y-ft.y,pt.x-ft.x)}function Et(t,e,a){const r=Math.max(0,Math.min(1,(a-t)/(e-t)));return r*r*(3-2*r)}function pa(t){const e=_t(t.width,t.height,t.cornerRadius,t.kind),a=sa*(t.scale??1),r=[];for(let o=0;o<$t;o++){const n=o/$t*e,i=ot(n,t.width,t.height,t.cornerRadius,a,0,t.kind);r.push({x:i.x,y:i.y,arc:n})}return r}function ma(t,e){const{width:a,height:r,cornerRadius:o}=t,n=t.scale??1,i=t.kind==="circle"?2:1,u=Math.max(0,o-i),l=(-200*n).toFixed(0),c=l,h=(540*n).toFixed(0),f=(440*n).toFixed(0),d=`x="${l}" y="${c}" width="${h}" height="${f}"`,g=`${d} filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"`,x=F=>(F*n).toFixed(3),m=F=>(F*n).toFixed(3);return["<defs>",`<filter id="${e}_bXl" ${g}><feGaussianBlur stdDeviation="${m(8.4)}"/></filter>`,`<filter id="${e}_bLg" ${g}><feGaussianBlur stdDeviation="${m(4.8)}"/></filter>`,`<filter id="${e}_bMd" ${g}><feGaussianBlur stdDeviation="${m(2.1)}"/></filter>`,`<filter id="${e}_bSm" ${g}><feGaussianBlur stdDeviation="${m(.9)}"/></filter>`,`<filter id="${e}_ebO" ${g}><feGaussianBlur stdDeviation="${m(da)}"/></filter>`,`<filter id="${e}_ebC" ${g}><feGaussianBlur stdDeviation="${m(ua)}"/></filter>`,`<radialGradient id="${e}_fg" cx="0.5" cy="0.5" r="0.5"><stop offset="0" stop-color="white"/><stop offset="0.30" stop-color="white"/><stop offset="0.65" stop-color="#404040"/><stop offset="1" stop-color="black"/></radialGradient>`,`<mask id="${e}_fm" maskUnits="userSpaceOnUse" ${d}><rect ${d} fill="black"/><circle id="${e}_fc" cx="0" cy="0" r="${(ha*n).toFixed(3)}" fill="url(#${e}_fg)"/></mask>`,`<mask id="${e}_rm" maskUnits="userSpaceOnUse" ${d}><rect ${d} fill="#808080"/><rect x="0" y="0" width="${a}" height="${r}" rx="${o}" ry="${o}" fill="white"/><rect x="${i}" y="${i}" width="${a-i*2}" height="${r-i*2}" rx="${u}" ry="${u}" fill="black"/></mask>`,"</defs>",`<g id="${e}_h" mask="url(#${e}_rm)" opacity="0">`,`<rect ${d} fill="none" pointer-events="none"/>`,`<g id="${e}_hI" stroke="white">`,`<path id="${e}_pXl" stroke-width="${x(26.4)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.385" filter="url(#${e}_bXl)"/>`,`<path id="${e}_pLg" stroke-width="${x(15.6)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.595" filter="url(#${e}_bLg)"/>`,`<path id="${e}_pMd" stroke-width="${x(7.2)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.70" filter="url(#${e}_bMd)"/>`,`<path id="${e}_pSm" stroke-width="${x(3)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.70" filter="url(#${e}_bSm)"/>`,"</g></g>",`<g id="${e}_e" mask="url(#${e}_rm)" opacity="0">`,`<rect ${d} fill="none" pointer-events="none"/>`,`<g mask="url(#${e}_fm)">`,`<g id="${e}_eI" stroke="white">`,`<path id="${e}_eO" stroke-width="${x(la)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.85" filter="url(#${e}_ebO)"/>`,`<path id="${e}_eC" stroke-width="${x(ca)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="1.0" filter="url(#${e}_ebC)"/>`,"</g></g></g>"].join("")}const xa=.00875,Lt=.08,Nt=.32,ga=.05,va=3e3,Wt=.85,st=.34,mt=1500,ba=15,wa=.0075,ya=120,ka=1.5,Ma=7.8,_a=9.13952,Ca=1,Sa=1/3,Ta=.8,$a=3.51,Bt=2e3,xt=400,Ra=2.625,Fa=1.008,Ia=.31,ne=140,ie=40,se=20;let Oa=0;const q={x:0,y:0};function zt(t,e){const a=`mfxg_${++Oa}`,r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("class","metal-fx-glow-svg"),r.setAttribute("preserveAspectRatio","none"),r.setAttribute("viewBox",`0 0 ${e.width} ${e.height}`),r.innerHTML=ma(e,a),t.appendChild(r);const o=b=>r.querySelector(`#${a}_${b}`),n=o("h"),i=o("hI"),u=o("e"),l=o("eI"),c=o("fc"),h=_t(e.width,e.height,e.cornerRadius,e.kind)/Mt(ne,ie,se),f=Math.max(1,Ma*h),d=Math.max(.6,_a*Sa*h),g=jt(f,je),x=jt(d,Ee),m=[o("pXl"),o("pLg"),o("pMd"),o("pSm")],F=[o("eO"),o("eC")];for(const b of m)b.setAttribute("d",g);for(const b of F)b.setAttribute("d",x);return i.style.transformOrigin="0 0",l.style.transformOrigin="0 0",i.style.willChange="transform",l.style.willChange="transform",i.style.transition="transform 100ms linear",l.style.transition="transform 100ms linear",n.style.willChange="opacity",u.style.willChange="opacity",n.style.transition="opacity 100ms linear",u.style.transition="opacity 100ms linear",c.style.willChange="transform",{svg:r,haloGroup:n,haloInner:i,extraGroup:u,extraInner:l,fadeCircle:c,width:e.width,height:e.height,cornerRadius:e.cornerRadius,kind:e.kind,scale:e.scale??1,perim:pa(e),currentIdx:0,appearedAt:0,glowOpacity:0,relocTween:null,relocNextIdx:-1,wanderS:0,wanderTargetS:0,wanderFrames:0,tintFrom:{r:255,g:255,b:255},tintTarget:{r:255,g:255,b:255},tintTween:null,tintHoldUntil:0,lastHaloStroke:"",lastExtraStroke:""}}function Pa(t,e,a,r,o="dark"){var n;const{width:i,height:u,cornerRadius:l,perim:c}=t;if(c.length===0)return;const h=2;let f=-1,d=t.currentIdx,g=0;for(let v=0;v<c.length;v++){const M=c[v],S=Ot(e,M.x,M.y,h);S>f&&(f=S,d=v),v===t.currentIdx&&(g=S)}const x=t.appearedAt>0&&a-t.appearedAt<va,m=st+(Wt-st)*Et(Lt,Nt,g),F=!x&&f-g>ga;if(!t.relocTween||t.relocTween.done)if(t.appearedAt===0)t.currentIdx=d,t.appearedAt=a,t.wanderS=0,t.wanderTargetS=0,t.wanderFrames=0,t.relocTween=K(0,m,mt,lt.smoothstep),J(t.relocTween,a);else if((n=t.relocTween)!=null&&n.done&&t.relocTween.to===0){t.currentIdx=t.relocNextIdx,t.appearedAt=a,t.wanderS=0,t.wanderTargetS=0,t.wanderFrames=0;const v=c[t.currentIdx],M=Ot(e,v.x,v.y,h),S=st+(Wt-st)*Et(Lt,Nt,M);t.relocTween=K(0,S,mt,lt.smoothstep),J(t.relocTween,a)}else F?(t.relocNextIdx=d,t.relocTween=K(t.glowOpacity,0,mt,lt.smoothstep),J(t.relocTween,a)):t.glowOpacity+=(m-t.glowOpacity)*xa;t.relocTween&&(t.glowOpacity=At(t.relocTween,a)),t.glowOpacity=Math.max(0,Math.min(1,t.glowOpacity));const b=_t(i,u,l,t.kind)/Mt(ne,ie,se),P=ba*b;t.wanderFrames++>=ya&&(t.wanderTargetS=(Math.random()*2-1)*P,t.wanderFrames=0),t.wanderS+=(t.wanderTargetS-t.wanderS)*wa;const j=c[t.currentIdx].arc+t.wanderS,L=ka*t.scale;ot(j,i,u,l,L,0,t.kind,q);const C=q.x,E=q.y,z=fa(j,i,u,l,L,t.kind),X=`translate(${C.toFixed(3)}px,${E.toFixed(3)}px) rotate(${z.toFixed(4)}rad)`;t.haloInner.style.transform=X;const N=Ca*b*t.scale;ot(j,i,u,l,L,N,t.kind,q),t.extraInner.style.transform=`translate(${q.x.toFixed(3)}px,${q.y.toFixed(3)}px) rotate(${z.toFixed(4)}rad)`,t.fadeCircle.style.transform=`translate(${q.x.toFixed(3)}px,${q.y.toFixed(3)}px)`;const $=o==="light",k=$?Xe(e,C,E,h):Ve(e,C,E,h);t.tintTween?t.tintTween.done&&($?(t.tintFrom={r:t.tintFrom.r+(t.tintTarget.r-t.tintFrom.r)*t.tintTween.val,g:t.tintFrom.g+(t.tintTarget.g-t.tintFrom.g)*t.tintTween.val,b:t.tintFrom.b+(t.tintTarget.b-t.tintFrom.b)*t.tintTween.val},t.tintTarget={...k},t.tintTween=K(0,1,xt),J(t.tintTween,a)):a>=t.tintHoldUntil&&(t.tintFrom={...t.tintTarget},t.tintTarget={...k},t.tintTween=K(0,1,xt),J(t.tintTween,a),t.tintHoldUntil=a+Bt)):(t.tintFrom={...k},t.tintTarget={...k},t.tintTween=K(0,1,xt),J(t.tintTween,a),t.tintHoldUntil=$?0:a+Bt),At(t.tintTween,a);const I=t.tintTween.val;let W,B,H;if($)W=Math.round(t.tintFrom.r+(t.tintTarget.r-t.tintFrom.r)*I),B=Math.round(t.tintFrom.g+(t.tintTarget.g-t.tintFrom.g)*I),H=Math.round(t.tintFrom.b+(t.tintTarget.b-t.tintFrom.b)*I);else{const v=t.tintFrom.r+(t.tintTarget.r-t.tintFrom.r)*I,M=t.tintFrom.g+(t.tintTarget.g-t.tintFrom.g)*I,S=t.tintFrom.b+(t.tintTarget.b-t.tintFrom.b)*I,O=Math.max(v,M,S)||1;W=Math.round(255*(v/O)),B=Math.round(255*(M/O)),H=Math.round(255*(S/O))}const y=`rgb(${W},${B},${H})`;if(y!==t.lastHaloStroke&&(t.lastHaloStroke=y,t.haloInner.style.stroke=y),$){const v=Re(W,B,H),[M,S,O]=Fe(v[0],Math.min(1,v[1]*Ra),Math.max(Ia,v[2]*Fa)),D=`rgb(${M},${S},${O})`;D!==t.lastExtraStroke&&(t.lastExtraStroke=D,t.extraInner.style.stroke=D)}else t.lastExtraStroke!=="#ffffff"&&(t.lastExtraStroke="#ffffff",t.extraInner.style.stroke="#ffffff");const w=Math.max(0,Math.min(1,r));t.haloGroup.style.opacity=(t.glowOpacity*Ta*w).toFixed(3),t.extraGroup.style.opacity=Math.min(1,t.glowOpacity*$a*w).toFixed(3)}const yt=12,Ht=32,Gt=1,Dt=.55,Aa=1,ja=1,Ea=.85,La=0,Na=1.3,Ut=3.6,Wa=.7,Ba=1,za=.52,Ha=1,Ga=.044,Da=235,Ua=2.535,qa=.7,Qa=.5,Va=new Set(["INPUT","TEXTAREA","SELECT","OPTION"]);function Xa(t,e){const a=Math.max(t.left-e.right,e.left-t.right,0),r=Math.max(t.top-e.bottom,e.top-t.bottom,0);return Math.sqrt(a*a+r*r)}function Ya(t,e,a,r){return!(Math.min(t.bottom,e.bottom)-Math.max(t.top,e.top)<a||Math.max(t.left-e.right,e.left-t.right,0)>r)}function Za(t,e,a,r){return Math.min(t.right,e.right)-Math.max(t.left,e.left)<a?!1:Math.max(t.top-e.bottom,e.top-t.bottom,0)<=r}function V(t,e,a,r,o,n){const i=Math.max(0,Math.min(n,r*.5,o*.5)),u=t.roundRect;if(typeof u=="function"){u.call(t,e,a,r,o,i);return}t.moveTo(e+i,a),t.lineTo(e+r-i,a),t.quadraticCurveTo(e+r,a,e+r,a+i),t.lineTo(e+r,a+o-i),t.quadraticCurveTo(e+r,a+o,e+r-i,a+o),t.lineTo(e+i,a+o),t.quadraticCurveTo(e,a+o,e,a+o-i),t.lineTo(e,a+i),t.quadraticCurveTo(e,a,e+i,a)}function le(t,e,a,r,o){if(!o.flipX&&!o.flipY){t.drawImage(e,0,0,a,r,o.x,o.y,o.w,o.h);return}t.save(),o.flipX&&(t.translate(o.x+o.w,0),t.scale(-1,1)),o.flipY&&(t.translate(0,o.y+o.h),t.scale(1,-1)),t.drawImage(e,0,0,a,r,o.flipX?0:o.x,o.flipY?0:o.y,o.w,o.h),t.restore()}const Ka=4;function Ja(t,e,a,r,o,n,i){if(r<=2*i||o<=2*i){t.beginPath(),V(t,e,a,r,o,n),t.clip();return}t.beginPath(),V(t,e,a,r,o,n),V(t,e+i,a+i,r-2*i,o-2*i,Math.max(0,n-i)),t.clip("evenodd")}function tr(t,e,a,r,o,n,i,u,l,c,h){const f=Math.max(1,Math.round((yt+Ka*3)*h));let d=Math.max(0,i),g=!0;for(let x=0;x<3&&d>1e-4;x++){const m=Math.min(1,d);t.save(),Ja(t,c.x,c.y,c.w,c.h,c.r,f),t.globalCompositeOperation=g?"source-over":"lighter",g=!1,t.globalAlpha=m,le(t,e,a,r,l),t.globalAlpha=1,t.globalCompositeOperation="destination-in",t.fillStyle=u,t.fillRect(0,0,o,n),t.restore(),d-=m}}function ce(t,e,a,r,o,n,i){const u=i|0;if(u<1||r<=2*u||o<=2*u){t.beginPath(),V(t,e,a,r,o,n),t.clip();return}t.beginPath(),V(t,e,a,r,o,n),V(t,e+u,a+u,r-2*u,o-2*u,Math.max(0,n-u)),t.clip("evenodd")}function er(t,e,a,r,o,n,i,u,l,c,h,f){let d=u*h,g=!0;for(let x=0;x<3&&d>1e-4;x++){const m=Math.min(1,d);t.save(),ce(t,i.x,i.y,i.w,i.h,i.r,l),t.globalCompositeOperation=g?"source-over":"lighter",g=!1,t.globalAlpha=m,le(t,e,a,r,f),t.globalAlpha=1,t.globalCompositeOperation="destination-in",t.fillStyle=c,t.fillRect(0,0,o,n),t.restore(),d-=m}}function ar(t,e,a,r,o,n,i,u){const l=t.createLinearGradient(r,o,n,i);l.addColorStop(0,`rgba(255,255,255,${u.toFixed(3)})`),l.addColorStop(.5,`rgba(255,255,255,${(u*.45).toFixed(3)})`),l.addColorStop(1,"rgba(255,255,255,0)"),t.save(),ce(t,e.x,e.y,e.w,e.h,e.r,a),t.globalCompositeOperation="lighter",t.lineWidth=a*2,t.strokeStyle=l,t.beginPath(),V(t,e.x,e.y,e.w,e.h,e.r),t.stroke(),t.restore()}function de(t){const e=getComputedStyle(t),a=[parseFloat(e.borderTopLeftRadius)||0,parseFloat(e.borderTopRightRadius)||0,parseFloat(e.borderBottomRightRadius)||0,parseFloat(e.borderBottomLeftRadius)||0].filter(r=>r>0);return a.length?Math.min.apply(null,a):0}function ue(t){const e=getComputedStyle(t),a=Math.max(parseFloat(e.borderTopWidth)||0,parseFloat(e.borderRightWidth)||0,parseFloat(e.borderBottomWidth)||0,parseFloat(e.borderLeftWidth)||0);let r=0,o=0;const n=e.boxShadow;if(n&&n!=="none"){const u=n.replace(/rgba?\([^)]*\)/g,h=>h.replace(/,/g,"\0")).split(/,\s*/);let l=1/0,c=1/0;for(const h of u){const f=h.match(/-?\d+(?:\.\d+)?px/g);if(!f||f.length<4)continue;const d=parseFloat(f[3]);d>0&&(/\binset\b/.test(h)?d<l&&(l=d):d<c&&(c=d))}Number.isFinite(l)&&(r=l),Number.isFinite(c)&&(o=c)}const i=Math.max(a,o);return{width:Math.max(a,r,o)||1,outerCssPx:i}}function qt(t){t.cornerRadius=de(t.el);const e=ue(t.el);t.hairlineWidth=e.width,t.hairlineOuterCssPx=e.outerCssPx}function rr(t){typeof ResizeObserver<"u"&&(t.resizeObserver=new ResizeObserver(()=>qt(t)),t.resizeObserver.observe(t.el)),typeof MutationObserver<"u"&&(t.mutationObserver=new MutationObserver(()=>qt(t)),t.mutationObserver.observe(t.el,{attributes:!0,attributeFilter:["style","class"]}))}function or(t){var e,a;(e=t.resizeObserver)==null||e.disconnect(),t.resizeObserver=null,(a=t.mutationObserver)==null||a.disconnect(),t.mutationObserver=null}const tt=new Set;function nr(t,e,a){if(typeof document>"u"||Va.has(t.tagName))return null;for(const g of tt)if(g.el===t)return g;const r=document.createElement("div");r.setAttribute("data-metal-fx-reflection",""),r.setAttribute("aria-hidden","true");const o=document.createElement("canvas");o.className="metal-fx-reflection-canvas";const n=o.getContext("2d",{alpha:!0});if(!n)return null;const i=document.createElement("canvas");i.className="metal-fx-reflection-stroke-canvas";const u=i.getContext("2d",{alpha:!0});if(!u)return null;r.appendChild(o),r.appendChild(i);const l=getComputedStyle(t);let c=!1;l.position==="static"&&(t.style.position="relative",c=!0);let h=!1;l.isolation!=="isolate"&&(t.style.isolation="isolate",h=!0),t.setAttribute("data-metal-fx-reflect-host",""),t.insertBefore(r,t.firstChild);const f=ue(t),d={el:t,anchor:e,anchorEl:a,wrap:r,canvas:o,ctx:n,strokeCanvas:i,strokeCtx:u,cornerRadius:de(t),hairlineWidth:f.width,hairlineOuterCssPx:f.outerCssPx,appliedPositionRelative:c,appliedIsolation:h,resizeObserver:null,mutationObserver:null};return rr(d),tt.add(d),d}function ir(t){for(const e of tt)if(e.el===t){or(e),e.canvas.width=0,e.canvas.height=0,e.strokeCanvas.width=0,e.strokeCanvas.height=0,e.wrap.parentNode===e.el&&e.el.removeChild(e.wrap),e.el.removeAttribute("data-metal-fx-reflect-host"),e.appliedPositionRelative&&(e.el.style.position=""),e.appliedIsolation&&(e.el.style.isolation=""),tt.delete(e);return}}function sr(){if(tt.size===0)return;const t=typeof window<"u"&&window.devicePixelRatio||1,e=new Map;for(const a of tt){const r=a.el.getBoundingClientRect();let o=e.get(a.anchorEl);if(o||(o=a.anchorEl.getBoundingClientRect(),e.set(a.anchorEl,o)),r.width<1||r.height<1||o.width<1||o.height<1)continue;if(!Ya(o,r,Gt,Ht)&&!Za(o,r,Gt,Ht)){a.canvas.width!==1&&(a.canvas.width=1,a.canvas.height=1),a.strokeCanvas.width!==1&&(a.strokeCanvas.width=1,a.strokeCanvas.height=1);continue}const n=a.anchor.canvas,i=n.width|0,u=n.height|0;if(i<4||u<4)continue;const l=(o.left+o.right)*.5,c=(o.top+o.bottom)*.5,h=(r.left+r.right)*.5,f=(r.top+r.bottom)*.5,d=l-h,g=c-f,x=Math.max(o.left-r.right,r.left-o.right,0),m=Math.max(o.top-r.bottom,r.top-o.bottom,0),F=x>=m,b=Xa(o,r);let P=1-Math.min(1,b/yt);P=P*P*(3-2*P);const j=Dt+(Aa-Dt)*P,L=Math.min(Ut,j*Na*Wa),C=a.anchor.scale??1,E=Math.max(Ba*C,a.hairlineWidth),z=Math.max(1,Math.round(E*t)),X=Math.max(1,Math.round(Math.max(Ha*C,a.hairlineWidth)*t)),N=a.hairlineOuterCssPx;a.wrap.style.inset=`${-N}px`,a.wrap.style.borderRadius=`${Math.max(0,a.cornerRadius)}px`;const $=Math.max(1,Math.round((r.width+N*2)*t)),k=Math.max(1,Math.round((r.height+N*2)*t));a.canvas.width!==$&&(a.canvas.width=$),a.canvas.height!==k&&(a.canvas.height=k),a.strokeCanvas.width!==$&&(a.strokeCanvas.width=$),a.strokeCanvas.height!==k&&(a.strokeCanvas.height=k);const I=a.ctx;I.setTransform(1,0,0,1,0,0),I.clearRect(0,0,$,k);const W=a.strokeCtx;W.setTransform(1,0,0,1,0,0),W.clearRect(0,0,$,k);const B=Math.min(yt*t,Math.max($,k));let H,y,w,v;F?(H=d>0?$:0,w=d>0?$-B:B,y=k*.5,v=k*.5):(y=g>0?k:0,v=g>0?k-B:B,H=$*.5,w=$*.5);const M=I.createLinearGradient(H,y,w,v);M.addColorStop(0,`rgba(0,0,0,${ja})`),M.addColorStop(.5,`rgba(0,0,0,${Ea})`),M.addColorStop(1,`rgba(0,0,0,${La})`);const S=i/t,O=Math.max(1,Math.round(Da*Math.max(.1,S/140)*t));let D,U,T,A,Q=!1,Ct=!1;if(F){const at=Math.max(o.top,r.top),ht=Math.min(o.bottom,r.bottom);Q=!0,D=d>0?$-O:0,U=Math.round((at-r.top+N)*t),T=O,A=Math.max(1,Math.round((ht-at)*t))}else{const at=Math.max(o.left,r.left),ht=Math.min(o.right,r.right);Ct=!0,D=Math.round((at-r.left+N)*t),U=g>0?k-O:0,T=Math.max(1,Math.round((ht-at)*t)),A=O}const St={x:D,y:U,w:T,h:A,flipX:Q,flipY:Ct},ut={x:0,y:0,w:$,h:k,r:Math.max(0,a.cornerRadius*t)},me=Math.min(Ut,L*Ua*qa*Qa);tr(I,n,i,u,$,k,me,M,St,ut,t),er(W,n,i,u,$,k,ut,L,z,M,za,St),ar(W,ut,X,H,y,w,v,Math.min(.85,Ga*L)),I.globalCompositeOperation="source-over",W.globalCompositeOperation="source-over"}}let gt=!1,Qt=0;function lr(){gt||(gt=!0,!(typeof requestAnimationFrame>"u")&&requestAnimationFrame(t=>{gt=!1,!(t-Qt<Oe)&&(Qt=t,sr())}))}const Vt="metal-fx-styles",cr=`
.metal-fx-root {
position: relative;
display: inline-flex;
align-items: center;
justify-content: center;
isolation: isolate;
overflow: visible;
background: #272727;
color: #f8f8f8;
}
.metal-fx-root[data-theme='light'] {
background: #ffffff;
color: #1d1d1d;
}
.metal-fx-root::before {
content: '';
position: absolute;
inset: 0;
border-radius: inherit;
pointer-events: none;
z-index: 2;
box-shadow: inset 0 0 50px 0 rgba(255, 255, 255, 0.02);
}
.metal-fx-root[data-theme='light']::before {
box-shadow: inset 0 0 50px 0 rgba(0, 0, 0, 0.02);
}
.metal-fx-root::after {
content: '';
position: absolute;
inset: 0;
border-radius: inherit;
pointer-events: none;
z-index: 4;
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}
.metal-fx-root[data-theme='light']::after {
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}
/* Circle variant gets a thicker outer rim than the button variant. */
.metal-fx-root[data-variant='circle']::after {
box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.1);
}
.metal-fx-root[data-theme='light'][data-variant='circle']::after {
box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.06);
}
.metal-fx-canvas {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
display: block;
z-index: 0;
pointer-events: none;
border-radius: inherit;
}
/* The inner spacer — defines the inset geometry where the metal ring meets
the interior (3 px for Button, 1-2 px for Circle) and carries the Circle dark
hairline ('box-shadow: inset' rules below). Intentionally transparent so
the wrapper's background propagates through to the punched shader centre,
giving consumers a single surface tone to override. See "Single-surface
background" in the file header for the rationale. */
.metal-fx-inner {
position: absolute;
inset: 3px;
border-radius: inherit;
z-index: 1;
pointer-events: none;
}
.metal-fx-root[data-variant='button'][data-shape='pill'] .metal-fx-inner {
border-radius: calc(var(--mfx-radius, 20px) - 3px);
}
.metal-fx-root[data-variant='button'][data-shape='circle'] .metal-fx-inner {
border-radius: calc(var(--mfx-radius, 16px) - 3px);
}
.metal-fx-root[data-variant='circle'][data-shape='pill'] .metal-fx-inner {
inset: 0;
border-radius: var(--mfx-radius, 20px);
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45);
}
.metal-fx-root[data-variant='circle'][data-shape='circle'] .metal-fx-inner {
inset: 0;
border-radius: var(--mfx-radius, 16px);
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45);
}
/* Circle-variant hairline alpha — light mode.
Source-of-truth: index.html L2261-2267. The 0.45-alpha black inset that
reads as a single-pixel frame against the dark interior is too heavy
on a #ffffff inner: it ends up looking like a hard 2-px black ring
against the iridescent shader. Suppressed entirely (alpha 0) — the
shader's own iridescent rim already defines the silhouette in light
mode, so an extra dark hairline only competes with it. The rule is
kept (rather than deleted) as a tunable hook in case a future variant
wants to re-introduce a soft edge. NOTE: we keep the dark-mode inset
and border-radius values because — unlike index.html — our renderer
does NOT overscan the canvas in light mode, so there is no 1-px gap
between inner element and shader to compensate for. */
.metal-fx-root[data-theme='light'][data-variant='circle'][data-shape='pill'] .metal-fx-inner,
.metal-fx-root[data-theme='light'][data-variant='circle'][data-shape='circle'] .metal-fx-inner {
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0);
}
/* ─── Combined glow SVG (z=3) ──────────────────────────────────────────────
Single SVG per instance that holds BOTH the wide-halo group
(#mfx_haloTravel) and the catch-light group (#mfx_extraTravel), exactly
mirroring canonical's _buildGlowSvgInner (index.html L8078). One
mix-blend-mode: screen lifts the combined composite onto the shader
ring; per-frame opacity attributes on each inner group still drive the
independent fade-in / fade-out cycles for the halo and the catch-light.
Why a single SVG: the circle variant anchors halo + catch-light at the same
perimeter point, so they overlap in the bright zone. Two separately-
screened SVGs would double-screen the overlap (A + B + C - AB - AC -
BC + ABC instead of A + B + C - AB - AC once both groups composite
in source-over inside one SVG and then screen against the host once).
That overlap looked muted versus canonical specifically on the circle
variant where both layers travel together.
Source-of-truth opacity: #btnGlowSvg drops to 0.7 in dark and 0.2746 in
light (index.html L632/L643). */
.metal-fx-glow-svg {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
overflow: visible;
z-index: 3;
pointer-events: none;
opacity: 0.7;
}
.metal-fx-root[data-theme='light'] .metal-fx-glow-svg {
/* Light-mode 1-px overscan mirrors .btn-glow-svg in metal.html so the
halo stays glued to the visible silhouette (the shader ring there sits
1 px outside the host's padding box). */
inset: -1px;
width: calc(100% + 2px);
height: calc(100% + 2px);
mix-blend-mode: multiply;
/* Source-of-truth: html[data-theme="light"] #btnGlowSvg { opacity: 0.2746 }
→ −35 % from 0.4225 from the original 0.7 dark-mode opacity. */
opacity: 0.2746;
filter: saturate(5.355) brightness(0.78);
}
/* Circle light-mode small variants (e.g. 36×36 send button): the geometrically
shrunk halo loses density when multiplied against #ffffff. Mirror the
canonical override at index.html L2316 — bump saturation + drop brightness
so the small glow holds together visually. */
.metal-fx-root[data-variant='circle'][data-shape='circle'][data-theme='light'] .metal-fx-glow-svg {
filter: saturate(7.5) brightness(0.6);
}
/* The wrapped child — hoisted into z=5 so it sits above every overlay, with
normalized chrome so consumer button styles don't fight the metal frame. */
.metal-fx-content {
position: relative;
z-index: 5;
display: inline-flex;
align-items: center;
justify-content: center;
width: 100%;
pointer-events: none;
}
.metal-fx-content > * {
pointer-events: auto;
}
.metal-fx-root[data-normalize='true'] .metal-fx-content > * {
background: transparent !important;
border: 0 !important;
outline: 0 !important;
box-shadow: none !important;
/* Sizing: we deliberately DO NOT force \`width: 100%; height: 100%\` on the
child here. That used to be the contract ("the wrapper is the visible
button surface; the child stretches to fill it"), but it created a cyclic
percentage dependency: the wrapper is \`inline-flex\` with no intrinsic
size, .metal-fx-content is \`width/height: 100%\` of the wrapper, and the
child was \`100%\` of .metal-fx-content. With nothing breaking the cycle,
icon-only / class-sized children collapsed.
The new contract: the child sizes itself (intrinsic content, CSS class,
or inline style — all work), and the wrapper's \`inline-flex\` wraps it
tightly. Consumers who want a metal frame BIGGER than the child (e.g.
padding around an icon) size <MetalFx style={{ width, height }}> AND
explicitly set width/height on the child to fill (or accept that the
child renders at its intrinsic size, centered).
Typography is intentionally NOT touched. We used to apply
\`color: inherit; font: inherit;\` here to "match" the wrapper, but
\`font: inherit\` is a shorthand that overrides font-family, font-size,
font-weight, AND line-height on the child — which (a) shrank the
button height (line-height changes propagate through the flex
content box) and (b) scaled em-based icons / font-icons inside the
child to whatever the wrapper inherited. The wrapper now stays out
of the child's typography entirely; consumers who want typographic
normalization can apply it themselves on the child element. */
}
[data-metal-fx-reflection] {
position: absolute;
inset: 0;
pointer-events: none;
border-radius: inherit;
overflow: hidden;
z-index: 0;
isolation: isolate;
}
.metal-fx-reflection-canvas {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
display: block;
filter: blur(4px) saturate(1.2) brightness(1.58);
}
.metal-fx-reflection-stroke-canvas {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
display: block;
filter: saturate(1.35) brightness(1.75);
}
/* Hosts that participate as reflection targets need positioning + isolation
so the wrap composites only against the host (not the parent stack). The
wrap injects these inline as well, but stating them here keeps reflections
working on hosts that already have other inline styles applied. */
[data-metal-fx-reflect-host] {
isolation: isolate;
}
`;let vt=!1;function dr(){if(vt||typeof document>"u")return;if(document.getElementById(Vt)){vt=!0;return}const t=document.createElement("style");t.id=Vt,t.textContent=cr,document.head.appendChild(t),vt=!0}dr();const ur={position:"absolute",inset:0,width:"100%",height:"100%"},hr={position:"absolute",inset:3},fr={position:"absolute",inset:0,pointerEvents:"none",zIndex:3,borderRadius:"inherit"},ct=new Map;aa((t,e)=>{const a=ct.get(t);a&&Pa(a.handles,t,e,t.opacityMul,a.themeRef.current)});function pr(t){const[e,a]=_.useState(()=>t!=="auto"?t:typeof window>"u"||!window.matchMedia||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");return _.useEffect(()=>{if(t!=="auto"){a(t);return}if(typeof window>"u"||!window.matchMedia)return;const r=window.matchMedia("(prefers-color-scheme: dark)"),o=()=>a(r.matches?"dark":"light");return o(),r.addEventListener("change",o),()=>r.removeEventListener("change",o)},[t]),e}const he=_.forwardRef(function({children:t,variant:e="button",preset:a="chromatic",theme:r="auto",strength:o=1,paused:n=!1,borderRadius:i,normalizeHostStyles:u=!0,reflectionTargets:l,disableGlow:c=!1,shaderScale:h,ringCssPx:f,scale:d=1,className:g,style:x,...m},F){const b=_.useRef(null),P=_.useRef(null),j=_.useRef(null),L=_.useRef(null),C=_.useRef(null),E=_.useRef(null),z=_.useRef("dark"),X=_.useRef(0),[N,$]=_.useState(!1),k=pr(r);z.current=k;const I=e==="circle"?"circle":"pill",W=!c;_.useImperativeHandle(F,()=>b.current,[]);const B=(y,w)=>{if(I==="circle")return Math.min(y,w)/2;const v=typeof i=="number"?i:(()=>{var M;const S=(M=L.current)==null?void 0:M.firstElementChild;if(S){const O=parseFloat(getComputedStyle(S).borderTopLeftRadius);if(Number.isFinite(O)&&O>0)return O}return X.current})();return Math.min(v,Math.min(y,w)/2)};_.useEffect(()=>{ea(a,k)},[a,k]),_.useEffect(()=>{const y=C.current;y&&rt(y,{paused:n})},[n]),_.useEffect(()=>{const y=C.current;if(!y)return;const w={};h!==void 0&&(w.shaderScale=h),f!==void 0&&(w.ringCssPx=f),d!==void 0&&(w.scale=d),Object.keys(w).length>0&&rt(y,w)},[h,f,d]),_.useLayoutEffect(()=>{const y=P.current,w=b.current,v=j.current;if(!y||!w)return;{const T=getComputedStyle(w),A=parseFloat(T.borderTopLeftRadius);X.current=Number.isFinite(A)?A:0}const M=()=>{const T=w.getBoundingClientRect(),A=Math.max(1,Math.round(T.width)),Q=Math.max(1,Math.round(T.height));return{cssWidth:A,cssHeight:Q,cornerRadius:B(A,Q)}},S=M();C.current=Ye({hostCanvas:y,cssWidth:S.cssWidth,cssHeight:S.cssHeight,cornerRadius:S.cornerRadius,kind:I,paused:n,shaderScale:h,ringCssPx:f,scale:d,onFirstCopy:()=>$(!0)}),w.style.setProperty("--mfx-radius",`${S.cornerRadius}px`),w.style.borderRadius=`${S.cornerRadius}px`,v&&(E.current=zt(v,{width:S.cssWidth,height:S.cssHeight,cornerRadius:S.cornerRadius,kind:I,scale:d}));let O=0;const D=new ResizeObserver(()=>{O===0&&(O=requestAnimationFrame(()=>{O=0;const T=M(),A=C.current;A&&(rt(A,{cssWidth:T.cssWidth,cssHeight:T.cssHeight,cornerRadius:T.cornerRadius}),w.style.setProperty("--mfx-radius",`${T.cornerRadius}px`),w.style.borderRadius=`${T.cornerRadius}px`,v&&(v.innerHTML="",E.current=zt(v,{width:T.cssWidth,height:T.cssHeight,cornerRadius:T.cornerRadius,kind:I,scale:d}),A&&E.current&&ct.set(A,{handles:E.current,themeRef:z})))}))});D.observe(w);let U=null;return typeof IntersectionObserver<"u"&&(U=new IntersectionObserver(T=>{const A=C.current;if(A)for(const Q of T)ta(A,Q.isIntersecting)},{rootMargin:"64px"}),U.observe(w)),C.current&&E.current&&(ct.set(C.current,{handles:E.current,themeRef:z}),Ke(C.current)),()=>{D.disconnect(),U?.disconnect(),O!==0&&cancelAnimationFrame(O);const T=C.current;T&&(ct.delete(T),Je(T),Ze(T)),C.current=null,E.current=null,v&&(v.innerHTML="")}},[I]),_.useEffect(()=>{const y=C.current;y&&rt(y,{opacityMul:Math.max(0,Math.min(1,o))})},[o,e]),_.useEffect(()=>{const y=C.current,w=b.current;if(!y||!w||!l||k!=="dark")return;y.onAfterFrame=lr;const v=l.flatMap(M=>M.current?[M.current]:[]);for(const M of v)nr(M,y,w);return()=>{y.onAfterFrame=void 0;for(const M of v)ir(M)}},[l,k]),_.useEffect(()=>{const y=b.current,w=C.current;if(!y||!w)return;const v=B(w.cssWidth,w.cssHeight);rt(w,{cornerRadius:v}),y.style.setProperty("--mfx-radius",`${v}px`),y.style.borderRadius=`${v}px`},[i,k,e,I]);const H=_.useMemo(()=>({...x,"--mfx-strength":String(Math.min(1,Math.max(0,o))),opacity:N?1:0,visibility:N?"visible":"hidden",transition:N?"opacity 0.15s ease-out":"none"}),[x,o,N]);return p.jsxs("div",{...m,ref:b,className:g?`metal-fx-root ${g}`:"metal-fx-root","data-variant":e,"data-shape":I,"data-theme":k,"data-paused":n?"true":void 0,"data-normalize":u?"true":"false",style:H,children:[p.jsx("canvas",{ref:P,className:"metal-fx-canvas",style:ur}),p.jsx("div",{className:"metal-fx-inner","aria-hidden":"true",style:hr}),p.jsx("div",{ref:j,"aria-hidden":"true",style:{...fr,display:W?void 0:"none"}}),p.jsx("div",{ref:L,className:"metal-fx-content",children:t})]})});he.displayName="MetalFx";const et=18;function fe(){return p.jsxs("svg",{"aria-hidden":!0,width:et,height:et,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[p.jsx("circle",{cx:"12",cy:"12",r:"4"}),p.jsx("path",{d:"M12 2v2"}),p.jsx("path",{d:"M12 20v2"}),p.jsx("path",{d:"m4.93 4.93 1.41 1.41"}),p.jsx("path",{d:"m17.66 17.66 1.41 1.41"}),p.jsx("path",{d:"M2 12h2"}),p.jsx("path",{d:"M20 12h2"}),p.jsx("path",{d:"m6.34 17.66-1.41 1.41"}),p.jsx("path",{d:"m19.07 4.93-1.41 1.41"})]})}function pe(){return p.jsx("svg",{"aria-hidden":!0,width:et,height:et,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:p.jsx("path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"})})}function mr(){return p.jsxs("svg",{"aria-hidden":!0,width:et,height:et,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[p.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),p.jsx("path",{d:"M8 21h8"}),p.jsx("path",{d:"M12 17v4"})]})}const xr=[{value:"light",label:"Light",Icon:fe},{value:"dark",label:"Dark",Icon:pe},{value:"system",label:"System",Icon:mr}];function gr(t){return t==="dark"?pe:fe}function vr({theme:t,resolvedTheme:e,onSetTheme:a,className:r="",direction:o="down",align:n="right"}){const[i,u]=_.useState(!1),l=_.useRef(null),c=_.useCallback(()=>u(!1),[]);_.useEffect(()=>{if(!i)return;const f=d=>{l.current&&!l.current.contains(d.target)&&c()};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[i,c]),_.useEffect(()=>{if(!i)return;const f=d=>{d.key==="Escape"&&c()};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[i,c]);const h=gr(e);return p.jsxs("div",{ref:l,className:`relative ${r}`,children:[p.jsx("button",{type:"button","aria-label":"Theme","aria-expanded":i,onClick:()=>u(f=>!f),className:"flex items-center justify-center w-9 h-9 rounded-lg text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white transition-colors",children:p.jsx(h,{})}),i&&p.jsx("div",{className:`absolute z-50 min-w-[140px] py-1 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 shadow-lg ${o==="up"?"bottom-full mb-1":"top-full mt-1"} ${n==="left"?"left-0":"right-0"}`,children:xr.map(({value:f,label:d,Icon:g})=>{const x=t===f;return p.jsxs("button",{type:"button",onClick:()=>{a(f),c()},className:`flex w-full items-center gap-2.5 px-3 py-2 text-sm transition-colors ${x?"text-oai-black dark:text-white bg-oai-gray-100 dark:bg-oai-gray-800":"text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/60 hover:text-oai-black dark:hover:text-white"}`,children:[p.jsx(g,{}),p.jsx("span",{children:d})]},f)})})]})}const br="https://github.com/mm7894215/TokenTracker/releases/latest";function Ur({auth:t,signedIn:e,sessionSoftExpired:a,userId:r}){const{currency:o,rate:n}=ke(),{theme:i,resolvedTheme:u,setTheme:l}=xe(),{openLoginModal:c}=ge(),{signedIn:h,loading:f}=ve(),d=!be(),g=e&&!a,x=_.useMemo(()=>g&&(typeof t=="function"||typeof t=="string"||t&&typeof t=="object")?t:null,[t,g]),m=_e({userId:r,period:"total",accessToken:x});return p.jsxs("div",{className:"flex flex-col min-h-screen bg-oai-gray-50 dark:bg-oai-gray-950 text-oai-black dark:text-oai-white font-oai antialiased transition-colors duration-200",children:[p.jsx("header",{className:"sticky top-0 z-50 w-full px-4 pt-4 pb-2 transition-all duration-300 pointer-events-none",children:p.jsxs("div",{className:"mx-auto max-w-3xl rounded-2xl border border-oai-gray-200/50 dark:border-white/10 bg-white/75 dark:bg-oai-gray-950/60 backdrop-blur-xl shadow-[0_8px_30px_rgb(0,0,0,0.04)] dark:shadow-[0_8px_30px_rgb(0,0,0,0.3)] flex h-14 items-center justify-between px-3 sm:px-4 pointer-events-auto transition-all duration-300",children:[p.jsxs("div",{className:"flex items-center gap-4",children:[p.jsxs(Tt,{to:"/",className:"flex items-center gap-3 no-underline outline-none rounded-md focus-visible:ring-2 focus-visible:ring-indigo-500 transition-opacity hover:opacity-80 active:scale-95",children:[p.jsx("img",{src:"/app-icon.png",alt:"",width:24,height:24,className:"rounded-md"}),p.jsx("span",{className:"text-sm font-semibold tracking-wide text-oai-black dark:text-white uppercase",children:"Token Tracker"})]}),p.jsx("div",{className:"hidden sm:block scale-90 origin-left opacity-90 hover:opacity-100 transition-opacity",children:p.jsx(Me,{})})]}),p.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2",children:[p.jsxs(Tt,{to:"/leaderboard",className:"group no-underline inline-flex items-center gap-1.5 h-8 px-3 text-xs font-bold rounded-full border border-oai-gray-200 dark:border-white/10 bg-transparent text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-white/5 hover:text-oai-black dark:hover:text-white transition-all duration-200 active:scale-95 shadow-sm",children:[p.jsx(we,{size:13,strokeWidth:2.5,"aria-hidden":!0,className:"transition-transform duration-150 ease-out group-hover:scale-110 group-hover:rotate-6"}),p.jsx("span",{children:Y("leaderboard.profile.nav.back")})]}),d&&p.jsx(he,{variant:"button",preset:"chromatic",theme:"dark",borderRadius:9999,disableGlow:!0,className:"!bg-black",children:p.jsxs("a",{href:br,target:"_blank",rel:"noopener noreferrer",className:"group no-underline inline-flex h-8 items-center gap-1.5 px-3 text-xs font-bold rounded-full bg-black text-white transition-transform duration-200 active:scale-[0.98]",children:[p.jsx(Te,{size:13,strokeWidth:2.5,"aria-hidden":!0,className:"transition-transform duration-150 ease-out group-hover:translate-y-0.5"}),p.jsx("span",{className:"hidden sm:inline",children:Y("leaderboard.profile.nav.download")})]})}),f?p.jsx("div",{className:"h-8 w-16 animate-pulse rounded-full bg-oai-gray-200 dark:bg-white/10","aria-hidden":!0}):h?p.jsx(ye,{}):p.jsx("button",{type:"button",onClick:c,className:"inline-flex h-8 min-w-[76px] items-center justify-center px-3 text-xs font-bold rounded-full border border-oai-gray-200 dark:border-white/10 bg-transparent text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-white/5 hover:text-oai-black dark:hover:text-white transition-all duration-200 active:scale-95 shadow-sm select-none",children:Y("header.auth.sign_in_aria")})]})]})}),p.jsx("main",{className:"flex-1 px-4 pt-4 pb-10 sm:pt-6 sm:pb-16",children:p.jsx("div",{className:"mx-auto max-w-3xl",children:p.jsxs("div",{className:"rounded-2xl bg-white dark:bg-oai-gray-950 ring-1 ring-oai-gray-200 dark:ring-oai-gray-800 overflow-hidden shadow-sm dark:shadow-none",children:[m.loading&&p.jsx(Ce,{variant:"page"}),!m.loading&&m.error&&p.jsx("div",{className:"px-6 py-16 text-center",children:p.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:Y("leaderboard.profile_modal.error")})}),!m.loading&&!m.error&&!m.data&&p.jsx("div",{className:"px-6 py-16 text-center",children:p.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:Y("leaderboard.profile_modal.empty")})}),!m.loading&&!m.error&&m.data&&p.jsx(Se,{data:m.data,currency:o,rate:n,variant:"page"})]})})}),p.jsx("footer",{className:"border-t border-oai-gray-200 dark:border-oai-gray-900 py-8 px-4 transition-colors duration-200",children:p.jsxs("div",{className:"mx-auto flex max-w-3xl items-center justify-between text-sm text-oai-gray-400 dark:text-oai-gray-500",children:[p.jsx("p",{children:Y("landing.v2.footer.line")}),p.jsx(vr,{theme:i,resolvedTheme:u,onSetTheme:l,direction:"up",align:"right"})]})})]})}export{Ur as LeaderboardProfilePage};
import{c as r}from"./__vite-browser-external-CuMc3dqk.js";const t=["claude","codex","cursor","gemini","kimi","kiro","grok","copilot","antigravity","zcode","opencodeGo"],e={claude:"CLAUDE",codex:"CODEX",cursor:"CURSOR",gemini:"GEMINI",kimi:"KIMI",kiro:"KIRO",grok:"GROK",copilot:"COPILOT",antigravity:"ANTIGRAVITY",zcode:"ZCODE",opencodeGo:"OPENCODE"};function c(i){return e[i]||null}function n(i){switch(i){case"claude":return r("limits.provider.claude");case"codex":return r("limits.provider.codex");case"cursor":return r("limits.provider.cursor");case"gemini":return r("limits.provider.gemini");case"kimi":return r("limits.provider.kimi");case"kiro":return r("limits.provider.kiro");case"grok":return r("limits.provider.grok");case"copilot":return r("limits.provider.copilot");case"antigravity":return r("limits.provider.antigravity");case"zcode":return r("limits.provider.zcode");case"opencodeGo":return r("limits.provider.opencode_go");default:return String(i||"")}}export{t as L,c as a,n as l};
import{l as G,j as t,d as H,c as r,i as $,r as b,ac as ee,R as te,J as ae,L as ie,ad as re,p as ne,ae as oe}from"./__vite-browser-external-CuMc3dqk.js";import{m as T}from"./react-B80AX8fE.js";import{P as B,c as se,r as j,a as le,u as de,b as ce,s as ue}from"./use-usage-limits-BYdWzSUW.js";import{L as m,u as me}from"./use-limits-display-prefs-DEZXM-yU.js";import{C as W}from"./Card-C3Fxl-vL.js";import{F as xe}from"./FadeIn-COsoZJXe.js";import{L as pe,l as _,a as ge}from"./limits-providers-CMQJD3FZ.js";import{P as fe}from"./ProviderIcon-B6sgfDtI.js";import{H as he}from"./HoverTooltip-jQvD29cq.js";import{L as be}from"./LocalOnlyNotice-D8FJuEXT.js";import{u as ye}from"./use-reduced-motion-BEAopWkx.js";import"./arrow-up-right-D2tCxxHL.js";import"./download-zNMgxXgK.js";const ve=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]],ke=G("bell-off",ve);const je=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],Ne=G("bell",je),_e=[3,2,3,3,2,2,3];function g({className:e}){return t.jsx("div",{className:H("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",e)})}function we(){return t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(g,{className:"h-3 w-12 shrink-0"}),t.jsx(g,{className:"flex-1 h-1.5 rounded-full min-w-0"}),t.jsx(g,{className:"h-3 w-[30px] shrink-0"}),t.jsx(g,{className:"h-3 w-6 shrink-0"})]})}function Me({bars:e,index:a}){const i=a%3===0?"w-24":a%3===1?"w-20":"w-[4.5rem]";return t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(g,{className:"h-[14px] w-[14px] rounded shrink-0"}),t.jsx(g,{className:H("h-4",i)})]}),Array.from({length:e},(o,n)=>t.jsx(we,{},n))]})}function Ee(){return t.jsx(W,{children:t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsx(g,{className:"h-3.5 w-28"}),_e.map((e,a)=>t.jsx(Me,{bars:e,index:a},a))]})})}const L=100;function A(e){const a=Date.parse(e);return Number.isFinite(a)?a:null}function Ie(e){return Math.max(0,Math.min(L,Math.round(e)))}function Le(e){return new Intl.DateTimeFormat($(),{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(new Date(e))}function Pe(e,a,i){if(e==null||e>=a)return L;const o=a-e,n=a-i;return Ie(n/o*L)}function Oe(e){const a=e.available_count;return a===null?null:Number.isInteger(a)&&a>=0?a:void 0}function Se(e,{now:a}={}){if(!e||typeof e!="object")return null;const i=Oe(e);if(i===void 0)return null;const o=Array.isArray(e.credits)?e.credits:[],n=a instanceof Date?a.getTime():Number(a??Date.now()),s=[];for(const c of o){const d=A(c?.expires_at);if(d==null)continue;const l=s.length+1;s.push({key:`reset-${l}`,label:r("limits.codex_reset_bank.row_label",{index:l}),expiresAt:Le(d),expiresMs:d,percent:Pe(A(c?.granted_at),d,n)})}return i===0?null:s.length>0?{kind:"rows",availableCount:i??s.length,rows:s}:i>0?{kind:"count_only",availableCount:i,rows:[]}:null}const Ce="shrink-0 text-oai-black dark:text-oai-white";function Re(e){const a=j(e);if(!Number.isFinite(a))return null;const i=a-Date.now();if(i<=0)return r("shared.time.now");const o=Math.floor(i/6e4);if(o<60)return`${o}m`;const n=Math.floor(o/60);return n<24?`${n}h`:`${Math.floor(n/24)}d`}function Te(e,a){const i=a===m.REMAINING?100-e:e;return i>=90?"bg-red-500":i>=70?"bg-amber-500":"bg-emerald-500"}function k(e,a="used_percent"){return e?a==="utilization"?e.utilization:e.used_percent:null}function N(e,a="reset_at"){return e?a==="resets_at"?e.resets_at:e.reset_at:null}function w(e){const a=Math.max(0,Math.min(100,Number(e)||0)),i=Math.round(a);return a>0&&i===0?r("limits.bar.sub_one_percent"):String(i)}function M(e){const a=Number(e);return Number.isFinite(a)?new Intl.NumberFormat(void 0,{minimumFractionDigits:0,maximumFractionDigits:a>=100?0:2}).format(a):null}function Ae(e){if(!e||typeof e!="object")return null;const a=M(e.used_credits),i=M(e.limit_credits),o=M(e.remaining_credits);return!a||!i||!o?null:r("limits.codex_credits.detail",{used:a,limit:i,remaining:o})}function De(e,a){return se({usedPercent:k(e.window,e.pctField),windowSeconds:le(e,e.window),resetMs:j(N(e.window,e.resetField)),mode:a})}function U(e){return Number.isFinite(e)?new Intl.DateTimeFormat($(),{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(new Date(e)):null}function Fe(e,a,i){const o=[K(e,a,i)],n=j(N(e.window,e.resetField)),s=U(n);if(s&&o.push(r("limits.hover.resets_at",{time:s})),e.key==="credits"){const c=Ae(e.window);c&&o.push(c)}return o.join(`
`)}const z=he;function Ge({label:e,pct:a,reset:i,mode:o=m.USED,pacePercent:n=null,paceOver:s=!1,title:c=null}){const d=Math.max(0,Math.min(100,Number(a)||0)),l=o===m.REMAINING?100-d:d,u=Math.round(l),x=l>0&&u===0?Math.max(l,.35):l;let f=String(u);l>0&&u===0&&(f=r("limits.bar.sub_one_percent"));const h=n==null?null:Math.max(0,Math.min(100,n));return t.jsxs("div",{className:"group relative flex items-center gap-2",children:[t.jsx(z,{text:c}),t.jsx("span",{"data-limit-label":"",className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400 shrink-0 whitespace-nowrap",style:{width:"var(--tt-limits-label-w)"},children:e}),t.jsxs("div",{className:"relative flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:[t.jsx("div",{className:`${Te(l,o)} rounded-full h-full transition-[width] duration-500 ease-out`,style:{width:`${x}%`,minWidth:l>0?"3px":0}}),h!=null&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"absolute top-0 h-full bg-oai-gray-100 dark:bg-oai-gray-700/50",style:{left:`calc(${h}% - 3px)`,width:"6px"}}),t.jsx("div",{className:`absolute top-0 h-full ${s?"bg-red-500":"bg-emerald-500"}`,style:{left:`calc(${h}% - 1px)`,width:"2px"}})]})]}),t.jsxs("span",{className:"text-[11px] tabular-nums text-oai-gray-500 dark:text-oai-gray-400 w-9 text-right shrink-0 whitespace-nowrap",children:[f,"%"]}),i&&t.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500 w-6 text-right shrink-0",children:i})]})}function K(e,a,i){const o=e.label??r(e.labelKey),n=i===m.REMAINING,s=l=>n?100-l:l;if(a.expectedPercent==null){const l=Math.max(0,Math.min(100,Number(k(e.window,e.pctField))||0)),u=w(s(l));return n?r("limits.explain.remaining",{label:o,used:u}):r("limits.explain.used",{label:o,used:u})}if(a.paceOver){if(a.runsOutEta)return r("limits.explain.ahead_eta",{label:o,eta:a.runsOutEta});const l=w(s(a.projectedEnd??100));return r(n?"limits.explain.ahead_pct_remaining":"limits.explain.ahead_pct",{label:o,pct:l})}const c=Math.max(0,Math.min(100,Number(k(e.window,e.pctField))||0)),d=w(s(a.projectedEnd??c));return r(n?"limits.explain.on_track_remaining":"limits.explain.on_track",{label:o,pct:d})}function He({rows:e,mode:a}){if(e.length===0)return null;const i=a===m.REMAINING;return t.jsxs("div",{className:"mt-1 flex flex-col gap-1",children:[e.map(({spec:o,pace:n})=>{const s=U(j(N(o.window,o.resetField)));return t.jsxs("div",{className:"text-[11px] leading-snug text-oai-gray-600 dark:text-oai-gray-300",children:[K(o,n,a),s?t.jsxs("span",{className:"text-oai-gray-400 dark:text-oai-gray-500",children:[" · ",r("limits.hover.resets_at",{time:s})]}):null]},o.key)}),t.jsx("div",{className:"mt-1 pt-1.5 border-t border-oai-gray-200/70 dark:border-oai-gray-700/50 text-[10.5px] leading-snug text-oai-gray-400 dark:text-oai-gray-500",children:r(i?"limits.explain.body_remaining":"limits.explain.body")})]})}function E(e){if(!e)return null;const a=Date.now()-new Date(e).getTime();if(a<0)return null;const i=Math.floor(a/6e4);if(i<1)return r("shared.time.now");if(i<60)return r("shared.time.m_ago",{n:i});const o=Math.floor(i/60);if(o<24)return r("shared.time.h_ago",{n:o});const n=Math.floor(o/24);return r("shared.time.d_ago",{n})}const D={live:{surface:"bg-oai-gray-50 dark:bg-oai-gray-800 border-oai-gray-200/60 dark:border-oai-gray-700/60 text-oai-gray-500 dark:text-oai-gray-400",dot:"bg-emerald-500",pulse:"bg-emerald-400"},stale:{surface:"bg-oai-gray-50 dark:bg-oai-gray-800 border-oai-gray-200/60 dark:border-oai-gray-700/60 text-oai-gray-500 dark:text-oai-gray-400",dot:"bg-amber-500",pulse:"bg-amber-400"},cached:{surface:"bg-oai-gray-50 dark:bg-oai-gray-800 border-oai-gray-200/60 dark:border-oai-gray-700/60 text-oai-gray-500 dark:text-oai-gray-400",dot:"bg-amber-500",pulse:"bg-amber-400"}},$e={claude:"claude",codex:"codex"};function v({label:e,age:a=null,tone:i="live",tooltip:o=null}){const n=D[i]||D.live,s=i==="live";return t.jsxs("div",{className:"relative inline-flex items-center group cursor-help ml-1",onClick:c=>c.stopPropagation(),children:[t.jsxs("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full text-[9px] font-semibold uppercase tracking-wider border leading-normal ${n.surface}`,children:[s?t.jsxs("span",{className:"relative flex h-1.5 w-1.5",children:[t.jsx("span",{className:`animate-ping absolute inline-flex h-full w-full rounded-full ${n.pulse} opacity-75`}),t.jsx("span",{className:`relative inline-flex rounded-full h-1.5 w-1.5 ${n.dot}`})]}):t.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${n.dot}`}),e,a?t.jsxs(t.Fragment,{children:[" · ",a]}):null]}),o?t.jsxs("span",{className:"pointer-events-none absolute left-1/2 bottom-full z-20 mb-2 -translate-x-1/2 w-48 rounded-md bg-oai-gray-900 dark:bg-oai-gray-800 px-2.5 py-1.5 text-[10px] font-normal text-white text-center opacity-0 scale-95 translate-y-1 group-hover:opacity-100 group-hover:scale-100 group-hover:translate-y-0 transition-all duration-200 cubic-bezier(0.16, 1, 0.3, 1) leading-normal shadow-lg origin-bottom border border-oai-gray-800 dark:border-oai-gray-700",children:[o,t.jsx("span",{className:"absolute left-1/2 top-full -translate-x-1/2 border-4 border-transparent border-t-oai-gray-900 dark:border-t-oai-gray-800"})]}):null]})}function P({name:e,providerId:a,children:i,expandable:o=!1,expanded:n=!1,onToggle:s,badge:c=null}){const d=ge(a),l=t.jsxs("div",{className:"flex items-center gap-1.5",children:[d?t.jsx(fe,{provider:d,size:14,className:Ce}):null,t.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-oai-white",children:e}),c]});return o?t.jsxs("div",{role:"button",tabIndex:0,"aria-expanded":n,onClick:s,onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),s?.())},className:"flex flex-col gap-1.5 -mx-1.5 px-1.5 py-1 rounded-lg cursor-pointer transition-colors hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/40 aria-expanded:bg-oai-gray-50 dark:aria-expanded:bg-oai-gray-800/40",children:[l,i]}):t.jsxs("div",{className:"flex flex-col gap-1.5",children:[l,i]})}const Be=pe;function y({children:e,tone:a="neutral"}){const i=a==="error"?"text-red-600 dark:text-red-400":"text-oai-gray-500 dark:text-oai-gray-400";return t.jsx("div",{className:`text-[11px] leading-snug ${i}`,children:e})}function We({rows:e,mode:a,extra:i=null}){const o=e.length===0&&!i;return t.jsxs(t.Fragment,{children:[e.map(({spec:n,pace:s})=>t.jsx(Ge,{label:n.label??r(n.labelKey),pct:k(n.window,n.pctField),reset:Re(N(n.window,n.resetField)),mode:a,pacePercent:s.pacePercent,paceOver:s.paceOver,title:Fe(n,s,a)},n.key)),o?t.jsx(y,{children:r("limits.status.no_data")}):null,i]})}function Ue(e){if(!Number.isFinite(e.expiresMs))return null;const a=Math.floor((e.expiresMs-Date.now())/864e5);return a<0?null:a===0?r("limits.reset_bank.hover_detail_today",{date:e.expiresAt}):r("limits.reset_bank.hover_detail",{date:e.expiresAt,days:a})}function ze({row:e}){const a=Math.max(0,Math.min(100,Number(e.percent)||0));return t.jsxs("div",{className:"group relative flex items-center gap-2","data-reset-bank-row":"",children:[t.jsx(z,{text:Ue(e)}),t.jsx("span",{"data-limit-label":"",className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400 shrink-0 whitespace-nowrap",style:{width:"var(--tt-limits-label-w)"},children:e.label}),t.jsx("div",{className:"relative flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:t.jsx("div",{className:"bg-oai-gray-400 dark:bg-oai-gray-500 rounded-full h-full transition-[width] duration-500 ease-out",style:{width:`${a}%`,minWidth:a>0?"3px":0}})}),t.jsx("span",{className:"text-[10px] tabular-nums text-oai-gray-400 dark:text-oai-gray-500 w-[4.25rem] text-right shrink-0 whitespace-nowrap",children:e.expiresAt})]})}function Ke({model:e}){const a=e.kind==="count_only"?r("limits.codex_reset_bank.count_only",{count:e.availableCount}):null;return t.jsxs("div",{className:"mt-1 flex flex-col gap-1","data-reset-bank-section":e.kind,children:[t.jsx("div",{className:"text-[10.5px] font-medium uppercase tracking-wide text-oai-gray-400 dark:text-oai-gray-500",children:r("limits.codex_reset_bank.title")}),a?t.jsx("div",{className:"text-[11px] leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:a}):e.rows.map(i=>t.jsx(ze,{row:i},i.key))]})}function Ve(e,a){if(e==="codex_meta"){const i=Se(a.reset_credits);return i?t.jsx(Ke,{model:i}):null}return e==="kimi_parallel"&&a.parallel_limit?t.jsx(y,{children:r("limits.label.kimi_parallel",{count:a.parallel_limit})}):e==="copilot_otel"&&!a.otel_has_files&&!a.otel_enabled?t.jsx(Ye,{defaultDir:a.otel_default_dir}):null}function qe(e,a,i,o,n,s,c=null){const d=B[e];if(!d)return null;const l=d.windows(a).filter(x=>x.window).map(x=>({spec:x,pace:De(x,o)})),u=Ve(d.extra,a);return t.jsxs(P,{name:i,providerId:e,expandable:l.length>0,expanded:n,onToggle:s,badge:c,children:[t.jsx(We,{mode:o,rows:l,extra:u}),n?t.jsx(He,{rows:l,mode:o}):null]},e)}function Xe(e,a,i,o,n){if(!B[e])return null;if(!a?.configured)return t.jsxs(P,{name:_(e),providerId:e,children:[t.jsx(y,{children:r("limits.status.not_connected")}),e==="opencodeGo"?t.jsx(F,{}):null]},e);if(a.error)return t.jsxs(P,{name:_(e),providerId:e,children:[t.jsx(y,{tone:"error",children:r("shared.error.prefix",{error:a.error})}),e==="opencodeGo"?t.jsx(F,{}):null]},e);const s=_(e),c=a.plan_label?`${s} ${a.plan_label}`:s;let d=null;if(e==="antigravity")if(a.cached){const u=E(a.cached_at);d=t.jsx(v,{label:r("limits.label.antigravity_cached"),age:u,tone:"cached",tooltip:r("limits.tooltip.antigravity_cached")})}else d=t.jsx(v,{label:r("limits.label.antigravity_live"),tone:"live",tooltip:r("limits.tooltip.antigravity_live")});if(!d&&a.auth_action_required==="reauth"){const u=$e[e];d=t.jsx(v,{label:r("limits.reauth.badge"),age:E(a.cached_at),tone:"stale",tooltip:u?r("limits.reauth.tooltip",{command:u}):null})}const l=a.provenance;return l?.stale&&!d&&(d=t.jsx(v,{label:r("limits.provenance.stale"),age:E(l.captured_at),tone:"stale",tooltip:r("limits.provenance.tooltip",{source:l.source,confidence:l.confidence})})),qe(e,a,c,i,o,n,d)}function Ye({defaultDir:e}){const[a,i]=b.useState(!1),n=["export COPILOT_OTEL_ENABLED=true","export COPILOT_OTEL_EXPORTER_TYPE=file",`export COPILOT_OTEL_FILE_EXPORTER_PATH="${e||"$HOME/.copilot/otel"}/copilot-otel-$(date +%Y%m%d).jsonl"`].join(`
`),s=async c=>{c.stopPropagation();try{await navigator.clipboard.writeText(n),i(!0),setTimeout(()=>i(!1),1600)}catch{}};return t.jsxs("div",{className:"mt-1 rounded-md border border-amber-300/60 dark:border-amber-700/40 bg-amber-50/50 dark:bg-amber-900/10 px-2.5 py-2 text-[11px] text-oai-gray-600 dark:text-oai-gray-300",children:[t.jsx("div",{className:"font-medium text-oai-gray-700 dark:text-oai-gray-200",children:r("limits.copilot.otelHint.title")}),t.jsx("div",{className:"mt-0.5 leading-snug",children:r("limits.copilot.otelHint.body")}),t.jsx("pre",{className:"mt-1.5 overflow-x-auto rounded bg-oai-gray-100 dark:bg-oai-gray-900/60 px-2 py-1.5 font-mono text-[10.5px] leading-tight whitespace-pre",children:n}),t.jsx("button",{type:"button",onClick:s,className:"mt-1 inline-flex items-center gap-1 rounded border border-oai-gray-300 dark:border-oai-gray-700 px-1.5 py-0.5 text-[10.5px] text-oai-gray-700 dark:text-oai-gray-200 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors",children:a?r("limits.copilot.otelHint.copied"):r("limits.copilot.otelHint.copy")})]})}function I({n:e,children:a}){return t.jsxs("li",{className:"flex gap-2.5",children:[t.jsx("span",{className:"mt-[1px] flex h-4 w-4 shrink-0 items-center justify-center rounded-full bg-oai-brand/15 text-[9px] font-semibold text-oai-brand",children:e}),t.jsx("div",{className:"min-w-0 flex-1 leading-snug",children:a})]})}function Je(){return t.jsx("svg",{viewBox:"0 0 12 12","aria-hidden":"true",className:"h-2.5 w-2.5",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:t.jsx("path",{d:"M4.5 2.75h4.75V7.5M9.25 2.75 3 9"})})}function F(){const[e,a]=b.useState(!1),i=['export OPENCODE_GO_AUTH_COOKIE="..."','# Optional: export OPENCODE_GO_WORKSPACE_ID="wrk_..." (Only if auto-discovery fails)'].join(`
`),o=async n=>{n.stopPropagation();try{await navigator.clipboard.writeText(i),a(!0),setTimeout(()=>a(!1),1600)}catch{}};return t.jsxs("div",{className:"mt-1.5 rounded-lg border border-oai-gray-200 dark:border-oai-gray-700/60 bg-oai-gray-50/50 dark:bg-oai-gray-900/20 p-3 text-[11px] text-oai-gray-600 dark:text-oai-gray-300",children:[t.jsx("div",{className:"text-[12px] font-semibold text-oai-gray-800 dark:text-oai-gray-100",children:r("limits.opencodeGo.setupHint.title")}),t.jsx("div",{className:"mt-0.5 leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:r("limits.opencodeGo.setupHint.subtitle")}),t.jsxs("ol",{className:"mt-2.5 space-y-2.5",children:[t.jsxs(I,{n:"1",children:[t.jsx("div",{children:r("limits.opencodeGo.setupHint.step1")}),t.jsxs("a",{href:"https://opencode.ai",target:"_blank",rel:"noreferrer",onClick:n=>n.stopPropagation(),className:"mt-1 inline-flex items-center gap-1 rounded-md bg-oai-brand/10 px-2 py-1 font-medium text-oai-brand hover:bg-oai-brand/15 transition-colors",children:[r("limits.opencodeGo.setupHint.cta"),t.jsx(Je,{})]})]}),t.jsxs(I,{n:"2",children:[t.jsx("div",{children:r("limits.opencodeGo.setupHint.step2")}),t.jsxs("ul",{className:"mt-1 space-y-0.5 text-oai-gray-500 dark:text-oai-gray-400",children:[t.jsx("li",{children:r("limits.opencodeGo.setupHint.step2_workspace")}),t.jsx("li",{children:r("limits.opencodeGo.setupHint.step2_cookie")})]})]}),t.jsxs(I,{n:"3",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{children:r("limits.opencodeGo.setupHint.step3")}),t.jsx("button",{type:"button",onClick:o,className:"shrink-0 rounded-md border border-oai-gray-300 dark:border-oai-gray-700 px-2 py-0.5 text-[10.5px] text-oai-gray-700 dark:text-oai-gray-200 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors",children:e?r("limits.opencodeGo.setupHint.copied"):r("limits.opencodeGo.setupHint.copy")})]}),t.jsx("pre",{className:"mt-1.5 overflow-x-auto rounded-md bg-oai-gray-100 dark:bg-oai-gray-900/60 px-2 py-1.5 font-mono text-[10.5px] leading-relaxed whitespace-pre",children:i}),t.jsx("div",{className:"mt-1 text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:r("limits.opencodeGo.setupHint.note_app")})]})]})]})}function Qe(e){const[a,i]=b.useState(0);return b.useLayoutEffect(()=>{const o=e.current;if(!o)return;const n=o.querySelectorAll("[data-limit-label]");let s=0,c=null;if(n.length>0)try{c=document.createElement("canvas").getContext("2d")}catch{c=null}if(c){const l=window.getComputedStyle(n[0]);c.font=`${l.fontStyle} ${l.fontWeight} ${l.fontSize} ${l.fontFamily}`;for(const u of n)s=Math.max(s,c.measureText(u.textContent).width)}const d=Math.ceil(s);i(l=>l===d?l:d)}),a}function Ze({claude:e,codex:a,cursor:i,gemini:o,kimi:n,kiro:s,grok:c,antigravity:d,copilot:l,zcode:u,opencodeGo:x,order:f,visibility:h,displayMode:V}){const q={claude:e,codex:a,cursor:i,gemini:o,kimi:n,kiro:s,grok:c,antigravity:d,copilot:l,zcode:u,opencodeGo:x},O=b.useRef(null),S=Qe(O),[X,Y]=b.useState(null),J=Array.isArray(f)&&f.length>0?f:Be,C=V===m.REMAINING?m.REMAINING:m.USED,Q=C===m.REMAINING?r("limits.settings.display_mode_remaining"):r("limits.settings.display_mode_used"),R=J.filter(p=>!h||h[p]!==!1).map(p=>Xe(p,q[p],C,X===p,()=>Y(Z=>Z===p?null:p))).filter(Boolean);return t.jsx(xe,{delay:.15,children:t.jsx(W,{children:t.jsxs("div",{ref:O,className:"flex flex-col gap-3",style:S>0?{"--tt-limits-label-w":`${S}px`}:void 0,children:[t.jsxs("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:[r("limits.panel.title"),r("limits.panel.mode_separator"),Q]}),R.length>0?R:t.jsx(y,{children:r("limits.status.all_hidden")})]})})})}const et=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),tt="x-apple.systempreferences:com.apple.preference.notifications";function at(){const e=ye(),a=ne(),i=r("limits.alert.blocked"),o=a?T.button:T.div;return t.jsxs(o,{type:a?"button":void 0,onClick:a?()=>oe({type:"action",name:"openURL",value:tt}):void 0,initial:e?!1:{opacity:0,x:14,scale:.9},animate:{opacity:1,x:0,scale:1},transition:{type:"spring",stiffness:320,damping:18},title:i,className:`relative hidden sm:inline-flex min-w-0 max-w-[360px] items-center gap-1.5 rounded-full border border-amber-300/70 bg-amber-50 px-3 py-1.5 text-xs text-amber-700 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-300 ${a?"cursor-pointer transition-colors hover:bg-amber-100 dark:hover:bg-amber-500/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-amber-500/60":""}`,children:[t.jsxs("span",{className:"relative flex h-1.5 w-1.5 shrink-0",children:[t.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-amber-400 opacity-75"}),t.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-amber-500"})]}),t.jsx("span",{className:"truncate",children:i}),t.jsx("span",{"aria-hidden":!0,className:"absolute left-full top-1/2 -translate-y-1/2 border-[5px] border-transparent border-l-amber-300/80 dark:border-l-amber-500/40"})]})}function ft(){const e=ee(),{data:a,error:i,isLoading:o}=de(e?{initialRefresh:!0,initialState:e,publishToPreloadCache:!0}:{initialRefresh:!0,publishToPreloadCache:!0}),n=me(),s=ce();return te.useEffect(()=>{s.enabled&&a&&ue(a)},[s.enabled,a]),!et&&!ae()?t.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:t.jsx(be,{})}):t.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:t.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:t.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[t.jsxs("div",{className:"flex flex-row items-start justify-between gap-4 mb-8",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white mb-3",children:r("nav.limits")}),t.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:r("limits.page.subtitle")})]}),t.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.enabled&&s.permissionBlocked?t.jsx(at,{}):null,t.jsx("button",{type:"button",onClick:()=>{s.setEnabled(!s.enabled)},"aria-label":s.enabled?r("limits.alert.disable"):r("limits.alert.enable"),title:s.enabled?r("limits.alert.disable"):r("limits.alert.enable"),className:`inline-flex h-9 w-9 items-center justify-center rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 ${s.enabled&&s.permissionBlocked?"text-amber-600 dark:text-amber-400":"text-oai-gray-600 dark:text-oai-gray-400 hover:text-oai-black dark:hover:text-white"}`,children:s.enabled?t.jsx(Ne,{className:"h-4 w-4","aria-hidden":!0}):t.jsx(ke,{className:"h-4 w-4","aria-hidden":!0})}),t.jsx(ie,{to:"/settings?section=limits","aria-label":r("limits.page.openSettings"),title:r("limits.page.openSettings"),className:"shrink-0 inline-flex h-9 w-9 items-center justify-center rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white transition-colors no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",children:t.jsx(re,{className:"h-4 w-4","aria-hidden":!0})})]})]}),o?t.jsx(Ee,{}):t.jsxs(t.Fragment,{children:[i?t.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400",children:r("shared.error.prefix",{error:i})}):null,t.jsx(Ze,{claude:a?.claude,codex:a?.codex,cursor:a?.cursor,gemini:a?.gemini,kimi:a?.kimi,kiro:a?.kiro,grok:a?.grok,antigravity:a?.antigravity,copilot:a?.copilot,zcode:a?.zcode,opencodeGo:a?.opencodeGo,order:n.order,visibility:n.visibility,displayMode:n.displayMode})]})]})})})}export{ft as LimitsPage};
import{l as e}from"./__vite-browser-external-CuMc3dqk.js";const o=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],t=e("link-2",o);export{t as L};
import{l as e}from"./__vite-browser-external-CuMc3dqk.js";const o=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],a=e("loader-circle",o);export{a as L};
import{j as e,c as t}from"./__vite-browser-external-CuMc3dqk.js";import{A as r}from"./arrow-up-right-D2tCxxHL.js";import{D as o}from"./download-zNMgxXgK.js";const i="https://github.com/mm7894215/TokenTracker/releases/latest";function c(){const a=()=>{try{window.location.href="tokentracker://open"}catch{}};return e.jsx("div",{className:"flex flex-1 flex-col items-center justify-center px-6 py-20 text-center",children:e.jsxs("div",{className:"max-w-md",children:[e.jsx("h2",{className:"text-lg font-semibold text-oai-black dark:text-white",children:t("local_only.title")}),e.jsx("p",{className:"mt-2 text-sm leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:t("local_only.body")}),e.jsxs("div",{className:"mt-6 flex flex-wrap items-center justify-center gap-3",children:[e.jsxs("button",{type:"button",onClick:a,className:"inline-flex h-9 items-center gap-1.5 rounded-full px-4 text-sm font-medium bg-oai-gray-900 text-white hover:bg-oai-gray-800 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100 transition-colors",children:[e.jsx("span",{children:t("local_only.open_app")}),e.jsx(r,{size:14,strokeWidth:2,"aria-hidden":!0})]}),e.jsxs("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"inline-flex h-9 items-center gap-1.5 rounded-full px-4 text-sm font-medium ring-1 ring-oai-gray-200 dark:ring-oai-gray-800 text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-900 transition-colors",children:[e.jsx(o,{size:14,strokeWidth:2,"aria-hidden":!0}),e.jsx("span",{children:t("local_only.download")})]})]})]})})}export{c as L};
import{l as re,a0 as ce,a as ge,r as o,c as a,j as e,d as h}from"./__vite-browser-external-CuMc3dqk.js";const ue=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],me=re("arrow-left",ue);const xe=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],he=re("mail",xe),be=e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",children:[e.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1Z",fill:"#4285F4"}),e.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23Z",fill:"#34A853"}),e.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18A10.96 10.96 0 0 0 1 12c0 1.77.42 3.44 1.18 4.93l3.66-2.84Z",fill:"#FBBC05"}),e.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53Z",fill:"#EA4335"})]}),fe=e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0 0 24 12c0-6.63-5.37-12-12-12Z"})}),pe={google:be,github:fe},ye={google:"Google",github:"GitHub",microsoft:"Microsoft",discord:"Discord",apple:"Apple"};function we(i){return ye[i]||String(i||"").replace(/-/g," ")}function ke(i){if(typeof i=="string"&&i.trim())return i.trim();if(i&&typeof i=="object"){if(typeof i.token=="string"&&i.token.trim())return i.token.trim();if(typeof i.otp=="string"&&i.otp.trim())return i.otp.trim()}return""}function je({title:i,subtitle:H,className:ae="",onSuccess:S,hideLogo:D=!1,initialMode:p="signin",tokenFromUrl:P="",initialEmail:y="",initialCode:v=""}){ce();const{enabled:w,signedIn:j,refreshUser:E,signInWithPassword:G,signUp:Z,signInWithOAuth:T,getPublicAuthConfig:V,sendResetPasswordEmail:$,exchangeResetPasswordToken:U,resetPassword:W}=ge(),[n,u]=o.useState(p),[c,k]=o.useState(y),[m,N]=o.useState(""),[A,L]=o.useState(""),[M,te]=o.useState(""),[q,z]=o.useState(v),[_,x]=o.useState(!1),[J,s]=o.useState(null),[C,b]=o.useState(null),[F,O]=o.useState(!1),[oe,se]=o.useState(!!(p!=="signin"||y)),[R,K]=o.useState(!0),[I,Q]=o.useState([]),[X,ie]=o.useState(8);o.useEffect(()=>{p&&u(p)},[p]),o.useEffect(()=>{y&&k(y)},[y]),o.useEffect(()=>{v&&z(v)},[v]),o.useEffect(()=>{if(!w)return;let r=!0;return K(!0),(async()=>{const{data:t,error:l}=await V();if(r){if(l||!t)Q(["google","github"]);else{const d=Array.isArray(t.oAuthProviders)?t.oAuthProviders:[],f=Array.isArray(t.customOAuthProviders)?t.customOAuthProviders:[];Q([...d,...f]),typeof t.passwordMinLength=="number"&&t.passwordMinLength>0&&ie(t.passwordMinLength)}K(!1)}})(),()=>{r=!1}},[w,V]),o.useEffect(()=>{j&&S&&S()},[j,S]);const Y=o.useMemo(()=>typeof window>"u"?"":!!window.webkit?.messageHandlers?.nativeOAuth?`${window.location.origin}/auth/callback`:`${window.location.origin}/`,[]),ee=o.useMemo(()=>typeof window>"u"?"/reset-password":`${window.location.origin}/reset-password`,[]),B=o.useCallback(async r=>{s(null),x(!0);try{const{error:t}=await T(r,Y);t&&s(t.message||String(t))}finally{x(!1)}},[T,Y]);o.useEffect(()=>{if(!w||R||j||typeof window>"u")return;const r=window.location.search;if(!r)return;const t=new URLSearchParams(r),l=t.get("native")==="1",d=t.get("provider");l&&d&&[...I].includes(d)&&B(d)},[w,R,j,I,B]);const ne=o.useCallback(async r=>{r.preventDefault(),s(null),x(!0);try{if(n==="signup"){const{data:l,error:d}=await Z({email:c.trim(),password:m,name:M.trim()||void 0});if(d){s(d.message||String(d));return}if(l?.requireEmailVerification){b(a("login.verify_email_pending")),u("signin");return}await E();return}const{error:t}=await G({email:c.trim(),password:m});if(t){s(t.message||String(t));return}await E()}finally{x(!1)}},[n,c,m,M,Z,G,E]),le=o.useCallback(async r=>{r.preventDefault(),s(null),x(!0);try{const t=c.trim(),{error:l}=await $({email:t,redirectTo:ee});if(l){s(l.message||String(l));return}k(t),b(a("reset_password.request.sent")),u("reset_confirm")}finally{x(!1)}},[c,ee,$]),de=o.useCallback(async r=>{if(r.preventDefault(),s(null),m!==A){s(a("reset_password.error.password_mismatch"));return}x(!0);try{let t=P;if(!t){const{data:d,error:f}=await U({email:c.trim(),code:q.trim()});if(f){s(f.message||String(f));return}if(t=ke(d),!t){s(a("reset_password.error.missing_token"));return}}const{error:l}=await W({newPassword:m,otp:t});if(l){s(l.message||String(l));return}O(!0),b(a("reset_password.success"))}finally{x(!1)}},[q,A,c,U,m,W,P]);if(!w)return null;const g=n==="reset_email"||n==="reset_confirm";return e.jsxs("div",{className:h("w-full bg-white dark:bg-oai-gray-950 p-6 transition-colors duration-200",ae),children:[g&&e.jsxs("button",{type:"button",onClick:()=>{u("signin"),b(null),s(null),O(!1),N(""),L("")},className:"flex items-center gap-1.5 text-xs font-medium text-oai-gray-500 hover:text-oai-black dark:hover:text-white transition-colors mb-4 focus:outline-none",children:[e.jsx(me,{className:"h-3.5 w-3.5"}),a("reset_password.back_to_sign_in")]}),e.jsxs("div",{className:h("mb-6",g?"text-left":"text-center"),children:[!D&&!g&&e.jsxs("div",{className:"flex items-center justify-center gap-2 mb-2",children:[e.jsx("img",{src:"/app-icon.png",alt:"",width:28,height:28,className:"rounded-md"}),e.jsx("span",{className:"text-lg font-semibold text-oai-black dark:text-white font-oai tracking-tight",children:a("shared.app_name")})]}),e.jsx("h2",{className:h("text-sm font-semibold text-oai-black dark:text-white tracking-tight mb-1",(D||g)&&"text-base font-bold md:text-lg"),children:g?a("reset_password.title"):i||a("login_modal.subtitle")}),!g&&H&&e.jsx("p",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 mt-1.5 leading-relaxed max-w-[320px] mx-auto",children:H}),g&&e.jsx("p",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 mt-1.5 leading-relaxed max-w-[320px]",children:C&&n==="reset_confirm"&&!F?C:a("reset_password.subtitle")})]}),C&&(!g||F)&&e.jsx("div",{className:"mb-4 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900/50 px-3 py-2 text-xs text-oai-gray-700 dark:text-oai-gray-300",children:C}),J&&e.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400 text-center",role:"alert",children:J}),n==="reset_email"&&e.jsxs("form",{onSubmit:le,className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-reset-email",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("login.field.email")}),e.jsx("input",{id:"card-reset-email",type:"email",autoComplete:"email",required:!0,value:c,onChange:r=>k(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),e.jsx("button",{type:"submit",disabled:_,className:"w-full h-10 rounded-lg bg-oai-gray-900 dark:bg-white text-white dark:text-oai-gray-950 text-sm font-semibold hover:bg-oai-gray-800 dark:hover:bg-oai-gray-100 transition-colors disabled:opacity-50",children:a("reset_password.request.submit")})]}),n==="reset_confirm"&&(F?e.jsx("button",{type:"button",onClick:()=>{u("signin"),O(!1),b(null),s(null),N(""),L("")},className:"w-full h-10 rounded-lg bg-oai-gray-900 dark:bg-white text-white dark:text-oai-gray-950 text-sm font-semibold hover:bg-oai-gray-800 dark:hover:bg-oai-gray-100 transition-colors text-center shadow-sm",children:a("reset_password.success_cta")}):e.jsxs("form",{onSubmit:de,className:"space-y-3",children:[!P&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-reset-email-confirm",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("login.field.email")}),e.jsx("input",{id:"card-reset-email-confirm",type:"email",autoComplete:"email",required:!0,value:c,onChange:r=>k(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-reset-code",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("reset_password.field.code")}),e.jsx("input",{id:"card-reset-code",type:"text",inputMode:"numeric",autoComplete:"one-time-code",required:!0,value:q,onChange:r=>z(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-reset-password",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("reset_password.field.new_password")}),e.jsx("input",{id:"card-reset-password",type:"password",autoComplete:"new-password",required:!0,minLength:8,value:m,onChange:r=>N(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-reset-password-confirm",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("reset_password.field.confirm_password")}),e.jsx("input",{id:"card-reset-password-confirm",type:"password",autoComplete:"new-password",required:!0,minLength:8,value:A,onChange:r=>L(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),e.jsx("button",{type:"submit",disabled:_,className:"w-full h-10 rounded-lg bg-oai-gray-900 dark:bg-white text-white dark:text-oai-gray-950 text-sm font-semibold hover:bg-oai-gray-800 dark:hover:bg-oai-gray-100 transition-colors disabled:opacity-50",children:a("reset_password.reset.submit")})]})),!g&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-2.5 mb-5",children:R?e.jsxs("div",{className:"space-y-2.5",children:[e.jsx("div",{className:"h-10 rounded-lg bg-oai-gray-100 dark:bg-oai-gray-900/50 animate-pulse"}),e.jsx("div",{className:"h-10 rounded-lg bg-oai-gray-100 dark:bg-oai-gray-900/50 animate-pulse"})]}):I.map(r=>e.jsxs("button",{type:"button",disabled:_,onClick:()=>B(r),className:h("w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-700 bg-oai-gray-50 dark:bg-oai-gray-900 text-sm font-medium text-oai-black dark:text-white","hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:border-oai-gray-300 dark:hover:border-oai-gray-600 transition-colors disabled:opacity-50","flex items-center justify-center gap-2.5"),children:[pe[r]||null,a("login.oauth.continue",{provider:we(r)})]},r))}),oe?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"relative mb-5",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("span",{className:"w-full border-t border-oai-gray-200 dark:border-oai-gray-800"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase tracking-wider",children:e.jsx("span",{className:"bg-white dark:bg-oai-gray-950 px-3 text-oai-gray-400 dark:text-oai-gray-600",children:a("login_modal.divider_email")})})]}),e.jsxs("div",{className:"flex rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 p-0.5 bg-oai-gray-50 dark:bg-oai-gray-900/50 mb-4",children:[e.jsx("button",{type:"button",className:h("flex-1 py-1.5 text-xs font-medium rounded-md transition-colors",n==="signin"?"bg-white dark:bg-oai-gray-800 text-oai-black dark:text-white shadow-sm":"text-oai-gray-500 hover:text-oai-gray-700 dark:hover:text-oai-gray-300"),onClick:()=>{u("signin"),s(null)},children:a("login.tab.sign_in")}),e.jsx("button",{type:"button",className:h("flex-1 py-1.5 text-xs font-medium rounded-md transition-colors",n==="signup"?"bg-white dark:bg-oai-gray-800 text-oai-black dark:text-white shadow-sm":"text-oai-gray-500 hover:text-oai-gray-700 dark:hover:text-oai-gray-300"),onClick:()=>{u("signup"),s(null)},children:a("login.tab.sign_up")})]}),e.jsxs("form",{onSubmit:ne,className:"space-y-3",children:[n==="signup"&&e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-name",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("login.field.name")}),e.jsx("input",{id:"card-name",type:"text",autoComplete:"name",value:M,onChange:r=>te(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500",placeholder:a("login.field.name_placeholder")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-email",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("login.field.email")}),e.jsx("input",{id:"card-email",type:"email",autoComplete:"email",required:!0,value:c,onChange:r=>k(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-password",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("login.field.password")}),e.jsx("input",{id:"card-password",type:"password",autoComplete:n==="signup"?"new-password":"current-password",required:!0,minLength:n==="signup"?X:void 0,value:m,onChange:r=>N(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"}),n==="signup"&&e.jsx("p",{className:"mt-1 text-xs text-oai-gray-400 dark:text-oai-gray-600",children:a("login.password_hint",{min:String(X)})}),n==="signin"&&e.jsx("div",{className:"mt-1 text-right",children:e.jsx("button",{type:"button",onClick:()=>{u("reset_email"),s(null),b(null)},className:"text-xs font-medium text-oai-gray-500 hover:text-oai-black dark:hover:text-white no-underline bg-transparent border-0 p-0 cursor-pointer focus:outline-none",children:a("login.forgot_password")})})]}),e.jsx("button",{type:"submit",disabled:_,className:"w-full h-10 rounded-lg bg-oai-gray-900 dark:bg-white text-white dark:text-oai-gray-950 text-sm font-semibold hover:bg-oai-gray-800 dark:hover:bg-oai-gray-100 transition-colors disabled:opacity-50",children:n==="signup"?a("login.submit.sign_up"):a("login.submit.sign_in")})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"relative mb-5",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("span",{className:"w-full border-t border-oai-gray-200 dark:border-oai-gray-800"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase tracking-wider",children:e.jsx("span",{className:"bg-white dark:bg-oai-gray-950 px-3 text-oai-gray-400 dark:text-oai-gray-600",children:a("login.divider")})})]}),e.jsxs("button",{type:"button",onClick:()=>se(!0),className:h("w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-700 bg-oai-gray-50 dark:bg-oai-gray-900 text-sm font-medium text-oai-black dark:text-white","hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:border-oai-gray-300 dark:hover:border-oai-gray-600 transition-colors","flex items-center justify-center gap-2.5"),children:[e.jsx(he,{className:"h-[18px] w-[18px] text-oai-gray-500 dark:text-oai-gray-400",strokeWidth:1.75}),a("login_modal.continue_email")]})]})]})]})}export{je as L};
import{u as s,a as c,r as l,j as e,X as d}from"./__vite-browser-external-CuMc3dqk.js";import{m as o}from"./react-B80AX8fE.js";import{L as m}from"./LoginCard-DHj1TAkh.js";import{A as p}from"./index-jpsn86uT.js";function b(){const{isOpen:i,closeLoginModal:a}=s(),{enabled:r}=c();return l.useEffect(()=>{if(!i)return;const t=n=>{n.key==="Escape"&&a()};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[i,a]),r?e.jsx(p,{children:i&&e.jsxs(o.div,{className:"fixed inset-0 z-[100] flex items-center justify-center p-4",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},children:[e.jsx(o.div,{className:"absolute inset-0 bg-black/40 dark:bg-black/60",onClick:a,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0}}),e.jsxs(o.div,{className:"relative w-full max-w-[420px] rounded-2xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-950 shadow-2xl overflow-hidden",initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},transition:{duration:.2},onClick:t=>t.stopPropagation(),children:[e.jsx("button",{type:"button",onClick:a,className:"absolute right-4 top-4 z-10 text-oai-gray-400 dark:text-oai-gray-500 hover:text-oai-black dark:hover:text-white transition-colors",children:e.jsx(d,{className:"h-5 w-5"})}),e.jsx(m,{onSuccess:a,className:"p-6 bg-transparent"})]})]})}):null}export{b as LoginModal};
import{e as p,f as w,a as v,r,c as s,j as e,L as y}from"./__vite-browser-external-CuMc3dqk.js";import{L as j}from"./LoginCard-DHj1TAkh.js";function N(i){const t=new URLSearchParams(i).get("next");return typeof t!="string"||t.length===0||!t.startsWith("/")||t.startsWith("//")?"/dashboard":t}function L(){const i=p(),[t,f]=w(),{enabled:n,loading:u,signedIn:x,refreshUser:g}=v(),c=r.useMemo(()=>N(t.toString()),[t]),[m,d]=r.useState(null);r.useEffect(()=>{const l=t.get("insforge_status"),a=t.get("insforge_type"),h=t.get("insforge_error");l==="success"&&a==="verify_email"?d(s("login.verify_email_success")):l==="error"&&a==="verify_email"&&h&&d(s("shared.error.prefix",{error:h}))},[t]);const o=r.useMemo(()=>t.get("native")==="1",[t]);r.useEffect(()=>{if(!(!n||u)&&x){if(o){window.location.href="/auth/native-callback";return}i(c,{replace:!0})}},[n,u,x,i,c,o]),r.useEffect(()=>{n&&g()},[n,g]),r.useEffect(()=>{if(o&&typeof window<"u")try{window.sessionStorage.setItem("tokentracker_native_login","1")}catch{}},[o]);const b=r.useCallback(()=>{f(l=>{const a=new URLSearchParams(l);return a.delete("insforge_status"),a.delete("insforge_type"),a.delete("insforge_error"),a},{replace:!0}),d(null)},[f]);return n?e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 h-16 flex items-center justify-between",children:e.jsx(y,{to:"/",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 rounded",children:s("login.back_home")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4 py-12",children:e.jsxs("div",{className:"w-full max-w-md space-y-6",children:[m?e.jsxs("div",{className:"rounded-lg border border-oai-gray-800 bg-oai-gray-900/50 px-4 py-3 text-sm text-oai-gray-300 flex justify-between gap-3 items-start",role:"status",children:[e.jsx("span",{children:m}),e.jsx("button",{type:"button",onClick:b,className:"shrink-0 text-oai-gray-500 hover:text-white text-xs",children:s("login.dismiss")})]}):null,e.jsx("div",{className:"border border-oai-gray-900 bg-oai-gray-950 rounded-2xl overflow-hidden shadow-2xl",children:e.jsx(j,{hideLogo:!0,title:s("login.title"),subtitle:s("login.subtitle"),className:"p-8 bg-transparent",onSuccess:()=>{o?window.location.href="/auth/native-callback":i(c,{replace:!0})}})})]})})]}):e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 py-4",children:e.jsx(y,{to:"/",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline",children:s("login.back_home")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4",children:e.jsx("p",{className:"text-oai-gray-400 text-center max-w-md",children:s("login.cloud_only")})})]})}export{L as LoginPage};
import{l as t}from"./__vite-browser-external-CuMc3dqk.js";const a=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],i=t("maximize-2",a);export{i as M};
import{l as E,Q as re,ai as ie,r as o,aj as se,ak as oe,al as le,w as H,c as r,j as e,d as b,a4 as U,X as ne}from"./__vite-browser-external-CuMc3dqk.js";import{u as de,T as O,S as ce}from"./use-native-settings-BkwcrMcE.js";import{P as pe}from"./ProviderIcon-B6sgfDtI.js";import{n as me,C as q}from"./ClawdAnimated-BwRC-Tmz.js";import{F}from"./FadeIn-COsoZJXe.js";import{L as xe}from"./link-2-CmjxdvpK.js";import{L as W}from"./loader-circle-CracNP_H.js";import{Z as ue}from"./zap-CcqNcNpw.js";import{T as ge}from"./trash-2-DAfuNrRz.js";import{D as be,a as he,b as fe,c as ye,d as ke,e as ve}from"./DialogTitle-KxLDeLzC.js";import{D as je}from"./DialogDescription-BgYqW0_C.js";import{D as we}from"./DialogClose-DmGnH7p-.js";import"./Card-C3Fxl-vL.js";import"./react-B80AX8fE.js";import"./use-reduced-motion-BEAopWkx.js";import"./useScrollLock-DmM-LeMm.js";import"./store-NtnkxrS2.js";const Ne=[["path",{d:"M13.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v11.5",key:"4pqfef"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M8 12v-1",key:"1ej8lb"}],["path",{d:"M8 18v-2",key:"qcmpov"}],["path",{d:"M8 7V6",key:"1nbb54"}],["circle",{cx:"8",cy:"20",r:"2",key:"ckkr5m"}]],Se=E("file-archive",Ne);const Ce=[["path",{d:"m9 10 3-3 3 3",key:"11gsxs"}],["path",{d:"M12 13V7",key:"h0r20n"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]],Pe=E("monitor-up",Ce);const ze=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],Ie=E("upload",ze),Ae={visible:!1,character:"clawd",size:"medium"};function De(){const t=re()&&ie(),[a,l]=o.useState(Ae);o.useEffect(()=>{if(!t)return;const p=se(s=>{l({visible:!!s.visible,character:me(s.character),size:["small","medium","large"].includes(s.size)?s.size:"medium"})});return oe(),p},[t]);const d=o.useCallback((p,s)=>{l(x=>({...x,[p]:s})),t&&le(p,s)},[t]);return{available:t,settings:a,setSetting:d}}const k=[{id:"clawd",displayName:"Clawd",nameKey:"pet.character.clawd",spriteVersionNumber:1,custom:!1},{id:"sprout",displayName:"Sprout",nameKey:"pet.character.sprout",spriteVersionNumber:1,custom:!1,assetUrl:"/pets/sprout/spritesheet.webp"},{id:"byte",displayName:"Byte",nameKey:"pet.character.byte",spriteVersionNumber:1,custom:!1,assetUrl:"/pets/byte/spritesheet.webp"},{id:"ember",displayName:"Ember",nameKey:"pet.character.ember",spriteVersionNumber:1,custom:!1,assetUrl:"/pets/ember/spritesheet.webp"}];async function C(t){const a=await t.json().catch(()=>null);if(!t.ok||a?.ok===!1)throw new Error(a?.error||`Pet request failed with HTTP ${t.status}`);return a}async function Te(){const t=await fetch("/functions/tokentracker-pets",{headers:{Accept:"application/json"},cache:"no-store"}),a=await C(t);return[...k,...Array.isArray(a.pets)?a.pets:[]]}async function M(t){const a=await H();return C(await fetch("/functions/tokentracker-pets",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json",...a},cache:"no-store",body:JSON.stringify(t)}))}function Ee(t){return M({action:"install_url",url:t})}async function $(t){const a=await H();return C(await fetch("/api/pets/import",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/zip",...a},cache:"no-store",body:t}))}function Me(t){return M({action:"remove",id:t})}async function Le(){const t=await fetch("/functions/tokentracker-pets?scope=codex",{headers:{Accept:"application/json"},cache:"no-store"}),a=await C(t);return{importable:Array.isArray(a.importable)?a.importable:[],codexDetected:a.codexDetected===!0}}function _e(t){return M({action:"import_codex",ids:t})}let T=k;function Ke(){const[t,a]=o.useState(T),[l,d]=o.useState(!0),[p,s]=o.useState(!1),x=o.useCallback(async()=>{d(!0);try{const u=await Te();return T=u,a(u),s(!0),u}catch{return T=k,a(k),s(!1),k}finally{d(!1)}},[]);return o.useEffect(()=>{x()},[x]),{pets:t,loading:l,available:p,refresh:x}}const Be={clawd:"from-oai-amber-50 dark:from-orange-950/70",sprout:"from-oai-brand-100 dark:from-emerald-950/70",byte:"from-oai-gray-200 dark:from-slate-800/70",ember:"from-orange-100 dark:from-orange-950/80"};function Ve(){const t=r("pet.import.subtitle"),a="codex-pets.net",l=t.indexOf(a);return l<0?t:e.jsxs(e.Fragment,{children:[t.slice(0,l),e.jsx("a",{href:"https://codex-pets.net",target:"_blank",rel:"noreferrer",className:"underline decoration-oai-gray-400 underline-offset-2 transition-colors hover:text-oai-black dark:decoration-oai-gray-500 dark:hover:text-white",children:a}),t.slice(l+a.length)]})}const v=[{id:"idle-living",labelKey:"pet.state.calm"},{id:"working-thinking",labelKey:"pet.state.focus"},{id:"working-juggling",labelKey:"pet.state.multitask"},{id:"working-wizard",labelKey:"pet.state.streak"},{id:"happy",labelKey:"pet.state.celebrate"},{id:"sleeping",labelKey:"pet.state.rest"}];function X({character:t,selected:a,onSelect:l,onRemove:d,removeDisabled:p}){const s=t.nameKey?r(t.nameKey):t.displayName;return e.jsxs("div",{className:"group relative",children:[e.jsxs("button",{type:"button",onClick:l,"aria-pressed":a,className:b("relative w-full overflow-hidden rounded-xl border p-2.5 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",a?"border-oai-brand-500/40 bg-white dark:border-oai-brand-500/25 dark:bg-oai-gray-900/80":"border-oai-gray-200/80 bg-white/55 hover:border-oai-gray-400 dark:border-oai-gray-800 dark:bg-oai-gray-950/55 dark:hover:border-oai-gray-600"),children:[e.jsx("div",{className:b("absolute inset-0 bg-gradient-to-br to-transparent opacity-80 dark:opacity-55",Be[t.id]||"from-oai-gray-200/80 dark:from-oai-gray-800/70")}),e.jsxs("div",{className:"relative flex items-center gap-2.5",children:[e.jsx("div",{className:"flex h-12 w-12 shrink-0 items-center justify-center",children:e.jsx(q,{state:"idle-living",character:t.id,pet:t,size:44})}),e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-semibold text-oai-black dark:text-white",children:s}),t.spriteVersionNumber===2?e.jsx("span",{className:"shrink-0 rounded border border-oai-gray-300/80 px-1 text-[9px] font-semibold text-oai-gray-500 dark:border-oai-gray-600 dark:text-oai-gray-400",children:r("pet.format.v2")}):null,a?e.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-oai-brand-500","aria-hidden":!0}):null]})]})]}),d?e.jsx("button",{type:"button",disabled:p,onClick:d,"aria-label":`${r("pet.import.remove")} · ${s}`,className:b("absolute right-1.5 top-1.5 flex h-6 w-6 items-center justify-center rounded-md border border-oai-gray-200/90 bg-white/95 text-oai-gray-500 transition-opacity hover:text-red-600 focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 disabled:opacity-40 dark:border-oai-gray-700 dark:bg-oai-gray-900/95 dark:text-oai-gray-400 dark:hover:text-red-400",a?"opacity-100":"opacity-0 group-hover:opacity-100"),children:e.jsx(ge,{className:"h-3 w-3","aria-hidden":!0})}):null]})}function Re({pet:t,state:a,onStateChange:l}){const[d,p]=o.useState(null),s=o.useRef(null),x=v.find(function(n){return n.id===a}),u=r(x?.labelKey||"pet.state.calm");return e.jsxs("section",{className:"relative flex min-h-[400px] flex-col overflow-hidden bg-oai-gray-50 dark:bg-oai-gray-950 sm:min-h-[440px] lg:min-h-[480px]",onPointerMove:m=>{if(t?.spriteVersionNumber!==2||!s.current)return;const n=s.current.getBoundingClientRect(),h=m.clientX-(n.left+n.width/2),c=m.clientY-(n.top+n.height/2),j=(Math.atan2(h,-c)*180/Math.PI+360)%360;p(Math.round(j/22.5)%16)},onPointerLeave:()=>p(null),children:[e.jsx("div",{className:"absolute inset-0 opacity-[0.16] dark:opacity-[0.12]",style:{backgroundImage:"radial-gradient(currentColor 0.7px, transparent 0.7px)",backgroundSize:"14px 14px"},"aria-hidden":!0}),e.jsxs("div",{className:"relative flex items-center justify-between gap-3 px-5 pt-5",children:[e.jsx("span",{className:"text-xs font-semibold uppercase tracking-[0.14em] text-oai-gray-500 dark:text-oai-gray-400",children:r("pet.preview.states")}),e.jsxs("div",{className:"flex items-center gap-2 rounded-full border border-black/5 bg-white/65 px-3 py-1.5 text-[11px] font-medium text-oai-gray-600 backdrop-blur-md dark:border-white/10 dark:bg-black/20 dark:text-oai-gray-300",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500","aria-hidden":!0}),u]})]}),e.jsx("div",{className:"relative flex flex-1 items-center justify-center px-6 py-5",children:e.jsx("div",{ref:s,className:"relative flex h-52 w-52 items-center justify-center sm:h-56 sm:w-56 lg:h-64 lg:w-64",children:e.jsx("div",{className:"origin-bottom lg:scale-[1.18]",children:e.jsx(q,{state:a,character:t?.id||"clawd",pet:t,size:190,lookDirectionIndex:d})})})}),e.jsx("div",{className:"relative border-t border-oai-gray-200/70 bg-white/85 px-3 py-2 dark:border-oai-gray-800 dark:bg-oai-gray-950/85",children:e.jsx("div",{className:"grid grid-cols-3 gap-1","aria-label":r("pet.preview.states"),children:v.map(m=>e.jsxs("button",{type:"button",onClick:()=>l(m.id),"aria-pressed":a===m.id,className:b("flex min-h-10 flex-col items-center justify-center gap-1 rounded-lg px-1.5 text-xs transition-colors duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-oai-brand-500",a===m.id?"font-semibold text-oai-black dark:text-white":"font-medium text-oai-gray-500 hover:text-oai-black dark:text-oai-gray-400 dark:hover:text-white"),children:[e.jsx("span",{children:r(m.labelKey)}),e.jsx("span",{className:b("h-1 w-1 rounded-full transition-colors duration-200",a===m.id?"bg-oai-black dark:bg-white":"bg-transparent"),"aria-hidden":!0})]},m.id))})})]})}function Ue({pets:t,busy:a,error:l,onImport:d,onClose:p}){const[s,x]=o.useState(()=>new Set),u=n=>x(h=>{const c=new Set(h);return c.has(n)?c.delete(n):c.add(n),c}),m=t.length!==0&&s.size===t.length;return e.jsx(be,{open:!0,onOpenChange:n=>{!n&&!a&&p()},children:e.jsxs(he,{children:[e.jsx(fe,{className:"fixed inset-0 z-50 bg-black/15 backdrop-blur-md dark:bg-black/40 animate-tt-fade-in"}),e.jsx(ye,{className:"fixed inset-0 z-50 flex items-center justify-center p-3 md:p-6",children:e.jsxs(ke,{className:"relative flex max-h-[86vh] w-full max-w-2xl flex-col overflow-hidden rounded-2xl border border-oai-gray-200/50 bg-white/95 shadow-2xl backdrop-blur-2xl dark:border-white/10 dark:bg-oai-gray-900/95 animate-tt-modal",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3 border-b border-oai-gray-200/70 px-5 py-4 dark:border-oai-gray-800",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx(ve,{className:"text-base font-semibold",children:r("pet.codex.title")}),e.jsx(je,{className:"mt-0.5 text-xs leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:r("pet.codex.subtitle")})]}),e.jsx(we,{type:"button",disabled:a,"aria-label":r("pet.codex.close"),className:"shrink-0 rounded-full border border-oai-gray-200/60 p-1.5 text-oai-gray-500 transition-colors hover:text-oai-black disabled:opacity-40 dark:border-oai-gray-800/60 dark:text-oai-gray-400 dark:hover:text-white",children:e.jsx(ne,{size:16})})]}),e.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-5 py-4",children:[t.length===0?e.jsx("p",{className:"py-8 text-center text-sm text-oai-gray-400 dark:text-oai-gray-500",children:r("pet.codex.empty")}):e.jsx("div",{className:"grid grid-cols-2 gap-2.5 sm:grid-cols-3",children:t.map(n=>e.jsx(X,{character:n,selected:s.has(n.id),onSelect:()=>u(n.id)},n.id))}),l?e.jsx("p",{role:"alert",className:"mt-3 text-xs text-red-600 dark:text-red-400",children:l}):null]}),e.jsxs("div",{className:"flex items-center justify-between gap-3 border-t border-oai-gray-200/70 px-5 py-3 dark:border-oai-gray-800",children:[e.jsx("button",{type:"button",disabled:a||t.length===0,onClick:()=>x(m?new Set:new Set(t.map(n=>n.id))),className:"text-xs font-medium text-oai-gray-500 underline-offset-2 hover:underline disabled:opacity-40 dark:text-oai-gray-400",children:r("pet.codex.select_all")}),e.jsxs("button",{type:"button",disabled:a||s.size===0,onClick:()=>d([...s]),className:"flex h-9 items-center gap-1.5 rounded-lg bg-oai-black px-4 text-xs font-semibold text-white transition-colors disabled:bg-oai-gray-200 disabled:text-oai-gray-400 dark:bg-white dark:text-black dark:disabled:bg-oai-gray-800 dark:disabled:text-oai-gray-500",children:[a?e.jsx(W,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):null,s.size>0?`${r("pet.codex.import")} · ${s.size}`:r("pet.codex.import")]})]})]})})]})})}function st(){const{available:t,settings:a,setSetting:l}=De(),{pets:d,loading:p,available:s,refresh:x}=Ke(),[u,m]=o.useState(""),[n,h]=o.useState(""),[c,j]=o.useState(!1),[L,P]=o.useState([]),[Z,z]=o.useState(!1),[w,_]=o.useState(!1),[J,I]=o.useState(""),[Q,K]=o.useState("idle-living"),[B,Y]=o.useState(!0),y=a.character||"clawd",A=de(),V=A.settings?.menuBarIconStyle==="pet",G=d.find(i=>i.id===y)||d[0],N=c?{kind:"busy",text:r("pet.import.busy")}:n?{kind:"error",text:n}:null,R=L.length!==0;o.useEffect(()=>{!p&&d.length>0&&!d.some(i=>i.id===y)&&l("character","clawd")},[p,d,y,l]);async function S(i,g=r("pet.import.success")){j(!0),h("");try{const f=await i();await x(),f?.pet?.id&&l("character",f.pet.id),U({title:g,timeout:4e3}),m("")}catch(f){h(f?.message||r("pet.import.failed"))}finally{j(!1)}}const D=o.useCallback(async()=>{if(!s){P([]);return}try{const i=await Le();P(i.importable)}catch{P([])}},[s]);o.useEffect(()=>{D()},[D]);async function ee(i){_(!0),I("");try{return await _e(i),await x(),await D(),U({title:r("pet.codex.imported"),timeout:4e3}),!0}catch(g){return I(g?.message||r("pet.import.failed")),!1}finally{_(!1)}}o.useEffect(()=>{if(!B)return;const i=window.setInterval(()=>{K(g=>{const f=v.findIndex(ae=>ae.id===g);return v[(f+1)%v.length].id})},5e3);return()=>window.clearInterval(i)},[B]);const te=[{value:"small",label:r("pet.size.small")},{value:"medium",label:r("pet.size.medium")},{value:"large",label:r("pet.size.large")}];return e.jsx("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:e.jsx("main",{className:"flex-1 pb-14 pt-8 sm:pt-10",children:e.jsxs("div",{className:"mx-auto max-w-5xl px-4 sm:px-6",children:[e.jsx(F,{y:12,children:e.jsxs("header",{className:"mb-8",children:[e.jsx("h1",{className:"text-3xl font-semibold tracking-tight sm:text-4xl",children:r("pet.page.title")}),e.jsx("p",{className:"mt-2 max-w-2xl text-sm leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:r("pet.page.subtitle")})]})}),e.jsx(F,{y:12,delay:.04,children:e.jsxs("div",{className:"overflow-hidden rounded-[28px] border border-oai-gray-200 bg-white/75 dark:border-oai-gray-800 dark:bg-oai-gray-900/60 lg:grid lg:grid-cols-[1.12fr_0.88fr]",children:[e.jsx(Re,{pet:G,state:Q,onStateChange:i=>{Y(!1),K(i)}}),e.jsxs("aside",{className:"flex flex-col border-t border-oai-gray-200 p-5 dark:border-oai-gray-800 lg:min-h-[480px] lg:border-l lg:border-t-0",children:[e.jsxs("section",{"aria-labelledby":"pet-character-title",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"pet-character-title",className:"text-sm font-semibold",children:r("pet.characters.title")}),e.jsx("p",{className:"mt-1 text-xs leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:r("pet.characters.subtitle")})]}),e.jsx("div",{className:"mt-4 grid max-h-72 grid-cols-2 gap-2 overflow-y-auto pr-1 -mr-1",children:d.map(i=>e.jsx(X,{character:i,selected:y===i.id,onSelect:()=>l("character",i.id),removeDisabled:c,onRemove:s&&i.custom?()=>S(async()=>(await Me(i.id),y===i.id&&l("character","clawd"),null),r("pet.import.removed")):void 0},i.id))}),A.available?e.jsxs("div",{className:"mt-4 flex items-center justify-between gap-3 rounded-xl border border-oai-gray-200/70 bg-oai-gray-50/60 px-3 py-2.5 dark:border-oai-gray-800 dark:bg-oai-gray-900/40",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-xs font-semibold",children:r("pet.menubar.title")}),e.jsx("p",{className:"mt-0.5 text-[11px] leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:r("pet.menubar.hint")})]}),e.jsx(O,{checked:V,onChange:()=>A.setSetting("menuBarIconStyle",V?"clawd":"pet"),ariaLabel:r("pet.menubar.title")})]}):null]}),s?e.jsxs("section",{className:"mt-6 border-t border-oai-gray-200/70 pt-5 dark:border-oai-gray-800","aria-labelledby":"pet-import-title",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ie,{className:"h-4 w-4 shrink-0 text-oai-gray-500","aria-hidden":!0}),e.jsx("h2",{id:"pet-import-title",className:"text-sm font-semibold",children:r("pet.import.title")})]}),e.jsx("p",{className:"mt-1 text-xs leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:e.jsx(Ve,{})}),e.jsxs("form",{className:"mt-3 flex gap-2",onSubmit:i=>{i.preventDefault(),!c&&u.trim()&&S(()=>Ee(u))},children:[e.jsxs("label",{className:"relative flex min-w-0 flex-1 items-center",children:[e.jsx(xe,{className:"pointer-events-none absolute left-3 h-3.5 w-3.5 text-oai-gray-400","aria-hidden":!0}),e.jsx("input",{value:u,onChange:i=>m(i.target.value),"aria-label":r("pet.import.url_label"),placeholder:"codex-pets.net/#/pets/…",className:"h-9 w-full rounded-lg border border-oai-gray-200 bg-white pl-9 pr-3 text-xs outline-none focus:border-oai-brand-500 dark:border-oai-gray-700 dark:bg-oai-gray-950"})]}),e.jsxs("button",{type:"submit",disabled:c||!u.trim(),className:"flex h-9 shrink-0 items-center gap-1.5 rounded-lg bg-oai-black px-3.5 text-xs font-semibold text-white transition-colors disabled:bg-oai-gray-200 disabled:text-oai-gray-400 dark:bg-white dark:text-black dark:disabled:bg-oai-gray-800 dark:disabled:text-oai-gray-500",children:[c?e.jsx(W,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):null,r("pet.import.add")]})]}),e.jsxs("div",{className:b("mt-2 grid gap-2",R?"grid-cols-2":"grid-cols-1"),children:[R?e.jsxs("button",{type:"button",disabled:c||w,onClick:()=>{I(""),z(!0)},className:b("flex h-9 cursor-pointer items-center justify-center gap-1.5 rounded-lg border border-dashed border-oai-gray-300 text-xs font-medium text-oai-gray-500 transition-colors hover:border-oai-gray-500 hover:text-oai-black dark:border-oai-gray-600 dark:text-oai-gray-400 dark:hover:border-oai-gray-400 dark:hover:text-white",(c||w)&&"pointer-events-none opacity-40"),children:[e.jsx(pe,{provider:"codex",size:14,className:"fill-current"}),r("pet.codex.browse")]}):null,e.jsxs("label",{onDragOver:i=>i.preventDefault(),onDrop:i=>{if(i.preventDefault(),c)return;const g=i.dataTransfer?.files?.[0];g&&S(()=>$(g))},className:b("flex h-9 cursor-pointer items-center justify-center gap-1.5 rounded-lg border border-dashed border-oai-gray-300 text-xs font-medium text-oai-gray-500 transition-colors hover:border-oai-gray-500 hover:text-oai-black dark:border-oai-gray-600 dark:text-oai-gray-400 dark:hover:border-oai-gray-400 dark:hover:text-white",c&&"pointer-events-none opacity-40"),children:[e.jsx(Se,{className:"h-3.5 w-3.5","aria-hidden":!0}),r("pet.import.zip"),e.jsx("input",{type:"file",accept:".zip,.codex-pet.zip,application/zip",className:"sr-only",disabled:c,onChange:i=>{const g=i.target.files?.[0];g&&S(()=>$(g)),i.target.value=""}})]})]}),N?e.jsx("p",{role:N.kind==="error"?"alert":"status",className:b("mt-2 text-xs",N.kind==="error"?"text-red-600 dark:text-red-400":"text-oai-gray-500 dark:text-oai-gray-400"),children:N.text}):null,Z?e.jsx(Ue,{pets:L,busy:w,error:J,onClose:()=>{w||z(!1)},onImport:async i=>{await ee(i)&&z(!1)}}):null]}):null,e.jsxs("section",{className:"mt-6 border-t border-oai-gray-200/70 pt-5 dark:border-oai-gray-800",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Pe,{className:"h-4 w-4 text-oai-gray-500 dark:text-oai-gray-400",strokeWidth:1.75,"aria-hidden":!0}),e.jsx("h2",{className:"text-sm font-semibold",children:r("pet.controls.title")})]}),e.jsxs("div",{className:"mt-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("div",{className:"text-sm font-medium",children:r("pet.controls.show")}),e.jsx(O,{checked:a.visible,onChange:()=>l("visible",!a.visible),disabled:!t,ariaLabel:r("pet.controls.show")})]}),e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("div",{className:"text-sm font-medium",children:r("pet.controls.size")}),e.jsx("div",{className:"shrink-0",children:e.jsx(ce,{options:te,value:a.size,onChange:i=>l("size",i),disabled:!t})})]})]})]}),t?null:e.jsxs("div",{className:"mt-6 flex gap-2 rounded-xl bg-oai-gray-100 p-3 text-xs leading-relaxed text-oai-gray-500 dark:bg-oai-gray-800/70 dark:text-oai-gray-400",children:[e.jsx(ue,{className:"mt-0.5 h-3.5 w-3.5 shrink-0","aria-hidden":!0}),r("pet.controls.native_only")]})]})]})})]})})})}export{st as PetPage};
import{aH as Xe,aQ as Ue,aR as le,aS as Ke,P as ne,aG as ge,r as m,aT as J,aU as me,aV as he,aW as oe,aD as Re,aX as We,aY as we,aE as z,A as $,aZ as W,a1 as ue,ax as pe,aF as qe,a_ as Ee,a$ as ze,E as Qe,b0 as $e,b1 as Te,V as q,j as V,aC as Je,W as Me,aK as Ze,b2 as et,b3 as tt,b4 as nt,b5 as ot,y as st,z as Ae,b6 as rt,b7 as ye,aA as it,b8 as at,b9 as ct,aB as lt,az as ut,ba as ft,ay as dt}from"./__vite-browser-external-CuMc3dqk.js";import{n as Pe,o as Le,q as He,r as Ce,v as se,P as pt,w as gt,k as mt,s as ht,x as Et,y as Tt,e as Pt,f as Ct,g as vt,h as Rt,a as Be,j as St,u as bt,z as Ot,A as It,t as Mt,B as yt,I as xt,D as Ft,c as kt,d as wt,b as At,p as Lt}from"./useScrollLock-DmM-LeMm.js";import{c as Ht,p as Bt,a as Dt}from"./store-NtnkxrS2.js";import{a as _t,b as jt,c as Nt,d as Vt,e as Yt,f as Gt,g as Xt,h as Ut}from"./ToolbarRootContext-xOR5ZEzv.js";function Kt(e,n){return n!=null&&!Pe(n)?0:typeof e=="function"?e():e}function ve(e,n,t){const l=Kt(e,t);return typeof l=="number"?l:l?.[n]}function xe(e){return typeof e=="function"?e():e}function De(e,n){return n||e==="click"||e==="mousedown"}function Wt(e){return e?.includes("mouse")&&e!=="mousedown"}class Se{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new le,this.restTimeout=new le,this.handleCloseOptions=void 0}static create(){return new Se}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}const fe=new WeakMap;function de(e){if(!e.performedPointerEventsMutation)return;const n=e.pointerEventsScopeElement;n&&fe.get(n)===e&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),fe.delete(n)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function _e(e,n){const{scopeElement:t,referenceElement:l,floatingElement:i}=n,o=fe.get(t);o&&o!==e&&de(o),de(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=t,e.pointerEventsReferenceElement=l,e.pointerEventsFloatingElement=i,fe.set(t,e),t.style.pointerEvents="none",l.style.pointerEvents="auto",i.style.pointerEvents="auto"}function je(e){const n=e.context.dataRef.current,t=Xe(()=>n.hoverInteractionState??Se.create()).current;return n.hoverInteractionState||(n.hoverInteractionState=t),Ue(n.hoverInteractionState.disposeEffect),n.hoverInteractionState}function qt(e,n={}){const{enabled:t=!0,closeDelay:l=0,nodeId:i}=n,o="rootStore"in e?e.rootStore:e,p=o.useState("open"),E=o.useState("floatingElement"),b=o.useState("domReferenceElement"),{dataRef:c}=o.context,r=Le(),O=He(),h=je(o),N=Ke(),u=ne(()=>De(c.current.openEvent?.type,h.interactedInside)),B=ne(()=>Wt(c.current.openEvent?.type)),g=ne(()=>{de(h)});ge(()=>{p||(h.pointerType=void 0,h.restTimeoutPending=!1,h.interactedInside=!1,g())},[p,h,g]),m.useEffect(()=>g,[g]),ge(()=>{if(t&&p&&h.handleCloseOptions?.blockPointerEvents&&B()&&J(b)&&E){const x=b,a=E,d=me(E),F=r?.nodesRef.current.find(R=>R.id===O)?.context?.elements.floating;F&&(F.style.pointerEvents="");const H=h.pointerEventsScopeElement!==a?h.pointerEventsScopeElement:null,P=F!==a?F:null,v=h.handleCloseOptions?.getScope?.()??H??P??x.closest("[data-rootownerid]")??d.body;return _e(h,{scopeElement:v,referenceElement:x,floatingElement:a}),()=>{g()}}},[t,p,b,E,h,B,r,O,g]),m.useEffect(()=>{if(!t)return;function x(){return!!(r&&O&&Ce(r.nodesRef.current,O).length>0)}function a(R){const M=ve(l,"close",h.pointerType),_=()=>{o.setOpen(!1,$(W,R)),r?.events.emit("floating.closed",R)};M?h.openChangeTimeout.start(M,_):(h.openChangeTimeout.clear(),_())}function d(R){const M=Re(R);if(!We(M)){h.interactedInside=!1;return}h.interactedInside=M?.closest("[aria-haspopup]")!=null}function F(){h.openChangeTimeout.clear(),N.clear(),r?.events.off("floating.closed",P),g()}function H(R){if(x()&&r){r.events.on("floating.closed",P);return}if(we(R.relatedTarget,o.context.triggerElements))return;const M=c.current.floatingContext?.nodeId??i,_=R.relatedTarget;if(!(r&&M&&J(_)&&Ce(r.nodesRef.current,M,!1).some(X=>z(X.context?.elements.floating,_)))){if(h.handler){h.handler(R);return}g(),B()&&!u()&&a(R)}}function P(R){!r||!O||x()||N.start(0,()=>{r.events.off("floating.closed",P),o.setOpen(!1,$(W,R)),r.events.emit("floating.closed",R)})}const v=E;return he(v&&oe(v,"mouseenter",F),v&&oe(v,"mouseleave",H),v&&oe(v,"pointerdown",d,!0),()=>{r?.events.off("floating.closed",P)})},[t,E,o,c,l,i,B,u,g,h,r,O,N])}const zt={current:null};function Qt(e,n={}){const{enabled:t=!0,delay:l=0,handleClose:i=null,mouseOnly:o=!1,restMs:p=0,move:E=!0,triggerElementRef:b=zt,externalTree:c,isActiveTrigger:r=!0,getHandleCloseContext:O,isClosing:h,shouldOpen:N}=n,u="rootStore"in e?e.rootStore:e,{dataRef:B,events:g}=u.context,x=Le(c),a=je(u),d=m.useRef(!1),F=se(i),H=se(l),P=se(p),v=se(t),R=se(N),M=se(h),_=ne(()=>De(B.current.openEvent?.type,a.interactedInside)),G=ne(()=>R.current?.()!==!1),X=ne((s,T,A)=>{const S=u.context.triggerElements;if(S.hasElement(T))return!s||!z(s,T);if(!J(A))return!1;const f=A;return S.hasMatchingElement(L=>z(L,f))&&(!s||!z(s,f))}),j=ne(()=>{if(!a.handler)return;me(u.select("domReferenceElement")).removeEventListener("mousemove",a.handler),a.handler=void 0}),w=ne(()=>{de(a)});return r&&(a.handleCloseOptions=F.current?.__options),m.useEffect(()=>j,[j]),m.useEffect(()=>{if(!t)return;function s(T){T.open?d.current=!1:(d.current=T.reason===W,j(),a.openChangeTimeout.clear(),a.restTimeout.clear(),a.blockMouseMove=!0,a.restTimeoutPending=!1)}return g.on("openchange",s),()=>{g.off("openchange",s)}},[t,g,a,j]),m.useEffect(()=>{if(!t)return;function s(f,L=!0){const D=ve(H.current,"close",a.pointerType);D?a.openChangeTimeout.start(D,()=>{u.setOpen(!1,$(W,f)),x?.events.emit("floating.closed",f)}):L&&(a.openChangeTimeout.clear(),u.setOpen(!1,$(W,f)),x?.events.emit("floating.closed",f))}const T=b.current??(r?u.select("domReferenceElement"):null);if(!J(T))return;function A(f){if(a.openChangeTimeout.clear(),a.blockMouseMove=!1,o&&!Pe(a.pointerType))return;const L=xe(P.current),D=ve(H.current,"open",a.pointerType),Y=Re(f),U=f.currentTarget??null,I=u.select("domReferenceElement");let k=U;if(J(Y)&&!u.context.triggerElements.hasElement(Y)){for(const Ie of u.context.triggerElements.elements())if(z(Ie,Y)){k=Ie;break}}J(U)&&J(I)&&!u.context.triggerElements.hasElement(U)&&z(U,I)&&(k=I);const C=k==null?!1:X(I,k,Y),Q=u.select("open"),Z=M.current?.()??u.select("transitionStatus")==="ending",K=!Q&&Z&&d.current,ee=!C&&J(k)&&J(I)&&z(I,k)&&K,te=L>0&&!D,Ge=C&&(Q||K)||ee,Oe=!Q||C;if(Ge){G()&&u.setOpen(!0,$(W,f,k));return}te||(D?a.openChangeTimeout.start(D,()=>{Oe&&G()&&u.setOpen(!0,$(W,f,k))}):Oe&&G()&&u.setOpen(!0,$(W,f,k)))}function S(f){if(_()){w();return}j();const L=u.select("domReferenceElement"),D=me(L);a.restTimeout.clear(),a.restTimeoutPending=!1;const Y=B.current.floatingContext??O?.();if(we(f.relatedTarget,u.context.triggerElements))return;if(F.current&&Y){u.select("open")||a.openChangeTimeout.clear();const I=b.current;a.handler=F.current({...Y,tree:x,x:f.clientX,y:f.clientY,onClose(){w(),j(),v.current&&!_()&&I===u.select("domReferenceElement")&&s(f,!0)}}),D.addEventListener("mousemove",a.handler),a.handler(f);return}(a.pointerType!=="touch"||!z(u.select("floatingElement"),f.relatedTarget))&&s(f)}return E?he(oe(T,"mousemove",A,{once:!0}),oe(T,"mouseenter",A),oe(T,"mouseleave",S)):he(oe(T,"mouseenter",A),oe(T,"mouseleave",S))},[j,w,B,H,u,t,F,a,r,X,_,o,E,P,b,x,v,O,M,G]),m.useMemo(()=>{if(!t)return;function s(T){a.pointerType=T.pointerType}return{onPointerDown:s,onPointerEnter:s,onMouseMove(T){const{nativeEvent:A}=T,S=T.currentTarget,f=u.select("domReferenceElement"),L=u.select("open"),D=X(f,S,T.target);if(o&&!Pe(a.pointerType))return;if(L&&D&&a.handleCloseOptions?.blockPointerEvents){const I=u.select("floatingElement");if(I){const k=a.handleCloseOptions?.getScope?.()??S.ownerDocument.body;_e(a,{scopeElement:k,referenceElement:S,floatingElement:I})}}const Y=xe(P.current);if(L&&!D||Y===0||!D&&a.restTimeoutPending&&T.movementX**2+T.movementY**2<2)return;a.restTimeout.clear();function U(){if(a.restTimeoutPending=!1,_())return;const I=u.select("open");!a.blockMouseMove&&(!I||D)&&G()&&u.setOpen(!0,$(W,A,S))}a.pointerType==="touch"?ue.flushSync(()=>{U()}):D&&L?U():(a.restTimeoutPending=!0,a.restTimeout.start(Y,U))}}},[t,a,_,X,o,u,P,G])}const Fe=.1,$t=Fe*Fe,y=.5;function ie(e,n,t,l,i,o){return l>=n!=o>=n&&e<=(i-t)*(n-l)/(o-l)+t}function ae(e,n,t,l,i,o,p,E,b,c){let r=!1;return ie(e,n,t,l,i,o)&&(r=!r),ie(e,n,i,o,p,E)&&(r=!r),ie(e,n,p,E,b,c)&&(r=!r),ie(e,n,b,c,t,l)&&(r=!r),r}function Jt(e,n,t){return e>=t.x&&e<=t.x+t.width&&n>=t.y&&n<=t.y+t.height}function ce(e,n,t,l,i,o){const p=Math.min(t,i),E=Math.max(t,i),b=Math.min(l,o),c=Math.max(l,o);return e>=p&&e<=E&&n>=b&&n<=c}function Zt(e={}){const{blockPointerEvents:n=!1}=e,t=new le,l=({x:i,y:o,placement:p,elements:E,onClose:b,nodeId:c,tree:r})=>{const O=p?.split("-")[0];let h=!1,N=null,u=null,B=typeof performance<"u"?performance.now():0;function g(a,d){const F=performance.now(),H=F-B;if(N===null||u===null||H===0)return N=a,u=d,B=F,!1;const P=a-N,v=d-u,R=P*P+v*v,M=H*H*$t;return N=a,u=d,B=F,R<M}function x(){t.clear(),b()}return function(d){t.clear();const F=E.domReference,H=E.floating;if(!F||!H||O==null||i==null||o==null)return;const{clientX:P,clientY:v}=d,R=Re(d),M=d.type==="mouseleave",_=z(H,R),G=z(F,R);if(_&&(h=!0,!M))return;if(G&&(h=!1,!M)){h=!0;return}if(M&&J(d.relatedTarget)&&z(H,d.relatedTarget))return;function X(){return!!(r&&Ce(r.nodesRef.current,c).length>0)}function j(){X()||x()}if(X())return;const w=F.getBoundingClientRect(),s=H.getBoundingClientRect(),T=i>s.right-s.width/2,A=o>s.bottom-s.height/2,S=s.width>w.width,f=s.height>w.height,L=(S?w:s).left,D=(S?w:s).right,Y=(f?w:s).top,U=(f?w:s).bottom;if(O==="top"&&o>=w.bottom-1||O==="bottom"&&o<=w.top+1||O==="left"&&i>=w.right-1||O==="right"&&i<=w.left+1){j();return}let I=!1;switch(O){case"top":I=ce(P,v,L,w.top+1,D,s.bottom-1);break;case"bottom":I=ce(P,v,L,s.top+1,D,w.bottom-1);break;case"left":I=ce(P,v,s.right-1,U,w.left+1,Y);break;case"right":I=ce(P,v,w.right-1,U,s.left+1,Y);break}if(I)return;if(h&&!Jt(P,v,w)){j();return}if(!M&&g(P,v)){j();return}let k=!1;switch(O){case"top":{const C=S?y/2:y*4,Q=S||T?i+C:i-C,Z=S?i-C:T?i+C:i-C,K=o+y+1,ee=T||S?s.bottom-y:s.top,te=T?S?s.bottom-y:s.top:s.bottom-y;k=ae(P,v,Q,K,Z,K,s.left,ee,s.right,te);break}case"bottom":{const C=S?y/2:y*4,Q=S||T?i+C:i-C,Z=S?i-C:T?i+C:i-C,K=o-y,ee=T||S?s.top+y:s.bottom,te=T?S?s.top+y:s.bottom:s.top+y;k=ae(P,v,Q,K,Z,K,s.left,ee,s.right,te);break}case"left":{const C=f?y/2:y*4,Q=f||A?o+C:o-C,Z=f?o-C:A?o+C:o-C,K=i+y+1,ee=A||f?s.right-y:s.left,te=A?f?s.right-y:s.left:s.right-y;k=ae(P,v,ee,s.top,te,s.bottom,K,Q,K,Z);break}case"right":{const C=f?y/2:y*4,Q=f||A?o+C:o-C,Z=f?o-C:A?o+C:o-C,K=i-y,ee=A||f?s.left+y:s.right,te=A?f?s.left+y:s.right:s.left+y;k=ae(P,v,K,Q,K,Z,ee,s.top,te,s.bottom);break}}k?h||t.start(40,j):j()}};return l.__options={...e,blockPointerEvents:n},l}const Ne=m.createContext(void 0);function re(e){const n=m.useContext(Ne);if(n===void 0&&!e)throw new Error(pe(47));return n}function en(){return{...Dt(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}const tn={...Bt,disabled:q(e=>e.disabled),instantType:q(e=>e.instantType),openMethod:q(e=>e.openMethod),openChangeReason:q(e=>e.openChangeReason),modal:q(e=>e.modal),focusManagerModal:q(e=>e.focusManagerModal),stickIfOpen:q(e=>e.stickIfOpen),titleElementId:q(e=>e.titleElementId),descriptionElementId:q(e=>e.descriptionElementId),openOnHover:q(e=>e.openOnHover),closeDelay:q(e=>e.closeDelay),hasViewport:q(e=>e.hasViewport)};class be extends qe{constructor(n,t,l=!1){const i={...en(),...n},o=new pt;i.open&&n?.mounted===void 0&&(i.mounted=!0),i.floatingRootContext=Ht(o,t,l),super(i,{popupRef:m.createRef(),backdropRef:m.createRef(),internalBackdropRef:m.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:m.createRef(),beforeContentFocusGuardRef:m.createRef(),stickIfOpenTimeout:new le,triggerElements:o},tn)}setOpen=(n,t)=>{const l=t.reason===W,i=t.reason===Ee&&t.event.detail===0,o=!n&&(t.reason===ze||t.reason==null),p=gt(t),E=this.select("activeTriggerId");if(!n&&t.reason===Qe&&t.trigger==null&&E!=null&&(t.trigger=this.context.triggerElements.getById(E)??this.select("activeTriggerElement")??void 0),this.context.onOpenChange?.(n,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(n,t);const b=()=>{const c={open:n,openChangeReason:t.reason};ht(c,n,t.trigger,p()),this.update(c)};l?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start($e,()=>{this.set("stickIfOpen",!1)}),ue.flushSync(b)):b(),i||o?this.set("instantType",i?"click":"dismiss"):t.reason===Te?this.set("instantType","focus"):this.set("instantType",void 0)};static useStore(n,t){const{store:l,internalStore:i}=mt(n,(o,p)=>new be(t,o,p));return m.useEffect(()=>i?.disposeEffect(),[i]),l}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()}function ke({props:e}){const{children:n,open:t,defaultOpen:l=!1,onOpenChange:i,onOpenChangeComplete:o,modal:p=!1,handle:E,triggerId:b,defaultTriggerId:c=null}=e,r=be.useStore(E?.store,{modal:p,open:l,openProp:t,activeTriggerId:c,triggerIdProp:b});Tt(r,t,l,c),r.useControlledProp("openProp",t),r.useControlledProp("triggerIdProp",b);const O=r.useState("open"),h=r.useState("mounted"),N=r.useState("payload"),u=He()!=null;r.useContextCallback("onOpenChange",i),r.useContextCallback("onOpenChangeComplete",o),Pt(r,O),Ct(r);const{forceUnmount:B}=vt(O,r,()=>{r.update({stickIfOpen:!0,openChangeReason:null})});r.useSyncedValues({modal:p,nested:u}),m.useEffect(()=>{O||r.context.stickIfOpenTimeout.clear()},[r,O]);const g=m.useCallback(()=>{r.setOpen(!1,$(Je))},[r]);m.useImperativeHandle(e.actionsRef,()=>({unmount:B,close:g}),[B,g]);const x=O||h,a=m.useMemo(()=>({store:r}),[r]);return V.jsxs(Ne.Provider,{value:a,children:[x&&V.jsx(nn,{store:r,modal:p}),typeof n=="function"?n({payload:N}):n]})}function hn(e){return re(!0)?V.jsx(ke,{props:e}):V.jsx(Et,{children:V.jsx(ke,{props:e})})}function nn({store:e,modal:n}){const t=e.useState("floatingRootContext"),l=Rt(t,{outsidePressEvent:{mouse:n==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),i=l.reference??Me,o=l.trigger??Me,p=m.useMemo(()=>Ze(Be,l.floating),[l.floating]);return St(e,{activeTriggerProps:i,inactiveTriggerProps:o,popupProps:p}),null}const on=300;function sn(e,n){const t=m.useRef(null);function l(o){ue.flushSync(()=>{e.setOpen(!1,$(Te,o.nativeEvent,o.currentTarget))}),ot(t.current)?.focus()}function i(o){const p=e.select("positionerElement");if(p&&et(o,p))e.context.beforeContentFocusGuardRef.current?.focus();else{ue.flushSync(()=>{e.setOpen(!1,$(Te,o.nativeEvent,o.currentTarget))});let E=tt(e.context.triggerFocusTargetRef.current||n.current);for(;E!==null&&z(p,E);){const b=E;if(E=nt(E),E===b)break}E?.focus()}}return{preFocusGuardRef:t,handlePreFocusGuardFocus:l,handleFocusTargetFocus:i}}const En=m.forwardRef(function(n,t){const{render:l,className:i,style:o,disabled:p=!1,nativeButton:E=!0,handle:b,payload:c,openOnHover:r=!1,delay:O=on,closeDelay:h=0,id:N,...u}=n,B=re(!0),g=b?.store??B?.store;if(!g)throw new Error(pe(74));const x=bt(N),a=g.useState("isTriggerActive",x),d=g.useState("floatingRootContext"),F=g.useState("isOpenedByTrigger",x),H=g.useState("triggerPopupId",x),P=m.useRef(null),{registerTrigger:v,isMountedByThisTrigger:R}=Ot(x,P,g,{payload:c,disabled:p,openOnHover:r,closeDelay:h}),M=g.useState("openChangeReason"),_=g.useState("stickIfOpen"),G=g.useState("openMethod"),X=g.useState("focusManagerModal"),j=Qt(d,{enabled:!p&&d!=null&&r&&(G!=="touch"||M!==Ee),mouseOnly:!0,move:!1,handleClose:Zt(),restMs:O,delay:{close:h},triggerElementRef:P,isActiveTrigger:a,isClosing:()=>g.select("transitionStatus")==="ending"}),w=_t(d,{enabled:d!=null,stickIfOpen:_}),s=jt(()=>g.select("open"),k=>{g.set("openMethod",k)}),T=g.useState("triggerProps",R),{getButtonProps:A,buttonRef:S}=st({disabled:p,native:E}),f={open(k){return k&&M===Ee?It.open(k):Mt.open(k)}},{preFocusGuardRef:L,handlePreFocusGuardFocus:D,handleFocusTargetFocus:Y}=sn(g,P),I=Ae("button",n,{state:{disabled:p,open:F},ref:[S,t,v,P],props:[w.reference,j,T,s,{[rt]:"",id:x,"aria-haspopup":"dialog","aria-expanded":F,"aria-controls":H},u,A],stateAttributesMapping:f});return R&&!X?V.jsxs(m.Fragment,{children:[V.jsx(ye,{ref:L,onFocus:D}),V.jsx(m.Fragment,{children:I},x),V.jsx(ye,{ref:g.context.triggerFocusTargetRef,onFocus:Y})]}):V.jsx(m.Fragment,{children:I},x)}),Ve=m.createContext(void 0);function rn(){const e=m.useContext(Ve);if(e===void 0)throw new Error(pe(45));return e}const Tn=m.forwardRef(function(n,t){const{keepMounted:l=!1,...i}=n,{store:o}=re();return o.useState("mounted")||l?V.jsx(Ve.Provider,{value:l,children:V.jsx(it,{ref:t,...i})}):null}),Ye=m.createContext(void 0);function an(){const e=m.useContext(Ye);if(!e)throw new Error(pe(46));return e}const Pn=m.forwardRef(function(n,t){const{render:l,className:i,style:o,anchor:p,positionMethod:E="absolute",side:b="bottom",align:c="center",sideOffset:r=0,alignOffset:O=0,collisionBoundary:h="clipping-ancestors",collisionPadding:N=5,arrowPadding:u=5,sticky:B=!1,disableAnchorTracking:g=!1,collisionAvoidance:x=at,...a}=n,{store:d}=re(),F=rn(),H=yt(),P=d.useState("floatingRootContext"),v=d.useState("mounted"),R=d.useState("open"),M=d.useState("openChangeReason"),_=d.useState("activeTriggerElement"),G=d.useState("modal"),X=d.useState("openMethod"),j=d.useState("positionerElement"),w=d.useState("instantType"),s=d.useState("transitionStatus"),T=d.useState("hasViewport"),A=m.useRef(null),S=ct(j,!1,!1),f=Nt({anchor:p,floatingRootContext:P,positionMethod:E,mounted:v,side:b,sideOffset:r,align:c,alignOffset:O,arrowPadding:u,collisionBoundary:h,collisionPadding:N,sticky:B,disableAnchorTracking:g,keepMounted:F,nodeId:H,collisionAvoidance:x,adaptiveOrigin:T?Gt:void 0}),L=P.useState("domReferenceElement");ge(()=>{const I=L,k=A.current;if(I&&(A.current=I),k&&I&&I!==k){d.set("instantType",void 0);const C=new AbortController;return S(()=>{d.set("instantType","trigger-change")},C.signal),()=>{C.abort()}}},[L,S,d]),Vt(R&&G===!0&&M!==W,X==="touch",j,_);const D=m.useCallback(I=>{d.set("positionerElement",I)},[d]),Y={open:R,side:f.side,align:f.align,anchorHidden:f.anchorHidden,instant:w},U=Yt(n,Y,{styles:f.positionerStyles,transitionStatus:s,props:a,refs:[t,D],hidden:!v,inert:!R});return V.jsxs(Ye.Provider,{value:f,children:[v&&G===!0&&M!==W&&V.jsx(xt,{ref:d.context.internalBackdropRef,inert:lt(!R),cutout:_}),V.jsx(Ft,{id:H,children:U})]})}),cn=m.createContext(void 0);function ln(){const[e,n]=m.useState(0),t=ne(()=>(n(i=>i+1),()=>{n(i=>Math.max(0,i-1))}));return{context:m.useMemo(()=>({register:t}),[t]),hasClosePart:e>0}}function un(e){const{value:n,children:t}=e;return V.jsx(cn.Provider,{value:n,children:t})}const fn={...Lt,...dt},Cn=m.forwardRef(function(n,t){const{render:l,className:i,style:o,initialFocus:p,finalFocus:E,...b}=n,{store:c}=re(),r=an(),O=Xt()!=null,{context:h,hasClosePart:N}=ln(),u=c.useState("open"),B=c.useState("openMethod"),g=c.useState("instantType"),x=c.useState("transitionStatus"),a=c.useState("popupProps"),d=c.useState("titleElementId"),F=c.useState("descriptionElementId"),H=c.useState("modal"),P=c.useState("mounted"),v=c.useState("openChangeReason"),R=c.useState("activeTriggerElement"),M=c.useState("floatingRootContext"),_=M.useState("floatingId"),G=c.useState("disabled"),X=c.useState("openOnHover"),j=c.useState("closeDelay"),w=b.id??_;ut({open:u,ref:c.context.popupRef,onComplete(){u&&c.context.onOpenChangeComplete?.(!0)}}),qt(M,{enabled:X&&!G,closeDelay:j});const s=p===void 0?kt(c.context.popupRef):p,T=H!==!1&&N;c.useSyncedValue("focusManagerModal",T);const A=m.useCallback(L=>{c.set("popupElement",L)},[c]),S={open:u,side:r.side,align:r.align,instant:g,transitionStatus:x},f=Ae("div",n,{state:S,ref:[t,c.context.popupRef,A],props:[a,{id:w,role:"dialog",...Be,"aria-labelledby":d,"aria-describedby":F,onKeyDown(L){O&&At.has(L.key)&&L.stopPropagation()}},Ut(x),b],stateAttributesMapping:fn});return V.jsx(wt,{context:M,openInteractionType:B,modal:T,disabled:!P||v===W,initialFocus:s,returnFocus:E,restoreFocus:"popup",previousFocusableElement:ft(R)?R:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:V.jsx(un,{value:h,children:f})})});export{hn as P,En as a,Tn as b,Pn as c,Cn as d};
import{l as Ne,r as i,j as e,c as o,Y as Ie,aa as He,a3 as Ge,X as Oe,a1 as qe,m as Ke}from"./__vite-browser-external-CuMc3dqk.js";import{u as Ze}from"./useCurrency-DdWYV5RR.js";import{u as Ee}from"./useTokenFormat-BkFEXBXZ.js";import{M as Ve}from"./maximize-2-BZX57ABx.js";import{T as Je}from"./terminal-d0IOaeZn.js";import{I as Qe}from"./info-CDTfOJ13.js";const et=[["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"}]],tt=Ne("pause",et);const at=[["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"}]],rt=Ne("play",at);const ot=[["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"}]],nt=Ne("rotate-ccw",ot),ae={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 st(l,u){const h=/^#([0-9a-f]{6})$/i.exec(l);if(!h)return l;const c=parseInt(h[1],16),b=c>>16&255,Y=c>>8&255,D=c&255,R=$=>Math.max(0,Math.min(255,Math.round($*u)));return`rgb(${R(b)}, ${R(Y)}, ${R(D)})`}function q(l,u,h,c,b){const Y=Math.cos(c),D=Math.sin(c),R=l*Y-u*D,$=l*D+u*Y,S=h,E=Math.cos(b),A=Math.sin(b),K=R,p=$*E-S*A,v=$*A+S*E;return{x:K,y:p,z:v}}function lt(l,u,h,c,b){return q(l,u,h,c,b)}function Se(l,u,h=c=>Number(c).toLocaleString()){const c=h(u);if(l>=4){const b=Math.floor(Math.random()*3)+1;return o(`heatmap.3d.voxel.joke.${b}`,{value:c})}else return l===3?o("heatmap.3d.voxel.level3",{value:c}):l===2?o("heatmap.3d.voxel.level2",{value:c}):l===1?o("heatmap.3d.voxel.level1",{value:c}):o("heatmap.3d.voxel.level0")}function Ae({weeks:l,palette:u="auto",isDark:h=!1,interactive:c=!1,autoRotateInit:b=!1,onResetViewRef:Y=null}){const{formatTokens:D,formatTokensTooltip:R}=Ee(),$=ae[u]||(u==="auto"?ae.emerald:null),S=$?h?$.dark:$.light:Array.isArray(u)?u:h?ae.emerald.dark:ae.emerald.light,E=$?h?$.gridColor.dark:$.gridColor.light:h?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",A=-.2,K=.88,[p,v]=i.useState({yaw:A,pitch:K}),[le,Z]=i.useState(b),[he,L]=i.useState(1),j=c?13:10.5,fe=i.useMemo(()=>{const t=[],r=l.length;if(r===0||!c)return[];for(let n=0;n<=7;n++){const s=(n-3.5)*j,d=q(-r/2*j,s,0,p.yaw,p.pitch),x=q(r/2*j,s,0,p.yaw,p.pitch);t.push({d:`M${d.x},${d.y} L${x.x},${x.y}`,key:`horiz-${n}`})}for(let n=0;n<=r;n+=4){const s=(n-r/2)*j,d=q(s,-3.5*j,0,p.yaw,p.pitch),x=q(s,3.5*j,0,p.yaw,p.pitch);t.push({d:`M${d.x},${d.y} L${x.x},${x.y}`,key:`vert-${n}`})}if(r%4!==0){const n=(r-r/2)*j,s=q(n,-3.5*j,0,p.yaw,p.pitch),d=q(n,3.5*j,0,p.yaw,p.pitch);t.push({d:`M${s.x},${s.y} L${d.x},${d.y}`,key:"vert-last"})}return t},[l.length,p,j,c]);i.useEffect(()=>{Y&&(Y.current={reset:()=>{v({yaw:A,pitch:K}),Z(!1),L(1),be()},toggleAutoRotate:t=>{Z(t)}})},[Y]);const V=i.useRef(null),I=i.useRef(null),B=i.useRef(!1),ie=i.useRef({x:0,y:0}),J=i.useRef({yaw:A,pitch:K}),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),Q=i.useRef(null),se=i.useRef(!0);i.useEffect(()=>(se.current=!0,()=>{se.current=!1}),[]);const be=()=>{Q.current&&cancelAnimationFrame(Q.current),ye(0);const t=performance.now(),r=1200,n=s=>{if(!se.current)return;const d=s-t,x=Math.min(1,d/r),C=1-Math.pow(1-x,3);ye(C),x<1?Q.current=requestAnimationFrame(n):Q.current=null};Q.current=requestAnimationFrame(n)};i.useEffect(()=>(be(),()=>{Q.current&&cancelAnimationFrame(Q.current)}),[c]),i.useEffect(()=>{if(!le||B.current||typeof window>"u"||typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;let r;const n=()=>{if(typeof document<"u"&&document.visibilityState==="hidden"){r=requestAnimationFrame(n);return}v(s=>({yaw:s.yaw+.002,pitch:s.pitch})),r=requestAnimationFrame(n)};return r=requestAnimationFrame(n),()=>cancelAnimationFrame(r)},[le]);const ce=(t,r)=>{c&&(B.current=!0,ie.current={x:t,y:r},J.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(!B.current)return;const n=t-ie.current.x,s=r-ie.current.y,d=performance.now(),x=d-oe.current.time;x>0&&(U.current={x:(t-oe.current.x)/x,y:(r-oe.current.y)/x}),oe.current={x:t,y:r,time:d};const C=.005,T=J.current.yaw-n*C,k=Math.PI/2.3,y=Math.max(-k,Math.min(k,J.current.pitch-s*C));v({yaw:T,pitch:y})},ve=()=>{if(!B.current)return;B.current=!1;let t=-U.current.x*12,r=-U.current.y*12;const n=.95,s=()=>{B.current||(t*=n,r*=n,!(Math.abs(t)<.01&&Math.abs(r)<.01)&&(v(d=>{const x=d.yaw+t*.005,C=Math.PI/2.3,T=Math.max(-C,Math.min(C,d.pitch+r*.005));return{yaw:x,pitch:T}}),ne.current=requestAnimationFrame(s)))};ne.current=requestAnimationFrame(s)},[f,de]=i.useState(null),[ee,ue]=i.useState({x:0,y:0,shiftX:0}),g=i.useRef(null);i.useEffect(()=>()=>{g.current&&clearTimeout(g.current)},[]),i.useEffect(()=>{if(!c||!I.current)return;const t=n=>{n.preventDefault();const s=-n.deltaY*.0025;L(d=>{const x=d+s;return Math.max(.5,Math.min(3,x))})},r=I.current;return r.addEventListener("wheel",t,{passive:!1}),()=>{r.removeEventListener("wheel",t)}},[c]);const _=i.useMemo(()=>{const t=[];return l.forEach((r,n)=>{(Array.isArray(r)?r:[]).forEach((s,d)=>{s&&t.push({key:s.day||`${n}-${d}`,col:n,row:d,level:s.level||0,value:s.value||0,day:s.day,models:s.models||null})})}),t},[l]),pe=j-(c?1.8:1.5),ke=c?38:28,we=t=>Math.max(1.8,Number(t)/4*ke),te=i.useMemo(()=>{if(_.length===0)return[];const t=l.length;return _.map(r=>{const n=we(r.level),s=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)),x=s/d*.4,C=Math.min(1,Math.max(0,(ge-x)*(1/.6))),T=n*C,k=(r.col-t/2)*j,y=(r.row-3.5)*j,w=pe/2,G=[{x:k-w,y:y-w,z:0},{x:k+w,y:y-w,z:0},{x:k+w,y:y+w,z:0},{x:k-w,y:y+w,z:0},{x:k-w,y:y-w,z:T},{x:k+w,y:y-w,z:T},{x:k+w,y:y+w,z:T},{x:k-w,y:y+w,z:T}].map(W=>q(W.x,W.y,W.z,p.yaw,p.pitch)),xe=q(k,y,T/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=S[Math.min(4,Math.max(0,Number(r.level)||0))],ze=[],Ye=.35,De=-.4,Ue=.83;return Le.forEach(W=>{const je=lt(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`,Fe=je.x*Ye+je.y*De+je.z*Ue,We=h?.18:0,Be=W.scale*(.82+.28*Math.max(0,Fe))+We;ze.push({name:W.name,d:Xe,fill:st(Pe,Be)})}}),{...r,centerProj:xe,renderedFaces:ze}})},[_,p,S,l.length,ge,j,pe,ke]),O=i.useMemo(()=>[...te].sort((t,r)=>t.centerProj.z-r.centerProj.z),[te]),M=i.useMemo(()=>{if(O.length===0)return{minX:-100,minY:-100,maxX:100,maxY:100};let t=1/0,r=1/0,n=-1/0,s=-1/0;return O.forEach(d=>{const x=j*2,C=d.centerProj.x,T=d.centerProj.y;C-x<t&&(t=C-x),C+x>n&&(n=C+x),T-x<r&&(r=T-x),T+x>s&&(s=T+x)}),{minX:t,minY:r,maxX:n,maxY:s}},[O,j]),P=12,me=M.maxX-M.minX+P*2,a=M.maxY-M.minY+P*2,m=me/he,z=a/he,N=M.minX-P+(me-m)/2,F=M.minY-P+(a-z)/2,H=`${N} ${F} ${m} ${z}`;return _.length===0?e.jsx("div",{className:"py-8 text-center text-sm text-oai-gray-500",children:o("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;ce(t.clientX,t.clientY);const r=s=>X(s.clientX,s.clientY),n=()=>{ve(),window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",n)};window.addEventListener("mousemove",r),window.addEventListener("mouseup",n)},onTouchStart:t=>{!c||t.touches.length===0||ce(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:V,viewBox:H,width:c?"95%":"100%",height:c?"95%":"auto",role:"img","aria-label":o("heatmap.iso.aria")||"3D interactive activity heatmap",style:{display:"block",width:"100%",height:"auto",maxWidth:c?"none":`${me}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:E,strokeWidth:.25,strokeDasharray:"1.5 2.5",strokeLinecap:"round"},t.key)),O.map(t=>{const r=f&&f.key===t.key;return e.jsxs("g",{onMouseEnter:n=>{if(g.current&&(clearTimeout(g.current),g.current=null),de(t),c&&V.current){const s=q((t.col-l.length/2)*j,(t.row-3.5)*j,we(t.level),p.yaw,p.pitch);let d=0,x=0;const C=V.current;if(I.current&&typeof C.createSVGPoint=="function"&&typeof C.getScreenCTM=="function")try{const w=C.createSVGPoint();w.x=s.x,w.y=s.y;const re=C.getScreenCTM();if(re){const G=w.matrixTransform(re),xe=I.current.getBoundingClientRect();d=G.x-xe.left,x=G.y-xe.top}}catch{const re=C.getBoundingClientRect(),G=M.maxX-M.minX+P*2,xe=M.maxY-M.minY+P*2;d=(s.x-(M.minX-P))/G*re.width,x=(s.y-(M.minY-P))/xe*re.height}else{const w=C.getBoundingClientRect(),re=M.maxX-M.minX+P*2,G=M.maxY-M.minY+P*2;d=(s.x-(M.minX-P))/re*w.width,x=(s.y-(M.minY-P))/G*w.height}const T=140;let k=0;const y=I.current?I.current.getBoundingClientRect().width:C.getBoundingClientRect().width;d<T?k=T-d:d>y-T&&(k=y-T-d),ue({x:d,y:x,shiftX:k})}},onMouseLeave:()=>{g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{de(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:o("heatmap.tooltip.tokens",{day:t.day,value:R(t.value)})}),t.renderedFaces.map((n,s)=>e.jsx("path",{d:n.d,fill:n.fill,stroke:n.fill,strokeWidth:.25,strokeLinejoin:"round"},s))]},t.key)})]}),c&&f&&e.jsxs("div",{onMouseEnter:()=>{g.current&&(clearTimeout(g.current),g.current=null)},onMouseLeave:()=>{g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{de(null)},150)},className:"absolute z-[9999] w-0 h-0 transition-all duration-100 ease-out",style:{left:`${ee.x}px`,top:`${ee.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% + ${ee.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:f.day}),(()=>{const t=f.level===0?h?"#9ca3af":"#6b7280":S[f.level];return e.jsx("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:o("heatmap.tooltip.level",{level:f.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(f.value),className:"text-lg font-bold text-oai-gray-900 dark:text-white leading-none",children:D(f.value)}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 uppercase tracking-wider font-semibold",children:o("heatmap.unit.tokens")})]}),f.models&&Object.keys(f.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:o("heatmap.tooltip.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(f.models).map(([t,r])=>({name:t,val:Number(r)})).sort((t,r)=>r.val-t.val).map(({name:t,val:r})=>{const n=Number(f.value)||1,s=Math.round(r/n*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:D(r)}),e.jsxs("span",{className:"text-[9px] text-oai-gray-450 dark:text-oai-gray-500 min-w-[28px] text-right font-medium",children:[s,"%"]})]})]}),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:`${s}%`,backgroundColor:S[4],boxShadow:`0 0 4px ${S[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:Se(f.level,f.value,D)})]})]}),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 it=12,ct=3,dt=26,mt=["#ebedf0","#a7f3d0","#6ee7b7","#34d399","#10b981"],xt=["#121212","#065f46","#059669","#10b981","#34d399"];function ut(l){if(typeof l!="string")return null;const u=/^(\d{4})-(\d{2})-(\d{2})$/.exec(l.trim());if(!u)return null;const h=new Date(Date.UTC(Number(u[1]),Number(u[2])-1,Number(u[3])));return Number.isFinite(h.getTime())?h:null}function Re(l,u){return new Date(Date.UTC(l.getUTCFullYear(),l.getUTCMonth(),l.getUTCDate()+u))}function pt(l,u){return Math.floor((Date.UTC(u.getUTCFullYear(),u.getUTCMonth(),u.getUTCDate())-Date.UTC(l.getUTCFullYear(),l.getUTCMonth(),l.getUTCDate()))/864e5)}function ht(l,u){const h=u==="mon"?1:0,c=l.getUTCDay();return Re(l,-((c-h+7)%7))}function ft(l,u,h,c){if(!l)return[];const b=ut(u)||new Date,Y=[];for(let E=11;E>=0;E-=1)Y.push(new Date(Date.UTC(b.getUTCFullYear(),b.getUTCMonth()-E,1)));const D=ht(b,h),R=Re(D,-(l-1)*7),$=[],S=new Set;for(const E of Y){const A=Math.floor(pt(R,E)/7);A<0||A>=l||S.has(A)||(S.add(A),$.push({label:c[E.getUTCMonth()],index:A}))}return $}function Ct({heatmap:l,timeZoneLabel:u,timeZoneShortLabel:h,hideLegend:c=!1,embedded:b=!1}){const{resolvedTheme:Y}=Ie(),{currency:D,rate:R}=Ze(),{formatTokens:$,formatTokensTooltip:S}=Ee(),E=Y==="dark",A=E?xt:mt,K=i.useRef(null),p=i.useRef(null),[v,le]=i.useState(null),[Z,he]=i.useState({x:0,y:0,shiftX:0,flipY:!1}),L=i.useRef(null);i.useEffect(()=>()=>{L.current&&clearTimeout(L.current)},[]);const[j,fe]=i.useState(!1),[V,I]=i.useState(!1),[B,ie]=i.useState(!1),J=i.useRef(null),[U,oe]=i.useState("emerald"),ne=[o("heatmap.month.jan"),o("heatmap.month.feb"),o("heatmap.month.mar"),o("heatmap.month.apr"),o("heatmap.month.may"),o("heatmap.month.jun"),o("heatmap.month.jul"),o("heatmap.month.aug"),o("heatmap.month.sep"),o("heatmap.month.oct"),o("heatmap.month.nov"),o("heatmap.month.dec")],ge=(a,m)=>{if(!m||!m.day)return;L.current&&(clearTimeout(L.current),L.current=null),le(m);const z=a.currentTarget.getBoundingClientRect(),N=typeof window<"u"?window.innerWidth:1024,F=z.left+z.width/2,H=z.top<300,t=H?z.bottom:z.top,r=140;let n=0;F<r?n=r-F:F>N-r&&(n=N-r-F),he({x:F,y:t,shiftX:n,flipY:H})},ye=()=>{L.current&&clearTimeout(L.current),L.current=setTimeout(()=>{le(null)},150)},Q=()=>{I(!1),fe(!0)},se=()=>{I(!0)},be=a=>{a.target===a.currentTarget&&V&&(fe(!1),I(!1))};i.useEffect(()=>{if(!j||V)return;const a=m=>{m.key==="Escape"&&se()};return window.addEventListener("keydown",a),()=>{window.removeEventListener("keydown",a)}},[j,V]);const ce=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=ce[U]||ce.emerald,ve=ae[U]?E?ae[U].dark:ae[U].light:E?ae.emerald.dark:ae.emerald.light,[f,de]=i.useState(()=>{if(b)return"2d";try{return window.localStorage?.getItem("tt:heatmap-view")==="3d"?"3d":"2d"}catch{return"2d"}});i.useEffect(()=>{if(!b)try{window.localStorage?.setItem("tt:heatmap-view",f)}catch{}},[f,b]),i.useEffect(()=>{if(f!=="2d")return;const a=K.current;a&&(a.scrollLeft=a.scrollWidth)},[l?.weeks,f]),i.useEffect(()=>{const a=K.current;if(!a)return;const m=()=>{L.current&&(clearTimeout(L.current),L.current=null),le(null)};return a.addEventListener("scroll",m),()=>a.removeEventListener("scroll",m)},[]);const ee=l?.week_starts_on==="mon"?"mon":"sun",ue=i.useMemo(()=>{const a=Array.isArray(l?.weeks)?l.weeks:[];if(!a.length)return{weeks:[]};const m=[];for(const z of a)for(const N of Array.isArray(z)?z:[])N?.day&&m.push({day:N.day,total_tokens:N.total_tokens??N.value??0,billable_total_tokens:N.billable_total_tokens??N.value??N.total_tokens??0,models:N.models??null});return He({dailyRows:m,weeks:Math.max(52,a.length),to:l?.to,weekStartsOn:ee})},[l?.to,l?.weeks,ee]),g=ue?.weeks||[],_=i.useMemo(()=>{let a=0,m=0,z={day:null,value:0},N=0,F=0;const H=[];g.forEach(k=>{(Array.isArray(k)?k:[]).forEach(y=>{y&&y.day&&H.push(y)})}),H.sort((k,y)=>k.day.localeCompare(y.day)),H.forEach(k=>{const y=Number(k.value)||0;a+=y,y>0?(m++,N++,N>F&&(F=N)):N=0,y>z.value&&(z={day:k.day,value:y})});const t=H.length||365,r=(m/t*100).toFixed(1);let n="heatmap.3d.modal.ai.eval.default",s="heatmap.3d.modal.ai.title.default";a>=15e6?(s="heatmap.3d.modal.ai.title.peak",n="heatmap.3d.modal.ai.eval.peak"):a>=5e6?(s="heatmap.3d.modal.ai.title.heavy",n="heatmap.3d.modal.ai.eval.heavy"):a>=1e6?(s="heatmap.3d.modal.ai.title.core",n="heatmap.3d.modal.ai.eval.core"):a>=2e4&&(s="heatmap.3d.modal.ai.title.steady",n="heatmap.3d.modal.ai.eval.steady");const d=l?.total_cost_usd,x=Number(d),T=d!=null&&(typeof d!="string"||d.trim()!=="")&&Number.isFinite(x)?x:a/15e5;return{totalTokens:a,activeDays:m,activeRate:r,maxSingleDay:z,maxStreak:F,aiEvaluationTitleKey:s,aiEvaluationKey:n,totalCostUsd:T}},[g,l?.total_cost_usd]),Ce=i.useMemo(()=>Ge(_.totalCostUsd,{currency:D,rate:R}),[_.totalCostUsd,D,R]),pe=a=>$(a,{mode:Ke.COMPACT,decimals:2}),ke=ee==="mon"?["Mon","Tue","Wed","Thu","Fri","Sat","Sun"].map(a=>o(`heatmap.day.${a.toLowerCase()}`)):["Sun","Mon","Tue","Wed","Thu","Fri","Sat"].map(a=>o(`heatmap.day.${a.toLowerCase()}`)),we=i.useMemo(()=>ft(g.length,ue?.to,ee,ne),[ue?.to,g.length,ee,ne]);if(!g.length)return e.jsx("div",{className:"py-8 text-center text-sm text-oai-gray-500",children:o("heatmap.empty")});const te=b?10:it,O=b?2:ct,M=b?22:dt,P=M+g.length*te+Math.max(0,g.length-1)*O,me=`${M}px repeat(${g.length}, ${te}px)`;return e.jsxs("div",{ref:p,className:b?"relative":"relative rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-5",children:[!b&&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:o("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":f==="2d",onClick:()=>de("2d"),className:f==="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:o("heatmap.view.2d")}),e.jsx("button",{type:"button",role:"tab","aria-selected":f==="3d",onClick:()=>de("3d"),className:f==="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:o("heatmap.view.3d")})]}),e.jsx("span",{className:"text-xs text-oai-gray-400 dark:text-oai-gray-450",children:h||o("heatmap.legend.utc")})]})]}),f==="3d"&&e.jsxs("div",{onClick:Q,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:o("heatmap.3d.hover_tip"),children:[e.jsx(Ae,{weeks:g,isDark:E,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(Ve,{size:9}),o("heatmap.3d.hover_tip")]})})]}),f==="2d"&&e.jsx("div",{ref:K,className:`overflow-x-auto overflow-y-hidden heatmap-scroll-thin${b?"":" pb-1"}`,children:e.jsxs("div",{style:{minWidth:P},children:[e.jsxs("div",{className:"grid text-[10px] uppercase text-oai-gray-400 dark:text-oai-gray-400 mb-1",style:{gridTemplateColumns:me,columnGap:O},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:me,columnGap:O},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, ${te}px)`,rowGap:O},children:ke.map(a=>e.jsx("span",{className:"leading-none",children:a},a))}),e.jsx("div",{className:"grid",style:{gridAutoFlow:"column",gridTemplateRows:`repeat(7, ${te}px)`,gap:O},children:g.map((a,m)=>(Array.isArray(a)?a:[]).map((z,N)=>{if(!z)return null;const F=z.day||`e-${m}-${N}`,H=Number(z.level)||0,t=A[H]||A[0];return e.jsx("span",{onMouseEnter:r=>ge(r,z),onMouseLeave:ye,className:"rounded-[2px] transition-transform hover:scale-125 hover:z-10 cursor-pointer",style:{width:te,height:te,background:t}},F)}))})]})]})}),!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:o("heatmap.legend.less")}),e.jsx("div",{className:"flex gap-0.5",children:A.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:o("heatmap.legend.more")})]}),j&&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 ${V?"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 ${V?"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:o("heatmap.3d.modal.eyebrow")})]}),e.jsx("h4",{className:"text-xl font-black text-zinc-900 dark:text-zinc-50 tracking-tight leading-none mt-2 select-none",children:o("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:o("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:o("heatmap.3d.modal.stats.precision_total_tokens")}),e.jsxs("span",{className:"mt-0.5 font-bold text-zinc-900 dark:text-zinc-50",children:[S(_.totalTokens)," ",o("heatmap.unit.tokens")]})]})}),e.jsx("span",{className:"text-[9px] font-bold text-zinc-400 dark:text-zinc-500 uppercase tracking-widest font-mono",children:o("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:pe(_.totalTokens)}),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:o("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:o("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:[_.activeRate,"%"," ",e.jsxs("span",{className:"text-[10px] font-bold text-zinc-400 dark:text-zinc-500 font-mono",children:["(",_.activeDays,o("heatmap.3d.modal.stats.days_suffix"),")"]})]})]}),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:o("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:[_.maxStreak," ",e.jsx("span",{className:"text-[10px] font-bold text-amber-500/80 font-mono",children:o("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:o("heatmap.3d.modal.stats.precision_peak_value")}),e.jsx("span",{className:"mt-0.5 font-bold text-zinc-900 dark:text-zinc-50",children:_.maxSingleDay.value>0?`${S(_.maxSingleDay.value)} ${o("heatmap.unit.tokens")}`:o("heatmap.3d.modal.stats.no_data")}),e.jsx("span",{className:"text-[8px] text-zinc-400 dark:text-zinc-500 mt-0.5",children:_.maxSingleDay.day||o("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:o("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:[_.maxSingleDay.value>0?pe(_.maxSingleDay.value):o("heatmap.3d.modal.stats.no_data")," ",e.jsxs("span",{className:"text-[10px] font-bold text-zinc-400 dark:text-zinc-500 font-mono",children:["(",_.maxSingleDay.day||o("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(Je,{size:11,style:{color:X.rawColor}}),e.jsx("span",{className:"text-[9px] font-extrabold uppercase tracking-widest font-mono",style:{color:X.rawColor},children:o(_.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:o(_.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:o("heatmap.3d.modal.legend.title")}),e.jsx("span",{className:"text-[10px] font-medium text-zinc-500 dark:text-zinc-400",children:o(`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:o("heatmap.tooltip.level",{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(ce).map(a=>{const m=U===a;return e.jsx("button",{type:"button",onClick:()=>oe(a),title:o(`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=!B;ie(a),J.current&&J.current.toggleAutoRotate(a)},title:B?o("heatmap.3d.modal.control.pause"):o("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 ${B?X.accentText:"text-oai-gray-400 hover:text-oai-gray-600 dark:hover:text-oai-gray-250"}`,children:B?e.jsx(tt,{size:12}):e.jsx(rt,{size:12})}),e.jsx("button",{type:"button",onClick:()=>{ie(!1),J.current&&J.current.reset()},title:o("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(nt,{size:12})})]})]}),e.jsx(Ae,{weeks:g,isDark:E,interactive:!0,palette:U,autoRotateInit:B,onResetViewRef:J}),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(Qe,{size:10,className:X.accentText}),e.jsx("span",{children:o("heatmap.3d.modal.footer.tip")})]})]})]})}),v&&!j&&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:`${Z.x}px`,top:`${Z.y}px`},children:[e.jsxs("div",{className:`absolute left-0 ${Z.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% + ${Z.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:v.day}),(()=>{const a=v.level===0?E?"#9ca3af":"#6b7280":A[v.level];return e.jsx("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:o("heatmap.tooltip.level",{level:v.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:S(v.total_tokens??v.value),className:"text-lg font-bold text-oai-gray-900 dark:text-white leading-none",children:$(v.total_tokens??v.value)}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 uppercase tracking-wider font-semibold",children:o("heatmap.unit.tokens")})]}),v.models&&Object.keys(v.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:o("heatmap.tooltip.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(v.models).map(([a,m])=>({name:a,val:Number(m)})).sort((a,m)=>m.val-a.val).map(({name:a,val:m})=>{const z=Number(v.total_tokens??v.value)||1,N=Math.round(m/z*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:S(m),className:"font-mono text-oai-gray-900 dark:text-oai-gray-100 font-semibold",children:$(m)}),e.jsxs("span",{className:"text-[9px] text-oai-gray-450 dark:text-oai-gray-500 min-w-[28px] text-right font-medium",children:[N,"%"]})]})]}),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:`${N}%`,backgroundColor:A[4],boxShadow:`0 0 4px ${A[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:Se(v.level,v.total_tokens??v.value,$)})]})]}),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 ${Z.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:Z.flipY?{marginTop:"1px"}:{marginBottom:"1px"}})]}),document.body),e.jsx("style",{children:`
@keyframes tt-fade-in {
from { opacity: 0; }
to { opacity: 1; }
}
@keyframes tt-fade-out {
from { opacity: 1; }
to { opacity: 0; }
}
@keyframes tt-modal-entrance {
from {
opacity: 0;
transform: scale(0.96) translateY(10px);
}
to {
opacity: 1;
transform: scale(1) translateY(0);
}
}
@keyframes tt-modal-exit {
from {
opacity: 1;
transform: scale(1) translateY(0);
}
to {
opacity: 0;
transform: scale(0.96) translateY(10px);
}
}
.animate-tt-fade-in {
animation: tt-fade-in 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.animate-tt-fade-out {
animation: tt-fade-out 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.animate-tt-modal {
animation: tt-modal-entrance 0.3s cubic-bezier(0.34, 1.3, 0.64, 1) forwards;
}
.animate-tt-modal-exit {
animation: tt-modal-exit 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
`})]})}const gt={anythingllm:"AnythingLLM",pianthropic:"Pi · Anthropic",pigithubcopilot:"Pi · GitHub Copilot",picopilot:"Pi · Copilot"};function yt(l){return String(l||"").trim().toLowerCase().replace(/[\s_-]+/g,"")}function zt(l){const u=String(l||"").trim();if(!u)return"";const h=gt[yt(u)];return h||u.charAt(0).toUpperCase()+u.slice(1)}export{Ct as A,zt as f};
import{j as l}from"./__vite-browser-external-CuMc3dqk.js";function s({size:c=16,className:r=""}){return l.jsx("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:r,children:l.jsx("path",{d:"M4.709 15.955l4.72-2.647.08-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0 11.784l.055-.352.48-.321.686.06 1.52.103 2.278.158 1.652.097 2.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686 1.908 1.476 2.491 1.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97 2.97 0 01-.104-.729L6.283.134 6.696 0l.996.134.42.364.62 1.414 1.002 2.229 1.555 3.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.376-.91.747-.492.584.28.48.685-.067.444-.286 1.851-.559 2.903-.364 1.942h.212l.243-.242.985-1.306 1.652-2.064.73-.82.85-.904.547-.431h1.033l.76 1.129-.34 1.166-1.064 1.347-.881 1.142-1.264 1.7-.79 1.36.073.11.188-.02 2.856-.606 1.543-.28 1.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.049.061 1.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093 1.068 2.006 1.81 2.509 2.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649 2.345 3.521.122 1.08-.17.353-.608.213-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674 7.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434 1.967-2.18 2.945-1.726 1.845-.414.164-.717-.37.067-.662.401-.589 2.388-3.036 1.44-1.882.93-1.086-.006-.158h-.055L4.132 18.56l-1.13.146-.487-.456.061-.746.231-.243 1.908-1.312-.006.006z"})})}function h({size:c=16,className:r=""}){return l.jsx("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",className:r,children:l.jsx("path",{d:"M8.086.457a6.105 6.105 0 013.046-.415c1.333.153 2.521.72 3.564 1.7a.117.117 0 00.107.029c1.408-.346 2.762-.224 4.061.366l.063.03.154.076c1.357.703 2.33 1.77 2.918 3.198.278.679.418 1.388.421 2.126a5.655 5.655 0 01-.18 1.631.167.167 0 00.04.155 5.982 5.982 0 011.578 2.891c.385 1.901-.01 3.615-1.183 5.14l-.182.22a6.063 6.063 0 01-2.934 1.851.162.162 0 00-.108.102c-.255.736-.511 1.364-.987 1.992-1.199 1.582-2.962 2.462-4.948 2.451-1.583-.008-2.986-.587-4.21-1.736a.145.145 0 00-.14-.032c-.518.167-1.04.191-1.604.185a5.924 5.924 0 01-2.595-.622 6.058 6.058 0 01-2.146-1.781c-.203-.269-.404-.522-.551-.821a7.74 7.74 0 01-.495-1.283 6.11 6.11 0 01-.017-3.064.166.166 0 00.008-.074.115.115 0 00-.037-.064 5.958 5.958 0 01-1.38-2.202 5.196 5.196 0 01-.333-1.589 6.915 6.915 0 01.188-2.132c.45-1.484 1.309-2.648 2.577-3.493.282-.188.55-.334.802-.438.286-.12.573-.22.861-.304a.129.129 0 00.087-.087A6.016 6.016 0 015.635 2.31C6.315 1.464 7.132.846 8.086.457zm-.804 7.85a.848.848 0 00-1.473.842l1.694 2.965-1.688 2.848a.849.849 0 001.46.864l1.94-3.272a.849.849 0 00.007-.854l-1.94-3.393zm5.446 6.24a.849.849 0 000 1.695h4.848a.849.849 0 000-1.696h-4.848z"})})}function x({size:c=16,className:r=""}){return l.jsx("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:r,children:l.jsx("path",{d:"M22.106 5.68L12.5.135a.998.998 0 00-.998 0L1.893 5.68a.84.84 0 00-.419.726v11.186c0 .3.16.577.42.727l9.607 5.547a.999.999 0 00.998 0l9.608-5.547a.84.84 0 00.42-.727V6.407a.84.84 0 00-.42-.726zm-.603 1.176L12.228 22.92c-.063.108-.228.064-.228-.061V12.34a.59.59 0 00-.295-.51l-9.11-5.26c-.107-.062-.063-.228.062-.228h18.55c.264 0 .428.286.296.514z"})})}function v({size:c=16,className:r=""}){return l.jsx("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:r,children:l.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z"})})}function u({size:c=16,className:r=""}){return l.jsx("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:r,children:l.jsx("path",{d:"M9.27 15.29l7.978-5.897c.391-.29.95-.177 1.137.272.98 2.369.542 5.215-1.41 7.169-1.951 1.954-4.667 2.382-7.149 1.406l-2.711 1.257c3.889 2.661 8.611 2.003 11.562-.953 2.341-2.344 3.066-5.539 2.388-8.42l.006.007c-.983-4.232.242-5.924 2.75-9.383.06-.082.12-.164.179-.248l-3.301 3.305v-.01L9.267 15.292M7.623 16.723c-2.792-2.67-2.31-6.801.071-9.184 1.761-1.763 4.647-2.483 7.166-1.425l2.705-1.25a7.808 7.808 0 00-1.829-1A8.975 8.975 0 005.984 5.83c-2.533 2.536-3.33 6.436-1.962 9.764 1.022 2.487-.653 4.246-2.34 6.022-.599.63-1.199 1.259-1.682 1.925l7.62-6.815"})})}function C({size:c=16,className:r=""}){return l.jsx("svg",{width:c,height:c,viewBox:"0 -1 22 28",fill:"currentColor",fillRule:"evenodd",className:r,children:l.jsx("path",{d:"M4.125 20.149c-2.69 5.959 3.036 7.453 7.26 3.966 1.24 3.91 5.898.993 7.569-2.036 3.682-6.678 2.195-13.49 1.813-14.895-2.617-9.582-15.699-9.592-17.95.049-.526 1.687-.535 3.606-.833 5.598-.15 1.005-.256 1.646-.645 2.703-.223.607-.53 1.147-1.014 2.056-.75 1.412-.434 4.138 3.434 2.724v.001ZM11.895 11.332c-1.073 0-1.234-1.283-1.234-2.048 0-.69.124-1.239.358-1.586a1 1 0 0 1 .876-.462c.375 0 .697.158.924.47.259.354.395.9.395 1.578 0 1.283-.493 2.048-1.319 2.048Zm4.416 0c-1.073 0-1.234-1.283-1.234-2.048 0-.69.124-1.239.358-1.586a1 1 0 0 1 .876-.462c.375 0 .697.158.924.47.259.354.396.9.396 1.578 0 1.283-.494 2.048-1.32 2.048Z"})})}function g({size:c=16,className:r=""}){return l.jsx("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:r,children:l.jsx("path",{d:"M16 6H8v12h8V6zm4 16H4V2h16v20z"})})}function f({size:c=16,className:r=""}){return l.jsxs("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:r,children:[l.jsx("path",{d:"M21.846 0a1.923 1.923 0 110 3.846H20.15a.226.226 0 01-.227-.226V1.923C19.923.861 20.784 0 21.846 0z"}),l.jsx("path",{d:"M11.065 11.199l7.257-7.2c.137-.136.06-.41-.116-.41H14.3a.164.164 0 00-.117.051l-7.82 7.756c-.122.12-.302.013-.302-.179V3.82c0-.127-.083-.23-.185-.23H3.186c-.103 0-.186.103-.186.23V19.77c0 .128.083.23.186.23h2.69c.103 0 .186-.102.186-.23v-3.25c0-.069.025-.135.069-.178l2.424-2.406a.158.158 0 01.205-.023l6.484 4.772a7.677 7.677 0 003.453 1.283c.108.012.2-.095.2-.23v-3.06c0-.117-.07-.212-.164-.227a5.028 5.028 0 01-2.027-.807l-5.613-4.064c-.117-.078-.132-.279-.028-.381z"})]})}function j({size:c=16,className:r=""}){return l.jsx("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:r,"aria-hidden":"true",children:l.jsx("path",{d:"M16.278 2c1.156 0 2.093.927 2.093 2.07v12.501a.74.74 0 00.744.709.74.74 0 00.743-.709V9.099a2.06 2.06 0 012.071-2.049A2.06 2.06 0 0124 9.1v6.561a.649.649 0 01-.652.645.649.649 0 01-.653-.645V9.1a.762.762 0 00-.766-.758.762.762 0 00-.766.758v7.472a2.037 2.037 0 01-2.048 2.026 2.037 2.037 0 01-2.048-2.026v-12.5a.785.785 0 00-.788-.753.785.785 0 00-.789.752l-.001 15.904A2.037 2.037 0 0113.441 22a2.037 2.037 0 01-2.048-2.026V18.04c0-.356.292-.645.652-.645.36 0 .652.289.652.645v1.934c0 .263.142.506.372.638.23.131.514.131.744 0a.734.734 0 00.372-.638V4.07c0-1.143.937-2.07 2.093-2.07zm-5.674 0c1.156 0 2.093.927 2.093 2.07v11.523a.648.648 0 01-.652.645.648.648 0 01-.652-.645V4.07a.785.785 0 00-.789-.78.785.785 0 00-.789.78v14.013a2.06 2.06 0 01-2.07 2.048 2.06 2.06 0 01-2.071-2.048V9.1a.762.762 0 00-.766-.758.762.762 0 00-.766.758v3.8a2.06 2.06 0 01-2.071 2.049A2.06 2.06 0 010 12.9v-1.378c0-.357.292-.646.652-.646.36 0 .653.29.653.646V12.9c0 .418.343.757.766.757s.766-.339.766-.757V9.099a2.06 2.06 0 012.07-2.048 2.06 2.06 0 012.071 2.048v8.984c0 .419.343.758.767.758.423 0 .766-.339.766-.758V4.07c0-1.143.937-2.07 2.093-2.07z"})})}function w({size:c=16,className:r=""}){return l.jsx("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:r,children:l.jsx("path",{d:"M19.245 5.364c1.322 1.36 1.877 3.216 2.11 5.817.622 0 1.2.135 1.592.654l.73.964c.21.278.323.61.323.955v2.62c0 .339-.173.669-.453.868C20.239 19.602 16.157 21.5 12 21.5c-4.6 0-9.205-2.583-11.547-4.258-.28-.2-.452-.53-.453-.868v-2.62c0-.345.113-.679.321-.956l.73-.963c.392-.517.974-.654 1.593-.654l.029-.297c.25-2.446.81-4.213 2.082-5.52 2.461-2.54 5.71-2.851 7.146-2.864h.198c1.436.013 4.685.323 7.146 2.864zm-7.244 4.328c-.284 0-.613.016-.962.05-.123.447-.305.85-.57 1.108-1.05 1.023-2.316 1.18-2.994 1.18-.638 0-1.306-.13-1.851-.464-.516.165-1.012.403-1.044.996a65.882 65.882 0 00-.063 2.884l-.002.48c-.002.563-.005 1.126-.013 1.69.002.326.204.63.51.765 2.482 1.102 4.83 1.657 6.99 1.657 2.156 0 4.504-.555 6.985-1.657a.854.854 0 00.51-.766c.03-1.682.006-3.372-.076-5.053-.031-.596-.528-.83-1.046-.996-.546.333-1.212.464-1.85.464-.677 0-1.942-.157-2.993-1.18-.266-.258-.447-.661-.57-1.108-.32-.032-.64-.049-.96-.05zm-2.525 4.013c.539 0 .976.426.976.95v1.753c0 .525-.437.95-.976.95a.964.964 0 01-.976-.95v-1.752c0-.525.437-.951.976-.951zm5 0c.539 0 .976.426.976.95v1.753c0 .525-.437.95-.976.95a.964.964 0 01-.976-.95v-1.752c0-.525.437-.951.976-.951zM7.635 5.087c-1.05.102-1.935.438-2.385.906-.975 1.037-.765 3.668-.21 4.224.405.394 1.17.657 1.995.657h.09c.649-.013 1.785-.176 2.73-1.11.435-.41.705-1.433.675-2.47-.03-.834-.27-1.52-.63-1.813-.39-.336-1.275-.482-2.265-.394zm6.465.394c-.36.292-.6.98-.63 1.813-.03 1.037.24 2.06.675 2.47.968.957 2.136 1.104 2.776 1.11h.044c.825 0 1.59-.263 1.995-.657.555-.556.765-3.187-.21-4.224-.45-.468-1.335-.804-2.385-.906-.99-.088-1.875.058-2.265.394zM12 7.615c-.24 0-.525.015-.84.044.03.16.045.336.06.526l-.001.159a2.94 2.94 0 01-.014.25c.225-.022.425-.027.612-.028h.366c.187 0 .387.006.612.028-.015-.146-.015-.277-.015-.409.015-.19.03-.365.06-.526a9.29 9.29 0 00-.84-.044z"})})}function i({size:c=16,className:r=""}){return l.jsxs("svg",{width:c,height:c,viewBox:"0 0 64 60",fill:"none",className:r,"aria-hidden":"true",children:[l.jsx("path",{fill:"currentColor",d:"M37.2114 3.75318C37.6821 3.33106 37.7106 3.31457 38.0558 3.29385C38.6149 3.2531 39.1272 3.52199 39.9989 4.31564C42.0356 6.16652 44.8714 9.97183 46.6346 13.2212L47.3163 14.4819L48.2782 14.9605C49.2072 15.4299 50.7308 16.3923 51.3672 16.9085C51.655 17.1464 51.6956 17.1508 51.9947 17.0344C53.3454 16.5084 55.2803 17.206 56.9869 18.8432C58.5231 20.3155 59.9943 22.8312 60.558 24.9308C60.6403 25.2687 60.7493 25.9952 60.7891 26.5362C60.9177 28.4358 60.3092 29.9532 59.1362 30.64C58.8965 30.7784 58.8801 30.8158 58.8868 31.4132C58.9409 34.2583 58.1741 37.0985 56.6335 39.8679C54.8946 42.9773 51.7981 46.1938 47.6074 49.2243C45.357 50.8619 40.0323 53.964 37.6248 55.0532C31.8578 57.6496 27.2346 58.646 23.2188 58.154C20.8236 57.8638 18.1124 56.9287 16.5082 55.8433C16.086 55.5515 16.0191 55.5329 15.6966 55.6251C13.9793 56.1185 11.73 55.1053 9.81931 52.9844C9.05725 52.1366 7.82714 50.0548 7.42839 48.9409C6.50606 46.3339 6.68976 43.9816 7.91836 42.5767C8.23573 42.2149 8.2453 42.1995 8.17598 41.5912C8.06148 40.5951 8.00971 39.1206 8.06202 38.1692L8.10361 37.2803L6.76977 34.9212C4.70378 31.2451 3.3912 28.1582 2.88489 25.7998C2.61762 24.5066 2.63385 23.9324 2.96214 23.5078C3.16198 23.2515 3.81796 22.9866 4.60785 22.8407C6.59665 22.4917 10.9334 22.8076 15.7581 23.6595L16.259 23.7458L17.3608 22.7713C19.1891 21.1519 20.4038 20.244 22.6429 18.8478C24.9768 17.3876 27.6108 16.1858 30.577 15.2346L31.5295 14.9294L32.0526 13.5561C33.9257 8.61146 35.8437 4.96584 37.2114 3.75318ZM21.5208 29.0919C19.404 30.314 18.3453 30.9251 17.5676 31.6099C14.4179 34.3835 13.2414 38.777 14.5823 42.7537C14.9135 43.7357 15.5247 44.7942 16.7469 46.9111C17.9691 49.0279 18.5801 50.0865 19.2649 50.8643C22.0385 54.014 26.4316 55.1918 30.4084 53.8509C31.3904 53.5198 32.4489 52.9085 34.5657 51.6863L46.7442 44.6551C48.8613 43.4328 49.9205 42.8214 50.6983 42.1365C53.8479 39.363 55.0245 34.9695 53.6835 30.9927C53.3524 30.0107 52.7412 28.9522 51.519 26.8354C50.2968 24.7185 49.6858 23.66 49.0009 22.8822C46.2274 19.7325 41.8342 18.5547 37.8575 19.8956C36.8754 20.2267 35.8163 20.8383 33.6993 22.0606L21.5208 29.0919Z"}),l.jsx("g",{transform:"rotate(-30 22.6953 37.6011)",children:l.jsx("rect",{x:"22.6953",y:"37.6011",width:"4.81084",height:"9.99175",rx:"2.40542",fill:"currentColor"})}),l.jsx("g",{transform:"rotate(-30 35.6748 30.1074)",children:l.jsx("rect",{x:"35.6748",y:"30.1074",width:"4.81084",height:"9.99175",rx:"2.40542",fill:"currentColor"})})]})}function L({size:c=16,className:r=""}){return l.jsxs("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",className:r,children:[l.jsx("path",{d:"M5.938 12.835c.127-.039.285.02.373.143.028.038.036.092.046.14.003.014-.02.033-.04.05-.124-.098-.24-.194-.354-.291-.011-.01-.016-.027-.025-.042zM8.396 9.412c.195-.032.39-.06.588-.05a.54.54 0 01.148.026c.202.071.402.147.601.224.028.01.05.036.075.055l-.013.027a9.203 9.203 0 01-.26-.089c-.115-.038-.213-.077-.315-.098-.25-.05-.25-.046-.292-.014l.574.144c.275.139.55.276.823.417.042.022.09.057.107.098.026.06.063.076.117.072.066-.006.132-.017.213-.027l-.04.086c.051.08.142.02.216.064-.074.13-.247.09-.334.199l.061.074-.12.087c0 .106-.038.168-.306.243l.026.085-.196.042.07.124h-.25l-.007.137c-.081-.01-.161-.018-.244-.027l-.053.123c-.027-.008-.052-.011-.073-.023-.067-.038-.128-.056-.195.006-.019.017-.063.014-.093.008-.026-.006-.05-.029-.07-.042-.11.095-.11.095-.208.003-.057.046-.12.074-.186.011-.063.027-.123-.02-.178-.014-.07.007-.097-.035-.133-.07l-.13.033c-.013-.236-.194-.19-.34-.203.005-.072.05-.092.095-.094a.474.474 0 01.159.022c.164.05.32.12.496.138.203.021.405.029.601-.015.265-.059.52-.149.707-.365.049-.056.083-.127.117-.195.019-.038.02-.084-.02-.116a1.397 1.397 0 00-.382-.217c.024.12-.031.182-.115.221 0 .014-.004.025 0 .03.08.115.084.16-.007.267a1.39 1.39 0 01-.218.211.477.477 0 01-.641-.05 1.36 1.36 0 01-.133-.152c-.078-.107-.076-.108-.033-.236-.165-.08-.128-.226-.104-.364.008-.05.028-.096.049-.163-.04.014-.067.017-.087.032a.897.897 0 00-.316.357c-.007.016-.01.034-.02.047-.012.015-.034.038-.045.035-.02-.006-.037-.027-.05-.045-.008-.012-.007-.032-.012-.057h-.126l.053-.172a14.82 14.82 0 00-.039-.049l.11-.284c-.06.026-.091.044-.124.051-.03.007-.064 0-.095 0 0-.031-.01-.07.004-.092.149-.22.305-.428.593-.476z"}),l.jsx("path",{d:"M8.06 10.788c-.003-.038-.004-.075.037-.062.016.006.034.048.028.067-.01.04-.038.032-.064-.005z"}),l.jsx("path",{d:"M11.981.009c.226-.012.453-.011.679 0 .247.01.495.024.74.062.401.064.798.157 1.19.273.463.138.92.299 1.356.511a7.31 7.31 0 012.948 2.642c.292.469.536.963.739 1.479.219.556.446 1.11.623 1.683.204.654.329 1.326.458 1.997.097.504.182 1.01.29 1.511.156.722.329 1.44.494 2.16.186.812.4 1.615.63 2.415.102.355.193.713.282 1.072.11.436.202.876.254 1.323.031.278.066.557.073.837a7.56 7.56 0 01-.017.88c-.037.413-.1.818-.226 1.212a5.017 5.017 0 01-.915 1.649l-.13.156.018.023c.043-.023.088-.041.127-.068.2-.138.373-.307.531-.49.4-.46.721-.973.975-1.529a3.59 3.59 0 00.325-1.72c-.024-.424-.097-.834-.3-1.213-.013-.027-.015-.06-.03-.121.05.035.082.048.101.072.107.13.22.258.315.398.33.494.46 1.052.486 1.64a3.75 3.75 0 01-.47 1.97c-.36.655-.887 1.14-1.526 1.506-.193.111-.394.21-.595.308-.157.078-.248.211-.318.365a.522.522 0 00-.033.406.359.359 0 01.013.139c-.005.077-.077.155-.14.162-.054.006-.125-.043-.15-.116a1.206 1.206 0 01-.06-.233c-.04-.314-.155-.6-.308-.87a3.906 3.906 0 00-.73-.91 2.129 2.129 0 00-.897-.524 4.093 4.093 0 00-.692-.131c-.075-.008-.15-.04-.22.01.18.06.363.11.538.18.434.173.82.43 1.18.728.308.255.58.543.794.884.098.155.186.315.227.496.027.123.042.25.067.375.013.062-.002.109-.053.144-.047.033-.122.034-.163-.01a.455.455 0 01-.08-.14c-.03-.073-.038-.159-.078-.225a7.314 7.314 0 00-1.423-1.664c-.16-.137-.329-.26-.537-.323-.376-.114-.753-.203-1.15-.154-.213.025-.427.032-.64.053a1.6 1.6 0 00-.736.278 5.14 5.14 0 00-.834.72c-.329.342-.642.699-.955 1.055-.136.155-.264.319-.314.531a5.227 5.227 0 00-.012.051.096.096 0 01-.09.076h-.31c-.046 0-.082-.048-.072-.094.023-.108.045-.216.07-.324.075-.325.19-.635.368-.917.024-.039.04-.088.104-.08l.01.049.027.077c.28-.435.571-.834.996-1.135.283-.204.584-.378.89-.55a.196.196 0 00-.098-.002c-.162.043-.325.084-.485.134-.402.124-.764.33-1.11.566-.147.1-.298.193-.414.333a7.314 7.314 0 00-1.07 1.767.845.845 0 00-.04.12.075.075 0 01-.072.056h-.494c-.04 0-.062-.051-.036-.082.123-.14.246-.282.377-.415.275-.281.58-.532.777-.884.027-.048.063-.09.095-.135.238-.333.54-.607.818-.902.082-.086.175-.16.26-.24.029-.027.053-.057.079-.085l-.018-.025-.135.041c-.034.017-.07.031-.102.05-.248.144-.494.292-.743.433-.408.23-.825.439-1.209.711-.281.2-.591.358-.889.533-.02.012-.044.015-.08.028-.015-.135.143-.201.108-.336-.033.014-.064.02-.085.038-.111.096-.227.19-.328.296-.148.157-.284.325-.425.488-.125.143-.25.286-.373.431A.153.153 0 019.89 24H8.762a.316.316 0 00.016-.042c.028-.09.085-.172.083-.28-.091-.018-.162.001-.212.077a4.45 4.45 0 00-.136.215c-.01.016-.024.03-.042.03h-.093c-.019 0-.029-.022-.017-.037.071-.088.14-.178.209-.268.001-.002-.006-.012-.012-.024-.014.004-.03.006-.045.013-.176.09-.352.181-.527.274a.363.363 0 01-.168.042H5.202c-.026 0-.039-.036-.019-.053.21-.178.402-.374.558-.605.335-.496.538-1.047.667-1.629.004-.02-.003-.043-.006-.091-.037.048-.059.072-.076.1a1.943 1.943 0 01-.334.415c-.28.258-.59.448-.983.464-.297.012-.588 0-.865-.127-.46-.21-.722-.57-.794-1.072-.025-.17-.017-.171-.182-.219A3.513 3.513 0 011.97 20.6a2.286 2.286 0 01-.808-1.13 3.569 3.569 0 01-.16-1.245c.002-.034.016-.067.024-.1.032.023.046.043.05.066.033.153.059.308.096.46.086.355.257.664.516.92.258.256.571.419.91.532.358.118.717.138 1.07-.016a1.89 1.89 0 00.621-.452c.328-.348.533-.76.648-1.223.009-.034.005-.071.007-.11-.015.006-.026.006-.03.011-.031.05-.064.1-.093.152-.284.502-.679.887-1.196 1.135-.351.17-.718.255-1.11.159a1.607 1.607 0 01-.971-.64 2.006 2.006 0 01-.368-.924 2.903 2.903 0 01.02-.886c.05-.439.466-1.17.742-1.271-.02.063-.035.112-.053.16-.043.116-.097.227-.13.345a1.901 1.901 0 00-.05.82c.033.212.09.416.204.6.147.236.346.407.62.465.11.023.225.014.338.018a.576.576 0 00.386-.131c.164-.128.282-.292.366-.481.168-.375.24-.777.309-1.179.05-.296.093-.594.133-.893.039-.281.071-.563.104-.845.026-.232.048-.464.074-.696.024-.228.052-.455.076-.683.024-.227.047-.455.069-.683.013-.14.022-.28.034-.42l.037-.417c.022-.25.041-.5.065-.748.008-.082-.02-.132-.09-.177a2.46 2.46 0 01-.492-.418c-.1-.109-.188-.228-.282-.342-.035-.042-.056-.097-.116-.118a2.084 2.084 0 00.275.597c.06.092.131.176.196.265.063.086.182.115.234.226-.028.003-.046.01-.06.006a4.74 4.74 0 01-.22-.057 2.71 2.71 0 01-1.287-.819c-.435-.487-.656-1.076-.71-1.723a5.206 5.206 0 01.014-1.06c.072-.602.22-1.186.45-1.745.155-.376.338-.741.526-1.102.205-.393.466-.75.765-1.076.512-.559 1.104-1.024 1.726-1.448.717-.49 1.478-.898 2.277-1.233C8.244.828 8.767.632 9.31.494c.655-.166 1.31-.33 1.982-.415.229-.03.458-.058.688-.07zm-1.847 22.82c-.07.06-.147.111-.207.18-.238.27-.464.549-.668.869l-.044.108a.177.177 0 00.093-.057c.174-.19.351-.378.519-.574.104-.122.195-.255.288-.386.024-.034.03-.08.046-.12l-.027-.02zm1.65-3.695a5.51 5.51 0 00-.653.593l-.37.386a.963.963 0 01-.377.25 1.372 1.372 0 01-.467.09c-.044 0-.087.006-.151.012.028.058.043.097.064.131.15.242.301.482.45.724.136.22.276.438.399.666.068.125.105.267.156.404.077.027.14-.018.202-.048.29-.135.579-.274.867-.412.213-.101.437-.186.636-.31.347-.215.68-.455 1.018-.685.015-.01.026-.028.042-.046-.023-.019-.038-.037-.056-.044-.287-.111-.527-.3-.77-.482a5.319 5.319 0 01-.506-.42 1.757 1.757 0 01-.41-.653c-.019-.049-.045-.095-.075-.156zm-5.847.264c-.06.096-.097.194-.132.293a3.38 3.38 0 01-.555 1.01c-.2.25-.455.412-.762.493-.23.06-.464.076-.7.07-.048-.002-.097.002-.158.005.016.04.021.066.035.085.1.145.23.246.4.295.157.046.316.034.498.023.181-.037.343-.115.485-.234.238-.199.402-.454.536-.732.175-.363.264-.751.342-1.144.01-.053.008-.11.011-.164zm14.945-4.586c.008.029.016.057.027.107.024.155.051.31.072.464.03.219.067.437.078.657.017.344.027.689-.014 1.033-.037.315-.063.633-.116.946a6.153 6.153 0 01-.46 1.518c-.008.018-.01.039-.02.082.047-.03.077-.042.098-.064.085-.083.17-.167.248-.255.271-.305.458-.66.596-1.043.18-.498.228-1.011.145-1.531-.103-.65-.33-1.263-.597-1.881a9.055 9.055 0 00-.024-.055l-.033.022zM5.797 8.29a.26.26 0 00.018.153c.124.251.25.501.379.75.025.049.066.09.03.163-.284.06-.578.119-.88.255.059.038.097.06.132.087.042.032.112.058.09.12-.01.033-.075.048-.117.072.017.01.043.021.067.036.166.102.33.207.447.368.138.192.229.404.188.644-.079.469-.306.85-.69 1.132-.054.04-.106.083-.161.122a.243.243 0 00-.103.245.77.77 0 00.055.195c.083.196.22.35.375.492.083.076.159.164.222.257a.37.37 0 01.025.377c-.023.05-.05.099-.076.148-.03.06-.028.111.022.162.041.042.08.089.112.138.038.058.078.079.147.05a.486.486 0 01.333-.006c.16.046.302.126.444.21.13.077.264.149.4.219.067.035.14.05.219.026.071-.022.124.01.145.076.02.064-.003.108-.074.139-.07.03-.137.063-.209.088-.1.035-.201.073-.314.077-.013-.107.11-.088.127-.159-.206-.126-.643-.145-.801-.034.063.112.035.21-.096.313-.13-.1-.025-.202.002-.3a.209.209 0 00-.249.17c-.015.101.067.216.178.224.108.007.218-.005.326-.012.06-.005.12-.027.199 0-.103.123-.248.127-.357.19.002.05.07.086.019.131-.053.048-.095-.001-.132-.03-.08-.063-.16-.126-.231-.197a.474.474 0 01-.157-.311.52.52 0 00-.043-.172c-.032-.074-.032-.137.033-.19-.018-.03-.028-.053-.045-.072a1.222 1.222 0 01-.196-.369c-.053-.137-.046-.264.048-.381.024-.03.05-.06.064-.095a.664.664 0 00.047-.168c.017-.165-.064-.287-.182-.387-.186-.156-.36-.322-.46-.551-.005-.011-.024-.017-.037-.026-.011.017-.024.027-.025.038-.019.185-.045.37-.052.557-.014.377.058.743.162 1.104.118.41.289.798.488 1.173.267.502.537 1.002.812 1.5.055.098.13.189.208.27.198.202.452.272.724.273.202 0 .404-.006.605-.026.295-.03.59-.073.884-.113.183-.025.365-.057.548-.08.21-.026.38.073.522.21.16.156.305.327.447.5.22.265.397.56.554.867.05.098.07.1.147.03.13-.121.26-.242.394-.36.067-.059.088-.12.067-.213a3.535 3.535 0 01-.085-.796c.002-.157.006-.314.018-.471.015-.224.03-.45.06-.672a59.114 59.114 0 01.362-2.298c.087-.493.182-.984.268-1.477.06-.347.118-.694.162-1.043.034-.273.055-.55.063-.825.011-.332.003-.665.002-.998 0-.077.004-.155-.01-.23-.028-.142-.01-.155-.162-.19a5.826 5.826 0 00-.607-.107c-.146-.018-.207-.053-.221-.19-.006-.049-.025-.098-.041-.146-.009-.025-.024-.048-.046-.09l-.025.264c-.009.096-.029.116-.127.115-.055 0-.11-.008-.164-.008-.476 0-.952-.008-1.426.032-.095.008-.173-.015-.226-.103-.04-.066-.088-.126-.134-.186-.063-.084-.086-.093-.182-.06-.195.068-.388.138-.582.21a2.71 2.71 0 00-.675.394.986.986 0 01-.323.168c-.033.01-.07.008-.127.013.02-.066.024-.114.047-.15.064-.105.135-.205.205-.306.023-.033.049-.063.073-.095l-.015-.023-.201.037c-.146.04-.296.07-.437.122-.148.053-.266.023-.386-.072a3.623 3.623 0 01-.733-.786l-.093-.132zm8.592 8.963l-.147.09c-.22.134-.44.266-.659.402-.093.058-.184.12-.27.188-.085.07-.124.161-.072.272.047.1.093.2.147.294.047.08.124.138.213.147.11.01.228.012.336-.012.217-.05.372-.205.528-.357a.291.291 0 00.087-.308c-.046-.18-.079-.365-.118-.547-.011-.052-.027-.103-.045-.169zm-.257-2.409c-.12.291-.205.597-.325.91-.151.433-.294.87-.435 1.323.036-.01.054-.01.067-.018.261-.16.522-.324.785-.484.054-.033.071-.078.065-.138-.012-.13-.024-.262-.034-.393l-.068-.886c-.008-.103-.02-.206-.029-.31-.009 0-.017-.002-.026-.004zm3.081-8.13l.099.285c.08.231.159.463.24.714l.58 1.952c.187.63.372 1.262.558 1.893.114.382.235.762.343 1.146.072.257.126.519.186.799.044.206.087.413.127.64.034.106.023.226.077.325l.025-.006-.068-.362c-.038-.206-.077-.412-.113-.638-.015-.07-.029-.141-.046-.211-.095-.396-.177-.796-.29-1.187-.196-.685-.413-1.364-.618-2.046-.165-.549-.322-1.1-.488-1.648-.069-.227-.15-.45-.226-.695l-.117-.336c-.037-.107-.075-.216-.115-.322-.04-.106-.084-.21-.127-.314a7.558 7.558 0 01-.027.01zM6.225 14.304c-.063-.001-.115.014-.134.083a.35.35 0 00.41.012 4.533 4.533 0 00-.276-.095zM5.23 11.98c-.026-.027-.057-.048-.075.002-.012.032-.007.07-.01.113.082-.037.082-.037.085-.115zm.062-1.189a.135.135 0 00-.088.056.197.197 0 00-.025.11c.005.152.01.306.026.457a.751.751 0 00.066.218c.061.136.157.167.288.101.055-.027.06-.054.025-.11a4.52 4.52 0 01-.129-.211c-.015-.068-.066-.131-.033-.207.04-.09-.076-.116-.074-.19V10.874c-.003-.038-.006-.087-.056-.083zm-.017-.968a.867.867 0 00-.467.127c-.076.045-.084.07-.05.158.034.087.07.173.115.254.064.117.09.125.21.077a.657.657 0 01.336-.053c.202.022.357.136.504.264l.092.077c.007-.006.014-.013.022-.018-.019-.105-.035-.226-.149-.264-.157-.053-.324-.075-.508-.117l-.24-.005c.24-.169.452-.044.687.009-.063-.115-.153-.147-.23-.193-.082-.05-.17-.092-.25-.144-.06-.037-.12-.08-.072-.172zm10.233.325c-.23-.01-.427.08-.608.211-.034.026-.06.065-.105.117.087.026.15.046.232.065.044-.015.088-.03.13-.046.306-.114.61-.115.904.031.126.063.237.04.366-.005-.02-.031-.03-.054-.045-.071a.986.986 0 00-.448-.273c-.14-.044-.284-.024-.426-.03zM7.99 6.483a.308.308 0 00.002.133c.08.321.156.643.242.962.104.387.27.75.456 1.103.02.037.061.08.098.087a.404.404 0 00.253-.051l-.472-.84c-.23-.448-.405-.92-.579-1.394zM10.397.497c-.2-.008-.405.004-.603.034-.236.035-.47.087-.7.152-.287.08-.569.18-.852.273-.04.013-.074.038-.11.058.028.014.05.018.07.014.287-.068.58-.085.873-.09.134-.002.269.009.402.025.19.024.382.048.57.09.456.104.874.3 1.265.556.464.306.888.66 1.257 1.078.205.232.395.475.56.739.17.274.315.561.449.856.273.601.456 1.232.6 1.876.04.173.07.348.1.524.017.104.065.167.17.19.122.028.2.105.22.251-.003.102-.06.174-.129.24a1.065 1.065 0 00-.268.358.164.164 0 00.083-.039c.08-.086.162-.172.235-.265a.56.56 0 00.13-.333c.009-.05.022-.1.024-.15.007-.124-.017-.15-.143-.168-.025-.004-.049-.014-.073-.015-.082-.007-.125-.063-.137-.131-.033-.198-.004-.355.247-.408.086-.018.174-.03.26-.042.158-.023.315-.053.473-.067.14-.012.19.033.226.167.008.029.018.057.021.087.019.179-.008.225-.141.288-.027.013-.055.024-.078.042a.148.148 0 00-.051.067c-.039.144.073.382.206.445l.673.32c.023.011.05.015.075.023l.018-.026c-.015-.008-.032-.013-.044-.024a2.27 2.27 0 00-.544-.32 4.898 4.898 0 00-.173-.075.203.203 0 01-.126-.191c-.003-.085.045-.154.128-.187l.059-.025c.099-.044.118-.076.112-.187a.384.384 0 00-.008-.063c-.067-.294-.123-.59-.205-.88a9.478 9.478 0 00-.826-2.036 7.465 7.465 0 00-1.39-1.805 4.536 4.536 0 00-1.177-.824 3.656 3.656 0 00-1.016-.328 6.155 6.155 0 00-.712-.074zm6.719 5.955c.01.014.018.028.038.034l-.022-.044-.016.01zM4.103 3.917a.062.062 0 01-.03.012.455.455 0 01-.04.039c-.01.01-.02.02-.045.04l-.363.354c-.088.085-.17.178-.266.253-.284.22-.425.53-.544.855a.132.132 0 00-.007.071c.013.055.033.108.052.168l.074.026c-.017.056-.03.105-.047.152-.058.164-.118.327-.175.491-.005.015.008.036.019.077.08-.175.158-.33.225-.489.228-.544.484-1.074.819-1.561.09-.133.182-.266.283-.401.004-.006.007-.013.022-.03.001-.016.003-.032.015-.04l.008-.017zm12.976 2.408a.023.023 0 01.009.019.073.073 0 00-.006.01.188.188 0 00.007.02l.018.022c.002-.007.007-.016.005-.021-.003-.01-.012-.018-.02-.038a1.331 1.331 0 01-.013-.012zM4.199 4.48c-.003.004-.008.008-.027.014-.005.013-.011.025-.031.047a2.085 2.085 0 01-.124.167c-.048.07-.116.055-.181.041-.134-.028-.228.016-.287.143-.089.187-.187.37-.273.56-.049.108-.11.216-.118.36.081.003.154.007.228.008h.228a2.563 2.563 0 01-.079.264c-.01.052-.022.103-.033.155l.02.004c.018-.046.037-.092.067-.153.066-.142.13-.285.2-.426.02-.04.034-.1.116-.092 0 .043.004.084 0 .124-.005.045-.017.09-.028.143.141.043.086.174.115.269.102-.022.104-.195.248-.144v.205l.017.002.439-1.059c-.13 0-.246-.02-.358.033-.024.011-.058-.001-.108-.004.075-.15.139-.278.211-.417a.128.128 0 01.025-.036c0-.015-.001-.03.008-.038l.006-.02c-.005.006-.01.011-.028.017-.004.012-.009.024-.026.045a.085.085 0 01-.032.033c-.123.157-.09.164-.258.106-.079-.027-.078-.028-.047-.144.028-.046.056-.093.098-.15 0-.016-.001-.032.007-.042L4.2 4.48zm2.073-.67c-.003.006-.007.011-.027.016-.094.125-.194.246-.28.377-.155.238-.301.481-.451.723-.14.224-.345.368-.575.481-.017.008-.04.006-.079.011.012-.059.016-.109.033-.153a6.076 6.076 0 01.229-.518l-.007-.02a.138.138 0 01-.035.025c-.028.05-.055.1-.093.164-.26.424-.443.817-.442.95.024.004.048.011.073.013.177.013.188.007.26-.165.03-.07.077-.12.147-.15l.175-.07c.044-.018.085-.057.146-.032.003.05-.01.11.014.145.042.062.044.125.047.193.002.049.017.098.026.147.029-.034.039-.065.05-.097.142-.39.277-.782.428-1.17.1-.256.22-.504.33-.756.013-.03.013-.067.03-.092V3.81zm3.987-.34c0 .045.01.084.021.123.042.16.094.318.124.48.024.133.023.27.028.406 0 .033-.019.067-.032.11-.094-.058-.047-.158-.106-.215h-.125c-.015.072-.01.152-.046.2-.066.085-.155.154-.236.227-.043.038-.078.018-.103-.025l-.046-.087c-.065.035-.117.069-.172.093-.116.051-.235.095-.35.147-.085.038-.09.053-.07.147.014.075.034.148.047.223.013.072.05.109.123.124.233.05.462.115.657.265.058-.102.058-.102.168-.151.03-.014.06-.03.092-.042.08-.03.115-.017.15.06.023.048.041.098.066.158.06-.14-.042-.267.017-.416.157.18.24.39.375.567a.235.235 0 00.022-.098c.002-.124 0-.247.002-.371 0-.034.013-.067.02-.1l.032-.003c.11.155.13.354.226.52a3.036 3.036 0 00-.01-.392c-.004-.045 0-.074.05-.088.08.036.116.14.215.158-.03-.275-.423-1.137-.798-1.635-.114-.127-.2-.28-.34-.386zm-2.667.696c-.019.034-.03.05-.037.067-.061.185-.125.37-.18.556-.031.105-.087.169-.195.19-.09.019-.178.052-.268.073-.038.009-.089.015-.118-.003-.024-.016-.025-.069-.036-.106-.064.076-.082.087-.17.047-.133-.062-.262-.135-.393-.201-.048-.025-.093-.063-.17-.03-.043.12-.091.25-.137.382-.099.28-.087.242.095.453.046.048.102.03.154.023.054-.009.106-.03.16-.036.13-.013.26-.08.367-.015.204-.064.387-.122.571-.178.05-.015.089.005.114.054.022.042.034.093.082.121.038-.056-.013-.128.063-.178l.14.241-.042-1.46zm.278.358c-.096-.01-.107.01-.11.108-.002.038-.003.078.002.115.03.2.099.386.174.57.002.006.012.01.022.015l.078-.05c.052.036.081.088.153.088.205-.002.41.014.616.012.099-.001.158.042.205.12.018.03.024.077.088.066l-.08-.394c-.05-.195-.085-.395-.172-.589-.057.057-.114.068-.18.046a.72.72 0 00-.135-.028c-.22-.028-.44-.059-.66-.08zm10.254-1.727c.089.163.155.316.139.491-.016.168.026.342-.044.516-.047-.033-.088-.082-.112-.075-.117.035-.164-.057-.227-.115a4.772 4.772 0 01-.286-.29l-.104-.113a4.856 4.856 0 01-.023.019c.035.046.07.093.11.156.04.064.084.127.122.193.034.058.065.118.031.205-.082-.01-.164-.019-.246-.032-.06-.01-.101 0-.124.07-.031.098-.037.096-.15.09.02.042.036.08.057.116.041.074.03.138-.03.196-.06.06-.118.122-.178.181a.175.175 0 01-.185.046c-.222-.061-.447-.113-.67-.174-.032-.009-.063-.04-.086-.068-.03-.04-.052-.087-.08-.13-.044-.07-.09-.138-.136-.207a.18.18 0 00-.014.105c.012.127.03.253.035.38.005.1-.024.12-.121.104-.104-.017-.206-.04-.31-.058-.064-.012-.131-.028-.202.03l.081.208c.09 0 .166-.01.237.002a.819.819 0 01.458.251c.078.083.154.168.241.26l.018-.005c-.004-.006-.008-.013-.01-.04.014-.056-.062-.118.018-.178.031.03.064.057.088.09.058.078.111.159.169.257l.089.141.024-.013a2093.819 2093.819 0 01-.427-.934c.055.007.083.007.108.016.193.07.385.142.577.216.074.028.147.06.219.094.062.028.112.018.157-.033.05-.056.102-.112.154-.167.05-.051.095-.046.132.014.016.025.026.053.04.08.071.138.143.277.217.433l.159.308.025-.011c-.044-.106-.07-.218-.138-.334-.057-.182-.168-.346-.206-.545.136.034.362.326.567.732l.057.074.018-.011a1.563 1.563 0 01-.052-.127c-.046-.145-.097-.29-.136-.436-.022-.083-.036-.173.022-.26l.109.058-.026-.207.027-.016c.022.02.05.036.065.06.073.108.143.22.215.33.01.016.029.029.043.043-.036-.217-.2-.38-.229-.626l.155.112c.014-.166.012-.319.042-.465.032-.158-.023-.297-.063-.445.024.004.036.006.055.025.092.124.183.249.277.371.02.027.05.047.069.087l.04.063.019-.015a.293.293 0 01-.053-.082 27.922 27.922 0 01-.332-.49c-.221-.311-.363-.467-.485-.521zm-6.57.327c-.003.161.092.275.069.415l-.368.087c.09.139.032.237-.052.331-.05.057-.092.122-.143.178-.037.04-.046.078-.018.126l.16.275c.029.048.072.066.128.064.076-.003.152 0 .228-.001.116-.003.216.022.275.137.006.014.02.024.044.052.004-.059-.003-.098.01-.13.016-.04.04-.099.072-.108.084-.023.173-.024.26-.03.013-.001.027.018.04.029l.071.065c.019-.11-.082-.198-.024-.31l.126.04c-.026-.123-.07-.245-.071-.366 0-.123.051-.243.115-.36.107.062.16.156.234.253.183.265.36.533.494.834.165-.078.27.068.407.088-.003-.106-.133-.441-.197-.492a.142.142 0 00-.102-.028c-.06.011-.119.039-.191.063-.025-.039-.056-.078-.077-.122a3.936 3.936 0 00-.473-.783c-.076-.094-.16-.182-.228-.26l-.391.285c-.049.035-.094.03-.132-.017l-.169-.207c-.025-.03-.053-.059-.097-.108z"})]})}function m({size:c=16,className:r=""}){return l.jsx("svg",{width:c,height:c,viewBox:"0 0 16 16",fill:"currentColor",className:r,children:l.jsx("path",{d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8z"})})}function I({size:c=16,className:r=""}){return l.jsx("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"currentColor",className:r,children:l.jsx("path",{d:"M23.955 13.587l-1.342-4.135-2.664-8.189c-.135-.423-.73-.423-.867 0L16.418 9.45H7.582L4.919 1.263c-.135-.423-.73-.423-.867 0L1.388 9.452.045 13.587a.924.924 0 0 0 .331 1.03L12 23.054l11.625-8.436a.92.92 0 0 0 .33-1.031"})})}function M({size:c=16,className:r=""}){return l.jsx("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:r,"aria-hidden":"true",children:l.jsx("g",{transform:"translate(3.4502, 3)",fill:"#9570BE",children:l.jsx("path",{d:"M3.17890888,3.6 L3.17890888,0 L16,0 L16,3.6 L3.17890888,3.6 Z M9.642,7.2 L9.64218223,10.8 L0,10.8 L0,3.6 L16,3.6 L16,7.2 L9.642,7.2 Z M3.17890888,18 L3.178,14.4 L0,14.4 L0,10.8 L16,10.8 L16,18 L3.17890888,18 Z",fillRule:"nonzero"})})})}function p({size:c=16,className:r=""}){return l.jsxs("svg",{width:c,height:c,viewBox:"0 0 120 90",fill:"currentColor",className:r,children:[l.jsx("rect",{x:"10",y:"8",width:"100",height:"12",rx:"2"}),l.jsx("rect",{x:"25",y:"20",width:"12",height:"62",rx:"2"}),l.jsx("rect",{x:"75",y:"20",width:"12",height:"45",rx:"2"}),l.jsx("rect",{x:"71",y:"55",width:"20",height:"16",rx:"3"}),l.jsx("rect",{x:"76",y:"71",width:"3",height:"8",rx:"1"}),l.jsx("rect",{x:"82",y:"71",width:"3",height:"8",rx:"1"})]})}function e({size:c=16,className:r=""}){return l.jsxs("svg",{width:c,height:c,viewBox:"0 0 120 90",fill:"currentColor",className:r,children:[l.jsx("rect",{x:"10",y:"8",width:"100",height:"12",rx:"2"}),l.jsx("rect",{x:"25",y:"20",width:"12",height:"62",rx:"2"}),l.jsx("rect",{x:"83",y:"20",width:"12",height:"62",rx:"2"})]})}function H({size:c=16,className:r=""}){return l.jsxs("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:r,children:[l.jsx("path",{d:"M9 3v2"}),l.jsx("path",{d:"M15 3v2"}),l.jsx("rect",{x:"4",y:"6",width:"16",height:"13",rx:"3"}),l.jsx("circle",{cx:"9",cy:"13",r:"1.4",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"15",cy:"13",r:"1.4",fill:"currentColor",stroke:"none"}),l.jsx("path",{d:"M9 16h6"})]})}function O({size:c=16,className:r=""}){return l.jsx("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:r,children:l.jsx("path",{d:"M12.105 2L9.927 4.953H.653L2.83 2h9.276zM23.254 19.048L21.078 22h-9.242l2.174-2.952h9.244zM24 2L9.264 22H0L14.736 2H24z"})})}function V({size:c=16,className:r=""}){return l.jsx("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:r,children:l.jsx("path",{d:"M20.113 5.5l-.442 1.557a.157.157 0 01-.196.106l-7.414-2.157a.16.16 0 00-.143.028l-7.342 5.74a.159.159 0 01-.074.032l-4.37.656a.154.154 0 00-.132.162l.02.245c.005.078.071.14.152.141l5.074.128.058.002 3.75-1.953a.16.16 0 01.164.01l2.657 1.847a.152.152 0 01.066.125l-.023 2.45c0 .032.01.063.028.089l3.737 5.227c.03.04.077.065.129.065h1.182a.153.153 0 00.14-.224l-2.664-4.919a.15.15 0 01.005-.152l1.389-2.169a.156.156 0 01.062-.055l4.965-2.456a.16.16 0 01.158.01l1.418.921a.16.16 0 00.087.026h1.289c.125 0 .2-.136.13-.237l-3.578-5.29c-.074-.109-.246-.082-.282.044z"})})}function R({size:c=16,className:r=""}){return l.jsx("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:r,children:l.jsx("path",{d:"M21.595 23.61c1.167-.254 2.405-.944 2.405-.944l-2.167-1.784a12.124 12.124 0 01-2.695-3.131 12.127 12.127 0 00-3.97-4.049l-.794-.462a1.115 1.115 0 01-.488-.815.844.844 0 01.154-.575c.413-.582 2.548-3.115 2.94-3.44.503-.416 1.065-.762 1.586-1.159.074-.056.148-.112.221-.17.003-.002.007-.004.009-.007.167-.131.325-.272.45-.438.453-.524.563-.988.59-1.193-.061-.197-.244-.639-.753-1.148.319.02.705.272 1.056.569.235-.376.481-.773.727-1.171.165-.266-.08-.465-.086-.471h-.001V3.22c-.007-.007-.206-.25-.471-.086-.567.35-1.134.702-1.639 1.021 0 0-.597-.012-1.305.599a2.464 2.464 0 00-.438.45l-.007.009c-.058.072-.114.147-.17.221-.397.521-.743 1.083-1.16 1.587-.323.391-2.857 2.526-3.44 2.94a.842.842 0 01-.574.153 1.115 1.115 0 01-.815-.488l-.462-.794a12.123 12.123 0 00-4.049-3.97 12.133 12.133 0 01-3.13-2.695L1.332 0S.643 1.238.39 2.405c.352.428 1.27 1.49 2.34 2.302C1.58 4.167.73 3.75.06 3.4c-.103.765-.063 1.92.043 2.816.726.317 1.961.806 3.219 1.066-1.006.236-2.11.278-2.961.262.15.554.358 1.119.64 1.688.119.263.25.52.39.77.452.125 2.222.383 3.164.171l-2.51.897a27.776 27.776 0 002.544 2.726c2.031-1.092 2.494-1.241 4.018-2.238-2.467 2.008-3.108 2.828-3.8 3.67l-.483.678c-.25.351-.469.725-.65 1.117-.61 1.31-1.47 4.1-1.47 4.1-.154.486.202.842.674.674 0 0 2.79-.861 4.1-1.47.392-.182.766-.4 1.118-.65l.677-.483c.227-.187.453-.37.701-.586 0 0 1.705 2.02 3.458 3.349l.896-2.511c-.211.942.046 2.712.17 3.163.252.142.509.272.772.392.569.28 1.134.49 1.688.64-.016-.853.026-1.956.261-2.962.26 1.258.75 2.493 1.067 3.219.895.106 2.051.146 2.816.043a73.87 73.87 0 01-1.308-2.67c.811 1.07 1.874 1.988 2.302 2.34h-.001z"})})}function z({size:c=16,className:r=""}){return l.jsx("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:r,children:l.jsx("path",{d:"M0 0v24h24V0H0zm22.222 22.222H1.778V1.778h20.444v20.444zm-7.555-4.964h2.222v1.778h-2.794L12.89 17.83v-2.794h1.778v2.222zm4 0h-1.778v-2.222h-2.222v-1.778h2.793l1.207 1.207v2.793zm-7.556-2.591H9.333v-1.778h1.778v1.778zm-5.778-1.778h1.778v4h4v1.778H6.54L5.333 17.46V12.89zm13.334-3.556v1.778h-5.778V9.333h1.987V7.111h-1.987V5.333h2.558l1.206 1.207v2.793h2.014zm-11.556-2h2.222l1.778 1.778v2H9.333v-2H7.111v2H5.333V5.333h1.778v2zm4 0H9.333v-2h1.778v2z"})})}function E({size:c=16,className:r=""}){return l.jsx("svg",{width:c,height:c,viewBox:"0 0 16 16",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",className:r,children:l.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.125 2.75C2.9179 2.75 2.75 2.9179 2.75 3.125V11.375H2V3.125C2 2.50368 2.50368 2 3.125 2H13.1723C13.6735 2 13.9244 2.6059 13.5701 2.96025L7.38189 9.14843H9.125V8.375H9.875V9.33593C9.875 9.6466 9.6232 9.8984 9.3125 9.8984H6.63189L5.34282 11.1875H11.1875V6.5H11.9375V11.1875C11.9375 11.6017 11.6017 11.9375 11.1875 11.9375H4.59282L3.28032 13.25H12.875C13.0821 13.25 13.25 13.0821 13.25 12.875V4.625H14V12.875C14 13.4963 13.4963 14 12.875 14H2.82767C2.32653 14 2.07557 13.3941 2.42992 13.0397L8.59468 6.875H6.875V7.625H6.125V6.6875C6.125 6.37684 6.37684 6.125 6.6875 6.125H9.34468L10.6571 4.8125H4.8125V9.5H4.0625V4.8125C4.0625 4.39829 4.39829 4.0625 4.8125 4.0625H11.4071L12.7197 2.75H3.125Z"})})}function B({size:c=16,className:r=""}){return l.jsx("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",xmlns:"http://www.w3.org/2000/svg",className:r,children:l.jsx("path",{d:"M23.748 4.482c-.254-.124-.364.113-.512.234-.051.039-.094.09-.137.136-.372.397-.806.657-1.373.626-.829-.046-1.537.214-2.163.848-.133-.782-.575-1.248-1.247-1.548-.352-.156-.708-.311-.955-.65-.172-.241-.219-.51-.305-.774-.055-.16-.11-.323-.293-.35-.2-.031-.278.136-.356.276-.313.572-.434 1.202-.422 1.84.027 1.436.633 2.58 1.838 3.393.137.093.172.187.129.323-.082.28-.18.552-.266.833-.055.179-.137.217-.329.14a5.526 5.526 0 01-1.736-1.18c-.857-.828-1.631-1.742-2.597-2.458a11.365 11.365 0 00-.689-.471c-.985-.957.13-1.743.388-1.836.27-.098.093-.432-.779-.428-.872.004-1.67.295-2.687.684a3.055 3.055 0 01-.465.137 9.597 9.597 0 00-2.883-.102c-1.885.21-3.39 1.102-4.497 2.623C.082 8.606-.231 10.684.152 12.85c.403 2.284 1.569 4.175 3.36 5.653 1.858 1.533 3.997 2.284 6.438 2.14 1.482-.085 3.133-.284 4.994-1.86.47.234.962.327 1.78.397.63.059 1.236-.03 1.705-.128.735-.156.684-.837.419-.961-2.155-1.004-1.682-.595-2.113-.926 1.096-1.296 2.746-2.642 3.392-7.003.05-.347.007-.565 0-.845-.004-.17.035-.237.23-.256a4.173 4.173 0 001.545-.475c1.396-.763 1.96-2.015 2.093-3.517.02-.23-.004-.467-.247-.588zM11.581 18c-2.089-1.642-3.102-2.183-3.52-2.16-.392.024-.321.471-.235.763.09.288.207.486.371.739.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.167-1.361-.802-2.5-1.86-3.301-3.307-.774-1.393-1.224-2.887-1.298-4.482-.02-.386.093-.522.477-.592a4.696 4.696 0 011.529-.039c2.132.312 3.946 1.265 5.468 2.774.868.86 1.525 1.887 2.202 2.891.72 1.066 1.494 2.082 2.48 2.914.348.292.625.514.891.677-.802.09-2.14.11-3.054-.614zm1-6.44a.306.306 0 01.415-.287.302.302 0 01.2.288.306.306 0 01-.31.307.303.303 0 01-.304-.308zm3.11 1.596c-.2.081-.399.151-.59.16a1.245 1.245 0 01-.798-.254c-.274-.23-.47-.358-.552-.758a1.73 1.73 0 01.016-.588c.07-.327-.008-.537-.239-.727-.187-.156-.426-.199-.688-.199a.559.559 0 01-.254-.078c-.11-.054-.2-.19-.114-.358.028-.054.16-.186.192-.21.356-.202.767-.136 1.146.016.352.144.618.408 1.001.782.391.451.462.576.685.914.176.265.336.537.445.848.067.195-.019.354-.25.452z"})})}const D={CLAUDE:s,ZCODE:O,CODEBUDDY:i,WORKBUDDY:i,CODEX:h,COPILOT:w,CRAFT:M,CURSOR:x,DEEPSEEK:B,DROID:H,"EVERY-CODE":h,GEMINI:v,GITHUB:m,GITLAB:I,GOOSE:R,GROK:u,HERMES:L,KIMI:f,KIRO:C,KILOCODE:z,MINIMAX:j,OPENCODE:g,OMP:p,PI:e,"PI-ANTHROPIC":e,"PI-GITHUB-COPILOT":e,"PI-COPILOT":e,ROOCODE:V,ZED:E},P={ANTIGRAVITY:"/brand-logos/antigravity.svg",ANYTHINGLLM:"/brand-logos/anythingllm.svg",CLAUDE:"/brand-logos/claude-code.svg",CODEX:"/brand-logos/codex.svg",DEEPSEEK:"/brand-logos/deepseek.svg",GEMINI:"/brand-logos/gemini.svg","KILO-CLI":"/brand-logos/kilo.svg","KILO-CODE":"/brand-logos/kilo.svg",MIMO:"/brand-logos/mimo.svg",OPENCLAW:"/brand-logos/openclaw.svg",OPENCODE:"/brand-logos/opencode.svg"},A={ANYTHINGLLM:"brightness-0 dark:brightness-100"};function y({size:c=16,className:r=""}){return l.jsx("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:r,children:l.jsx("circle",{cx:"12",cy:"12",r:"7.5",strokeDasharray:"3 3"})})}function b({provider:c,size:r=16,color:k,className:t=""}){const o=c?.toUpperCase?.()||"",a=P[o];if(a){const d=`${A[o]||""} ${t}`.trim();return l.jsx("img",{src:a,alt:"",width:r,height:r,className:d,style:{width:r,height:r,objectFit:"contain"},"aria-hidden":!0})}const n=D[o];return n?l.jsx(n,{size:r,className:t}):l.jsx(y,{size:r,className:`text-oai-gray-400 dark:text-oai-gray-500 shrink-0 ${t}`})}export{b as P};

Sorry, the diff of this file is too big to display

import{f as d,a as m,r as o,j as e,L as l,c as t}from"./__vite-browser-external-CuMc3dqk.js";import{L as x}from"./LoginCard-DHj1TAkh.js";function n(s,a){for(const i of a){const r=s.get(i);if(typeof r=="string"&&r.trim())return r.trim()}return""}function h(){const[s]=d(),{enabled:a}=m(),i=o.useMemo(()=>n(s,["otp","token","reset_token","insforge_token"]),[s]),r=o.useMemo(()=>n(s,["email"]),[s]),c=o.useMemo(()=>n(s,["code"]),[s]);return a?e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 h-16 flex items-center justify-between",children:e.jsx(l,{to:"/login",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 rounded",children:t("reset_password.back_to_sign_in")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4 py-12",children:e.jsx("div",{className:"w-full max-w-md border border-oai-gray-900 bg-oai-gray-950 rounded-2xl overflow-hidden shadow-2xl",children:e.jsx(x,{hideLogo:!0,initialMode:i?"reset_confirm":"reset_email",tokenFromUrl:i,initialEmail:r,initialCode:c})})})]}):e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 py-4",children:e.jsx(l,{to:"/login",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline",children:t("reset_password.back_to_sign_in")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4",children:e.jsx("p",{className:"text-oai-gray-400 text-center max-w-md",children:t("login.cloud_only")})})]})}export{h as ResetPasswordPage};
import{l as c}from"./__vite-browser-external-CuMc3dqk.js";const e=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],o=c("search",e);export{o as S};
import{r as b,j as d,d as w}from"./__vite-browser-external-CuMc3dqk.js";function S({id:l,value:c,onChange:g,placeholder:x,disabled:u=!1,type:m="text",label:h,error:i,className:s="",...n}){const y=b.useId(),f=l||y,t=i?`${f}-error`:void 0,r=`w-full bg-oai-white dark:bg-oai-gray-900 border border-oai-gray-300 dark:border-oai-gray-700 rounded-md text-oai-black dark:text-oai-white placeholder-oai-gray-400 dark:placeholder-oai-gray-500 transition-all duration-200 focus:outline-none focus:border-oai-brand dark:focus:border-oai-brand focus:ring-1 focus:ring-oai-brand/30 ${u?"bg-oai-gray-50 dark:bg-oai-gray-800 text-oai-gray-400 dark:text-oai-gray-400 cursor-not-allowed":""} ${i?"border-oai-error focus:border-oai-error focus:ring-oai-error/30":""} h-10 px-3 text-sm ${s}`;return d.jsxs("div",{className:"w-full",children:[h&&d.jsx("label",{htmlFor:f,className:"block text-sm font-medium text-oai-gray-700 dark:text-oai-gray-300 mb-1.5 transition-colors duration-200",children:h}),d.jsx("input",{id:f,type:m,value:c,onChange:g,placeholder:x,disabled:u,"aria-invalid":i?!0:void 0,"aria-describedby":t,className:r,...n}),i&&d.jsx("p",{id:t,className:"mt-1.5 text-sm text-oai-error",children:i})]})}function j({options:l,value:c,onChange:g,leading:x=null,disabled:u=!1,ariaLabel:m,className:h=""}){const i=b.useRef(null),s=b.useRef(new Map),[n,y]=b.useState(null),f=(t,a)=>{const e=l.filter(k=>!u&&!k.disabled),o=e.findIndex(k=>k.id===a);if(o<0)return;let r=null;t.key==="ArrowRight"||t.key==="ArrowDown"?r=e[(o+1)%e.length]:t.key==="ArrowLeft"||t.key==="ArrowUp"?r=e[(o-1+e.length)%e.length]:t.key==="Home"?r=e[0]:t.key==="End"&&(r=e[e.length-1]),!(!r||r.id===a)&&(t.preventDefault(),g(r.id),s.current.get(r.id)?.focus())};return b.useLayoutEffect(()=>{const t=()=>{const e=s.current.get(c);if(!e||e.offsetWidth===0)return;const o={left:e.offsetLeft,top:e.offsetTop,width:e.offsetWidth,height:e.offsetHeight};y(r=>r&&r.left===o.left&&r.top===o.top&&r.width===o.width&&r.height===o.height?r:o)};if(t(),typeof ResizeObserver>"u"||!i.current)return;const a=new ResizeObserver(t);a.observe(i.current);for(const e of s.current.values())a.observe(e);return()=>a.disconnect()},[c,l]),d.jsxs("div",{ref:i,role:"tablist","aria-label":m,className:w("relative inline-flex h-8 items-center gap-1 rounded-md border border-oai-gray-200 bg-oai-gray-100 p-[3px] dark:border-oai-gray-700 dark:bg-oai-gray-800",h),children:[x,n?d.jsx("span",{"aria-hidden":!0,className:"pointer-events-none absolute left-0 top-0 rounded-sm bg-white shadow-sm transition-[transform,width] duration-200 ease-out motion-reduce:transition-none dark:bg-oai-gray-700",style:{transform:`translate(${n.left}px, ${n.top}px)`,width:`${n.width}px`,height:`${n.height}px`}}):null,l.map(t=>{const a=t.id===c;return d.jsxs("button",{ref:e=>{e?s.current.set(t.id,e):s.current.delete(t.id)},type:"button",role:"tab","aria-selected":a,tabIndex:a?0:-1,disabled:u||t.disabled,onClick:()=>g(t.id),onKeyDown:e=>f(e,t.id),className:w("relative z-10 inline-flex h-6 items-center gap-1.5 rounded px-2.5 text-xs font-medium transition-colors disabled:opacity-50",a?"text-oai-black dark:text-white":"text-oai-gray-500 hover:text-oai-black dark:text-oai-gray-400 dark:hover:text-white"),children:[t.icon,t.label]},t.id)})]})}export{S as I,j as S};
import{r as v,O as i,P as w,z as k,j as e,d as b}from"./__vite-browser-external-CuMc3dqk.js";import{C as j}from"./ToolbarRootContext-xOR5ZEzv.js";import{C as N}from"./check-Dy8VgHZ8.js";import{u as C,a as E,s as l,L as I,b as R,S as T,c as L,d as P,e as A,f as O,g as _,h as z,i as D,j as G}from"./SelectItemText-DrcW545o.js";const M=v.forwardRef(function(t,s){const{render:n,className:f,style:o,...c}=t,{store:r,scrollHandlerRef:d}=C(),{alignItemWithTriggerActive:g}=E(),u=i(r,l.hasScrollArrows),h=i(r,l.openMethod),a=i(r,l.multiple),m={id:`${i(r,l.id)}-list`,role:"listbox","aria-multiselectable":a||void 0,onScroll(x){d.current?.(x.currentTarget)},...g&&{style:I},className:u&&h!=="touch"?R.className:void 0},S=w(x=>{r.set("listElement",x)});return k("div",t,{ref:[s,S],props:[m,c]})}),V="relative inline-flex items-center justify-between gap-2 rounded-lg border border-oai-gray-200 bg-white text-oai-black transition-colors hover:border-oai-gray-300 focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-white dark:hover:border-oai-gray-700";function W({value:y,onValueChange:t,options:s=[],ariaLabel:n,id:f,disabled:o=!1,leadingIcon:c=null,className:r="",popupClassName:d="",align:g="start",matchTriggerWidth:u=!1}){const h=s.map(a=>({value:a.value,label:a.label}));return e.jsxs(T,{value:y,items:h,disabled:o,onValueChange:a=>{!o&&a!=null&&t?.(a)},children:[e.jsxs(L,{id:f,"aria-label":n,className:b(V,o&&"cursor-not-allowed opacity-50 hover:border-oai-gray-200 dark:hover:border-oai-gray-800",r),children:[e.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[c,e.jsx(P,{className:"truncate"})]}),e.jsx(j,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})]}),e.jsx(A,{children:e.jsx(O,{align:g,side:"bottom",sideOffset:4,className:"z-50",children:e.jsx(_,{className:b("max-h-[min(18rem,var(--available-height))] origin-[var(--transform-origin)] overflow-y-auto","rounded-xl border border-oai-gray-200 bg-white p-1 shadow-lg ring-1 ring-black/[0.04]","dark:border-oai-gray-700 dark:bg-oai-gray-900 dark:ring-white/[0.05]","transition-[opacity,transform] duration-150 ease-out","data-[starting-style]:scale-95 data-[starting-style]:opacity-0","data-[ending-style]:scale-95 data-[ending-style]:opacity-0",u&&"min-w-[var(--anchor-width)]",d),children:e.jsx(M,{role:"listbox","aria-label":n,children:s.map(a=>e.jsxs(z,{value:a.value,disabled:a.disabled,className:({selected:p,disabled:m})=>b("flex w-full cursor-pointer items-center gap-1.5 whitespace-nowrap rounded-lg py-1.5 pl-1.5 pr-6","text-left text-xs outline-none transition-colors",p?"bg-oai-gray-100 text-oai-black dark:bg-oai-gray-800/70 dark:text-white":"text-oai-gray-600 hover:bg-oai-gray-50 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800/60",m&&"cursor-not-allowed opacity-50 hover:bg-transparent dark:hover:bg-transparent"),children:[e.jsx("span",{className:"flex w-3.5 shrink-0 items-center justify-center text-oai-gray-500 dark:text-oai-gray-300",children:e.jsx(D,{children:e.jsx(N,{className:"h-3 w-3","aria-hidden":!0})})}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:e.jsx(G,{children:a.label})})]},String(a.value)))})})})})]})}export{W as S};
import{bP as Xt,bN as Rn,r,P as le,bc as Pt,aG as G,c8 as _t,c9 as Mt,ca as Bt,bT as Ct,aU as st,aE as He,A as Me,cb as zt,ba as jt,cc as at,aD as bn,b1 as Jt,cd as bt,ce as St,cf as Qt,cg as Lt,aS as ht,ch as Sn,bX as In,ci as At,ax as it,aI as be,W as Zt,aH as xt,aT as En,j as ye,V as Y,O as w,az as Ft,aK as Ot,aJ as Tn,aM as Mn,aN as Cn,aO as Dt,cj as vn,bU as wn,aL as yt,bL as Pn,y as en,z as Qe,ck as An,aA as On,cl as Vn,aB as Ln,bV as Fn,aW as Dn,cm as Nn,ay as tn,cn as vt}from"./__vite-browser-external-CuMc3dqk.js";import{v as We,q as kn,o as Un,E as Hn,G as Le,H as nn,J as _n,u as Bn,m as rn,h as zn,a as jn,l as Wn,A as Kn,I as Yn,d as qn,p as $n,b as Gn}from"./useScrollLock-DmM-LeMm.js";import{i as Xn,u as Jn,j as Qn,a as Zn,d as er,c as tr,e as nr,g as rr,k as or,p as sr,r as ir,h as lr}from"./ToolbarRootContext-xOR5ZEzv.js";function tt(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}const cr="Escape";function It(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function ft(e,t){return It(t,e===Qt||e===Lt,e===bt||e===St)}function wt(e,t,n){return It(t,e===Lt,n?e===bt:e===St)||e==="Enter"||e===" "||e===""}function ur(e,t,n){return It(t,n?e===bt:e===St,e===Lt)}function ar(e,t,n,o){const l=n?e===St:e===bt,c=e===Qt;return t==="both"||t==="horizontal"&&o?e===cr:It(t,l,c)}function fr(e,t){const{listRef:n,activeIndex:o,onNavigate:l=()=>{},enabled:c=!0,selectedIndex:i=null,allowEscape:R=!1,loopFocus:u=!1,nested:m=!1,rtl:v=!1,virtual:a=!1,focusItemOnOpen:p="auto",focusItemOnHover:b=!0,openOnArrowKeyDown:y=!0,disabledIndices:O=void 0,orientation:g="vertical",parentOrientation:S,id:V,resetOnPointerLeave:E=!0,externalTree:d,grid:L}=t,j=L!=null,q="rootStore"in e?e.rootStore:e,D=q.useState("open"),W=q.useState("floatingElement"),J=q.useState("domReferenceElement"),me=q.context.dataRef,he=Xt(W),$=Rn(J),P=We(he),H=kn(),oe=Un(d),z=r.useRef(p),T=r.useRef(i??-1),K=r.useRef(null),k=r.useRef(!0),s=le(f=>{l(T.current===-1?null:T.current,f)}),M=r.useRef(!!W),ae=r.useRef(D),U=r.useRef(!1),pe=r.useRef(!1),ge=r.useRef(null),h=We(O),F=We(D),se=We(i),Se=We(E),B=Pt(),ne=Pt(),Q=le(()=>{function f(_){a?oe?.events.emit("virtualfocus",_):ge.current=Hn(_,{sync:U.current,preventScroll:!0})}const x=n.current[T.current],X=pe.current;x&&f(x),(U.current?_=>_():_=>B.request(_))(()=>{const _=n.current[T.current]||x;if(!_)return;x||f(_),Re&&(X||!k.current)&&_.scrollIntoView?.({block:"nearest",inline:"nearest"})})});G(()=>{me.current.orientation=g},[me,g]),G(()=>{c&&(D&&W?(T.current=i??-1,z.current&&i!=null&&(pe.current=!0,s())):M.current&&(T.current=-1,s()))},[c,D,W,i,s]),G(()=>{if(c){if(!D){U.current=!1;return}if(W)if(o==null){if(U.current=!1,se.current!=null)return;if(M.current&&(T.current=-1,Q()),(!ae.current||!M.current)&&z.current&&(K.current!=null||z.current===!0&&K.current==null)){let f=0;const x=()=>{n.current[0]==null?(f<2&&(f?I=>ne.request(I):queueMicrotask)(x),f+=1):(T.current=K.current==null||wt(K.current,g,v)||m?Mt(n):Bt(n),K.current=null,s())};x()}}else _t(n.current,o)||(T.current=o,Q(),pe.current=!1)}},[c,D,W,o,se,m,n,g,v,s,Q,ne]),G(()=>{if(!c||W||!oe||a||!M.current)return;const f=oe.nodesRef.current,x=f.find(_=>_.id===H)?.context?.elements.floating,X=Ct(st(J??x??null)),I=f.some(_=>_.context&&He(_.context.elements.floating,X));x&&!I&&k.current&&x.focus({preventScroll:!0})},[c,W,J,oe,H,a]),G(()=>{ae.current=D,M.current=!!W}),G(()=>{D||(K.current=null,z.current=p)},[D,p]);const xe=o!=null,ce=le(f=>{if(!F.current)return;const x=n.current.indexOf(f.currentTarget);x!==-1&&(T.current!==x||o!==x)&&(T.current=x,s(f))}),ue=le(()=>S??oe?.nodesRef.current.find(f=>f.id===H)?.context?.dataRef?.current.orientation),de=le(()=>Mt(n,h.current)),ee=le(f=>{if(k.current=!1,U.current=!0,f.which===229||!F.current&&f.currentTarget===P.current)return;if(m&&ar(f.key,g,v,j)){ft(f.key,ue())||Le(f),q.setOpen(!1,Me(zt,f.nativeEvent)),jt(J)&&(a?oe?.events.emit("virtualfocus",J):J.focus());return}const x=T.current,X=Mt(n,O),I=Bt(n,O);if($||(f.key==="Home"&&(Le(f),T.current=X,s(f)),f.key==="End"&&(Le(f),T.current=I,s(f))),L!=null){const _=L(f,T.current,n,g,u,v,O,X,I);if(_!=null&&(T.current=_,s(f)),g==="both")return}if(ft(f.key,g)){if(Le(f),D&&!a&&Ct(f.currentTarget.ownerDocument)===f.currentTarget){T.current=wt(f.key,g,v)?X:I,s(f);return}wt(f.key,g,v)?u?x>=I?R&&x!==n.current.length?T.current=-1:(U.current=!1,T.current=X):T.current=at(n.current,{startingIndex:x,disabledIndices:O}):T.current=Math.min(I,at(n.current,{startingIndex:x,disabledIndices:O})):u?x<=X?R&&x!==-1?T.current=n.current.length:(U.current=!1,T.current=I):T.current=at(n.current,{startingIndex:x,decrement:!0,disabledIndices:O}):T.current=Math.max(X,at(n.current,{startingIndex:x,decrement:!0,disabledIndices:O})),_t(n.current,T.current)&&(T.current=-1),s(f)}}),Re=r.useMemo(()=>({onFocus(x){U.current=!0,ce(x)},onClick:({currentTarget:x})=>x.focus({preventScroll:!0}),onMouseMove(x){U.current=!0,pe.current=!1,b&&ce(x)},onPointerLeave(x){if(!F.current||!k.current||x.pointerType==="touch")return;U.current=!0;const X=x.relatedTarget;if(!(!b||n.current.includes(X))&&Se.current&&(ge.current?.(),ge.current=null,T.current=-1,s(x),!a)){const I=P.current,_=Ct(st(I));I&&He(I,_)&&I.focus({preventScroll:!0})}}}),[ce,F,P,b,n,s,Se,a]),te=r.useMemo(()=>a&&D&&xe&&{"aria-activedescendant":`${V}-${o}`},[a,D,xe,V,o]),Z=r.useMemo(()=>({"aria-orientation":g==="both"?void 0:g,...$?{}:te,onKeyDown(f){if(f.key==="Tab"&&f.shiftKey&&D&&!a){const x=bn(f.nativeEvent);if(x&&!He(P.current,x))return;Le(f),q.setOpen(!1,Me(Jt,f.nativeEvent)),jt(J)&&J.focus();return}ee(f)},onPointerMove(){k.current=!0}}),[te,ee,P,g,$,q,D,a,J]),re=r.useMemo(()=>{function f(I){q.setOpen(!0,Me(zt,I.nativeEvent,I.currentTarget))}function x(I){p==="auto"&&nn(I.nativeEvent)&&(z.current=!a)}function X(I){z.current=p,p==="auto"&&_n(I.nativeEvent)&&(z.current=!0)}return{onKeyDown(I){const _=q.select("open");k.current=!1;const ve=I.key.startsWith("Arrow"),De=ur(I.key,ue(),v),Ee=ft(I.key,g),Ae=(m?De:Ee)||I.key==="Enter"||I.key.trim()==="";if(a&&_)return ee(I);if(!(!_&&!y&&ve)){if(Ae){const fe=ft(I.key,ue());K.current=m&&fe?null:I.key}if(m){De&&(Le(I),_?(T.current=de(),s(I)):f(I));return}Ee&&(se.current!=null&&(T.current=se.current),Le(I),!_&&y?f(I):ee(I),_&&s(I))}},onFocus(I){q.select("open")&&!a&&(T.current=-1,s(I))},onPointerDown:X,onPointerEnter:X,onMouseDown:x,onClick:x}},[ee,p,de,m,s,q,y,g,ue,v,se,a]),A=r.useMemo(()=>({...te,...re}),[te,re]);return r.useMemo(()=>c?{reference:A,floating:Z,item:Re,trigger:re}:{},[c,A,Z,re,Re])}function dr(e,t){const{listRef:n,elementsRef:o,activeIndex:l,onMatch:c,disabledIndices:i,onTyping:R,enabled:u=!0,resetMs:m=750,selectedIndex:v=null}=t,a="rootStore"in e?e.rootStore:e,p=a.useState("open"),b=ht(),y=r.useRef(""),O=r.useRef(v??l??-1),g=r.useRef(null),S=le(d=>{function L(P){const H=o?.current[P];return!H||In(H)}function j(P){return L(P)?i==null||!Sn(At,P,i):!1}function q(P,H,oe=0){if(P.length===0)return-1;const z=(oe%P.length+P.length)%P.length,T=H.toLowerCase();for(let K=0;K<P.length;K+=1){const k=(z+K)%P.length;if(!(!P[k]?.toLowerCase().startsWith(T)||!j(k)))return k}return-1}const D=n.current;if(y.current.length>0&&d.key===" "&&(Le(d),R?.(!0)),y.current.length>0&&y.current[0]!==" "&&q(D,y.current)===-1&&d.key!==" "&&R?.(!1),D==null||d.key.length!==1||d.ctrlKey||d.metaKey||d.altKey)return;p&&d.key!==" "&&(Le(d),R?.(!0));const W=y.current==="";W&&(O.current=v??l??-1),D.every((P,H)=>P&&j(H)?P[0]?.toLowerCase()!==P[1]?.toLowerCase():!0)&&y.current===d.key&&(y.current="",O.current=g.current),y.current+=d.key,b.start(m,()=>{y.current="",O.current=g.current,R?.(!1)});const he=((W?v??l??-1:O.current)??0)+1,$=q(D,y.current,he);$!==-1?(c?.($),g.current=$):d.key!==" "&&(y.current="",R?.(!1))}),V=le(d=>{const L=d.relatedTarget,j=a.select("domReferenceElement"),q=a.select("floatingElement");He(j,L)||He(q,L)||(b.clear(),y.current="",O.current=g.current,R?.(!1))});G(()=>{!p&&v!==null||(b.clear(),g.current=null,y.current!==""&&(y.current=""))},[p,v,b]),G(()=>{p&&y.current===""&&(O.current=v??l??-1)},[p,v,l]);const E=r.useMemo(()=>({onKeyDown:S,onBlur:V}),[S,V]);return r.useMemo(()=>u?{reference:E,floating:E}:{},[u,E])}function pr(e){const[t,n]=r.useState({current:e,previous:null});return e!==t.current&&n({current:e,previous:t.current}),t.previous}function gr(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}function Wt({controlled:e,default:t,name:n,state:o="value"}){const{current:l}=r.useRef(e!==void 0),[c,i]=r.useState(t),R=l?e:c,u=r.useCallback(m=>{l||i(m)},[]);return[R,u]}const on=r.createContext(null),sn=r.createContext(null);function Ye(){const e=r.useContext(on);if(e===null)throw new Error(it(60));return e}function ln(){const e=r.useContext(sn);if(e===null)throw new Error(it(61));return e}let Kt=(function(e){return e.disabled="data-disabled",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const mr={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},nt={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},hr={disabled:!1,...nt},yr={valid(e){return e===null?null:e?{[Kt.valid]:""}:{[Kt.invalid]:""}}},xr={invalid:void 0,name:void 0,validityData:{state:mr,errors:[],error:"",value:"",initialValue:null},setValidityData:be,disabled:void 0,touched:nt.touched,setTouched:be,dirty:nt.dirty,setDirty:be,filled:nt.filled,setFilled:be,focused:nt.focused,setFocused:be,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:hr,markedDirtyRef:{current:!1},registerFieldControl:be,validation:{getValidationProps:(e,t=Zt)=>t,inputRef:{current:null},registerInput:be,commit:async()=>{},change:be}},Rr=r.createContext(xr);function Nt(e=!0){const t=r.useContext(Rr);if(t.setValidityData===be&&!e)throw new Error(it(28));return t}function br(e,t,n,o,l=!0,c){const{registerFieldControl:i}=Nt(),R=r.useRef(null);R.current||(R.current=Symbol()),G(()=>{const u=R.current;return!u||!l?void 0:(i(u,{controlRef:e,getValue:o,id:t,name:c,value:n}),()=>{i(u,void 0)})},[e,l,o,t,c,i,n])}const Sr=r.createContext({controlId:void 0,registerControlId:be,labelId:void 0,setLabelId:be,messageIds:[],setMessageIds:be,getDescriptionProps:e=>e});function cn(){return r.useContext(Sr)}function un(e={}){const{id:t,implicit:n=!1,controlRef:o}=e,{controlId:l,registerControlId:c}=cn(),i=Bn(t),R=n?l:void 0,u=xt(()=>Symbol("labelable-control")),m=r.useRef(!1),v=r.useRef(t!=null),a=le(()=>{!m.current||c===be||(m.current=!1,c(u.current,void 0))});return G(()=>{if(c===be)return;let p;if(n){const b=o?.current;En(b)&&b.closest("label")!=null?p=t??null:p=R??i}else if(t!=null)v.current=!0,p=t;else if(v.current)p=i;else{a();return}if(p===void 0){a();return}m.current=!0,c(u.current,p)},[t,o,R,c,n,i,u,a]),r.useEffect(()=>a,[a]),l??i}const Ir=(e,t)=>Object.is(e,t);function Ke(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Er(e,t,n){return!e||e.length===0?!1:e.some(o=>o===void 0?!1:Ke(t,o,n))}function ot(e,t,n){return!e||e.length===0?-1:e.findIndex(o=>o===void 0?!1:Ke(o,t,n))}function Tr(e,t,n){return e.filter(o=>!Ke(t,o,n))}function Vt(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function an(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function Mr(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(an(t)){for(const n of t)for(const o of n.items)if(o&&o.value==null&&o.label!=null)return!0;return!1}for(const n of t)if(n&&n.value==null&&n.label!=null)return!0;return!1}function fn(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return Vt(e)}function je(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?Vt(e.value):Vt(e)}function dn(e,t,n){function o(){return fn(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??o();if(Array.isArray(t)){const l=t,c=an(l)?l.flatMap(i=>i.items):l;if(e==null||typeof e!="object"){const i=c.find(R=>R.value===e);return i&&i.label!=null?i.label:o()}if("value"in e){const i=c.find(R=>R&&R.value===e.value);if(i&&i.label!=null)return i.label}}return o()}function Cr(e,t,n){return e.reduce((o,l,c)=>(c>0&&o.push(", "),o.push(ye.jsx(r.Fragment,{children:dn(l,t,n)},c)),o),[])}const C={id:Y(e=>e.id),labelId:Y(e=>e.labelId),modal:Y(e=>e.modal),multiple:Y(e=>e.multiple),items:Y(e=>e.items),itemToStringLabel:Y(e=>e.itemToStringLabel),itemToStringValue:Y(e=>e.itemToStringValue),isItemEqualToValue:Y(e=>e.isItemEqualToValue),value:Y(e=>e.value),hasSelectedValue:Y(e=>{const{value:t,multiple:n,itemToStringValue:o}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:je(t,o)!==""}),hasNullItemLabel:Y((e,t)=>t?Mr(e.items):!1),open:Y(e=>e.open),mounted:Y(e=>e.mounted),forceMount:Y(e=>e.forceMount),transitionStatus:Y(e=>e.transitionStatus),openMethod:Y(e=>e.openMethod),activeIndex:Y(e=>e.activeIndex),selectedIndex:Y(e=>e.selectedIndex),isActive:Y((e,t)=>e.activeIndex===t),isSelected:Y((e,t)=>{const n=e.isItemEqualToValue,o=e.value;return e.multiple?Array.isArray(o)&&o.some(l=>Ke(t,l,n)):Ke(t,o,n)}),isSelectedByFocus:Y((e,t)=>e.selectedIndex===t),popupProps:Y(e=>e.popupProps),triggerProps:Y(e=>e.triggerProps),triggerElement:Y(e=>e.triggerElement),positionerElement:Y(e=>e.positionerElement),listElement:Y(e=>e.listElement),popupSide:Y(e=>e.popupSide),scrollUpArrowVisible:Y(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:Y(e=>e.scrollDownArrowVisible),hasScrollArrows:Y(e=>e.hasScrollArrows)},vr=r.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:be,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function wr(){return r.useContext(vr)}function Pr(e,t,n=(o,l)=>o===l){return e.length===t.length&&e.every((o,l)=>n(o,t[l]))}const Fe=1;function pn(e,t){return Math.max(0,e-t)}function Ar(e,t){if(t<=0)return 0;const n=tt(e,0,t),o=n,l=t-n,c=o<=Fe,i=l<=Fe;return c&&i?o<=l?0:t:c?0:i?t:n}function to(e){const{id:t,value:n,defaultValue:o=null,onValueChange:l,open:c,defaultOpen:i=!1,onOpenChange:R,name:u,form:m,autoComplete:v,disabled:a=!1,readOnly:p=!1,required:b=!1,modal:y=!0,actionsRef:O,inputRef:g,onOpenChangeComplete:S,items:V,multiple:E=!1,itemToStringLabel:d,itemToStringValue:L,isItemEqualToValue:j=Ir,highlightItemOnHover:q=!0,children:D}=e,{clearErrors:W}=wr(),{setDirty:J,setTouched:me,setFocused:he,validityData:$,setFilled:P,name:H,disabled:oe,validation:z,validationMode:T}=Nt(),K=un({id:t}),k=oe||a,s=H??u,[M,ae]=Wt({controlled:n,default:E?o??At:o,name:"Select",state:"value"}),[U,pe]=Wt({controlled:c,default:i,name:"Select",state:"open"}),ge=r.useRef([]),h=r.useRef([]),F=r.useRef(null),se=r.useRef(null),Se=r.useRef(0),B=r.useRef(null),ne=r.useRef([]),Q=r.useRef(!1),xe=r.useRef(null),ce=r.useRef(null),ue=r.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),de=r.useRef(!1),{mounted:ee,setMounted:Re,transitionStatus:te}=rn(U),{openMethod:Z,triggerProps:re}=Xn(U),A=xt(()=>new vn({id:K,labelId:void 0,modal:y,multiple:E,itemToStringLabel:d,itemToStringValue:L,isItemEqualToValue:j,value:M,open:U,mounted:ee,transitionStatus:te,items:V,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,f=w(A,C.activeIndex),x=w(A,C.selectedIndex),X=w(A,C.triggerElement),I=w(A,C.positionerElement),_=pr(Z),ve=Z??_??null,De=r.useMemo(()=>E?"":je(M,L),[E,M,L]),Ee=r.useMemo(()=>E&&Array.isArray(M)?M.map(N=>je(N,L)):je(M,L),[E,M,L]),Ae=We(A.state.triggerElement),fe=le(()=>Ee);br(Ae,K,M,fe,!k,u);const Oe=r.useRef(M),Ve=E?Array.isArray(M)&&M.length>0:M!=null&&je(M,L)!=="";G(()=>{M!==Oe.current&&A.set("forceMount",!0)},[A,M]),G(()=>{P(Ve)},[Ve,P]),G(function(){const ie=ne.current;let Te;if(E){const Ie=Array.isArray(M)?M:[];if(Ie.length===0)Te=null;else{const Ue=Ie[Ie.length-1],ze=ot(ie,Ue,j);Te=ze===-1?null:ze}}else{const Ie=ot(ie,M,j);Te=Ie===-1?null:Ie}Te===null&&(ce.current=null),!U&&A.set("selectedIndex",Te)},[Ve,E,U,M,ne,j,A,ce]);function we(N){const ie=$.initialValue;return Array.isArray(N)&&Array.isArray(ie)?!Pr(N,ie,(Te,Ie)=>Ke(Te,Ie,j)):N!==ie}Jn(M,()=>{W(s),J(we(M)),z.change(M)});const qe=le((N,ie)=>{R?.(N,ie),!ie.isCanceled&&(pe(N),!N&&(ie.reason===Jt||ie.reason===wn)&&(me(!0),he(!1),T==="onBlur"&&z.commit(M)))}),$e=le(()=>{Re(!1),A.update({activeIndex:null,openMethod:null}),S?.(!1)});Ft({enabled:!O,open:U,ref:F,onComplete(){U||$e()}}),r.useImperativeHandle(O,()=>({unmount:$e}),[$e]);const Ne=le((N,ie)=>{l?.(N,ie),!ie.isCanceled&&ae(N)}),Pe=le(()=>{const N=A.state.listElement||F.current;if(!N)return;const ie=pn(N.scrollHeight,N.clientHeight),Te=Ar(N.scrollTop,ie),Ie=Te>0,Ue=Te<ie;A.state.scrollUpArrowVisible!==Ie&&A.set("scrollUpArrowVisible",Ie),A.state.scrollDownArrowVisible!==Ue&&A.set("scrollDownArrowVisible",Ue)}),_e=Qn({open:U,onOpenChange:qe,elements:{reference:X,floating:I}}),Ge=Zn(_e,{enabled:!p&&!k,event:"mousedown"}),Xe=zn(_e),ke=fr(_e,{enabled:!p&&!k,listRef:ge,activeIndex:f,selectedIndex:x,disabledIndices:At,onNavigate(N){N===null&&!U||A.set("activeIndex",N)},focusItemOnHover:q}),Be=dr(_e,{enabled:!p&&!k&&(U||!E),listRef:h,activeIndex:f,selectedIndex:x,disabledIndices:N=>gr(ge.current[N]),onMatch(N){U?A.set("activeIndex",N):Ne(ne.current[N],Me("none"))},onTyping(N){Q.current=N}}),Ze=r.useMemo(()=>{const N=Ot(Be.reference,ke.reference,Xe.reference,Ge.reference,re);return K&&(N.id=K),N},[Ge.reference,Be.reference,ke.reference,Xe.reference,re,K]),et=r.useMemo(()=>Ot(jn,Be.floating,ke.floating,Xe.floating),[Be.floating,ke.floating,Xe.floating]),lt=ke.item??Zt;Wn(()=>{A.update({popupProps:et,triggerProps:Ze})}),G(()=>{A.update({id:K,modal:y,multiple:E,value:M,open:U,mounted:ee,transitionStatus:te,popupProps:et,triggerProps:Ze,items:V,itemToStringLabel:d,itemToStringValue:L,isItemEqualToValue:j,openMethod:ve})},[A,K,y,E,M,U,ee,te,et,Ze,V,d,L,j,ve]);const Ce=r.useMemo(()=>({store:A,name:s,required:b,disabled:k,readOnly:p,multiple:E,highlightItemOnHover:q,setValue:Ne,setOpen:qe,listRef:ge,popupRef:F,scrollHandlerRef:se,handleScrollArrowVisibility:Pe,scrollArrowsMountedCountRef:Se,itemProps:lt,valueRef:B,valuesRef:ne,labelsRef:h,typingRef:Q,selectionRef:ue,firstItemTextRef:xe,selectedItemTextRef:ce,validation:z,onOpenChangeComplete:S,alignItemWithTriggerActiveRef:de,initialValueRef:Oe}),[A,s,b,k,p,E,q,Ne,qe,lt,z,S,Pe]),Je=Tn(g,z.inputRef),ct=E&&Array.isArray(M)&&M.length>0,ut=E?void 0:s,Et=r.useMemo(()=>!E||!Array.isArray(M)||!s?null:M.map(N=>{const ie=je(N,L);return ye.jsx("input",{type:"hidden",form:m,name:s,value:ie,disabled:k},ie)}),[E,M,m,s,L,k]);return ye.jsx(on.Provider,{value:Ce,children:ye.jsxs(sn.Provider,{value:_e,children:[D,ye.jsx("input",{...z.getValidationProps(k,{onFocus(){A.state.triggerElement?.focus({focusVisible:!0})},onChange(N){if(N.nativeEvent.defaultPrevented||k||p)return;const ie=N.currentTarget.value,Te=Me(Dt,N.nativeEvent);function Ie(){if(E)return;const Ue=ie.toLowerCase();let ze=ne.current.findIndex(Tt=>je(Tt,L).toLowerCase()===Ue||fn(Tt,d).toLowerCase()===Ue);ze===-1&&(ze=ne.current.findIndex((Tt,xn)=>{const Ht=h.current[xn];return Ht!=null&&Ht.toLowerCase()===Ue}));const Ut=ze===-1?void 0:ne.current[ze];Ut!=null&&Ne(Ut,Te)}A.set("forceMount",!0),queueMicrotask(Ie)}}),id:K&&ut==null?`${K}-hidden-input`:void 0,form:m,name:ut,autoComplete:v,value:De,disabled:k,required:b&&!ct,readOnly:p,ref:Je,style:s?Mn:Cn,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Et]})})}function Or(e,t){return e??t}function Vr(e){const t=e.getBoundingClientRect(),n=yt(e);if(Pn)return t;const o=n.getComputedStyle(e,"::before"),l=n.getComputedStyle(e,"::after");if(!(o.content!=="none"||l.content!=="none"))return t;const i=parseFloat(o.width)||0,R=parseFloat(o.height)||0,u=parseFloat(l.width)||0,m=parseFloat(l.height)||0,v=Math.max(t.width,i,u),a=Math.max(t.height,R,m),p=v-t.width,b=a-t.height;return{left:t.left-p/2,right:t.right+p/2,top:t.top-b/2,bottom:t.bottom+b/2}}const dt=2,Lr=400,Fr={...Kn,...yr,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},no=r.forwardRef(function(t,n){const{render:o,className:l,id:c,disabled:i=!1,nativeButton:R=!0,style:u,...m}=t,{setTouched:v,setFocused:a,validationMode:p,state:b,disabled:y}=Nt(),{labelId:O}=cn(),{store:g,setOpen:S,selectionRef:V,validation:E,readOnly:d,required:L,alignItemWithTriggerActiveRef:j,disabled:q}=Ye(),D=y||q||i,W=w(g,C.open),J=w(g,C.mounted),me=w(g,C.value),he=w(g,C.triggerProps),$=w(g,C.positionerElement),P=w(g,C.listElement),H=w(g,C.popupSide),oe=w(g,C.id),z=w(g,C.labelId),T=w(g,C.hasSelectedValue),K=J&&$?H:null,k=c??oe,s=Or(O,z);un({id:k});const M=We($),ae=r.useRef(null),{getButtonProps:U,buttonRef:pe}=en({disabled:D,native:R}),ge=le(Q=>{g.set("triggerElement",Q)}),h=ht(),F=ht(),se=ht();r.useEffect(()=>{if(W)return se.start(Lr,()=>{V.current.allowUnselectedMouseUp=!0,V.current.allowSelectedMouseUp=!0}),()=>{se.clear()};V.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},F.clear()},[W,V,F,se]);const Se=Ot(he,{id:k,role:"combobox","aria-expanded":W?"true":"false","aria-haspopup":"listbox","aria-controls":W?P?.id??Xt($)?.id:void 0,"aria-labelledby":s,"aria-readonly":d||void 0,"aria-required":L||void 0,tabIndex:D?-1:0,onFocus(Q){a(!0),W&&j.current&&S(!1,Me(Dt,Q.nativeEvent)),h.start(0,()=>{g.set("forceMount",!0)})},onBlur(Q){He($,Q.relatedTarget)||(v(!0),a(!1),p==="onBlur"&&E.commit(me))},onMouseDown(Q){if(W)return;const xe=st(Q.currentTarget);function ce(ue){if(!ae.current)return;const de=ue.target;if(He(ae.current,de)||He(M.current,de))return;const ee=Vr(ae.current);ue.clientX>=ee.left-dt&&ue.clientX<=ee.right+dt&&ue.clientY>=ee.top-dt&&ue.clientY<=ee.bottom+dt||S(!1,Me(An,ue))}F.start(0,()=>{xe.addEventListener("mouseup",ce,{once:!0})})}},m,U),B=E.getValidationProps(D,Se);B.role="combobox";const ne={...b,open:W,disabled:D,value:me,readOnly:d,popupSide:K,placeholder:!T};return Qe("button",t,{ref:[n,ae,pe,ge],state:ne,stateAttributesMapping:Fr,props:B})}),Dr={value:()=>null},ro=r.forwardRef(function(t,n){const{className:o,render:l,children:c,placeholder:i,style:R,...u}=t,{store:m,valueRef:v}=Ye(),a=w(m,C.value),p=w(m,C.items),b=w(m,C.itemToStringLabel),y=w(m,C.hasSelectedValue),O=!y&&i!=null&&c==null,g=w(m,C.hasNullItemLabel,O),S={value:a,placeholder:!y};let V=null;return typeof c=="function"?V=c(a):c!=null?V=c:!y&&i!=null&&!g?V=i:Array.isArray(a)?V=Cr(a,p,b):V=dn(a,p,b),Qe("span",t,{state:S,ref:[n,v],props:[{children:V},u],stateAttributesMapping:Dr})}),Nr=r.createContext(void 0),oo=r.forwardRef(function(t,n){const{store:o}=Ye(),l=w(o,C.mounted),c=w(o,C.forceMount);return l||c?ye.jsx(Nr.Provider,{value:!0,children:ye.jsx(On,{ref:n,...t})}):null}),gn=r.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function kr(){return r.useContext(gn)}function Ur(e){const{children:t,elementsRef:n,labelsRef:o,onMapChange:l}=e,c=le(l),i=r.useRef(0),R=xt(_r).current,u=xt(Hr).current,[m,v]=r.useState(0),a=r.useRef(m),p=le((S,V)=>{u.set(S,V??null),a.current+=1,v(a.current)}),b=le(S=>{u.delete(S),a.current+=1,v(a.current)}),y=r.useMemo(()=>{const S=new Map;return Array.from(u.keys()).filter(E=>E.isConnected).sort(Br).forEach((E,d)=>{const L=u.get(E)??{};S.set(E,{...L,index:d})}),S},[u,m]);G(()=>{if(typeof MutationObserver!="function"||y.size===0)return;const S=new MutationObserver(V=>{const E=new Set,d=L=>E.has(L)?E.delete(L):E.add(L);V.forEach(L=>{L.removedNodes.forEach(d),L.addedNodes.forEach(d)}),E.size===0&&(a.current+=1,v(a.current))});return y.forEach((V,E)=>{E.parentElement&&S.observe(E.parentElement,{childList:!0})}),()=>{S.disconnect()}},[y]),G(()=>{a.current===m&&(n.current.length!==y.size&&(n.current.length=y.size),o&&o.current.length!==y.size&&(o.current.length=y.size),i.current=y.size),c(y)},[c,y,n,o,m]),G(()=>()=>{n.current=[]},[n]),G(()=>()=>{o&&(o.current=[])},[o]);const O=le(S=>(R.add(S),()=>{R.delete(S)}));G(()=>{R.forEach(S=>S(y))},[R,y]);const g=r.useMemo(()=>({register:p,unregister:b,subscribeMapChange:O,elementsRef:n,labelsRef:o,nextIndexRef:i}),[p,b,O,n,o,i]);return ye.jsx(gn.Provider,{value:g,children:t})}function Hr(){return new Map}function _r(){return new Set}function Br(e,t){const n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}const mn=r.createContext(void 0);function zr(){const e=r.useContext(mn);if(!e)throw new Error(it(59));return e}function Rt(e,t){e&&Object.assign(e.style,t)}const jr={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},Wr={position:"fixed"},so=r.forwardRef(function(t,n){const{anchor:o,positionMethod:l="absolute",className:c,render:i,side:R="bottom",align:u="center",sideOffset:m=0,alignOffset:v=0,collisionBoundary:a="clipping-ancestors",collisionPadding:p,arrowPadding:b=5,sticky:y=!1,disableAnchorTracking:O,alignItemWithTrigger:g=!0,collisionAvoidance:S=Vn,style:V,...E}=t,{store:d,listRef:L,labelsRef:j,alignItemWithTriggerActiveRef:q,selectedItemTextRef:D,valuesRef:W,initialValueRef:J,popupRef:me,setValue:he}=Ye(),$=ln(),P=w(d,C.open),H=w(d,C.mounted),oe=w(d,C.modal),z=w(d,C.value),T=w(d,C.openMethod),K=w(d,C.positionerElement),k=w(d,C.triggerElement),s=w(d,C.isItemEqualToValue),M=w(d,C.transitionStatus),ae=r.useRef(null),U=r.useRef(null),[pe,ge]=r.useState(g),h=H&&pe&&T!=="touch";!H&&pe!==g&&ge(g),G(()=>{H||(C.scrollUpArrowVisible(d.state)&&d.set("scrollUpArrowVisible",!1),C.scrollDownArrowVisible(d.state)&&d.set("scrollDownArrowVisible",!1))},[d,H]),r.useImperativeHandle(q,()=>h),er((h||oe)&&P,T==="touch",K,k);const F=tr({anchor:o,floatingRootContext:$,positionMethod:l,mounted:H,side:R,sideOffset:m,align:u,alignOffset:v,arrowPadding:b,collisionBoundary:a,collisionPadding:p,sticky:y,disableAnchorTracking:O??h,collisionAvoidance:S,keepMounted:!0}),se=h?"none":F.side,Se=h?Wr:F.positionerStyles,B={open:P,side:se,align:F.align,anchorHidden:F.anchorHidden};G(()=>{d.set("popupSide",F.side)},[d,F.side]);const ne=le(de=>{d.set("positionerElement",de)}),Q=nr(t,B,{styles:Se,transitionStatus:M,props:E,refs:[n,ne],hidden:!H,inert:!P}),xe=r.useRef(0),ce=le(de=>{if(de.size===0&&xe.current===0||W.current.length===0)return;const ee=xe.current;if(xe.current=de.size,de.size===ee)return;const Re=Me(Dt);if(ee!==0&&!d.state.multiple&&z!==null&&ot(W.current,z,s)===-1){const Z=J.current,A=Z!=null&&ot(W.current,Z,s)!==-1?Z:null;he(A,Re),A===null&&(d.set("selectedIndex",null),D.current=null)}if(ee!==0&&d.state.multiple&&Array.isArray(z)){const te=re=>ot(W.current,re,s)!==-1,Z=z.filter(re=>te(re));(Z.length!==z.length||Z.some(re=>!Er(z,re,s)))&&(he(Z,Re),Z.length===0&&(d.set("selectedIndex",null),D.current=null))}if(P&&h){d.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const te={height:""};Rt(K,te),Rt(me.current,te)}}),ue=r.useMemo(()=>({...F,side:se,alignItemWithTriggerActive:h,setControlledAlignItemWithTrigger:ge,scrollUpArrowRef:ae,scrollDownArrowRef:U}),[F,se,h,ge]);return ye.jsx(Ur,{elementsRef:L,labelsRef:j,onMapChange:ce,children:ye.jsxs(mn.Provider,{value:ue,children:[H&&oe&&ye.jsx(Yn,{inert:Ln(!P),cutout:k}),Q]})})}),pt="base-ui-disable-scrollbar",Yt={className:pt,getElement(e){return ye.jsx("style",{nonce:e,href:pt,precedence:"base-ui:low",children:`.${pt}{scrollbar-width:none}.${pt}::-webkit-scrollbar{display:none}`})}},Kr=r.createContext(void 0),Yr={disableStyleElements:!1};function qr(){return r.useContext(Kr)??Yr}const $r={...$n,...tn},io=r.forwardRef(function(t,n){const{render:o,className:l,style:c,finalFocus:i,...R}=t,{store:u,popupRef:m,onOpenChangeComplete:v,setOpen:a,valueRef:p,firstItemTextRef:b,selectedItemTextRef:y,multiple:O,handleScrollArrowVisibility:g,scrollHandlerRef:S,listRef:V,highlightItemOnHover:E}=Ye(),{side:d,align:L,alignItemWithTriggerActive:j,isPositioned:q,setControlledAlignItemWithTrigger:D}=zr(),W=rr()!=null,J=ln(),me=or(),{nonce:he,disableStyleElements:$}=qr(),P=w(u,C.id),H=w(u,C.open),oe=w(u,C.openMethod),z=w(u,C.mounted),T=w(u,C.popupProps),K=w(u,C.transitionStatus),k=w(u,C.triggerElement),s=w(u,C.positionerElement),M=w(u,C.listElement),ae=r.useRef(!1),U=r.useRef(!1),pe=r.useRef({}),ge=Pt(),h=le(B=>{if(!s||!m.current||!U.current)return;if(ae.current||!j){g();return}const ne=s.style.top==="0px",Q=s.style.bottom==="0px";if(!ne&&!Q){g();return}const xe=$t(s),ce=rt(s.getBoundingClientRect().height,"y",xe),ue=st(s),de=yt(s),ee=de.getComputedStyle(s),Re=parseFloat(ee.marginTop),te=parseFloat(ee.marginBottom),Z=qt(de.getComputedStyle(m.current)),re=Math.min(ue.documentElement.clientHeight-Re-te,Z),A=B.scrollTop,f=gt(B);let x=0,X=null,I=!1,_=!1;const ve=fe=>{s.style.height=`${fe}px`},De=(fe,Oe)=>{const Ve=tt(fe,0,re-ce);Ve>0&&ve(ce+Ve),B.scrollTop=Oe,re-(ce+Ve)<=Fe&&(ae.current=!0),g()},Ee=ne?f-A:A,Ae=Math.min(ce+Ee,re);if(x=Ae,Ee<=Fe){De(Ee,ne?f:0);return}if(re-Ae>Fe)ne?_=!0:X=0;else if(I=!0,Q&&A<f){const fe=ce+Ee-re;X=A-(Ee-fe)}if(x=Math.ceil(x),x!==0&&ve(x),_||X!=null){const fe=gt(B),Oe=_?fe:tt(X,0,fe);Math.abs(B.scrollTop-Oe)>Fe&&(B.scrollTop=Oe)}(I||x>=re-Fe)&&(ae.current=!0),g()});r.useImperativeHandle(S,()=>h,[h]),Ft({open:H,ref:m,onComplete(){H&&v?.(!0)}});const F={open:H,transitionStatus:K,side:d,align:L};G(()=>{!s||!m.current||Object.keys(pe.current).length||(pe.current={top:s.style.top||"0",left:s.style.left||"0",right:s.style.right,height:s.style.height,bottom:s.style.bottom,minHeight:s.style.minHeight,maxHeight:s.style.maxHeight,marginTop:s.style.marginTop,marginBottom:s.style.marginBottom})},[m,s]),G(()=>{H||j||(U.current=!1,ae.current=!1,Rt(s,pe.current))},[H,j,s,m]),G(()=>{const B=m.current;if(!H||!k||!s||!B||j&&!q||u.state.transitionStatus==="ending")return;if(!j){U.current=!0,ge.request(g),B.style.removeProperty("--transform-origin");return}const ne=Gr(B);B.style.removeProperty("--transform-origin");try{let Q=y.current;Q?.isConnected||(Q=!C.hasSelectedValue(u.state)&&b.current?.isConnected?b.current:null);const xe=p.current,ce=yt(s),ue=ce.getComputedStyle(s),de=ce.getComputedStyle(B),ee=st(k),Re=$t(k),te=mt(k.getBoundingClientRect(),Re),Z=mt(s.getBoundingClientRect(),Re),re=te.height,A=M||B,f=A.scrollHeight,x=parseFloat(de.borderBottomWidth),X=parseFloat(ue.marginTop)||10,I=parseFloat(ue.marginBottom)||10,_=parseFloat(ue.minHeight)||100,ve=qt(de),De=5,Ee=5,Ae=20,fe=ee.documentElement.clientHeight-X-I,Oe=ee.documentElement.clientWidth,Ve=fe-te.bottom+re;let we,qe=me==="rtl"?te.right-Z.width:te.left,$e=0;if(Q&&xe){const Ce=mt(xe.getBoundingClientRect(),Re);we=mt(Q.getBoundingClientRect(),Re),qe=Z.left+(me==="rtl"?Ce.right-we.right:Ce.left-we.left);const Je=Ce.top-te.top+Ce.height/2;$e=we.top-Z.top+we.height/2-Je}const Ne=Ve+$e+I+x;let Pe=Math.min(fe,Ne);const _e=fe-X-I,Ge=Ne-Pe,Xe=Oe-Ee;s.style.left=`${tt(qe,De,Xe-Z.width)}px`,s.style.height=`${Pe}px`,s.style.maxHeight="none",s.style.marginTop=`${X}px`,s.style.marginBottom=`${I}px`,B.style.height="100%";const ke=gt(A),Be=Ge>=ke-Fe;Be&&(Pe=Math.min(fe,Z.height)-(Ge-ke));const Ze=te.top<Ae||te.bottom>fe-Ae||Math.ceil(Pe)+Fe<Math.min(f,_),et=(ce.visualViewport?.scale??1)!==1&&Fn;if(Ze||et){U.current=!0,Rt(s,pe.current),D(!1);return}const lt=Math.max(_,Pe);if(Be){const Ce=Math.max(0,fe-Ne);s.style.top=Z.height>=_e?"0":`${Ce}px`,s.style.height=`${Pe}px`,A.scrollTop=gt(A)}else s.style.bottom="0",A.scrollTop=Ge;if(we){const Ce=Z.top,Je=Z.height,ct=we.top+we.height/2,ut=Je>0?(ct-Ce)/Je*100:50,Et=tt(ut,0,100);B.style.setProperty("--transform-origin",`50% ${Et}%`)}(lt===fe||Pe>=ve)&&(ae.current=!0),g(),E&&u.state.selectedIndex===null&&u.state.activeIndex===null&&V.current[0]!=null&&u.set("activeIndex",0),U.current=!0}finally{ne()}},[u,H,s,k,p,b,y,m,g,j,D,ge,M,V,E,me,q]),r.useEffect(()=>{if(!j||!s||!H)return;const B=yt(s);function ne(Q){a(!1,Me(Nn,Q))}return Dn(B,"resize",ne)},[a,j,s,H]);const se={...M?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":O||void 0,id:`${P}-list`},onKeyDown(B){W&&Gn.has(B.key)&&B.stopPropagation()},onScroll(B){M||h(B.currentTarget)},...j&&{style:M?{height:"100%"}:jr}},Se=Qe("div",t,{ref:[n,m],state:F,stateAttributesMapping:$r,props:[T,se,lr(K),{className:!M&&j?Yt.className:void 0},R]});return ye.jsxs(r.Fragment,{children:[!$&&Yt.getElement(he),ye.jsx(qn,{context:J,modal:!1,disabled:!z,openInteractionType:oe,returnFocus:i,restoreFocus:!0,children:Se})]})});function qt(e){const t=e.maxHeight||"";return t.endsWith("px")&&parseFloat(t)||1/0}function gt(e){return pn(e.scrollHeight,e.clientHeight)}function $t(e){return sr.getScale(e)}function rt(e,t,n){return e/n[t]}function mt(e,t){return ir({x:rt(e.x,"x",t),y:rt(e.y,"y",t),width:rt(e.width,"x",t),height:rt(e.height,"y",t)})}const Gt=[["transform","none"],["scale","1"],["translate","0 0"]];function Gr(e){const{style:t}=e,n={};for(const[o,l]of Gt)n[o]=t.getPropertyValue(o),t.setProperty(o,l,"important");return()=>{for(const[o]of Gt){const l=n[o];l?t.setProperty(o,l):t.removeProperty(o)}}}let hn=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function Xr(e={}){const{label:t,metadata:n,textRef:o,indexGuessBehavior:l,index:c}=e,{register:i,unregister:R,subscribeMapChange:u,elementsRef:m,labelsRef:v,nextIndexRef:a}=kr(),p=r.useRef(-1),[b,y]=r.useState(c??(l===hn.GuessFromOrder?()=>{if(p.current===-1){const S=a.current;a.current+=1,p.current=S}return p.current}:-1)),O=r.useRef(null),g=r.useCallback(S=>{if(O.current=S,b!==-1&&S!==null&&(m.current[b]=S,v)){const V=t!==void 0;v.current[b]=V?t:o?.current?.textContent??S.textContent}},[b,m,v,t,o]);return G(()=>{if(c!=null)return;const S=O.current;if(S)return i(S,n),()=>{R(S)}},[c,i,R,n]),G(()=>{if(c==null)return u(S=>{const V=O.current?S.get(O.current)?.index:null;V!=null&&y(V)})},[c,u,y]),{ref:g,index:b}}const yn=r.createContext(void 0);function kt(){const e=r.useContext(yn);if(!e)throw new Error(it(57));return e}const lo=r.memo(r.forwardRef(function(t,n){const{render:o,className:l,style:c,value:i=null,label:R,disabled:u=!1,nativeButton:m=!1,...v}=t,a=r.useRef(null),p=Xr({label:R,textRef:a,indexGuessBehavior:hn.GuessFromOrder}),{store:b,itemProps:y,setOpen:O,setValue:g,selectionRef:S,typingRef:V,valuesRef:E,multiple:d,selectedItemTextRef:L,disabled:j,readOnly:q}=Ye(),D=w(b,C.isActive,p.index),W=w(b,C.open),J=w(b,C.isSelected,i),me=w(b,C.isSelectedByFocus,p.index),he=w(b,C.isItemEqualToValue),$=p.index,P=$!==-1,H=r.useRef(null);G(()=>{if(!P)return;const h=E.current;return h[$]=i,()=>{delete h[$]}},[P,$,i,E]),G(()=>{if(!P)return;const h=b.state.value;let F=h;d&&Array.isArray(h)&&(F=h.length>0?h[h.length-1]:void 0),F!==void 0&&Ke(i,F,he)&&(b.set("selectedIndex",$),a.current&&(L.current=a.current))},[P,$,d,he,b,i,L]);const oe=r.useRef(null),z=r.useRef("mouse"),T=r.useRef(!1),{getButtonProps:K,buttonRef:k}=en({disabled:u,focusableWhenDisabled:!0,native:m,composite:!0}),s={disabled:u,selected:J,highlighted:D};function M(h){if(j||q)return;const F=b.state.value;if(d){const se=Array.isArray(F)?F:[],Se=J?Tr(se,i,he):[...se,i];g(Se,Me(vt,h))}else g(i,Me(vt,h)),O(!1,Me(vt,h))}function ae(){S.current.dragY=0}const U={role:"option","aria-selected":J,tabIndex:W&&D?0:-1,onKeyDown(h){oe.current=h.key,b.set("activeIndex",$),h.key===" "&&V.current&&h.preventDefault()},onClick(h){const F=h.type==="click"&&z.current!=="touch",se=h.nativeEvent.pointerType,Se=F&&nn(h.nativeEvent)&&(se!==void 0||D),B=F&&!Se&&!T.current;T.current=!1,!(h.type==="keydown"&&oe.current===null)&&(u||h.type==="keydown"&&oe.current===" "&&V.current||B||(oe.current=null,M(h.nativeEvent)))},onPointerEnter(h){z.current=h.pointerType},onPointerMove(h){if(h.pointerType==="mouse"&&h.buttons===1){const F=S.current;F.dragY+=h.movementY,F.dragY**2>=64&&(F.allowUnselectedMouseUp=!0)}},onPointerDown(h){z.current=h.pointerType,T.current=!0,ae()},onMouseUp(){if(ae(),u||z.current==="touch"||T.current)return;const h=!S.current.allowSelectedMouseUp&&J,F=!S.current.allowUnselectedMouseUp&&!J;h||F||(T.current=!0,H.current?.click(),T.current=!1)}},pe=Qe("div",t,{ref:[k,n,p.ref,H],state:s,props:[y,U,v,K]}),ge=r.useMemo(()=>({selected:J,index:$,textRef:a,selectedByFocus:me,hasRegistered:P}),[J,$,a,me,P]);return ye.jsx(yn.Provider,{value:ge,children:pe})})),co=r.forwardRef(function(t,n){const o=t.keepMounted??!1,{selected:l}=kt();return o||l?ye.jsx(Jr,{...t,ref:n}):null}),Jr=r.memo(r.forwardRef((e,t)=>{const{render:n,className:o,style:l,keepMounted:c,...i}=e,{selected:R}=kt(),u=r.useRef(null),{transitionStatus:m,setMounted:v}=rn(R),p=Qe("span",e,{ref:[t,u],state:{selected:R,transitionStatus:m},props:[{"aria-hidden":!0,children:"✔️"},i],stateAttributesMapping:tn});return Ft({open:R,ref:u,onComplete(){R||v(!1)}}),p})),uo=r.memo(r.forwardRef(function(t,n){const{index:o,textRef:l,selectedByFocus:c,hasRegistered:i}=kt(),{firstItemTextRef:R,selectedItemTextRef:u}=Ye(),{render:m,className:v,style:a,...p}=t,b=r.useCallback(O=>{O&&(i&&o===0&&(R.current=O),i&&c&&(u.current=O))},[R,u,o,c,i]);return Qe("div",t,{ref:[b,n,l],props:p})}));export{jr as L,to as S,zr as a,Yt as b,no as c,ro as d,oo as e,so as f,io as g,lo as h,co as i,uo as j,yr as k,wr as l,Nt as m,cn as n,Wt as o,br as p,C as s,Ye as u};
import{l as K,r as o,j as e,d as E,c as a,a0 as W,J as H,a2 as X,X as Y,R as ee,k as $,a3 as te,a4 as R}from"./__vite-browser-external-CuMc3dqk.js";import{S as U,I as ae}from"./SegmentedControl-C_ZhjPE7.js";import{C as re}from"./ToolbarRootContext-xOR5ZEzv.js";import{S as z}from"./search-DtGZgKCk.js";import{C as se}from"./check-Dy8VgHZ8.js";import{P as oe,a as ie,b as ne,c as le,d as ce}from"./PopoverPopup-B6oEN7QL.js";import{P as de}from"./ProviderIcon-B6sgfDtI.js";import{H as ue}from"./HoverTooltip-jQvD29cq.js";import{L as xe}from"./LocalOnlyNotice-D8FJuEXT.js";import{u as me}from"./useCurrency-DdWYV5RR.js";import{i as he}from"./host-mode-Bc_iTzHk.js";import{L as fe}from"./loader-circle-CracNP_H.js";import{T as pe}from"./terminal-d0IOaeZn.js";import"./useScrollLock-DmM-LeMm.js";import"./store-NtnkxrS2.js";import"./arrow-up-right-D2tCxxHL.js";import"./download-zNMgxXgK.js";const ge=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],ye=K("calendar",ge);const be=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],ke=K("folder",be),ve="flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-sm text-oai-black outline-none hover:bg-oai-gray-100 dark:text-white dark:hover:bg-oai-gray-800";function je({options:r,value:t,onChange:s,allValue:d="all",allLabel:h,searchPlaceholder:k,emptyLabel:S,ariaLabel:u,disabled:x=!1,className:T=""}){const[p,I]=o.useState(!1),[g,w]=o.useState(""),[c,m]=o.useState(-1),F=o.useRef(null),C=`${o.useId()}-listbox`,M=t===d?h:r.find(n=>n.value===t)?.label??t,N=g.trim().toLowerCase(),v=o.useMemo(()=>N?r.filter(n=>n.label.toLowerCase().includes(N)):r,[r,N]),y=o.useMemo(()=>[{value:d,label:h},...v],[d,h,v]),O=c>=0&&c<y.length?y[c]:null,P=n=>{s(n),I(!1),w(""),m(-1)};o.useEffect(()=>{p&&F.current?.querySelector('[data-active="true"]')?.scrollIntoView?.({block:"nearest"})},[p,c]);const L=n=>{if(n.key==="ArrowDown"||n.key==="ArrowUp"){n.preventDefault();const f=n.key==="ArrowDown";m(_=>{const D=y.length;return D?f?_>=D-1?0:_+1:_<=0?D-1:_-1:-1});return}if(n.key==="Enter"){const f=O||(N&&v.length?v[0]:null);if(!f)return;n.preventDefault(),P(f.value)}};return e.jsxs(oe,{open:p,onOpenChange:n=>{I(n),m(-1),n||w("")},children:[e.jsxs(ie,{disabled:x,"aria-label":u,className:E("inline-flex h-8 max-w-[12rem] shrink-0 items-center gap-1.5 rounded-md border border-oai-gray-200 bg-oai-white px-2.5 text-xs font-medium transition hover:border-oai-gray-300 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 disabled:opacity-60 data-[popup-open]:border-oai-gray-300 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:hover:border-oai-gray-700",t!==d?"text-oai-black dark:text-white":"text-oai-gray-700 dark:text-oai-gray-200",T),children:[e.jsx(ke,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-400","aria-hidden":!0}),e.jsx("span",{className:"truncate",children:M}),e.jsx(re,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-400","aria-hidden":!0})]}),e.jsx(ne,{children:e.jsx(le,{sideOffset:4,side:"bottom",align:"start",className:"z-[60]",children:e.jsxs(ce,{className:"w-56 overflow-hidden rounded-md border border-oai-gray-200 bg-white p-1 shadow-[0_12px_32px_-12px_rgba(0,0,0,0.18)] outline-none dark:border-oai-gray-800 dark:bg-oai-gray-950 dark:shadow-[0_12px_32px_-12px_rgba(0,0,0,0.6)]",children:[e.jsxs("div",{className:"relative mb-1",children:[e.jsx(z,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-oai-gray-400","aria-hidden":!0}),e.jsx("input",{type:"text",role:"combobox","aria-expanded":!0,"aria-controls":C,"aria-activedescendant":O?`${C}-${c}`:void 0,value:g,onChange:n=>{w(n.target.value),m(-1)},onKeyDown:L,placeholder:k,className:"h-8 w-full rounded border border-oai-gray-200 bg-transparent pl-8 pr-2 text-xs text-oai-black outline-none placeholder:text-oai-gray-400 focus:border-oai-gray-400 dark:border-oai-gray-800 dark:text-white dark:focus:border-oai-gray-500"})]}),e.jsxs("div",{ref:F,id:C,role:"listbox","aria-label":u,className:"max-h-64 overflow-y-auto",children:[y.map((n,f)=>e.jsxs("button",{id:`${C}-${f}`,type:"button",role:"option","aria-selected":t===n.value,"data-active":f===c?"true":void 0,onMouseEnter:()=>m(f),onClick:()=>P(n.value),className:E(ve,t===n.value&&"bg-oai-gray-100 dark:bg-oai-gray-800",f===c&&"ring-1 ring-inset ring-oai-gray-300 dark:ring-oai-gray-600"),children:[e.jsx("span",{className:"flex-1 truncate",children:n.label}),t===n.value?e.jsx(se,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}):null]},n.value)),v.length===0?e.jsx("div",{className:"px-2 py-3 text-center text-xs text-oai-gray-400 dark:text-oai-gray-500",children:S}):null]})]})})})]})}const we="tokentracker-sessions";async function Ne(r={}){const t=new URL(`/functions/${we}`,window.location.origin);r.from&&t.searchParams.set("from",r.from),r.to&&t.searchParams.set("to",r.to),r.limit&&t.searchParams.set("limit",String(r.limit)),r.refresh&&t.searchParams.set("refresh","1");const s=await fetch(t.toString(),{headers:{Accept:"application/json"},cache:"no-store"}),d=await s.json().catch(()=>null);if(!s.ok){const h=s.status===404?a("sessions.error.outdated_app"):`Request failed with HTTP ${s.status}`,k=new Error(d?.error||h);throw k.status=s.status,k}return d}const Q=he(),_e=[],A=100,Se=[{id:"all",label:()=>a("sessions.filter.source_all")},{id:"claude",label:()=>"Claude Code"},{id:"codex",label:()=>"Codex"}],Z=[{id:"all",days:0,label:()=>a("sessions.filter.range_all")},{id:"7d",days:7,label:()=>a("sessions.filter.range_7d")},{id:"30d",days:30,label:()=>a("sessions.filter.range_30d")},{id:"90d",days:90,label:()=>a("sessions.filter.range_90d")}];function Ce(r){const t=Z.find(d=>d.id===r)?.days||0;if(!t)return 0;const s=new Date;return s.setDate(s.getDate()-(t-1)),s.setHours(0,0,0,0),s.getTime()}function Le(r,t){if(!t)return!0;const s=Date.parse(r.ended_at||r.started_at||"");return Number.isFinite(s)?s>=t:!0}function De(r,t){if(!r)return"—";const s=Date.parse(r);if(!Number.isFinite(s))return"—";try{return new Date(s).toLocaleString(t||void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return new Date(s).toISOString().slice(0,16).replace("T"," ")}}function Ie(r){const t=Number(r);if(!Number.isFinite(t)||t<=0)return null;const s=Math.round(t/6e4);if(s<60)return a("sessions.duration.minutes",{minutes:s});const d=Math.floor(s/60),h=s%60;return a("sessions.duration.hours",{hours:d,minutes:h})}async function G(r){if(navigator?.clipboard?.writeText)return await navigator.clipboard.writeText(r),!0;const t=document.createElement("textarea");t.value=r,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();const s=document.execCommand("copy");return document.body.removeChild(t),s}const Me=ee.memo(function({session:t,locale:s}){const{currency:d,rate:h}=me(),k=String(t.source||"").toUpperCase(),S=Ie(t.duration_ms),u=t.resume_command,x=t.project_key||a("sessions.project.unknown"),T=t.title||x,p=!!(t.title&&t.project_key),I=t.project_ref?`${t.project_ref}
${a("sessions.project.copy_hint")}`:void 0,g=async()=>{if(t.project_ref)try{await G(t.project_ref)?R({title:a("sessions.project.copied")}):R({title:a("sessions.project.copy_failed")})}catch{R({title:a("sessions.project.copy_failed")})}},w=m=>e.jsxs("span",{className:"group relative inline-flex min-w-0 max-w-full",children:[e.jsx(ue,{text:I,placement:"bottom"}),e.jsx("button",{type:"button",onClick:g,"aria-label":a("sessions.project.copy_aria",{project:x}),className:E("max-w-full truncate rounded text-left underline decoration-dotted decoration-oai-gray-300 underline-offset-4 hover:decoration-oai-gray-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:decoration-oai-gray-600 dark:hover:decoration-oai-gray-400",m),children:x})]}),c=async()=>{if(u)try{await G(u)?R({title:a("sessions.resume.copied")}):R({title:a("sessions.resume.copy_failed")})}catch{R({title:a("sessions.resume.copy_failed")})}};return e.jsxs("li",{className:"flex flex-col gap-3 py-4 sm:flex-row sm:items-start",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-start gap-2.5",children:[e.jsx("span",{className:"mt-0.5 shrink-0 text-oai-gray-400 dark:text-oai-gray-500",children:e.jsx(de,{provider:k,size:20})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[!t.title&&t.project_ref?w("font-medium text-oai-black dark:text-white"):e.jsx("span",{className:"truncate font-medium text-oai-black dark:text-white",children:T}),t.first_pass?e.jsx("span",{className:"inline-flex items-center rounded-full bg-emerald-50 px-2 py-0.5 text-[11px] font-medium text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-300",children:a("sessions.badge.first_pass")}):null]}),e.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:[p?e.jsxs(e.Fragment,{children:[t.project_ref?w("hover:text-oai-black dark:hover:text-white"):e.jsx("span",{className:"truncate",children:x}),e.jsx("span",{"aria-hidden":!0,children:"·"})]}):null,e.jsx("span",{className:"truncate",children:t.model||a("sessions.model.unknown")}),e.jsx("span",{"aria-hidden":!0,children:"·"}),e.jsx("span",{className:"tabular-nums",children:De(t.started_at,s)}),S?e.jsxs(e.Fragment,{children:[e.jsx("span",{"aria-hidden":!0,children:"·"}),e.jsx("span",{className:"tabular-nums",children:S})]}):null]})]})]}),e.jsxs("div",{className:"flex items-start gap-5 pl-[30px] sm:pl-0",children:[e.jsxs("dl",{className:"flex items-start gap-6 text-right",children:[e.jsxs("div",{className:"flex w-16 flex-col-reverse",children:[e.jsx("dt",{className:"text-[11px] text-oai-gray-400 dark:text-oai-gray-500",children:a("sessions.col.tokens")}),e.jsx("dd",{className:"tabular-nums text-sm font-medium text-oai-black dark:text-white",children:$(t.total_tokens)})]}),e.jsxs("div",{className:"flex w-16 flex-col-reverse",children:[e.jsx("dt",{className:"text-[11px] text-oai-gray-400 dark:text-oai-gray-500",children:a("sessions.col.cost")}),e.jsx("dd",{className:"tabular-nums text-sm font-medium text-oai-black dark:text-white",children:te(t.cost_usd,{currency:d,rate:h})})]}),e.jsxs("div",{className:"hidden w-10 flex-col-reverse sm:flex",children:[e.jsx("dt",{className:"text-[11px] text-oai-gray-400 dark:text-oai-gray-500",children:a("sessions.col.turns")}),e.jsx("dd",{className:"tabular-nums text-sm font-medium text-oai-black dark:text-white",children:$(t.turns)})]}),e.jsxs("div",{className:"hidden w-10 flex-col-reverse sm:flex",children:[e.jsx("dt",{className:"text-[11px] text-oai-gray-400 dark:text-oai-gray-500",children:a("sessions.col.edits")}),e.jsx("dd",{className:"tabular-nums text-sm font-medium text-oai-black dark:text-white",children:$(t.edit_turns)})]})]}),e.jsxs("button",{type:"button",onClick:c,disabled:!u,title:u||a("sessions.resume.unavailable"),"aria-label":u?a("sessions.resume.copy_aria",{command:u}):a("sessions.resume.unavailable"),className:E("-mt-0.5 inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",u?"text-oai-gray-500 hover:bg-oai-gray-100 hover:text-oai-black dark:text-oai-gray-400 dark:hover:bg-oai-gray-800 dark:hover:text-white":"cursor-not-allowed text-oai-gray-300 dark:text-oai-gray-600"),children:[e.jsx(pe,{className:"h-3.5 w-3.5","aria-hidden":!0}),e.jsx("span",{className:"hidden sm:inline",children:a("sessions.resume.copy")})]})]})]})});function Je(){const[r,t]=o.useState(null),[s,d]=o.useState(null),[h,k]=o.useState(!0),[S,u]=o.useState(!1),[x,T]=o.useState("all"),[p,I]=o.useState("all"),[g,w]=o.useState("all"),[c,m]=o.useState(""),[F,C]=o.useState(A),M=o.useRef(0),{resolvedLocale:N}=W(),v=o.useCallback(async(i=!1)=>{const b=++M.current;i?u(!0):k(!0),d(null);try{const l=await Ne({refresh:i});b===M.current&&t(l)}catch(l){b===M.current&&d(l?.message||String(l))}finally{b===M.current&&(k(!1),u(!1))}},[]);o.useEffect(()=>{Q||H()?v(!1):k(!1)},[v]);const y=r?.sessions||_e,O=o.useMemo(()=>{const i=new Set,b=[];for(const l of y){const j=l.project_key;!j||i.has(j)||(i.add(j),b.push({value:j,label:j}))}return b.sort((l,j)=>l.label.localeCompare(j.label))},[y]),P=o.useDeferredValue(c),L=o.useMemo(()=>{const i=P.trim().toLowerCase(),b=Ce(p);return y.filter(l=>x!=="all"&&l.source!==x||g!=="all"&&l.project_key!==g||!Le(l,b)?!1:i?`${l.title||""} ${l.project_key||""} ${l.model||""} ${l.project_ref||""} ${l.session_id||""}`.toLowerCase().includes(i):!0)},[y,x,g,p,P]),n=x!=="all"||p!=="all"||g!=="all"||c.trim()!=="";o.useEffect(()=>{C(A)},[x,g,p,P,y]);const f=o.useMemo(()=>L.slice(0,F),[L,F]),_=L.length>f.length,D=o.useCallback(()=>C(i=>i+A),[]),q=o.useRef(null);o.useEffect(()=>{if(!_||typeof IntersectionObserver>"u")return;const i=q.current;if(!i)return;const b=new IntersectionObserver(l=>{l.some(j=>j.isIntersecting)&&D()},{rootMargin:"400px"});return b.observe(i),()=>b.disconnect()},[_,D]);const B=o.useMemo(()=>Se.map(i=>({id:i.id,label:i.label()})),[N]),J=o.useMemo(()=>Z.map(i=>({id:i.id,label:i.label()})),[N]),V=Number(r?.session_count)>Number(r?.returned_count);return!Q&&!H()?e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx(xe,{})}):e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:e.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[e.jsxs("div",{className:"mb-8 flex flex-row items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"mb-3 text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:a("nav.sessions")}),e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400 sm:text-base",children:a("sessions.page.subtitle")})]}),e.jsx("button",{type:"button",onClick:()=>{v(!0)},disabled:S||h,"aria-label":a("sessions.page.refresh"),title:a("sessions.page.refresh"),className:"inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-oai-gray-200 text-oai-gray-600 transition-colors hover:bg-oai-gray-100 hover:text-oai-black focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-400 dark:hover:bg-oai-gray-800 dark:hover:text-white",children:e.jsx(X,{className:E("h-4 w-4",S&&"animate-spin"),"aria-hidden":!0})})]}),e.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2 pt-1 text-xs text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx(U,{ariaLabel:a("sessions.filter.source_aria"),options:B,value:x,onChange:T}),e.jsx(U,{className:"pl-2",ariaLabel:a("sessions.filter.range_aria"),leading:e.jsx(ye,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-400","aria-hidden":!0}),options:J,value:p,onChange:I}),e.jsx(je,{options:O,value:g,onChange:w,allLabel:a("sessions.filter.project_all"),searchPlaceholder:a("sessions.filter.project_search"),emptyLabel:a("sessions.filter.project_empty"),ariaLabel:a("sessions.filter.project_aria")}),e.jsxs("div",{className:"relative w-72 max-w-full",children:[e.jsx(z,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-oai-gray-400","aria-hidden":!0}),e.jsx(ae,{type:"search",value:c,onChange:i=>m(i.target.value),onKeyDown:i=>{i.key==="Escape"&&c&&(i.preventDefault(),m(""))},"aria-label":a("sessions.action.search_aria"),placeholder:a("sessions.search.placeholder"),className:"h-8 pl-9 pr-8 !border-oai-gray-200 dark:!border-oai-gray-800 focus:!border-oai-gray-400 focus:!ring-oai-gray-400/20 dark:focus:!border-oai-gray-500 dark:focus:!ring-oai-gray-500/20 [&::-webkit-search-cancel-button]:appearance-none"}),e.jsx("button",{type:"button",onMouseDown:i=>i.preventDefault(),onClick:()=>m(""),"aria-label":a("sessions.action.search_clear"),"aria-hidden":!c,tabIndex:c?0:-1,className:E("absolute right-2 top-1/2 flex h-6 w-6 -translate-y-1/2 items-center justify-center rounded-full text-oai-gray-400 transition duration-150 ease-out hover:bg-oai-gray-100 hover:text-oai-gray-600 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-gray-400/40 dark:hover:bg-oai-gray-800 dark:hover:text-oai-gray-200",c?"scale-100 opacity-100":"pointer-events-none scale-90 opacity-0"),children:e.jsx(Y,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),e.jsx("span",{className:"ml-auto shrink-0 tabular-nums text-oai-gray-500 dark:text-oai-gray-400",children:a("sessions.filter.result_count",{filtered:L.length,total:y.length})})]}),V?e.jsx("p",{className:"mb-4 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:a("sessions.truncated",{shown:r.returned_count,total:r.session_count})}):null,s&&!r?e.jsxs("div",{className:"rounded-xl border border-dashed border-red-300 py-16 text-center dark:border-red-500/40",children:[e.jsx("p",{className:"text-sm font-medium text-oai-black dark:text-white",children:a("sessions.error.title")}),e.jsx("p",{className:"mt-1 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s}),e.jsx("button",{type:"button",onClick:()=>{v(!1)},className:"mt-4 inline-flex h-8 items-center rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 hover:text-oai-black focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:border-oai-gray-800 dark:text-oai-gray-200 dark:hover:bg-oai-gray-800 dark:hover:text-white",children:a("sessions.error.retry")})]}):h?e.jsxs("div",{className:"flex items-center gap-2 py-16 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:[e.jsx(fe,{className:"h-4 w-4 animate-spin","aria-hidden":!0}),a("sessions.loading")]}):L.length===0?e.jsxs("div",{className:"rounded-xl border border-dashed border-oai-gray-200 py-16 text-center dark:border-oai-gray-800",children:[e.jsx("p",{className:"text-sm font-medium text-oai-black dark:text-white",children:n?a("sessions.empty.filtered_title"):a("sessions.empty.title")}),e.jsx("p",{className:"mt-1 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:n?a("sessions.empty.filtered_body"):a("sessions.empty.body")})]}):e.jsxs(e.Fragment,{children:[s?e.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400",children:a("shared.error.prefix",{error:s})}):null,e.jsx("ul",{className:"divide-y divide-oai-gray-200/70 dark:divide-oai-gray-800/70",children:f.map(i=>e.jsx(Me,{session:i,locale:N},i.session_hash))}),_?e.jsx("div",{ref:q,className:"flex justify-center pt-6",children:e.jsx("button",{type:"button",onClick:D,className:"inline-flex h-8 items-center rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-600 transition-colors hover:bg-oai-gray-100 hover:text-oai-black focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800 dark:hover:text-white",children:a("sessions.action.load_more")})}):null]}),e.jsx("p",{className:"mt-6 text-xs text-oai-gray-400 dark:text-oai-gray-500",children:a("sessions.privacy")})]})})})}export{Je as SessionsPage};
import{l as C,r as u,j as t,d as N,c as a,a as ie,ap as oe,bv as re,av as le,aw as ce,a7 as F,bw as ue,bx as de,u as ge,R as L,Y as me,a0 as H,m as I,by as he,bz as pe,N as $,bA as be,x as fe,bB as xe,bC as ye,bD as ve,bE as ke,bF as je,bG as Ne,bH as Se,L as Ce,a2 as we,bI as Le,a4 as _,f as Ae,bJ as Oe}from"./__vite-browser-external-CuMc3dqk.js";import{b as Ee,g as Pe,L as G,m as V}from"./react-B80AX8fE.js";import{u as Ie,L as T}from"./use-limits-display-prefs-DEZXM-yU.js";import{P as _e}from"./ProviderIcon-B6sgfDtI.js";import{a as D,l as R}from"./limits-providers-CMQJD3FZ.js";import{a as S,T as k,b as f,S as A,u as O}from"./use-native-settings-BkwcrMcE.js";import{P as Ge,u as Te,a as De}from"./use-session-efficiency-pref-B8rvdBw1.js";import{C as Re}from"./check-Dy8VgHZ8.js";import{C as Me}from"./copy-BIDPrnLf.js";import{A as Ue}from"./index-jpsn86uT.js";import{u as Fe}from"./useCurrency-DdWYV5RR.js";import{u as He}from"./useTokenFormat-BkFEXBXZ.js";import{S as B}from"./Select-C6oiyYQ_.js";import{I as $e}from"./info-CDTfOJ13.js";import{C as Ve}from"./ConfirmModal-CiJio3w8.js";import{A as Be}from"./arrow-up-right-D2tCxxHL.js";import{D as ze}from"./download-zNMgxXgK.js";import"./Card-C3Fxl-vL.js";import"./ToolbarRootContext-xOR5ZEzv.js";import"./useScrollLock-DmM-LeMm.js";import"./SelectItemText-DrcW545o.js";import"./DialogTitle-KxLDeLzC.js";import"./store-NtnkxrS2.js";import"./DialogDescription-BgYqW0_C.js";const qe=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Ke=C("activity",qe);const Ze=[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]],We=C("flask-conical",Ze);const Ye=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],Je=C("grip-vertical",Ye);const Qe=[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]],Xe=C("languages",Qe);const et=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],tt=C("log-out",et);const nt=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],at=C("palette",nt);const st=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],it=C("user-round",st),ot=e=>!e.isLayoutDirty&&e.willUpdate(!1);function M(){const e=new Set,n=new WeakMap,s=()=>e.forEach(ot);return{add:i=>{e.add(i),n.set(i,i.addEventListener("willUpdate",s))},remove:i=>{e.delete(i);const o=n.get(i);o&&(o(),n.delete(i)),s()},dirty:s}}const rt=u.createContext(null);function lt(){const e=u.useRef(!1);return Ee(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function ct(){const e=lt(),[n,s]=u.useState(0),i=u.useCallback(()=>{e.current&&s(n+1)},[n]);return[u.useCallback(()=>Pe.postRender(i),[i]),n]}const z=e=>e===!0,ut=e=>z(e===!0)||e==="id",dt=({children:e,id:n,inherit:s=!0})=>{const i=u.useContext(G),o=u.useContext(rt),[r,l]=ct(),d=u.useRef(null),g=i.id||o;d.current===null&&(ut(s)&&g&&(n=n?g+"-"+n:g),d.current={id:n,group:z(s)&&i.group||M()});const p=u.useMemo(()=>({...d.current,forceRender:r}),[l]);return t.jsx(G.Provider,{value:p,children:e})},gt="shrink-0 text-oai-gray-900 dark:text-oai-gray-200";function mt({checked:e,onChange:n,ariaLabel:s}){return t.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":s,onClick:n,className:N("relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",e?"bg-oai-brand-500":"bg-oai-gray-300 dark:bg-oai-gray-700"),children:t.jsx("span",{className:N("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",e?"translate-x-[18px]":"translate-x-[3px]")})})}function ht({prefs:e}){const{order:n,visibility:s,toggle:i,moveToward:o}=e,[r,l]=u.useState(null),[d,g]=u.useState(null),p=c=>h=>{l(c),h.dataTransfer.effectAllowed="move",h.dataTransfer.setData("text/plain",c)},m=c=>h=>{h.preventDefault(),h.dataTransfer.dropEffect="move",r&&r!==c&&d!==c&&(g(c),o(r,c))},x=()=>{l(null),g(null)},y=c=>{c.preventDefault(),l(null),g(null)};return t.jsx(dt,{children:t.jsx("div",{className:"flex flex-col",children:n.map(c=>{const h=s[c]!==!1,b=r===c;return t.jsxs(V.div,{layout:!0,transition:{duration:.28,ease:[.22,1,.36,1]},draggable:!0,onDragStart:p(c),onDragOver:m(c),onDragEnd:x,onDrop:y,className:N("flex items-center gap-3 py-2 rounded-md","hover:bg-oai-gray-100/60 dark:hover:bg-oai-gray-800/60",b&&"opacity-40"),style:{cursor:b?"grabbing":"grab"},children:[t.jsx(Je,{className:"h-4 w-4 shrink-0 text-oai-gray-400 dark:text-oai-gray-500",strokeWidth:1.75,"aria-hidden":!0}),D(c)?t.jsx(_e,{provider:D(c),size:18,className:N("pointer-events-none",gt)}):null,t.jsx("span",{className:"flex-1 text-sm text-oai-gray-900 dark:text-oai-gray-200 select-none",children:R(c)}),t.jsx("div",{onMouseDown:v=>v.stopPropagation(),draggable:!1,children:t.jsx(mt,{checked:h,onChange:()=>i(c),ariaLabel:`${a("limits.settings.toggle_visible")}: ${R(c)}`})})]},c)})})})}function pt(e){if(!e||typeof e!="object")return"";const n=e.user_metadata&&typeof e.user_metadata=="object"?e.user_metadata:{},s=e.profile&&typeof e.profile=="object"?e.profile:{},i=n.full_name||n.name||s.name||n.user_name||n.preferred_username;return typeof i=="string"&&i.trim()?i.trim():typeof e.email=="string"&&e.email.includes("@")?e.email.split("@")[0].trim()||e.email.trim():typeof e.email=="string"?e.email.trim():""}function bt(e){return!e||typeof e!="object"?"":typeof e.email=="string"?e.email.trim():""}function ft(e){const n=typeof e=="string"?e.trim():"";if(!n)return null;const s=n.match(/^@?([A-Za-z0-9][A-Za-z0-9-]{0,38})$/),i=n.match(/^https:\/\/github\.com\/([A-Za-z0-9][A-Za-z0-9-]{0,38})\/?$/i),o=s?.[1]||i?.[1];return o?`https://github.com/${o}`:null}function E(e,n){console.warn(`[tokentracker] settings ${e}:`,n)}function xt(e,n,s){const[i,o]=u.useState(()=>oe()),r=n&&s&&re(),l=u.useCallback(async()=>{const d=!i;if(le(d),o(d),!!d)try{await ce(()=>e())}catch(g){E("cloud sync",g)}},[i,e]);return{cloudSyncOn:i,handleCloudSyncToggle:l,showLocalCloudSync:r}}function yt(e){const[n,s]=u.useState(!1),[i,o]=u.useState(!1),[r,l]=u.useState(!1),[d,g]=u.useState(!1),[p,m]=u.useState(null),[x,y]=u.useState(!1),[c,h]=u.useState(""),[b,v]=u.useState(!1),[w,P]=u.useState(""),[W,Y]=u.useState(""),[J,Q]=u.useState(!1),[X,ee]=u.useState(null),te=u.useMemo(()=>pt(e),[e]),ne=u.useMemo(()=>bt(e),[e]),ae=u.useMemo(()=>typeof e?.id=="string"?e.id.trim():"",[e]),se=u.useMemo(()=>({setAnonymousOn:o,setCustomDisplayName:m,setGithubUrl:P,setProfileLoading:l,setPublicProfileOn:s,setShowGithubOn:v}),[]);return{anonymousOn:i,customDisplayName:p,displayName:te,editingGithub:J,editingName:x,email:ne,githubError:X,githubInput:W,githubUrl:w,loadSetters:se,nameInput:c,profileLoading:r,profileSaving:d,publicProfileOn:n,setAnonymousOn:o,setCustomDisplayName:m,setEditingGithub:Q,setEditingName:y,setGithubError:ee,setGithubInput:Y,setGithubUrl:P,setNameInput:h,setProfileLoading:l,setProfileSaving:g,setPublicProfileOn:s,setShowGithubOn:v,showGithubOn:b,userId:ae}}function vt(e,n,s){u.useEffect(()=>{if(!n)return;let i=!0;return s.setProfileLoading(!0),(async()=>{try{const o=await F({getAccessToken:e});if(!i||!o)return;const r=await ue({accessToken:o});if(!i)return;s.setPublicProfileOn(!!r?.enabled),s.setAnonymousOn(!!r?.anonymous),r?.display_name&&s.setCustomDisplayName(r.display_name),s.setShowGithubOn(!!r?.show_github_url),s.setGithubUrl(r?.github_url||"")}catch(o){E("load public profile",o)}finally{i&&s.setProfileLoading(!1)}})(),()=>{i=!1}},[e,n,s])}function kt(e,n){return u.useCallback(async(s,{label:i,onError:o,onSuccess:r}={})=>{if(n.profileSaving)return!1;n.setProfileSaving(!0);try{const l=await F({getAccessToken:e});if(!l)return!1;const d=await de({accessToken:l,...s});return r?.(d),!0}catch(l){return o?o(l):E(i||"mutate profile",l),!1}finally{n.setProfileSaving(!1)}},[e,n])}function jt(e,n){return{anonymousOn:e.anonymousOn,customDisplayName:e.customDisplayName,displayName:e.displayName,editingName:e.editingName,handleAnonymousToggle:n.handleAnonymousToggle,handleSaveName:n.handleSaveName,nameInput:e.nameInput,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingName:e.setEditingName,setNameInput:e.setNameInput,startEditingName:n.startEditingName}}function Nt(e,n){return{editingGithub:e.editingGithub,githubError:e.githubError,githubInput:e.githubInput,githubUrl:e.githubUrl,handleSaveGithub:n.handleSaveGithub,handleShowGithubToggle:n.handleShowGithubToggle,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingGithub:e.setEditingGithub,setGithubError:e.setGithubError,setGithubInput:e.setGithubInput,showGithubOn:e.showGithubOn,startEditingGithub:n.startEditingGithub}}function St(e,n){const s=u.useCallback(async()=>{const o=!e.publicProfileOn;await n({enabled:o},{label:"toggle public profile",onSuccess:()=>e.setPublicProfileOn(o)})},[n,e]);return{handleAnonymousToggle:u.useCallback(async()=>{const o=!e.anonymousOn;await n({anonymous:o},{label:"toggle anonymous",onSuccess:()=>e.setAnonymousOn(o)})},[n,e]),handlePublicProfileToggle:s}}function Ct(e,n,s){const i=u.useCallback(async()=>{const r=e.nameInput.trim().slice(0,50);r&&await n({display_name:r},{label:"save display name",onSuccess:()=>{e.setCustomDisplayName(r),e.setEditingName(!1),s?.()}})},[n,e,s]),o=u.useCallback(()=>{e.setNameInput(e.customDisplayName||e.displayName),e.setEditingName(!0)},[e]);return{handleSaveName:i,startEditingName:o}}function wt(e,n){const s=u.useCallback(async()=>{if(!e.showGithubOn&&!e.githubUrl){e.setEditingGithub(!0),e.setGithubInput(""),e.setGithubError(null);return}const r=!e.showGithubOn;await n({show_github_url:r},{label:"toggle GitHub profile",onSuccess:()=>e.setShowGithubOn(r)})},[n,e]),i=u.useCallback(async()=>{const r=ft(e.githubInput);if(e.githubInput.trim()&&!r){e.setGithubError(a("settings.account.githubUrlInvalid"));return}e.setGithubError(null),await n({github_url:r,show_github_url:!!r},{label:"save GitHub profile",onError:l=>e.setGithubError(l?.message||a("settings.account.githubUrlInvalid")),onSuccess:l=>{e.setGithubUrl(l?.github_url||r||""),e.setShowGithubOn(!!r),e.setEditingGithub(!1)}})},[n,e]),o=u.useCallback(()=>{e.setGithubInput(e.githubUrl),e.setGithubError(null),e.setEditingGithub(!0)},[e]);return{handleSaveGithub:i,handleShowGithubToggle:s,startEditingGithub:o}}function Lt(){const e=ie(),n=yt(e.user),s=xt(e.getAccessToken,e.enabled,e.signedIn);vt(e.getAccessToken,e.signedIn,n.loadSetters);const i=kt(e.getAccessToken,n),o=St(n,i),r=Ct(n,i,e.refreshDisplayName),l=wt(n,i);return{...e,...s,email:n.email,handlePublicProfileToggle:o.handlePublicProfileToggle,userId:n.userId,name:jt(n,{...o,...r}),github:Nt(n,l),profileLoading:n.profileLoading,profileSaving:n.profileSaving,publicProfileOn:n.publicProfileOn}}function q({disabled:e,onCancel:n,onSave:s,saveLabel:i=a("settings.account.save")}){return t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",onClick:s,disabled:e,className:"rounded-md bg-oai-brand-500 px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-oai-brand-600 disabled:opacity-50",children:i}),t.jsx("button",{type:"button",onClick:n,className:"rounded-md px-2 py-1.5 text-xs text-oai-gray-500 transition-colors hover:text-oai-gray-700 dark:hover:text-oai-gray-300",children:a("settings.account.cancel")})]})}function At({nameInput:e,setEditingName:n,setNameInput:s,profileSaving:i,handleSaveName:o}){return t.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[t.jsx("input",{type:"text",value:e,onChange:r=>s(r.target.value),onKeyDown:r=>{r.key==="Enter"&&o(),r.key==="Escape"&&n(!1)},maxLength:50,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white",placeholder:a("settings.account.displayName")}),t.jsx(q,{disabled:i||!e.trim(),onCancel:()=>n(!1),onSave:o,saveLabel:i?a("settings.account.saving"):void 0})]})}function Ot({githubError:e,githubInput:n,handleSaveGithub:s,profileSaving:i,setEditingGithub:o,setGithubError:r,setGithubInput:l}){return t.jsxs("div",{className:"mt-2",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("input",{type:"text",value:n,onChange:d=>{l(d.target.value),e&&r(null)},onKeyDown:d=>{d.key==="Enter"&&s(),d.key==="Escape"&&(o(!1),r(null))},maxLength:100,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white",placeholder:a("settings.account.githubUrlPlaceholder")}),t.jsx(q,{disabled:i,onCancel:()=>{o(!1),r(null)},onSave:s,saveLabel:i?a("settings.account.saving"):void 0})]}),e?t.jsx("div",{className:"mt-1.5 text-xs text-red-600 dark:text-red-400",children:e}):null]})}function K({disabled:e=!1,label:n,onClick:s,title:i}){return t.jsxs("button",{type:"button",onClick:s,disabled:e,title:i,className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-40 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[t.jsx(Ge,{className:"h-3.5 w-3.5","aria-hidden":!0}),n]})}function Z({actions:e,editing:n,editor:s,hint:i,label:o}){return t.jsx("div",{className:"py-3",children:t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:o}),n?s:t.jsx("div",{className:"mt-0.5 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:i})]}),n?null:e]})})}function Et({name:e}){const n=e.anonymousOn?a("settings.account.displayNameDisabledWhileAnon"):void 0;return t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsx(K,{disabled:e.anonymousOn,label:a("settings.account.edit"),onClick:e.startEditingName,title:n}),t.jsx(k,{checked:!e.anonymousOn,onChange:e.handleAnonymousToggle,disabled:e.profileLoading||e.profileSaving,ariaLabel:a("settings.account.displayName")})]})}function Pt({name:e}){const{anonymousOn:n,customDisplayName:s,displayName:i,editingName:o,handleAnonymousToggle:r,handleSaveName:l,nameInput:d,profileLoading:g,profileSaving:p,setEditingName:m,setNameInput:x,startEditingName:y}=e,c=n?a("settings.account.displayNameAnonymousHint"):s||i;return t.jsx(Z,{label:a("settings.account.displayName"),editing:o,hint:c,editor:t.jsx(At,{nameInput:d,setEditingName:m,setNameInput:x,profileSaving:p,handleSaveName:l}),actions:t.jsx(Et,{name:e})})}function It({github:e}){const{editingGithub:n,githubError:s,githubInput:i,githubUrl:o,handleSaveGithub:r,handleShowGithubToggle:l,profileLoading:d,profileSaving:g,setEditingGithub:p,setGithubError:m,setGithubInput:x,showGithubOn:y,startEditingGithub:c}=e;return t.jsx(t.Fragment,{children:t.jsx(Z,{label:a("settings.account.githubUrl"),editing:n,hint:o||a("settings.account.githubUrlHint"),editor:t.jsx(Ot,{githubError:s,githubInput:i,handleSaveGithub:r,profileSaving:g,setEditingGithub:p,setGithubError:m,setGithubInput:x}),actions:t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsx(K,{label:a("settings.account.edit"),onClick:c}),t.jsx(k,{checked:y,onChange:l,disabled:d||g,ariaLabel:a("settings.account.githubUrl")})]})})})}function _t(){const{openLoginModal:e}=ge();return t.jsx(S,{title:a("settings.section.account"),children:t.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[t.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:a("settings.account.signedOutHint")}),t.jsx("button",{type:"button",onClick:e,className:"inline-flex h-8 shrink-0 items-center justify-center rounded-md bg-oai-gray-900 px-4 text-xs font-medium text-white transition-colors hover:bg-oai-gray-800 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100",children:a("settings.account.signIn")})]})})}function Gt({name:e,github:n}){return t.jsxs(t.Fragment,{children:[t.jsx(Pt,{name:e}),t.jsx(It,{github:n})]})}function Tt(){const e=Lt();return e.enabled?e.signedIn?t.jsxs(S,{title:a("settings.section.account"),subtitle:e.email||e.name.customDisplayName||e.name.displayName,action:t.jsx(Rt,{onSignOut:e.signOut}),children:[t.jsx(Dt,{userId:e.userId}),t.jsx(Mt,{settings:e}),t.jsx(Ut,{checked:e.publicProfileOn,disabled:e.profileLoading||e.profileSaving,onChange:e.handlePublicProfileToggle}),t.jsx(Ft,{visible:e.publicProfileOn,name:e.name,github:e.github})]}):t.jsx(_t,{}):null}function Dt({userId:e}){const[n,s]=L.useState(!1);if(!e)return null;const i=async()=>{try{if(typeof navigator>"u"||!navigator.clipboard?.writeText)return;await navigator.clipboard.writeText(e),s(!0),globalThis.setTimeout(()=>s(!1),1200)}catch{s(!1)}};return t.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:a("settings.account.userId")}),t.jsx("div",{className:"mt-0.5 truncate font-mono text-xs text-oai-gray-500 dark:text-oai-gray-400",children:e})]}),t.jsxs("button",{type:"button",onClick:i,className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800","aria-label":a("settings.account.copyUserId"),children:[n?t.jsx(Re,{className:"h-3.5 w-3.5","aria-hidden":!0}):t.jsx(Me,{className:"h-3.5 w-3.5","aria-hidden":!0}),n?a("settings.account.copied"):a("settings.account.copy")]})]})}function Rt({onSignOut:e}){return t.jsxs("button",{type:"button",onClick:()=>e(),className:"inline-flex h-7 items-center gap-1.5 text-xs font-medium text-oai-gray-500 transition-colors hover:text-oai-gray-700 dark:hover:text-oai-gray-300",children:[t.jsx(tt,{className:"h-3.5 w-3.5","aria-hidden":!0}),a("settings.account.signOut")]})}function Mt({settings:e}){return e.showLocalCloudSync?t.jsx(f,{label:a("settings.account.cloudSync"),hint:a("settings.account.cloudSyncHint"),control:t.jsx(k,{checked:e.cloudSyncOn,onChange:e.handleCloudSyncToggle,ariaLabel:a("settings.account.cloudSync")})}):null}function Ut({checked:e,disabled:n,onChange:s}){return t.jsx(f,{label:a("settings.account.publicProfile"),hint:a("settings.account.publicProfileHint"),control:t.jsx(k,{checked:e,onChange:s,disabled:n,ariaLabel:a("settings.account.publicProfile")})})}function Ft({visible:e,name:n,github:s}){return t.jsx(Ue,{initial:!1,children:e?t.jsx(V.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{height:{duration:.28,ease:[.22,1,.36,1]},opacity:{duration:.2,ease:[.22,1,.36,1]}},style:{overflow:"hidden"},className:"divide-y divide-oai-gray-200/60 dark:divide-oai-gray-800/60",children:t.jsx(Gt,{name:n,github:s})},"public-profile-fields"):null})}function Ht(){return[{value:"light",label:a("settings.appearance.theme.light"),Icon:he},{value:"dark",label:a("settings.appearance.theme.dark"),Icon:pe},{value:"system",label:a("settings.appearance.theme.system"),Icon:$}]}function $t(){return[{value:xe,label:a("settings.appearance.language.system")},{value:ye,label:a("settings.appearance.language.english")},{value:ve,label:a("settings.appearance.language.chinese")},{value:ke,label:a("settings.appearance.language.traditional_chinese")},{value:je,label:a("settings.appearance.language.japanese")},{value:Ne,label:a("settings.appearance.language.korean")},{value:Se,label:a("settings.appearance.language.german")}]}function Vt(e){if(!e)return null;try{const n=new Date(e);return Number.isNaN(n.getTime())?null:n.toLocaleString()}catch{return null}}function Bt(e,n){const s=a(`settings.appearance.currency.rate_source.${e}`),i=Vt(n),o=i?a("settings.appearance.currency.rate_updated",{when:i}):a("settings.appearance.currency.rate_never");return`${s} · ${o}`}function zt({locale:e,setLocale:n}){const s=$t();return t.jsx(B,{value:e,onValueChange:n,options:s,ariaLabel:a("settings.appearance.language.label"),className:"px-2.5 py-1.5 text-xs font-medium",leadingIcon:t.jsx(Xe,{className:"h-3.5 w-3.5 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})})}function qt({currency:e,setCurrency:n}){const s=be().map(i=>({value:i.code,label:a(i.labelKey)}));return t.jsx(B,{value:e,onValueChange:n,options:s,ariaLabel:a("settings.appearance.currency.label"),className:"px-3 py-1.5 text-xs font-medium"})}function Kt({currency:e,rate:n,rateSource:s,rateFetchedAt:i}){if(e===fe)return t.jsx(t.Fragment,{children:a("settings.appearance.currency.hint")});const o=Bt(s,i);return t.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[t.jsx("span",{children:`1 USD = ${n.toFixed(4)} ${e}`}),t.jsx("span",{role:"img","aria-label":o,title:o,className:"inline-flex h-4 w-4 cursor-help items-center justify-center text-oai-gray-400 hover:text-oai-gray-600 dark:text-oai-gray-500 dark:hover:text-oai-gray-300",children:t.jsx($e,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})}function Zt(){const{theme:e,setTheme:n}=me(),{locale:s,setLocale:i}=H(),{currency:o,rate:r,rateSource:l,rateFetchedAt:d,setCurrency:g}=Fe(),{mode:p,setMode:m}=He();return t.jsxs(S,{title:a("settings.section.appearance"),children:[t.jsx(f,{label:a("settings.appearance.theme.label"),hint:a("settings.appearance.theme.hint"),control:t.jsx(A,{options:Ht(),value:e,onChange:n})}),t.jsx(f,{label:a("settings.appearance.language.label"),hint:a("settings.appearance.language.hint"),control:t.jsx(zt,{locale:s,setLocale:i})}),t.jsx(f,{label:a("settings.appearance.currency.label"),hint:t.jsx(Kt,{currency:o,rate:r,rateSource:l,rateFetchedAt:d}),control:t.jsx(qt,{currency:o,setCurrency:g})}),t.jsx(f,{label:a("settings.appearance.token_format.label"),hint:a("settings.appearance.token_format.hint"),control:t.jsx(A,{options:[{value:I.COMPACT,label:a("settings.appearance.token_format.compact")},{value:I.FULL,label:a("settings.appearance.token_format.full")}],value:p,onChange:m})})]})}function U({labelKey:e}){return t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("span",{children:a(e)}),t.jsx("span",{className:"px-1.5 py-0.5 text-[8px] 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 scale-90 origin-left",children:a("qpd.card.badge")})]})}function Wt(){const{enabled:e,toggle:n}=Te(),{enabled:s,toggle:i}=De();return t.jsxs(S,{title:a("settings.section.labs"),children:[t.jsx(f,{label:t.jsx(U,{labelKey:"settings.labs.qpd.label"}),hint:a("settings.labs.qpd.hint"),control:t.jsx(k,{checked:e,onChange:n,ariaLabel:a("settings.labs.qpd.aria")})}),t.jsx(f,{label:t.jsx(U,{labelKey:"settings.labs.sessions.label"}),hint:a("settings.labs.sessions.hint"),control:t.jsx(k,{checked:s,onChange:i,ariaLabel:a("settings.labs.sessions.aria")})})]})}function Yt(){const{available:e,settings:n,setSetting:s,runAction:i}=O();if(!e)return null;const o=!!n?.launchAtLogin,r=n?.toastOnReset!==!1,l=n?.confettiOnReset!==!1,d=n?.launchAtLoginSupported!==!1,g=n?.updateStatus||null,p=!!n?.updateBusy,m=!!n?.isSyncing;return t.jsxs(S,{title:a("settings.section.menubar"),children:[t.jsx(f,{label:a("settings.menubar.appearance"),hint:a("settings.menubar.appearanceHint"),control:t.jsxs(Ce,{to:"/widgets",className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 no-underline transition-colors hover:bg-oai-gray-100 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[a("settings.menubar.appearanceLink"),t.jsx(Be,{className:"h-3.5 w-3.5","aria-hidden":!0})]})}),t.jsx(f,{label:a("settings.menubar.toastOnReset"),hint:a("settings.menubar.toastOnResetHint"),control:t.jsx(k,{checked:r,onChange:()=>s("toastOnReset",!r),ariaLabel:a("settings.menubar.toastOnReset")})}),t.jsx(f,{label:a("settings.menubar.confettiOnReset"),hint:a("settings.menubar.confettiOnResetHint"),control:t.jsx(k,{checked:l,onChange:()=>s("confettiOnReset",!l),ariaLabel:a("settings.menubar.confettiOnReset")})}),d?t.jsx(f,{label:a("settings.menubar.launchAtLogin"),hint:a("settings.menubar.launchAtLoginHint"),control:t.jsx(k,{checked:o,onChange:()=>s("launchAtLogin",!o),ariaLabel:a("settings.menubar.launchAtLogin")})}):null,t.jsx(f,{label:a("settings.menubar.syncNow"),hint:a("settings.menubar.syncNowHint"),control:t.jsxs("button",{type:"button",onClick:()=>i("syncNow"),disabled:m,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[t.jsx(we,{className:N("h-3.5 w-3.5",m&&"animate-spin"),"aria-hidden":!0}),m?a("settings.menubar.syncing"):a("settings.menubar.syncNow")]})}),t.jsx(f,{label:a("settings.menubar.updates"),hint:g||void 0,control:t.jsxs("button",{type:"button",onClick:()=>i("checkForUpdates"),disabled:p,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[t.jsx(ze,{className:"h-3.5 w-3.5","aria-hidden":!0}),a("settings.menubar.checkUpdates")]})})]})}function Jt(e,n){function s(r){return r.replace(/^v/,"").split(".").map(Number)}const i=s(e),o=s(n);for(let r=0;r<Math.max(i.length,o.length);r++){const l=i[r]||0,d=o[r]||0;if(l<d)return!0;if(l>d)return!1}return!1}function Qt(){const{available:e,settings:n,runAction:s}=O(),i=e&&n?.version,[o,r]=L.useState(!1),[l,d]=L.useState({open:!1,latestVersion:"",htmlUrl:""}),{resolvedLocale:g}=H(),p="0.84.2",m=async()=>{r(!0);try{const b=await fetch("https://api.github.com/repos/mm7894215/TokenTracker/releases/latest");if(!b.ok)throw new Error("Failed to fetch");const v=await b.json(),w=v.tag_name;Jt(p,w)?d({open:!0,latestVersion:w,htmlUrl:v.html_url}):_({title:a("settings.menubar.updates.upToDate")})}catch(b){console.error("Check updates failed:",b),_({title:a("settings.menubar.updates.failed")})}finally{r(!1)}},x=a("settings.menubar.updates.modalTitle"),y=a("settings.menubar.updates.modalDescription",{version:l.latestVersion}),c=a("settings.menubar.updates.modalConfirm"),h=a("settings.menubar.updates.modalCancel");return t.jsxs("div",{className:"mt-6 flex flex-col items-center justify-center gap-4 text-xs text-oai-gray-500 dark:text-oai-gray-500",children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[i?t.jsxs(t.Fragment,{children:[t.jsx("span",{children:a("settings.menubar.updates.footerCombined",{barVersion:n.version,coreVersion:p})}),t.jsx("span",{"aria-hidden":!0,children:"·"}),t.jsx("button",{type:"button",onClick:()=>s("openAbout"),className:"underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300",children:"GitHub"}),t.jsx("span",{"aria-hidden":!0,children:"·"})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{children:a("settings.menubar.updates.footerCore",{version:p})}),t.jsx("span",{"aria-hidden":!0,children:"·"}),t.jsx("button",{type:"button",onClick:m,disabled:o,className:"underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300 disabled:opacity-50",children:o?a("settings.menubar.updates.checking"):a("settings.menubar.checkUpdates")}),t.jsx("span",{"aria-hidden":!0,children:"·"})]}),t.jsxs("a",{href:Le,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300",children:[t.jsx(Ke,{className:"h-3.5 w-3.5","aria-hidden":!0}),a("settings.footer.statusPage")]})]}),t.jsx(Ve,{open:l.open,title:x,description:y,confirmLabel:c,cancelLabel:h,onConfirm:()=>{window.open(l.htmlUrl,"_blank"),d(b=>({...b,open:!1}))},onCancel:()=>d(b=>({...b,open:!1}))})]})}const j={APPEARANCE:"appearance",NATIVE_APP:"native-app",ACCOUNT:"account",LIMITS:"limits",LABS:"labs"};function Xt({prefs:e}){return t.jsx(A,{options:[{value:T.USED,label:a("limits.settings.display_mode_used")},{value:T.REMAINING,label:a("limits.settings.display_mode_remaining")}],value:e.displayMode,onChange:e.setDisplayMode})}function Cn(){const e=Ie(),{available:n,settings:s,setSetting:i}=O(),o=s?.toastOnReset!==!1,r=s?.confettiOnReset!==!1,[l,d]=Ae(),g=l.get("section"),m=Object.values(j).includes(g)&&(g!==j.NATIVE_APP||n)?g:j.APPEARANCE,x=c=>{const h=new URLSearchParams(l);c===j.APPEARANCE?h.delete("section"):h.set("section",c),d(h,{replace:!0})},y=[{id:j.APPEARANCE,label:a("settings.section.appearance"),Icon:at,content:t.jsx(Zt,{})},...n?[{id:j.NATIVE_APP,label:a("settings.section.menubar"),Icon:$,content:t.jsx(Yt,{})}]:[],{id:j.ACCOUNT,label:a("settings.section.account"),Icon:it,content:t.jsx(Tt,{})},{id:j.LIMITS,label:a("settings.section.limits"),Icon:Oe,content:t.jsxs("div",{className:"space-y-4",children:[t.jsxs(S,{title:a("settings.section.limits"),children:[t.jsx(f,{label:a("limits.settings.display_mode_label"),control:t.jsx(Xt,{prefs:e})}),t.jsx(f,{label:a("settings.menubar.toastOnReset"),hint:a("settings.menubar.toastOnResetHint"),control:t.jsx(k,{checked:o,disabled:!n,onChange:()=>i("toastOnReset",!o),ariaLabel:a("settings.menubar.toastOnReset")})}),t.jsx(f,{label:a("settings.menubar.confettiOnReset"),hint:a("settings.menubar.confettiOnResetHint"),control:t.jsx(k,{checked:r,disabled:!n,onChange:()=>i("confettiOnReset",!r),ariaLabel:a("settings.menubar.confettiOnReset")})})]}),t.jsx(S,{title:a("settings.limits.providers"),children:t.jsx(ht,{prefs:e})})]})},{id:j.LABS,label:a("settings.section.labs"),Icon:We,content:t.jsx(Wt,{})}];return t.jsx("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:t.jsx("main",{className:"flex-1 pb-12 pt-8 sm:pb-16 sm:pt-10",children:t.jsxs("div",{className:"mx-auto w-full max-w-5xl px-4 sm:px-6",children:[t.jsx("div",{className:"mb-7",children:t.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:a("settings.page.title")})}),t.jsxs("div",{className:"grid min-w-0 gap-6 md:grid-cols-[12rem_minmax(0,1fr)] md:gap-8 lg:grid-cols-[13.5rem_minmax(0,1fr)]",children:[t.jsx("aside",{className:"min-w-0 border-b border-oai-gray-200 pb-3 dark:border-oai-gray-800 md:border-b-0 md:border-r md:pb-0 md:pr-5",children:t.jsx("nav",{"aria-label":a("settings.page.title"),className:"flex gap-0 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden md:sticky md:top-6 md:flex-col md:gap-1 md:overflow-visible",children:y.map(({id:c,label:h,Icon:b})=>{const v=m===c;return t.jsxs("button",{id:`settings-nav-${c}`,type:"button","aria-current":v?"page":void 0,"aria-controls":`settings-panel-${c}`,onClick:()=>x(c),className:N("inline-flex min-h-10 min-w-max shrink-0 items-center gap-1.5 rounded-md px-2 py-2 text-left text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-oai-brand-500 md:w-full md:min-w-0 md:gap-2 md:px-3",v?"bg-oai-gray-100 text-oai-black dark:bg-oai-gray-800 dark:text-white":"text-oai-gray-500 hover:bg-oai-gray-50 hover:text-oai-gray-900 dark:text-oai-gray-400 dark:hover:bg-oai-gray-900 dark:hover:text-oai-gray-200"),children:[t.jsx(b,{className:N("h-4 w-4 shrink-0",v?"text-oai-black dark:text-white":"text-oai-gray-400 dark:text-oai-gray-500"),"aria-hidden":!0}),t.jsx("span",{className:"truncate",children:h})]},c)})})}),t.jsxs("div",{className:"min-w-0",children:[y.map(({id:c,label:h,content:b})=>t.jsx("section",{id:`settings-panel-${c}`,"aria-labelledby":`settings-nav-${c}`,"aria-label":h,"data-settings-panel":c,hidden:m!==c,children:b},c)),t.jsx(Qt,{})]})]})]})})})}export{Cn as SettingsPage};
import{w as l}from"./__vite-browser-external-CuMc3dqk.js";const i="tokentracker-skills";async function r(t){const e=new URL(`/functions/${i}`,window.location.origin);if(t)for(const[c,s]of Object.entries(t))s!=null&&s!==""&&e.searchParams.set(c,String(s));const o=await fetch(e.toString(),{headers:{Accept:"application/json"},cache:"no-store"}),a=await o.json().catch(()=>null);if(!o.ok)throw new Error(a?.error||`Request failed with HTTP ${o.status}`);return a}async function n(t){const e=await l(),o=await fetch(`/functions/${i}`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json",...e},cache:"no-store",body:JSON.stringify(t)}),a=await o.json().catch(()=>null);if(!o.ok||a?.ok===!1)throw new Error(a?.error||`Request failed with HTTP ${o.status}`);return a}function f(){return r({mode:"installed"})}function d(t={}){return r({mode:"discover",...t.force?{force:1}:{}})}function p(t,e=0,o=20){return r({mode:"search",q:t,offset:e,limit:o})}function k(){return r({mode:"repos"})}function S(t,e){return n({action:"install",skill:t,targets:e})}function h(t){return n({action:"uninstall",id:t})}function g(t){return n({action:"restore",id:t})}function m(t,e){return n({action:"set_targets",id:t,targets:e})}function w(t,e){return n({action:"import_local",directory:t,targets:e})}function y(t,e){return n({action:"delete_local",directory:t,targets:e||[]})}function j(t){return n({action:"add_repo",repo:t})}function T(t,e){return n({action:"remove_repo",owner:t,name:e})}function R(t={}){return r({mode:"popular",...t.force?{force:1}:{}})}function _(t={}){return r({mode:"updates",...t.force?{force:1}:{}})}function v(t={}){return r({mode:"skill_usage",...t.force?{force:1}:{}})}export{k as a,R as b,_ as c,d,v as e,y as f,f as g,m as h,S as i,w as j,T as k,j as l,g as r,p as s,h as u};
import{l as da,r as i,O as it,z as ca,j as e,X as Se,c as r,d as me,aG as na,ax as _a,aH as ot,y as lt,aI as ha,aJ as dt,aK as ct,W as ut,aL as xa,aM as mt,aN as gt,A as ht,aO as xt,az as pt,ay as ft,aP as yt,a3 as bt,J as kt,B as G,a2 as wt,R as vt,a4 as Ce}from"./__vite-browser-external-CuMc3dqk.js";import{L as jt}from"./LocalOnlyNotice-D8FJuEXT.js";import{C as Nt}from"./Card-C3Fxl-vL.js";import{C as pa}from"./ConfirmModal-CiJio3w8.js";import{S as Ct,I as ua}from"./SegmentedControl-C_ZhjPE7.js";import{I as La}from"./info-CDTfOJ13.js";import{P as be}from"./ProviderIcon-B6sgfDtI.js";import{m as fa}from"./react-B80AX8fE.js";import{u as St}from"./useCurrency-DdWYV5RR.js";import{L as Z}from"./loader-circle-CracNP_H.js";import{C as _e}from"./check-Dy8VgHZ8.js";import{T as ma}from"./trash-2-DAfuNrRz.js";import{A as _t}from"./index-jpsn86uT.js";import{u as Lt}from"./use-reduced-motion-BEAopWkx.js";import{u as Pt,s as Rt,k as Pa,l as It,m as Et,n as Bt,o as $t,p as Tt,S as Ra,c as Ia,d as Ea,e as Ba,f as $a,g as Ta,h as Ge,j as We,i as Je}from"./SelectItemText-DrcW545o.js";import{t as Dt,u as ia,m as Mt}from"./useScrollLock-DmM-LeMm.js";import{u as Ot,C as ga}from"./ToolbarRootContext-xOR5ZEzv.js";import{g as Ut,a as Ft,d as zt,b as At,c as Kt,e as Vt,s as qt,i as ya,u as ba,f as ka,r as Ht,h as wa,j as va,k as Gt,l as Wt}from"./skills-api-CGL-iHOO.js";import{F as Jt}from"./flame-VQYtrvgY.js";import{S as oa}from"./search-DtGZgKCk.js";import{D as Da}from"./download-zNMgxXgK.js";import{C as Qt}from"./chevron-right-D1F23F5W.js";import{P as Ma,a as Oa,b as Ua,c as Fa,d as za}from"./PopoverPopup-B6oEN7QL.js";import"./arrow-up-right-D2tCxxHL.js";import"./DialogTitle-KxLDeLzC.js";import"./store-NtnkxrS2.js";import"./DialogDescription-BgYqW0_C.js";const Xt=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]],Aa=da("circle-arrow-up",Xt);const Yt=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],la=da("external-link",Yt);const Zt=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Ka=da("plus",Zt),Va=i.forwardRef(function(s,l){const{render:u,className:c,style:p,...m}=s,{store:h}=Pt(),b={open:it(h,Rt.open)};return ca("span",s,{state:b,ref:l,props:[{"aria-hidden":!0,children:"▼"},m],stateAttributesMapping:Dt})}),er="tt:hint:dismissed:";function qa(a){return er+a}function ar(a){if(typeof window>"u")return!1;try{return window.localStorage.getItem(qa(a))==="1"}catch{return!1}}function tr({id:a,children:s,className:l,ariaLabel:u}){const[c,p]=i.useState(()=>ar(a)),m=i.useCallback(()=>{if(typeof window<"u")try{window.localStorage.setItem(qa(a),"1")}catch{}p(!0)},[a]);return c?null:e.jsxs("div",{role:"note","aria-label":u||r("hint.dismissible_aria"),className:me("relative rounded-lg border border-oai-gray-200 bg-oai-gray-50 px-4 py-3 text-sm text-oai-gray-700","dark:border-oai-gray-800 dark:bg-oai-gray-900/40 dark:text-oai-gray-300",l),children:[e.jsx("button",{type:"button",onClick:m,"aria-label":r("hint.dismiss"),className:"absolute top-2 right-2 inline-flex h-7 w-7 items-center justify-center rounded-md text-oai-gray-500 transition-colors hover:bg-oai-gray-200/70 hover:text-oai-gray-700 focus:outline-none focus:ring-2 focus:ring-oai-blue/30 dark:text-oai-gray-400 dark:hover:bg-oai-gray-800/70 dark:hover:text-oai-gray-200",children:e.jsx(Se,{className:"h-4 w-4","aria-hidden":"true"})}),e.jsxs("div",{className:"flex items-start gap-2 pr-8",children:[e.jsx(La,{className:"mt-0.5 h-4 w-4 shrink-0 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":"true"}),e.jsx("div",{className:"min-w-0 flex-1",children:s})]})]})}function rr(a){if(!a)return null;for(const s of a.elements){const l=s.tagName;if(l==="BUTTON"||l==="INPUT"){const u=s;if(u.type==="submit")return u}}return null}let ja=(function(a){return a.checked="data-checked",a.unchecked="data-unchecked",a.indeterminate="data-indeterminate",a.disabled="data-disabled",a.readonly="data-readonly",a.required="data-required",a.valid="data-valid",a.invalid="data-invalid",a.touched="data-touched",a.dirty="data-dirty",a.filled="data-filled",a.focused="data-focused",a})({});function Ha(a){return i.useMemo(()=>({checked(s){return a.indeterminate?{}:s?{[ja.checked]:""}:{[ja.unchecked]:""}},...Pa}),[a.indeterminate])}const sr=i.createContext({disabled:!1});function nr(){return i.useContext(sr)}function ir(a,s,l,u=!0,c){const[p,m]=i.useState(),h=ia(c?`${c}-label`:void 0),x=a??s??p;return na(()=>{const b=a||s||!u?void 0:or(l.current,h);p!==b&&m(b)}),x}function or(a,s){const l=lr(a);if(l)return!l.id&&s&&(l.id=s),l.id||void 0}function lr(a){if(!a)return;const s=a.parentElement;if(s&&s.tagName==="LABEL")return s;const l=a.id;if(l){const c=a.nextElementSibling;if(c&&c.htmlFor===l)return c}const u=a.labels;return u&&u[0]}const dr=i.createContext(void 0);function cr(a=!0){const s=i.useContext(dr);if(s===void 0&&!a)throw new Error(_a(3));return s}const Ga=i.createContext(void 0);function ur(){const a=i.useContext(Ga);if(a===void 0)throw new Error(_a(14));return a}const mr="data-parent",gr=i.forwardRef(function(s,l){const{checked:u,className:c,defaultChecked:p=!1,"aria-labelledby":m,disabled:h=!1,form:x,id:b,indeterminate:o=!1,inputRef:j,name:C,onCheckedChange:k,parent:v=!1,readOnly:y=!1,render:N,required:E=!1,uncheckedValue:O,value:W,nativeButton:U=!1,style:ge,...w}=s,{clearErrors:ee}=It(),{disabled:B,name:K,setDirty:J,setFilled:ae,setFocused:F,setTouched:ke,state:we,validationMode:Ue,validityData:Le,validation:Fe}=Et(),ze=nr(),{labelId:T,controlId:te,registerControlId:Q,getDescriptionProps:ve}=Bt(),L=cr(),V=L?.parent,re=V&&L.allValues,I=B||ze.disabled||L?.disabled||h,se=K??C,P=W??se,Pe=ia(),je=ia();let ne=te;re?ne=v?je:`${V.id}-${P}`:b&&(ne=b);let pe={};re&&(v?pe=L.parent.getParentProps():P&&(pe=L.parent.getChildProps(P)));const{checked:Re=u,indeterminate:Ie=o,onCheckedChange:Ee,...Ne}=pe,q=L?.value,ie=L?.setValue,fe=L?.defaultValue,oe=i.useRef(null),le=ot(()=>Symbol("checkbox-control")),he=i.useRef(!1),{getButtonProps:Xe,buttonRef:Ae}=lt({disabled:I,native:U}),de=L?.validation??Fe,[_,Ye]=$t({controlled:P&&q&&!v?q.includes(P):Re,default:P&&fe&&!v?fe.includes(P):p,name:"Checkbox",state:"checked"}),Be=re?!!Re:_,ye=re&&Ie||o;na(()=>{Q!==ha&&(he.current=!0,Q(le.current,ne))},[ne,Q,le]),i.useEffect(()=>{const f=le.current;return()=>{!he.current||Q===ha||(he.current=!1,Q(f,void 0))}},[Q,le]),Tt(oe,Pe,_,void 0,!L&&!I,C);const X=i.useRef(null),$e=dt(j,X,de.inputRef,de.registerInput),Ze=ir(m,T,X,!U,ne??void 0);na(()=>{X.current&&(X.current.indeterminate=ye,_&&ae(!0))},[_,ye,ae]),Ot(_,()=>{L||(ee(se),ae(_),J(_!==Le.initialValue),de.change(_))});const Ke=ct({checked:_,disabled:I,form:x,name:v?void 0:se,id:U?void 0:ne??void 0,required:E,ref:$e,style:se?mt:gt,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(f){if(f.nativeEvent.defaultPrevented)return;if(y){f.preventDefault();return}const D=f.currentTarget.checked,ce=ht(xt,f.nativeEvent);if(k?.(D,ce),!ce.isCanceled&&(Ee?.(D,ce),!ce.isCanceled&&(Ye(D),P&&q&&ie&&!v&&!re))){const ue=D?[...q,P]:q.filter($=>$!==P);ie(ue,ce)}},onFocus(){oe.current?.focus()}},W!==void 0?{value:(L?_&&W:W)||""}:ut,ve,f=>de.getValidationProps(I,f));i.useEffect(()=>{if(!V||!P)return;const f=V.disabledStatesRef.current;return f.set(P,I),()=>{f.delete(P)}},[V,I,P]);const Te=i.useMemo(()=>({...we,checked:Be,disabled:I,readOnly:y,required:E,indeterminate:ye}),[we,Be,I,y,E,ye]),ea=Ha(Te),aa=ca("span",s,{state:Te,ref:[Ae,oe,l,L?.registerControlRef],props:[{id:U?ne??void 0:Pe,role:"checkbox","aria-checked":ye?"mixed":Be,"aria-readonly":y||void 0,"aria-required":E||void 0,"aria-labelledby":Ze,[mr]:v?"":void 0,onFocus(){I||F(!0)},onBlur(){const f=X.current;f&&(ke(!0),F(!1),Ue==="onBlur"&&de.commit(L?q:f.checked))},onKeyDown(f){if(f.key!=="Enter"||(f.preventBaseUIHandler(),f.defaultPrevented))return;const D=X.current?.form??null,ce=f.currentTarget,ue=f.nativeEvent,$=f.preventDefault,H=ue.preventDefault;let De=!1;f.preventDefault=()=>{De=!0,$.call(f)},ue.preventDefault=()=>{De=!0,H.call(ue)},H.call(ue),xa(ce).queueMicrotask(()=>{f.preventDefault=$,ue.preventDefault=H,De||rr(D)?.click()})},onClick(f){if(y||I)return;f.preventDefault();const D=X.current;D&&D.dispatchEvent(new(xa(D)).PointerEvent("click",{bubbles:!0,shiftKey:f.shiftKey,ctrlKey:f.ctrlKey,altKey:f.altKey,metaKey:f.metaKey}))}},w,Ne,Xe,ve,f=>de.getValidationProps(I,f)],stateAttributesMapping:ea});return e.jsxs(Ga.Provider,{value:Te,children:[aa,!_&&!L&&se&&!v&&O!==void 0&&e.jsx("input",{type:"hidden",form:x,name:se,value:O,disabled:I}),e.jsx("input",{...Ke,suppressHydrationWarning:!0})]})}),hr=i.forwardRef(function(s,l){const{render:u,className:c,style:p,keepMounted:m=!1,...h}=s,x=ur(),b=x.checked||x.indeterminate,{mounted:o,transitionStatus:j,setMounted:C}=Mt(b),k=i.useRef(null),v={...x,transitionStatus:j};pt({open:b,ref:k,onComplete(){b||C(!1)}});const N={...Ha(x),...ft,...Pa},E=m||o,O=ca("span",s,{ref:[l,k],state:v,stateAttributesMapping:N,props:h});return E?O:null});function xr(a,s){return`target:${a}:${s}`}function pr(a){return`remove:${a.id||a.directory}`}function Wa(a){if(!a)return null;const s=new Date(a).getTime();return Number.isFinite(s)?Math.floor((Date.now()-s)/864e5):null}function fr(a){const s=Wa(a);if(s==null)return null;if(s<=0)return r("skills.usage.today");if(s<30)return r("skills.usage.days_ago",{days:s});const l=Math.max(1,Math.floor(s/30));return r("skills.usage.months_ago",{months:l})}function yr(a){const s=Wa(a);return s==null?"bg-oai-gray-300 dark:bg-oai-gray-600":s<=7?"bg-emerald-500":s<=30?"bg-amber-500":"bg-oai-gray-300 dark:bg-oai-gray-600"}function ra({label:a,children:s}){return e.jsxs("div",{className:"flex items-center justify-between gap-3 py-2 text-sm",children:[e.jsx("dt",{className:"flex items-center gap-1 text-oai-gray-500 dark:text-oai-gray-400",children:a}),e.jsx("dd",{className:"text-right font-medium tabular-nums text-oai-black dark:text-white",children:s})]})}function br({skill:a,targets:s,busyKey:l,usage:u,hasUpdate:c,updating:p,onUpdate:m,onClose:h,onToggleTarget:x,onRemove:b}){return e.jsx(_t,{children:a?e.jsx(kr,{skill:a,targets:s,busyKey:l,usage:u,hasUpdate:c,updating:p,onUpdate:m,onClose:h,onToggleTarget:x,onRemove:b},a.id||a.directory):null})}function kr({skill:a,targets:s,busyKey:l,usage:u,hasUpdate:c,updating:p,onUpdate:m,onClose:h,onToggleTarget:x,onRemove:b}){const o=Lt(),{currency:j,rate:C}=St(),k=i.useRef(null);i.useEffect(()=>{const w=B=>{B.key==="Escape"&&(B.stopPropagation(),h?.())},ee=B=>{const K=B.target;K instanceof Element&&(k.current?.contains(K)||K.closest('[data-skill-row="1"]')||h?.())};return document.addEventListener("keydown",w),document.addEventListener("mousedown",ee),()=>{document.removeEventListener("keydown",w),document.removeEventListener("mousedown",ee)}},[h]);const v=a.name||a.directory,y=!!(a.repoOwner&&a.repoName),N=y?`https://github.com/${a.repoOwner}/${a.repoName}`:null,E=new Set(a.targets||[]),O=l===pr(a),W=fr(u?.lastUsedAt),U=!!(u&&u.invocations>0),ge=o?{duration:0}:{type:"spring",stiffness:320,damping:30,mass:.7};return e.jsxs(e.Fragment,{children:[e.jsx(fa.div,{className:"fixed inset-0 z-20 bg-oai-black/30 backdrop-blur-[2px] lg:hidden",initial:o?!1:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:o?0:.15},onClick:h,"aria-hidden":!0}),e.jsxs(fa.aside,{ref:k,role:"complementary","aria-label":v,initial:o?!1:{opacity:0,x:24,scale:.98},animate:{opacity:1,x:0,scale:1},exit:o?{opacity:0}:{opacity:0,x:24,scale:.98},transition:ge,className:"fixed inset-x-3 bottom-3 top-20 z-30 flex flex-col overflow-hidden rounded-2xl border border-white/40 bg-white/75 shadow-[0_24px_60px_-20px_rgba(15,23,42,0.25)] backdrop-blur-xl backdrop-saturate-150 supports-[backdrop-filter]:bg-white/65 dark:border-white/10 dark:bg-oai-gray-950/70 dark:shadow-[0_24px_60px_-20px_rgba(0,0,0,0.7)] dark:supports-[backdrop-filter]:bg-oai-gray-950/55 lg:inset-auto lg:right-6 lg:top-24 lg:bottom-6 lg:w-[22rem] lg:max-h-[calc(100vh-7.5rem)]",children:[e.jsxs("header",{className:"flex items-center gap-3 border-b border-white/40 bg-gradient-to-b from-white/30 to-transparent px-5 pb-4 pt-5 dark:border-white/10 dark:from-white/[0.04]",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h2",{className:"truncate text-base font-semibold text-oai-black dark:text-white",title:v,children:v}),y?e.jsxs("a",{href:N,target:"_blank",rel:"noreferrer noopener",className:"mt-1 inline-flex max-w-full items-center gap-1 truncate text-xs text-oai-gray-500 transition-colors hover:text-oai-black hover:underline dark:text-oai-gray-400 dark:hover:text-white",title:N,children:[e.jsxs("span",{className:"truncate",children:[a.repoOwner,"/",a.repoName]}),e.jsx(la,{className:"h-3 w-3 shrink-0","aria-hidden":!0})]}):a.directory&&a.directory!==v?e.jsx("div",{className:"mt-1 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",title:a.directory,children:a.directory}):null]}),e.jsx("button",{type:"button",onClick:h,"aria-label":r("skills.detail.close"),className:"-mr-1 inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-full text-oai-gray-500 transition hover:bg-oai-gray-100 hover:text-oai-black focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:text-oai-gray-400 dark:hover:bg-oai-gray-800 dark:hover:text-white",children:e.jsx(Se,{className:"h-4 w-4","aria-hidden":!0})})]}),e.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-5 py-5",children:[c?e.jsxs("div",{className:"mb-4 flex items-center gap-3 rounded-xl bg-sky-50/80 px-3 py-2.5 ring-1 ring-sky-200 dark:bg-sky-950/30 dark:ring-sky-800/60",children:[e.jsx(Aa,{className:"h-4 w-4 shrink-0 text-sky-600 dark:text-sky-300","aria-hidden":!0}),e.jsx("span",{className:"min-w-0 flex-1 text-xs text-sky-800 dark:text-sky-200",children:r("skills.update.available")}),e.jsxs("button",{type:"button",onClick:()=>m?.(a),disabled:p,className:"inline-flex h-7 shrink-0 items-center gap-1 rounded-md bg-sky-600 px-2.5 text-xs font-semibold text-white transition hover:bg-sky-700 focus:outline-none focus:ring-2 focus:ring-sky-400/40 disabled:cursor-not-allowed disabled:opacity-60 dark:bg-sky-500 dark:hover:bg-sky-400",children:[p?e.jsx(Z,{className:"h-3 w-3 animate-spin","aria-hidden":!0}):null,r("skills.update.action")]})]}):null,a.description?e.jsx("p",{className:"text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:a.description}):null,e.jsxs("section",{className:"mt-6",children:[e.jsx("h3",{className:"mb-1 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.usage.section_title")}),e.jsxs("dl",{className:"divide-y divide-oai-gray-200/60 dark:divide-white/[0.06]",children:[e.jsx(ra,{label:r("skills.usage.invocations"),children:yt(u?.invocations||0)}),e.jsx(ra,{label:r("skills.usage.last_used"),children:e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx("span",{className:me("h-1.5 w-1.5 rounded-full",yr(u?.lastUsedAt)),"aria-hidden":!0}),U?W||r("skills.usage.unknown"):r("skills.usage.never")]})}),e.jsx(ra,{label:e.jsxs(e.Fragment,{children:[r("skills.usage.cost"),e.jsx("span",{title:r("skills.usage.disclaimer"),className:"inline-flex cursor-help text-oai-gray-400 dark:text-oai-gray-500",children:e.jsx(La,{className:"h-3 w-3","aria-label":r("skills.usage.disclaimer")})})]}),children:bt(u?.cost||0,{currency:j,rate:C})})]}),U?null:e.jsx("p",{className:"mt-2 text-[11px] leading-4 text-oai-gray-400 dark:text-oai-gray-500",children:r("skills.usage.unused")})]}),e.jsxs("section",{className:"mt-6",children:[e.jsx("h3",{className:"mb-1 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.detail.sync_section_title")}),e.jsx("div",{children:(s||[]).map(w=>{const ee=E.has(w.id),B=l===xr(a.id,w.id),K=`skill-detail-sync-${a.id||a.directory}-${w.id}`;return e.jsxs("label",{htmlFor:K,className:"-mx-2 flex cursor-pointer items-center gap-3 rounded-md px-2 py-2 text-sm text-oai-black transition-colors hover:bg-oai-gray-100/70 dark:text-white dark:hover:bg-white/[0.05]",children:[e.jsx(gr,{id:K,checked:ee,disabled:B,onCheckedChange:J=>x?.(a,w.id,!!J),className:"peer flex h-4 w-4 shrink-0 items-center justify-center rounded-[4px] border border-oai-gray-300/80 bg-white/80 shadow-sm transition-colors hover:border-oai-gray-400 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-gray-400/40 focus-visible:ring-offset-1 focus-visible:ring-offset-transparent disabled:cursor-not-allowed disabled:opacity-50 data-[checked]:border-oai-black data-[checked]:bg-oai-black dark:border-oai-gray-500/60 dark:bg-oai-gray-900/60 dark:hover:border-oai-gray-400 dark:data-[checked]:border-white dark:data-[checked]:bg-white",children:e.jsx(hr,{className:"flex items-center justify-center text-white dark:text-oai-black",children:e.jsx(_e,{className:"h-3 w-3",strokeWidth:3.5,"aria-hidden":!0})})}),e.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center","aria-hidden":!0,children:e.jsx(be,{provider:w.id,size:16})}),e.jsx("span",{className:"flex-1",children:w.label}),B?e.jsx(Z,{className:"h-3.5 w-3.5 animate-spin text-oai-gray-400","aria-hidden":!0}):null]},w.id)})})]})]}),e.jsxs("footer",{className:"border-t border-white/40 bg-white/30 px-5 py-4 dark:border-white/10 dark:bg-white/[0.02]",children:[e.jsxs("button",{type:"button",onClick:()=>b?.(a),disabled:O,className:"inline-flex w-full items-center justify-center gap-2 rounded-lg border border-red-200/70 bg-white px-3 py-2 text-sm font-medium text-red-600 transition hover:border-red-300 hover:bg-red-50 focus:outline-none focus:ring-2 focus:ring-red-400/30 disabled:cursor-not-allowed disabled:opacity-60 dark:border-red-900/60 dark:bg-oai-gray-950 dark:text-red-300 dark:hover:border-red-800 dark:hover:bg-red-950/30",children:[O?e.jsx(Z,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):e.jsx(ma,{className:"h-3.5 w-3.5","aria-hidden":!0}),r("skills.detail.remove_button")]}),e.jsx("p",{className:"mt-2 text-center text-[11px] text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.detail.remove_confirm_hint")})]})]})]})}const wr=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),sa=["claude","codex"],A="popular",vr={claude:"text-orange-500 dark:text-orange-300",codex:"text-emerald-600 dark:text-emerald-300",grok:"text-zinc-700 dark:text-zinc-200",antigravity:"text-violet-600 dark:text-violet-300",gemini:"text-sky-600 dark:text-sky-300",opencode:"text-amber-600 dark:text-amber-300",hermes:"text-indigo-500 dark:text-indigo-300"},xe="all",M="skillssh";function Qe(a){return`${a.repoOwner||"local"}/${a.repoName||"local"}:${a.directory}`}function Ja(a){return String(a||"").replace(/\\/g,"/").trim().toLowerCase()}function jr(a){return Ja(a).split("/").filter(Boolean).pop()||""}function Nr(a){if(a.repoOwner||a.repoName)return"";const s=Ja(a.directory);return!s||s.includes("/")?"":`dir:${s}`}function Na(a){const s=jr(a.directory);return s?`dir:${s}`:""}function Ca(a){const s=new Set([Qe(a).toLowerCase()]);a.repoOwner&&a.repoName&&s.add(`${a.repoOwner}/${a.repoName}:${a.sourceDirectory||a.directory}`.toLowerCase());const l=Nr(a);return l&&s.add(l),s}function He(a){return`install:${Qe(a)}`}function Sa(a){return`remove:${a.id||a.directory}`}function Qa(a,s){return`target:${a}:${s}`}function Cr({target:a,state:s,busy:l,onToggle:u}){const c=s==="synced",p=s==="orphan",m=p?r("skills.dot.orphan_aria",{agent:a.label}):c?r("skills.dot.synced_aria",{agent:a.label}):r("skills.dot.off_aria",{agent:a.label});return e.jsxs("button",{type:"button",title:m,"aria-label":m,"aria-pressed":c,disabled:l,onClick:h=>{h.stopPropagation(),u?.(a.id,!c)},className:"relative flex h-7 w-7 items-center justify-center rounded-md transition-colors hover:bg-oai-gray-100 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/40 disabled:cursor-not-allowed dark:hover:bg-oai-gray-800/60",children:[l?e.jsx(Z,{className:"h-4 w-4 animate-spin text-oai-gray-400","aria-hidden":!0}):e.jsx("span",{className:me("flex h-[18px] w-[18px] items-center justify-center transition",c&&vr[a.id],!c&&!p&&"opacity-35 grayscale"),"aria-hidden":!0,children:e.jsx(be,{provider:a.id,size:18})}),p&&!l?e.jsx("span",{className:"absolute -bottom-px -right-px h-2 w-2 rounded-full bg-amber-500 ring-2 ring-oai-white dark:ring-oai-gray-900","aria-hidden":!0}):null]})}function Sr({skill:a,targets:s,onToggleTarget:l,busyKey:u}){return e.jsx("div",{className:"flex items-center gap-1",onClick:c=>c.stopPropagation(),children:s.map(c=>e.jsx(Cr,{target:c,state:a.targetStates?.[c.id]||"off",busy:u===Qa(a.id,c.id),onToggle:(p,m)=>l?.(a,p,m)},c.id))})}function _r({skill:a,targets:s,selected:l,onSelect:u,selectable:c,checked:p,onToggleSelect:m,onToggleTarget:h,hasUpdate:x,busyKey:b}){const o=a.repoOwner&&a.repoName?`${a.repoOwner}/${a.repoName}`:null,j=o?`${a.directory} · ${o}`:a.directory,C=k=>{(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),u?.(a))};return e.jsxs("div",{"data-skill-row":"1",role:"button",tabIndex:0,"aria-pressed":l,"aria-label":r("skills.row.open_details",{name:a.name||a.directory}),onClick:()=>u?.(a),onKeyDown:C,className:me("cursor-pointer rounded-md py-3 pr-2 transition focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30",l?"bg-oai-gray-100 ring-1 ring-oai-gray-200 dark:bg-oai-gray-800/60 dark:ring-oai-gray-800":p?"bg-oai-gray-50 dark:bg-oai-gray-900/40":"hover:bg-oai-gray-50 dark:hover:bg-oai-gray-900/40"),children:[e.jsxs("div",{className:"flex items-center gap-3",children:[c?e.jsx("label",{className:"flex shrink-0 items-center",onClick:k=>k.stopPropagation(),children:e.jsx("input",{type:"checkbox",checked:p,onChange:k=>m?.(a,k.target.checked),"aria-label":r("skills.select.row_aria",{name:a.name||a.directory}),className:"h-4 w-4 rounded border-oai-gray-300 text-oai-black focus:ring-oai-gray-400 dark:border-oai-gray-600 dark:bg-oai-gray-900 dark:text-white"})}):null,e.jsx("h2",{className:"min-w-0 flex-1 truncate text-sm font-semibold text-oai-black dark:text-white",title:j,children:a.name||a.directory}),x?e.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-full bg-sky-50 px-1.5 py-0.5 text-[10px] font-semibold text-sky-700 ring-1 ring-sky-200 dark:bg-sky-950/40 dark:text-sky-300 dark:ring-sky-800/60",children:[e.jsx(Aa,{className:"h-2.5 w-2.5","aria-hidden":!0}),r("skills.update.badge")]}):null,e.jsx(Sr,{skill:a,targets:s,onToggleTarget:h,busyKey:b}),e.jsx(Qt,{className:me("hidden h-4 w-4 shrink-0 text-oai-gray-300 transition-colors dark:text-oai-gray-600 lg:block",l&&"text-oai-gray-500 dark:text-oai-gray-300"),"aria-hidden":!0})]}),a.description?e.jsx("p",{className:me("mt-1 line-clamp-2 text-xs text-oai-gray-500 dark:text-oai-gray-400",c&&"pl-7"),children:a.description}):null]})}function Lr({agentFilter:a,agentOptions:s,onAgentFilter:l,filteredCount:u,totalCount:c,anyFilter:p,onClearFilters:m,searchQuery:h,onSearchQuery:x,searchPlaceholder:b}){return e.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2 pt-1 text-xs text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsxs(Ra,{value:a,onValueChange:l,children:[e.jsxs(Ia,{"aria-label":r("skills.filter.agent_label"),className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 bg-oai-white px-2.5 text-xs font-medium text-oai-gray-700 transition hover:border-oai-gray-300 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 data-[popup-open]:border-oai-gray-300 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-oai-gray-200 dark:hover:border-oai-gray-700",children:[e.jsxs("span",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:[r("skills.filter.agent_label"),":"]}),e.jsx(Ea,{children:o=>o==="all"?r("skills.filter.agent_all"):s.find(j=>j.id===o)?.label||o}),e.jsx(Va,{className:"text-oai-gray-400",children:e.jsx(ga,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),e.jsx(Ba,{children:e.jsx($a,{sideOffset:4,alignItemWithTrigger:!1,className:"z-[60]",children:e.jsxs(Ta,{className:"min-w-[var(--anchor-width)] overflow-hidden rounded-md border border-oai-gray-200 bg-white p-1 shadow-[0_12px_32px_-12px_rgba(0,0,0,0.18)] outline-none dark:border-oai-gray-800 dark:bg-oai-gray-950 dark:shadow-[0_12px_32px_-12px_rgba(0,0,0,0.6)]",children:[e.jsxs(Ge,{value:"all",className:"flex cursor-default select-none items-center justify-between gap-2 rounded px-3 py-1.5 text-sm text-oai-black outline-none data-[highlighted]:bg-oai-gray-100 dark:text-white dark:data-[highlighted]:bg-oai-gray-800",children:[e.jsx(We,{children:r("skills.filter.agent_all")}),e.jsx(Je,{children:e.jsx(_e,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),s.map(o=>e.jsxs(Ge,{value:o.id,className:"flex cursor-default select-none items-center justify-between gap-2 rounded px-3 py-1.5 text-sm text-oai-black outline-none data-[highlighted]:bg-oai-gray-100 dark:text-white dark:data-[highlighted]:bg-oai-gray-800",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(be,{provider:o.id,size:14}),e.jsx(We,{children:o.label})]}),e.jsx(Je,{children:e.jsx(_e,{className:"h-3.5 w-3.5","aria-hidden":!0})})]},o.id))]})})})]}),e.jsxs("div",{className:"relative w-56 max-w-full",children:[e.jsx(oa,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-oai-gray-400","aria-hidden":!0}),e.jsx(ua,{type:"search",value:h,onChange:o=>x(o.target.value),onKeyDown:o=>{o.key==="Escape"&&h&&(o.preventDefault(),x(""))},"aria-label":r("skills.action.search_aria"),placeholder:b,className:"h-8 pl-9 pr-8 !border-oai-gray-200 dark:!border-oai-gray-800 focus:!border-oai-gray-400 focus:!ring-oai-gray-400/20 dark:focus:!border-oai-gray-500 dark:focus:!ring-oai-gray-500/20 [&::-webkit-search-cancel-button]:appearance-none"}),e.jsx("button",{type:"button",onMouseDown:o=>o.preventDefault(),onClick:()=>x(""),"aria-label":r("skills.action.search_clear"),"aria-hidden":!h,tabIndex:h?0:-1,className:me("absolute right-2 top-1/2 flex h-6 w-6 -translate-y-1/2 items-center justify-center rounded-full text-oai-gray-400 transition duration-150 ease-out before:absolute before:-inset-1.5 before:content-[''] hover:bg-oai-gray-100 hover:text-oai-gray-600 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-gray-400/40 motion-reduce:transition-none dark:hover:bg-oai-gray-800 dark:hover:text-oai-gray-200",h?"scale-100 opacity-100":"pointer-events-none scale-90 opacity-0"),children:e.jsx(Se,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),e.jsx("span",{role:"status","aria-live":"polite",className:"ml-auto shrink-0 tabular-nums text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.filter.result_count",{filtered:u,total:c})}),p?e.jsxs("button",{type:"button",onClick:m,className:"shrink-0 inline-flex h-7 items-center gap-1 rounded-full bg-oai-gray-100 px-2.5 text-[11px] font-medium text-oai-gray-700 transition hover:bg-oai-gray-200 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:bg-oai-gray-800/70 dark:text-oai-gray-200 dark:hover:bg-oai-gray-700",children:[e.jsx(Se,{className:"h-3 w-3","aria-hidden":!0}),r("skills.filter.clear")]}):null]})}function Pr({count:a,targets:s,busy:l,onBulkSync:u,onBulkRemove:c,onClear:p}){return e.jsxs("div",{role:"toolbar","aria-label":r("skills.select.toolbar_aria"),className:"mb-2 flex flex-wrap items-center gap-2 rounded-lg border border-oai-gray-200 bg-oai-gray-50 px-3 py-2 dark:border-oai-gray-800 dark:bg-oai-gray-900/50",children:[e.jsx("span",{className:"text-xs font-medium text-oai-gray-700 dark:text-oai-gray-200","aria-live":"polite",children:r("skills.select.count",{count:a})}),e.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[e.jsxs(Ma,{children:[e.jsxs(Oa,{disabled:l,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 bg-oai-white px-2.5 text-xs font-medium text-oai-gray-700 transition hover:border-oai-gray-300 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 disabled:opacity-60 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-oai-gray-200",children:[e.jsx(Da,{className:"h-3.5 w-3.5","aria-hidden":!0}),r("skills.select.bulk_sync"),e.jsx(ga,{className:"h-3 w-3","aria-hidden":!0})]}),e.jsx(Ua,{children:e.jsx(Fa,{sideOffset:6,side:"bottom",align:"end",className:"!z-[80]",children:e.jsxs(za,{className:"min-w-[200px] rounded-lg bg-white p-1.5 shadow-lg ring-1 ring-oai-gray-200 dark:bg-oai-gray-950 dark:ring-oai-gray-800",children:[e.jsx("div",{className:"px-2 pb-1 pt-0.5 text-[11px] font-medium uppercase tracking-wide text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.select.bulk_sync_hint")}),s.map(m=>e.jsxs("button",{type:"button",onClick:()=>u(m.id),className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm text-oai-black hover:bg-oai-gray-100 dark:text-white dark:hover:bg-oai-gray-800",children:[e.jsx(be,{provider:m.id,size:16}),e.jsx("span",{className:"flex-1",children:m.label})]},m.id))]})})})]}),e.jsxs(G,{type:"button",variant:"ghost",size:"sm",disabled:l,onClick:c,children:[e.jsx(ma,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),r("skills.select.bulk_remove")]}),e.jsxs("button",{type:"button",onClick:p,className:"inline-flex h-7 items-center gap-1 rounded-full px-2 text-[11px] font-medium text-oai-gray-500 transition hover:text-oai-black focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:text-oai-gray-400 dark:hover:text-white",children:[e.jsx(Se,{className:"h-3 w-3","aria-hidden":!0}),r("skills.select.clear")]})]})]})}function Rr({items:a,totalCount:s,targets:l,agentOptions:u,agentFilter:c,onAgentFilter:p,anyFilter:m,onClearFilters:h,searchQuery:x,onSearchQuery:b,searchPlaceholder:o,selectedId:j,onSelect:C,onToggleTarget:k,busyKey:v,updates:y,selectedIds:N,onToggleSelect:E,onClearSelection:O,onBulkSync:W,onBulkRemove:U}){const ge=N.size;return e.jsxs("div",{children:[ge>0?e.jsx(Pr,{count:ge,targets:l,busy:v==="batch",onBulkSync:W,onBulkRemove:U,onClear:O}):e.jsx(Lr,{agentFilter:c,agentOptions:u,onAgentFilter:p,filteredCount:a.length,totalCount:s,anyFilter:m,onClearFilters:h,searchQuery:x,onSearchQuery:b,searchPlaceholder:o}),a.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-lg border border-dashed border-oai-gray-200 px-4 py-10 text-center text-sm text-oai-gray-500 dark:border-oai-gray-800 dark:text-oai-gray-400",children:[e.jsx("p",{children:r("skills.empty.no_match")}),e.jsx(G,{type:"button",variant:"secondary",size:"sm",onClick:h,children:r("skills.filter.clear")})]}):e.jsx("div",{className:"divide-y divide-oai-gray-200/70 dark:divide-oai-gray-800/70",children:a.map(w=>e.jsx(_r,{skill:w,targets:l,selected:j===(w.id||w.directory),onSelect:C,selectable:!0,checked:N.has(w.id),onToggleSelect:E,onToggleTarget:k,hasUpdate:!!(w.id&&y?.[w.id]),busyKey:v},w.id||w.key))})]})}const Ir={contentVisibility:"auto",containIntrinsicSize:"0 240px"},Er=vt.memo(function({skill:s,installed:l,installing:u,allTargets:c,defaultTargets:p,onInstall:m,onManage:h}){const[x,b]=i.useState(()=>(p||[]).filter(y=>c.some(N=>N.id===y))),o=y=>{b(N=>N.includes(y)?N.filter(E=>E!==y):[...N,y])},j=s.repoOwner&&s.repoName?`${s.repoOwner}/${s.repoName}`:null,C=j?`https://github.com/${s.repoOwner}/${s.repoName}`:null,k=s.installs!=null?r("skills.card.installs",{count:Number(s.installs||0).toLocaleString()}):null,v=x.length?x.map(y=>c.find(N=>N.id===y)?.label||y).join(", "):r("skills.action.choose_targets");return e.jsxs(Nt,{className:"h-full rounded-lg",bodyClassName:"flex h-full flex-col",children:[e.jsx("div",{className:"flex items-start justify-between gap-3",children:e.jsxs("div",{className:"min-w-0",children:[s.readmeUrl?e.jsxs("a",{href:s.readmeUrl,target:"_blank",rel:"noopener noreferrer",className:"group inline-flex max-w-full items-center gap-1 truncate text-base font-semibold text-oai-black hover:underline dark:text-white",title:s.readmeUrl,children:[e.jsx("span",{className:"truncate",children:s.name||s.directory}),e.jsx(la,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-400 opacity-0 transition-opacity group-hover:opacity-100","aria-hidden":!0})]}):e.jsx("h2",{className:"truncate text-base font-semibold text-oai-black dark:text-white",children:s.name||s.directory}),j||k?e.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-x-1.5 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:[C?e.jsxs("a",{href:C,target:"_blank",rel:"noopener noreferrer",onClick:y=>y.stopPropagation(),className:"inline-flex items-center gap-1 truncate rounded text-oai-gray-500 hover:text-oai-black hover:underline focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:text-oai-gray-400 dark:hover:text-white",title:C,children:[e.jsx("span",{className:"truncate",children:j}),e.jsx(la,{className:"h-2.5 w-2.5 shrink-0","aria-hidden":!0})]}):null,j&&k?e.jsx("span",{"aria-hidden":!0,children:"·"}):null,k?e.jsx("span",{className:"truncate",children:k}):null]}):null]})}),s.description?e.jsx("p",{className:"mt-3 line-clamp-3 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:s.description}):null,e.jsx("div",{className:"mt-auto pt-5",children:l?e.jsxs(G,{type:"button",variant:"secondary",size:"sm",onClick:()=>h?.(s),className:"w-full",children:[e.jsx(_e,{className:"mr-1.5 h-3.5 w-3.5 text-emerald-500 dark:text-emerald-400","aria-hidden":!0}),r("skills.card.manage")]}):e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-1 text-xs text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx("span",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.card.targets_prefix")}),e.jsx("span",{className:"min-w-0 truncate font-medium text-oai-black dark:text-white",children:x.length?v:r("skills.target.none")}),e.jsxs(Ma,{children:[e.jsx(Oa,{disabled:u,"aria-label":r("skills.action.choose_targets"),className:"rounded text-xs font-medium text-oai-gray-500 underline decoration-oai-gray-300 decoration-dotted underline-offset-2 transition hover:text-oai-black hover:decoration-oai-gray-500 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 disabled:cursor-not-allowed disabled:opacity-60 dark:text-oai-gray-400 dark:decoration-oai-gray-600 dark:hover:text-white dark:hover:decoration-oai-gray-400",children:r("skills.card.targets_change")}),e.jsx(Ua,{children:e.jsx(Fa,{sideOffset:6,side:"bottom",align:"end",className:"!z-[80]",children:e.jsxs(za,{className:"min-w-[220px] rounded-lg bg-white p-1.5 shadow-lg ring-1 ring-oai-gray-200 dark:bg-oai-gray-950 dark:ring-oai-gray-800",children:[e.jsx("div",{className:"px-2 pb-1 pt-0.5 text-[11px] font-medium uppercase tracking-wide text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.target.menu_label")}),c.map(y=>{const N=x.includes(y.id);return e.jsxs("label",{className:"flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-sm text-oai-black hover:bg-oai-gray-100 dark:text-white dark:hover:bg-oai-gray-800",children:[e.jsx("input",{type:"checkbox",className:"h-4 w-4 shrink-0 rounded border-oai-gray-300 text-oai-black focus:ring-oai-gray-400 dark:border-oai-gray-600 dark:bg-oai-gray-900 dark:text-white",checked:N,onChange:()=>o(y.id)}),e.jsx(be,{provider:y.id,size:16}),e.jsx("span",{className:"flex-1 text-left",children:y.label})]},y.id)})]})})})]})]}),e.jsxs(G,{type:"button",size:"sm",onClick:()=>m(s,x),disabled:u||x.length===0,className:"w-full",children:[u?e.jsx(Z,{className:"mr-1.5 h-3.5 w-3.5 animate-spin","aria-hidden":!0}):e.jsx(Da,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),r("skills.action.install")]})]})})]})});function Br({repos:a,repoInput:s,onRepoInput:l,busyKey:u,onAdd:c,onRemove:p}){return e.jsxs("div",{className:"rounded-lg border border-oai-gray-200 bg-white p-4 dark:border-oai-gray-800 dark:bg-oai-gray-950",children:[e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[e.jsx(ua,{value:s,onChange:m=>l(m.target.value),placeholder:r("skills.repo.placeholder"),className:"min-w-0 flex-1"}),e.jsxs(G,{type:"button",variant:"secondary",size:"md",onClick:c,disabled:u==="repo:add",className:"shrink-0 whitespace-nowrap",children:[u==="repo:add"?e.jsx(Z,{className:"mr-1.5 h-4 w-4 animate-spin","aria-hidden":!0}):e.jsx(Ka,{className:"mr-1.5 h-4 w-4","aria-hidden":!0}),r("skills.repo.add")]})]}),a.length?e.jsx("div",{className:"mt-3 divide-y divide-oai-gray-200/70 dark:divide-oai-gray-800/70",children:a.map(m=>{const h=u===`repo:${m.owner}/${m.name}`;return e.jsxs("div",{className:"flex items-center justify-between gap-3 py-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"truncate text-sm font-medium text-oai-black dark:text-white",children:[m.owner,"/",m.name]}),e.jsx("div",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400",children:m.branch})]}),e.jsxs(G,{type:"button",variant:"ghost",size:"sm",disabled:h,onClick:()=>p(m),className:"shrink-0",children:[h?e.jsx(Z,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):e.jsx(ma,{className:"h-3.5 w-3.5","aria-hidden":!0}),e.jsx("span",{className:"sr-only",children:r("skills.repo.remove")})]})]},`${m.owner}/${m.name}`)})}):null]})}function $r(){return typeof window>"u"?"my":new URLSearchParams(window.location.search).get("tab")==="browse"?"browse":"my"}function ls(){const[a,s]=i.useState($r),[l,u]=i.useState({skills:[],targets:[]}),[c,p]=i.useState([]),[m,h]=i.useState([]),[x,b]=i.useState([]),[o,j]=i.useState(xe),[C,k]=i.useState(""),[v,y]=i.useState(""),[N,E]=i.useState(""),[O,W]=i.useState(""),[U,ge]=i.useState(""),[w,ee]=i.useState(!1),[B,K]=i.useState("all"),[J,ae]=i.useState(null),[F,ke]=i.useState(""),[we,Ue]=i.useState(!0),[Le,Fe]=i.useState(!1),[ze,T]=i.useState(""),[te,Q]=i.useState(null),[ve,L]=i.useState(null),[V,re]=i.useState(()=>new Set),[I,se]=i.useState({}),[P,Pe]=i.useState({}),[je,ne]=i.useState([]),[pe,Re]=i.useState(!1),Ie=i.useRef(!1),Ee=i.useMemo(()=>{const t=new Set;for(const n of l.skills||[])for(const d of Ca(n))t.add(d);return t},[l.skills]),Ne=i.useCallback(async()=>{const t=await Ut();u({skills:t.skills||[],targets:t.targets||[]})},[]),q=i.useCallback(async()=>{const t=await Ft();b(t.repos||[])},[]),ie=i.useCallback(async({force:t=!1}={})=>{Fe(!0);try{const n=await zt({force:t});p(n.skills||[])}finally{Fe(!1)}},[]),fe=i.useCallback(async({force:t=!1}={})=>{Re(!0);try{const n=await At({force:t});ne(n.skills||[])}finally{Re(!1)}},[]),oe=i.useCallback(async()=>{try{const t=await Kt();se(t?.updates||{})}catch{se({})}},[]),le=i.useCallback(async()=>{try{const t=await Vt(),n={};for(const d of t?.skills||[])d.installed&&(d.directory&&(n[String(d.directory).toLowerCase()]=d),n[String(d.skill).toLowerCase()]=d);Pe(n)}catch{Pe({})}},[]),he=i.useCallback(async()=>{Ue(!0),T("");try{await Promise.all([Ne(),q()])}catch(t){T(t?.message||r("skills.error.generic"))}finally{Ue(!1)}},[Ne,q]),Xe=i.useCallback(async()=>{await he();const t=n=>T(n?.message||r("skills.error.generic"));a==="my"?(oe(),le()):o===A?fe({force:!0}).catch(t):o!==M&&ie({force:!0}).catch(t)},[ie,he,fe,oe,le,o,a]);i.useEffect(()=>{he()},[he]),i.useEffect(()=>{if(Ie.current||typeof window>"u")return;const t=new URLSearchParams(window.location.search),n=t.get("skill");if(!n){Ie.current=!0;return}const d=l.skills||[];if(!d.length)return;const g=d.find(S=>S.directory===n||S.id===n);g&&(s("my"),ae(g.id||g.directory)),Ie.current=!0,t.delete("skill");const R=t.toString();window.history.replaceState({},"",`${window.location.pathname}${R?`?${R}`:""}${window.location.hash}`)},[l.skills]),i.useEffect(()=>{a==="browse"&&(o===M||o===A||c.length===0&&ie().catch(t=>T(t?.message||r("skills.error.generic"))))},[c.length,ie,o,a]),i.useEffect(()=>{a!=="browse"||o!==A||je.length===0&&fe().catch(t=>T(t?.message||r("skills.error.generic")))},[fe,je.length,o,a]);const Ae=Object.keys(I).length>0,de=Object.keys(P).length>0;if(i.useEffect(()=>{a==="my"&&(Ae||oe(),de||le())},[a,Ae,de,oe,le]),i.useEffect(()=>{const t=setTimeout(()=>y(C),200);return()=>clearTimeout(t)},[C]),i.useEffect(()=>{const t=setTimeout(()=>W(N),120);return()=>clearTimeout(t)},[N]),i.useEffect(()=>{if(typeof window>"u")return;const t=new URLSearchParams(window.location.search),n=t.get("tab");if(a==="my"){if(!n)return;t.delete("tab")}else{if(n===a)return;t.set("tab",a)}const d=t.toString(),g=`${window.location.pathname}${d?`?${d}`:""}${window.location.hash}`;window.history.replaceState({},"",g)},[a]),!wr&&!kt())return e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx(jt,{})});const _=async(t,n)=>{ke(t),T("");try{await n(),await Ne()}catch(d){T(d?.message||r("skills.error.generic"))}finally{ke("")}},Ye=(t,n)=>{const d=(n&&n.length?n:sa).filter(g=>(l.targets||[]).some(R=>R.id===g));_(He(t),async()=>{await ya(t,d);const g=d.map(R=>(l.targets||[]).find(S=>S.id===R)?.label||R).join(", ");Ce({title:r("skills.toast.installed",{name:t.name||t.directory,targets:g||r("skills.target.none")}),timeout:4e3})})},Be=t=>{Q(t)},ye=()=>{const t=te;t&&(Q(null),_(Sa(t),async()=>{let n=null;t.managed?n=await ba(t.id):await ka(t.directory,t.targets||[]);const d=!!(n?.trashed&&t.managed&&t.id);Ce({title:r("skills.toast.removed",{name:t.name||t.directory}),timeout:6e3,data:d?{onUndo:async()=>{try{await Ht(t.id),await Ne()}catch(g){T(g?.message||r("skills.error.generic"))}}}:void 0})}))},X=(t,n,d)=>_(Qa(t.id,n),async()=>{const g=new Set(t.targets||[]);d?g.add(n):g.delete(n),t.managed?await wa(t.id,Array.from(g)):await va(t.directory,Array.from(g));const R={name:t.name||t.directory,agent:Ke(n)};Ce({title:d?r("skills.toast.synced_one",R):r("skills.toast.unsynced_one",R),timeout:3e3})}),$e=i.useCallback(()=>re(new Set),[]),Ze=i.useCallback((t,n)=>{re(d=>{const g=new Set(d);return n?g.add(t.id):g.delete(t.id),g})},[]),Ke=t=>(l.targets||[]).find(n=>n.id===t)?.label||t,Te=t=>{const n=(l.skills||[]).filter(d=>V.has(d.id));n.length&&_("batch",async()=>{for(const d of n){const g=new Set(d.targets||[]);g.add(t),d.managed?await wa(d.id,Array.from(g)):await va(d.directory,Array.from(g))}$e(),Ce({title:r("skills.toast.bulk_synced",{count:n.length,agent:Ke(t)}),timeout:4e3})})},ea=()=>{const t=(l.skills||[]).filter(n=>V.has(n.id));t.length&&L(t)},aa=()=>{const t=ve;t&&(L(null),_("batch",async()=>{for(const n of t)n.managed?await ba(n.id):await ka(n.directory,n.targets||[]);$e(),Ce({title:r("skills.toast.bulk_removed",{count:t.length}),timeout:4e3})}))},f=t=>{!t?.repoOwner||!t?.repoName||_(He(t),async()=>{await ya({key:t.key,name:t.name,description:t.description,directory:t.sourceDirectory||t.directory,repoOwner:t.repoOwner,repoName:t.repoName,repoBranch:t.repoBranch,readmeUrl:t.readmeUrl},t.targets&&t.targets.length?t.targets:sa),await oe(),Ce({title:r("skills.toast.updated",{name:t.name||t.directory}),timeout:4e3})})},D=async()=>{const t=C.trim();if(!(t.length<2)){ke("search"),T("");try{const n=await qt(t);h(n.skills||[])}catch(n){T(n?.message||r("skills.error.generic"))}finally{ke("")}}},ce=async()=>{const t=U.trim().replace(/^https:\/\/github\.com\//,"").replace(/\.git$/,""),[n,d]=t.split("/");if(!n||!d){T(r("skills.repo.invalid"));return}await _("repo:add",async()=>{await Wt({owner:n,name:d,branch:"main",enabled:!0}),ge(""),await q(),await ie()})},ue=async t=>{await _(`repo:${t.owner}/${t.name}`,async()=>{await Gt(t.owner,t.name),await q(),await ie()})},$=l.targets||[],H=l.skills||[],De=i.useMemo(()=>{const t=B==="all"?H:H.filter(d=>(d.targets||[]).includes(B)),n=O.trim().toLowerCase();return n?t.filter(d=>(d.name||"").toLowerCase().includes(n)||(d.directory||"").toLowerCase().includes(n)||(d.description||"").toLowerCase().includes(n)):t},[H,B,O]),Xa=B!=="all",Y=i.useMemo(()=>J&&H.find(t=>(t.id||t.directory)===J)||null,[H,J]),Ya=i.useCallback(()=>{K("all"),E("")},[]),Za=i.useCallback(t=>{ae(n=>{const d=t?.id||t?.directory||null;return n===d?null:d})},[]),et=i.useCallback(()=>ae(null),[]),at=i.useCallback(t=>{const n=Qe(t).toLowerCase(),d=Na(t),g=(l.skills||[]).find(R=>{const S=Ca(R);return S.has(n)||d&&S.has(d)});g&&ae(g.id||g.directory)},[l.skills]);i.useEffect(()=>{a!=="my"&&V.size&&re(new Set)},[a,V.size]),i.useEffect(()=>{J&&!Y&&ae(null)},[Y,J]);const Me=i.useMemo(()=>{const t=o===M?m:o===A?je:c,d=o===M||o===A||o===xe?t:t.filter(S=>`${S.repoOwner}/${S.repoName}`===o),g=v.trim().toLowerCase();return(o===M||!g?d:d.filter(S=>(S.name||"").toLowerCase().includes(g)||(S.directory||"").toLowerCase().includes(g)||(S.description||"").toLowerCase().includes(g))).map(S=>{const ta=Qe(S).toLowerCase(),z=Na(S);return{...S,installed:Ee.has(ta)||z&&Ee.has(z)}})},[v,c,Ee,je,m,o]),tt=e.jsx("div",{className:"flex h-64 items-center justify-center",children:e.jsx(Z,{className:"h-8 w-8 animate-spin text-oai-gray-400","aria-hidden":!0})}),rt=e.jsxs("div",{className:"flex h-64 flex-col items-center justify-center gap-3 px-6 text-center",children:[e.jsx(Z,{className:"h-8 w-8 animate-spin text-oai-gray-400","aria-hidden":!0}),e.jsx("p",{className:"max-w-md text-xs text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.browse.loading_hint")})]}),Ve=(t,n=null)=>e.jsxs("div",{className:"flex flex-col items-center gap-4 rounded-lg border border-dashed border-oai-gray-200 px-4 py-10 text-center text-sm text-oai-gray-500 dark:border-oai-gray-800 dark:text-oai-gray-400",children:[e.jsx("p",{children:r(t)}),n]});let qe;if(we)qe=tt;else if(a==="my")qe=H.length?e.jsx(Rr,{items:De,totalCount:H.length,targets:$,agentOptions:$,agentFilter:B,onAgentFilter:K,anyFilter:Xa,onClearFilters:Ya,searchQuery:N,onSearchQuery:E,searchPlaceholder:r("skills.my.placeholder"),selectedId:J,onSelect:Za,onToggleTarget:X,busyKey:F,updates:I,selectedIds:V,onToggleSelect:Ze,onClearSelection:$e,onBulkSync:Te,onBulkRemove:ea}):e.jsxs("div",{className:"flex flex-col items-center gap-4 rounded-lg border border-dashed border-oai-gray-200 px-4 py-10 text-center dark:border-oai-gray-800",children:[$.length>0?e.jsxs("div",{className:"relative h-11 w-80 overflow-hidden","aria-hidden":!0,children:[e.jsx("div",{className:"pointer-events-none absolute inset-0",style:{maskImage:"linear-gradient(to right, transparent 8%, black 20%, black 32%, transparent 44%, transparent 56%, black 68%, black 80%, transparent 92%)",WebkitMaskImage:"linear-gradient(to right, transparent 8%, black 20%, black 32%, transparent 44%, transparent 56%, black 68%, black 80%, transparent 92%)"},children:e.jsx("div",{className:"absolute inset-y-0 left-0 flex w-max items-center animate-marquee-x",style:{filter:"blur(2.5px)"},children:[...$,...$].map((t,n)=>e.jsx("span",{className:"shrink-0 px-3",children:e.jsx(be,{provider:t.id,size:30})},`b-${n}`))})}),e.jsx("div",{className:"pointer-events-none absolute inset-0",style:{maskImage:"linear-gradient(to right, transparent 28%, black 42%, black 58%, transparent 72%)",WebkitMaskImage:"linear-gradient(to right, transparent 28%, black 42%, black 58%, transparent 72%)"},children:e.jsx("div",{className:"absolute inset-y-0 left-0 flex w-max items-center animate-marquee-x",children:[...$,...$].map((t,n)=>e.jsx("span",{className:"shrink-0 px-3",children:e.jsx(be,{provider:t.id,size:30})},`c-${n}`))})}),e.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-0 w-20 bg-gradient-to-r from-oai-white to-transparent dark:from-oai-gray-900"}),e.jsx("div",{className:"pointer-events-none absolute inset-y-0 right-0 w-20 bg-gradient-to-l from-oai-white to-transparent dark:from-oai-gray-900"})]}):null,e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.empty.my")}),e.jsx(G,{type:"button",size:"sm",onClick:()=>s("browse"),children:r("skills.empty.my_cta")})]});else{const t=o===M,n=o===A,d=x.length===0&&!t&&!n,g=Le&&!t&&!n||n&&pe,R=!t&&!n&&(v.trim()!==""||o!==xe),S=()=>{k(""),j(xe)},ta=!d&&!g&&(Me.length>0||R)?e.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2 px-1 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:[e.jsx("span",{children:r("skills.filter.result_count_browse",{count:Me.length})}),R?e.jsxs("button",{type:"button",onClick:S,className:"ml-auto inline-flex h-7 items-center gap-1 rounded-full bg-oai-gray-100 px-2.5 text-[11px] font-medium text-oai-gray-700 transition hover:bg-oai-gray-200 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:bg-oai-gray-800/70 dark:text-oai-gray-200 dark:hover:bg-oai-gray-700",children:[e.jsx(Se,{className:"h-3 w-3","aria-hidden":!0}),r("skills.filter.clear")]}):null]}):null;let z;d?z=e.jsx("div",{className:"rounded-lg border border-dashed border-oai-gray-200 p-6 text-center dark:border-oai-gray-800",children:e.jsx("p",{className:"text-sm text-oai-gray-600 dark:text-oai-gray-300",children:r("skills.browse.empty_sources")})}):g?z=rt:t&&C.trim().length<2?z=e.jsx("div",{className:"rounded-lg border border-dashed border-oai-gray-200 px-4 py-6 text-center text-sm text-oai-gray-500 dark:border-oai-gray-800 dark:text-oai-gray-400",children:r("skills.browse.hint_skillssh")}):Me.length?z=e.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:Me.map(Oe=>e.jsx("div",{style:Ir,children:e.jsx(Er,{skill:Oe,installed:!!Oe.installed,installing:F===He(Oe),allTargets:$,defaultTargets:sa,onInstall:Ye,onManage:at})},Oe.id||Oe.key))}):R?z=Ve("skills.empty.no_match",e.jsx(G,{type:"button",variant:"secondary",size:"sm",onClick:S,children:r("skills.filter.clear")})):t?z=Ve("skills.empty.search"):n?z=Ve("skills.empty.popular"):z=Ve("skills.empty.browse");const st=d||w?e.jsx("div",{className:"mb-5",children:e.jsx(Br,{repos:x,repoInput:U,onRepoInput:ge,busyKey:F,onAdd:ce,onRemove:ue})}):null,nt=!w&&!t&&!n&&x.length<=1&&Me.length>0?e.jsx(tr,{id:"skills-browse-intro",className:"mt-6",children:e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[e.jsx("span",{children:r("skills.browse.add_repo_hint")}),e.jsx("button",{type:"button",onClick:()=>ee(!0),className:"rounded font-medium text-oai-gray-700 underline decoration-dotted underline-offset-2 transition hover:text-oai-black focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:text-oai-gray-200 dark:hover:text-white",children:r("skills.browse.manage_sources")})]})}):null;qe=e.jsxs(e.Fragment,{children:[st,ta,z,nt]})}return e.jsxs("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:[e.jsx("main",{className:"flex-1 pb-12 pt-8 sm:pb-16 sm:pt-10",children:e.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[e.jsxs("div",{className:"mb-6 flex items-end justify-between gap-4",children:[e.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:r("skills.page.title")}),e.jsxs(G,{type:"button",variant:"secondary",size:"sm",onClick:Xe,disabled:we||Le||pe,children:[e.jsx(wt,{className:me("mr-1.5 h-3.5 w-3.5",(we||Le||pe)&&"animate-spin"),"aria-hidden":!0}),r("skills.action.refresh")]})]}),e.jsx("div",{className:"mb-5 flex gap-6 border-b border-oai-gray-200 dark:border-oai-gray-800",children:[["my",r("skills.tab.my")],["browse",r("skills.tab.browse")]].map(([t,n])=>e.jsx("button",{type:"button","aria-pressed":a===t,onClick:()=>s(t),className:me("-mb-px border-b-2 pb-2 text-sm font-medium transition-colors",a===t?"border-oai-black text-oai-black dark:border-white dark:text-white":"border-transparent text-oai-gray-500 hover:text-oai-black dark:text-oai-gray-400 dark:hover:text-white"),children:n},t))}),ze?e.jsx("div",{className:"mb-4 rounded-lg border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700 dark:border-red-900/60 dark:bg-red-950/30 dark:text-red-200",children:ze}):null,a==="browse"?e.jsxs("div",{className:"mb-5 flex flex-col gap-3 sm:flex-row sm:items-center",children:[e.jsx(Ct,{className:"shrink-0",ariaLabel:r("skills.source.label"),options:[{id:"repo",label:r("skills.mode.repo")},{id:"popular",label:r("skills.mode.popular"),icon:e.jsx(Jt,{className:"h-3.5 w-3.5","aria-hidden":!0})},{id:"skillssh",label:r("skills.mode.skillssh")}],value:o===M?"skillssh":o===A?"popular":"repo",onChange:t=>{t==="skillssh"?j(M):t==="popular"?j(A):(o===M||o===A)&&j(xe)}}),o!==M&&o!==A?e.jsxs(Ra,{value:o,onValueChange:j,children:[e.jsxs(Ia,{"aria-label":r("skills.source.label"),className:"inline-flex h-8 w-44 shrink-0 items-center justify-between gap-2 rounded-md border border-oai-gray-200 bg-oai-white px-2.5 text-xs text-oai-black focus:outline-none data-[popup-open]:border-oai-gray-300 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-white dark:data-[popup-open]:border-oai-gray-700",children:[e.jsx(Ea,{children:t=>t===xe?r("skills.source.all"):t}),e.jsx(Va,{className:"text-oai-gray-400",children:e.jsx(ga,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),e.jsx(Ba,{children:e.jsx($a,{sideOffset:4,alignItemWithTrigger:!1,className:"z-[60]",children:e.jsxs(Ta,{className:"min-w-[var(--anchor-width)] overflow-hidden rounded-md border border-oai-gray-200 bg-white p-1 shadow-[0_12px_32px_-12px_rgba(0,0,0,0.18)] outline-none transition-[opacity,transform] duration-150 ease-out data-[ending-style]:scale-[0.97] data-[ending-style]:opacity-0 data-[starting-style]:scale-[0.97] data-[starting-style]:opacity-0 dark:border-oai-gray-800 dark:bg-oai-gray-950 dark:shadow-[0_12px_32px_-12px_rgba(0,0,0,0.6)]",children:[e.jsxs(Ge,{value:xe,className:"flex cursor-default select-none items-center justify-between gap-2 rounded px-3 py-1.5 text-sm text-oai-black outline-none data-[highlighted]:bg-oai-gray-100 dark:text-white dark:data-[highlighted]:bg-oai-gray-800",children:[e.jsx(We,{children:r("skills.source.all")}),e.jsx(Je,{children:e.jsx(_e,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),x.map(t=>{const n=`${t.owner}/${t.name}`;return e.jsxs(Ge,{value:n,className:"flex cursor-default select-none items-center justify-between gap-2 rounded px-3 py-1.5 text-sm text-oai-black outline-none data-[highlighted]:bg-oai-gray-100 dark:text-white dark:data-[highlighted]:bg-oai-gray-800",children:[e.jsx(We,{children:n}),e.jsx(Je,{children:e.jsx(_e,{className:"h-3.5 w-3.5","aria-hidden":!0})})]},n)})]})})})]}):null,e.jsxs("div",{className:"relative flex-1",children:[e.jsx(oa,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-oai-gray-400","aria-hidden":!0}),e.jsx(ua,{type:"search",value:C,onChange:t=>k(t.target.value),onKeyDown:t=>{t.key==="Enter"&&o===M&&D()},"aria-label":r("skills.action.search_aria"),placeholder:o===M?r("skills.browse.placeholder_skillssh"):o===A?r("skills.browse.placeholder_popular"):o===xe?r("skills.browse.placeholder_all"):r("skills.browse.placeholder_repo",{repo:o}),className:"h-8 pl-9 !border-oai-gray-200 dark:!border-oai-gray-800 focus:!border-oai-gray-400 focus:!ring-oai-gray-400/20 dark:focus:!border-oai-gray-500 dark:focus:!ring-oai-gray-500/20"})]}),o===M?e.jsxs(G,{type:"button",size:"sm",onClick:D,disabled:C.trim().length<2||F==="search",className:"focus:!ring-oai-gray-400/30",children:[F==="search"?e.jsx(Z,{className:"mr-1.5 h-4 w-4 animate-spin","aria-hidden":!0}):e.jsx(oa,{className:"mr-1.5 h-4 w-4","aria-hidden":!0}),r("skills.action.search")]}):o===A?null:e.jsxs(G,{type:"button",variant:"secondary",size:"sm",onClick:()=>ee(t=>!t),"aria-expanded":w,className:"!h-8 shrink-0 whitespace-nowrap !border-oai-gray-200 dark:!border-oai-gray-800 hover:!border-oai-gray-300 dark:hover:!border-oai-gray-700 hover:!text-oai-black dark:hover:!text-white focus:!ring-oai-gray-400/30",children:[e.jsx(Ka,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),r("skills.browse.manage_sources"),e.jsx("span",{className:"ml-1.5 rounded bg-oai-gray-100 px-1.5 py-0.5 text-xs font-medium text-oai-gray-600 dark:bg-oai-gray-800 dark:text-oai-gray-300",children:x.length})]})]}):null,qe,e.jsx(br,{skill:Y,targets:$,busyKey:F,usage:Y&&(P[String(Y.directory||"").toLowerCase()]||P[String(Y.name||"").toLowerCase()])||null,hasUpdate:!!(Y?.id&&I?.[Y.id]),updating:Y?F===He(Y):!1,onUpdate:f,onClose:et,onToggleTarget:X,onRemove:Be})]})}),e.jsx(pa,{open:!!te,title:r("skills.confirm.remove_title",{name:te?.name||te?.directory||""}),description:te?te.managed?r("skills.confirm.remove_managed"):r("skills.confirm.remove_local"):"",confirmLabel:r("skills.action.remove"),cancelLabel:r("shared.action.cancel"),destructive:!0,busy:F===Sa(te||{}),onCancel:()=>Q(null),onConfirm:ye}),e.jsx(pa,{open:!!ve,title:r("skills.confirm.bulk_remove_title",{count:ve?.length||0}),description:r("skills.confirm.bulk_remove_desc"),confirmLabel:r("skills.action.remove"),cancelLabel:r("shared.action.cancel"),destructive:!0,busy:F==="batch",onCancel:()=>L(null),onConfirm:aa})]})}export{ls as SkillsPage};
import{V as o,W as r}from"./__vite-browser-external-CuMc3dqk.js";import{F as u,P as d}from"./useScrollLock-DmM-LeMm.js";function a(){return new u({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new d,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function m(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:a(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:r,inactiveTriggerProps:r,popupProps:r}}function P(e,n,g=!1){return new u({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:n,syncOnly:!0,nested:g,onOpenChange:void 0})}const t=o(e=>e.triggerIdProp??e.activeTriggerId),i=o(e=>e.openProp??e.open),p=o(e=>(e.popupElement?.id??e.floatingId)||void 0);function l(e,n){return n!==void 0&&i(e)&&t(e)===n}function s(e,n){return l(e,n)?!0:n!==void 0&&i(e)&&t(e)==null&&e.triggerCount===1}const E={open:i,mounted:o(e=>e.mounted),transitionStatus:o(e=>e.transitionStatus),floatingRootContext:o(e=>e.floatingRootContext),triggerCount:o(e=>e.triggerCount),preventUnmountingOnClose:o(e=>e.preventUnmountingOnClose),payload:o(e=>e.payload),activeTriggerId:t,activeTriggerElement:o(e=>e.mounted?e.activeTriggerElement:null),popupId:p,isTriggerActive:o((e,n)=>n!==void 0&&t(e)===n),isOpenedByTrigger:o((e,n)=>l(e,n)),isMountedByTrigger:o((e,n)=>n!==void 0&&t(e)===n&&e.mounted),triggerProps:o((e,n)=>n?e.activeTriggerProps:e.inactiveTriggerProps),triggerPopupId:o((e,n)=>s(e,n)?p(e):void 0),popupProps:o(e=>e.popupProps),popupElement:o(e=>e.popupElement),positionerElement:o(e=>e.positionerElement)};export{m as a,P as c,E as p};
import{l as e}from"./__vite-browser-external-CuMc3dqk.js";const o=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],a=e("terminal",o);export{a as T};

Sorry, the diff of this file is too big to display

import{l as on,a_ as sn,r as R,bc as rn,aS as cn,aD as ln,bd as an,W as $t,A as fn,aT as B,be as Z,bf as Ne,ba as se,bg as J,aL as K,bh as je,bi as pe,bj as Se,bk as un,bl as Ht,bm as dn,bn as qe,bo as Ue,bp as De,bq as vt,br as It,a1 as gn,bs as mn,aH as hn,aG as G,aU as Ce,P as Ke,bt as pn,z as xn,bu as wn}from"./__vite-browser-external-CuMc3dqk.js";import{n as At,q as yn,F as bn,P as Rn,o as vn,v as Re,p as An,i as On}from"./useScrollLock-DmM-LeMm.js";const Sn=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Bo=on("chevron-down",Sn),Cn=["top","right","bottom","left"],de=Math.min,z=Math.max,Ee=Math.round,ve=Math.floor,q=e=>({x:e,y:e}),En={left:"right",right:"left",bottom:"top",top:"bottom"};function Xe(e,t,o){return z(e,de(t,o))}function Q(e,t){return typeof e=="function"?e(t):e}function V(e){return e.split("-")[0]}function te(e){return e.split("-")[1]}function Ge(e){return e==="x"?"y":"x"}function Je(e){return e==="y"?"height":"width"}function X(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Qe(e){return Ge(X(e))}function Pn(e,t,o){o===void 0&&(o=!1);const n=te(e),i=Qe(e),s=Je(i);let r=i==="x"?n===(o?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(r=Pe(r)),[r,Pe(r)]}function Tn(e){const t=Pe(e);return[Ye(e),t,Ye(t)]}function Ye(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Ot=["left","right"],St=["right","left"],Mn=["top","bottom"],Dn=["bottom","top"];function kn(e,t,o){switch(e){case"top":case"bottom":return o?t?St:Ot:t?Ot:St;case"left":case"right":return t?Mn:Dn;default:return[]}}function Ln(e,t,o,n){const i=te(e);let s=kn(V(e),o==="start",n);return i&&(s=s.map(r=>r+"-"+i),t&&(s=s.concat(s.map(Ye)))),s}function Pe(e){const t=V(e);return En[t]+e.slice(t.length)}function Fn(e){return{top:0,right:0,bottom:0,left:0,...e}}function Bt(e){return typeof e!="number"?Fn(e):{top:e,right:e,bottom:e,left:e}}function Te(e){const{x:t,y:o,width:n,height:i}=e;return{width:n,height:i,top:o,left:t,right:t+n,bottom:o+i,x:t,y:o}}function Vo(e,t={}){const{enabled:o=!0,event:n="click",toggle:i=!0,ignoreMouse:s=!1,stickIfOpen:r=!0,touchOpenDelay:c=0,reason:l=sn}=t,u="rootStore"in e?e.rootStore:e,a=u.context.dataRef,f=R.useRef(void 0),g=rn(),d=cn(),h=R.useMemo(()=>{function m(p,w,x,y){const v=fn(l,w,x);p&&y==="touch"&&c>0?d.start(c,()=>{u.setOpen(!0,v)}):u.setOpen(p,v)}function b(p,w,x){const y=a.current.openEvent,v=u.select("domReferenceElement")!==w;return p&&v||!p||!i?!0:y&&r?!x(y.type):!1}return{onPointerDown(p){f.current=p.pointerType},onMouseDown(p){const w=f.current,x=p.nativeEvent,y=u.select("open");if(p.button!==0||n==="click"||At(w,!0)&&s)return;const v=b(y,p.currentTarget,E=>E==="click"||E==="mousedown"),A=ln(x);if(an(A)){m(v,x,A,w);return}const P=p.currentTarget;g.request(()=>{m(v,x,P,w)})},onClick(p){if(n==="mousedown-only")return;const w=f.current;if(n==="mousedown"&&w){f.current=void 0;return}if(At(w,!0)&&s)return;const x=u.select("open"),y=b(x,p.currentTarget,v=>v==="click"||v==="mousedown"||v==="keydown"||v==="keyup");m(y,p.nativeEvent,p.currentTarget,w)},onKeyDown(){f.current=void 0}}},[a,n,s,l,u,r,i,g,d,c]);return R.useMemo(()=>o?{reference:h}:$t,[o,h])}function Ct(e,t,o){let{reference:n,floating:i}=e;const s=X(t),r=Qe(t),c=Je(r),l=V(t),u=s==="y",a=n.x+n.width/2-i.width/2,f=n.y+n.height/2-i.height/2,g=n[c]/2-i[c]/2;let d;switch(l){case"top":d={x:a,y:n.y-i.height};break;case"bottom":d={x:a,y:n.y+n.height};break;case"right":d={x:n.x+n.width,y:f};break;case"left":d={x:n.x-i.width,y:f};break;default:d={x:n.x,y:n.y}}switch(te(t)){case"start":d[r]-=g*(o&&u?-1:1);break;case"end":d[r]+=g*(o&&u?-1:1);break}return d}async function Wn(e,t){var o;t===void 0&&(t={});const{x:n,y:i,platform:s,rects:r,elements:c,strategy:l}=e,{boundary:u="clippingAncestors",rootBoundary:a="viewport",elementContext:f="floating",altBoundary:g=!1,padding:d=0}=Q(t,e),h=Bt(d),b=c[g?f==="floating"?"reference":"floating":f],p=Te(await s.getClippingRect({element:(o=await(s.isElement==null?void 0:s.isElement(b)))==null||o?b:b.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:u,rootBoundary:a,strategy:l})),w=f==="floating"?{x:n,y:i,width:r.floating.width,height:r.floating.height}:r.reference,x=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),y=await(s.isElement==null?void 0:s.isElement(x))?await(s.getScale==null?void 0:s.getScale(x))||{x:1,y:1}:{x:1,y:1},v=Te(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:w,offsetParent:x,strategy:l}):w);return{top:(p.top-v.top+h.top)/y.y,bottom:(v.bottom-p.bottom+h.bottom)/y.y,left:(p.left-v.left+h.left)/y.x,right:(v.right-p.right+h.right)/y.x}}const $n=50,Hn=async(e,t,o)=>{const{placement:n="bottom",strategy:i="absolute",middleware:s=[],platform:r}=o,c=r.detectOverflow?r:{...r,detectOverflow:Wn},l=await(r.isRTL==null?void 0:r.isRTL(t));let u=await r.getElementRects({reference:e,floating:t,strategy:i}),{x:a,y:f}=Ct(u,n,l),g=n,d=0;const h={};for(let m=0;m<s.length;m++){const b=s[m];if(!b)continue;const{name:p,fn:w}=b,{x,y,data:v,reset:A}=await w({x:a,y:f,initialPlacement:n,placement:g,strategy:i,middlewareData:h,rects:u,platform:c,elements:{reference:e,floating:t}});a=x??a,f=y??f,h[p]={...h[p],...v},A&&d<$n&&(d++,typeof A=="object"&&(A.placement&&(g=A.placement),A.rects&&(u=A.rects===!0?await r.getElementRects({reference:e,floating:t,strategy:i}):A.rects),{x:a,y:f}=Ct(u,g,l)),m=-1)}return{x:a,y:f,placement:g,strategy:i,middlewareData:h}},In=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var o,n;const{placement:i,middlewareData:s,rects:r,initialPlacement:c,platform:l,elements:u}=t,{mainAxis:a=!0,crossAxis:f=!0,fallbackPlacements:g,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:m=!0,...b}=Q(e,t);if((o=s.arrow)!=null&&o.alignmentOffset)return{};const p=V(i),w=X(c),x=V(c)===c,y=await(l.isRTL==null?void 0:l.isRTL(u.floating)),v=g||(x||!m?[Pe(c)]:Tn(c)),A=h!=="none";!g&&A&&v.push(...Ln(c,m,h,y));const P=[c,...v],E=await l.detectOverflow(t,b),k=[];let D=((n=s.flip)==null?void 0:n.overflows)||[];if(a&&k.push(E[p]),f){const W=Pn(i,r,y);k.push(E[W[0]],E[W[1]])}if(D=[...D,{placement:i,overflows:k}],!k.every(W=>W<=0)){var F,S;const W=(((F=s.flip)==null?void 0:F.index)||0)+1,H=P[W];if(H&&(!(f==="alignment"?w!==X(H):!1)||D.every(O=>X(O.placement)===w?O.overflows[0]>0:!0)))return{data:{index:W,overflows:D},reset:{placement:H}};let $=(S=D.filter(L=>L.overflows[0]<=0).sort((L,O)=>L.overflows[1]-O.overflows[1])[0])==null?void 0:S.placement;if(!$)switch(d){case"bestFit":{var M;const L=(M=D.filter(O=>{if(A){const I=X(O.placement);return I===w||I==="y"}return!0}).map(O=>[O.placement,O.overflows.filter(I=>I>0).reduce((I,C)=>I+C,0)]).sort((O,I)=>O[1]-I[1])[0])==null?void 0:M[0];L&&($=L);break}case"initialPlacement":$=c;break}if(i!==$)return{reset:{placement:$}}}return{}}}};function Et(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Pt(e){return Cn.some(t=>e[t]>=0)}const Bn=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:o,platform:n}=t,{strategy:i="referenceHidden",...s}=Q(e,t);switch(i){case"referenceHidden":{const r=await n.detectOverflow(t,{...s,elementContext:"reference"}),c=Et(r,o.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:Pt(c)}}}case"escaped":{const r=await n.detectOverflow(t,{...s,altBoundary:!0}),c=Et(r,o.floating);return{data:{escapedOffsets:c,escaped:Pt(c)}}}default:return{}}}}},Vt=new Set(["left","top"]);async function Vn(e,t){const{placement:o,platform:n,elements:i}=e,s=await(n.isRTL==null?void 0:n.isRTL(i.floating)),r=V(o),c=te(o),l=X(o)==="y",u=Vt.has(r)?-1:1,a=s&&l?-1:1,f=Q(t,e);let{mainAxis:g,crossAxis:d,alignmentAxis:h}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&typeof h=="number"&&(d=c==="end"?h*-1:h),l?{x:d*a,y:g*u}:{x:g*u,y:d*a}}const _n=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var o,n;const{x:i,y:s,placement:r,middlewareData:c}=t,l=await Vn(t,e);return r===((o=c.offset)==null?void 0:o.placement)&&(n=c.arrow)!=null&&n.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:r}}}}},zn=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:o,y:n,placement:i,platform:s}=t,{mainAxis:r=!0,crossAxis:c=!1,limiter:l={fn:p=>{let{x:w,y:x}=p;return{x:w,y:x}}},...u}=Q(e,t),a={x:o,y:n},f=await s.detectOverflow(t,u),g=X(V(i)),d=Ge(g);let h=a[d],m=a[g];if(r){const p=d==="y"?"top":"left",w=d==="y"?"bottom":"right",x=h+f[p],y=h-f[w];h=Xe(x,h,y)}if(c){const p=g==="y"?"top":"left",w=g==="y"?"bottom":"right",x=m+f[p],y=m-f[w];m=Xe(x,m,y)}const b=l.fn({...t,[d]:h,[g]:m});return{...b,data:{x:b.x-o,y:b.y-n,enabled:{[d]:r,[g]:c}}}}}},Nn=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:o,y:n,placement:i,rects:s,middlewareData:r}=t,{offset:c=0,mainAxis:l=!0,crossAxis:u=!0}=Q(e,t),a={x:o,y:n},f=X(i),g=Ge(f);let d=a[g],h=a[f];const m=Q(c,t),b=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){const x=g==="y"?"height":"width",y=s.reference[g]-s.floating[x]+b.mainAxis,v=s.reference[g]+s.reference[x]-b.mainAxis;d<y?d=y:d>v&&(d=v)}if(u){var p,w;const x=g==="y"?"width":"height",y=Vt.has(V(i)),v=s.reference[f]-s.floating[x]+(y&&((p=r.offset)==null?void 0:p[f])||0)+(y?0:b.crossAxis),A=s.reference[f]+s.reference[x]+(y?0:((w=r.offset)==null?void 0:w[f])||0)-(y?b.crossAxis:0);h<v?h=v:h>A&&(h=A)}return{[g]:d,[f]:h}}}},Xn=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var o,n;const{placement:i,rects:s,platform:r,elements:c}=t,{apply:l=()=>{},...u}=Q(e,t),a=await r.detectOverflow(t,u),f=V(i),g=te(i),d=X(i)==="y",{width:h,height:m}=s.floating;let b,p;f==="top"||f==="bottom"?(b=f,p=g===(await(r.isRTL==null?void 0:r.isRTL(c.floating))?"start":"end")?"left":"right"):(p=f,b=g==="end"?"top":"bottom");const w=m-a.top-a.bottom,x=h-a.left-a.right,y=de(m-a[b],w),v=de(h-a[p],x),A=!t.middlewareData.shift;let P=y,E=v;if((o=t.middlewareData.shift)!=null&&o.enabled.x&&(E=x),(n=t.middlewareData.shift)!=null&&n.enabled.y&&(P=w),A&&!g){const D=z(a.left,0),F=z(a.right,0),S=z(a.top,0),M=z(a.bottom,0);d?E=h-2*(D!==0||F!==0?D+F:z(a.left,a.right)):P=m-2*(S!==0||M!==0?S+M:z(a.top,a.bottom))}await l({...t,availableWidth:E,availableHeight:P});const k=await r.getDimensions(c.floating);return h!==k.width||m!==k.height?{reset:{rects:!0}}:{}}}};function _t(e){const t=J(e);let o=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const i=se(e),s=i?e.offsetWidth:o,r=i?e.offsetHeight:n,c=Ee(o)!==s||Ee(n)!==r;return c&&(o=s,n=r),{width:o,height:n,$:c}}function Ze(e){return B(e)?e:e.contextElement}function ue(e){const t=Ze(e);if(!se(t))return q(1);const o=t.getBoundingClientRect(),{width:n,height:i,$:s}=_t(t);let r=(s?Ee(o.width):o.width)/n,c=(s?Ee(o.height):o.height)/i;return(!r||!Number.isFinite(r))&&(r=1),(!c||!Number.isFinite(c))&&(c=1),{x:r,y:c}}const Yn=q(0);function zt(e){const t=K(e);return!It()||!t.visualViewport?Yn:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function jn(e,t,o){return t===void 0&&(t=!1),!o||t&&o!==K(e)?!1:t}function ie(e,t,o,n){t===void 0&&(t=!1),o===void 0&&(o=!1);const i=e.getBoundingClientRect(),s=Ze(e);let r=q(1);t&&(n?B(n)&&(r=ue(n)):r=ue(e));const c=jn(s,o,n)?zt(s):q(0);let l=(i.left+c.x)/r.x,u=(i.top+c.y)/r.y,a=i.width/r.x,f=i.height/r.y;if(s){const g=K(s),d=n&&B(n)?K(n):n;let h=g,m=vt(h);for(;m&&n&&d!==h;){const b=ue(m),p=m.getBoundingClientRect(),w=J(m),x=p.left+(m.clientLeft+parseFloat(w.paddingLeft))*b.x,y=p.top+(m.clientTop+parseFloat(w.paddingTop))*b.y;l*=b.x,u*=b.y,a*=b.x,f*=b.y,l+=x,u+=y,h=K(m),m=vt(h)}}return Te({width:a,height:f,x:l,y:u})}function ke(e,t){const o=De(e).scrollLeft;return t?t.left+o:ie(Z(e)).left+o}function Nt(e,t){const o=e.getBoundingClientRect(),n=o.left+t.scrollLeft-ke(e,o),i=o.top+t.scrollTop;return{x:n,y:i}}function qn(e){let{elements:t,rect:o,offsetParent:n,strategy:i}=e;const s=i==="fixed",r=Z(n),c=t?je(t.floating):!1;if(n===r||c&&s)return o;let l={scrollLeft:0,scrollTop:0},u=q(1);const a=q(0),f=se(n);if((f||!f&&!s)&&((qe(n)!=="body"||Ue(r))&&(l=De(n)),f)){const d=ie(n);u=ue(n),a.x=d.x+n.clientLeft,a.y=d.y+n.clientTop}const g=r&&!f&&!s?Nt(r,l):q(0);return{width:o.width*u.x,height:o.height*u.y,x:o.x*u.x-l.scrollLeft*u.x+a.x+g.x,y:o.y*u.y-l.scrollTop*u.y+a.y+g.y}}function Un(e){return Array.from(e.getClientRects())}function Kn(e){const t=Z(e),o=De(e),n=e.ownerDocument.body,i=z(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),s=z(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let r=-o.scrollLeft+ke(e);const c=-o.scrollTop;return J(n).direction==="rtl"&&(r+=z(t.clientWidth,n.clientWidth)-i),{width:i,height:s,x:r,y:c}}const Tt=25;function Gn(e,t){const o=K(e),n=Z(e),i=o.visualViewport;let s=n.clientWidth,r=n.clientHeight,c=0,l=0;if(i){s=i.width,r=i.height;const a=It();(!a||a&&t==="fixed")&&(c=i.offsetLeft,l=i.offsetTop)}const u=ke(n);if(u<=0){const a=n.ownerDocument,f=a.body,g=getComputedStyle(f),d=a.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,h=Math.abs(n.clientWidth-f.clientWidth-d);h<=Tt&&(s-=h)}else u<=Tt&&(s+=u);return{width:s,height:r,x:c,y:l}}function Jn(e,t){const o=ie(e,!0,t==="fixed"),n=o.top+e.clientTop,i=o.left+e.clientLeft,s=se(e)?ue(e):q(1),r=e.clientWidth*s.x,c=e.clientHeight*s.y,l=i*s.x,u=n*s.y;return{width:r,height:c,x:l,y:u}}function Mt(e,t,o){let n;if(t==="viewport")n=Gn(e,o);else if(t==="document")n=Kn(Z(e));else if(B(t))n=Jn(t,o);else{const i=zt(e);n={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return Te(n)}function Xt(e,t){const o=pe(e);return o===t||!B(o)||Se(o)?!1:J(o).position==="fixed"||Xt(o,t)}function Qn(e,t){const o=t.get(e);if(o)return o;let n=Ne(e,[],!1).filter(c=>B(c)&&qe(c)!=="body"),i=null;const s=J(e).position==="fixed";let r=s?pe(e):e;for(;B(r)&&!Se(r);){const c=J(r),l=Ht(r);!l&&c.position==="fixed"&&(i=null),(s?!l&&!i:!l&&c.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||Ue(r)&&!l&&Xt(e,r))?n=n.filter(a=>a!==r):i=c,r=pe(r)}return t.set(e,n),n}function Zn(e){let{element:t,boundary:o,rootBoundary:n,strategy:i}=e;const r=[...o==="clippingAncestors"?je(t)?[]:Qn(t,this._c):[].concat(o),n],c=Mt(t,r[0],i);let l=c.top,u=c.right,a=c.bottom,f=c.left;for(let g=1;g<r.length;g++){const d=Mt(t,r[g],i);l=z(d.top,l),u=de(d.right,u),a=de(d.bottom,a),f=z(d.left,f)}return{width:u-f,height:a-l,x:f,y:l}}function eo(e){const{width:t,height:o}=_t(e);return{width:t,height:o}}function to(e,t,o){const n=se(t),i=Z(t),s=o==="fixed",r=ie(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const l=q(0);function u(){l.x=ke(i)}if(n||!n&&!s)if((qe(t)!=="body"||Ue(i))&&(c=De(t)),n){const d=ie(t,!0,s,t);l.x=d.x+t.clientLeft,l.y=d.y+t.clientTop}else i&&u();s&&!n&&i&&u();const a=i&&!n&&!s?Nt(i,c):q(0),f=r.left+c.scrollLeft-l.x-a.x,g=r.top+c.scrollTop-l.y-a.y;return{x:f,y:g,width:r.width,height:r.height}}function _e(e){return J(e).position==="static"}function Dt(e,t){if(!se(e)||J(e).position==="fixed")return null;if(t)return t(e);let o=e.offsetParent;return Z(e)===o&&(o=o.ownerDocument.body),o}function Yt(e,t){const o=K(e);if(je(e))return o;if(!se(e)){let i=pe(e);for(;i&&!Se(i);){if(B(i)&&!_e(i))return i;i=pe(i)}return o}let n=Dt(e,t);for(;n&&un(n)&&_e(n);)n=Dt(n,t);return n&&Se(n)&&_e(n)&&!Ht(n)?o:n||dn(e)||o}const no=async function(e){const t=this.getOffsetParent||Yt,o=this.getDimensions,n=await o(e.floating);return{reference:to(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function oo(e){return J(e).direction==="rtl"}const io={convertOffsetParentRelativeRectToViewportRelativeRect:qn,getDocumentElement:Z,getClippingRect:Zn,getOffsetParent:Yt,getElementRects:no,getClientRects:Un,getDimensions:eo,getScale:ue,isElement:B,isRTL:oo};function jt(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function so(e,t){let o=null,n;const i=Z(e);function s(){var c;clearTimeout(n),(c=o)==null||c.disconnect(),o=null}function r(c,l){c===void 0&&(c=!1),l===void 0&&(l=1),s();const u=e.getBoundingClientRect(),{left:a,top:f,width:g,height:d}=u;if(c||t(),!g||!d)return;const h=ve(f),m=ve(i.clientWidth-(a+g)),b=ve(i.clientHeight-(f+d)),p=ve(a),x={rootMargin:-h+"px "+-m+"px "+-b+"px "+-p+"px",threshold:z(0,de(1,l))||1};let y=!0;function v(A){const P=A[0].intersectionRatio;if(P!==l){if(!y)return r();P?r(!1,P):n=setTimeout(()=>{r(!1,1e-7)},1e3)}P===1&&!jt(u,e.getBoundingClientRect())&&r(),y=!1}try{o=new IntersectionObserver(v,{...x,root:i.ownerDocument})}catch{o=new IntersectionObserver(v,x)}o.observe(e)}return r(!0),s}function kt(e,t,o,n){n===void 0&&(n={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:r=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:l=!1}=n,u=Ze(e),a=i||s?[...u?Ne(u):[],...t?Ne(t):[]]:[];a.forEach(p=>{i&&p.addEventListener("scroll",o,{passive:!0}),s&&p.addEventListener("resize",o)});const f=u&&c?so(u,o):null;let g=-1,d=null;r&&(d=new ResizeObserver(p=>{let[w]=p;w&&w.target===u&&d&&t&&(d.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var x;(x=d)==null||x.observe(t)})),o()}),u&&!l&&d.observe(u),t&&d.observe(t));let h,m=l?ie(e):null;l&&b();function b(){const p=ie(e);m&&!jt(m,p)&&o(),m=p,h=requestAnimationFrame(b)}return o(),()=>{var p;a.forEach(w=>{i&&w.removeEventListener("scroll",o),s&&w.removeEventListener("resize",o)}),f?.(),(p=d)==null||p.disconnect(),d=null,l&&cancelAnimationFrame(h)}}const ro=_n,co=zn,lo=In,ao=Xn,fo=Bn,uo=Nn,go=(e,t,o)=>{const n=new Map,i={platform:io,...o},s={...i.platform,_c:n};return Hn(e,t,{...i,platform:s})};var mo=typeof document<"u",ho=function(){},Ae=mo?R.useLayoutEffect:ho;function Me(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let o,n,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(o=e.length,o!==t.length)return!1;for(n=o;n--!==0;)if(!Me(e[n],t[n]))return!1;return!0}if(i=Object.keys(e),o=i.length,o!==Object.keys(t).length)return!1;for(n=o;n--!==0;)if(!{}.hasOwnProperty.call(t,i[n]))return!1;for(n=o;n--!==0;){const s=i[n];if(!(s==="_owner"&&e.$$typeof)&&!Me(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function qt(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Lt(e,t){const o=qt(e);return Math.round(t*o)/o}function ze(e){const t=R.useRef(e);return Ae(()=>{t.current=e}),t}function po(e){e===void 0&&(e={});const{placement:t="bottom",strategy:o="absolute",middleware:n=[],platform:i,elements:{reference:s,floating:r}={},transform:c=!0,whileElementsMounted:l,open:u}=e,[a,f]=R.useState({x:0,y:0,strategy:o,placement:t,middlewareData:{},isPositioned:!1}),[g,d]=R.useState(n);Me(g,n)||d(n);const[h,m]=R.useState(null),[b,p]=R.useState(null),w=R.useCallback(O=>{O!==A.current&&(A.current=O,m(O))},[]),x=R.useCallback(O=>{O!==P.current&&(P.current=O,p(O))},[]),y=s||h,v=r||b,A=R.useRef(null),P=R.useRef(null),E=R.useRef(a),k=l!=null,D=ze(l),F=ze(i),S=ze(u),M=R.useCallback(()=>{if(!A.current||!P.current)return;const O={placement:t,strategy:o,middleware:g};F.current&&(O.platform=F.current),go(A.current,P.current,O).then(I=>{const C={...I,isPositioned:S.current!==!1};W.current&&!Me(E.current,C)&&(E.current=C,gn.flushSync(()=>{f(C)}))})},[g,t,o,F,S]);Ae(()=>{u===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,f(O=>({...O,isPositioned:!1})))},[u]);const W=R.useRef(!1);Ae(()=>(W.current=!0,()=>{W.current=!1}),[]),Ae(()=>{if(y&&(A.current=y),v&&(P.current=v),y&&v){if(D.current)return D.current(y,v,M);M()}},[y,v,M,D,k]);const H=R.useMemo(()=>({reference:A,floating:P,setReference:w,setFloating:x}),[w,x]),$=R.useMemo(()=>({reference:y,floating:v}),[y,v]),L=R.useMemo(()=>{const O={position:o,left:0,top:0};if(!$.floating)return O;const I=Lt($.floating,a.x),C=Lt($.floating,a.y);return c?{...O,transform:"translate("+I+"px, "+C+"px)",...qt($.floating)>=1.5&&{willChange:"transform"}}:{position:o,left:I,top:C}},[o,c,$.floating,a.x,a.y]);return R.useMemo(()=>({...a,update:M,refs:H,elements:$,floatingStyles:L}),[a,M,H,$,L])}const xo=(e,t)=>{const o=ro(e);return{name:o.name,fn:o.fn,options:[e,t]}},wo=(e,t)=>{const o=co(e);return{name:o.name,fn:o.fn,options:[e,t]}},yo=(e,t)=>({fn:uo(e).fn,options:[e,t]}),bo=(e,t)=>{const o=lo(e);return{name:o.name,fn:o.fn,options:[e,t]}},Ro=(e,t)=>{const o=ao(e);return{name:o.name,fn:o.fn,options:[e,t]}},vo=(e,t)=>{const o=fo(e);return{name:o.name,fn:o.fn,options:[e,t]}};function Ao(e){const{open:t=!1,onOpenChange:o,elements:n={}}=e,i=mn(),s=yn()!=null,r=hn(()=>new bn({open:t,transitionStatus:void 0,onOpenChange:o,referenceElement:n.reference??null,floatingElement:n.floating??null,triggerElements:new Rn,floatingId:i,syncOnly:!1,nested:s})).current;return G(()=>{const c={open:t,floatingId:i};n.reference!==void 0&&(c.referenceElement=n.reference,c.domReferenceElement=B(n.reference)?n.reference:null),n.floating!==void 0&&(c.floatingElement=n.floating),r.update(c)},[t,i,n.reference,n.floating,r]),r.context.onOpenChange=o,r.context.nested=s,r}function Oo(e={}){const{nodeId:t,externalTree:o}=e,n=Ao(e),i=e.rootContext||n,s=i.useState("referenceElement"),r=i.useState("floatingElement"),c=i.useState("domReferenceElement"),l=i.useState("open"),u=i.useState("floatingId"),[a,f]=R.useState(null),[g,d]=R.useState(void 0),[h,m]=R.useState(void 0),b=R.useRef(null),p=vn(o),w=R.useMemo(()=>({reference:s,floating:r,domReference:c}),[s,r,c]),x=po({...e,elements:{...w,...a&&{reference:a}}}),y=B(g)?g:null,v=h===void 0?i.state.floatingElement:h;i.useSyncedValue("referenceElement",g??null),i.useSyncedValue("domReferenceElement",g===void 0?c:y),i.useSyncedValue("floatingElement",v);const A=R.useCallback(S=>{const M=B(S)?{getBoundingClientRect:()=>S.getBoundingClientRect(),getClientRects:()=>S.getClientRects(),contextElement:S}:S;f(M),x.refs.setReference(M)},[x.refs]),P=R.useCallback(S=>{(B(S)||S===null)&&(b.current=S,d(S)),(B(x.refs.reference.current)||x.refs.reference.current===null||S!==null&&!B(S))&&x.refs.setReference(S)},[x.refs,d]),E=R.useCallback(S=>{m(S),x.refs.setFloating(S)},[x.refs]),k=R.useMemo(()=>({...x.refs,setReference:P,setFloating:E,setPositionReference:A,domReference:b}),[x.refs,P,E,A]),D=R.useMemo(()=>({...x.elements,domReference:c}),[x.elements,c]),F=R.useMemo(()=>({...x,dataRef:i.context.dataRef,open:l,onOpenChange:i.setOpen,events:i.context.events,floatingId:u,refs:k,elements:D,nodeId:t,rootStore:i}),[x,k,D,t,i,l,u]);return G(()=>{c&&(b.current=c)},[c]),G(()=>{i.context.dataRef.current.floatingContext=F;const S=p?.nodesRef.current.find(M=>M.id===t);S&&(S.context=F)}),R.useMemo(()=>({...x,context:F,refs:k,elements:D,rootStore:i}),[x,k,D,F,i])}const So=R.createContext(void 0);function Co(){return R.useContext(So)?.direction??"ltr"}const Eo=e=>({name:"arrow",options:e,async fn(t){const{x:o,y:n,placement:i,rects:s,platform:r,elements:c,middlewareData:l}=t,{element:u,padding:a=0,offsetParent:f="real"}=Q(e,t)||{};if(u==null)return{};const g=Bt(a),d={x:o,y:n},h=Qe(i),m=Je(h),b=await r.getDimensions(u),p=h==="y",w=p?"top":"left",x=p?"bottom":"right",y=p?"clientHeight":"clientWidth",v=s.reference[m]+s.reference[h]-d[h]-s.floating[m],A=d[h]-s.reference[h],P=f==="real"?await r.getOffsetParent?.(u):c.floating;let E=c.floating[y]||s.floating[m];(!E||!await r.isElement?.(P))&&(E=c.floating[y]||s.floating[m]);const k=v/2-A/2,D=E/2-b[m]/2-1,F=Math.min(g[w],D),S=Math.min(g[x],D),M=F,W=E-b[m]-S,H=E/2-b[m]/2+k,$=Xe(M,H,W),L=!l.arrow&&te(i)!=null&&H!==$&&s.reference[m]/2-(H<M?F:S)-b[m]/2<0,O=L?H<M?H-M:H-W:0;return{[h]:d[h]+O,data:{[h]:$,centerOffset:H-$-O,...L&&{alignmentOffset:O}},reset:L}}}),Po=(e,t)=>({...Eo(e),options:[e,t]}),To=vo().fn,Mo={name:"hide",async fn(e){const{width:t,height:o,x:n,y:i}=e.rects.reference,s=t===0&&o===0&&n===0&&i===0;return{data:{referenceHidden:(await To(e)).data?.referenceHidden||s}}}},Oe={sideX:"left",sideY:"top"},_o={name:"adaptiveOrigin",async fn(e){const{x:t,y:o,rects:{floating:n},elements:{floating:i},platform:s,strategy:r,placement:c}=e,l=K(i),u=l.getComputedStyle(i);if(!(u.transitionDuration!=="0s"&&u.transitionDuration!==""))return{x:t,y:o,data:Oe};const f=await s.getOffsetParent?.(i);let g={width:0,height:0};if(r==="fixed"&&l?.visualViewport)g={width:l.visualViewport.width,height:l.visualViewport.height};else if(f===l){const w=Ce(i);g={width:w.documentElement.clientWidth,height:w.documentElement.clientHeight}}else await s.isElement?.(f)&&(g=await s.getDimensions(f));const d=V(c);let h=t,m=o;d==="left"&&(h=g.width-(t+n.width)),d==="top"&&(m=g.height-(o+n.height));const b=d==="left"?"right":Oe.sideX,p=d==="top"?"bottom":Oe.sideY;return{x:h,y:m,data:{sideX:b,sideY:p}}}};function Ut(e,t,o){const n=e==="inline-start"||e==="inline-end";return{top:"top",right:n?o?"inline-start":"inline-end":"right",bottom:"bottom",left:n?o?"inline-end":"inline-start":"left"}[t]}function Ft(e,t,o){const{rects:n,placement:i}=e;return{side:Ut(t,V(i),o),align:te(i)||"center",anchor:{width:n.reference.width,height:n.reference.height},positioner:{width:n.floating.width,height:n.floating.height}}}function zo(e){const{anchor:t,positionMethod:o="absolute",side:n="bottom",sideOffset:i=0,align:s="center",alignOffset:r=0,collisionBoundary:c,collisionPadding:l=5,sticky:u=!1,arrowPadding:a=5,disableAnchorTracking:f=!1,inline:g,keepMounted:d=!1,floatingRootContext:h,mounted:m,collisionAvoidance:b,shiftCrossAxis:p=!1,nodeId:w,adaptiveOrigin:x,lazyFlip:y=!1,externalTree:v}=e,[A,P]=R.useState(null);!m&&A!==null&&P(null);const E=b.side||"flip",k=b.align||"flip",D=b.fallbackAxisSide||"end",F=typeof t=="function"?t:void 0,S=Ke(F),M=F?S:t,W=Re(t),H=Re(m),L=Co()==="rtl",O=A||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":L?"left":"right","inline-start":L?"right":"left"}[n],I=s==="center"?O:`${O}-${s}`;let C=l;const ee=1,et=n==="bottom"?ee:0,tt=n==="top"?ee:0,nt=n==="right"?ee:0,ot=n==="left"?ee:0;typeof C=="number"?C={top:C+et,right:C+ot,bottom:C+tt,left:C+nt}:C&&(C={top:(C.top||0)+et,right:(C.right||0)+ot,bottom:(C.bottom||0)+tt,left:(C.left||0)+nt});const xe={boundary:c==="clipping-ancestors"?"clippingAncestors":c,padding:C},re=R.useRef(null),Le=Re(i),Fe=Re(r),Kt=typeof i!="function"?i:0,Gt=typeof r!="function"?r:0,ce=[];g&&ce.push(g),ce.push(xo(T=>{const _=Ft(T,n,L),j=typeof Le.current=="function"?Le.current(_):Le.current,N=typeof Fe.current=="function"?Fe.current(_):Fe.current;return{mainAxis:j,crossAxis:N,alignmentAxis:N}},[Kt,Gt,L,n]));const it=k==="none"&&E!=="shift",st=!it&&(u||p||E==="shift"),rt=E==="none"?null:bo({...xe,padding:{top:C.top+ee,right:C.right+ee,bottom:C.bottom+ee,left:C.left+ee},mainAxis:!p&&E==="flip",crossAxis:k==="flip"?"alignment":!1,fallbackAxisSideDirection:D}),ct=it?null:wo(T=>{const _=Ce(T.elements.floating).documentElement;return{...xe,rootBoundary:p?{x:0,y:0,width:_.clientWidth,height:_.clientHeight}:void 0,mainAxis:k!=="none",crossAxis:st,limiter:u||p?void 0:yo(j=>{if(!re.current)return{};const{width:N,height:U}=re.current.getBoundingClientRect(),Y=X(V(j.placement)),oe=Y==="y"?N:U,fe=Y==="y"?C.left+C.right:C.top+C.bottom;return{offset:oe/2+fe/2}})}},[xe,u,p,C,k]);E==="shift"||k==="shift"||s==="center"?ce.push(ct,rt):ce.push(rt,ct),ce.push(Ro({...xe,apply({elements:{floating:T},availableWidth:_,availableHeight:j,rects:N}){if(!H.current)return;const U=T.style;U.setProperty("--available-width",`${_}px`),U.setProperty("--available-height",`${j}px`);const Y=K(T).devicePixelRatio||1,{x:oe,y:fe,width:be,height:He}=N.reference,Ie=(Math.round((oe+be)*Y)-Math.round(oe*Y))/Y,Be=(Math.round((fe+He)*Y)-Math.round(fe*Y))/Y;U.setProperty("--anchor-width",`${Ie}px`),U.setProperty("--anchor-height",`${Be}px`)}}),Po(T=>({element:re.current||Ce(T.elements.floating).createElement("div"),padding:a,offsetParent:"floating"}),[a]),{name:"transformOrigin",fn(T){const{elements:_,middlewareData:j,placement:N,rects:U,y:Y}=T,oe=V(N),fe=X(oe),be=re.current,He=j.arrow?.x||0,Ie=j.arrow?.y||0,Be=be?.clientWidth||0,Jt=be?.clientHeight||0,Ve=He+Be/2,Rt=Ie+Jt/2,Qt=Math.abs(j.shift?.y||0),Zt=U.reference.height/2,he=typeof i=="function"?i(Ft(T,n,L)):i,en=Qt>he,tn={top:`${Ve}px calc(100% + ${he}px)`,bottom:`${Ve}px ${-he}px`,left:`calc(100% + ${he}px) ${Rt}px`,right:`${-he}px ${Rt}px`}[oe],nn=`${Ve}px ${U.reference.y+Zt-Y}px`;return _.floating.style.setProperty("--transform-origin",st&&fe==="y"&&en?nn:tn),{}}},Mo,x),G(()=>{!m&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[m,h]);const We=R.useMemo(()=>({elementResize:!f&&typeof ResizeObserver<"u",layoutShift:!f&&typeof IntersectionObserver<"u"}),[f]),{refs:le,elements:ge,x:lt,y:at,middlewareData:ae,update:we,placement:ft,context:ut,isPositioned:ne,floatingStyles:dt}=Oo({rootContext:h,open:d?m:void 0,placement:I,middleware:ce,strategy:o,whileElementsMounted:d?void 0:(...T)=>kt(...T,We),nodeId:w,externalTree:v}),{sideX:gt,sideY:mt}=ae.adaptiveOrigin||Oe,$e=ne?o:"fixed",ht=R.useMemo(()=>{const T=x?{position:$e,[gt]:lt,[mt]:at}:{position:$e,...dt};return ne||(T.opacity=0),T},[x,$e,gt,lt,mt,at,dt,ne]),ye=R.useRef(null);G(()=>{if(!m)return;const T=W.current,_=typeof T=="function"?T():T,N=(Wt(_)?_.current:_)||null||null;N!==ye.current&&(le.setPositionReference(N),ye.current=N)},[m,le,M,W]),R.useEffect(()=>{if(!m)return;const T=W.current;typeof T!="function"&&Wt(T)&&T.current!==ye.current&&(le.setPositionReference(T.current),ye.current=T.current)},[m,le,M,W]),R.useEffect(()=>{if(d&&m&&ge.reference&&ge.floating)return kt(ge.reference,ge.floating,we,We)},[d,m,ge,we,We]);const me=V(ft),pt=Ut(n,me,L),xt=te(ft)||"center",wt=!!ae.hide?.referenceHidden;G(()=>{y&&m&&ne&&P(me)},[y,m,ne,me]);const yt=R.useMemo(()=>({position:"absolute",top:ae.arrow?.y,left:ae.arrow?.x}),[ae.arrow]),bt=ae.arrow?.centerOffset!==0;return R.useMemo(()=>({positionerStyles:ht,arrowStyles:yt,arrowRef:re,arrowUncentered:bt,side:pt,align:xt,physicalSide:me,anchorHidden:wt,refs:le,context:ut,isPositioned:ne,update:we}),[ht,yt,re,bt,pt,xt,me,wt,le,ut,ne,we])}function Wt(e){return e!=null&&"current"in e}function Do(e){return e==="starting"?pn:$t}function No(e,t,{styles:o,transitionStatus:n,props:i,refs:s,hidden:r,inert:c=!1}){const l={...o};return c&&(l.pointerEvents="none"),xn("div",e,{state:t,ref:s,props:[{role:"presentation",hidden:r,style:l},Do(n),i],stateAttributesMapping:An})}function ko(e){const t=R.useRef(""),o=R.useCallback(i=>{i.defaultPrevented||(t.current=i.pointerType,e(i,i.pointerType))},[e]);return{onClick:R.useCallback(i=>{if(i.detail===0){e(i,"keyboard");return}"pointerType"in i?e(i,i.pointerType):e(i,t.current),t.current=""},[e]),onPointerDown:o}}function Lo(e,t){const o=R.useRef(e),n=Ke(t);G(()=>{o.current!==e&&n(o.current)},[e,n]),G(()=>{o.current=e},[e])}function Fo(e,t){const o=Ke((s,r)=>{(typeof e=="function"?e():e)||t(r||(wn?"touch":""))}),{onClick:n,onPointerDown:i}=ko(o);return R.useMemo(()=>({onClick:n,onPointerDown:i}),[n,i])}function Xo(e){const[t,o]=R.useState(null),n=Fo(e,o);return Lo(e,i=>{i&&!e&&o(null)}),R.useMemo(()=>({openMethod:t,triggerProps:n}),[t,n])}const Wo=20;function Yo(e,t,o,n){const[i,s]=R.useState(!1);G(()=>{if(!e||!t||o==null){s(!1);return}const r=Ce(o).documentElement.clientWidth,c=o.offsetWidth;s(r>0&&c>0&&c>=r-Wo)},[e,t,o]),On(e&&(!t||i),n)}const $o=R.createContext(void 0);function jo(e){return R.useContext($o)}export{Bo as C,Vo as a,Fo as b,zo as c,Yo as d,No as e,_o as f,jo as g,Do as h,Xo as i,Ao as j,Co as k,io as p,Te as r,Lo as u};
import{l as a}from"./__vite-browser-external-CuMc3dqk.js";const t=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],o=a("trash-2",t);export{o as T};

Sorry, the diff of this file is too big to display

import{r as p,g as N,b as M}from"./__vite-browser-external-CuMc3dqk.js";const D=6e3,S=2500,E=100;function h(t,r){let o;const n=new Promise((a,i)=>{o=setTimeout(()=>i(new Error("landing stats timeout")),r)});return Promise.race([t,n]).finally(()=>{o!=null&&clearTimeout(o)})}const A=5*6e4,P=1440*6e4,k="tokentracker:community-stats:v2";let s=null;function C(t){const r=Number(t?.tokenFloor)||0,o=Number(t?.totalEntries)||0;return!(r>0)||!(o>0)?null:{tokenFloor:r,totalEntries:o,top:Array.isArray(t?.top)?t.top:[],topModels:Array.isArray(t?.topModels)?t.topModels:[],providers:Array.isArray(t?.providers)?t.providers:[],dailyGrowth:Array.isArray(t?.dailyGrowth)?t.dailyGrowth:[],tokenMix:Array.isArray(t?.tokenMix)?t.tokenMix:[],userDistribution:Array.isArray(t?.userDistribution)?t.userDistribution:[],platforms:Array.isArray(t?.platforms)?t.platforms:[],activeDevelopersTotal:Number(t?.activeDevelopersTotal)||0,activeDevelopers30d:Number(t?.activeDevelopers30d)||0,tokens30d:Number(t?.tokens30d)||0,tokenGrowthPct:t?.tokenGrowthPct!=null&&Number.isFinite(Number(t.tokenGrowthPct))?Number(t.tokenGrowthPct):null,developerGrowthPct:t?.developerGrowthPct!=null&&Number.isFinite(Number(t.developerGrowthPct))?Number(t.developerGrowthPct):null,generatedAt:typeof t?.generatedAt=="string"?t.generatedAt:null}}function G(){if(typeof window>"u"||!window.localStorage)return null;try{const t=JSON.parse(window.localStorage.getItem(k)||"null"),r=Number(t?.cachedAt)||0,o=C(t?.data),n=Date.now()-r;return!o||n<0||n>P?null:{data:o,isFresh:n<A}}catch{return null}}function I(t){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(k,JSON.stringify({cachedAt:Date.now(),data:t}))}catch{}}function F(){if(s&&Date.now()-s.at<A)return s.promise;const t=Promise.all([h(N({period:"total",limit:E,offset:0}),D),h(M(),S).catch(()=>null)]);return s={at:Date.now(),promise:t},t.catch(()=>{s?.promise===t&&(s=null)}),t}function O({enabled:t=!0}={}){const[r]=p.useState(()=>G()),[o,n]=p.useState(()=>r?{status:"ready",...r.data}:{status:"loading",tokenFloor:null,totalEntries:null,top:[]});return p.useEffect(()=>{if(!t||r?.isFresh)return;let a=!1,i=null,u=null;const y=async()=>{try{const[l,e]=await F();if(a)return;const c=Array.isArray(l?.entries)?l.entries:[],b=c.reduce((m,T)=>m+(Number(T?.total_tokens)||0),0),d=Number(e?.total_tokens)||0;d>0||(s=null);const w=Number(r?.data?.tokenFloor)||0,f=d>0?d:w>0?w:b;if(!c.length||!(f>0)){n(m=>({...m,status:"error"}));return}const g=Array.isArray(e?.top_models)?e.top_models:r?.data?.topModels||[],_={tokenFloor:f,totalEntries:Number(l?.total_entries)||c.length,top:c.slice(0,3),topModels:g,providers:Array.isArray(e?.providers)?e.providers:[],dailyGrowth:Array.isArray(e?.daily_growth)?e.daily_growth:[],tokenMix:Array.isArray(e?.token_mix)?e.token_mix:[],userDistribution:Array.isArray(e?.user_distribution)?e.user_distribution:[],platforms:Array.isArray(e?.platforms)?e.platforms:[],activeDevelopersTotal:Number(e?.active_developers_total)||0,activeDevelopers30d:Number(e?.active_developers_30d)||0,tokens30d:Number(e?.tokens_30d)||0,tokenGrowthPct:e?.token_growth_pct==null?null:Number(e.token_growth_pct),developerGrowthPct:e?.developer_growth_pct==null?null:Number(e.developer_growth_pct),generatedAt:typeof e?.generated_at=="string"?e.generated_at:null};n({status:"ready",..._}),d>0&&I(_)}catch{a||n(e=>e.status==="ready"?e:{...e,status:"error"})}};return typeof window<"u"&&"requestIdleCallback"in window?i=window.requestIdleCallback(y,{timeout:1500}):u=setTimeout(y,400),()=>{a=!0,i!=null&&typeof window.cancelIdleCallback=="function"&&window.cancelIdleCallback(i),u!=null&&clearTimeout(u)}},[t,r]),o}export{O as u};
import{r as a,p as D,q as K,t as j,v as J}from"./__vite-browser-external-CuMc3dqk.js";import{L as q}from"./limits-providers-CMQJD3FZ.js";const p=q,g="tt.limits.providerOrder",E="tt.limits.providerVisibility",h="tt.limits.displayMode",O="tt.limits.updatedAt",M="limitsPreferences",B="limitsDisplayMode",w=Object.freeze({USED:"used",REMAINING:"remaining"}),v=new Set(Object.values(w)),L=new Set([g,E,h,O]);function A(){return[...p]}function b(){return Object.fromEntries(p.map(e=>[e,!0]))}function _(e){const t=[];if(Array.isArray(e))for(const n of e)p.includes(n)&&!t.includes(n)&&t.push(n);for(const n of p)t.includes(n)||t.push(n);return t}function N(e){const t=b();if(!e||typeof e!="object"||Array.isArray(e))return t;for(const n of p)typeof e[n]=="boolean"&&(t[n]=e[n]);return t}function G(e){return v.has(e)?e:w.USED}function y(e){if(e!=null){if(typeof e=="number")return Number.isSafeInteger(e)?e:void 0;if(typeof e=="string"){const t=e.trim();if(t==="")return;const n=Number(t);return Number.isSafeInteger(n)?n:void 0}}}function m(e={}){const t=e&&typeof e=="object"?e:{};return{displayMode:G(t.displayMode),providerOrder:_(t.providerOrder),providerVisibility:N(t.providerVisibility),updatedAt:y(t.updatedAt)}}function F(){if(typeof window>"u")return A();try{const e=window.localStorage.getItem(g);return _(e?JSON.parse(e):void 0)}catch{return A()}}function H(){if(typeof window>"u")return b();try{const e=window.localStorage.getItem(E);return N(e?JSON.parse(e):void 0)}catch{return b()}}function Q(){if(typeof window>"u")return w.USED;try{const e=window.localStorage.getItem(h);return v.has(e)?e:w.USED}catch{return w.USED}}function W(){if(!(typeof window>"u"))try{return y(window.localStorage.getItem(O))}catch{return}}function X(){if(typeof window>"u")return!1;try{for(const e of L)if(window.localStorage.getItem(e)!==null)return!0}catch{return!1}return!1}function S(){return m({displayMode:Q(),providerOrder:F(),providerVisibility:H(),updatedAt:W()})}function Z(e){if(typeof window>"u")return;const t=m(e);try{window.localStorage.setItem(g,JSON.stringify(t.providerOrder)),window.localStorage.setItem(E,JSON.stringify(t.providerVisibility)),window.localStorage.setItem(h,t.displayMode),t.updatedAt===void 0?window.localStorage.removeItem(O):window.localStorage.setItem(O,String(t.updatedAt))}catch(n){console.warn("[tokentracker] limits preferences localStorage write failed:",n)}}function $(e){const t=m(e);return{displayMode:t.displayMode,providerOrder:[...t.providerOrder],providerVisibility:{...t.providerVisibility},updatedAt:t.updatedAt??null}}function ee(...e){let t;for(const s of e){const c=y(s);c!==void 0&&(t=t===void 0?c:Math.max(t,c))}const n=Date.now();return t!==void 0&&n<=t?t+1:n}function te(e,t){return e.length===t.length&&e.every((n,s)=>n===t[s])}function re(e,t){return p.every(n=>e[n]===t[n])}function k(e,t){return e.displayMode===t.displayMode&&te(e.providerOrder,t.providerOrder)&&re(e.providerVisibility,t.providerVisibility)}function ie(e,t){return k(e,t)&&y(e.updatedAt)===y(t.updatedAt)}function V(e,t){const n=y(e.updatedAt),s=y(t.updatedAt);return n!==void 0&&(s===void 0||n>s)}function de(){const[e,t]=a.useState(S),n=a.useRef(e),s=a.useCallback((o,r={})=>{const i=m(o);return n.current=i,t(i),r.writeLocal&&Z(i),i},[]),c=a.useCallback(o=>{D()&&K(M,$(o))},[]),u=a.useCallback(o=>{const r=S(),i=V(r,n.current)?s(r):n.current,d=m(o(i));if(k(i,d))return;const f=ee(r.updatedAt,i.updatedAt),l=s({...d,updatedAt:f},{writeLocal:!0});c(l)},[s,c]),P=a.useCallback(o=>{v.has(o)&&u(r=>({...r,displayMode:o}))},[u]),I=a.useCallback(o=>{if(!v.has(o))return;const r=S();if(r.updatedAt!==void 0){s(r);return}s({...r,displayMode:o,updatedAt:void 0},{writeLocal:!0})},[s]);a.useEffect(()=>{if(!D())return;const o=j(r=>{const i=r?.[M];if(i&&typeof i=="object"){const d=m(i);if(!X()){s(d,{writeLocal:!0});return}const f=S();if(V(d,f))s(d,{writeLocal:!0});else{const l=s(f);ie(d,f)||c(l)}return}I(r?.[B])});return J(),o},[I,s,c]),a.useEffect(()=>{if(typeof window>"u")return;const o=r=>{(r.key===null||L.has(r.key))&&s(S())};return window.addEventListener("storage",o),()=>window.removeEventListener("storage",o)},[s]);const U=a.useCallback(o=>{p.includes(o)&&u(r=>({...r,providerVisibility:{...r.providerVisibility,[o]:!r.providerVisibility[o]}}))},[u]),x=a.useCallback(o=>{u(r=>{const i=r.providerOrder.indexOf(o);if(i<=0)return r;const d=[...r.providerOrder];return[d[i-1],d[i]]=[d[i],d[i-1]],{...r,providerOrder:d}})},[u]),C=a.useCallback(o=>{u(r=>{const i=r.providerOrder.indexOf(o);if(i<0||i>=r.providerOrder.length-1)return r;const d=[...r.providerOrder];return[d[i],d[i+1]]=[d[i+1],d[i]],{...r,providerOrder:d}})},[u]),R=a.useCallback((o,r)=>{o!==r&&u(i=>{const d=i.providerOrder.indexOf(o),f=i.providerOrder.indexOf(r);if(d<0||f<0)return i;const l=[...i.providerOrder],[z]=l.splice(d,1);return l.splice(f,0,z),{...i,providerOrder:l}})},[u]),Y=a.useCallback(()=>{u(()=>({displayMode:w.USED,providerOrder:A(),providerVisibility:b()}))},[u]),T=a.useMemo(()=>e.providerOrder.filter(o=>e.providerVisibility[o]!==!1),[e.providerOrder,e.providerVisibility]);return{order:e.providerOrder,visibility:e.providerVisibility,displayMode:e.displayMode,setDisplayMode:P,visibleOrdered:T,toggle:U,moveUp:x,moveDown:C,moveToward:R,reset:Y}}export{w as L,de as u};
import{j as a,d as x,r as o,Q as m,S as g,t as b,v as u,q as f,M as h}from"./__vite-browser-external-CuMc3dqk.js";import{C as y}from"./Card-C3Fxl-vL.js";function j({checked:t,onChange:s,disabled:e,ariaLabel:r}){return a.jsx("button",{type:"button",role:"switch","aria-checked":t,"aria-label":r,onClick:s,disabled:e,className:x("relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 disabled:opacity-50 disabled:cursor-not-allowed",t?"bg-oai-brand-500":"bg-oai-gray-300 dark:bg-oai-gray-700"),children:a.jsx("span",{className:x("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",t?"translate-x-[18px]":"translate-x-[3px]")})})}function k({label:t,hint:s,control:e}){return a.jsxs("div",{className:"flex flex-col gap-2 py-3 sm:flex-row sm:items-center sm:justify-between sm:gap-4",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:t}),s?a.jsx("div",{className:"mt-0.5 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:s}):null]}),a.jsx("div",{className:"self-end sm:shrink-0 sm:self-auto",children:e})]})}function N({title:t,subtitle:s,action:e,children:r}){return a.jsxs(y,{className:"rounded-lg",children:[a.jsxs("div",{className:"mb-3 flex items-start justify-between gap-4",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("h2",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:t}),s?a.jsx("p",{className:"mt-1 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:s}):null]}),e?a.jsx("div",{className:"shrink-0",children:e}):null]}),a.jsx("div",{className:"-mb-3 divide-y divide-oai-gray-200/60 dark:divide-oai-gray-800/60",children:r})]})}function w({options:t,value:s,onChange:e,disabled:r=!1}){return a.jsx("div",{className:"inline-flex items-center rounded-lg border border-oai-gray-200 bg-oai-gray-50 p-0.5 dark:border-oai-gray-800 dark:bg-oai-gray-900",children:t.map(({value:l,label:d,Icon:i})=>{const n=s===l;return a.jsxs("button",{type:"button",onClick:()=>e(l),"aria-pressed":n,disabled:r,className:x("inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50",n?"bg-white text-oai-black shadow-sm dark:bg-oai-gray-800 dark:text-white":"text-oai-gray-500 hover:text-oai-black dark:text-oai-gray-400 dark:hover:text-white"),children:[i?a.jsx(i,{className:"h-3.5 w-3.5","aria-hidden":!0}):null,a.jsx("span",{children:d})]},l)})})}function S(){const[t,s]=o.useState(null),e=m()&&g();o.useEffect(()=>{if(!e)return;const i=b(n=>s(n));return u(),i},[e]);const r=o.useCallback((i,n)=>{e&&(s(c=>c&&{...c,[i]:n}),f(i,n))},[e]),l=o.useCallback(i=>{e&&h(i)},[e]),d=o.useCallback(()=>{e&&u()},[e]);return{available:e,settings:t,setSetting:r,runAction:l,refresh:d}}export{w as S,j as T,N as a,k as b,S as u};
import{r as c,R as P,a1 as Oe}from"./__vite-browser-external-CuMc3dqk.js";function In(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return c.useMemo(()=>r=>{t.forEach(o=>o(r))},t)}const tt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function me(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function wt(e){return"nodeType"in e}function B(e){var t,n;return e?me(e)?e:wt(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function mt(e){const{Document:t}=B(e);return e instanceof t}function Be(e){return me(e)?!1:e instanceof B(e).HTMLElement}function Vt(e){return e instanceof B(e).SVGElement}function ye(e){return e?me(e)?e.document:wt(e)?mt(e)?e:Be(e)||Vt(e)?e.ownerDocument:document:document:document}const Q=tt?c.useLayoutEffect:c.useEffect;function yt(e){const t=c.useRef(e);return Q(()=>{t.current=e}),c.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function Mn(){const e=c.useRef(null),t=c.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=c.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function ke(e,t){t===void 0&&(t=[e]);const n=c.useRef(e);return Q(()=>{n.current!==e&&(n.current=e)},t),n}function Fe(e,t){const n=c.useRef();return c.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Ke(e){const t=yt(e),n=c.useRef(null),r=c.useCallback(o=>{o!==n.current&&t?.(o,n.current),n.current=o},[]);return[n,r]}function ht(e){const t=c.useRef();return c.useEffect(()=>{t.current=e},[e]),t.current}let ct={};function $e(e,t){return c.useMemo(()=>{if(t)return t;const n=ct[e]==null?0:ct[e]+1;return ct[e]=n,e+"-"+n},[e,t])}function qt(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((i,a)=>{const s=Object.entries(a);for(const[l,u]of s){const f=i[l];f!=null&&(i[l]=f+e*u)}return i},{...t})}}const we=qt(1),ze=qt(-1);function An(e){return"clientX"in e&&"clientY"in e}function xt(e){if(!e)return!1;const{KeyboardEvent:t}=B(e.target);return t&&e instanceof t}function On(e){if(!e)return!1;const{TouchEvent:t}=B(e.target);return t&&e instanceof t}function gt(e){if(On(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return An(e)?{x:e.clientX,y:e.clientY}:null}const _e=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[_e.Translate.toString(e),_e.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),Nt="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Tn(e){return e.matches(Nt)?e:e.querySelector(Nt)}const Nn={display:"none"};function Ln(e){let{id:t,value:n}=e;return P.createElement("div",{id:t,style:Nn},n)}function kn(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return P.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function zn(){const[e,t]=c.useState("");return{announce:c.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const Gt=c.createContext(null);function Pn(e){const t=c.useContext(Gt);c.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Bn(){const[e]=c.useState(()=>new Set),t=c.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[c.useCallback(r=>{let{type:o,event:i}=r;e.forEach(a=>{var s;return(s=a[o])==null?void 0:s.call(a,i)})},[e]),t]}const Fn={draggable:`
To pick up a draggable item, press the space bar.
While dragging, use the arrow keys to move the item.
Press space again to drop the item in its new position, or press escape to cancel.
`},$n={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Xn(e){let{announcements:t=$n,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=Fn}=e;const{announce:i,announcement:a}=zn(),s=$e("DndLiveRegion"),[l,u]=c.useState(!1);if(c.useEffect(()=>{u(!0)},[]),Pn(c.useMemo(()=>({onDragStart(d){let{active:h}=d;i(t.onDragStart({active:h}))},onDragMove(d){let{active:h,over:g}=d;t.onDragMove&&i(t.onDragMove({active:h,over:g}))},onDragOver(d){let{active:h,over:g}=d;i(t.onDragOver({active:h,over:g}))},onDragEnd(d){let{active:h,over:g}=d;i(t.onDragEnd({active:h,over:g}))},onDragCancel(d){let{active:h,over:g}=d;i(t.onDragCancel({active:h,over:g}))}}),[i,t])),!l)return null;const f=P.createElement(P.Fragment,null,P.createElement(Ln,{id:r,value:o.draggable}),P.createElement(kn,{id:s,announcement:a}));return n?Oe.createPortal(f,n):f}var O;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(O||(O={}));function Qe(){}function uo(e,t){return c.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function fo(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return c.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const q=Object.freeze({x:0,y:0});function Jt(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Kt(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Yn(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Lt(e){let{left:t,top:n,height:r,width:o}=e;return[{x:t,y:n},{x:t+o,y:n},{x:t,y:n+r},{x:t+o,y:n+r}]}function _t(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function kt(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const ho=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=kt(t,t.left,t.top),i=[];for(const a of r){const{id:s}=a,l=n.get(s);if(l){const u=Jt(kt(l),o);i.push({id:s,data:{droppableContainer:a,value:u}})}}return i.sort(Kt)},jn=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=Lt(t),i=[];for(const a of r){const{id:s}=a,l=n.get(s);if(l){const u=Lt(l),f=o.reduce((h,g,C)=>h+Jt(u[C],g),0),d=Number((f/4).toFixed(4));i.push({id:s,data:{droppableContainer:a,value:d}})}}return i.sort(Kt)};function Un(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),a=o-r,s=i-n;if(r<o&&n<i){const l=t.width*t.height,u=e.width*e.height,f=a*s,d=f/(l+u-f);return Number(d.toFixed(4))}return 0}const Wn=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const i of r){const{id:a}=i,s=n.get(a);if(s){const l=Un(s,t);l>0&&o.push({id:a,data:{droppableContainer:i,value:l}})}}return o.sort(Yn)};function Hn(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Qt(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:q}function Vn(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return o.reduce((a,s)=>({...a,top:a.top+e*s.y,bottom:a.bottom+e*s.y,left:a.left+e*s.x,right:a.right+e*s.x}),{...n})}}const qn=Vn(1);function Gn(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function Jn(e,t,n){const r=Gn(t);if(!r)return e;const{scaleX:o,scaleY:i,x:a,y:s}=r,l=e.left-a-(1-o)*parseFloat(n),u=e.top-s-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),f=o?e.width/o:e.width,d=i?e.height/i:e.height;return{width:f,height:d,top:u,right:l+f,bottom:u+d,left:l}}const Kn={ignoreTransform:!1};function xe(e,t){t===void 0&&(t=Kn);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:f}=B(e).getComputedStyle(e);u&&(n=Jn(n,u,f))}const{top:r,left:o,width:i,height:a,bottom:s,right:l}=n;return{top:r,left:o,width:i,height:a,bottom:s,right:l}}function zt(e){return xe(e,{ignoreTransform:!0})}function _n(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Qn(e,t){return t===void 0&&(t=B(e).getComputedStyle(e)),t.position==="fixed"}function Zn(e,t){t===void 0&&(t=B(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const i=t[o];return typeof i=="string"?n.test(i):!1})}function nt(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(mt(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Be(o)||Vt(o)||n.includes(o))return n;const i=B(e).getComputedStyle(o);return o!==e&&Zn(o,i)&&n.push(o),Qn(o,i)?n:r(o.parentNode)}return e?r(e):n}function Zt(e){const[t]=nt(e,1);return t??null}function lt(e){return!tt||!e?null:me(e)?e:wt(e)?mt(e)||e===ye(e).scrollingElement?window:Be(e)?e:null:null}function en(e){return me(e)?e.scrollX:e.scrollLeft}function tn(e){return me(e)?e.scrollY:e.scrollTop}function vt(e){return{x:en(e),y:tn(e)}}var N;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(N||(N={}));function nn(e){return!tt||!e?!1:e===document.scrollingElement}function rn(e){const t={x:0,y:0},n=nn(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,a=e.scrollTop>=r.y,s=e.scrollLeft>=r.x;return{isTop:o,isLeft:i,isBottom:a,isRight:s,maxScroll:r,minScroll:t}}const er={x:.2,y:.2};function tr(e,t,n,r,o){let{top:i,left:a,right:s,bottom:l}=n;r===void 0&&(r=10),o===void 0&&(o=er);const{isTop:u,isBottom:f,isLeft:d,isRight:h}=rn(e),g={x:0,y:0},C={x:0,y:0},v={height:t.height*o.y,width:t.width*o.x};return!u&&i<=t.top+v.height?(g.y=N.Backward,C.y=r*Math.abs((t.top+v.height-i)/v.height)):!f&&l>=t.bottom-v.height&&(g.y=N.Forward,C.y=r*Math.abs((t.bottom-v.height-l)/v.height)),!h&&s>=t.right-v.width?(g.x=N.Forward,C.x=r*Math.abs((t.right-v.width-s)/v.width)):!d&&a<=t.left+v.width&&(g.x=N.Backward,C.x=r*Math.abs((t.left+v.width-a)/v.width)),{direction:g,speed:C}}function nr(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:a}=window;return{top:0,left:0,right:i,bottom:a,width:i,height:a}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function on(e){return e.reduce((t,n)=>we(t,vt(n)),q)}function rr(e){return e.reduce((t,n)=>t+en(n),0)}function or(e){return e.reduce((t,n)=>t+tn(n),0)}function ir(e,t){if(t===void 0&&(t=xe),!e)return;const{top:n,left:r,bottom:o,right:i}=t(e);Zt(e)&&(o<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const sr=[["x",["left","right"],rr],["y",["top","bottom"],or]];class Dt{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=nt(n),o=on(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,a,s]of sr)for(const l of a)Object.defineProperty(this,l,{get:()=>{const u=s(r),f=o[i]-u;return this.rect[l]+f},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Te{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function ar(e){const{EventTarget:t}=B(e);return e instanceof t?e:ye(e)}function ut(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var W;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(W||(W={}));function Pt(e){e.preventDefault()}function cr(e){e.stopPropagation()}var w;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(w||(w={}));const sn={start:[w.Space,w.Enter],cancel:[w.Esc],end:[w.Space,w.Enter,w.Tab]},lr=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case w.Right:return{...n,x:n.x+25};case w.Left:return{...n,x:n.x-25};case w.Down:return{...n,y:n.y+25};case w.Up:return{...n,y:n.y-25}}};class an{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Te(ye(n)),this.windowListeners=new Te(B(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(W.Resize,this.handleCancel),this.windowListeners.add(W.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(W.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&ir(r),n(q)}handleKeyDown(t){if(xt(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:i=sn,coordinateGetter:a=lr,scrollBehavior:s="smooth"}=o,{code:l}=t;if(i.end.includes(l)){this.handleEnd(t);return}if(i.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:u}=r.current,f=u?{x:u.left,y:u.top}:q;this.referenceCoordinates||(this.referenceCoordinates=f);const d=a(t,{active:n,context:r.current,currentCoordinates:f});if(d){const h=ze(d,f),g={x:0,y:0},{scrollableAncestors:C}=r.current;for(const v of C){const p=t.code,{isTop:m,isRight:y,isLeft:b,isBottom:S,maxScroll:R,minScroll:E}=rn(v),x=nr(v),D={x:Math.min(p===w.Right?x.right-x.width/2:x.right,Math.max(p===w.Right?x.left:x.left+x.width/2,d.x)),y:Math.min(p===w.Down?x.bottom-x.height/2:x.bottom,Math.max(p===w.Down?x.top:x.top+x.height/2,d.y))},A=p===w.Right&&!y||p===w.Left&&!b,T=p===w.Down&&!S||p===w.Up&&!m;if(A&&D.x!==d.x){const M=v.scrollLeft+h.x,H=p===w.Right&&M<=R.x||p===w.Left&&M>=E.x;if(H&&!h.y){v.scrollTo({left:M,behavior:s});return}H?g.x=v.scrollLeft-M:g.x=p===w.Right?v.scrollLeft-R.x:v.scrollLeft-E.x,g.x&&v.scrollBy({left:-g.x,behavior:s});break}else if(T&&D.y!==d.y){const M=v.scrollTop+h.y,H=p===w.Down&&M<=R.y||p===w.Up&&M>=E.y;if(H&&!h.x){v.scrollTo({top:M,behavior:s});return}H?g.y=v.scrollTop-M:g.y=p===w.Down?v.scrollTop-R.y:v.scrollTop-E.y,g.y&&v.scrollBy({top:-g.y,behavior:s});break}}this.handleMove(t,we(ze(d,this.referenceCoordinates),g))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}an.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=sn,onActivation:o}=t,{active:i}=n;const{code:a}=e.nativeEvent;if(r.start.includes(a)){const s=i.activatorNode.current;return s&&e.target!==s?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function Bt(e){return!!(e&&"distance"in e)}function Ft(e){return!!(e&&"delay"in e)}class Ct{constructor(t,n,r){var o;r===void 0&&(r=ar(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:i}=t,{target:a}=i;this.props=t,this.events=n,this.document=ye(a),this.documentListeners=new Te(this.document),this.listeners=new Te(r),this.windowListeners=new Te(B(a)),this.initialCoordinates=(o=gt(i))!=null?o:q,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(W.Resize,this.handleCancel),this.windowListeners.add(W.DragStart,Pt),this.windowListeners.add(W.VisibilityChange,this.handleCancel),this.windowListeners.add(W.ContextMenu,Pt),this.documentListeners.add(W.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Ft(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Bt(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:o}=this.props;o(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(W.Click,cr,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(W.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:i}=this,{onMove:a,options:{activationConstraint:s}}=i;if(!o)return;const l=(n=gt(t))!=null?n:q,u=ze(o,l);if(!r&&s){if(Bt(s)){if(s.tolerance!=null&&ut(u,s.tolerance))return this.handleCancel();if(ut(u,s.distance))return this.handleStart()}if(Ft(s)&&ut(u,s.tolerance))return this.handleCancel();this.handlePending(s,u);return}t.cancelable&&t.preventDefault(),a(l)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===w.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const ur={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class cn extends Ct{constructor(t){const{event:n}=t,r=ye(n.target);super(t,ur,r)}}cn.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const dr={move:{name:"mousemove"},end:{name:"mouseup"}};var pt;(function(e){e[e.RightClick=2]="RightClick"})(pt||(pt={}));class fr extends Ct{constructor(t){super(t,dr,ye(t.event.target))}}fr.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===pt.RightClick?!1:(r?.({event:n}),!0)}}];const dt={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class hr extends Ct{constructor(t){super(t,dt)}static setup(){return window.addEventListener(dt.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(dt.move.name,t)};function t(){}}}hr.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r?.({event:n}),!0)}}];var Ne;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Ne||(Ne={}));var Ze;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Ze||(Ze={}));function gr(e){let{acceleration:t,activator:n=Ne.Pointer,canScroll:r,draggingRect:o,enabled:i,interval:a=5,order:s=Ze.TreeOrder,pointerCoordinates:l,scrollableAncestors:u,scrollableAncestorRects:f,delta:d,threshold:h}=e;const g=pr({delta:d,disabled:!i}),[C,v]=Mn(),p=c.useRef({x:0,y:0}),m=c.useRef({x:0,y:0}),y=c.useMemo(()=>{switch(n){case Ne.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Ne.DraggableRect:return o}},[n,o,l]),b=c.useRef(null),S=c.useCallback(()=>{const E=b.current;if(!E)return;const x=p.current.x*m.current.x,D=p.current.y*m.current.y;E.scrollBy(x,D)},[]),R=c.useMemo(()=>s===Ze.TreeOrder?[...u].reverse():u,[s,u]);c.useEffect(()=>{if(!i||!u.length||!y){v();return}for(const E of R){if(r?.(E)===!1)continue;const x=u.indexOf(E),D=f[x];if(!D)continue;const{direction:A,speed:T}=tr(E,D,y,t,h);for(const M of["x","y"])g[M][A[M]]||(T[M]=0,A[M]=0);if(T.x>0||T.y>0){v(),b.current=E,C(S,a),p.current=T,m.current=A;return}}p.current={x:0,y:0},m.current={x:0,y:0},v()},[t,S,r,v,i,a,JSON.stringify(y),JSON.stringify(g),C,u,R,f,JSON.stringify(h)])}const vr={x:{[N.Backward]:!1,[N.Forward]:!1},y:{[N.Backward]:!1,[N.Forward]:!1}};function pr(e){let{delta:t,disabled:n}=e;const r=ht(t);return Fe(o=>{if(n||!r||!o)return vr;const i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[N.Backward]:o.x[N.Backward]||i.x===-1,[N.Forward]:o.x[N.Forward]||i.x===1},y:{[N.Backward]:o.y[N.Backward]||i.y===-1,[N.Forward]:o.y[N.Forward]||i.y===1}}},[n,t,r])}function br(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return Fe(o=>{var i;return t==null?null:(i=r??o)!=null?i:null},[r,t])}function wr(e,t){return c.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,i=o.activators.map(a=>({eventName:a.eventName,handler:t(a.handler,r)}));return[...n,...i]},[]),[e,t])}var Pe;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Pe||(Pe={}));var bt;(function(e){e.Optimized="optimized"})(bt||(bt={}));const $t=new Map;function mr(e,t){let{dragging:n,dependencies:r,config:o}=t;const[i,a]=c.useState(null),{frequency:s,measure:l,strategy:u}=o,f=c.useRef(e),d=p(),h=ke(d),g=c.useCallback(function(m){m===void 0&&(m=[]),!h.current&&a(y=>y===null?m:y.concat(m.filter(b=>!y.includes(b))))},[h]),C=c.useRef(null),v=Fe(m=>{if(d&&!n)return $t;if(!m||m===$t||f.current!==e||i!=null){const y=new Map;for(let b of e){if(!b)continue;if(i&&i.length>0&&!i.includes(b.id)&&b.rect.current){y.set(b.id,b.rect.current);continue}const S=b.node.current,R=S?new Dt(l(S),S):null;b.rect.current=R,R&&y.set(b.id,R)}return y}return m},[e,i,n,d,l]);return c.useEffect(()=>{f.current=e},[e]),c.useEffect(()=>{d||g()},[n,d]),c.useEffect(()=>{i&&i.length>0&&a(null)},[JSON.stringify(i)]),c.useEffect(()=>{d||typeof s!="number"||C.current!==null||(C.current=setTimeout(()=>{g(),C.current=null},s))},[s,d,g,...r]),{droppableRects:v,measureDroppableContainers:g,measuringScheduled:i!=null};function p(){switch(u){case Pe.Always:return!1;case Pe.BeforeDragging:return n;default:return!n}}}function ln(e,t){return Fe(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function yr(e,t){return ln(e,t)}function xr(e){let{callback:t,disabled:n}=e;const r=yt(t),o=c.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return c.useEffect(()=>()=>o?.disconnect(),[o]),o}function rt(e){let{callback:t,disabled:n}=e;const r=yt(t),o=c.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return c.useEffect(()=>()=>o?.disconnect(),[o]),o}function Dr(e){return new Dt(xe(e),e)}function Xt(e,t,n){t===void 0&&(t=Dr);const[r,o]=c.useState(null);function i(){o(l=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=l??n)!=null?u:null}const f=t(e);return JSON.stringify(l)===JSON.stringify(f)?l:f})}const a=xr({callback(l){if(e)for(const u of l){const{type:f,target:d}=u;if(f==="childList"&&d instanceof HTMLElement&&d.contains(e)){i();break}}}}),s=rt({callback:i});return Q(()=>{i(),e?(s?.observe(e),a?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),a?.disconnect())},[e]),r}function Cr(e){const t=ln(e);return Qt(e,t)}const Yt=[];function Sr(e){const t=c.useRef(e),n=Fe(r=>e?r&&r!==Yt&&e&&t.current&&e.parentNode===t.current.parentNode?r:nt(e):Yt,[e]);return c.useEffect(()=>{t.current=e},[e]),n}function Rr(e){const[t,n]=c.useState(null),r=c.useRef(e),o=c.useCallback(i=>{const a=lt(i.target);a&&n(s=>s?(s.set(a,vt(a)),new Map(s)):null)},[]);return c.useEffect(()=>{const i=r.current;if(e!==i){a(i);const s=e.map(l=>{const u=lt(l);return u?(u.addEventListener("scroll",o,{passive:!0}),[u,vt(u)]):null}).filter(l=>l!=null);n(s.length?new Map(s):null),r.current=e}return()=>{a(e),a(i)};function a(s){s.forEach(l=>{const u=lt(l);u?.removeEventListener("scroll",o)})}},[o,e]),c.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,a)=>we(i,a),q):on(e):q,[e,t])}function jt(e,t){t===void 0&&(t=[]);const n=c.useRef(null);return c.useEffect(()=>{n.current=null},t),c.useEffect(()=>{const r=e!==q;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?ze(e,n.current):q}function Er(e){c.useEffect(()=>{if(!tt)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function Ir(e,t){return c.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:i}=r;return n[o]=a=>{i(a,t)},n},{}),[e,t])}function un(e){return c.useMemo(()=>e?_n(e):null,[e])}const Ut=[];function Mr(e,t){t===void 0&&(t=xe);const[n]=e,r=un(n?B(n):null),[o,i]=c.useState(Ut);function a(){i(()=>e.length?e.map(l=>nn(l)?r:new Dt(t(l),l)):Ut)}const s=rt({callback:a});return Q(()=>{s?.disconnect(),a(),e.forEach(l=>s?.observe(l))},[e]),o}function Ar(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Be(t)?t:e}function Or(e){let{measure:t}=e;const[n,r]=c.useState(null),o=c.useCallback(u=>{for(const{target:f}of u)if(Be(f)){r(d=>{const h=t(f);return d?{...d,width:h.width,height:h.height}:h});break}},[t]),i=rt({callback:o}),a=c.useCallback(u=>{const f=Ar(u);i?.disconnect(),f&&i?.observe(f),r(f?t(f):null)},[t,i]),[s,l]=Ke(a);return c.useMemo(()=>({nodeRef:s,rect:n,setRef:l}),[n,s,l])}const Tr=[{sensor:cn,options:{}},{sensor:an,options:{}}],Nr={current:{}},Je={draggable:{measure:zt},droppable:{measure:zt,strategy:Pe.WhileDragging,frequency:bt.Optimized},dragOverlay:{measure:xe}};class Le extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const Lr={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Le,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Qe},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Je,measureDroppableContainers:Qe,windowRect:null,measuringScheduled:!1},kr={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Qe,draggableNodes:new Map,over:null,measureDroppableContainers:Qe},ot=c.createContext(kr),dn=c.createContext(Lr);function zr(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Le}}}function Pr(e,t){switch(t.type){case O.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case O.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case O.DragEnd:case O.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case O.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new Le(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case O.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const a=new Le(e.droppable.containers);return a.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:a}}}case O.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new Le(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function Br(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=c.useContext(ot),i=ht(r),a=ht(n?.id);return c.useEffect(()=>{if(!t&&!r&&i&&a!=null){if(!xt(i)||document.activeElement===i.target)return;const s=o.get(a);if(!s)return;const{activatorNode:l,node:u}=s;if(!l.current&&!u.current)return;requestAnimationFrame(()=>{for(const f of[l.current,u.current]){if(!f)continue;const d=Tn(f);if(d){d.focus();break}}})}},[r,t,o,a,i]),null}function Fr(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,i)=>i({transform:o,...r}),n):n}function $r(e){return c.useMemo(()=>({draggable:{...Je.draggable,...e?.draggable},droppable:{...Je.droppable,...e?.droppable},dragOverlay:{...Je.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Xr(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const i=c.useRef(!1),{x:a,y:s}=typeof o=="boolean"?{x:o,y:o}:o;Q(()=>{if(!a&&!s||!t){i.current=!1;return}if(i.current||!r)return;const u=t?.node.current;if(!u||u.isConnected===!1)return;const f=n(u),d=Qt(f,r);if(a||(d.x=0),s||(d.y=0),i.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const h=Zt(u);h&&h.scrollBy({top:d.y,left:d.x})}},[t,a,s,r,n])}const fn=c.createContext({...q,scaleX:1,scaleY:1});var ue;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(ue||(ue={}));const go=c.memo(function(t){var n,r,o,i;let{id:a,accessibility:s,autoScroll:l=!0,children:u,sensors:f=Tr,collisionDetection:d=Wn,measuring:h,modifiers:g,...C}=t;const v=c.useReducer(Pr,void 0,zr),[p,m]=v,[y,b]=Bn(),[S,R]=c.useState(ue.Uninitialized),E=S===ue.Initialized,{draggable:{active:x,nodes:D,translate:A},droppable:{containers:T}}=p,M=x!=null?D.get(x):null,H=c.useRef({initial:null,translated:null}),V=c.useMemo(()=>{var k;return x!=null?{id:x,data:(k=M?.data)!=null?k:Nr,rect:H}:null},[x,M]),G=c.useRef(null),[De,Xe]=c.useState(null),[F,Ye]=c.useState(null),Z=ke(C,Object.values(C)),Ce=$e("DndDescribedBy",a),je=c.useMemo(()=>T.getEnabled(),[T]),z=$r(h),{droppableRects:ee,measureDroppableContainers:de,measuringScheduled:Se}=mr(je,{dragging:E,dependencies:[A.x,A.y],config:z.droppable}),j=br(D,x),Ue=c.useMemo(()=>F?gt(F):null,[F]),oe=En(),te=yr(j,z.draggable.measure);Xr({activeNode:x!=null?D.get(x):null,config:oe.layoutShiftCompensation,initialRect:te,measure:z.draggable.measure});const I=Xt(j,z.draggable.measure,te),Re=Xt(j?j.parentElement:null),J=c.useRef({activatorEvent:null,active:null,activeNode:j,collisionRect:null,collisions:null,droppableRects:ee,draggableNodes:D,draggingNode:null,draggingNodeRect:null,droppableContainers:T,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),fe=T.getNodeFor((n=J.current.over)==null?void 0:n.id),ne=Or({measure:z.dragOverlay.measure}),he=(r=ne.nodeRef.current)!=null?r:j,ge=E?(o=ne.rect)!=null?o:I:null,St=!!(ne.nodeRef.current&&ne.rect),Rt=Cr(St?null:I),it=un(he?B(he):null),ie=Sr(E?fe??j:null),We=Mr(ie),He=Fr(g,{transform:{x:A.x-Rt.x,y:A.y-Rt.y,scaleX:1,scaleY:1},activatorEvent:F,active:V,activeNodeRect:I,containerNodeRect:Re,draggingNodeRect:ge,over:J.current.over,overlayNodeRect:ne.rect,scrollableAncestors:ie,scrollableAncestorRects:We,windowRect:it}),Et=Ue?we(Ue,A):null,It=Rr(ie),mn=jt(It),yn=jt(It,[I]),ve=we(He,mn),pe=ge?qn(ge,He):null,Ee=V&&pe?d({active:V,collisionRect:pe,droppableRects:ee,droppableContainers:je,pointerCoordinates:Et}):null,Mt=_t(Ee,"id"),[se,At]=c.useState(null),xn=St?He:we(He,yn),Dn=Hn(xn,(i=se?.rect)!=null?i:null,I),st=c.useRef(null),Ot=c.useCallback((k,$)=>{let{sensor:X,options:ae}=$;if(G.current==null)return;const U=D.get(G.current);if(!U)return;const Y=k.nativeEvent,K=new X({active:G.current,activeNode:U,event:Y,options:ae,context:J,onAbort(L){if(!D.get(L))return;const{onDragAbort:_}=Z.current,re={id:L};_?.(re),y({type:"onDragAbort",event:re})},onPending(L,ce,_,re){if(!D.get(L))return;const{onDragPending:Me}=Z.current,le={id:L,constraint:ce,initialCoordinates:_,offset:re};Me?.(le),y({type:"onDragPending",event:le})},onStart(L){const ce=G.current;if(ce==null)return;const _=D.get(ce);if(!_)return;const{onDragStart:re}=Z.current,Ie={activatorEvent:Y,active:{id:ce,data:_.data,rect:H}};Oe.unstable_batchedUpdates(()=>{re?.(Ie),R(ue.Initializing),m({type:O.DragStart,initialCoordinates:L,active:ce}),y({type:"onDragStart",event:Ie}),Xe(st.current),Ye(Y)})},onMove(L){m({type:O.DragMove,coordinates:L})},onEnd:be(O.DragEnd),onCancel:be(O.DragCancel)});st.current=K;function be(L){return async function(){const{active:_,collisions:re,over:Ie,scrollAdjustedTranslate:Me}=J.current;let le=null;if(_&&Me){const{cancelDrop:Ae}=Z.current;le={activatorEvent:Y,active:_,collisions:re,delta:Me,over:Ie},L===O.DragEnd&&typeof Ae=="function"&&await Promise.resolve(Ae(le))&&(L=O.DragCancel)}G.current=null,Oe.unstable_batchedUpdates(()=>{m({type:L}),R(ue.Uninitialized),At(null),Xe(null),Ye(null),st.current=null;const Ae=L===O.DragEnd?"onDragEnd":"onDragCancel";if(le){const at=Z.current[Ae];at?.(le),y({type:Ae,event:le})}})}}},[D]),Cn=c.useCallback((k,$)=>(X,ae)=>{const U=X.nativeEvent,Y=D.get(ae);if(G.current!==null||!Y||U.dndKit||U.defaultPrevented)return;const K={active:Y};k(X,$.options,K)===!0&&(U.dndKit={capturedBy:$.sensor},G.current=ae,Ot(X,$))},[D,Ot]),Tt=wr(f,Cn);Er(f),Q(()=>{I&&S===ue.Initializing&&R(ue.Initialized)},[I,S]),c.useEffect(()=>{const{onDragMove:k}=Z.current,{active:$,activatorEvent:X,collisions:ae,over:U}=J.current;if(!$||!X)return;const Y={active:$,activatorEvent:X,collisions:ae,delta:{x:ve.x,y:ve.y},over:U};Oe.unstable_batchedUpdates(()=>{k?.(Y),y({type:"onDragMove",event:Y})})},[ve.x,ve.y]),c.useEffect(()=>{const{active:k,activatorEvent:$,collisions:X,droppableContainers:ae,scrollAdjustedTranslate:U}=J.current;if(!k||G.current==null||!$||!U)return;const{onDragOver:Y}=Z.current,K=ae.get(Mt),be=K&&K.rect.current?{id:K.id,rect:K.rect.current,data:K.data,disabled:K.disabled}:null,L={active:k,activatorEvent:$,collisions:X,delta:{x:U.x,y:U.y},over:be};Oe.unstable_batchedUpdates(()=>{At(be),Y?.(L),y({type:"onDragOver",event:L})})},[Mt]),Q(()=>{J.current={activatorEvent:F,active:V,activeNode:j,collisionRect:pe,collisions:Ee,droppableRects:ee,draggableNodes:D,draggingNode:he,draggingNodeRect:ge,droppableContainers:T,over:se,scrollableAncestors:ie,scrollAdjustedTranslate:ve},H.current={initial:ge,translated:pe}},[V,j,Ee,pe,D,he,ge,ee,T,se,ie,ve]),gr({...oe,delta:A,draggingRect:pe,pointerCoordinates:Et,scrollableAncestors:ie,scrollableAncestorRects:We});const Sn=c.useMemo(()=>({active:V,activeNode:j,activeNodeRect:I,activatorEvent:F,collisions:Ee,containerNodeRect:Re,dragOverlay:ne,draggableNodes:D,droppableContainers:T,droppableRects:ee,over:se,measureDroppableContainers:de,scrollableAncestors:ie,scrollableAncestorRects:We,measuringConfiguration:z,measuringScheduled:Se,windowRect:it}),[V,j,I,F,Ee,Re,ne,D,T,ee,se,de,ie,We,z,Se,it]),Rn=c.useMemo(()=>({activatorEvent:F,activators:Tt,active:V,activeNodeRect:I,ariaDescribedById:{draggable:Ce},dispatch:m,draggableNodes:D,over:se,measureDroppableContainers:de}),[F,Tt,V,I,m,Ce,D,se,de]);return P.createElement(Gt.Provider,{value:b},P.createElement(ot.Provider,{value:Rn},P.createElement(dn.Provider,{value:Sn},P.createElement(fn.Provider,{value:Dn},u)),P.createElement(Br,{disabled:s?.restoreFocus===!1})),P.createElement(Xn,{...s,hiddenTextDescribedById:Ce}));function En(){const k=De?.autoScrollEnabled===!1,$=typeof l=="object"?l.enabled===!1:l===!1,X=E&&!k&&!$;return typeof l=="object"?{...l,enabled:X}:{enabled:X}}}),Yr=c.createContext(null),Wt="button",jr="Draggable";function Ur(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const i=$e(jr),{activators:a,activatorEvent:s,active:l,activeNodeRect:u,ariaDescribedById:f,draggableNodes:d,over:h}=c.useContext(ot),{role:g=Wt,roleDescription:C="draggable",tabIndex:v=0}=o??{},p=l?.id===t,m=c.useContext(p?fn:Yr),[y,b]=Ke(),[S,R]=Ke(),E=Ir(a,t),x=ke(n);Q(()=>(d.set(t,{id:t,key:i,node:y,activatorNode:S,data:x}),()=>{const A=d.get(t);A&&A.key===i&&d.delete(t)}),[d,t]);const D=c.useMemo(()=>({role:g,tabIndex:v,"aria-disabled":r,"aria-pressed":p&&g===Wt?!0:void 0,"aria-roledescription":C,"aria-describedby":f.draggable}),[r,g,v,p,C,f.draggable]);return{active:l,activatorEvent:s,activeNodeRect:u,attributes:D,isDragging:p,listeners:r?void 0:E,node:y,over:h,setNodeRef:b,setActivatorNodeRef:R,transform:m}}function Wr(){return c.useContext(dn)}const Hr="Droppable",Vr={timeout:25};function qr(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const i=$e(Hr),{active:a,dispatch:s,over:l,measureDroppableContainers:u}=c.useContext(ot),f=c.useRef({disabled:n}),d=c.useRef(!1),h=c.useRef(null),g=c.useRef(null),{disabled:C,updateMeasurementsFor:v,timeout:p}={...Vr,...o},m=ke(v??r),y=c.useCallback(()=>{if(!d.current){d.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{u(Array.isArray(m.current)?m.current:[m.current]),g.current=null},p)},[p]),b=rt({callback:y,disabled:C||!a}),S=c.useCallback((D,A)=>{b&&(A&&(b.unobserve(A),d.current=!1),D&&b.observe(D))},[b]),[R,E]=Ke(S),x=ke(t);return c.useEffect(()=>{!b||!R.current||(b.disconnect(),d.current=!1,b.observe(R.current))},[R,b]),c.useEffect(()=>(s({type:O.RegisterDroppable,element:{id:r,key:i,disabled:n,node:R,rect:h,data:x}}),()=>s({type:O.UnregisterDroppable,key:i,id:r})),[r]),c.useEffect(()=>{n!==f.current.disabled&&(s({type:O.SetDroppableDisabled,id:r,key:i,disabled:n}),f.current.disabled=n)},[r,i,n,s]),{active:a,rect:h,isOver:l?.id===r,node:R,over:l,setNodeRef:E}}function hn(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Gr(e,t){return e.reduce((n,r,o)=>{const i=t.get(r);return i&&(n[o]=i),n},Array(e.length))}function Ve(e){return e!==null&&e>=0}function Jr(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Kr(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const qe={scaleX:1,scaleY:1},vo=e=>{var t;let{rects:n,activeNodeRect:r,activeIndex:o,overIndex:i,index:a}=e;const s=(t=n[o])!=null?t:r;if(!s)return null;const l=_r(n,a,o);if(a===o){const u=n[i];return u?{x:o<i?u.left+u.width-(s.left+s.width):u.left-s.left,y:0,...qe}:null}return a>o&&a<=i?{x:-s.width-l,y:0,...qe}:a<o&&a>=i?{x:s.width+l,y:0,...qe}:{x:0,y:0,...qe}};function _r(e,t,n){const r=e[t],o=e[t-1],i=e[t+1];return!r||!o&&!i?0:n<t?o?r.left-(o.left+o.width):i.left-(r.left+r.width):i?i.left-(r.left+r.width):r.left-(o.left+o.width)}const gn=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const i=hn(t,r,n),a=t[o],s=i[o];return!s||!a?null:{x:s.left-a.left,y:s.top-a.top,scaleX:s.width/a.width,scaleY:s.height/a.height}},Ge={scaleX:1,scaleY:1},po=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:i,overIndex:a}=e;const s=(t=i[n])!=null?t:r;if(!s)return null;if(o===n){const u=i[a];return u?{x:0,y:n<a?u.top+u.height-(s.top+s.height):u.top-s.top,...Ge}:null}const l=Qr(i,o,n);return o>n&&o<=a?{x:0,y:-s.height-l,...Ge}:o<n&&o>=a?{x:0,y:s.height+l,...Ge}:{x:0,y:0,...Ge}};function Qr(e,t,n){const r=e[t],o=e[t-1],i=e[t+1];return r?n<t?o?r.top-(o.top+o.height):i?i.top-(r.top+r.height):0:i?i.top-(r.top+r.height):o?r.top-(o.top+o.height):0:0}const vn="Sortable",pn=P.createContext({activeIndex:-1,containerId:vn,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:gn,disabled:{draggable:!1,droppable:!1}});function bo(e){let{children:t,id:n,items:r,strategy:o=gn,disabled:i=!1}=e;const{active:a,dragOverlay:s,droppableRects:l,over:u,measureDroppableContainers:f}=Wr(),d=$e(vn,n),h=s.rect!==null,g=c.useMemo(()=>r.map(E=>typeof E=="object"&&"id"in E?E.id:E),[r]),C=a!=null,v=a?g.indexOf(a.id):-1,p=u?g.indexOf(u.id):-1,m=c.useRef(g),y=!Jr(g,m.current),b=p!==-1&&v===-1||y,S=Kr(i);Q(()=>{y&&C&&f(g)},[y,g,C,f]),c.useEffect(()=>{m.current=g},[g]);const R=c.useMemo(()=>({activeIndex:v,containerId:d,disabled:S,disableTransforms:b,items:g,overIndex:p,useDragOverlay:h,sortedRects:Gr(g,l),strategy:o}),[v,d,S.draggable,S.droppable,b,g,p,l,h,o]);return P.createElement(pn.Provider,{value:R},t)}const Zr=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return hn(n,r,o).indexOf(t)},eo=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:i,newIndex:a,previousItems:s,previousContainerId:l,transition:u}=e;return!u||!r||s!==i&&o===a?!1:n?!0:a!==o&&t===l},to={duration:200,easing:"ease"},bn="transform",no=_e.Transition.toString({property:bn,duration:0,easing:"linear"}),ro={roleDescription:"sortable"};function oo(e){let{disabled:t,index:n,node:r,rect:o}=e;const[i,a]=c.useState(null),s=c.useRef(n);return Q(()=>{if(!t&&n!==s.current&&r.current){const l=o.current;if(l){const u=xe(r.current,{ignoreTransform:!0}),f={x:l.left-u.left,y:l.top-u.top,scaleX:l.width/u.width,scaleY:l.height/u.height};(f.x||f.y)&&a(f)}}n!==s.current&&(s.current=n)},[t,n,r,o]),c.useEffect(()=>{i&&a(null)},[i]),i}function wo(e){let{animateLayoutChanges:t=eo,attributes:n,disabled:r,data:o,getNewIndex:i=Zr,id:a,strategy:s,resizeObserverConfig:l,transition:u=to}=e;const{items:f,containerId:d,activeIndex:h,disabled:g,disableTransforms:C,sortedRects:v,overIndex:p,useDragOverlay:m,strategy:y}=c.useContext(pn),b=io(r,g),S=f.indexOf(a),R=c.useMemo(()=>({sortable:{containerId:d,index:S,items:f},...o}),[d,o,S,f]),E=c.useMemo(()=>f.slice(f.indexOf(a)),[f,a]),{rect:x,node:D,isOver:A,setNodeRef:T}=qr({id:a,data:R,disabled:b.droppable,resizeObserverConfig:{updateMeasurementsFor:E,...l}}),{active:M,activatorEvent:H,activeNodeRect:V,attributes:G,setNodeRef:De,listeners:Xe,isDragging:F,over:Ye,setActivatorNodeRef:Z,transform:Ce}=Ur({id:a,data:R,attributes:{...ro,...n},disabled:b.draggable}),je=In(T,De),z=!!M,ee=z&&!C&&Ve(h)&&Ve(p),de=!m&&F,Se=de&&ee?Ce:null,Ue=ee?Se??(s??y)({rects:v,activeNodeRect:V,activeIndex:h,overIndex:p,index:S}):null,oe=Ve(h)&&Ve(p)?i({id:a,items:f,activeIndex:h,overIndex:p}):S,te=M?.id,I=c.useRef({activeId:te,items:f,newIndex:oe,containerId:d}),Re=f!==I.current.items,J=t({active:M,containerId:d,isDragging:F,isSorting:z,id:a,index:S,items:f,newIndex:I.current.newIndex,previousItems:I.current.items,previousContainerId:I.current.containerId,transition:u,wasDragging:I.current.activeId!=null}),fe=oo({disabled:!J,index:S,node:D,rect:x});return c.useEffect(()=>{z&&I.current.newIndex!==oe&&(I.current.newIndex=oe),d!==I.current.containerId&&(I.current.containerId=d),f!==I.current.items&&(I.current.items=f)},[z,oe,d,f]),c.useEffect(()=>{if(te===I.current.activeId)return;if(te&&!I.current.activeId){I.current.activeId=te;return}const he=setTimeout(()=>{I.current.activeId=te},50);return()=>clearTimeout(he)},[te]),{active:M,activeIndex:h,attributes:G,data:R,rect:x,index:S,newIndex:oe,items:f,isOver:A,isSorting:z,isDragging:F,listeners:Xe,node:D,overIndex:p,over:Ye,setNodeRef:je,setActivatorNodeRef:Z,setDroppableNodeRef:T,setDraggableNodeRef:De,transform:fe??Ue,transition:ne()};function ne(){if(fe||Re&&I.current.newIndex===S)return no;if(!(de&&!xt(H)||!u)&&(z||J))return _e.Transition.toString({...u,property:bn})}}function io(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}function et(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const so=[w.Down,w.Right,w.Up,w.Left],mo=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:o,droppableContainers:i,over:a,scrollableAncestors:s}}=t;if(so.includes(e.code)){if(e.preventDefault(),!n||!r)return;const l=[];i.getEnabled().forEach(d=>{if(!d||d!=null&&d.disabled)return;const h=o.get(d.id);if(h)switch(e.code){case w.Down:r.top<h.top&&l.push(d);break;case w.Up:r.top>h.top&&l.push(d);break;case w.Left:r.left>h.left&&l.push(d);break;case w.Right:r.left<h.left&&l.push(d);break}});const u=jn({collisionRect:r,droppableRects:o,droppableContainers:l});let f=_t(u,"id");if(f===a?.id&&u.length>1&&(f=u[1].id),f!=null){const d=i.get(n.id),h=i.get(f),g=h?o.get(h.id):null,C=h?.node.current;if(C&&g&&d&&h){const p=nt(C).some((E,x)=>s[x]!==E),m=wn(d,h),y=ao(d,h),b=p||!m?{x:0,y:0}:{x:y?r.width-g.width:0,y:y?r.height-g.height:0},S={x:g.left,y:g.top};return b.x&&b.y?S:ze(S,b)}}}};function wn(e,t){return!et(e)||!et(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function ao(e,t){return!et(e)||!et(t)||!wn(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function co(e){if(typeof window>"u")return null;try{const t=window.localStorage.getItem(e);if(!t)return null;const n=JSON.parse(t);return Array.isArray(n)?n.filter(r=>typeof r=="string"):null}catch{return null}}function ft(e,t){if(!(typeof window>"u"))try{window.localStorage.setItem(e,JSON.stringify(t))}catch{}}function Ht(e,t){if(!e)return t;const n=new Set(t),r=e.filter(i=>n.has(i)),o=t.filter(i=>!r.includes(i));return[...r,...o]}function yo(e,t){const n=c.useMemo(()=>t.join("|"),[t]),[r,o]=c.useState(()=>Ht(co(e),t));c.useEffect(()=>{o(s=>{const l=Ht(s,t);return l.length===s.length&&l.every((f,d)=>f===s[d])?s:(ft(e,l),l)})},[n,t,e]);const i=c.useCallback((s,l)=>{!s||!l||s===l||o(u=>{const f=u.indexOf(s),d=u.indexOf(l);if(f===-1||d===-1)return u;const h=u.slice(),[g]=h.splice(f,1);return h.splice(d,0,g),ft(e,h),h})},[e]),a=c.useCallback(()=>{ft(e,t),o(t)},[e,t]);return{order:r,reorder:i,reset:a}}export{_e as C,go as D,an as K,cn as P,bo as S,yo as a,fo as b,uo as c,ho as d,vo as h,mo as s,wo as u,po as v};
import{r as o}from"./__vite-browser-external-CuMc3dqk.js";import{h as r,i as t,p as s}from"./react-B80AX8fE.js";function i(){!r.current&&t();const[e]=o.useState(s.current);return e}export{i as u};
import{l as u,r as n}from"./__vite-browser-external-CuMc3dqk.js";const f=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],E=u("pencil",f),i="tt.qualityPerDollar.enabled";function l(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(i)==="1"}catch{return!1}}function y(){const[r,o]=n.useState(l);n.useEffect(()=>{if(typeof window>"u")return;const t=e=>{(e.key===null||e.key===i)&&o(l())};return window.addEventListener("storage",t),()=>window.removeEventListener("storage",t)},[]);const a=n.useCallback(t=>{const e=!!t;o(e);try{window.localStorage.setItem(i,e?"1":"0")}catch{}},[]),s=n.useCallback(()=>a(!l()),[a]);return{enabled:r,setEnabled:a,toggle:s}}const d="tt.sessionEfficiency.enabled";function c(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(d)==="1"}catch{return!1}}function g(){const[r,o]=n.useState(c);n.useEffect(()=>{if(typeof window>"u")return;const t=e=>{(e.key===null||e.key===d)&&o(c())};return window.addEventListener("storage",t),()=>window.removeEventListener("storage",t)},[]);const a=n.useCallback(t=>{const e=!!t;o(e);try{window.localStorage.setItem(d,e?"1":"0")}catch{}},[]),s=n.useCallback(()=>a(!c()),[a]);return{enabled:r,setEnabled:a,toggle:s}}export{E as P,g as a,y as u};
import{d as y,u as l,e as A,M as p,b as h,f as C,g as V,j as u}from"./react-B80AX8fE.js";import{r as f}from"./__vite-browser-external-CuMc3dqk.js";function x(...t){const e=!Array.isArray(t[0]),n=e?0:-1,o=t[0+n],s=t[1+n],c=t[2+n],r=t[3+n],a=y(s,c,r);return e?a(o):a}function E(t){const e=l(()=>A(t)),{isStatic:n}=f.useContext(p);if(n){const[,o]=f.useState(t);f.useEffect(()=>e.on("change",o),[])}return e}function m(t,e){const n=E(e()),o=()=>n.set(e());return o(),h(()=>{const s=()=>V.preRender(o,!1,!0),c=t.map(r=>r.on("change",s));return()=>{c.forEach(r=>r()),C(o)}}),n}function L(t){u.current=[],t();const e=m(u.current,t);return u.current=void 0,e}function g(t,e,n,o){if(typeof t=="function")return L(t);const c=typeof e=="function"?e:x(e,n,o),r=Array.isArray(t)?i(t,c):i([t],([d])=>c(d)),a=Array.isArray(t)?void 0:t.accelerate;return a&&!a.isTransformed&&typeof e!="function"&&Array.isArray(n)&&o?.clamp!==!1&&(r.accelerate={...a,times:e,keyframes:n,isTransformed:!0}),r}function i(t,e){const n=l(()=>[]);return m(t,()=>{n.length=0;const o=t.length;for(let s=0;s<o;s++)n[s]=t[s].get();return e(n)})}export{g as a,E as u};
import{p as _,ae as K,r as w,c as g,af as F,ag as M,ah as b}from"./__vite-browser-external-CuMc3dqk.js";import{l as x}from"./limits-providers-CMQJD3FZ.js";const S="native:notificationPermission";let E=null;function N(){return typeof window<"u"&&!!window.chrome?.webview}function v(){return _()?E||"unknown":N()?"granted":typeof Notification>"u"?"unsupported":Notification.permission}function L(e){if(typeof window>"u")return()=>{};const i=t=>{const a=t?.detail?.status;typeof a=="string"&&(E=a),e(v())};return window.addEventListener(S,i),e(v()),_()&&K({type:"getNotificationStatus"}),()=>window.removeEventListener(S,i)}async function I(){if(_()){K({type:"requestNotificationPermission"});return}N()||typeof Notification<"u"&&Notification.permission==="default"&&await Notification.requestPermission().catch(()=>"denied")}const p="tt.limitAlerts.enabled";function O(){try{return window.localStorage.getItem(p)==="1"}catch{return!1}}function U(){const[e,i]=w.useState(O),[t,a]=w.useState("unknown");w.useEffect(()=>L(a),[]);const y=w.useCallback(async n=>{const l=!!n;l&&await I();try{window.localStorage.setItem(p,l?"1":"0")}catch{}i(l)},[]);return{enabled:e,setEnabled:y,permissionBlocked:t==="denied"}}function A(e,i){if(!(e>0))return null;const t=(e-i)/e;return Number.isFinite(t)?Math.min(Math.max(t,0),1):null}function z(e,i,t=.03){return e>i+t}function D(e){const i=Math.max(0,Math.floor(e)),t=Math.floor(i/3600);return t>24?`${Math.floor(t/24)}d`:t>0?`${t}h`:`${Math.floor(i/60)}m`}function j(e,i){if(typeof e.windowSeconds=="number")return e.windowSeconds;if(e.windowSecondsField&&i){const t=i[e.windowSecondsField];return typeof t=="number"&&t>0?t:null}return null}function R(e){return e==null?NaN:typeof e=="number"?e*1e3:Date.parse(e)}function C({usedPercent:e,windowSeconds:i,resetMs:t,mode:a,now:y=Date.now()}){const n=Math.min(Math.max(Number(e)||0,0),100)/100,l={pacePercent:null,paceOver:!1,expectedPercent:null,runsOutEta:null,projectedEnd:null};if(!(i>0)||!Number.isFinite(t))return l;const r=Math.max(0,(t-y)/1e3),s=A(i,r);if(s==null)return l;if(l.expectedPercent=Math.round(s*100),l.paceOver=z(n,s),n>=.05){const u=a==="remaining"?1-s:s;l.pacePercent=u*100}if(s>.02&&n>0){const u=i*s,c=n/u,m=n/s;m>=1&&c>0?l.runsOutEta=D((1-n)/c):l.projectedEnd=Math.round(Math.min(m,1)*100)}return l}const T={claude:{windows(e){const i=Array.isArray(e.weekly_scoped)?e.weekly_scoped.map(t=>({key:`scoped-${t.label}`,label:t.label,window:t,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},...i]}},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){const i=typeof e.period_type=="string"?e.period_type:null,t=i==="weekly"?"limits.label.grok_week":i==="daily"?"limits.label.grok_day":"limits.label.grok_month",a=i==="weekly"?7*86400:i==="daily"?86400:void 0;return[{key:i==="weekly"?"week":i==="daily"?"day":"month",labelKey:t,window:e.primary_window,windowSeconds:a},{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}]}}},P="tt.limitAlerts.cycles.v1";function $(){try{return JSON.parse(window.localStorage.getItem(P)||"{}")}catch{return{}}}function B(e){try{window.localStorage.setItem(P,JSON.stringify(e))}catch{}}function V(e,{now:i=Date.now()}={}){const t=[],a=T;for(const[y,n]of Object.entries(e||{})){const l=a[y];if(!(!n?.configured||n.error||!l))for(const r of l.windows(n)){if(!r.window)continue;const s=Number(r.pctField==="utilization"?r.window.utilization:r.window.used_percent),u=r.resetField==="resets_at"?r.window.resets_at:r.window.reset_at,c=R(u),m=C({usedPercent:s,windowSeconds:j(r,r.window),resetMs:c,mode:"used",now:i});!m.runsOutEta||!m.paceOver||s<20||!(c>i)||t.push({id:`${y}:${r.key}:${c}`,providerId:y,windowKey:r.key,resetMs:c,usedPercent:s,runsOutEta:m.runsOutEta})}}return t}function q(e){const i=$(),t=V(e);for(const n of t){if(i[n.id])continue;const l=x(n.providerId),r=g("limits.alert.title",{provider:l}),s=g("limits.alert.body",{eta:n.runsOutEta,percent:Math.round(n.usedPercent)});let u=F({title:r,body:s,id:n.id});!u&&typeof Notification<"u"&&Notification.permission==="granted"&&(new Notification(r,{body:s,tag:n.id}),u=!0),u&&(i[n.id]=Date.now())}const a=Date.now()-864e5,y=Object.fromEntries(Object.entries(i).filter(([n,l])=>{const r=Number(n.split(":").at(-1));return Number.isFinite(r)?r>=a:Number(l)>=a}).slice(-100));return B(y),t.length}function W(e){const i=!!e?.initialState,[t,a]=w.useState(()=>i?e?.initialState?.data??null:null),[y,n]=w.useState(()=>i?e?.initialState?.error??null:null),[l,r]=w.useState(!i),s=!!e?.initialRefresh,u=!!e?.publishToPreloadCache;w.useEffect(()=>{if(!(!t||typeof window>"u"))try{window.localStorage.getItem(p)==="1"&&q(t)}catch{}},[t]);const c=w.useCallback((o,d)=>{!u||!o||typeof o!="object"||M(o,{source:d})},[u]),m=w.useCallback(async()=>{try{const o=await b({refresh:!0}),d=o&&typeof o=="object"?o:null;a(d),n(null),c(d,"manual-refresh")}catch(o){n(o?.message||String(o))}},[c]),k=w.useCallback(async()=>{try{const o=await b(),d=o&&typeof o=="object"?o:null;a(d),n(null),c(d,"page-load")}catch(o){n(o?.message||String(o))}},[c]);return w.useEffect(()=>{if(typeof window>"u"||typeof document>"u")return;const o=15e3;let d=Date.now();const f=()=>{if(document.visibilityState!=="visible")return;const h=Date.now();h-d<o||(d=h,k())};return window.addEventListener("focus",f),document.addEventListener("visibilitychange",f),()=>{window.removeEventListener("focus",f),document.removeEventListener("visibilitychange",f)}},[k]),w.useEffect(()=>{if(i&&!s)return;let o=!1;return(async()=>{try{const d=await b();if(o)return;const f=d&&typeof d=="object"?d:null;a(f),n(null),c(f,"page-load")}catch(d){if(o)return;n(d?.message||String(d))}finally{o||r(!1)}})(),()=>{o=!0}},[i,s,c]),{data:t,error:y,isLoading:l,refresh:m}}export{T as P,j as a,U as b,C as c,R as r,q as s,W as u};
import{r as e,C as t,D as r,x as c}from"./__vite-browser-external-CuMc3dqk.js";const s=Object.freeze({currency:c,rate:1,symbol:"$",rates:{...r},rateSource:"default",rateFetchedAt:null,setCurrency:()=>{}});function a(){return e.useContext(t)??s}export{a as u};
import{bK as Ve,bL as _t,aH as Ot,aG as H,aI as wt,aU as K,bM as Ct,bn as je,j as Se,bs as ze,r as g,P as X,bN as ot,bO as Dt,aJ as it,aS as Ne,bc as Gt,bP as ct,bQ as xt,aW as x,aV as ke,ba as he,bR as Xe,bS as le,bT as ae,aE as C,aZ as Ut,bU as It,bV as Je,bd as Kt,b7 as ut,b2 as lt,b4 as Vt,bW as Xt,aD as be,b6 as $t,bX as qt,A as Pe,b1 as jt,bY as Ze,aL as Ye,bZ as zt,b_ as He,a_ as Jt,aR as Le,a$ as Zt,aT as Ie,bj as _e,bi as Qt,b$ as en,bg as tn,aF as nn,V as Te,c0 as me,c1 as rn,aO as sn,az as on,W as De,c2 as at,bu as cn,bo as Qe}from"./__vite-browser-external-CuMc3dqk.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:Ve&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function fn(e){return _t?!1:!Ve&&e.width===0&&e.height===0||Ve&&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 qn(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,H(t.effect),t}function pn(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}let We=0;function Ge(e,t={}){const{preventScroll:n=!1,sync:r=!1,shouldFocus:s}=t;cancelAnimationFrame(We);function o(){s&&!s()||e?.focus({preventScroll:n})}if(r)return o(),wt;const i=requestAnimationFrame(o);return We=i,()=>{We===i&&(cancelAnimationFrame(i),We=0)}}const Ue={inert:new WeakMap,"aria-hidden":new WeakMap},dt="data-base-ui-inert",$e={inert:new WeakSet,"aria-hidden":new WeakSet};let xe=new WeakMap,Ke=0;function gn(e){return $e[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=>{je(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=Ue[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),Z=E!==null&&E!=="false",B=(b.get(y)||0)+1;b.set(y,B),k.push(y),B===1&&Z&&T.add(y),Z||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,"")}),Ke+=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)}),Ke-=1,Ke||(Ue.inert=new WeakMap,Ue["aria-hidden"]=new WeakMap,$e.inert=new WeakSet,$e["aria-hidden"]=new WeakSet,xe=new WeakMap)}}function mt(e,t={}){const{ariaHidden:n=!1,inert:r=!1,mark:s=!0}=t,o=K(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 jn(e){const t=ze(),n=tt(e),r=et();return H(()=>{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=Ye(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&&je(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?Ze(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 Ze(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 Zn(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:Z,dataRef:B}=P.context,$=X(()=>B.current.floatingContext?.nodeId),J=s===!1,D=ot(y)&&J,se=Ae(s),F=Ae(o),q=Ae(f),ve=Ae(_),W=tt(T),R=Dt(),Y=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),j=it(ye,R?.afterInsideRef),ie=Ne(),ce=Ne(),Oe=Gt(),Me=R!=null,p=ct(E),ne=X((m=p)=>m?xt(m):[]),Q=X(()=>A?.().filter(m=>m!=null)??[]);g.useEffect(()=>{if(r||!u)return;function m(N){N.key==="Tab"&&C(p,ae(K(p)))&&ne().length===0&&!D&&un(N)}const I=K(p);return x(I,"keydown",m)},[r,p,u,D,ne]),g.useEffect(()=>{if(r||!_)return;const m=K(p);function I(){ee.current=!1}function N(z){const a=be(z),O=Q(),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(`[${$t}]`)&&(oe.current=!0,ce.start(0,()=>{oe.current=!1}))}function G(){de.current="keyboard"}return ke(x(m,"pointerdown",N,!0),x(m,"pointerup",I,!0),x(m,"pointercancel",I,!0),x(m,"keydown",G,!0),I)},[r,E,y,p,_,R,ce,Q]),g.useEffect(()=>{if(r||!h)return;const m=K(p);function I(){oe.current=!0,ce.start(0,()=>{oe.current=!1})}function N(O){const d=be(O);Ze(d)&&(te.current=d)}function G(O){const d=O.relatedTarget,M=O.currentTarget,U=be(O);u&&d==null&&U!=null&&C(E,U)&&Et(U),queueMicrotask(()=>{const w=$(),Re=P.context.triggerElements,c=Q(),l=d?.hasAttribute(Xe("focus-guard"))&&[pe.current,ye.current,R?.beforeInsideRef.current,R?.afterInsideRef.current,R?.beforeOutsideRef.current,R?.afterOutsideRef.current,le(L),le(k)].includes(d),V=!(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||W&&(Fe(W.nodesRef.current,w).find(v=>C(v.context?.elements.floating,d)||C(v.context?.elements.domReference,d))||ft(W.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&&!qt(U)&&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(B.current.insideReactTree){B.current.insideReactTree=!1;return}(D||!u)&&d&&V&&!oe.current&&(D||d!==yt())&&(Y.current=!0,P.setOpen(!1,Pe(jt,O)))})}function z(){ee.current||(B.current.insideReactTree=!0,ie.start(0,()=>{B.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",N),E&&x(E,"focusout",G),E&&R&&x(E,"focusout",z,!0))},[r,y,E,p,u,W,R,P,h,i,ne,D,$,B,ie,ce,Oe,k,L,Q]),g.useEffect(()=>{if(r||!E||!_)return;const m=Array.from(R?.portalNode?.querySelectorAll(`[${Xe("portal")}]`)||[]),N=(W?ft(W.nodesRef.current,$()):[]).find(M=>ot(M.context?.elements.domReference||null))?.context?.elements.domReference,z=[...[E,...m,pe.current,ye.current,R?.beforeOutsideRef.current,R?.afterOutsideRef.current,...Q()],N,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,W,$,k,L,Q]),H(()=>{if(!_||r||!he(p))return;const m=K(p),I=ae(m);queueMicrotask(()=>{const N=se.current,G=typeof N=="function"?N(q.current||""):N;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 U=ae(m);return!(U!==d&&C(p,U))}})})},[r,_,p,ne,se,q,ve]),H(()=>{if(r||!p)return;const m=K(p),I=ae(m),N=q.current==null;Et(I);function G(a){if(a.open||(Ee.current=bn(a.nativeEvent,de.current)),a.reason===Ut&&a.nativeEvent.type==="mouseleave"&&(Y.current=!0),a.reason===It)if(a.nested)Y.current=!1;else if(an(a.nativeEvent)||fn(a.nativeEvent))Y.current=!1;else{let O=!1;K(p).createElement("div").focus({get preventScroll(){return O=!0,!1}}),O?Y.current=!1:Y.current=!0}}Z.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&&je(I)!=="body"?I:null;let U=N?M||d:d||M;return U||(U=yt()||null),typeof O=="boolean"?U:le(O)||U||null}return()=>{Z.off("openchange",G);const a=ae(m),O=Q(),d=C(E,a)||O.some(w=>w===a||C(w,a))||W&&Fe(W.nodesRef.current,$(),!1).some(w=>C(w.context?.elements.floating,a)),M=F.current,U=z();queueMicrotask(()=>{const w=En(U),Re=typeof M!="boolean";M&&!Y.current&&he(w)&&(!(!Re&&w!==a&&a!==m.body)||d)&&w.focus({preventScroll:!0}),Y.current=!1})}},[r,E,p,F,q,Z,W,y,$,Q]),H(()=>{if(!Je||_||!E)return;const m=ae(K(E));!he(m)||!Kt(m)||C(E,m)&&m.blur()},[_,E]),H(()=>{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]),H(()=>{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&&(Y.current=!1,lt(m,R.portalNode)?Vt(y)?.focus():le(L??R.beforeOutsideRef)?.focus())}}),n,ge&&Se.jsx(ut,{"data-type":"inside",ref:j,onFocus:m=>{u?Ge(ne()[0]):R?.portalNode&&(h&&(Y.current=!0),lt(m,R.portalNode)?Xt(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 Qn(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=X(typeof s=="function"?s:()=>!1),P=typeof s=="function"?A:s,_=P!==!1,y=X(()=>o),{escapeKey:E,outsidePress:Z}=Rn(u),B=g.useRef(!1),$=g.useRef(!1),J=g.useRef(!1),D=g.useRef(!1),se=g.useRef(""),F=g.useRef(null),q=Ne(),ve=Ne(),W=X(()=>{ve.clear(),b.current.insideReactTree=!1}),R=X(S=>{const j=b.current.floatingContext?.nodeId;return(T?Fe(T.nodesRef.current,j):[]).some(ce=>ce.context?.open&&!ce.context.dataRef.current[S])}),Y=X(S=>He(S,f.select("floatingElement"))||He(S,f.select("domReferenceElement"))),oe=X(S=>{i()&&f.setOpen(!1,Pe(Jt,S.nativeEvent))}),ee=X(S=>{if(!k||!n||!r||S.key!=="Escape"||D.current||!E&&R("__escapeKeyBubbles"))return;const j=ln(S)?S.nativeEvent:S,ie=Pe(Zt,j);f.setOpen(!1,ie),ie.isCanceled||S.preventDefault(),!E&&!ie.isPropagationAllowed&&S.stopPropagation()}),te=X(()=>{b.current.insideReactTree=!0,ve.start(0,W)}),Ee=X(S=>{if(!k||!n||S.button!==0)return;const j=be(S.nativeEvent);C(f.select("floatingElement"),j)&&(B.current||(B.current=!0,$.current=!1))}),de=X(S=>{!k||!n||(S.defaultPrevented||S.nativeEvent.defaultPrevented)&&B.current&&($.current=!0)});g.useEffect(()=>{if(!k||!n)return;b.current.__escapeKeyBubbles=E,b.current.__outsidePressBubbles=Z;const S=new Le,j=new Le;function ie(){S.clear(),D.current=!0}function ce(){S.start(Je?5:0,()=>{D.current=!1})}function Oe(){J.current=!0,j.start(0,()=>{J.current=!1})}function Me(){B.current=!1,$.current=!1}function p(){const c=se.current,l=c==="pen"||!c?"mouse":c,V=y(),v=typeof V=="function"?V():V;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 Q(c){const l=b.current.floatingContext?.nodeId,V=T&&Fe(T.nodesRef.current,l).some(v=>He(c,v.context?.elements.floating));return Y(c)||V}function ge(c){if(ne(c)){c.type!=="click"&&!Y(c)&&(j.clear(),J.current=!1),W();return}if(b.current.insideReactTree){W();return}const l=be(c),V=`[${Xe("inert")}]`,v=Ie(l)?l.getRootNode():null,ue=Array.from((Ct(v)?v:K(f.select("floatingElement"))).querySelectorAll(V)),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=Qt(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),Be=tn(l),st=/auto|scroll/,At=re||st.test(Be.overflowX),Wt=re||st.test(Be.overflowY),Nt=At&&l.clientWidth>0&&l.scrollWidth>l.clientWidth,Lt=Wt&&l.clientHeight>0&&l.scrollHeight>l.clientHeight,Yt=Be.direction==="rtl",Bt=Lt&&(Yt?c.offsetX<=l.offsetWidth-l.clientWidth:c.offsetX>l.clientWidth),Ht=Nt&&c.offsetY>l.clientHeight;if(Bt||Ht)return}if(!Q(c)){if(p()==="intentional"&&J.current){j.clear(),J.current=!1;return}typeof P=="function"&&!P(c)||R("__outsidePressBubbles")||(f.setOpen(!1,Pe(It,c)),W())}}}function m(c){p()!=="sloppy"||c.pointerType==="touch"||!f.select("open")||!n||Y(c)||ge(c)}function I(c){if(p()!=="sloppy"||!f.select("open")||!n||Y(c))return;const l=c.touches[0];l&&(F.current={startTime:Date.now(),startX:l.clientX,startY:l.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},q.start(1e3,()=>{F.current&&(F.current.dismissOnTouchEnd=!1,F.current.dismissOnMouseDown=!1)}))}function N(c,l){const V=be(c);if(!V)return;const v=x(V,c.type,()=>{l(c),v()})}function G(c){se.current="touch",N(c,I)}function z(c){q.clear(),c.type==="pointerdown"&&(se.current=c.pointerType),!(c.type==="mousedown"&&F.current&&!F.current.dismissOnMouseDown)&&N(c,l=>{l.type==="pointerdown"?m(l):ge(l)})}function a(c){if(!B.current)return;const l=$.current;if(Me(),p()==="intentional"){if(c.type==="pointercancel"){l&&Oe();return}if(!Q(c)){if(l){Oe();return}typeof P=="function"&&!P(c)||(j.clear(),J.current=!0,W())}}}function O(c){if(p()!=="sloppy"||!F.current||Y(c))return;const l=c.touches[0];if(!l)return;const V=Math.abs(l.clientX-F.current.startX),v=Math.abs(l.clientY-F.current.startY),ue=Math.sqrt(V*V+v*v);ue>5&&(F.current.dismissOnTouchEnd=!0),ue>10&&(ge(c),q.clear(),F.current=null)}function d(c){N(c,O)}function M(c){p()!=="sloppy"||!F.current||Y(c)||(F.current.dismissOnTouchEnd&&ge(c),q.clear(),F.current=null)}function U(c){N(c,M)}const w=K(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",U,!0)));return()=>{Re(),S.clear(),j.clear(),Me(),J.current=!1}},[b,L,r,_,P,k,n,E,Z,ee,W,y,R,Y,T,f,q]),g.useEffect(W,[P,W]);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),H(()=>{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),H(()=>{if(!e&&o&&r!=="ending"&&n){const u=me.request(()=>{s("ending")});return()=>{me.cancel(u)}}},[e,o,r,n]),H(()=>{if(!e||t)return;const u=me.request(()=>{s(void 0)});return()=>{me.cancel(u)}},[t,e]),H(()=>{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=X(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 H(()=>{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");H(()=>{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=X(()=>{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),H(()=>()=>{e.update({activeTriggerProps:De,inactiveTriggerProps:De,popupProps:De})},[e])}function ar(e,t){H(()=>{!t&&e.state.openMethod!==null&&e.set("openMethod",null)},[t,e]),H(()=>()=>{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})({}),qe=(function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e})({});const xn={[qe.popupOpen]:""},In={[qe.popupOpen]:"",[qe.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",Wn="ArrowLeft",Nn="ArrowRight",Ln="Home",Yn="End",Bn=new Set([Wn,Nn]),Hn=new Set([Mn,An]),_n=new Set([...Bn,...Hn]),mr=new Set([..._n,Ln,Yn]),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=K(e);return Ye(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=K(e),r=n.documentElement,s=n.body,o=Qe(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 Un(e){const t=K(e),n=t.documentElement,r=t.body,s=Qe(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 Kn(e){const t=K(e),n=t.documentElement,r=t.body,s=Ye(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,Z=n.scrollWidth>n.clientWidth,B=T.overflowY==="scroll"||A.overflowY==="scroll",$=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),q=Qe(n)?n:r;if(u=Gn(e),u){n.style.scrollbarGutter=y,q.style.overflowY="hidden",q.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:y,overflowY:"hidden",overflowX:"hidden"}),(E||B)&&(n.style.overflowY="scroll"),(Z||$)&&(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 Vn{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=K(t).documentElement,s=Ye(r).getComputedStyle(r).overflowY;if(s==="hidden"||s==="clip"){this.restore=wt;return}const o=cn||!Dn(t);this.restore=o?Un(t):Kn(t)}}const Xn=new Vn;function Er(e=!0,t=null){H(()=>{if(e)return Xn.acquire(t)},[e,t])}export{pr as A,jn 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,Zn as d,ar as e,cr as f,ur as g,Qn as h,Er as i,lr as j,nr as k,Tn as l,wn as m,qn 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};
import{r as e,T as r,m as n,n as a,o as s}from"./__vite-browser-external-CuMc3dqk.js";const T=Object.freeze({mode:n.COMPACT,setMode:()=>{},formatTokens:(o,t={})=>s(o,t),formatTokensTooltip:(o,t={})=>a(o,t)});function f(){return e.useContext(r)??T}export{f as u};
import{j as e,c as a,M as I,N as R,r as u,p as $,R as E,d as M}from"./__vite-browser-external-CuMc3dqk.js";import{S as W}from"./Select-C6oiyYQ_.js";import{u as K,T as O}from"./use-native-settings-BkwcrMcE.js";import{F as L,S as D,a as G}from"./FadeIn-COsoZJXe.js";import{A as z}from"./arrow-up-right-D2tCxxHL.js";import{D as H}from"./download-zNMgxXgK.js";import"./ToolbarRootContext-xOR5ZEzv.js";import"./useScrollLock-DmM-LeMm.js";import"./check-Dy8VgHZ8.js";import"./SelectItemText-DrcW545o.js";import"./Card-C3Fxl-vL.js";import"./react-B80AX8fE.js";import"./use-reduced-motion-BEAopWkx.js";const U=["todayTokens","todayCost"],F=[{id:"todayTokens",label:"Today Tokens",shortLabel:"Tokens",category:"tokens"},{id:"todayCost",label:"Today Cost",shortLabel:"Cost",category:"cost"},{id:"last7dTokens",label:"Last 7 Days",shortLabel:"7d",category:"tokens"},{id:"totalTokens",label:"Total Tokens",shortLabel:"Total",category:"tokens"},{id:"totalCost",label:"Total Cost",shortLabel:"All $",category:"cost"},{id:"claude5h",label:"Claude 5h Limit",shortLabel:"Cl 5h",category:"limits"},{id:"claude7d",label:"Claude 7d Limit",shortLabel:"Cl 7d",category:"limits"},{id:"codex5h",label:"Codex 5h Limit",shortLabel:"Cx 5h",category:"limits"},{id:"codex7d",label:"Codex 7d Limit",shortLabel:"Cx 7d",category:"limits"},{id:"codexCredits",label:"Codex Credit Limit",shortLabel:"Cx Cred",category:"limits"},{id:"codexSpark5h",label:"Codex Spark 5h Limit",shortLabel:"Cx Spark 5h",category:"limits"},{id:"codexSpark7d",label:"Codex Spark 7d Limit",shortLabel:"Cx Spark 7d",category:"limits"},{id:"cursorPlan",label:"Cursor Plan Limit",shortLabel:"Cu Plan",category:"limits"},{id:"cursorAuto",label:"Cursor Auto Limit",shortLabel:"Cu Auto",category:"limits"},{id:"cursorAPI",label:"Cursor API Limit",shortLabel:"Cu API",category:"limits"},{id:"geminiPro",label:"Gemini Pro Limit",shortLabel:"Gm Pro",category:"limits"},{id:"geminiFlash",label:"Gemini Flash Limit",shortLabel:"Gm Flash",category:"limits"},{id:"geminiLite",label:"Gemini Lite Limit",shortLabel:"Gm Lite",category:"limits"},{id:"kimiWeekly",label:"Kimi Weekly Limit",shortLabel:"Km Wk",category:"limits"},{id:"kimi5h",label:"Kimi 5h Limit",shortLabel:"Km 5h",category:"limits"},{id:"kimiTotal",label:"Kimi Total Limit",shortLabel:"Km Tot",category:"limits"},{id:"kiroMonth",label:"Kiro Monthly Limit",shortLabel:"Kr Mo",category:"limits"},{id:"kiroBonus",label:"Kiro Bonus Limit",shortLabel:"Kr Bn",category:"limits"},{id:"copilotPremium",label:"Copilot Premium Limit",shortLabel:"Co Prem",category:"limits"},{id:"copilotChat",label:"Copilot Chat Limit",shortLabel:"Co Chat",category:"limits"},{id:"antigravityClaudeWeekly",label:"Antigravity Claude 7d Limit",shortLabel:"Ag Cl 7d",category:"limits"},{id:"antigravityClaude5h",label:"Antigravity Claude 5h Limit",shortLabel:"Ag Cl 5h",category:"limits"},{id:"antigravityGeminiWeekly",label:"Antigravity Gemini 7d Limit",shortLabel:"Ag Gm 7d",category:"limits"},{id:"antigravityGemini5h",label:"Antigravity Gemini 5h Limit",shortLabel:"Ag Gm 5h",category:"limits"}];function N(t,i=F,l=2){const s=new Set(i.map(n=>n.id)),o=new Set,r=Array.isArray(t)?t.filter(n=>!s.has(n)||o.has(n)?!1:(o.add(n),!0)):[];return(r.length>0?r:U).slice(0,Math.max(1,Number(l)||2))}const V=264,X=124,g="ui-rounded, -apple-system, system-ui",S=["#5A8CF2","#9973E6","#4DB8A6","#E68C59"],Y={claude:"#C77DFF",codex:"#34C759",cursor:"#FFCC00",gemini:"#0A84FF"};function Z(t){return t>=.9?"#E64D4D":t>=.7?"#D9A633":"#33B866"}function b({size:t="sm",children:i}){const l=t==="lg",s=l?560:264,o=l?32:22;return e.jsx("div",{className:M("flex w-full items-center justify-center rounded-xl bg-oai-gray-100 dark:bg-oai-gray-950/60",l?"py-10 sm:py-14 px-6":"py-6 px-4"),children:e.jsx("div",{className:"overflow-hidden bg-white dark:bg-oai-gray-800 shadow-oai-md dark:shadow-[0_2px_4px_rgba(0,0,0,0.4),0_8px_24px_rgba(0,0,0,0.5)]",style:{width:"100%",maxWidth:s,aspectRatio:`${V} / ${X}`,borderRadius:o},children:i})})}function q({size:t="sm"}){const i="M0,104 L14,104 C26,98 34,100 44,96 S58,88 68,92 80,100 90,94 102,80 112,82 126,92 136,88 150,74 162,76 178,88 188,86 204,72 216,74 236,84 250,80 L264,80",l=`${i} L264,124 L0,124 Z`,s=`sparkArea-${t}`;return e.jsx(b,{size:t,children:e.jsxs("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:s,x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"#0A84FF",stopOpacity:"0.18"}),e.jsx("stop",{offset:"100%",stopColor:"#0A84FF",stopOpacity:"0"})]})}),e.jsx("text",{x:"14",y:"20",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"700",letterSpacing:"0.6",children:a("widgets.preview.today")}),e.jsx("text",{x:"14",y:"46",className:"fill-oai-black dark:fill-white",fontSize:"22",fontWeight:"700",fontFamily:g,children:"203.2M"}),e.jsx("text",{x:"14",y:"60",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"500",fontFamily:g,children:"$129.56 ±0%"}),e.jsx("text",{x:"134",y:"20",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"700",letterSpacing:"0.6",children:a("widgets.preview.seven_days")}),e.jsx("text",{x:"134",y:"46",className:"fill-oai-black dark:fill-white",fontSize:"22",fontWeight:"700",fontFamily:g,children:"880.9M"}),e.jsx("text",{x:"134",y:"60",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"500",fontFamily:g,children:"$673.61"}),e.jsx("path",{d:l,fill:`url(#${s})`,stroke:"none"}),e.jsx("path",{d:i,fill:"none",stroke:"#0A84FF",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})})}const C=(()=>{const l=[];for(let s=0;s<26;s++)for(let o=0;o<7;o++){const r=Math.sin((s+1)*12.9898+(o+1)*78.233+17)*43758.5453,c=Math.floor(Math.abs(r-Math.floor(r))*100);l.push({w:s,d:o,v:c})}return l})();function _(t,i){return t<18?i?"#262626":"#e5e5e5":t<38?"rgba(10, 132, 255, 0.28)":t<58?"rgba(10, 132, 255, 0.50)":t<80?"rgba(10, 132, 255, 0.75)":"#0A84FF"}function J(){return e.jsx(b,{children:e.jsxs("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:[e.jsx("g",{transform:`translate(${19.5}, 10)`,className:"hidden dark:inline",children:C.map(r=>e.jsx("rect",{x:r.w*(7.5+1.2),y:r.d*(8+1.2),width:7.5,height:8,rx:"1.3",fill:_(r.v,!0)},`d-${r.w}-${r.d}`))}),e.jsx("g",{transform:`translate(${19.5}, 10)`,className:"dark:hidden",children:C.map(r=>e.jsx("rect",{x:r.w*(7.5+1.2),y:r.d*(8+1.2),width:7.5,height:8,rx:"1.3",fill:_(r.v,!1)},`l-${r.w}-${r.d}`))}),e.jsx("text",{x:19.5,y:"102",className:"fill-oai-black dark:fill-white",fontSize:"10",fontWeight:"700",fontFamily:g,children:"10.3B"}),e.jsx("text",{x:19.5+30,y:"102",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"9",fontWeight:"500",children:a("widgets.preview.heatmap_summary",{days:202})})]})})}function Q(){const t=[{name:"claude-opus-4-6",value:"586.4M",pct:59},{name:"claude-sonnet-4-5-20250929",value:"218.7M",pct:22},{name:"gpt-5.4",value:"80.6M",pct:8},{name:"composer-2-fast",value:"52.1M",pct:5}],i=22,l=28,s=14,o=236;return e.jsx(b,{children:e.jsx("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:t.map((r,c)=>{const n=l+c*i,h=S[c%S.length];return e.jsxs("g",{children:[e.jsx("circle",{cx:"18",cy:n-3,r:"2.5",fill:h}),e.jsx("text",{x:"26",y:n,className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"500",children:r.name}),e.jsx("text",{x:"218",y:n,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"9",fontWeight:"600",fontFamily:g,children:r.value}),e.jsxs("text",{x:"250",y:n,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"600",fontFamily:g,children:[r.pct,"%"]}),e.jsx("rect",{x:s,y:n+4,width:o,height:"2.8",rx:"1.4",className:"fill-oai-gray-200 dark:fill-oai-gray-700"}),e.jsx("rect",{x:s,y:n+4,width:Math.max(o*(r.pct/100),4),height:"2.8",rx:"1.4",fill:h})]},r.name)})})})}function ee(){const t=[{label:`${a("limits.provider.claude")} · ${a("limits.label.claude_7d")}`,source:"claude",reset:a("widgets.preview.reset_days",{days:1}),pct:61},{label:`${a("limits.provider.claude")} · ${a("limits.label.claude_5h")}`,source:"claude",reset:a("widgets.preview.reset_hours_minutes",{hours:4,minutes:28}),pct:4},{label:a("limits.provider.cursor"),source:"cursor",reset:a("widgets.preview.reset_days",{days:25}),pct:51},{label:`${a("limits.provider.codex")} · ${a("limits.label.codex_7d")}`,source:"codex",reset:a("widgets.preview.reset_days",{days:1}),pct:32}],i=22,l=28,s=14,o=236;return e.jsx(b,{children:e.jsx("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:t.map((r,c)=>{const n=l+c*i,h=Y[r.source],y=Z(r.pct/100);return e.jsxs("g",{children:[e.jsx("circle",{cx:"18",cy:n-3,r:"2.5",fill:h}),e.jsx("text",{x:"26",y:n,className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"500",children:r.label}),e.jsx("text",{x:"218",y:n,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"500",fontFamily:g,children:r.reset}),e.jsxs("text",{x:"250",y:n,textAnchor:"end",className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"700",fontFamily:g,children:[r.pct,"%"]}),e.jsx("rect",{x:s,y:n+4,width:o,height:"2.8",rx:"1.4",className:"fill-oai-gray-200 dark:fill-oai-gray-700"}),e.jsx("rect",{x:s,y:n+4,width:Math.max(o*(r.pct/100),4),height:"2.8",rx:"1.4",fill:y})]},r.label)})})})}function te(t){switch(t.category){case"cost":return"$8.42";case"limits":return"62%";default:return t.id==="last7dTokens"?"1.8B":"203M"}}function ae(t,i){switch(t){case"todayTokens":return a("menubar.metric.today_tokens");case"todayCost":return a("menubar.metric.today_cost");case"last7dTokens":return a("menubar.metric.last_7d_tokens");case"totalTokens":return a("menubar.metric.total_tokens");case"totalCost":return a("menubar.metric.total_cost");case"claude5h":return a("menubar.metric.claude_5h");case"claude7d":return a("menubar.metric.claude_7d");case"codex5h":return a("menubar.metric.codex_5h");case"codex7d":return a("menubar.metric.codex_7d");case"codexCredits":return a("menubar.metric.codex_credits");case"codexSpark5h":return a("menubar.metric.codex_spark_5h");case"codexSpark7d":return a("menubar.metric.codex_spark_7d");default:return i}}function ie(t,i){const l=new Set(i.map(o=>o.id)),s=t.filter(o=>l.has(o));for(const o of i){if(s.length>=2)break;s.includes(o.id)||s.push(o.id)}return s.slice(0,2)}function se({slotConfigs:t,showStats:i}){return e.jsx("div",{className:"flex justify-center rounded-xl bg-gradient-to-b from-oai-gray-100 to-oai-gray-200 px-6 py-8 dark:from-oai-gray-950/80 dark:to-oai-gray-900/80",children:e.jsxs("div",{className:"inline-flex items-stretch rounded-md shadow-[0_1px_3px_rgba(0,0,0,0.18)] ring-1 ring-black/10 dark:ring-white/10 px-3",style:{background:"linear-gradient(180deg, #2c2c2e 0%, #1c1c1e 100%)"},children:[e.jsx("div",{className:"flex items-center pl-2 pr-1 py-2.5",children:e.jsx("img",{src:"/clawd/mini/idle-tight.svg",alt:"","aria-hidden":"true",className:"block shrink-0",style:{height:22,width:"auto"},draggable:"false"})}),i?t.map(({slot:l,item:s},o)=>e.jsxs(E.Fragment,{children:[o>0?e.jsx("span",{className:"my-1 w-px bg-white/20","aria-hidden":"true"}):null,e.jsxs("div",{className:M("flex min-w-[52px] flex-col items-center justify-center py-1.5",o===0?"pl-1 pr-2":"px-2"),children:[e.jsx("span",{className:"text-[13px] font-semibold leading-none tabular-nums text-white",children:s?.previewValue||"--"}),e.jsx("span",{className:"mt-[2px] text-[6px] font-semibold uppercase leading-none text-white/75",children:s?.shortLabel||a("widgets.preview.metric")})]})]},l)):null]})})}function re({slot:t,value:i,options:l,disabled:s,onChange:o}){const r=t===0?a("menubar.slot.primary"):a("menubar.slot.secondary");return e.jsxs("div",{className:"flex min-w-0 flex-col gap-1.5",children:[e.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-[0.08em] text-oai-gray-500 dark:text-oai-gray-400",children:r}),e.jsx(W,{value:i,disabled:s,ariaLabel:r,onValueChange:c=>o(t,c),options:l.map(c=>({value:c.id,label:c.displayLabel})),matchTriggerWidth:!0,className:"w-full px-3 py-2 text-sm font-medium"})]})}function p({label:t,hint:i,checked:l,disabled:s,onChange:o}){return e.jsxs("div",{className:"flex items-center justify-between gap-3 py-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-oai-black dark:text-white",children:t}),i?e.jsx("p",{className:"mt-0.5 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:i}):null]}),e.jsx(O,{checked:l,disabled:s,onChange:o,ariaLabel:t})]})}function le({label:t,hint:i,value:l,options:s,disabled:o,onChange:r}){return e.jsxs("div",{className:"flex items-center justify-between gap-3 py-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-oai-black dark:text-white",children:t}),i?e.jsx("p",{className:"mt-0.5 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:i}):null]}),e.jsx(W,{value:l,disabled:o,ariaLabel:t,onValueChange:r,options:s,className:"shrink-0 px-3 py-2 text-sm font-medium"})]})}function oe(){const{available:t,settings:i,setSetting:l}=K(),s=u.useMemo(()=>(Array.isArray(i?.menuBarAvailableItems)?i.menuBarAvailableItems:F).map(m=>({...m,displayLabel:ae(m.id,m.label),previewValue:te(m)})),[i?.menuBarAvailableItems]),o=Number(i?.menuBarMaxItems)||2,r=u.useMemo(()=>N(i?.menuBarItems,s,o),[s,o,i?.menuBarItems]),c=u.useMemo(()=>ie(r,s),[s,r]),n=i?.showStats!==!1,h=d=>{l("menuBarItems",N(d,s,o))},y=(d,m)=>{const x=[...c];x[d===0?1:0]!==m&&(x[d]=m,h(x))},w=[0,1].map(d=>{const m=c[d]||s[d]?.id||"",v=c[d===0?1:0],B=s.filter(f=>f.id===m||f.id!==v),P=s.find(f=>f.id===m);return{slot:d,currentValue:m,options:B,item:P}}),T=["clawd","cat","pet","static"].includes(i?.menuBarIconStyle)?i.menuBarIconStyle:"clawd",k=i?.toastOnReset!==!1,j=i?.confettiOnReset!==!1;return e.jsxs("article",{className:"rounded-xl border border-oai-gray-200 bg-white p-5 transition-colors duration-200 dark:border-oai-gray-800 dark:bg-oai-gray-900 sm:p-6",children:[e.jsx(se,{slotConfigs:w,showStats:n}),e.jsx("div",{className:"mt-5 grid grid-cols-1 gap-3 sm:grid-cols-2 sm:gap-4",children:w.map(({slot:d,currentValue:m,options:x})=>e.jsx(re,{slot:d,value:m,options:x,disabled:!t||!n,onChange:y},d))}),e.jsxs("div",{className:"mt-5 divide-y divide-oai-gray-100 border-t border-oai-gray-100 dark:divide-oai-gray-800 dark:border-oai-gray-800",children:[e.jsx(p,{label:a("settings.menubar.showStats"),hint:t?a("settings.menubar.showStatsHint"):a("menubar.native_only"),checked:n,disabled:!t,onChange:()=>l("showStats",!n)}),e.jsx(le,{label:a("settings.menubar.iconStyle"),hint:a("settings.menubar.iconStyleHint"),value:T,disabled:!t,options:[{value:"clawd",label:a("settings.menubar.iconStyle.clawd")},{value:"cat",label:a("settings.menubar.iconStyle.cat")},{value:"pet",label:a("settings.menubar.iconStyle.pet")},{value:"static",label:a("settings.menubar.iconStyle.static")}],onChange:d=>l("menuBarIconStyle",d)}),e.jsx(p,{label:a("settings.menubar.toastOnReset"),hint:a("settings.menubar.toastOnResetHint"),checked:k,disabled:!t,onChange:()=>l("toastOnReset",!k)}),e.jsx(p,{label:a("settings.menubar.confettiOnReset"),hint:a("settings.menubar.confettiOnResetHint"),checked:j,disabled:!t,onChange:()=>l("confettiOnReset",!j)})]})]})}function ne(){const[t,i]=u.useState("loading");return u.useEffect(()=>{if(typeof window>"u")return;if($()){i("native");return}const l=(navigator.userAgent||"").toLowerCase(),s=/mac/.test(l)&&!/iphone|ipad/.test(l);i(s?"mac-web":"other")},[]),t}function ce(){const t=ne();return t==="loading"?e.jsx("div",{className:"h-10 w-40","aria-hidden":"true"}):t==="native"?e.jsxs("button",{type:"button",onClick:()=>I("openWidgetGallery"),className:"inline-flex h-10 items-center gap-2 rounded-lg bg-oai-black px-4 text-sm font-medium text-white transition-colors hover:bg-oai-gray-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 focus-visible:ring-offset-2 dark:bg-white dark:text-oai-black dark:hover:bg-oai-gray-200",children:[a("widgets.cta.open_gallery"),e.jsx(z,{className:"h-4 w-4","aria-hidden":"true"})]}):t==="mac-web"?e.jsxs("a",{href:"https://github.com/mm7894215/TokenTracker/releases/latest",target:"_blank",rel:"noopener noreferrer",className:"inline-flex h-10 items-center gap-2 rounded-lg bg-oai-black px-4 text-sm font-medium text-white no-underline transition-colors hover:bg-oai-gray-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 focus-visible:ring-offset-2 dark:bg-white dark:text-oai-black dark:hover:bg-oai-gray-200",children:[e.jsx(H,{className:"h-4 w-4","aria-hidden":"true"}),a("widgets.cta.download")]}):e.jsxs("span",{className:"inline-flex h-10 items-center gap-2 rounded-lg border border-oai-gray-200 bg-oai-gray-50 px-4 text-sm font-medium text-oai-gray-500 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-oai-gray-400",children:[e.jsx(R,{className:"h-4 w-4","aria-hidden":"true"}),a("widgets.cta.macos_only")]})}const de=[{id:"summary",Preview:q,nameKey:"widgets.summary.name",descKey:"widgets.summary.description"},{id:"heatmap",Preview:J,nameKey:"widgets.heatmap.name",descKey:"widgets.heatmap.description"},{id:"topModels",Preview:Q,nameKey:"widgets.topModels.name",descKey:"widgets.topModels.description"},{id:"limits",Preview:ee,nameKey:"widgets.limits.name",descKey:"widgets.limits.description"}];function me({Preview:t,nameKey:i,descKey:l}){return e.jsxs("article",{className:"flex h-full flex-col rounded-xl border border-oai-gray-200 bg-white p-4 transition-colors duration-200 dark:border-oai-gray-800 dark:bg-oai-gray-900 sm:p-5",children:[e.jsx(t,{}),e.jsxs("div",{className:"mt-4",children:[e.jsx("h3",{className:"text-[15px] font-semibold text-oai-black dark:text-white",children:a(i)}),e.jsx("p",{className:"mt-1.5 text-sm leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:a(l)})]})]})}function A({titleKey:t}){return e.jsx("h2",{className:"mb-4 text-xl font-semibold tracking-tight text-oai-black dark:text-white sm:mb-5 sm:text-2xl",children:a(t)})}function Se(){return e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:e.jsxs("div",{className:"mx-auto max-w-5xl px-4 sm:px-6",children:[e.jsx(L,{y:12,children:e.jsxs("header",{className:"mb-10 flex items-start justify-between gap-4 sm:mb-12",children:[e.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:a("widgets.page.title")}),e.jsx("div",{className:"shrink-0",children:e.jsx(ce,{})})]})}),e.jsx(L,{y:12,delay:.06,children:e.jsxs("section",{"aria-label":a("widgets.menubar.section.title"),className:"mb-12 sm:mb-14",children:[e.jsx(A,{titleKey:"widgets.menubar.section.title"}),e.jsx(oe,{})]})}),e.jsxs("section",{"aria-label":a("widgets.gallery.section.title"),children:[e.jsx(A,{titleKey:"widgets.gallery.section.title"}),e.jsx(D,{staggerDelay:.08,initialDelay:.04,children:e.jsx("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-2 lg:gap-5",children:de.map(({id:t,Preview:i,nameKey:l,descKey:s})=>e.jsx(G,{children:e.jsx(me,{Preview:i,nameKey:l,descKey:s})},t))})})]})]})})})}export{Se as WidgetsPage};
import{r as x,j as e,c as s,i as j,k as f}from"./__vite-browser-external-CuMc3dqk.js";function c(a){return Number.isFinite(a)?Math.abs(a)>=1e12?(a/1e12).toFixed(2).replace(/\.?0+$/,"")+"T":f(a,{decimals:2}):"0"}function o({children:a,accent:d=!1,className:n=""}){const l="rounded-2xl border border-oai-gray-200 dark:border-oai-gray-800 p-6 bg-white dark:bg-oai-gray-900",p=d?"bg-gradient-to-br from-emerald-50 to-cyan-50 dark:from-emerald-900/30 dark:to-cyan-900/30 border-transparent":"";return e.jsx("div",{className:`${l} ${p} ${n}`,children:a})}function N(){const[a,d]=x.useState(null),[n,l]=x.useState("loading"),[p,y]=x.useState("");if(x.useEffect(()=>{let t=!1;const g=new URLSearchParams(window.location.search).get("year"),k=g?`/functions/tokentracker-wrapped?year=${encodeURIComponent(g)}`:"/functions/tokentracker-wrapped";return fetch(k).then(async r=>{if(!r.ok)throw new Error(`HTTP ${r.status}`);return r.json()}).then(r=>{t||(d(r),l(r.totals&&r.totals.tokens>0?"ready":"empty"))}).catch(r=>{t||(y(String(r?.message||r)),l("error"))}),()=>{t=!0}},[]),n==="loading")return e.jsx("div",{className:"min-h-screen bg-white dark:bg-oai-gray-950 flex items-center justify-center",children:e.jsx("p",{className:"text-oai-gray-500",children:s("wrapped.loading")})});if(n==="error")return e.jsx("div",{className:"min-h-screen bg-white dark:bg-oai-gray-950 flex items-center justify-center px-6",children:e.jsx(o,{children:e.jsx("p",{className:"text-red-600 dark:text-red-300",children:s("wrapped.error",{error:p})})})});if(n==="empty"||!a)return e.jsx("div",{className:"min-h-screen bg-white dark:bg-oai-gray-950 flex items-center justify-center px-6",children:e.jsx(o,{children:e.jsx("p",{className:"text-oai-gray-500",children:s("wrapped.empty",{command:"tracker sync"})})})});const m=t=>`${(t*100).toFixed(0)}%`,u=j(),i=[];if(a.top.models.length>0){const t=a.top.models[0];i.push(s("wrapped.highlight.model",{model:t.model,percent:(t.share*100).toFixed(0)}))}if(a.top.days.length>0){const t=a.top.days[0];i.push(s("wrapped.highlight.day",{day:t.day,tokens:c(t.tokens)}))}return a.peak_hour&&i.push(s("wrapped.highlight.hour",{hour:String(a.peak_hour.hour).padStart(2,"0")})),a.longest_streak?.days>=2&&i.push(s("wrapped.highlight.streak",{days:a.longest_streak.days})),a.totals.sources>=4&&i.push(s("wrapped.highlight.tools",{count:a.totals.sources})),e.jsx("div",{className:"min-h-screen bg-gradient-to-b from-white to-oai-gray-50 dark:from-oai-gray-950 dark:to-oai-gray-900 px-6 py-12",children:e.jsxs("div",{className:"max-w-3xl mx-auto space-y-6",children:[e.jsxs("header",{className:"text-center pb-6",children:[e.jsx("p",{className:"text-sm uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400",children:s("wrapped.kicker")}),e.jsx("h1",{className:"text-6xl font-bold text-oai-gray-900 dark:text-white mt-2",children:a.year})]}),e.jsxs(o,{accent:!0,className:"text-center",children:[e.jsx("p",{className:"text-xs uppercase tracking-widest text-oai-gray-600 dark:text-oai-gray-300",children:s("wrapped.total_tokens")}),e.jsx("p",{className:"text-7xl font-bold text-emerald-700 dark:text-emerald-300 mt-2",children:c(a.totals.tokens)}),e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400 mt-4",children:s("wrapped.summary",{conversations:a.totals.conversations.toLocaleString(u),days:a.totals.active_days,tools:a.totals.sources})})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs(o,{children:[e.jsx("h3",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400 mb-4",children:s("wrapped.top_tools")}),e.jsx("ul",{className:"space-y-3",children:a.top.sources.slice(0,5).map(t=>e.jsxs("li",{className:"flex items-baseline justify-between",children:[e.jsx("span",{className:"text-oai-gray-900 dark:text-white",children:t.source}),e.jsxs("span",{className:"text-oai-gray-500 dark:text-oai-gray-400 font-mono text-sm",children:[c(t.tokens)," · ",m(t.share)]})]},t.source))})]}),e.jsxs(o,{children:[e.jsx("h3",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400 mb-4",children:s("wrapped.top_models")}),e.jsx("ul",{className:"space-y-3",children:a.top.models.slice(0,5).map(t=>e.jsxs("li",{className:"flex items-baseline justify-between",children:[e.jsx("span",{className:"text-oai-gray-900 dark:text-white truncate pr-3",children:t.model}),e.jsxs("span",{className:"text-oai-gray-500 dark:text-oai-gray-400 font-mono text-sm whitespace-nowrap",children:[c(t.tokens)," · ",m(t.share)]})]},t.model))})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.peak_hour&&e.jsxs(o,{children:[e.jsx("p",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400",children:s("wrapped.peak_hour")}),e.jsxs("p",{className:"text-4xl font-semibold text-oai-gray-900 dark:text-white mt-2",children:[String(a.peak_hour.hour).padStart(2,"0"),":00 UTC"]}),e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400 mt-1",children:s("wrapped.tokens",{count:c(a.peak_hour.tokens)})})]}),a.longest_streak&&a.longest_streak.days>0&&e.jsxs(o,{children:[e.jsx("p",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400",children:s("wrapped.longest_streak")}),e.jsx("p",{className:"text-4xl font-semibold text-oai-gray-900 dark:text-white mt-2",children:s("wrapped.days",{count:a.longest_streak.days})}),e.jsxs("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400 mt-1",children:[a.longest_streak.from," → ",a.longest_streak.to]})]})]}),a.top.days.length>0&&e.jsxs(o,{children:[e.jsx("h3",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400 mb-4",children:s("wrapped.top_days")}),e.jsx("ul",{className:"space-y-2",children:a.top.days.slice(0,5).map(t=>e.jsxs("li",{className:"flex items-baseline justify-between",children:[e.jsx("span",{className:"text-oai-gray-900 dark:text-white font-mono text-sm",children:t.day}),e.jsx("span",{className:"text-oai-gray-500 dark:text-oai-gray-400 font-mono text-sm",children:c(t.tokens)})]},t.day))})]}),i.length>0&&e.jsxs(o,{accent:!0,children:[e.jsx("h3",{className:"text-xs uppercase tracking-widest text-oai-gray-600 dark:text-oai-gray-300 mb-3",children:s("wrapped.highlights")}),e.jsx("ul",{className:"space-y-2 text-oai-gray-800 dark:text-oai-gray-200",children:i.map((t,h)=>e.jsxs("li",{className:"text-base",children:["· ",t]},h))})]}),e.jsx("footer",{className:"text-center text-xs text-oai-gray-400 dark:text-oai-gray-500 pt-6",children:s("wrapped.footer",{command:"tracker wrapped --json"})})]})})}export{N as default};
import{l as a}from"./__vite-browser-external-CuMc3dqk.js";const o=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],e=a("zap",o);export{e as Z};
+1
-1

@@ -260,3 +260,3 @@ <!doctype html>

</script>
<script type="module" crossorigin src="/assets/__vite-browser-external-CeOnjjgl.js"></script>
<script type="module" crossorigin src="/assets/__vite-browser-external-CuMc3dqk.js"></script>
<link rel="stylesheet" crossorigin href="/assets/__vite-browser-external-WKilYZnq.css">

@@ -263,0 +263,0 @@ </head>

@@ -168,3 +168,3 @@ <!doctype html>

</script>
<script type="module" crossorigin src="/assets/__vite-browser-external-CeOnjjgl.js"></script>
<script type="module" crossorigin src="/assets/__vite-browser-external-CuMc3dqk.js"></script>
<link rel="stylesheet" crossorigin href="/assets/__vite-browser-external-WKilYZnq.css">

@@ -171,0 +171,0 @@ </head>

@@ -139,3 +139,3 @@ <!doctype html>

</script>
<script type="module" crossorigin src="/assets/__vite-browser-external-CeOnjjgl.js"></script>
<script type="module" crossorigin src="/assets/__vite-browser-external-CuMc3dqk.js"></script>
<link rel="stylesheet" crossorigin href="/assets/__vite-browser-external-WKilYZnq.css">

@@ -142,0 +142,0 @@ </head>

@@ -78,3 +78,3 @@ <!doctype html>

</script>
<script type="module" crossorigin src="/assets/__vite-browser-external-CeOnjjgl.js"></script>
<script type="module" crossorigin src="/assets/__vite-browser-external-CuMc3dqk.js"></script>
<link rel="stylesheet" crossorigin href="/assets/__vite-browser-external-WKilYZnq.css">

@@ -81,0 +81,0 @@ </head>

{
"name": "tokentracker-cli",
"version": "0.84.1",
"version": "0.84.2",
"description": "Local-first AI coding token usage and cost tracker for 27 tools, with a dashboard, desktop pet, widgets, achievements, and native macOS/Windows apps.",

@@ -5,0 +5,0 @@ "main": "src/cli.js",

@@ -265,3 +265,4 @@ <div align="center">

| `TOKENTRACKER_HTTP_TIMEOUT_MS` | HTTP-Timeout in Millisekunden | `20000` |
| `TOKENTRACKER_DISABLE_GIT_ATTRIBUTION` | Git-Commit-Zuordnung deaktivieren (`1` zum Deaktivieren). Die Zuordnung führt `git log` im Arbeitsverzeichnis jeder jüngeren Sitzung aus; unter macOS kann das pro geschütztem Ort (Dokumente, Downloads, Daten anderer Apps) einen eigenen Zugriffsdialog auslösen. Deaktiviert bleibt TokenTracker vollständig aus deinen Projektverzeichnissen heraus (Outcomes zeigt dann nur manuell erfasste Ergebnisse) | — |
| `TOKENTRACKER_DISABLE_GIT_ATTRIBUTION` | Git-Commit-Zuordnung deaktivieren (`1` zum Deaktivieren). Die Zuordnung führt `git log` im Arbeitsverzeichnis jeder jüngeren Sitzung aus. Deaktiviert bleibt TokenTracker vollständig aus deinen Projektverzeichnissen heraus (Outcomes zeigt dann nur manuell erfasste Ergebnisse) | — |
| `TOKENTRACKER_GIT_ATTRIBUTION_PROTECTED_DIRS` | Der Git-Zuordnung Zugriff auf TCC-geschützte macOS-Orte erlauben (`1` zum Erlauben). Standardmäßig werden Sitzungen unter `~/Documents`, `~/Downloads`, `~/Desktop`, `~/Library`, den Medienordnern und `/Volumes` übersprungen, weil macOS für jeden Ort einen eigenen Zugriffsdialog anzeigt. Nur aktivieren, wenn du dort Repositories liegen hast und den Zugriff gewähren möchtest | — |
| `TOKENTRACKER_WSL_MODE` | WSL-Installations-Auflösungsverhalten unter Windows (zur Aggregation von nativen und WSL-Installationen). `wsl-first` (bevorzugt WSL), `native-first`, `wsl-only`, `native-only`, `both` (aggregiert beide Installationen) | `wsl-first` |

@@ -268,0 +269,0 @@ | `CODEX_HOME` | Codex CLI-Verzeichnis überschreiben | `~/.codex` |

@@ -262,3 +262,4 @@ <div align="center">

| `TOKENTRACKER_HTTP_TIMEOUT_MS` | HTTP タイムアウト(ミリ秒) | `20000` |
| `TOKENTRACKER_DISABLE_GIT_ATTRIBUTION` | Git コミットの紐付けを無効化(`1` で無効)。紐付けは各セッションの作業ディレクトリ内で `git log` を実行するため、macOS では保護された場所(書類、ダウンロード、他アプリのデータ)ごとにアクセス許可ダイアログが出ることがあります。無効にすると TokenTracker はプロジェクトディレクトリに一切入りません(Outcomes は手動記録分のみ表示) | — |
| `TOKENTRACKER_DISABLE_GIT_ATTRIBUTION` | Git コミットの紐付けを無効化(`1` で無効)。紐付けは各セッションの作業ディレクトリ内で `git log` を実行します。無効にすると TokenTracker はプロジェクトディレクトリに一切入りません(Outcomes は手動記録分のみ表示) | — |
| `TOKENTRACKER_GIT_ATTRIBUTION_PROTECTED_DIRS` | Git 紐付けが macOS の保護された場所に入ることを許可(`1` で許可)。既定では `~/Documents`、`~/Downloads`、`~/Desktop`、`~/Library`、メディアフォルダ、`/Volumes` 配下のセッションをスキップします。macOS は場所ごとに個別のアクセス許可ダイアログを出すためです。これらの場所にリポジトリを置いており、許可しても構わない場合のみ有効化してください | — |
| `CODEX_HOME` | Codex CLI ディレクトリの上書き | `~/.codex` |

@@ -265,0 +266,0 @@ | `GEMINI_HOME` | Gemini CLI ディレクトリの上書き | `~/.gemini` |

@@ -262,3 +262,4 @@ <div align="center">

| `TOKENTRACKER_HTTP_TIMEOUT_MS` | HTTP 타임아웃 (밀리초) | `20000` |
| `TOKENTRACKER_DISABLE_GIT_ATTRIBUTION` | Git 커밋 연결 비활성화(`1`이면 비활성화). 연결 기능은 각 세션의 작업 디렉터리에서 `git log`를 실행하므로 macOS에서는 보호된 위치(문서, 다운로드, 다른 앱 데이터)마다 접근 허용 대화상자가 나타날 수 있습니다. 비활성화하면 TokenTracker가 프로젝트 디렉터리에 접근하지 않습니다(Outcomes에는 수동 기록만 표시) | — |
| `TOKENTRACKER_DISABLE_GIT_ATTRIBUTION` | Git 커밋 연결 비활성화(`1`이면 비활성화). 연결 기능은 각 세션의 작업 디렉터리에서 `git log`를 실행합니다. 비활성화하면 TokenTracker가 프로젝트 디렉터리에 전혀 접근하지 않습니다(Outcomes에는 수동 기록만 표시) | — |
| `TOKENTRACKER_GIT_ATTRIBUTION_PROTECTED_DIRS` | Git 연결이 macOS 보호 위치에 접근하도록 허용(`1`이면 허용). 기본적으로 `~/Documents`, `~/Downloads`, `~/Desktop`, `~/Library`, 미디어 폴더, `/Volumes` 아래의 세션은 건너뜁니다. macOS가 위치마다 별도의 접근 허용 대화상자를 띄우기 때문입니다. 해당 위치에 저장소를 두고 있고 권한을 허용해도 괜찮을 때만 켜세요 | — |
| `CODEX_HOME` | Codex CLI 디렉토리 오버라이드 | `~/.codex` |

@@ -265,0 +266,0 @@ | `GEMINI_HOME` | Gemini CLI 디렉토리 오버라이드 | `~/.gemini` |

@@ -315,3 +315,4 @@ <div align="center">

| `TOKENTRACKER_HTTP_TIMEOUT_MS` | HTTP timeout in milliseconds | `20000` |
| `TOKENTRACKER_DISABLE_GIT_ATTRIBUTION` | Skip Git commit attribution (`1` to disable). Attribution runs `git log` inside the working directory of each recent session; on macOS that can raise a folder-access prompt per protected location (Documents, Downloads, another app's data). Disabling keeps TokenTracker out of your project directories — the Outcomes view then shows only manually recorded outcomes | — |
| `TOKENTRACKER_DISABLE_GIT_ATTRIBUTION` | Skip Git commit attribution (`1` to disable). Attribution runs `git log` inside the working directory of each recent session. Disabling keeps TokenTracker out of your project directories entirely — the Outcomes view then shows only manually recorded outcomes | — |
| `TOKENTRACKER_GIT_ATTRIBUTION_PROTECTED_DIRS` | Let Git attribution enter macOS TCC-protected locations (`1` to allow). By default sessions under `~/Documents`, `~/Downloads`, `~/Desktop`, `~/Library`, the media folders and `/Volumes` are skipped, because macOS raises a separate folder-access prompt for each one. Enable this only if you keep repositories there and don't mind granting access | — |
| `TOKENTRACKER_WSL_MODE` | WSL install resolution behavior on Windows (for aggregating native and WSL installations). `wsl-first` (prefer WSL), `native-first`, `wsl-only`, `native-only`, `both` (aggregate both installs) | `wsl-first` |

@@ -318,0 +319,0 @@ | `CODEX_HOME` | Override Codex CLI directory | `~/.codex` |

@@ -264,3 +264,4 @@ <div align="center">

| `TOKENTRACKER_HTTP_TIMEOUT_MS` | HTTP 超时时间(毫秒) | `20000` |
| `TOKENTRACKER_DISABLE_GIT_ATTRIBUTION` | 关闭 Git 提交归因(设为 `1` 关闭)。归因会在每个近期会话的工作目录里执行 `git log`;在 macOS 上,每个受保护位置(文稿、下载、其他 App 的数据)都可能各弹一次访问授权提示。关闭后 TokenTracker 不会进入你的项目目录(Outcomes 页只显示手动记录的结果) | — |
| `TOKENTRACKER_DISABLE_GIT_ATTRIBUTION` | 关闭 Git 提交归因(设为 `1` 关闭)。归因会在每个近期会话的工作目录里执行 `git log`。关闭后 TokenTracker 完全不会进入你的项目目录(Outcomes 页只显示手动记录的结果) | — |
| `TOKENTRACKER_GIT_ATTRIBUTION_PROTECTED_DIRS` | 允许 Git 归因进入 macOS 受保护目录(设为 `1` 允许)。默认会跳过 `~/Documents`、`~/Downloads`、`~/Desktop`、`~/Library`、影片/音乐/图片以及 `/Volumes` 下的会话,因为 macOS 会为每个位置单独弹一次访问授权提示。只有当你确实把仓库放在这些目录、且不介意授权时才需要开启 | — |
| `CODEX_HOME` | 覆盖 Codex CLI 目录 | `~/.codex` |

@@ -267,0 +268,0 @@ | `GEMINI_HOME` | 覆盖 Gemini CLI 目录 | `~/.gemini` |

@@ -73,13 +73,25 @@ "use strict";

// serve the cached sidecar without entering a single project directory.
function sessionsFingerprint(sessions, cutoff, maxAgeDays) {
function sessionsFingerprint(sessions, maxAgeDays) {
const hash = crypto.createHash("sha256");
hash.update(`v1\0${maxAgeDays}\n`);
const rows = [];
const rows = sessions.map(
(session) => `${session.project_ref}\0${session.session_hash}\0${session.started_at}\0${session.ended_at}`,
);
for (const row of rows.sort()) hash.update(`${row}\n`);
return hash.digest("hex");
}
// The sessions attribution is allowed to look at. Filtering here — before the
// fingerprint and before any filesystem access — keeps the cache signature and
// the probe set in agreement, so a skipped directory is never entered and never
// invalidates the cache either.
function attributableSessions(sessions, cutoff, home) {
const kept = [];
for (const session of sessions || []) {
if (!session?.project_ref || !session.started_at || !session.ended_at) continue;
if (Date.parse(session.ended_at) < cutoff) continue;
rows.push(`${session.project_ref}\0${session.session_hash}\0${session.started_at}\0${session.ended_at}`);
if (isTccProtectedPath(session.project_ref, home)) continue;
kept.push(session);
}
for (const row of rows.sort()) hash.update(`${row}\n`);
return hash.digest("hex");
return kept;
}

@@ -91,2 +103,25 @@

// macOS gates these locations behind TCC: the first access to each one raises
// its own "TokenTracker would like to access data in …" consent dialog, and
// ad-hoc signing resets that consent on every update, so the dialogs come back
// each time. Attribution is an opt-in beta that walks into whatever directory a
// session happened to run in — a token tracker has no business making the OS
// ask for ~/Documents. Skip these by default; anyone who keeps repos there can
// opt back in and answer the prompts knowingly.
const TCC_PROTECTED_HOME_DIRS = ["Documents", "Downloads", "Desktop", "Movies", "Music", "Pictures", "Library"];
function protectedProbeAllowed() {
return ["1", "true"].includes(String(process.env.TOKENTRACKER_GIT_ATTRIBUTION_PROTECTED_DIRS || "").toLowerCase());
}
function isTccProtectedPath(target, home) {
if (process.platform !== "darwin" || protectedProbeAllowed()) return false;
const resolved = path.resolve(String(target || ""));
if (resolved === "/Volumes" || resolved.startsWith("/Volumes/")) return true;
const base = path.resolve(String(home || ""));
if (resolved !== base && !resolved.startsWith(`${base}${path.sep}`)) return false;
const [first] = path.relative(base, resolved).split(path.sep);
return TCC_PROTECTED_HOME_DIRS.includes(first);
}
async function buildGitOutcomesInternal(sessions, { home = os.homedir(), force = false, maxAgeDays = 90 } = {}) {

@@ -103,3 +138,4 @@ const outputPath = resolveAutoOutcomesPath(home);

// the last probe is recent, so there is nothing new to attribute.
const sessionSignature = sessionsFingerprint(sessions, cutoff, maxAgeDays);
const candidates = attributableSessions(sessions, cutoff, home);
const sessionSignature = sessionsFingerprint(candidates, maxAgeDays);
if (!force) {

@@ -123,5 +159,3 @@ try {

const rootCache = new Map();
for (const session of sessions || []) {
if (!session?.project_ref || !session.started_at || !session.ended_at) continue;
if (Date.parse(session.ended_at) < cutoff) continue;
for (const session of candidates) {
let root = rootCache.get(session.project_ref);

@@ -128,0 +162,0 @@ if (root === undefined) {

Sorry, the diff of this file is too big to display

import{l as o,R as N,j as r}from"./__vite-browser-external-CeOnjjgl.js";import{Z as $}from"./zap-D0DQz21w.js";import{F as A}from"./flame-BEU-cqaV.js";const j=[["path",{d:"M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2",key:"1ah6g2"}],["rect",{x:"14",y:"2",width:"8",height:"8",rx:"1",key:"88lufb"}]],E=o("blocks",j);const L=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],C=o("brain",L);const T=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]],z=o("calendar-days",T);const B=[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]],R=o("crown",B);const q=[["path",{d:"M12.67 19a2 2 0 0 0 1.416-.588l6.154-6.172a6 6 0 0 0-8.49-8.49L5.586 9.914A2 2 0 0 0 5 11.328V18a1 1 0 0 0 1 1z",key:"18jl4k"}],["path",{d:"M16 8 2 22",key:"vp34q"}],["path",{d:"M17.5 15H9",key:"1oz8nu"}]],H=o("feather",q);const D=[["path",{d:"M18 19a5 5 0 0 1-5-5v8",key:"sz5oeg"}],["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]],F=o("folder-git-2",D);const I=[["path",{d:"M4 16v-2.38C4 11.5 2.97 10.5 3 8c.03-2.72 1.49-6 4.5-6C9.37 2 10 3.8 10 5.5c0 3.11-2 5.66-2 8.68V16a2 2 0 1 1-4 0Z",key:"1dudjm"}],["path",{d:"M20 20v-2.38c0-2.12 1.03-3.12 1-5.62-.03-2.72-1.49-6-4.5-6C14.63 6 14 7.8 14 9.5c0 3.11 2 5.66 2 8.68V20a2 2 0 1 0 4 0Z",key:"l2t8xc"}],["path",{d:"M16 17h4",key:"1dejxt"}],["path",{d:"M4 13h4",key:"1bwh8b"}]],G=o("footprints",I);const V=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],S=o("heart",V);const Z=[["path",{d:"M7.21 15 2.66 7.14a2 2 0 0 1 .13-2.2L4.4 2.8A2 2 0 0 1 6 2h12a2 2 0 0 1 1.6.8l1.6 2.14a2 2 0 0 1 .14 2.2L16.79 15",key:"143lza"}],["path",{d:"M11 12 5.12 2.2",key:"qhuxz6"}],["path",{d:"m13 12 5.88-9.8",key:"hbye0f"}],["path",{d:"M8 7h8",key:"i86dvs"}],["circle",{cx:"12",cy:"17",r:"5",key:"qbz8iq"}],["path",{d:"M12 18v-2h-.5",key:"fawc4q"}]],O=o("medal",Z);const P=[["path",{d:"M18 5h4",key:"1lhgn2"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],X=o("moon-star",P);const K=[["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}],["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09",key:"u4xsad"}],["path",{d:"M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z",key:"676m9"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05",key:"92ym6u"}]],U=o("rocket",K);const W=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Y=o("shield-check",W);const J=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],Q=o("trending-up",J),k=[{id:"token_titan",scope:"cloud",icon:R,format:"tokens",art:"/achievements/token-titan.png"},{id:"big_day",scope:"cloud",icon:$,format:"tokens",art:"/achievements/big-day.png"},{id:"wordsmith",scope:"cloud",icon:H,format:"tokens",art:"/achievements/wordsmith.png"},{id:"marathoner",scope:"cloud",icon:G,format:"days",art:"/achievements/marathoner.png"},{id:"streak",scope:"cloud",icon:A,format:"days",art:"/achievements/streak.png"},{id:"weekend_warrior",scope:"cloud",icon:z,format:"days",art:"/achievements/weekend-warrior.png"},{id:"momentum",scope:"cloud",icon:Q,format:"multiplier",art:"/achievements/momentum.png"},{id:"polyglot",scope:"cloud",icon:C,format:"count",art:"/achievements/polyglot.png"},{id:"trendsetter",scope:"cloud",icon:U,format:"count",art:"/achievements/trendsetter.png"},{id:"multitool",scope:"cloud",icon:E,format:"count",art:"/achievements/multitool.png"},{id:"podium",scope:"cloud",icon:O,format:"rank",art:"/achievements/podium.png"},{id:"veteran",scope:"cloud",icon:Y,format:"days",art:"/achievements/veteran.png"},{id:"project_hopper",scope:"local",icon:F,format:"count",art:"/achievements/project-hopper.png"},{id:"project_devotion",scope:"local",icon:S,format:"tokens",art:"/achievements/project-devotion.png"},{id:"night_owl",scope:"local",icon:X,format:"count",art:"/achievements/night-owl.png"}],u=new Map(k.map(e=>[e.id,e])),m=new Map(k.map((e,a)=>[e.id,a]));function de(e,a){return`achievements.badge.${e}.${a}`}function ee(e){return[...e||[]].sort((a,t)=>{const c=(t?.tier||0)-(a?.tier||0);return c!==0?c:(m.get(a?.id)??99)-(m.get(t?.id)??99)})}function re(e){const a=(e||[]).filter(t=>t&&(t.tier||0)>=1&&u.has(t.id));return a.length===0?null:ee(a)[0]}const v={1:"bronze",2:"silver",3:"gold",4:"diamond"},ie=["bronze","silver","gold","diamond"],ae={bronze:{rim:["#a06a44","#5c3a22"],face:["#d29a6c","#96602f"],glyph:"#3f2817",ring:"#e8c3a0",sheen:"rgba(255, 236, 220, 0.45)",label:"#a06a44"},silver:{rim:["#aab3bb","#67707b"],face:["#dde2e7","#9ba5ae"],glyph:"#39424b",ring:"#f2f5f7",sheen:"rgba(255, 255, 255, 0.55)",label:"#8b959f"},gold:{rim:["#c9971c","#8a6508"],face:["#f2ca52","#cf9c26"],glyph:"#5c430e",ring:"#ffe9a8",sheen:"rgba(255, 248, 214, 0.55)",label:"#b8860b"},diamond:{rim:["#62b1e0","#7c6fd9"],face:["#c8ecf6","#84b4ea"],glyph:"#27496d",ring:"#eafcff",sheen:"rgba(255, 255, 255, 0.65)",label:"#5a9bd8"}},y={rim:["#a8ada9","#7c817d"],face:["#cdd2ce","#a3a8a4"],glyph:"#6a706c",ring:"#dde1de",sheen:"rgba(255, 255, 255, 0.25)",label:"#8b908c"};function te(e,a=!1){return a||!e||e<1?y:ae[v[Math.min(e,4)]]||y}function se(e){return v[e]||null}const g={xs:18,sm:24,md:44,xl:88,lg:108},f={xs:.75,sm:1,md:1.5,xl:2,lg:2};function le({badgeId:e,tier:a=0,size:t="md",locked:c=!1,label:i,className:M=""}){const s=u.get(e),h=c||!a||a<1,n=te(a,h),d=t==="fill",l=d?"100%":g[t]||g.md,b=d?4:f[t]||f.md,[_,x]=N.useState(!1),p=s?.icon||null,w=!!s?.art&&!_;return r.jsx("span",{role:i?"img":void 0,"aria-label":i||void 0,"aria-hidden":i?void 0:!0,className:`inline-flex shrink-0 rounded-full ${M}`,style:{width:l,height:l,padding:b,background:`linear-gradient(135deg, ${n.rim[0]} 0%, ${n.ring} 42%, ${n.rim[1]} 100%)`,boxShadow:d||t==="md"||t==="xl"||t==="lg"?"0 0 0 1px rgba(10, 15, 12, 0.06), 0 1px 2px rgba(10, 15, 12, 0.08)":void 0},children:w?r.jsx("img",{src:s.art,alt:"",draggable:!1,loading:"lazy",onError:()=>x(!0),className:"h-full w-full rounded-full object-cover",style:h?{filter:"grayscale(1)",opacity:.55}:void 0}):r.jsx("span",{className:"flex h-full w-full items-center justify-center rounded-full",style:{background:`linear-gradient(145deg, ${n.face[0]}, ${n.face[1]})`},children:p?r.jsx(p,{size:d?64:Math.round(l*.5),color:n.glyph,strokeWidth:2}):null})})}export{le as A,k as B,S as H,Q as T,ae as a,de as b,u as c,ie as d,re as h,te as p,ee as s,se as t};
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/BadgeDetailModal-5FcY9olH.js","assets/__vite-browser-external-CeOnjjgl.js","assets/__vite-browser-external-WKilYZnq.css","assets/react-CgmQzSd0.js","assets/AchievementBadge-BhAc3c3S.js","assets/zap-D0DQz21w.js","assets/flame-BEU-cqaV.js","assets/use-transform-OnxHQlyh.js","assets/use-reduced-motion-DUgAHZln.js","assets/AchievementsSection-T-v65Q1T.js","assets/format-tokens-DJ-Y0jv5.js","assets/DialogTitle-mSFue3N1.js","assets/useScrollLock-Ct5GyoVg.js","assets/store-BLjK5TrP.js"])))=>i.map(i=>d[i]);
import{r as l,G as x,H as f,I as v,j as e,c,L as p,R as g,a as y,J as b,K as k,_ as j}from"./__vite-browser-external-CeOnjjgl.js";import{A as w}from"./AchievementsSection-T-v65Q1T.js";import{B as h}from"./AchievementBadge-BhAc3c3S.js";import"./react-CgmQzSd0.js";import"./format-tokens-DJ-Y0jv5.js";import"./use-reduced-motion-DUgAHZln.js";import"./zap-D0DQz21w.js";import"./flame-BEU-cqaV.js";function N({enabled:a=!0}={}){const[r,t]=l.useState({status:"loading",achievements:[],error:null}),s=l.useMemo(()=>x(),[]);return l.useEffect(()=>{if(!a){t({status:"disabled",achievements:[],error:null});return}let i=!1;return t(n=>({...n,status:"loading"})),f({timeZone:s,tzOffsetMinutes:v()}).then(n=>{i||t({status:"ready",achievements:Array.isArray(n?.achievements)?n.achievements:[],error:null})}).catch(n=>{i||t({status:"error",achievements:[],error:n})}),()=>{i=!0}},[a,s]),r}const A=g.lazy(()=>j(()=>import("./BadgeDetailModal-5FcY9olH.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])));function I({authLoading:a,authEnabled:r,authUserId:t,mockEnabled:s}){if(s)return{authLoading:!1,signedIn:!0,userId:"mock-user"};const i=!!(r&&t);return{authLoading:!!a,signedIn:i,userId:i?t:null}}function B(){const a=y(),[r,t]=l.useState({status:"loading",achievements:[],userId:null}),s=b(),{authLoading:i,signedIn:n,userId:o}=I({authLoading:a?.loading,authEnabled:a?.enabled,authUserId:a?.user?.id,mockEnabled:s});return l.useEffect(()=>{if(i){t({status:"loading",achievements:[],userId:null});return}if(!n){t({status:"signed-out",achievements:[],userId:null});return}let d=!1;return t({status:"loading",achievements:[],userId:o}),(async()=>{try{const u=s?null:await a.getAccessToken?.(),m=await k({accessToken:u,userId:o});if(d)return;t({status:"ready",achievements:Array.isArray(m?.badges)?m.badges:[],userId:o})}catch{d||t({status:"error",achievements:[],userId:o})}})(),()=>{d=!0}},[i,s,n,o]),{...r,signedIn:n,settled:_({authLoading:i,signedIn:n,userId:o,state:r})}}function _({authLoading:a,signedIn:r,userId:t,state:s}){return a?!1:r?s.userId===t&&(s.status==="ready"||s.status==="error"):s.status==="signed-out"}function S(){return e.jsx("div",{className:"mx-0 grid animate-pulse grid-cols-[repeat(3,max-content)] justify-between gap-y-7 sm:-mx-2 sm:grid-cols-[repeat(4,max-content)] lg:grid-cols-[repeat(5,max-content)]","aria-hidden":!0,children:Array.from({length:h.length}).map((a,r)=>e.jsxs("div",{className:"flex w-[6.75rem] flex-col items-center px-0 pb-3 pt-4 sm:w-[7.75rem]",children:[e.jsx("div",{className:"h-[108px] w-[108px] rounded-full bg-oai-gray-200 dark:bg-oai-gray-800"}),e.jsx("div",{className:"mt-3 h-3 w-16 rounded bg-oai-gray-200 dark:bg-oai-gray-800"}),e.jsx("div",{className:"mt-2 h-2 w-10 rounded bg-oai-gray-100 dark:bg-oai-gray-800/60"})]},r))})}function z(){const a=N(),r=B(),[t,s]=l.useState(null),i=a.status==="loading"||!r.settled,n=l.useMemo(()=>[...r.achievements||[],...a.achievements||[]],[r.achievements,a.achievements]),o=l.useMemo(()=>n.filter(u=>(u?.tier||0)>=1).length,[n]),d=h.length;return e.jsxs("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:[e.jsx("main",{className:"flex-1 pb-12 pt-8 sm:pb-16 sm:pt-10",children:e.jsxs("div",{className:"mx-auto max-w-4xl px-4 sm:px-6",children:[e.jsxs("div",{className:"mb-7 flex items-baseline justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:c("achievements.page.title")}),e.jsx("p",{className:"mt-1.5 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:c("achievements.page.local_note")})]}),!i&&e.jsxs("div",{className:"shrink-0 text-right",children:[e.jsxs("div",{className:"font-mono text-2xl font-semibold leading-none tabular-nums text-oai-black dark:text-white",children:[o,e.jsxs("span",{className:"text-oai-gray-400 dark:text-oai-gray-600",children:["/",d]})]}),e.jsx("div",{className:"mt-2 h-1 w-24 overflow-hidden rounded-full bg-oai-gray-200 dark:bg-oai-gray-800",children:e.jsx("div",{className:"h-full rounded-full bg-oai-brand-600 transition-[width] duration-500",style:{width:`${Math.round(o/d*100)}%`}})})]})]}),!r.signedIn&&!i&&e.jsxs("div",{className:"mb-6 flex flex-wrap items-center justify-between gap-x-4 gap-y-2 rounded-xl border border-oai-gray-200 bg-oai-gray-50 px-4 py-3 dark:border-oai-gray-800 dark:bg-oai-gray-900/60",children:[e.jsx("p",{className:"text-sm text-oai-gray-600 dark:text-oai-gray-300",children:c("achievements.signin.prompt")}),e.jsx(p,{to:"/login",className:"shrink-0 rounded-lg bg-oai-brand-600 px-3 py-1.5 text-sm font-medium text-white transition-colors duration-200 hover:bg-oai-brand-700 active:scale-[0.98]",children:c("achievements.signin.action")})]}),i?e.jsx(S,{}):e.jsxs(e.Fragment,{children:[e.jsx(w,{achievements:n,isOwn:!0,columns:"wide",size:"lg",animateIn:!0,onSelect:s}),e.jsxs("p",{className:"mt-10 text-center text-xs text-oai-gray-400 dark:text-oai-gray-500",children:[c("achievements.page.suggest")," ",e.jsx("a",{href:"https://github.com/mm7894215/TokenTracker/issues",target:"_blank",rel:"noopener noreferrer",className:"underline decoration-oai-gray-300 underline-offset-2 transition-colors hover:text-oai-gray-700 hover:decoration-oai-gray-500 dark:decoration-oai-gray-600 dark:hover:text-oai-gray-300",children:c("achievements.page.suggest_link")})]})]})]})}),t&&e.jsx(g.Suspense,{fallback:null,children:e.jsx(A,{badge:t,onClose:()=>s(null)})})]})}export{_ as cloudBadgesSettled,z as default,I as resolveCloudBadgeIdentity};
import{l as _,j as s,c as l}from"./__vite-browser-external-CeOnjjgl.js";import{m as $}from"./react-CgmQzSd0.js";import{B as x,s as b,b as C,t as T,A as B,a as E}from"./AchievementBadge-BhAc3c3S.js";import{f as L}from"./format-tokens-DJ-Y0jv5.js";import{u as I}from"./use-reduced-motion-DUgAHZln.js";const D=[["path",{d:"M10 16h.01",key:"1bzywj"}],["path",{d:"M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"18tbho"}],["path",{d:"M21.946 12.013H2.054",key:"zqlbp7"}],["path",{d:"M6 16h.01",key:"1pmjb7"}]],F=_("hard-drive",D);function V(r,i){const t=Number(i)||0;switch(r){case"tokens":return L(t);case"rank":return`#${Math.round(t)}`;case"multiplier":return`${(Math.round(t*10)/10).toString()}×`;default:return Math.round(t).toLocaleString()}}function H(r){if(!r)return 0;const i=Number(r.next_threshold),t=Number(r.metric_value??r.value);if(!Number.isFinite(i)||i<=0)return r.tier>=4?1:0;if(!Number.isFinite(t)||t<=0)return 0;const o=r.lower_is_better?i/t:t/i;return Math.max(0,Math.min(1,o))}function q(r){const i=r?.achieved||{},t=Object.values(i).map(o=>o?Date.parse(o):NaN).filter(o=>Number.isFinite(o));return t.length>0?Math.max(...t):null}function K({achievements:r,isOwn:i=!1,scope:t,onSelect:o,size:m="xl",columns:v="default",animateIn:y=!1,className:N=""}){const k=I(),u=y&&!k,p=new Map;for(const e of Array.isArray(r)?r:[])e&&e.id&&p.set(e.id,e);const g=t?x.filter(e=>e.scope===t):x;let c;if(i){const e=g.map(a=>({entry:a,record:p.get(a.id)||{id:a.id,tier:0}})),n=b(e.filter(a=>(a.record.tier||0)>=1).map(a=>({...a,id:a.entry.id,tier:a.record.tier}))),h=e.filter(a=>(a.record.tier||0)<1);c=[...n,...h]}else c=b(g.map(e=>({entry:e,record:p.get(e.id)})).filter(e=>e.record&&(e.record.tier||0)>=1).map(e=>({...e,id:e.entry.id,tier:e.record.tier}))).map(({entry:e,record:n})=>({entry:e,record:n}));if(c.length===0)return null;const j=v==="wide"?"grid-cols-[repeat(3,max-content)] sm:grid-cols-[repeat(4,max-content)] lg:grid-cols-[repeat(5,max-content)]":"grid-cols-[repeat(3,max-content)] sm:grid-cols-[repeat(4,max-content)]",w=m==="lg"?"mx-0 sm:-mx-2":"-mx-2 sm:-mx-4",M=m==="lg"?"px-0":"px-1";return s.jsx("div",{className:`${w} grid justify-between gap-y-7 ${j} ${N}`,children:c.map(({entry:e,record:n},h)=>{const a=(n.tier||0)>=1,f=l(C(e.id,"name")),d=a?T(n.tier):null,A=H(n);return s.jsxs($.button,{type:"button",initial:u?{opacity:0,y:16,scale:.9}:!1,animate:u?{opacity:1,y:0,scale:1}:void 0,whileTap:u?{scale:.97}:void 0,transition:{delay:.05+h*.035,duration:.45,ease:[.16,1,.3,1]},onClick:o?()=>o({...n,id:e.id}):void 0,className:`group flex w-[6.75rem] flex-col items-center rounded-xl ${M} pb-3 pt-4 text-center transition-[background-color,transform] duration-200 ease-out hover:bg-oai-gray-50 active:scale-[0.97] dark:hover:bg-oai-gray-900/70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand/60 sm:w-[7.75rem]`,"aria-label":l("achievements.badge.aria",{name:f,tier:d?l(`achievements.tier.${d}`):l("achievements.modal.locked")}),children:[s.jsx(B,{badgeId:e.id,tier:n.tier,locked:!a,size:m,className:"transition-transform duration-200 ease-out group-hover:-translate-y-0.5 group-hover:scale-105"}),s.jsxs("span",{className:"mt-2.5 flex w-full items-center justify-center gap-1",children:[s.jsx("span",{title:f,className:"min-w-0 truncate text-xs font-medium leading-tight text-oai-gray-800 dark:text-oai-gray-200",children:f}),e.scope==="local"&&s.jsx("span",{title:l("achievements.page.local_note"),"aria-label":l("achievements.scope.local"),className:"inline-flex shrink-0 text-oai-gray-400 dark:text-oai-gray-500",children:s.jsx(F,{size:11,strokeWidth:2,"aria-hidden":!0})})]}),s.jsx("span",{className:"mt-1 flex h-4 w-full items-center justify-center",children:a?s.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-[0.08em]",style:{color:E[d]?.label},children:l(`achievements.tier.${d}`)}):i?s.jsx("span",{className:"h-[3px] w-14 overflow-hidden rounded-full bg-oai-gray-200 dark:bg-oai-gray-800",children:s.jsx("span",{className:"block h-full rounded-full bg-oai-brand/70",style:{width:`${Math.round(A*100)}%`}})}):null})]},e.id)})})}export{K as A,H as b,V as f,q as l};
import{r as s,j as t,R as g}from"./__vite-browser-external-CeOnjjgl.js";import{m as v}from"./react-CgmQzSd0.js";import{P as x}from"./ProviderIcon-C8fKhRQt.js";import{A as y}from"./index-DtrsMn3Y.js";function C(a){const e=[...a];for(let o=e.length-1;o>0;o--){const r=Math.floor(Math.random()*(o+1));[e[o],e[r]]=[e[r],e[o]]}return e}function j(a,e){const o=C(a),r=Array.from({length:e},()=>[]);o.forEach((i,m)=>{r[m%e].push(i)});const c=Math.max(...r.map(i=>i.length));return r.forEach(i=>{for(;i.length<c;)i.push(o[Math.floor(Math.random()*o.length)])}),r}const w=g.memo(function({logos:e,index:o,currentTime:r,onHoverChange:c}){const[i,m]=s.useState(!1),l=4e3,p=o*400,n=(r+p)%(l*e.length),d=Math.floor(n/l),u=e[d],h=f=>{m(f),c(f)};return t.jsxs("div",{className:"relative flex flex-col items-center",onMouseEnter:()=>h(!0),onMouseLeave:()=>h(!1),children:[t.jsx(v.div,{className:"relative h-8 w-8 sm:h-10 sm:w-10 md:h-12 md:w-12 overflow-hidden",initial:{opacity:0,y:50},animate:{opacity:1,y:0},transition:{delay:o*.1,duration:.5,ease:"easeOut"},children:t.jsx(y,{mode:"wait",children:t.jsx(v.div,{className:"absolute inset-0 flex items-center justify-center",initial:{y:"18%",opacity:0,filter:"blur(4px)"},animate:{y:"0%",opacity:1,filter:"blur(0px)",transition:{type:"tween",ease:[.22,1,.36,1],duration:.9}},exit:{y:"-18%",opacity:0,filter:"blur(4px)",transition:{type:"tween",ease:[.4,0,1,1],duration:.55}},children:t.jsx(x,{provider:u.provider,size:24,className:"object-contain"})},`${u.id}-${d}`)})}),t.jsx(y,{children:i&&t.jsx(v.span,{className:"pointer-events-none absolute -bottom-7 z-10 whitespace-nowrap rounded bg-oai-gray-800 px-2 py-0.5 text-xs font-medium text-oai-gray-100 shadow-lg ring-1 ring-oai-gray-700",initial:{opacity:0,y:-4},animate:{opacity:1,y:0},exit:{opacity:0,y:-4},transition:{duration:.15},children:u.name})})]})});function E({logos:a,columnCount:e=2}){const[o,r]=s.useState([]),[c,i]=s.useState(0),[m,l]=s.useState(!1);s.useEffect(()=>{r(j(a,e))},[a,e]),s.useEffect(()=>{if(m)return;const n=setInterval(()=>i(d=>d+400),400);return()=>clearInterval(n)},[m]);const p=s.useCallback(n=>{l(n)},[]);return t.jsx("div",{className:"flex gap-2.5 sm:gap-4 text-oai-gray-200",children:o.map((n,d)=>t.jsx(w,{logos:n,index:d,currentTime:c,onHoverChange:p},d))})}const A=[{id:1,name:"Claude Code",provider:"claude"},{id:2,name:"Codex",provider:"codex"},{id:3,name:"Cursor",provider:"cursor"},{id:4,name:"Gemini",provider:"gemini"},{id:5,name:"Antigravity",provider:"antigravity"},{id:6,name:"Kiro",provider:"kiro"},{id:7,name:"OpenCode",provider:"opencode"},{id:8,name:"OpenClaw",provider:"openclaw"},{id:9,name:"Every Code",provider:"every-code"},{id:10,name:"Hermes",provider:"hermes"},{id:11,name:"GitHub Copilot",provider:"copilot"},{id:12,name:"Kimi",provider:"kimi"},{id:13,name:"CodeBuddy",provider:"codebuddy"},{id:14,name:"WorkBuddy",provider:"workbuddy"},{id:15,name:"Grok",provider:"grok"},{id:16,name:"oh-my-pi",provider:"omp"},{id:17,name:"Pi",provider:"pi"},{id:18,name:"Craft",provider:"craft"},{id:19,name:"Kilo CLI",provider:"kilo-cli"},{id:20,name:"Kilo Code",provider:"kilocode"},{id:21,name:"Roo Code",provider:"roocode"},{id:22,name:"Zed",provider:"zed"},{id:23,name:"Goose",provider:"goose"},{id:24,name:"Droid",provider:"droid"},{id:25,name:"Mimo",provider:"mimo"},{id:26,name:"ZCode",provider:"zcode"},{id:27,name:"AnythingLLM",provider:"anythingllm"}];export{A,E as L};
import{l as o}from"./__vite-browser-external-CeOnjjgl.js";const t=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],a=o("arrow-up-right",t);export{a as A};
import{r as L,j as a,bb as De,c as h,d as ye,X as Ie}from"./__vite-browser-external-CeOnjjgl.js";import{k as _e,V as Me,l as Ve,r as Te,n as $e,o as be,q as ve,s as Oe,t as Re,v as Be,w as Pe,x as Ke,y as Ce,z as Fe,A as Le,B as Xe,S as Ge,H as We,C as G,D as ze,E as Ue,e as Ye,F as He,m as C}from"./react-CgmQzSd0.js";import{c as je,A as Ze,p as qe,b as U,t as le,a as T,d as Je}from"./AchievementBadge-BhAc3c3S.js";import{u as Qe,a as z}from"./use-transform-OnxHQlyh.js";import{u as et}from"./use-reduced-motion-DUgAHZln.js";import{l as ce,f as ue,b as tt}from"./AchievementsSection-T-v65Q1T.js";import{D as nt,a as rt,b as at,c as st,d as it,e as ot}from"./DialogTitle-mSFue3N1.js";import"./zap-D0DQz21w.js";import"./flame-BEU-cqaV.js";import"./format-tokens-DJ-Y0jv5.js";import"./useScrollLock-Ct5GyoVg.js";import"./store-BLjK5TrP.js";const lt=(e,t,n)=>{const r=t-e;return((n-e)%r+r)%r+e};function Ne(e,t){return _e(e)?e[lt(0,e.length,t)]:e}class ct{constructor(t){this.stop=()=>this.runAll("stop"),this.animations=t.filter(Boolean)}get finished(){return Promise.all(this.animations.map(t=>t.finished))}getAll(t){return this.animations[0][t]}setAll(t,n){for(let r=0;r<this.animations.length;r++)this.animations[r][t]=n}attachTimeline(t){const n=this.animations.map(r=>r.attachTimeline(t));return()=>{n.forEach((r,s)=>{r&&r(),this.animations[s].stop()})}}get time(){return this.getAll("time")}set time(t){this.setAll("time",t)}get speed(){return this.getAll("speed")}set speed(t){this.setAll("speed",t)}get state(){return this.getAll("state")}get startTime(){return this.getAll("startTime")}get duration(){return de(this.animations,"duration")}get iterationDuration(){return de(this.animations,"iterationDuration")}runAll(t){this.animations.forEach(n=>n[t]())}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}function de(e,t){let n=0;for(let r=0;r<e.length;r++){const s=e[r][t];s!==null&&s>n&&(n=s)}return n}class ut extends ct{then(t,n){return this.finished.finally(t).then(()=>{})}}function dt(e,t){return e in t}class mt extends Me{constructor(){super(...arguments),this.type="object"}readValueFromInstance(t,n){if(dt(n,t)){const r=t[n];if(typeof r=="string"||typeof r=="number")return r}}getBaseTargetFromProps(){}removeValueFromRenderState(t,n){delete n.output[t]}measureInstanceViewportBox(){return Ve()}build(t,n){Object.assign(t.output,n)}renderInstance(t,{output:n}){Object.assign(t,n)}sortInstanceNodePosition(){return 0}}function Y(e){return typeof e=="object"&&!Array.isArray(e)}function ke(e,t,n,r){return e==null?[]:typeof e=="string"&&Y(t)?Te(e,n,r):e instanceof NodeList?Array.from(e):Array.isArray(e)?e.filter(s=>s!=null):[e]}function ft(e,t,n){return e*(t+1)+n*t}function me(e,t,n,r){return typeof t=="number"?t:t.startsWith("-")||t.startsWith("+")?Math.max(0,e+parseFloat(t)):t==="<"?n:t.startsWith("<")?Math.max(0,n+parseFloat(t.slice(1))):r.get(t)??e}function pt(e,t,n){for(let r=0;r<e.length;r++){const s=e[r];s.at>t&&s.at<n&&(be(e,s),r--)}}function ht(e,t,n,r,s,c){pt(e,s,c);for(let i=0;i<t.length;i++)e.push({value:t[i],at:$e(s,c,r[i]),easing:Ne(n,i)})}function gt(e,t,n=0){const r=t+1+t*n;for(let s=0;s<e.length;s++)e[s]=e[s]/r}function xt(e,t){return e.at===t.at?e.value===null?1:t.value===null?-1:0:e.at-t.at}const yt="easeInOut",bt=20;function vt(e,{defaultTransition:t={},...n}={},r,s){const c=t.duration||.3,i=new Map,f=new Map,m={},p=new Map;let g=0,u=0,x=0;for(let N=0;N<e.length;N++){const k=e[N];if(typeof k=="string"){p.set(k,u);continue}else if(!Array.isArray(k)){p.set(k.name,me(u,k.at,g,p));continue}let[E,b,v={}]=k;v.at!==void 0&&(u=me(u,v.at,g,p));let j=0;const _=(w,M,A,o=0,l=0)=>{const d=jt(w),{delay:D=0,times:y=Oe(d),type:R=t.type||"keyframes",repeat:B,repeatType:W,repeatDelay:H=0,...Se}=M;let{ease:I=t.ease||"easeOut",duration:S}=M;const Z=typeof D=="function"?D(o,l):D,q=d.length,J=Ke(R)?R:s?.[R||"keyframes"];if(q<=2&&J){let $=100;if(q===2&&wt(d)){const P=d[1]-d[0];$=Math.abs(P)}const O={...t,...Se};S!==void 0&&(O.duration=Ce(S));const X=Re(O,$,J);I=X.ease,S=X.duration}S??(S=c);const Q=u+Z;y.length===1&&y[0]===0&&(y[1]=1);const ee=y.length-d.length;if(ee>0&&Be(y,ee),d.length===1&&d.unshift(null),B&&B<bt){const $=S>0?H/S:0;S=ft(S,B,H);const O=[...d],X=[...y];I=Array.isArray(I)?[...I]:[I];const P=[...I],ne=W==="reverse"||W==="mirror";let re=O,ae=P;ne&&(re=[...O].reverse(),W==="reverse"&&(ae=[...P].reverse().map(V=>typeof V=="function"?Pe(V):V)));for(let V=0;V<B;V++){const se=ne&&V%2===0,ie=se?re:O,Ee=se?ae:P,oe=(V+1)*(1+$);$>0&&(d.push(d[d.length-1]),y.push(oe),I.push("linear")),d.push(...ie);for(let K=0;K<ie.length;K++)y.push(X[K]+oe),I.push(K===0?"linear":Ne(Ee,K-1))}gt(y,B,$)}const te=Q+S;ht(A,d,I,y,Q,te),j=Math.max(Z+S,j),x=Math.max(te,x)};if(ve(E)){const w=fe(E,f);_(b,v,pe("default",w))}else{const w=ke(E,b,r,m),M=w.length;for(let A=0;A<M;A++){b=b,v=v;const o=w[A],l=fe(o,f);for(const d in b)_(b[d],Nt(v,d),pe(d,l),A,M)}}g=u,u+=j}return f.forEach((N,k)=>{for(const E in N){const b=N[E];b.sort(xt);const v=[],j=[],_=[];for(let o=0;o<b.length;o++){const{at:l,value:d,easing:D}=b[o];v.push(d),j.push(Fe(0,x,l)),_.push(D||"easeOut")}j[0]!==0&&(j.unshift(0),v.unshift(v[0]),_.unshift(yt)),j[j.length-1]!==1&&(j.push(1),v.push(null)),i.has(k)||i.set(k,{keyframes:{},transition:{}});const w=i.get(k);w.keyframes[E]=v;const{type:M,...A}=t;w.transition[E]={...A,duration:x,ease:_,times:j,...n}}}),i}function fe(e,t){return!t.has(e)&&t.set(e,{}),t.get(e)}function pe(e,t){return t[e]||(t[e]=[]),t[e]}function jt(e){return Array.isArray(e)?e:[e]}function Nt(e,t){return e&&e[t]?{...e,...e[t]}:{...e}}const kt=e=>typeof e=="number",wt=e=>e.every(kt);function At(e){const t={presenceContext:null,props:{},visualState:{renderState:{transform:{},transformOrigin:{},style:{},vars:{},attrs:{}},latestValues:{}}},n=Le(e)&&!Xe(e)?new Ge(t):new We(t);n.mount(e),G.set(e,n)}function St(e){const t={presenceContext:null,props:{},visualState:{renderState:{output:{}},latestValues:{}}},n=new mt(t);n.mount(e),G.set(e,n)}function Et(e,t){return ve(e)||typeof e=="number"||typeof e=="string"&&!Y(t)}function we(e,t,n,r){const s=[];if(Et(e,t))s.push(ze(e,Y(t)&&t.default||t,n&&(n.default||n)));else{if(e==null)return s;const c=ke(e,t,r),i=c.length;for(let f=0;f<i;f++){const m=c[f],p=m instanceof Element?At:St;G.has(m)||p(m);const g=G.get(m),u={...n};"delay"in u&&typeof u.delay=="function"&&(u.delay=u.delay(f,i)),s.push(...Ue(g,{...t,transition:u},{}))}}return s}function Dt(e,t,n){const r=[],s=e.map(i=>{if(Array.isArray(i)&&typeof i[0]=="function"){const f=i[0],m=Ye(0);return m.on("change",f),i.length===1?[m,[0,1]]:i.length===2?[m,[0,1],i[1]]:[m,i[1],i[2]]}return i});return vt(s,t,n,{spring:He}).forEach(({keyframes:i,transition:f},m)=>{r.push(...we(m,i,f))}),r}function It(e){return Array.isArray(e)&&e.some(Array.isArray)}function _t(e={}){const{scope:t,reduceMotion:n,skipAnimations:r}=e;function s(c,i,f){let m=[],p;const g={};if(n!==void 0&&(g.reduceMotion=n),r!==void 0&&(g.skipAnimations=r),It(c)){const{onComplete:x,...N}=i||{};typeof x=="function"&&(p=x),m=Dt(c,{...g,...N},t)}else{const{onComplete:x,...N}=f||{};typeof x=="function"&&(p=x),m=we(c,i,{...g,...N},t)}const u=new ut(m);return p&&u.finished.then(p),t&&(t.animations.push(u),u.finished.then(()=>{be(t.animations,u)})),u}return s}const F=_t(),he=8;function Mt({badgeId:e,tier:t,locked:n=!1,size:r=176,backLines:s=[],label:c}){const i=Qe(0),f=et(),m=L.useRef(null),p=L.useRef(null),g=L.useRef(!1),u=qe(t,n),x=je.get(e)?.icon||null,N=z(i,o=>`${(o%360+360)%360/360*160-80}%`),k=z(i,o=>`${80-(o%360+360)%360/360*160}%`),E=z(i,o=>{const l=Math.abs(Math.sin(o*Math.PI/180));return Math.max(0,(l-.35)/.65)*.3}),b=()=>{p.current?.stop?.(),p.current=null};L.useEffect(()=>{if(f||g.current)return;let o=!1;i.set(-360);const l=F(i,0,{duration:.9,ease:[.16,1,.3,1]});return p.current=l,l.then(()=>{o||g.current||(p.current=F(i,[0,-14,14,0],{duration:4.5,repeat:1/0,ease:"easeInOut"}))}),()=>{o=!0,b()}},[f,i]);const v=o=>{const l=i.get();if(f){const y=Math.round(l/180)*180;p.current=F(i,y,{duration:.2,ease:"easeOut"});return}const d=l+o*.35,D=Math.round(d/180)*180;p.current=F(i,D,{type:"spring",velocity:o,stiffness:58,damping:13.5,mass:1})},j=o=>{g.current=!0,b(),o.currentTarget.setPointerCapture?.(o.pointerId),m.current={pointerId:o.pointerId,startX:o.clientX,startRot:i.get(),samples:[{t:o.timeStamp,x:o.clientX}]}},_=o=>{const l=m.current;!l||l.pointerId!==o.pointerId||(i.set(l.startRot+(o.clientX-l.startX)*.55),l.samples.push({t:o.timeStamp,x:o.clientX}),l.samples.length>5&&l.samples.shift())},w=o=>{const l=m.current;if(!l||l.pointerId!==o.pointerId)return;m.current=null;const d=l.samples[0],D=l.samples[l.samples.length-1],y=D.t-d.t,R=y>0?(D.x-d.x)*.55*1e3/y:0;v(R)},M=o=>{if(o.key!=="ArrowLeft"&&o.key!=="ArrowRight")return;o.preventDefault(),g.current=!0,b();const l=o.key==="ArrowRight"?30:-30;p.current=F(i,i.get()+l,{duration:.15,ease:"easeOut"})},A={backfaceVisibility:"hidden",WebkitBackfaceVisibility:"hidden"};return a.jsx("div",{role:"img","aria-label":c,tabIndex:0,onPointerDown:j,onPointerMove:_,onPointerUp:w,onPointerCancel:w,onKeyDown:M,className:"inline-flex cursor-grab select-none items-center justify-center outline-none focus-visible:ring-2 focus-visible:ring-oai-brand/60 rounded-full active:cursor-grabbing",style:{perspective:900,touchAction:"pan-y"},children:a.jsxs("div",{className:"relative",style:{transform:"rotateX(-8deg)",transformStyle:"preserve-3d"},children:[a.jsxs(C.div,{className:"relative",style:{rotateY:i,transformStyle:"preserve-3d",width:r,height:r},children:[[-3,-1.5,0,1.5,3].map(o=>a.jsx("div",{"aria-hidden":!0,className:"absolute inset-0 rounded-full",style:{transform:`translateZ(${o}px)`,background:u.rim[1]}},o)),a.jsxs("div",{className:"absolute inset-0 overflow-hidden rounded-full",style:{...A,transform:`translateZ(${he/2}px)`},children:[a.jsx(Ze,{badgeId:e,tier:t,locked:n,size:"fill",className:"brightness-105 saturate-[1.08]"}),a.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 rounded-full",style:{background:"radial-gradient(circle at 30% 20%, rgba(255,255,255,0.45), rgba(255,255,255,0) 42%), linear-gradient(172deg, rgba(255,255,255,0.14) 0%, rgba(255,255,255,0) 38%, rgba(0,0,0,0.08) 100%)",boxShadow:"inset 0 3px 7px rgba(255,255,255,0.5), inset 0 -3px 8px rgba(0,0,0,0.15)"}}),a.jsx(C.div,{"aria-hidden":!0,className:"pointer-events-none absolute inset-0",style:{x:N,background:"linear-gradient(105deg, transparent 34%, rgba(255,255,255,0.5) 50%, transparent 66%)"}}),a.jsx(C.div,{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 rounded-full",style:{opacity:E,background:"rgba(8, 12, 10, 0.9)"}})]}),a.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-1 overflow-hidden rounded-full px-6 text-center",style:{...A,transform:`rotateY(180deg) translateZ(${he/2}px)`,background:`linear-gradient(145deg, ${u.face[0]}, ${u.face[1]})`,boxShadow:`inset 0 0 0 6px ${u.rim[1]}, inset 0 0 0 7.5px rgba(255,255,255,0.22), inset 0 3px 7px rgba(255,255,255,0.4), inset 0 -4px 12px rgba(0,0,0,0.22)`},children:[a.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 rounded-full",style:{background:"repeating-radial-gradient(circle at 50% 50%, rgba(255,255,255,0.06) 0px, rgba(255,255,255,0.06) 1px, transparent 1px, transparent 4px)"}}),x?a.jsx(x,{"aria-hidden":!0,size:Math.round(r*.62),strokeWidth:1.1,color:u.glyph,className:"pointer-events-none absolute opacity-[0.13]",style:{filter:"drop-shadow(0 1px 0 rgba(255,255,255,0.3)) drop-shadow(0 -1px 0 rgba(0,0,0,0.35))"}}):null,a.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 rounded-full",style:{background:"radial-gradient(circle at 70% 20%, rgba(255,255,255,0.4), rgba(255,255,255,0) 44%), linear-gradient(188deg, rgba(255,255,255,0.12) 0%, rgba(255,255,255,0) 38%, rgba(0,0,0,0.10) 100%)"}}),s.map((o,l)=>a.jsx("div",{className:`font-mono tabular-nums ${l===0?"text-[10px] uppercase tracking-[0.18em]":l===1?"text-lg font-bold":"text-[11px]"}`,style:{color:u.glyph,textShadow:"0 1px 0 rgba(255,255,255,0.28), 0 -1px 0 rgba(0,0,0,0.3)"},children:o},`${l}-${o}`)),a.jsx(C.div,{"aria-hidden":!0,className:"pointer-events-none absolute inset-0",style:{x:k,background:"linear-gradient(105deg, transparent 34%, rgba(255,255,255,0.45) 50%, transparent 66%)"}}),a.jsx(C.div,{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 rounded-full",style:{opacity:E,background:"rgba(8, 12, 10, 0.9)"}})]})]}),a.jsx("div",{"aria-hidden":!0,className:"absolute left-1/2 h-3 w-3/5 rounded-[100%] bg-black/20 blur-md dark:bg-black/45",style:{bottom:-20,transform:"translateX(-50%)"}})]})})}function Ae(e){if(!e)return null;const t=Date.parse(e);return Number.isFinite(t)?new Date(t).toLocaleDateString():null}function Vt(e){const t=Number(e);return!Number.isSafeInteger(t)||t<1?null:String(t).padStart(6,"0")}function Tt(e,t,n){if(t?.scope!=="cloud"||!n)return null;const r=Number(e?.serials?.[n]);return Number.isSafeInteger(r)&&r>=1?r:null}function $t({badge:e}){return a.jsx("div",{className:"flex items-center gap-1",children:Je.map((t,n)=>{const r=(e.tier||0)>=n+1,s=Ae(e.achieved?.[t]),c=T[t];return a.jsx("span",{title:s?`${h(`achievements.tier.${t}`)} · ${s}`:h(`achievements.tier.${t}`),className:"inline-flex h-2 w-8 rounded-full",style:r?{background:`linear-gradient(120deg, ${c.rim[0]} 0%, ${c.ring} 55%, ${c.rim[1]} 100%)`,boxShadow:"inset 0 1px 1px rgba(255,255,255,0.4), 0 0 0 1px rgba(10,15,12,0.05)"}:void 0,children:!r&&a.jsx("span",{className:"h-full w-full rounded-full bg-oai-gray-200 dark:bg-oai-gray-800"})},t)})})}function ge({badge:e,onClose:t}){const n=je.get(e.id),r=h(U(e.id,"name")),s=(e.tier||0)>=1,c=s?le(e.tier):null,i=Ae(s?e.achieved?.[c]||(ce(e)?new Date(ce(e)).toISOString():null):null),f=ue(n?.format,e.metric_value),m=tt(e),p=e.tier<4?le((e.tier||0)+1):null,g=Tt(e,n,c),u=Vt(g),x=u?[h("achievements.modal.achieved_label"),h("achievements.modal.issue_number",{number:u}),i||r]:[s?h("achievements.modal.achieved_label"):h("achievements.modal.locked"),s?f:"···",s&&i?i:r];return a.jsxs("div",{className:"flex flex-col items-center px-6 pb-6 pt-5 text-center",children:[a.jsxs("div",{className:"flex w-full items-start justify-between gap-3",children:[a.jsxs("div",{className:"min-w-0 flex-1 text-left",children:[a.jsx("h2",{className:"truncate text-lg font-semibold tracking-tight text-oai-black dark:text-white",children:r}),a.jsx("p",{className:"mt-0.5 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:h(U(e.id,"desc"))})]}),a.jsx("button",{type:"button",onClick:t,"aria-label":h("achievements.modal.close"),className:"shrink-0 rounded-md p-1.5 text-oai-gray-400 transition-colors hover:bg-oai-gray-100 hover:text-oai-gray-700 dark:hover:bg-oai-gray-900 dark:hover:text-oai-gray-200",children:a.jsx(Ie,{size:16})})]}),a.jsx("div",{className:"mt-5 mb-7",children:a.jsx(Mt,{badgeId:e.id,tier:e.tier,locked:!s,backLines:x,label:h("achievements.modal.coin_aria",{name:r})})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"rounded-full px-2.5 py-0.5 text-[11px] font-semibold uppercase tracking-wide",style:s?{background:`linear-gradient(120deg, ${T[c].rim[0]} 0%, ${T[c].ring} 55%, ${T[c].rim[1]} 100%)`,color:T[c].glyph,textShadow:"0 1px 0 rgba(255,255,255,0.35)",boxShadow:"inset 0 1px 1px rgba(255,255,255,0.4), 0 0 0 1px rgba(10,15,12,0.06)"}:{background:"rgba(128,134,130,0.75)",color:"rgba(250,250,250,0.95)"},children:s?h(`achievements.tier.${c}`):h("achievements.modal.locked")}),s&&i?a.jsx("span",{className:"text-xs tabular-nums text-oai-gray-500 dark:text-oai-gray-400",children:i}):null]}),a.jsxs("dl",{className:"mt-5 w-full space-y-3 border-t border-oai-gray-200/70 pt-4 text-left dark:border-oai-gray-800/60",children:[a.jsxs("div",{className:"flex items-baseline justify-between gap-3 text-sm",children:[a.jsx("dt",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:h("achievements.modal.value_label")}),a.jsx("dd",{className:"font-mono font-semibold tabular-nums text-oai-black dark:text-white",children:f})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-baseline justify-between gap-3 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:[a.jsx("span",{children:e.tier>=4?h("achievements.modal.max_tier"):h("achievements.modal.progress_to_next",{tier:h(`achievements.tier.${p}`)})}),e.tier<4&&e.next_threshold!=null?a.jsxs("span",{className:"font-mono tabular-nums",children:[f," ",e.lower_is_better?"→":"/"," ",ue(n?.format,e.next_threshold)]}):null]}),a.jsx("div",{className:"mt-1.5 h-1.5 w-full overflow-hidden rounded-full bg-oai-gray-200 dark:bg-oai-gray-800",children:a.jsx("div",{className:"h-full rounded-full transition-[width] duration-500",style:{width:`${Math.round((e.tier>=4?1:m)*100)}%`,background:s?`linear-gradient(90deg, ${T[c].rim[0]} 0%, ${T[c].ring} 55%, ${T[c].rim[1]} 100%)`:"rgba(128,134,130,0.75)",boxShadow:s?"inset 0 1px 1px rgba(255,255,255,0.35)":void 0}})})]}),a.jsxs("div",{className:"flex items-center justify-between gap-3 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:[a.jsx("span",{children:h("achievements.modal.tier_history")}),a.jsx($t,{badge:e})]})]})]})}const xe=ye("relative w-full max-w-[380px] 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","dark:border-t dark:border-white/[0.08]");function Ut({badge:e,onClose:t}){const n=De(),r=!!e;return L.useEffect(()=>{if(!n||!r)return;const s=c=>{c.key==="Escape"&&(c.stopPropagation(),t?.())};return window.addEventListener("keydown",s,!0),()=>window.removeEventListener("keydown",s,!0)},[n,r,t]),r?n?a.jsxs("div",{className:"fixed inset-0 z-[120] flex items-center justify-center p-4",children:[a.jsx("div",{className:"absolute inset-0 bg-black/40 backdrop-blur-[2px]",onClick:t,"aria-hidden":!0}),a.jsx("div",{className:xe,children:a.jsx(ge,{badge:e,onClose:t})})]}):a.jsx(nt,{open:!0,onOpenChange:s=>{s||t?.()},children:a.jsxs(rt,{children:[a.jsx(at,{className:"cost-modal-backdrop z-[110]"}),a.jsx(st,{className:"fixed inset-0 z-[120] flex items-center justify-center p-4",children:a.jsxs(it,{className:ye("cost-modal-popup",xe),children:[a.jsx(ot,{render:a.jsx("h2",{className:"sr-only"}),children:h(U(e.id,"name"))}),a.jsx(ge,{badge:e,onClose:t})]})})]})}):null}export{Ut as BadgeDetailModal,Tt as currentBadgeIssueNumber,Ut as default,Vt as formatIssueNumber};
import{j as r,d as e}from"./__vite-browser-external-CeOnjjgl.js";function n({children:i,title:a,subtitle:o,className:s="",bodyClassName:d=""}){return r.jsxs("div",{className:e("rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 transition-colors duration-200",s),children:[(a||o)&&r.jsxs("div",{className:"px-5 py-4 border-b border-oai-gray-200 dark:border-oai-gray-800 transition-colors duration-200",children:[a&&r.jsx("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide transition-colors duration-200",children:a}),o&&r.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-300 mt-1 transition-colors duration-200",children:o})]}),r.jsx("div",{className:`p-5 ${d}`,children:i})]})}export{n as C};
import{l as c}from"./__vite-browser-external-CeOnjjgl.js";const e=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],t=c("check",e);export{t as C};
import{l as o}from"./__vite-browser-external-CeOnjjgl.js";const t=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],c=o("chevron-right",t);export{c as C};
import{r,j as f}from"./__vite-browser-external-CeOnjjgl.js";function p(e){const n=String(e||"").trim().toLowerCase();return/^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$/.test(n)?n:"clawd"}const C=.84;function L(e){return p(e)==="clawd"?C:1}const z={idle:{row:0,durations:[280,110,110,140,140,320]},"running-right":{row:1,durations:[120,120,120,120,120,120,120,220]},"running-left":{row:2,durations:[120,120,120,120,120,120,120,220]},waving:{row:3,durations:[140,140,140,280]},jumping:{row:4,durations:[140,140,140,140,280]},failed:{row:5,durations:[140,140,140,140,140,140,140,240]},waiting:{row:6,durations:[150,150,150,150,150,260]},running:{row:7,durations:[120,120,120,120,120,220]},review:{row:8,durations:[150,150,150,150,150,280]}};function T(e){return["error","disconnected","working-overheated"].includes(e)?"failed":["happy","waking","mini-happy","jumping"].includes(e)?"jumping":["working-typing","working-ultrathink","working-juggling","running"].includes(e)?"running":["working-thinking","working-wizard","review"].includes(e)?"review":["sleeping","idle-doze","mini-sleep","waiting"].includes(e)?"waiting":["mini-peek","waving"].includes(e)?"waving":e==="running-left"||e==="running-right"?e:"idle"}function V(){const[e,n]=r.useState(()=>typeof document>"u"?!0:document.visibilityState!=="hidden");return r.useEffect(()=>{if(typeof document>"u")return;const t=()=>n(document.visibilityState!=="hidden");return document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},[]),e}function _(){const[e,n]=r.useState(()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches);return r.useEffect(()=>{if(typeof window.matchMedia!="function")return;const t=window.matchMedia("(prefers-reduced-motion: reduce)"),i=o=>n(o.matches);return t.addEventListener("change",i),()=>t.removeEventListener("change",i)},[]),e}function I({character:e,pet:n=null,state:t="idle-living",dragState:i=null,size:o=48,className:d="",lookDirectionIndex:u=null}){const l=p(e),g=i==="running-left"||i==="running-right"?i:T(t),a=z[g],s=n?.spriteVersionNumber===2?2:1,w=s===2?11:9,c=s===2&&g==="idle"&&Number.isInteger(u)?(u%16+16)%16:null,h=c==null?a.row:9+Math.floor(c/8),m=c==null?null:c%8,k=_(),y=V(),[b,S]=r.useState(0);r.useEffect(()=>{if(S(0),k||!y||c!=null)return;let M=!1,x=0;const E=$=>{x=window.setTimeout(()=>{if(M)return;const j=($+1)%a.durations.length;S(j),E(j)},a.durations[$])};return E(0),()=>{M=!0,window.clearTimeout(x)}},[c,k,y,a]);const A=r.useMemo(()=>({width:o*(192/208),height:o,backgroundImage:`url(${n?.assetUrl||`/pets/${l}/spritesheet.webp`})`,backgroundRepeat:"no-repeat",backgroundSize:`800% ${w*100}%`,backgroundPosition:`${(m??b)/7*100}% ${h/(w-1)*100}%`,imageRendering:"pixelated"}),[w,m,h,b,l,n?.assetUrl,o]);return f.jsx("div",{"aria-hidden":"true",className:`pet-atlas-animated ${d}`,style:A})}const R={"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"},v=new Map;async function P(e){if(v.has(e))return v.get(e);if(typeof fetch!="function")return null;let n;try{n=await fetch(`/clawd/${e}`)}catch{return null}if(!n.ok)return null;const i=(await n.text()).replace(/<svg([^>]*)>/,(o,d)=>`<svg${d.replace(/\s+width="[^"]*"/g,"").replace(/\s+height="[^"]*"/g,"")} width="100%" height="100%">`);return v.set(e,i),i}function H({state:e="idle-living",size:n=48,className:t=""}){const[i,o]=r.useState(""),d=r.useRef(null),l=N()?"static-base":e,g=R[l]||R["static-base"];return r.useEffect(()=>{let a=!1;return P(g).then(s=>{!a&&s&&o(s)}),()=>{a=!0}},[g]),r.useEffect(()=>{const a=d.current?.querySelector("svg");if(a)try{const s=a.getBBox();s.width>0&&s.height>0&&a.setAttribute("viewBox",`${s.x-2} ${s.y-2} ${s.width+4} ${s.height+4}`)}catch{}},[i]),f.jsx("div",{ref:d,"aria-hidden":"true",className:`clawd-animated ${t}`,style:{width:n,height:n,display:"inline-flex",alignItems:"center",justifyContent:"center",overflow:"hidden"},dangerouslySetInnerHTML:{__html:i}})}function B({state:e="idle-living",size:n=48,className:t="",character:i="clawd",pet:o=null,lookDirectionIndex:d=null}){const u=p(i);return u!=="clawd"?f.jsx(I,{character:u,pet:o,state:e,size:n,className:t,lookDirectionIndex:d}):f.jsx(H,{state:e,size:n*L(u),className:t})}function N(){const[e,n]=r.useState(()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches);return r.useEffect(()=>{if(typeof window.matchMedia!="function")return;const t=window.matchMedia("(prefers-reduced-motion: reduce)"),i=o=>n(o.matches);return t.addEventListener("change",i),()=>t.removeEventListener("change",i)},[]),e}export{B as C,p as n};
import{l as M,e as D,r,F as E,c as i,j as o,d as I}from"./__vite-browser-external-CeOnjjgl.js";import{m as j}from"./react-CgmQzSd0.js";import{P as L}from"./ProviderIcon-C8fKhRQt.js";import{g as A}from"./skills-api-CcfxTvl9.js";import{S as $}from"./search-BpgAnH3M.js";import{u as R}from"./use-reduced-motion-DUgAHZln.js";import{A as K}from"./index-DtrsMn3Y.js";const q=[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]],O=M("corner-down-left",q),T=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");function Q(){const f=D(),d=R(),[u,g]=r.useState(!1),[x,h]=r.useState(""),[n,l]=r.useState(0),[p,k]=r.useState([]),b=r.useRef(null),w=r.useRef(null);r.useEffect(()=>{const e=t=>{(t.metaKey||t.ctrlKey)&&(t.key==="k"||t.key==="K")&&(t.preventDefault(),g(c=>!c))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]),r.useEffect(()=>{if(!u)return;h(""),l(0);const e=requestAnimationFrame(()=>b.current?.focus());return T&&!p.length&&A().then(t=>k(t?.skills||[])).catch(()=>k([])),()=>cancelAnimationFrame(e)},[u,p.length]);const y=r.useMemo(()=>{const e=E().flatMap(a=>a.items.map(c=>({kind:"page",id:`page:${c.id}`,label:c.label,sub:i("cmdk.group.pages"),Icon:c.icon,run:()=>f(c.to)}))),t=(p||[]).map(a=>({kind:"skill",id:`skill:${a.id||a.directory}`,label:a.name||a.directory,sub:a.repoOwner&&a.repoName?`${a.repoOwner}/${a.repoName}`:i("cmdk.group.skills"),provider:(a.targets||[])[0]||"claude",run:()=>f(`/skills?skill=${encodeURIComponent(a.directory||a.id)}`)}));return[...e,...t]},[f,p]),s=r.useMemo(()=>{const e=x.trim().toLowerCase();return e?y.filter(t=>t.label.toLowerCase().includes(e)||String(t.sub||"").toLowerCase().includes(e)):y},[y,x]);r.useEffect(()=>{n>=s.length&&l(s.length?s.length-1:0)},[n,s.length]),r.useEffect(()=>{if(!u)return;w.current?.querySelector(`[data-cmdk-index="${n}"]`)?.scrollIntoView({block:"nearest"})},[n,u]);const m=r.useCallback(()=>g(!1),[]),v=r.useCallback(e=>{e&&(m(),e.run())},[m]),N=e=>{e.key==="ArrowDown"?(e.preventDefault(),l(t=>Math.min(t+1,Math.max(0,s.length-1)))):e.key==="ArrowUp"?(e.preventDefault(),l(t=>Math.max(t-1,0))):e.key==="Enter"?(e.preventDefault(),v(s[n])):e.key==="Escape"&&(e.preventDefault(),m())},C={duration:d?0:.12},S=d?{duration:0}:{type:"spring",stiffness:460,damping:34,mass:.6};return o.jsx(K,{children:u?o.jsxs(j.div,{className:"fixed inset-0 z-[120] flex items-start justify-center px-4 pt-[16vh]",initial:d?!1:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:C,children:[o.jsx("button",{type:"button","aria-label":i("cmdk.close"),onClick:m,className:"absolute inset-0 cursor-default bg-oai-black/40"}),o.jsxs(j.div,{role:"dialog","aria-modal":"true","aria-label":i("cmdk.open_aria"),initial:d?!1:{opacity:0,y:-8,scale:.985},animate:{opacity:1,y:0,scale:1},exit:d?{opacity:0}:{opacity:0,y:-8,scale:.985},transition:S,className:"relative w-full max-w-xl overflow-hidden rounded-2xl border border-oai-gray-200 bg-oai-white shadow-2xl dark:border-oai-gray-800 dark:bg-oai-gray-950",children:[o.jsxs("div",{className:"flex items-center gap-2.5 border-b border-oai-gray-200 px-4 dark:border-oai-gray-800",children:[o.jsx($,{className:"h-4 w-4 shrink-0 text-oai-gray-400","aria-hidden":!0}),o.jsx("input",{ref:b,type:"text",value:x,onChange:e=>{h(e.target.value),l(0)},onKeyDown:N,"aria-label":i("cmdk.placeholder"),"aria-controls":"cmdk-listbox","aria-activedescendant":s[n]?`cmdk-opt-${n}`:void 0,role:"combobox","aria-expanded":"true",placeholder:i("cmdk.placeholder"),className:"h-12 w-full bg-transparent text-sm text-oai-black placeholder:text-oai-gray-400 focus:outline-none dark:text-white"})]}),o.jsx("div",{ref:w,id:"cmdk-listbox",role:"listbox",className:"max-h-[min(56vh,22rem)] overflow-y-auto p-1.5",children:s.length===0?o.jsx("div",{className:"px-3 py-8 text-center text-sm text-oai-gray-500 dark:text-oai-gray-400",children:i("cmdk.empty")}):s.map((e,t)=>{const a=t===n;return o.jsxs("button",{type:"button",role:"option",id:`cmdk-opt-${t}`,"data-cmdk-index":t,"aria-selected":a,onMouseMove:()=>l(t),onClick:()=>v(e),className:I("flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-sm transition-colors",a?"bg-oai-gray-100 text-oai-black dark:bg-oai-gray-800/70 dark:text-white":"text-oai-gray-700 dark:text-oai-gray-200"),children:[o.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center text-oai-gray-500 dark:text-oai-gray-400",children:e.kind==="skill"?o.jsx(L,{provider:e.provider,size:16}):o.jsx(e.Icon,{className:"h-4 w-4","aria-hidden":!0})}),o.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:e.label}),o.jsx("span",{className:"shrink-0 truncate text-xs text-oai-gray-400 dark:text-oai-gray-500",children:e.sub}),a?o.jsx(O,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-400","aria-hidden":!0}):null]},e.id)})})]})]}):null})}export{Q as CommandPalette};
import{l as L,j as e,U as R,m as P,r as D,c as n,X as z,k as S}from"./__vite-browser-external-CeOnjjgl.js";import{m as M}from"./react-CgmQzSd0.js";import{A as K,W as U}from"./icons-mjdAc-2x.js";import{u as B}from"./useTokenFormat-RvsCI_oE.js";import{P as F}from"./ProviderIcon-C8fKhRQt.js";import{T as G}from"./TrendMonitor-C7g8DZSW.js";import{T as W}from"./AchievementBadge-BhAc3c3S.js";import{T as V}from"./terminal-Dbn_YmPM.js";import{D as X,a as Y,b as Z,c as H,d as q,e as J}from"./DialogTitle-mSFue3N1.js";import{D as Q}from"./DialogDescription-BFVeSjTD.js";import{D as ee}from"./DialogClose-DaB9Ae7L.js";import"./useCurrency-BS_xyhhg.js";import"./chevron-right-kOKJJLco.js";import"./PopoverPopup-JsU4A3UY.js";import"./useScrollLock-Ct5GyoVg.js";import"./store-BLjK5TrP.js";import"./ToolbarRootContext-Bs1pZOOn.js";import"./maximize-2-6nkX0TnZ.js";import"./use-reduced-motion-DUgAHZln.js";import"./zap-D0DQz21w.js";import"./flame-BEU-cqaV.js";const ae=[["path",{d:"M16 17h6v-6",key:"t6n2it"}],["path",{d:"m22 17-8.5-8.5-5 5L2 7",key:"x473p"}]],te=L("trending-down",ae),O=10,_={input:"var(--community-token-input)",cache_read:"var(--community-token-cache-read)",cache_write:"var(--community-token-cache-write)",output:"var(--community-token-output)",reasoning:"var(--community-token-reasoning)"},re={CLAUDE:"var(--community-claude)",CODEX:"var(--community-codex)",GEMINI:"var(--community-gemini)",CURSOR:"var(--community-cursor)",OPENCODE:"var(--community-opencode)",HERMES:"var(--community-hermes)",KIMI:"var(--community-kimi)",MIMO:"var(--community-mimo)",COPILOT:"var(--community-copilot)",KIRO:"var(--community-kiro)",GROK:"var(--community-grok)",DEEPSEEK:"var(--community-deepseek)",ZCODE:"var(--community-zcode)",WORKBUDDY:"var(--community-workbuddy)",MINIMAX:"var(--community-minimax)",DROID:"var(--community-droid)"};function ie(t){return re[String(t||"").toUpperCase()]||"var(--community-muted)"}const se=[[/claude|fable|opus|sonnet|haiku/,"CLAUDE"],[/gpt|codex|o3|o4/,"CODEX"],[/gemini/,"GEMINI"],[/composer|cursor/,"CURSOR"],[/kimi/,"KIMI"],[/mimo/,"MIMO"],[/copilot/,"COPILOT"],[/kiro/,"KIRO"],[/grok/,"GROK"],[/deepseek/,"DEEPSEEK"],[/glm/,"ZCODE"],[/hy3/,"WORKBUDDY"],[/minimax/,"MINIMAX"]],g=["overview","providers","community","models"];function oe(t){const s=String(t||"").toLowerCase(),a=se.find(([i])=>i.test(s));return a?a[1]:""}function u(t){const s=Number(t);return Number.isFinite(s)?`${s.toFixed(1)}%`:"—"}function p(t){return S(Number(t)||0)}function ne(t){return t?new Date(`${t}T00:00:00Z`).toLocaleDateString(void 0,{month:"short",day:"numeric",timeZone:"UTC"}):""}function k(){return e.jsx("div",{className:"flex h-full min-h-40 items-center justify-center text-xs text-oai-gray-400",children:n("leaderboard.community.modal.no_data")})}function b({children:t,detail:s}){return e.jsxs("div",{className:"mb-3 flex items-baseline justify-between gap-4",children:[e.jsx("h3",{className:"text-xs font-medium uppercase tracking-wide text-oai-gray-500 dark:text-oai-gray-400",children:t}),s?e.jsx("span",{className:"text-xs text-oai-gray-400",children:s}):null]})}function C({value:t,label:s}){const a=Number(t);if(!Number.isFinite(a))return null;const i=Math.sign(a)!==-1,r=i?W:te;return e.jsxs("span",{className:`inline-flex items-center gap-1 text-xs font-medium tabular-nums ${i?"text-emerald-600 dark:text-emerald-400":"text-rose-600 dark:text-rose-400"}`,title:s,children:[e.jsx(r,{className:"size-3","aria-hidden":"true"}),i?"+":"",a.toFixed(1),"%"]})}function j({label:t,value:s,title:a,delta:i,deltaLabel:r}){return e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-xs font-medium text-oai-gray-500 dark:text-oai-gray-400",children:t}),e.jsxs("div",{className:"mt-1 flex min-w-0 items-baseline gap-2",children:[e.jsx("span",{className:"truncate text-xl font-semibold leading-none tracking-tight text-oai-black tabular-nums dark:text-white",title:a,children:s}),e.jsx(C,{value:i,label:r})]})]})}function I({fillWidth:t,share:s,color:a="var(--oai-blue)",ariaLabel:i,dataAttrs:r,children:o}){return e.jsxs("div",{...r,className:"group relative grid min-h-11 grid-cols-[minmax(0,1fr)_auto] items-center gap-3 overflow-hidden px-2.5 transition-colors hover:bg-oai-gray-50 dark:hover:bg-oai-gray-900/60",children:[e.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-0 opacity-[0.15] transition-opacity group-hover:opacity-[0.22] dark:opacity-[0.24] dark:group-hover:opacity-[0.32]",style:{width:`${t}%`,backgroundColor:a},role:"progressbar","aria-label":i,"aria-valuemin":"0","aria-valuemax":"100","aria-valuenow":Number(s)||0}),o]})}function A({rank:t,provider:s,name:a,fillWidth:i,share:r,tokens:o,tokensTitle:l,dataAttrs:c}){return e.jsxs(I,{fillWidth:i,share:r,color:ie(s),ariaLabel:`${a} ${u(r)}`,dataAttrs:c,children:[e.jsxs("div",{className:"relative flex min-w-0 items-center gap-2.5",children:[e.jsx("span",{className:`w-5 shrink-0 text-xs tabular-nums ${t<=3?"font-semibold text-oai-gray-700 dark:text-oai-gray-200":"text-oai-gray-400"}`,children:t}),e.jsx("span",{className:"grid size-6 shrink-0 place-items-center text-oai-gray-700 dark:text-oai-gray-200",children:e.jsx(F,{provider:s,size:15})}),e.jsx("span",{className:"truncate text-xs font-medium text-oai-gray-700 dark:text-oai-gray-200",title:a,children:a})]}),e.jsxs("div",{className:"relative min-w-[4.5rem] text-right",children:[e.jsx("div",{className:"text-xs font-semibold text-oai-black tabular-nums dark:text-white",title:l,children:o}),e.jsx("div",{className:"text-xs text-oai-gray-500 tabular-nums dark:text-oai-gray-400",children:u(r)})]})]})}function le({rows:t,formatTokensTooltip:s}){return t.length?e.jsxs("div",{className:"mt-7",children:[e.jsx(b,{children:n("leaderboard.community.modal.token_mix")}),e.jsx("div",{className:"flex h-1.5 overflow-hidden bg-oai-gray-100 dark:bg-oai-gray-800",children:t.map(a=>e.jsx("div",{style:{width:`${Math.max(Number(a.share)||0,0)}%`,backgroundColor:_[a.key]||"var(--community-muted)"},title:`${n(`leaderboard.community.modal.token_mix.${a.key}`)} · ${u(a.share)}`},a.key))}),e.jsx("div",{className:"mt-3 flex flex-wrap gap-x-5 gap-y-1.5",children:t.map(a=>e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs text-oai-gray-500 dark:text-oai-gray-400",title:s(a.tokens),children:[e.jsx("span",{className:"size-2",style:{backgroundColor:_[a.key]||"var(--community-muted)"}}),n(`leaderboard.community.modal.token_mix.${a.key}`),e.jsx("span",{className:"tabular-nums text-oai-gray-700 dark:text-oai-gray-200",children:u(a.share)})]},a.key))})]}):null}function f({label:t,value:s,title:a,delta:i,deltaLabel:r,className:o=""}){return e.jsxs("div",{className:`min-w-0 ${o}`,children:[e.jsx("div",{className:"truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:t}),e.jsxs("div",{className:"mt-1 flex min-w-0 items-baseline gap-2",children:[e.jsx("span",{className:"truncate text-base font-semibold leading-none tracking-tight tabular-nums text-oai-black dark:text-white",title:a,children:s}),e.jsx(C,{value:i,label:r})]})]})}function de({trendRows:t,activeDevelopers30d:s,developerGrowthPct:a,formatTokens:i,formatTokensTooltip:r}){if(!t.length)return null;const o=t.reduce((m,h)=>m+h.value,0),l=t.reduce((m,h)=>m.value<h.value?h:m,t[0]),c=o/t.length;return e.jsxs("div",{className:"mt-5 grid grid-cols-3 divide-x divide-oai-gray-100 border-y border-oai-gray-100 py-3.5 dark:divide-oai-gray-800/80 dark:border-oai-gray-800/80",children:[e.jsx(f,{className:"pr-4",label:n("leaderboard.community.modal.daily_average"),value:i(c),title:r(c)}),e.jsx(f,{className:"px-4",label:`${n("leaderboard.community.modal.peak_day")} · ${l.day}`,value:i(l.value),title:r(l.value)}),e.jsx(f,{className:"pl-4",label:n("leaderboard.community.modal.active_30d"),value:p(s),title:Number(s).toLocaleString(),delta:a,deltaLabel:n("leaderboard.community.modal.vs_previous_week")})]})}function me({trendRows:t,mix:s,activeDevelopers30d:a,developerGrowthPct:i,formatTokens:r,formatTokensTooltip:o}){return!t.length&&!s.length?e.jsx(k,{}):e.jsxs("div",{children:[e.jsx(b,{detail:n("leaderboard.community.modal.utc_note"),children:n("leaderboard.community.modal.community_activity")}),e.jsx(G,{embedded:!0,rows:t,from:t[0]?.day,to:t.at(-1)?.day,chartHeightClass:"h-44"}),e.jsx(de,{trendRows:t,activeDevelopers30d:a,developerGrowthPct:i,formatTokens:r,formatTokensTooltip:o}),e.jsx(le,{rows:s,formatTokensTooltip:o})]})}function ce({rows:t,maxShare:s,formatTokens:a,formatTokensTooltip:i}){return t.length?e.jsx("div",{className:"space-y-0.5",children:t.map((r,o)=>e.jsx(A,{rank:o+1,dataAttrs:{"data-provider-rank":o+1,"data-provider-name":r.name},provider:String(r.name).toUpperCase(),name:r.name,fillWidth:Math.max((Number(r.share)||0)/s*100,2),share:r.share,tokens:a(r.tokens),tokensTitle:i(r.tokens)},r.name))}):e.jsx(k,{})}function xe({rows:t,maxShare:s,formatTokens:a,formatTokensTooltip:i}){return t.length?e.jsx("div",{className:"space-y-0.5",children:t.map((r,o)=>{const l=Number(r.share)||0;return e.jsx(A,{rank:o+1,dataAttrs:{"data-model-rank":o+1,"data-model-name":r.name},provider:oe(r.name),name:r.name,fillWidth:Math.max(l/s*100,2),share:l,tokens:a(r.tokens),tokensTitle:i(r.tokens)},r.name)})}):e.jsx(k,{})}function ue({name:t}){const s=String(t||"").toLowerCase();return s==="darwin"?e.jsx(K,{className:"size-3.5"}):s==="win32"?e.jsx(U,{className:"size-3.5"}):e.jsx(V,{className:"size-4","aria-hidden":"true"})}const he=.175,ye=.3;function ge({bands:t,formatTokensTooltip:s}){const a=t.reduce((r,o)=>Math.max(r,Number(o.developer_share)||0),0)||1,i=r=>`${n(`leaderboard.community.modal.band.${r.key}`)} · ${n("leaderboard.community.modal.developer_count",{count:p(r.developers)})} (${s(r.tokens)})`;return e.jsxs("div",{children:[e.jsx("div",{className:"flex gap-2 border-b border-oai-gray-200 dark:border-oai-gray-800",children:t.map((r,o)=>{const l=Number(r.developer_share)||0,c=Math.max(l/a*80,2);return e.jsxs("div",{className:"relative h-32 min-w-0 flex-1",title:i(r),children:[e.jsx("div",{role:"progressbar","aria-label":n("leaderboard.community.modal.developer_share_title",{share:u(l)}),"aria-valuemin":"0","aria-valuemax":"100","aria-valuenow":l,className:"absolute inset-x-0 bottom-0",style:{height:`${c}%`,backgroundColor:"var(--oai-blue)",opacity:ye+o*he}}),e.jsx("div",{className:"absolute inset-x-0 text-center text-xs font-medium tabular-nums text-oai-gray-700 dark:text-oai-gray-200",style:{bottom:`calc(${c}% + 4px)`},children:u(l)})]},r.key)})}),e.jsx("div",{className:"mt-2 flex gap-2",children:t.map(r=>e.jsxs("div",{className:"min-w-0 flex-1 text-center",title:i(r),children:[e.jsx("div",{className:"truncate text-xs font-medium text-oai-gray-700 dark:text-oai-gray-200",children:n(`leaderboard.community.modal.band.${r.key}`)}),e.jsx("div",{className:"truncate text-xs tabular-nums text-oai-gray-500 dark:text-oai-gray-400",children:p(r.developers)})]},r.key))})]})}function pe({bands:t,platforms:s,formatTokensTooltip:a}){return!t.length&&!s.length?e.jsx(k,{}):e.jsxs("div",{className:"space-y-8",children:[t.length?e.jsxs("div",{children:[e.jsx(b,{children:n("leaderboard.community.modal.usage_distribution")}),e.jsx(ge,{bands:t,formatTokensTooltip:a})]}):null,s.length?e.jsxs("div",{children:[e.jsx(b,{children:n("leaderboard.community.modal.platforms")}),e.jsx("div",{className:"space-y-0.5",children:s.map(i=>e.jsxs(I,{fillWidth:Math.max(Number(i.share)||0,1),share:i.share,ariaLabel:`${n(`leaderboard.community.modal.platform.${i.name}`)} ${u(i.share)}`,children:[e.jsxs("div",{className:"relative flex min-w-0 items-center gap-2.5",children:[e.jsx("span",{className:"grid size-6 shrink-0 place-items-center text-oai-gray-700 dark:text-oai-gray-200",children:e.jsx(ue,{name:i.name})}),e.jsx("span",{className:"truncate text-xs font-medium text-oai-gray-700 dark:text-oai-gray-200",children:n(`leaderboard.community.modal.platform.${i.name}`)})]}),e.jsxs("div",{className:"relative min-w-[4.5rem] text-right",children:[e.jsx("div",{className:"text-xs font-semibold text-oai-black tabular-nums dark:text-white",children:u(i.share)}),e.jsx("div",{className:"text-xs text-oai-gray-500 tabular-nums dark:text-oai-gray-400",title:Number(i.machines||0).toLocaleString(),children:n("leaderboard.community.modal.machine_count",{count:p(i.machines)})})]})]},i.name))})]}):null]})}function ve({isOpen:t,onClose:s,communityStats:a}){const{formatTokens:i,formatTokensTooltip:r}=B(),[o,l]=D.useState("overview"),c=a?.status==="ready",m=D.useMemo(()=>{if(!c)return null;const d=(Array.isArray(a.providers)?a.providers:[]).slice(0,O),x=(Array.isArray(a.topModels)?a.topModels:[]).slice(0,O),y=v=>v.reduce((E,$)=>Math.max(E,Number($.share)||0),0)||1;return{providers:d,models:x,providersMaxShare:y(d),modelsMaxShare:y(x),trendRows:(Array.isArray(a.dailyGrowth)?a.dailyGrowth:[]).map(v=>({day:ne(v.day),value:Number(v.tokens)||0})),mix:Array.isArray(a.tokenMix)?a.tokenMix:[],bands:Array.isArray(a.userDistribution)?a.userDistribution:[],platforms:Array.isArray(a.platforms)?a.platforms:[]}},[c,a]);if(!m)return null;const h=Number(a.tokenFloor)||0,N=Number(a.activeDevelopersTotal)||Number(a.totalEntries)||0,w=Number(a.tokens30d)||0,T=d=>{if(d.key!=="ArrowRight"&&d.key!=="ArrowLeft")return;d.preventDefault();const x=d.key==="ArrowRight"?1:-1,y=g[(g.indexOf(o)+x+g.length)%g.length];l(y),d.currentTarget.querySelector(`[data-tab-id="${y}"]`)?.focus()};return e.jsx(X,{open:t,onOpenChange:d=>!d&&s(),children:e.jsxs(Y,{children:[e.jsx(Z,{className:"fixed inset-0 z-[100] bg-black/50 backdrop-blur-[3px] transition-opacity duration-200 ease-out data-[ending-style]:opacity-0 data-[starting-style]:opacity-0"}),e.jsx(H,{className:"fixed inset-0 z-[101] flex items-center justify-center p-2 sm:p-5",children:e.jsxs(q,{className:"relative flex h-[min(42rem,92vh)] w-full max-w-xl flex-col overflow-hidden rounded-2xl bg-white shadow-2xl ring-1 ring-black/10 transition-[opacity,transform] duration-[220ms] ease-[cubic-bezier(0.16,1,0.3,1)] data-[ending-style]:translate-y-3 data-[ending-style]:scale-[0.98] data-[ending-style]:opacity-0 data-[starting-style]:translate-y-3 data-[starting-style]:scale-[0.98] data-[starting-style]:opacity-0 dark:bg-oai-gray-950 dark:ring-white/10",children:[e.jsxs("header",{"data-testid":"community-metrics-header",className:"shrink-0 px-5 pt-5 sm:px-6",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx(J,{className:"text-lg font-semibold tracking-[-0.02em] text-oai-black dark:text-white",children:n("leaderboard.community.modal.title")}),e.jsx(Q,{className:"sr-only",children:n("leaderboard.community.modal.description")})]}),e.jsx(ee,{className:"-mr-1 -mt-1 grid size-8 place-items-center rounded-full text-oai-gray-400 transition-colors hover:bg-black/5 hover:text-oai-black dark:hover:bg-white/10 dark:hover:text-white","aria-label":n("shared.dialog.close"),children:e.jsx(z,{className:"size-4"})})]}),e.jsxs("div",{className:"mt-4 grid grid-cols-3 gap-x-5",children:[e.jsx(j,{label:n("leaderboard.community.modal.total_tokens"),value:i(h),title:r(h)}),e.jsx(j,{label:n("leaderboard.community.modal.tokens_30d"),value:i(w),title:r(w),delta:a.tokenGrowthPct,deltaLabel:n("leaderboard.community.modal.vs_previous_week")}),e.jsx(j,{label:n("leaderboard.community.modal.contributors"),value:p(N),title:N.toLocaleString()})]}),e.jsx("div",{className:"mt-4 flex items-end overflow-x-auto border-b border-oai-gray-100 dark:border-oai-gray-900",role:"tablist","aria-label":n("leaderboard.community.modal.views"),onKeyDown:T,children:g.map(d=>{const x=o===d;return e.jsxs("button",{type:"button",role:"tab","data-tab-id":d,"aria-selected":x,tabIndex:x?0:-1,onClick:()=>l(d),className:`relative mr-5 h-10 shrink-0 text-sm font-medium transition-colors last:mr-0 ${x?"text-oai-black dark:text-white":"text-oai-gray-500 hover:text-oai-gray-700 dark:text-oai-gray-400 dark:hover:text-oai-gray-200"}`,children:[n(`leaderboard.community.modal.tab.${d}`),x?e.jsx(M.span,{layoutId:"community-metrics-tab-underline",className:"absolute inset-x-0 -bottom-px h-0.5 rounded-full bg-oai-black dark:bg-white",transition:{type:"spring",stiffness:420,damping:34}}):null]},d)})})]}),e.jsx("div",{"data-testid":"community-metrics-content",className:"min-h-0 flex-1 overflow-y-auto px-5 py-5 sm:px-6",children:e.jsxs(M.div,{initial:{opacity:0,y:4},animate:{opacity:1,y:0},transition:{duration:.18,ease:[.16,1,.3,1]},className:"h-full",children:[o==="overview"?e.jsx(me,{trendRows:m.trendRows,mix:m.mix,activeDevelopers30d:Number(a.activeDevelopers30d)||0,developerGrowthPct:a.developerGrowthPct,formatTokens:i,formatTokensTooltip:r}):null,o==="providers"?e.jsx(ce,{rows:m.providers,maxShare:m.providersMaxShare,formatTokens:i,formatTokensTooltip:r}):null,o==="community"?e.jsx(pe,{bands:m.bands,platforms:m.platforms,formatTokensTooltip:r}):null,o==="models"?e.jsx(xe,{rows:m.models,maxShare:m.modelsMaxShare,formatTokens:i,formatTokensTooltip:r}):null]},o)})]})})]})})}function Ke(t){return e.jsx(R,{mode:P.COMPACT,children:e.jsx(ve,{...t})})}export{Ke as CommunityStatsModal};
import{j as a,B as i,d as x}from"./__vite-browser-external-CeOnjjgl.js";import{D as p,a as m,b as y,c as b,d as f,e as u}from"./DialogTitle-mSFue3N1.js";import{D as h}from"./DialogDescription-BFVeSjTD.js";function _({open:r,title:l,description:t,confirmLabel:o,cancelLabel:n,destructive:d=!1,busy:e=!1,onConfirm:c,onCancel:s}){return a.jsx(p,{open:r,onOpenChange:g=>{!g&&!e&&s?.()},children:a.jsxs(m,{children:[a.jsx(y,{className:"fixed inset-0 z-[100] bg-black/40 backdrop-blur-[2px] transition-opacity duration-200 ease-out data-[ending-style]:opacity-0 data-[starting-style]:opacity-0"}),a.jsx(b,{className:"fixed inset-0 z-[101] flex items-center justify-center p-4",children:a.jsxs(f,{className:"relative w-full max-w-md rounded-2xl bg-white p-6 shadow-[0_20px_60px_-20px_rgba(0,0,0,0.25)] ring-1 ring-oai-gray-200 transition-[opacity,transform] duration-[220ms] ease-[cubic-bezier(0.16,1,0.3,1)] data-[ending-style]:translate-y-2 data-[ending-style]:scale-[0.96] data-[ending-style]:opacity-0 data-[starting-style]:translate-y-2 data-[starting-style]:scale-[0.96] data-[starting-style]:opacity-0 dark:bg-oai-gray-950 dark:shadow-[0_20px_60px_-10px_rgba(0,0,0,0.65)] dark:ring-oai-gray-800",children:[a.jsx(u,{className:"text-base font-semibold text-oai-black dark:text-white",children:l}),t?a.jsx(h,{className:"mt-2 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:t}):null,a.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[a.jsx(i,{type:"button",variant:"secondary",size:"sm",disabled:e,onClick:()=>s?.(),children:n}),a.jsx(i,{type:"button",size:"sm",disabled:e,onClick:()=>c?.(),className:x(d&&"!bg-red-600 hover:!bg-red-700 focus-visible:!outline-red-600 dark:!bg-red-600 dark:hover:!bg-red-500"),children:o})]})]})})]})})}export{_ as C};
import{l as c}from"./__vite-browser-external-CeOnjjgl.js";const e=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],t=c("copy",e);export{t as C};

Sorry, the diff of this file is too big to display

import{a as b,r as l,j as r,c as e,h as v}from"./__vite-browser-external-CeOnjjgl.js";const x={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_APP_VERSION:"0.84.1",VITE_INSFORGE_ANON_KEY:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3OC0xMjM0LTU2NzgtOTBhYi1jZGVmMTIzNDU2NzgiLCJlbWFpbCI6ImFub25AaW5zZm9yZ2UuY29tIiwicm9sZSI6ImFub24iLCJpYXQiOjE3ODExNDU5NDd9.T0auta_IrVIh0uXW1bob5QSnzvsnJmN28r5XkSGEuQY",VITE_INSFORGE_BASE_URL:"https://srctyff5.us-east.insforge.app"};function f(){return v(),`${(x&&"https://srctyff5.us-east.insforge.app"||"https://srctyff5.us-east.insforge.app").replace(/\/$/,"")}/functions/tokentracker-device-flow-grant`}function p(s){return(s||"").toUpperCase().replace(/\s+/g,"").replace(/[^A-Z0-9-]/g,"")}function h(){const s=b(),[m,g]=l.useState(""),[i,a]=l.useState({kind:"idle",message:""});l.useEffect(()=>{try{const d=new URLSearchParams(window.location.search).get("user_code");d&&g(p(d))}catch{}},[]);async function u(c){if(c?.preventDefault?.(),!s?.signedIn){a({kind:"error",message:e("device.approval.error.sign_in")});return}const d=p(m);if(!/^[A-HJKMNP-Z2-9]{4}-[A-HJKMNP-Z2-9]{4}$/.test(d)){a({kind:"error",message:e("device.approval.error.invalid_code")});return}a({kind:"working",message:e("device.approval.action.approving")});try{const n=await s.getAccessToken?.();if(!n){a({kind:"error",message:e("device.approval.error.no_token")});return}const o=await fetch(f(),{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${n}`},body:JSON.stringify({user_code:d})}),t=await o.json().catch(()=>({}));o.ok?a({kind:"success",message:t.status==="already_approved"?t.client_info?e("device.approval.success.already_client",{client:t.client_info}):e("device.approval.success.already"):t.client_info?e("device.approval.success.approved_client",{client:t.client_info}):e("device.approval.success.approved")}):o.status===404?a({kind:"error",message:e("device.approval.error.not_found")}):o.status===410?a({kind:"error",message:e("device.approval.error.expired")}):o.status===401?a({kind:"error",message:e("device.approval.error.session_expired")}):a({kind:"error",message:t?.error?e("device.approval.error.server_detail",{message:t.error}):e("device.approval.error.server",{status:o.status})})}catch(n){a({kind:"error",message:e("device.approval.error.network",{message:n?.message||n})})}}return r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-white dark:bg-oai-gray-950 px-6 py-12",children:r.jsxs("div",{className:"w-full max-w-md rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-8",children:[r.jsx("h1",{className:"text-2xl font-semibold text-oai-gray-900 dark:text-white mb-2",children:e("device.approval.title")}),r.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400 mb-6",children:e("device.approval.description")}),s?.signedIn?null:r.jsx("div",{className:"rounded-md border border-amber-200 bg-amber-50 dark:bg-amber-900/20 dark:border-amber-800 p-4 mb-4",children:r.jsx("p",{className:"text-sm text-amber-700 dark:text-amber-300",children:e("device.approval.sign_in_banner")})}),r.jsxs("form",{onSubmit:u,className:"space-y-4",children:[r.jsxs("label",{className:"block",children:[r.jsx("span",{className:"block text-xs font-medium uppercase tracking-wide text-oai-gray-500 dark:text-oai-gray-400 mb-1",children:e("device.approval.code_label")}),r.jsx("input",{type:"text",value:m,onChange:c=>g(p(c.target.value)),placeholder:"XXXX-XXXX",spellCheck:!1,autoCapitalize:"characters",maxLength:9,className:"w-full font-mono text-xl tracking-widest text-center rounded-md border border-oai-gray-300 dark:border-oai-gray-700 bg-white dark:bg-oai-gray-900 text-oai-gray-900 dark:text-white px-4 py-3 focus:outline-none focus:ring-inset focus:ring-2 focus:ring-emerald-600"})]}),r.jsx("button",{type:"submit",disabled:i.kind==="working"||!s?.signedIn,className:"w-full rounded-md bg-emerald-600 hover:bg-emerald-500 disabled:bg-oai-gray-300 disabled:cursor-not-allowed text-white font-medium py-3 transition-colors",children:i.kind==="working"?e("device.approval.action.approving"):e("device.approval.action.approve")})]}),i.kind==="success"&&r.jsx("div",{className:"mt-4 rounded-md border border-emerald-200 bg-emerald-50 dark:bg-emerald-900/20 dark:border-emerald-800 p-4",children:r.jsx("p",{className:"text-sm text-emerald-700 dark:text-emerald-300",children:i.message})}),i.kind==="error"&&r.jsx("div",{className:"mt-4 rounded-md border border-red-200 bg-red-50 dark:bg-red-900/20 dark:border-red-800 p-4",children:r.jsx("p",{className:"text-sm text-red-700 dark:text-red-300",children:i.message})})]})})}export{h as default};
import{r as p,y as d,z as m,A as C,E as g}from"./__vite-browser-external-CeOnjjgl.js";import{u as v}from"./DialogTitle-mSFue3N1.js";const h=p.forwardRef(function(e,o){const{render:E,className:R,style:b,disabled:t=!1,nativeButton:n=!0,...a}=e,{store:s}=v(),r=s.useState("open"),{getButtonProps:l,buttonRef:i}=d({disabled:t,native:n}),u={disabled:t};function c(f){r&&s.setOpen(!1,C(g,f.nativeEvent))}return m("button",e,{state:u,ref:[o,i],props:[{onClick:c},a,l]})});export{h as D};
import{r as n,z as a}from"./__vite-browser-external-CeOnjjgl.js";import{u as p}from"./DialogTitle-mSFue3N1.js";import{u as c}from"./useScrollLock-Ct5GyoVg.js";const x=n.forwardRef(function(e,r){const{render:l,className:u,style:m,id:s,...t}=e,{store:i}=p(),o=c(s);return i.useSyncedValueWithCleanup("descriptionElementId",o),a("p",e,{ref:r,props:[{id:o},t]})});export{x as D};
import{r as l,ax as _,z as v,ay as F,az as J,j as E,aA as q,aB as G,A as Q,aC as X,aD as Z,aE as V,W as N,aF as A,V as h}from"./__vite-browser-external-CeOnjjgl.js";import{p as B,C as P,c as ee,a as te,b as ne,d as oe,I as se,e as ae,f as re,g as le,h as ie,i as de,j as ce,P as ue,s as pe,k as ge,l as fe,u as me}from"./useScrollLock-Ct5GyoVg.js";import{c as Se,p as Ce,a as Re}from"./store-BLjK5TrP.js";const z=l.createContext(!1),L=l.createContext(void 0);function D(e){const t=l.useContext(L);if(e===!1&&t===void 0)throw new Error(_(27));return t}const he={...B,...F},Ne=l.forwardRef(function(t,o){const{render:s,className:i,style:a,forceRender:c=!1,...u}=t,{store:r}=D(),n=r.useState("open"),f=r.useState("nested"),S=r.useState("mounted"),m=r.useState("transitionStatus");return v("div",t,{state:{open:n,transitionStatus:m},ref:[r.context.backdropRef,o],stateAttributesMapping:he,props:[{role:"presentation",hidden:!S,style:{userSelect:"none",WebkitUserSelect:"none"}},u],enabled:c||!f})});let Oe=(function(e){return e.nestedDialogs="--nested-dialogs",e})({}),Pe=(function(e){return e[e.open=P.open]="open",e[e.closed=P.closed]="closed",e[e.startingStyle=P.startingStyle]="startingStyle",e[e.endingStyle=P.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const Y=l.createContext(void 0);function $(){const e=l.useContext(Y);if(e===void 0)throw new Error(_(26));return e}const xe={...B,...F,nestedDialogOpen(e){return e?{[Pe.nestedDialogOpen]:""}:null}},Fe=l.forwardRef(function(t,o){const{render:s,className:i,style:a,finalFocus:c,initialFocus:u,...r}=t,{store:n}=D(),f=n.useState("descriptionElementId"),S=n.useState("disablePointerDismissal"),m=n.useState("floatingRootContext"),R=n.useState("popupProps"),C=n.useState("modal"),O=n.useState("mounted"),x=n.useState("nested"),g=n.useState("nestedOpenDialogCount"),p=n.useState("open"),U=n.useState("openMethod"),I=n.useState("titleElementId"),d=n.useState("transitionStatus"),b=n.useState("role"),k=m.useState("floatingId"),w=r.id??k;$(),J({open:p,ref:n.context.popupRef,onComplete(){p&&n.context.onOpenChangeComplete?.(!0)}});const M=u===void 0?ee(n.context.popupRef):u,T=g>0,y=n.useStateSetter("popupElement"),H=v("div",t,{state:{open:p,nested:x,transitionStatus:d,nestedDialogOpen:T},props:[R,{id:w,"aria-labelledby":I??void 0,"aria-describedby":f??void 0,role:b,...te,hidden:!O,onKeyDown(K){ne.has(K.key)&&K.stopPropagation()},style:{[Oe.nestedDialogs]:g}},r],ref:[o,n.context.popupRef,y],stateAttributesMapping:xe});return E.jsx(oe,{context:m,openInteractionType:U,disabled:!O,closeOnFocusOut:!S,initialFocus:M,returnFocus:c,modal:C!==!1,restoreFocus:"popup",children:H})}),Be=l.forwardRef(function(t,o){const{keepMounted:s=!1,...i}=t,{store:a}=D(),c=a.useState("mounted"),u=a.useState("modal"),r=a.useState("open");return c||s?E.jsx(Y.Provider,{value:s,children:E.jsxs(q,{ref:o,...i,children:[c&&u===!0&&E.jsx(se,{ref:a.context.internalBackdropRef,inert:G(!r)}),t.children]})}):null});function Ee(e){const{store:t,actionsRef:o}=e,s=t.useState("open");ae(t,s),re(t);const{forceUnmount:i}=le(s,t),a=l.useCallback(()=>{t.setOpen(!1,Q(X))},[t]);l.useImperativeHandle(o,()=>({unmount:i,close:a}),[i,a])}function Ie({store:e,parentContext:t,isDrawer:o}){const s=e.useState("open"),i=e.useState("disablePointerDismissal"),a=e.useState("modal"),c=e.useState("popupElement"),u=e.useState("floatingRootContext"),[r,n]=l.useState(0),[f,S]=l.useState(0),m=r===0,R=ie(u,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?"intentional":{mouse:a==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(g){if(!e.context.outsidePressEnabledRef.current||"button"in g&&g.button!==0||"touches"in g&&g.touches.length!==1)return!1;const p=Z(g);return m&&!i?a&&(e.context.internalBackdropRef.current||e.context.backdropRef.current)?e.context.internalBackdropRef.current===p||e.context.backdropRef.current===p||V(p,c)&&!p?.hasAttribute("data-base-ui-portal"):!0:!1},escapeKey:m});de(s&&a===!0,c),e.useContextCallback("onNestedDialogOpen",(g,p)=>{n(g),S(p)}),e.useContextCallback("onNestedDialogClose",()=>{n(0),S(0)}),l.useEffect(()=>(t?.onNestedDialogOpen&&s&&t.onNestedDialogOpen(r+1,f+(o?1:0)),t?.onNestedDialogClose&&!s&&t.onNestedDialogClose(),()=>{t?.onNestedDialogClose&&s&&t.onNestedDialogClose()}),[o,s,r,f,t]);const C=R.reference??N,O=R.trigger??N,x=R.floating??N;return ce(e,{activeTriggerProps:C,inactiveTriggerProps:O,popupProps:x,nestedOpenDialogCount:r,nestedOpenDrawerCount:f}),null}const ye={...Ce,modal:h(e=>e.modal),nested:h(e=>e.nested),nestedOpenDialogCount:h(e=>e.nestedOpenDialogCount),nestedOpenDrawerCount:h(e=>e.nestedOpenDrawerCount),disablePointerDismissal:h(e=>e.disablePointerDismissal),openMethod:h(e=>e.openMethod),descriptionElementId:h(e=>e.descriptionElementId),titleElementId:h(e=>e.titleElementId),viewportElement:h(e=>e.viewportElement),role:h(e=>e.role)};class j extends A{constructor(t,o,s=!1){const i=new ue,a=De(t);a.floatingRootContext=Se(i,o,s),super(a,{popupRef:l.createRef(),backdropRef:l.createRef(),internalBackdropRef:l.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:i,onOpenChange:void 0,onOpenChangeComplete:void 0},ye)}setOpen=(t,o)=>{if(o.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!t&&o.trigger==null&&this.state.activeTriggerId!=null&&(o.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(t,o),o.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(t,o);const s={open:t};pe(s,t,o.trigger),this.update(s)};static useStore(t,o){return ge(t,(i,a)=>new j(o,i,a),!0).store}}function De(e={}){return{...Re(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:"dialog",...e}}function ve(e,t="dialog"){const{children:o,open:s,defaultOpen:i=!1,onOpenChange:a,onOpenChangeComplete:c,disablePointerDismissal:u=!1,modal:r=!0,actionsRef:n,handle:f,triggerId:S,defaultTriggerId:m=null}=e,R=t==="drawer",C=t==="alert-dialog",O=C?!0:r,x=C||u,g=C?"alertdialog":"dialog",p=D(!0),I={modal:O,disablePointerDismissal:x,nested:!!p,role:g},d=j.useStore(f?.store,{open:i,openProp:s,activeTriggerId:m,triggerIdProp:S,...I});fe(()=>{const y=s===void 0&&d.state.open===!1&&i===!0?{open:!0,activeTriggerId:m}:null;C?d.update(y?{...I,...y}:I):y&&d.update(y)}),d.useControlledProp("openProp",s),d.useControlledProp("triggerIdProp",S),d.useSyncedValues(I),d.useContextCallback("onOpenChange",a),d.useContextCallback("onOpenChangeComplete",c);const b=d.useState("open"),k=d.useState("mounted"),w=d.useState("payload");Ee({store:d,actionsRef:n});const M=b||k,T=l.useMemo(()=>({store:d}),[d]);return E.jsx(z.Provider,{value:!1,children:E.jsxs(L.Provider,{value:T,children:[M&&E.jsx(Ie,{store:d,parentContext:p?.store.context,isDrawer:R}),typeof o=="function"?o({payload:w}):o]})})}function je(e){const t=l.useContext(z)?"drawer":"dialog";return ve(e,t)}let W=(function(e){return e[e.open=P.open]="open",e[e.closed=P.closed]="closed",e[e.startingStyle=P.startingStyle]="startingStyle",e[e.endingStyle=P.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const be={...B,...F,nested(e){return e?{[W.nested]:""}:null},nestedDialogOpen(e){return e?{[W.nestedDialogOpen]:""}:null}},Ue=l.forwardRef(function(t,o){const{render:s,className:i,style:a,children:c,...u}=t,r=$(),{store:n}=D(),f=n.useState("open"),S=n.useState("nested"),m=n.useState("transitionStatus"),R=n.useState("nestedOpenDialogCount"),C=n.useState("mounted"),O=n.useStateSetter("viewportElement"),x=R>0;return v("div",t,{enabled:r||C,state:{open:f,nested:S,transitionStatus:m,nestedDialogOpen:x},ref:[o,O],stateAttributesMapping:be,props:[{role:"presentation",hidden:!C,style:{pointerEvents:f?void 0:"none"},children:c},u]})}),Ke=l.forwardRef(function(t,o){const{render:s,className:i,style:a,id:c,...u}=t,{store:r}=D(),n=me(c);return r.useSyncedValueWithCleanup("titleElementId",n),v("h2",t,{ref:o,props:[{id:n},u]})});export{je as D,Be as a,Ne as b,Ue as c,Fe as d,Ke as e,D as u};
import{l as o}from"./__vite-browser-external-CeOnjjgl.js";const a=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],e=o("download",a);export{e as D};
import{j as o}from"./__vite-browser-external-CeOnjjgl.js";import{m as s}from"./react-CgmQzSd0.js";import{u as d}from"./use-reduced-motion-DUgAHZln.js";function m({children:i,delay:t=0,duration:n=.35,y:e=12,className:r="",once:a=!0}){return d()?o.jsx("div",{className:r,children:i}):o.jsx(s.div,{initial:{opacity:0,y:e},animate:{opacity:1,y:0},transition:{duration:n,delay:t,ease:[.16,1,.3,1]},className:r,children:i})}function p({children:i,staggerDelay:t=.1,initialDelay:n=0,className:e=""}){return d()?o.jsx("div",{className:e,children:i}):o.jsx(s.div,{initial:"hidden",animate:"visible",variants:{hidden:{},visible:{transition:{staggerChildren:t,delayChildren:n}}},className:e,children:i})}function x({children:i,className:t="",y:n=12}){return d()?o.jsx("div",{className:t,children:i}):o.jsx(s.div,{variants:{hidden:{opacity:0,y:n},visible:{opacity:1,y:0,transition:{duration:.35,ease:[.16,1,.3,1]}}},className:t,children:i})}export{m as F,p as S,x as a};
import{l as c}from"./__vite-browser-external-CeOnjjgl.js";const e=[["path",{d:"M12 3q1 4 4 6.5t3 5.5a1 1 0 0 1-14 0 5 5 0 0 1 1-3 1 1 0 0 0 5 0c0-2-1.5-3-1.5-5q0-2 2.5-4",key:"1slcih"}]],a=c("flame",e);export{a as F};
import{k as r}from"./__vite-browser-external-CeOnjjgl.js";function n(o){const t=Number(o)||0;return t>=1e12?`${Number((t/1e12).toFixed(2)).toString()}T`:r(t)}export{n as f};
import{r as s,s as c,j as t,c as d}from"./__vite-browser-external-CeOnjjgl.js";function u({repo:r="mm7894215/TokenTracker"}){const[a,o]=s.useState(null);return s.useEffect(()=>{if(typeof window>"u")return;const n=typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,i=typeof document<"u"&&(document.documentElement?.classList.contains("screenshot-capture")||document.body?.classList.contains("screenshot-capture"));c({prefersReducedMotion:n,screenshotCapture:i})&&fetch(`https://api.github.com/repos/${r}`).then(e=>e.json()).then(e=>{e&&typeof e.stargazers_count=="number"&&o(e.stargazers_count)}).catch(()=>{})},[r]),t.jsxs("a",{href:`https://github.com/${r}`,target:"_blank",rel:"noopener noreferrer",className:"inline-flex shrink-0 items-center gap-2 px-3 py-1.5 rounded-md border border-oai-gray-200 dark:border-oai-gray-700 bg-oai-gray-50 dark:bg-oai-gray-800 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-700 transition-colors no-underline",children:[t.jsx("svg",{height:"16",viewBox:"0 0 16 16",width:"16",className:"shrink-0 fill-oai-gray-700 dark:fill-oai-gray-300",children:t.jsx("path",{d:"M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"})}),t.jsx("span",{className:"text-xs font-medium text-oai-gray-700 dark:text-oai-gray-300 whitespace-nowrap",children:d("shared.github.star")}),a!==null&&t.jsx("span",{className:"text-xs font-semibold text-oai-gray-900 dark:text-oai-white tabular-nums whitespace-nowrap",children:a})]})}export{u as H};
import{j as t,d as a}from"./__vite-browser-external-CeOnjjgl.js";function i({text:o,placement:r="top"}){return o?t.jsx("div",{role:"tooltip",className:a("pointer-events-none absolute left-1/2 z-10 w-max max-w-[260px] -translate-x-1/2 whitespace-pre-line rounded-xl border border-oai-gray-200/50 dark:border-oai-gray-800/50 bg-white/90 dark:bg-oai-gray-900/90 backdrop-blur-md px-2.5 py-1.5 text-[10.5px] leading-snug text-oai-gray-700 dark:text-oai-gray-200 shadow-xl opacity-0 transition-opacity duration-150 group-hover:opacity-100",r==="bottom"?"top-full mt-2":"bottom-full mb-2"),children:o}):null}export{i as H};
import{j as r}from"./__vite-browser-external-CeOnjjgl.js";function e({className:n}){return r.jsx("svg",{viewBox:"0 0 384 512",className:n,fill:"currentColor","aria-hidden":"true",children:r.jsx("path",{d:"M318.7 268.7c-.2-36.7 16.4-64.4 50-84.8-18.8-26.9-47.2-41.7-84.7-44.6-35.5-2.8-74.3 20.7-88.5 20.7-15 0-49.4-19.7-76.4-19.7C63.3 141.2 4 184.8 4 273.5q0 39.3 14.4 81.2c12.8 36.7 59 126.7 107.2 125.2 25.2-.6 43-17.9 75.8-17.9 31.8 0 48.3 17.9 76.4 17.9 48.6-.7 90.4-82.5 102.6-119.3-65.2-30.7-61.7-90-61.7-91.9zm-56.6-164.2c27.3-32.4 24.8-61.9 24-72.5-24.1 1.4-52 16.4-67.9 34.9-17.5 19.8-27.8 44.3-25.6 71.9 26.1 2 49.9-11.4 69.5-34.3z"})})}function o({className:n}){return r.jsx("svg",{viewBox:"0 0 16 16",className:n,fill:"currentColor","aria-hidden":"true",children:r.jsx("path",{d:"M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"})})}function t({className:n}){return r.jsx("svg",{viewBox:"0 0 24 24",className:n,fill:"currentColor","aria-hidden":"true",children:r.jsx("path",{d:"M3 5.46 10.2 4.5v6.92H3V5.46Zm0 13.08 7.2.96v-6.84H3v5.88Zm8.04 1.08L21 21V12.46h-9.96v7.16ZM11.04 4.38 21 3v8.46h-9.96V4.38Z"})})}export{e as A,o as G,t as W};
import{r as c}from"./__vite-browser-external-CeOnjjgl.js";var u={},p=()=>{window.si||(window.si=function(...i){window.siq=window.siq||[],window.siq.push(i)})},h="@vercel/speed-insights",g="2.0.0";function w(){return typeof window<"u"}function S(){try{const e="production"}catch{}return"production"}function l(){return S()==="development"}function k(e,i){if(!e||!i)return e;let n=e;try{const t=Object.entries(i);for(const[r,o]of t)if(!Array.isArray(o)){const s=d(o);s.test(n)&&(n=n.replace(s,`/[${r}]`))}for(const[r,o]of t)if(Array.isArray(o)){const s=d(o.join("/"));s.test(n)&&(n=n.replace(s,`/[...${r}]`))}return n}catch{return e}}function d(e){return new RegExp(`/${b(e)}(?=[/?#]|$)`)}function b(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function m(e){return e.scriptSrc?f(e.scriptSrc):l()?"https://va.vercel-scripts.com/v1/speed-insights/script.debug.js":e.dsn?"https://va.vercel-scripts.com/v1/speed-insights/script.js":e.basePath?f(`${e.basePath}/speed-insights/script.js`):"/_vercel/speed-insights/script.js"}function E(e,i){var n;let t=e;if(i)try{t={...(n=JSON.parse(i))==null?void 0:n.speedInsights,...e}}catch{}const r={sdkn:h+(t.framework?`/${t.framework}`:""),sdkv:g};return t.sampleRate&&(r.sampleRate=t.sampleRate.toString()),t.route&&(r.route=t.route),l()&&t.debug===!1&&(r.debug="false"),t.dsn&&(r.dsn=t.dsn),t.endpoint?r.endpoint=f(t.endpoint):t.basePath&&(r.endpoint=f(`${t.basePath}/speed-insights/vitals`)),{src:m(t),beforeSend:t.beforeSend,dataset:r}}function f(e){return e.startsWith("http://")||e.startsWith("https://")||e.startsWith("/")?e:`/${e}`}function y(e={},i){var n;if(!w()||e.route===null)return null;p();const{beforeSend:t,src:r,dataset:o}=E(e,i);if(document.head.querySelector(`script[src*="${r}"]`))return null;t&&((n=window.si)==null||n.call(window,"beforeSend",t));const s=document.createElement("script");s.src=r,s.defer=!0;for(const[a,v]of Object.entries(o))s.dataset[a]=v;return s.onerror=()=>{console.log(`[Vercel Speed Insights] Failed to load script from ${r}. Please check if any content blockers are enabled and try again.`)},document.head.appendChild(s),{setRoute:a=>{s.dataset.route=a??void 0}}}function R(){if(!(typeof process>"u"||typeof u>"u"))return u.REACT_APP_VERCEL_OBSERVABILITY_BASEPATH}function _(){if(!(typeof process>"u"||typeof u>"u"))return u.REACT_APP_VERCEL_OBSERVABILITY_CLIENT_CONFIG}function P(e){c.useEffect(()=>{var n;e.beforeSend&&((n=window.si)==null||n.call(window,"beforeSend",e.beforeSend))},[e.beforeSend]);const i=c.useRef(null);return c.useEffect(()=>{if(!i.current){const n=y({framework:e.framework??"react",basePath:e.basePath??R(),...e},e.configString??_());n&&(i.current=n.setRoute)}},[e]),c.useEffect(()=>{i.current&&e.route&&i.current(e.route)},[e.route]),null}export{P as SpeedInsights,k as computeRoute};
import{r as u}from"./__vite-browser-external-CeOnjjgl.js";var c={},p=()=>{window.va||(window.va=function(...r){window.vaq||(window.vaq=[]),window.vaq.push(r)})},m="@vercel/analytics",E="2.0.1";function l(){return typeof window<"u"}function w(){try{const e="production"}catch{}return"production"}function y(e="auto"){if(e==="auto"){window.vam=w();return}window.vam=e}function h(){return(l()?window.vam:w())||"production"}function v(){return h()==="production"}function d(){return h()==="development"}function g(e,{[e]:r,...i}){return i}function _(e,r){if(!e)return;let i=e;const n=[];for(const[t,o]of Object.entries(e))typeof o=="object"&&o!==null&&(r.strip?i=g(t,i):n.push(t));if(n.length>0&&!r.strip)throw Error(`The following properties are not valid: ${n.join(", ")}. Only strings, numbers, booleans, and null are allowed.`);return i}function S(e){return e.scriptSrc?a(e.scriptSrc):d()?"https://va.vercel-scripts.com/v1/script.debug.js":e.basePath?a(`${e.basePath}/insights/script.js`):"/_vercel/insights/script.js"}function k(e,r){var i;let n=e;if(r)try{n={...(i=JSON.parse(r))==null?void 0:i.analytics,...e}}catch{}y(n.mode);const t={sdkn:m+(n.framework?`/${n.framework}`:""),sdkv:E};return n.disableAutoTrack&&(t.disableAutoTrack="1"),n.viewEndpoint&&(t.viewEndpoint=a(n.viewEndpoint)),n.eventEndpoint&&(t.eventEndpoint=a(n.eventEndpoint)),n.sessionEndpoint&&(t.sessionEndpoint=a(n.sessionEndpoint)),d()&&n.debug===!1&&(t.debug="false"),n.dsn&&(t.dsn=n.dsn),n.endpoint?t.endpoint=n.endpoint:n.basePath&&(t.endpoint=a(`${n.basePath}/insights`)),{beforeSend:n.beforeSend,src:S(n),dataset:t}}function a(e){return e.startsWith("http://")||e.startsWith("https://")||e.startsWith("/")?e:`/${e}`}function P(e={debug:!0},r){var i;if(!l())return;const{beforeSend:n,src:t,dataset:o}=k(e,r);if(p(),n&&((i=window.va)==null||i.call(window,"beforeSend",n)),document.head.querySelector(`script[src*="${t}"]`))return;const s=document.createElement("script");s.src=t;for(const[f,b]of Object.entries(o))s.dataset[f]=b;s.defer=!0,s.onerror=()=>{const f=d()?"Please check if any ad blockers are enabled and try again.":"Be sure to enable Web Analytics for your project and deploy again. See https://vercel.com/docs/analytics/quickstart for more information.";console.log(`[Vercel Web Analytics] Failed to load script from ${t}. ${f}`)},document.head.appendChild(s)}function C(e,r,i){var n,t;if(!l()){const o="[Vercel Web Analytics] Please import `track` from `@vercel/analytics/server` when using this function in a server environment";if(v())console.warn(o);else throw new Error(o);return}if(!r){(n=window.va)==null||n.call(window,"event",{name:e,options:i});return}try{const o=_(r,{strip:v()});(t=window.va)==null||t.call(window,"event",{name:e,data:o,options:i})}catch(o){o instanceof Error&&d()&&console.error(o)}}function A({route:e,path:r}){var i;(i=window.va)==null||i.call(window,"pageview",{route:e,path:r})}function T(){if(!(typeof process>"u"||typeof c>"u"))return c.REACT_APP_VERCEL_OBSERVABILITY_BASEPATH}function j(){if(!(typeof process>"u"||typeof c>"u"))return c.REACT_APP_VERCEL_OBSERVABILITY_CLIENT_CONFIG}function $(e){return u.useEffect(()=>{var r;e.beforeSend&&((r=window.va)==null||r.call(window,"beforeSend",e.beforeSend))},[e.beforeSend]),u.useEffect(()=>{P({framework:e.framework||"react",basePath:e.basePath??T(),...e.route!==void 0&&{disableAutoTrack:!0},...e},e.configString??j())},[]),u.useEffect(()=>{e.route&&e.path&&A({route:e.route,path:e.path})},[e.route,e.path]),null}export{$ as Analytics,C as track};
import{r as n,j as $}from"./__vite-browser-external-CeOnjjgl.js";import{M as D,a as S,u as A,b as F,P as K,c as U,L as W}from"./react-CgmQzSd0.js";function I(e,r){if(typeof e=="function")return e(r);e!=null&&(e.current=r)}function B(...e){return r=>{let t=!1;const o=e.map(l=>{const c=I(l,r);return!t&&typeof c=="function"&&(t=!0),c});if(t)return()=>{for(let l=0;l<o.length;l++){const c=o[l];typeof c=="function"?c():I(e[l],null)}}}}function G(...e){return n.useCallback(B(...e),e)}class V extends n.Component{getSnapshotBeforeUpdate(r){const t=this.props.childRef.current;if(S(t)&&r.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const o=t.offsetParent,l=S(o)&&o.offsetWidth||0,c=S(o)&&o.offsetHeight||0,p=getComputedStyle(t),s=this.props.sizeRef.current;s.height=parseFloat(p.height),s.width=parseFloat(p.width),s.top=t.offsetTop,s.left=t.offsetLeft,s.right=l-s.width-s.left,s.bottom=c-s.height-s.top,s.direction=p.direction}return null}componentDidUpdate(){}render(){return this.props.children}}function X({children:e,isPresent:r,anchorX:t,anchorY:o,root:l,pop:c}){const p=n.useId(),s=n.useRef(null),y=n.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:"ltr"}),{nonce:E}=n.useContext(D),a=e.props?.ref??e?.ref,M=G(s,a);return n.useInsertionEffect(()=>{const{width:u,height:d,top:x,left:C,right:f,bottom:R,direction:L}=y.current;if(r||c===!1||!s.current||!u||!d)return;const b=L==="rtl",g=t==="left"?b?`right: ${f}`:`left: ${C}`:b?`left: ${C}`:`right: ${f}`,j=o==="bottom"?`bottom: ${R}`:`top: ${x}`;s.current.dataset.motionPopId=p;const h=document.createElement("style");E&&(h.nonce=E);const P=l??document.head;return P.appendChild(h),h.sheet&&h.sheet.insertRule(`
[data-motion-pop-id="${p}"] {
position: absolute !important;
width: ${u}px !important;
height: ${d}px !important;
${g}px !important;
${j}px !important;
}
`),()=>{s.current?.removeAttribute("data-motion-pop-id"),P.contains(h)&&P.removeChild(h)}},[r]),$.jsx(V,{isPresent:r,childRef:s,sizeRef:y,pop:c,children:c===!1?e:n.cloneElement(e,{ref:M})})}const Y=({children:e,initial:r,isPresent:t,onExitComplete:o,custom:l,presenceAffectsLayout:c,mode:p,anchorX:s,anchorY:y,root:E})=>{const a=A(_),M=n.useId(),u=n.useRef(t),d=n.useRef(o);F(()=>{u.current=t,d.current=o});let x=!0,C=n.useMemo(()=>(x=!1,{id:M,initial:r,isPresent:t,custom:l,onExitComplete:f=>{a.set(f,!0);for(const R of a.values())if(!R)return;o&&o()},register:f=>(a.set(f,!1),()=>{a.delete(f),!u.current&&!a.size&&d.current?.()})}),[t,a,o]);return c&&x&&(C={...C}),n.useMemo(()=>{a.forEach((f,R)=>a.set(R,!1))},[t]),n.useEffect(()=>{!t&&!a.size&&o&&o()},[t]),e=$.jsx(X,{pop:p==="popLayout",isPresent:t,anchorX:s,anchorY:y,root:E,children:e}),$.jsx(K.Provider,{value:C,children:e})};function _(){return new Map}const v=e=>e.key||"";function T(e){const r=[];return n.Children.forEach(e,t=>{n.isValidElement(t)&&r.push(t)}),r}const N=({children:e,custom:r,initial:t=!0,onExitComplete:o,presenceAffectsLayout:l=!0,mode:c="sync",propagate:p=!1,anchorX:s="left",anchorY:y="top",root:E})=>{const[a,M]=U(p),u=n.useMemo(()=>T(e),[e]),d=p&&!a?[]:u.map(v),x=n.useRef(!0),C=n.useRef(u),f=A(()=>new Map),R=n.useRef(new Set),[L,b]=n.useState(u),[g,j]=n.useState(u);F(()=>{x.current=!1,C.current=u;for(let m=0;m<g.length;m++){const i=v(g[m]);d.includes(i)?(f.delete(i),R.current.delete(i)):f.get(i)!==!0&&f.set(i,!1)}},[g,d.length,d.join("-")]);const h=[];if(u!==L){let m=[...u];for(let i=0;i<g.length;i++){const w=g[i],z=v(w);d.includes(z)||(m.splice(i,0,w),h.push(w))}return c==="wait"&&h.length&&(m=h),j(T(m)),b(u),null}const{forceRender:P}=n.useContext(W);return $.jsx($.Fragment,{children:g.map(m=>{const i=v(m),w=p&&!a?!1:u===g||d.includes(i),z=()=>{if(R.current.has(i))return;if(f.has(i))R.current.add(i),f.set(i,!0);else return;let k=!0;f.forEach(H=>{H||(k=!1)}),k&&(P?.(),j(C.current),p&&M?.(),o&&o())};return $.jsx(Y,{isPresent:w,initial:!x.current||t?void 0:!1,custom:r,presenceAffectsLayout:l,mode:c,root:E,onExitComplete:w?void 0:z,anchorX:s,anchorY:y,children:m},i)})})};export{N as A};
import{l as o}from"./__vite-browser-external-CeOnjjgl.js";const c=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],t=o("info",c);export{t as I};
import{r as ge,c as t,j as n}from"./__vite-browser-external-CeOnjjgl.js";const Ge=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),j=Ge?"/proxy/ipcheck":"https://ip.net.coffee",fe="claude_ip_history",Se=6,Ue=["CN","HK","MO","RU","KP","IR","SY","CU","BY","VE"],ze={CN:"Asia/Shanghai",TW:"Asia/Taipei",HK:"Asia/Hong_Kong",MO:"Asia/Macau",JP:"Asia/Tokyo",KR:"Asia/Seoul",SG:"Asia/Singapore",MY:"Asia/Kuala_Lumpur",TH:"Asia/Bangkok",VN:"Asia/Ho_Chi_Minh",ID:"Asia/Jakarta",PH:"Asia/Manila",IN:"Asia/Kolkata",PK:"Asia/Karachi",BD:"Asia/Dhaka",IR:"Asia/Tehran",IL:"Asia/Jerusalem",AE:"Asia/Dubai",SA:"Asia/Riyadh",TR:"Europe/Istanbul",RU:"Europe/Moscow",UA:"Europe/Kyiv",GB:"Europe/London",IE:"Europe/Dublin",FR:"Europe/Paris",DE:"Europe/Berlin",IT:"Europe/Rome",ES:"Europe/Madrid",PT:"Europe/Lisbon",NL:"Europe/Amsterdam",BE:"Europe/Brussels",CH:"Europe/Zurich",AT:"Europe/Vienna",SE:"Europe/Stockholm",NO:"Europe/Oslo",DK:"Europe/Copenhagen",FI:"Europe/Helsinki",PL:"Europe/Warsaw",CZ:"Europe/Prague",GR:"Europe/Athens",RO:"Europe/Bucharest",US:"America/Los_Angeles",CA:"America/Toronto",MX:"America/Mexico_City",BR:"America/Sao_Paulo",AR:"America/Argentina/Buenos_Aires",CL:"America/Santiago",AU:"Australia/Sydney",NZ:"Pacific/Auckland",ZA:"Africa/Johannesburg",EG:"Africa/Cairo",NG:"Africa/Lagos",KE:"Africa/Nairobi"},We={CN:["zh"],TW:["zh"],HK:["zh","en"],MO:["zh","en"],JP:["ja"],KR:["ko"],TH:["th"],VN:["vi"],SG:["en","zh","ms","ta"],MY:["ms","en","zh","ta"],ID:["id","en"],PH:["en","tl","fil"],IN:["en","hi"],PK:["ur","en"],BD:["bn","en"],LK:["si","ta","en"],NP:["ne","en"],US:["en"],GB:["en"],IE:["en","ga"],AU:["en"],NZ:["en","mi"],CA:["en","fr"],DE:["de"],AT:["de"],CH:["de","fr","it","rm"],BE:["nl","fr","de"],FR:["fr"],IT:["it"],ES:["es","ca","gl","eu"],PT:["pt"],NL:["nl","fy"],LU:["lb","fr","de"],SE:["sv"],NO:["no","nb","nn"],DK:["da"],FI:["fi","sv"],IS:["is","en"],PL:["pl"],CZ:["cs"],SK:["sk"],HU:["hu"],RO:["ro"],BG:["bg"],GR:["el"],RU:["ru"],UA:["uk","ru"],BY:["be","ru"],TR:["tr"],IL:["he","ar","en"],SA:["ar"],AE:["ar","en"],EG:["ar"],IR:["fa"],IQ:["ar","ku"],ZA:["en","af","zu","xh"],KE:["en","sw"],NG:["en"],ET:["am","en"],BR:["pt"],AR:["es"],MX:["es"],CL:["es"],CO:["es"],PE:["es"],VE:["es"]},Be={jp:"Japan",tw:"Taiwan",hk:"Hong Kong",sg:"Singapore",us:"United States",de:"Germany",kr:"South Korea",fr:"France",nl:"Netherlands",gb:"United Kingdom",au:"Australia",ca:"Canada",br:"Brazil",in:"India"};function Z(p){return!!p&&p.includes(":")}function Ke(p){return!Z(p)||p.length<=20?p:p.substring(0,18)+"..."}function w(p){return p==null?"":String(p).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function B(p){if(!p||!/^[a-zA-Z]{2}$/.test(p))return"";const b=p.toLowerCase();return`<img src="${b==="cn"?`${j}/favicons/cn.png`:b==="tw"?`${j}/favicons/flags/tw.png`:`${j}/favicons/flags/${b}.png`}" alt="${b}" class="inline-block h-4 w-auto align-[-2px]" onerror="this.onerror=null;this.style.display='none'">`}function Fe(p){if(!p)return"";const b=String(p).trim();if(/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(b)){const S=b.split(".");return S[0]+"."+S[1]+".*.*"}if(b.includes("…")){const S=b.lastIndexOf("…");return b.substring(0,S+1)+"*"}if(b.includes(":")){const S=b.split(":");if(S.length>=2)return S[0]+":"+S[1]+":*"}return b}function Ve(p){if(!p)return null;try{const S=new Intl.DateTimeFormat("en-US",{timeZone:p,timeZoneName:"longOffset"}).formatToParts(new Date).find(q=>q.type==="timeZoneName");if(!S)return null;if(S.value==="GMT"||S.value==="UTC")return 0;const M=S.value.match(/GMT([+-])(\d{1,2}):?(\d{0,2})/);return M?(M[1]==="+"?1:-1)*(parseInt(M[2],10)*60+parseInt(M[3]||"0",10)):null}catch{return null}}function Ye(p){if(p==null)return"";const b=p>=0?"+":"-",S=Math.abs(p),M=Math.floor(S/60),D=S%60;return"UTC"+b+M+(D?":"+String(D).padStart(2,"0"):"")}const Te={safe:"bg-emerald-50 text-emerald-700 dark:bg-emerald-500/15 dark:text-emerald-300",warn:"bg-amber-50 text-amber-800 dark:bg-amber-500/15 dark:text-amber-300",danger:"bg-red-50 text-red-700 dark:bg-red-500/15 dark:text-red-300",info:"bg-blue-50 text-blue-700 dark:bg-blue-500/15 dark:text-blue-300",neutral:"bg-oai-gray-100 text-oai-gray-600 dark:bg-oai-gray-800 dark:text-oai-gray-400"};function Je(){const p=ge.useRef(null),[b,S]=ge.useState(!1);ge.useEffect(()=>{const _=p.current;if(!_)return;const C=a=>_.querySelector(`#${a}`);let se=!1;const e={unknown:t("ipcheck.common.unknown"),failed:t("ipcheck.ip.failed"),regionAccessible:t("ipcheck.trust.region.accessible"),regionWarnTitle:a=>t("ipcheck.trust.region_warn.title",{region:a}),regionWarnBody:t("ipcheck.trust.region_warn.body"),regionRestrictedText:t("ipcheck.trust.text.restricted"),noData:t("ipcheck.trust.no_data"),noIp:t("ipcheck.trust.no_ip"),noScore:t("ipcheck.trust.no_score"),score:{pristine:t("ipcheck.trust.label.pristine"),clean:t("ipcheck.trust.label.clean"),good:t("ipcheck.trust.label.good"),neutral:t("ipcheck.trust.label.neutral"),suspicious:t("ipcheck.trust.label.suspicious"),unreachable:t("ipcheck.trust.label.unreachable")},scoreText:{excellent:t("ipcheck.trust.text.excellent"),great:t("ipcheck.trust.text.great"),minor:t("ipcheck.trust.text.minor"),moderate:t("ipcheck.trust.text.moderate"),severe:t("ipcheck.trust.text.severe")},propsRegion:t("ipcheck.props.region"),propsCity:t("ipcheck.props.city"),propsType:t("ipcheck.props.type"),propsAsn:t("ipcheck.props.asn"),propsOrg:t("ipcheck.props.org"),propsResidential:t("ipcheck.props.residential"),propsDatacenter:t("ipcheck.props.datacenter"),secVpn:t("ipcheck.security.vpn"),secProxy:t("ipcheck.security.proxy"),secTor:t("ipcheck.security.tor"),secCrawler:t("ipcheck.security.crawler"),secAbuser:t("ipcheck.security.abuser"),secProxyFlag:t("ipcheck.security.proxy_flag"),secCrawlerYes:t("ipcheck.security.crawler_yes"),secCrawlerNo:t("ipcheck.security.crawler_no"),secAbuserYes:t("ipcheck.security.abuser_yes"),secAbuserNo:t("ipcheck.security.abuser_no"),secClean:t("ipcheck.security.clean"),availSvc:t("ipcheck.avail.svc_row"),availLat:{normal:t("ipcheck.avail.latency.normal"),good:t("ipcheck.avail.latency.good"),slow:t("ipcheck.avail.latency.slow"),unreachable:t("ipcheck.avail.latency.unreachable")},availSvcStatus:{none:t("ipcheck.avail.svc.none"),minor:t("ipcheck.avail.svc.minor"),major:t("ipcheck.avail.svc.major"),critical:t("ipcheck.avail.svc.critical"),maintenance:t("ipcheck.avail.svc.maintenance"),other:t("ipcheck.avail.svc.other")},dnsStatus:t("ipcheck.dns.status"),dnsOutlet:t("ipcheck.dns.outlet"),dnsOutletIp:t("ipcheck.dns.outlet_ip"),dnsIsp:t("ipcheck.dns.isp"),dnsLeaked:t("ipcheck.dns.leaked"),dnsNoLeak:t("ipcheck.dns.no_leak"),dnsEncrypted:t("ipcheck.dns.encrypted"),dnsCnTag:t("ipcheck.dns.cn_tag"),udpStatus:t("ipcheck.udp.status"),udpOutlet:t("ipcheck.udp.outlet"),udpOutletIp:t("ipcheck.udp.outlet_ip"),udpOrigin:t("ipcheck.udp.origin"),udpDisabled:t("ipcheck.udp.disabled"),udpNoLeak:t("ipcheck.udp.no_leak"),udpLeaked:t("ipcheck.udp.leaked"),udpAnomaly:t("ipcheck.udp.anomaly"),devTz:t("ipcheck.device.tz"),devLang:t("ipcheck.device.lang"),devOs:t("ipcheck.device.os"),devTouch:t("ipcheck.device.touch"),devNet:t("ipcheck.device.net"),devDnt:t("ipcheck.device.dnt"),devWebglRender:t("ipcheck.device.webgl_render"),devCanvasFp:t("ipcheck.device.canvas_fp"),devWebglFp:t("ipcheck.device.webgl_fp"),devMatch:t("ipcheck.device.match"),devMismatch:t("ipcheck.device.mismatch"),devLocal:t("ipcheck.device.local"),devEstSuffix:t("ipcheck.device.estimate_suffix"),devDiffEqual:t("ipcheck.device.diff_equal"),devDiffAhead:a=>t("ipcheck.device.diff_ahead",{h:a}),devDiffBehind:a=>t("ipcheck.device.diff_behind",{h:a}),devLangExpected:t("ipcheck.device.lang_expected"),devTouchYes:t("ipcheck.device.touch_yes"),devTouchNo:t("ipcheck.device.touch_no"),devDntOn:t("ipcheck.device.dnt_on"),devDntOff:t("ipcheck.device.dnt_off"),devDntUnset:t("ipcheck.device.dnt_unset"),devNetUnsupported:t("ipcheck.device.net_unsupported"),devUnsupported:t("ipcheck.device.unsupported"),histEmpty:t("ipcheck.history.empty"),histCurrent:t("ipcheck.history.current"),histLoading:t("ipcheck.ip.loading")};function f(a,i="neutral"){return`<span class="inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium ${Te[i]||Te.neutral}">${a}</span>`}function J(a,i,r){return a===!0?f(i,"danger"):a===!1?f(r,"safe"):f(e.unknown,"neutral")}function he(a){if(!a)return`<span class="text-oai-gray-400 dark:text-oai-gray-500">${w(e.failed)}</span>`;const i=w(a);return Z(a)?`<span class="ip-mask-target truncate" title="${i}">${w(Ke(a))}</span>`:`<span class="ip-mask-target">${i}</span>`}function K(a){return a?`<span class="ip-link">${he(a)}</span>`:`<span class="text-oai-gray-400 dark:text-oai-gray-500">${w(e.failed)}</span>`}function d(a,i,r=!1){let u=i;return i===void 0?r?u=`<div class="inline-flex items-center gap-1.5 text-xs text-oai-gray-400">
<svg class="animate-spin-subtle h-3.5 w-3.5" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="3"></circle>
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
</svg>
</div>`:u='<span class="block h-3 w-20 rounded bg-oai-gray-100 dark:bg-oai-gray-800 shimmer"></span>':u=`<div class="animate-scale-up-fade">${i}</div>`,`<div class="flex items-center justify-between py-2.5 gap-3">
<span class="text-sm text-oai-gray-500 dark:text-oai-gray-400 shrink-0">${a}</span>
<span class="text-sm font-medium text-oai-black dark:text-white text-right min-w-0">${u}</span>
</div>`}function re(a){return a.map(i=>d(i,void 0)).join("")}function oe(){return'<div class="h-7 w-44 rounded bg-oai-gray-100 dark:bg-oai-gray-800 shimmer"></div>'}function ce(){return'<div class="h-3 w-52 mt-2 rounded bg-oai-gray-100 dark:bg-oai-gray-800 shimmer"></div>'}function _e(a){return a>=95?{text:e.score.pristine,variant:"safe"}:a>=80?{text:e.score.clean,variant:"safe"}:a>=50?{text:e.score.good,variant:"info"}:a>=25?{text:e.score.neutral,variant:"warn"}:{text:e.score.suspicious,variant:"danger"}}const m={ip:null,ippure:null,ipapis:null,claudeGeo:null,claudeRisk:null,cfGeo:"",scoreAnimId:null,lastScore:0};function xe(){const a=(m.claudeRisk?.countryCode||"").toUpperCase();return!a||!Ue.includes(a)?null:t(`ipcheck.region.${a}`)}function le(){const a=C("ipv6Warn");a&&a.classList.remove("hidden")}function te(a,i){const r=C(a);r&&(r.textContent=i||"",r.classList.remove("animate-pulse","bg-oai-gray-200","dark:bg-oai-gray-800","w-52","h-3","mt-2","rounded"))}const Le={gaugeScore:'<span class="block h-8 w-16 rounded bg-oai-gray-100 dark:bg-oai-gray-800 shimmer"></span>',ipAddrCN:oe(),ipGeoCN:ce(),ipAddr:oe(),ipGeo:ce(),ipAddrClaude:oe(),ipGeoClaude:ce(),propsContent:re([e.propsRegion,e.propsCity,e.propsType,e.propsAsn,e.propsOrg]),securityContent:re([e.secVpn,e.secProxy,e.secTor,e.secCrawler,e.secAbuser]),claudeAvailContent:d("claude.ai",void 0,!0)+d("anthropic.com",void 0,!0),dnsLeakContent:d(e.dnsStatus,void 0,!0)+d(e.dnsOutletIp,void 0,!0),udpLeakContent:d(e.udpStatus,void 0,!0)+d(e.udpOutletIp,void 0,!0),deviceContent:re([e.devTz,e.devLang,e.devOs,e.devTouch,e.devNet,e.devDnt,e.devWebglRender,e.devCanvasFp]),ipHistoryContent:`<span class="text-sm text-oai-gray-400 dark:text-oai-gray-500">${e.histLoading}</span>`};Object.entries(Le).forEach(([a,i])=>{const r=C(a);r&&(r.innerHTML=i)});let ye=!1;function Ne(a){if(!a)return;a.dataset.realText||(a.dataset.realText=(a.textContent||"").trim());const i=a.dataset.realText,r=ye?Fe(i):i;a.textContent!==r&&(a.textContent=r)}function ke(){_.querySelectorAll(".ip-link, .ip-mask-target").forEach(Ne)}const ve=new MutationObserver(()=>requestAnimationFrame(ke));["ipHeroCN","ipHero","ipHeroClaude","ipHistoryContent","dnsLeakContent","udpLeakContent"].forEach(a=>{const i=C(a);i&&ve.observe(i,{childList:!0,subtree:!0})}),_.__setMaskOn=a=>{ye=!!a,ke()};async function $e(){try{const r=(await(await fetch("https://1.1.1.1/cdn-cgi/trace",{signal:AbortSignal.timeout(5e3)})).text()).match(/ip=([^\n]+)/);r&&(m.ip=r[1].trim())}catch{}}async function je(){try{const i=await(await fetch("https://claude.ai/cdn-cgi/trace",{cache:"no-store",signal:AbortSignal.timeout(8e3)})).text(),r=Object.fromEntries(i.trim().split(`
`).map(u=>u.split("=")));return{ip:r.ip||null,loc:r.loc?.toLowerCase()||null}}catch{return null}}async function Me(){try{const r=(await(await fetch("https://2026.ip138.com/",{signal:AbortSignal.timeout(5e3)})).text()).match(/(\d+\.\d+\.\d+\.\d+)/);if(r)return{ip:r[1]}}catch{}try{const r=(await(await fetch("https://my.ip.cn/",{signal:AbortSignal.timeout(5e3)})).text()).match(/(\d+\.\d+\.\d+\.\d+)/);if(r)return{ip:r[1]}}catch{}return null}async function Ee(a,i,r,u){const g=C(a),o=C(i);if(!(!g||!o)){if(!r){g.innerHTML=`<span class="text-oai-gray-400 dark:text-oai-gray-500">${e.failed}</span>`,o.textContent="";return}Z(r)&&le(),g.innerHTML=`${B(u)+" "}${K(r)}`;try{const l=await fetch(`${j}/api/geoip/${r}`,{signal:AbortSignal.timeout(5e3)});if(l.ok){const h=await l.json(),s=[h.country,h.region,h.city,h.isp].filter(Boolean).join(" · "),x=h.country_code||u||"";g.innerHTML=`${B(x)} ${K(r)}`,te(i,s)}}catch{}}}function Ie(){const a=m.ippure,i=m.claudeRisk,r=m.claudeGeo,u=m.ipapis,g=i?.asn||a?.asn||"",o=i?.asOrganization||a?.asOrganization||u?.company?.name||"",l=xe(),h=!!(i&&i.ip);let s,x=null;h?l?(s=0,x=e.regionRestrictedText):s=typeof i.trust_score=="number"?i.trust_score:null:s=null;const v=C("gaugePointer"),c=C("gaugeScore"),P=C("gaugeText");if(s===null)c.innerHTML=`<span class="text-4xl font-bold tracking-tight tabular-nums text-oai-gray-400 dark:text-oai-gray-500">—</span> ${f(e.noData,"neutral")}`,v.style.left="0%",v.style.opacity="0.3",v.style.borderColor="",v.style.boxShadow="",P.textContent=h?e.noScore:e.noIp;else{const A=l?{text:e.score.unreachable,variant:"danger"}:_e(s),L=s>=50?"text-emerald-500":s>=25?"text-amber-500":"text-red-500",X=s>=50?"#10b981":s>=25?"#f59e0b":"#ef4444";if(m.lastScore!==s){m.scoreAnimId&&cancelAnimationFrame(m.scoreAnimId);const Q=m.lastScore||0;m.lastScore=s;const de=performance.now(),ee=800,ne=ue=>{const N=ue-de,k=Math.min(N/ee,1),$=k*(2-k),I=Math.round(Q+(s-Q)*$),Y=I>=50?"text-emerald-500":I>=25?"text-amber-500":"text-red-500";c&&(c.innerHTML=`<span class="text-4xl font-bold tracking-tight tabular-nums ${Y}">${I}</span> ${f(A.text,A.variant)}`),k<1?m.scoreAnimId=requestAnimationFrame(ne):m.scoreAnimId=null};m.scoreAnimId=requestAnimationFrame(ne)}else c.innerHTML=`<span class="text-4xl font-bold tracking-tight tabular-nums ${L}">${s}</span> ${f(A.text,A.variant)}`;requestAnimationFrame(()=>{requestAnimationFrame(()=>{v&&(v.style.left=Math.min(s,100)+"%",v.style.opacity="1",v.style.borderColor=X,v.style.boxShadow=`0 0 10px ${X}80, 0 2px 6px rgba(0,0,0,0.15)`)})}),P.textContent=x||(s>=95?e.scoreText.excellent:s>=80?e.scoreText.great:s>=50?e.scoreText.minor:s>=25?e.scoreText.moderate:e.scoreText.severe)}const y=C("statusDotClaude");if(y){let A,L;s===null?(A="animate-ping absolute inline-flex h-full w-full rounded-full bg-oai-gray-300 dark:bg-oai-gray-600 opacity-75",L="relative inline-flex h-2 w-2 rounded-full bg-oai-gray-400 dark:bg-oai-gray-500"):l||s<25?(A="animate-ping absolute inline-flex h-full w-full rounded-full bg-red-400 opacity-75",L="relative inline-flex h-2 w-2 rounded-full bg-red-500"):s<50?(A="animate-ping absolute inline-flex h-full w-full rounded-full bg-amber-400 opacity-75",L="relative inline-flex h-2 w-2 rounded-full bg-amber-500"):(A="animate-ping absolute inline-flex h-full w-full rounded-full bg-emerald-400 opacity-75",L="relative inline-flex h-2 w-2 rounded-full bg-emerald-500"),y.innerHTML=`<span class="${A}"></span><span class="${L}"></span>`}const H=C("regionWarn");H&&(l?(H.innerHTML=`<span class="font-medium">⚠️ ${e.regionWarnTitle(l)}</span><br><span class="text-[13px] font-normal mt-1 block opacity-90">${e.regionWarnBody}</span>`,H.classList.remove("hidden")):H.classList.add("hidden"));const G=C("claudeRegionSupportRow"),F=C("claudeRegionSupport");if(G&&F)if(l)G.classList.add("hidden");else{const A=!!(i&&i.ip),L=!!(i&&i.countryCode);F.innerHTML=!A||!L?f(e.unknown,"neutral"):f(e.regionAccessible,"safe"),G.classList.remove("hidden")}const U=i?.isResidential??(u?!u.is_datacenter:null),O=u?.company?.type||"",z=r?.country||i?.country||"",W=r?.city||i?.city||"";let T;if(U===!0?T=f(e.propsResidential,"safe"):U===!1?T=f(e.propsDatacenter,"warn"):T=f(e.unknown,"neutral"),O){const L={hosting:"Hosting",isp:"ISP",business:"Business",education:"Education"}[O]||w(O);T+=` <span class="text-xs text-oai-gray-500 dark:text-oai-gray-400">${L}</span>`}C("propsContent").innerHTML=d(e.propsRegion,z?w(z):f(e.unknown,"neutral"))+d(e.propsCity,W?w(W):f(e.unknown,"neutral"))+d(e.propsType,T)+d(e.propsAsn,g?`<span class="font-mono tabular-nums">AS${w(g)}</span>`:f(e.unknown,"neutral"))+d(e.propsOrg,o?w(o):f(e.unknown,"neutral"));const E=u||{};C("securityContent").innerHTML=d(e.secVpn,J(E.is_vpn,e.secVpn,e.secClean))+d(e.secProxy,J(E.is_proxy,e.secProxyFlag,e.secClean))+d(e.secTor,J(E.is_tor,e.secTor,e.secClean))+d(e.secCrawler,J(E.is_crawler,e.secCrawlerYes,e.secCrawlerNo))+d(e.secAbuser,J(E.is_abuser,e.secAbuserYes,e.secAbuserNo))}async function Re(){const a=C("dnsLeakContent");if(!a)return;a.innerHTML=d(e.dnsStatus,void 0,!0)+d(e.dnsOutletIp,void 0,!0);const i=Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2);for(let s=1;s<=2;s++)await new Promise(x=>{const v=new Image,c=setTimeout(x,2e3);v.onload=v.onerror=()=>{clearTimeout(c),x()},v.src=`http://${i}-${s}.d.ip.net.coffee/pixel.gif?_=${Date.now()}`});await new Promise(s=>setTimeout(s,1500));let r=[];for(let s=0;s<2;s++){try{const x=await fetch(`${j}/api/dns/result/${i}`,{signal:AbortSignal.timeout(3e3)});if(x.ok&&(r=(await x.json()).dns_servers||[],r.length>0))break}catch{}s===0&&await new Promise(x=>setTimeout(x,1500))}if(r.length===0){a.innerHTML=d(e.dnsStatus,f(e.dnsEncrypted,"safe"));return}const u=(m.claudeRisk?.country||"").toLowerCase(),g=u.includes("china")||u.includes("中国");let o=null,l=!1;for(const s of r){let x=null;try{const y=await fetch(`${j}/api/geoip/${s}`,{signal:AbortSignal.timeout(3e3)});y.ok&&(x=await y.json())}catch{}const v=x?.country_code||"",c=x?.isp||"";if(v==="cn"&&!g){o={ip:s,cc:v,isp:c,leaked:!0},l=!0;break}o||(o={ip:s,cc:v,isp:c,leaked:!1})}let h=d(e.dnsStatus,l?f(e.dnsLeaked,"warn"):f(e.dnsNoLeak,"safe"));if(o){const s=`${B(o.cc)} <span class="ip-mask-target ${o.leaked?"text-amber-600 dark:text-amber-400 font-medium":""}">${w(o.ip)}</span>${o.leaked?" "+f(e.dnsCnTag,"warn"):""}`;h+=d(e.dnsOutlet,s),o.isp&&(h+=d(e.dnsIsp,`<span class="text-xs text-oai-gray-500 dark:text-oai-gray-400 font-normal truncate inline-block max-w-[12rem] align-bottom">${w(o.isp)}</span>`))}a.innerHTML=h}async function He(){const a=C("udpLeakContent");if(!a)return;a.innerHTML=d(e.udpStatus,void 0,!0)+d(e.udpOutletIp,void 0,!0);const i=new Set;try{const y=new RTCPeerConnection({iceServers:[{urls:"stun:stun.l.google.com:19302"},{urls:"stun:stun.cloudflare.com:3478"}]});y.createDataChannel("");const H=await y.createOffer();await y.setLocalDescription(H),await new Promise(G=>{const F=setTimeout(()=>{y.close(),G()},5e3);y.onicecandidate=U=>{if(!U.candidate){clearTimeout(F),y.close(),G();return}const O=U.candidate.candidate.match(/([0-9]{1,3}\.){3}[0-9]{1,3}/);if(O){const W=O[0];!W.startsWith("0.")&&!W.startsWith("127.")&&W!=="0.0.0.0"&&i.add(W)}const z=U.candidate.candidate.match(/([a-f0-9]{1,4}:){2,7}[a-f0-9]{1,4}/i);z&&i.add(z[0])}})}catch{}const r=m.claudeRisk?.ip||"",u=[...i],g=u.filter(y=>!Z(y)&&!y.startsWith("192.168.")&&!y.startsWith("10.")&&!y.startsWith("172.")&&!y.startsWith("198.18.")&&!y.startsWith("198.19.")&&!y.startsWith("100.64.")&&!y.startsWith("127.")&&!y.startsWith("0."));if(g.length===0&&u.length===0){a.innerHTML=d(e.udpStatus,f(e.udpDisabled,"safe"));return}if(g.length===0){a.innerHTML=d(e.udpStatus,f(e.udpNoLeak,"safe"));return}let o=g.find(y=>y===r)||g[0];const l=new Set(g).size>1,h=o===r,s=l&&!h;let x=d(e.udpStatus,s?f(e.udpLeaked,"warn"):f(e.udpNoLeak,"safe")),v="",c="";try{const y=await fetch(`${j}/api/geoip/${o}`,{signal:AbortSignal.timeout(5e3)});if(y.ok){const H=await y.json();v=H.country_code||"",c=H.country||""}}catch{}const P=`${B(v)} <span class="${s?"text-amber-600 dark:text-amber-400 font-medium":""}">${he(o)}</span>${h?"":s?" "+f(e.udpAnomaly,"warn"):""}`;x+=d(e.udpOutlet,P),c&&(x+=d(e.udpOrigin,`<span class="text-xs text-oai-gray-500 dark:text-oai-gray-400 font-normal">${w(c)}</span>`)),a.innerHTML=x}async function be(){const a=C("claudeAvailContent");if(!a)return;a.innerHTML=d("claude.ai",void 0,!0)+d("anthropic.com",void 0,!0);const i=[{name:"claude.ai",url:"https://claude.ai/cdn-cgi/trace"},{name:"anthropic.com",url:"https://www.anthropic.com/favicon.ico"}],r=await Promise.allSettled(i.map(async o=>{const l=performance.now();try{return await fetch(o.url,{mode:"no-cors",signal:AbortSignal.timeout(6e3)}),{name:o.name,ms:Math.round(performance.now()-l),ok:!0}}catch{return{name:o.name,ms:-1,ok:!1}}})),u=xe();let g="";r.forEach(o=>{const l=o.value;if(u)g+=d(l.name,f(e.availLat.unreachable,"danger"));else if(l.ok){const h=l.ms<250?"safe":l.ms<500?"info":"warn",s=l.ms<250?e.availLat.normal:l.ms<500?e.availLat.good:e.availLat.slow;g+=d(l.name,`${f(s,h)} <span class="text-xs text-oai-gray-500 dark:text-oai-gray-400 font-normal">${l.ms}ms</span>`)}else g+=d(l.name,f(e.availLat.unreachable,"danger"))});try{const o=await fetch(`${j}/claude/status.json`,{signal:AbortSignal.timeout(3e3)});if(o.ok){const h=(await o.json()).overall_indicator||"none",s=e.availSvcStatus[h]||e.availSvcStatus.other,x={none:"safe",minor:"warn",major:"danger",critical:"danger",maintenance:"warn"};g+=d(e.availSvc,f(s,x[h]||"warn"))}}catch{}a.innerHTML=g}_.__detectClaudeAvail=be;function Oe(){const a=Intl.DateTimeFormat().resolvedOptions().timeZone||e.unknown,i=-(new Date().getTimezoneOffset()/60),r="UTC"+(i>=0?"+":"")+i,u=m.claudeRisk,g=(u?.countryCode||"").toUpperCase(),o=u?.timezone||ze[g]||"",l=!!u?.timezone,h=Ve(o),s=-new Date().getTimezoneOffset();let x=null;o&&h!=null&&(x=Math.abs(h-s)<=60);let v;const c=w(a),P=w(o);if(x===!0)v=`${f(e.devMatch,"safe")} <span class="text-xs text-oai-gray-500 dark:text-oai-gray-400">${c} (${r})</span>`;else if(x===!1){const N=Ye(h),k=Math.round((h-s)/60),$=k===0?e.devDiffEqual:k>0?e.devDiffAhead(k):e.devDiffBehind(-k),I=l?P:`${P} ${e.devEstSuffix}`;v=`${f(e.devMismatch,"warn")}<br><span class="text-xs text-oai-gray-500 dark:text-oai-gray-400 font-normal">${e.devLocal} ${c} (${r})<br>Claude ${I} (${N}) · ${$}</span>`}else v=`<span class="text-xs text-oai-gray-500 dark:text-oai-gray-400 font-normal">${c} (${r})</span>`;const y=navigator.languages||[navigator.language],H=y.join(", ")||e.unknown,G=(y[0]||"").split("-")[0].toLowerCase(),F=We[g]||[],U=G&&F.length?F.includes(G):null;let O;const z=w(H),W=w(F.join(" / "));U===!0?O=`${f(e.devMatch,"safe")} <span class="text-xs text-oai-gray-500 dark:text-oai-gray-400">${z}</span>`:U===!1?O=`${f(e.devMismatch,"warn")}<br><span class="text-xs text-oai-gray-500 dark:text-oai-gray-400 font-normal">${e.devLocal} ${z}<br>${e.devLangExpected} ${W}</span>`:O=`<span class="text-xs text-oai-gray-500 dark:text-oai-gray-400 font-normal">${z}</span>`;const T=navigator.userAgent;let E=e.unknown,A=e.unknown;T.includes("Windows")?E="Windows":T.includes("Mac OS")?E="macOS":T.includes("iPhone")||T.includes("iPad")?E="iOS":T.includes("Android")?E="Android":T.includes("Linux")&&(E="Linux"),T.includes("Edg/")?A="Edge "+(T.match(/Edg\/([\d.]+)/)||[])[1]:T.includes("Chrome/")?A="Chrome "+(T.match(/Chrome\/([\d.]+)/)||[])[1]:T.includes("Firefox/")?A="Firefox "+(T.match(/Firefox\/([\d.]+)/)||[])[1]:T.includes("Safari/")&&!T.includes("Chrome")&&(A="Safari "+(T.match(/Version\/([\d.]+)/)||[])[1]);let L=e.devUnsupported;try{const N=document.createElement("canvas"),k=N.getContext("webgl")||N.getContext("experimental-webgl");if(k){const $=k.getExtension("WEBGL_debug_renderer_info");$&&(L=k.getParameter($.UNMASKED_RENDERER_WEBGL))}}catch{}let X=e.devUnsupported;try{const N=document.createElement("canvas"),k=N.getContext("webgl")||N.getContext("experimental-webgl");if(k){const $=k.getExtension("WEBGL_debug_renderer_info"),I=$?k.getParameter($.UNMASKED_VENDOR_WEBGL):"",Y=$?k.getParameter($.UNMASKED_RENDERER_WEBGL):"",Ce=I+"~"+Y+"~"+k.getParameter(k.VERSION)+"~"+k.getParameter(k.SHADING_LANGUAGE_VERSION);let ie=0;for(let pe=0;pe<Ce.length;pe++)ie=(ie<<5)-ie+Ce.charCodeAt(pe)|0;X=(ie>>>0).toString(16).toUpperCase()}}catch{}let Q=e.devUnsupported;try{const N=document.createElement("canvas");N.width=200,N.height=50;const k=N.getContext("2d");k.textBaseline="top",k.font="14px Arial",k.fillStyle="#f60",k.fillRect(50,0,100,50),k.fillStyle="#069",k.fillText("net.coffee",2,15),k.fillStyle="rgba(102,204,0,0.7)",k.fillText("canvas fp",4,30);const $=N.toDataURL();let I=0;for(let Y=0;Y<$.length;Y++)I=(I<<5)-I+$.charCodeAt(Y)|0;Q=(I>>>0).toString(16).toUpperCase()}catch{}const de=navigator.maxTouchPoints>0,ee=navigator.connection||navigator.mozConnection||navigator.webkitConnection,ne=ee?ee.effectiveType||ee.type||e.unknown:e.devNetUnsupported,ue=navigator.doNotTrack==="1"?e.devDntOn:navigator.doNotTrack==="0"?e.devDntOff:e.devDntUnset;C("deviceContent").innerHTML=d(e.devTz,v)+d(e.devLang,O)+d(e.devOs,`${w(E)} <span class="text-oai-gray-400 dark:text-oai-gray-500">/</span> ${w(A)}`)+d(e.devTouch,de?f(e.devTouchYes,"info"):f(e.devTouchNo,"neutral"))+d(e.devNet,`<span class="font-mono uppercase">${w(ne)}</span>`)+d(e.devDnt,w(ue))+d(e.devWebglRender,`<span class="text-xs font-normal text-oai-gray-600 dark:text-oai-gray-400 break-all">${w(L)}</span>`)+d(e.devCanvasFp,`<span class="font-mono text-oai-gray-700 dark:text-oai-gray-300">${w(Q)}</span>`)+d(e.devWebglFp,`<span class="font-mono text-oai-gray-700 dark:text-oai-gray-300">${w(X)}</span>`)}function we(){try{return JSON.parse(localStorage.getItem(fe))||[]}catch{return[]}}function Pe(){const a=m.claudeRisk?.ip||"",i=(m.claudeRisk?.countryCode||"").toLowerCase(),r=m.claudeRisk?.city||"";if(!a){ae();return}const u=we(),g=new Date,o={ip:a,cc:i,geo:r,time:g.toISOString()};if(u.length>0){const l=u[0],h=(g-new Date(l.time))/(1e3*60*60);if(l.ip===a&&h<24){ae();return}}u.unshift(o),u.length>Se&&(u.length=Se),localStorage.setItem(fe,JSON.stringify(u)),ae()}function ae(){const a=C("ipHistoryContent");if(!a)return;const i=we();if(i.length===0){a.innerHTML=`<span class="text-sm text-oai-gray-500 dark:text-oai-gray-400">${e.histEmpty}</span>`;return}a.innerHTML=`<ul class="divide-y divide-oai-gray-100 dark:divide-oai-gray-800">${i.map((r,u)=>{const g=new Date(r.time),o=`${g.getMonth()+1}-${g.getDate()} ${String(g.getHours()).padStart(2,"0")}:${String(g.getMinutes()).padStart(2,"0")}`,l=u===0;return`<li class="flex items-center justify-between py-3 gap-4">
<div class="flex items-center gap-2 min-w-0">
<span class="text-sm ${l?"text-oai-black dark:text-white":"text-oai-gray-500 dark:text-oai-gray-400"}">${o}</span>
${l?`<span class="inline-flex items-center rounded-full bg-emerald-50 text-emerald-700 dark:bg-emerald-500/15 dark:text-emerald-300 px-1.5 py-0.5 text-[10px] font-medium">${w(e.histCurrent)}</span>`:""}
</div>
<div class="flex items-center gap-2 text-sm font-medium text-oai-black dark:text-white min-w-0">
${B(r.cc)}
${K(r.ip)}
${r.geo?`<span class="text-xs text-oai-gray-500 dark:text-oai-gray-400 font-normal truncate">${w(r.geo)}</span>`:""}
</div>
</li>`}).join("")}</ul>`}_.__clearIPHistory=()=>{localStorage.removeItem(fe),ae()};async function De(){const[,a,i]=await Promise.allSettled([$e(),Me(),je()]);if(se)return;const r=a.status==="fulfilled"?a.value:null,u=i.status==="fulfilled"?i.value:null,g=[];g.push(Ee("ipAddrCN","ipGeoCN",r?.ip,"cn")),g.push((async()=>{const o=C("ipAddr"),l=C("ipGeo");if(!m.ip){o&&(o.innerHTML=`<span class="text-oai-gray-400 dark:text-oai-gray-500">${e.failed}</span>`),l&&(l.textContent="");return}Z(m.ip)&&le(),o&&(o.innerHTML=K(m.ip));try{const h=await fetch(`${j}/api/geoip/${m.ip}`,{signal:AbortSignal.timeout(5e3)});if(h.ok){const s=await h.json(),x=(s.country_code||"").toLowerCase();m.ippure={ip:m.ip,country:s.country,countryCode:(s.country_code||"").toUpperCase(),region:s.region,city:s.city},m.cfGeo=[s.country,s.region,s.city,s.isp].filter(Boolean).join(" · "),o&&(o.innerHTML=`${B(x)} ${K(m.ip)}`),te("ipGeo",m.cfGeo)}}catch{}})()),g.push((async()=>{const o=u?.ip,l=C("ipAddrClaude"),h=C("ipGeoClaude");if(!o){l&&(l.innerHTML=`<span class="text-oai-gray-400 dark:text-oai-gray-500">${e.failed}</span>`),h&&(h.textContent="");return}Z(o)&&le(),l&&(l.innerHTML=`${B(u.loc||"")} ${K(o)}`);const[s,x]=await Promise.allSettled([fetch(`${j}/api/iprisk/${o}`,{signal:AbortSignal.timeout(1e4)}),fetch(`${j}/api/geoip/${o}`,{signal:AbortSignal.timeout(5e3)})]);let v=!1;if(x.status==="fulfilled"&&x.value.ok)try{const c=await x.value.json();if(c.country){m.claudeGeo={country:c.country,region:c.region,city:c.city,isp:c.isp,country_code:c.country_code};const P=[c.country,c.region,c.city,c.isp].filter(Boolean).join(" · ");l&&(l.innerHTML=`${B(c.country_code||u.loc||"")} ${K(o)}`),te("ipGeoClaude",P),v=!0}}catch{}if(!v&&u.loc&&(l&&(l.innerHTML=`${B(u.loc)} ${K(o)}`),te("ipGeoClaude",Be[u.loc]||u.loc.toUpperCase())),s.status==="fulfilled"&&s.value.ok){const c=await s.value.json();m.ipapis={is_datacenter:c.is_datacenter,is_vpn:c.is_vpn,is_proxy:c.is_proxy,is_tor:c.is_tor,is_crawler:c.is_crawler,is_abuser:c.is_abuser,is_mobile:c.is_mobile,company:{type:c.company_type,name:c.company_name},abuser_score:c.abuser_score,datacenter_name:c.datacenter_name},m.claudeRisk={ip:o,asn:c.asn,asOrganization:c.asOrganization,country:c.country,countryCode:c.countryCode,region:c.region,city:c.city,isResidential:c.isResidential,isBroadcast:c.isBroadcast,trust_score:c.trust_score,timezone:c.timezone}}})()),await Promise.allSettled(g),!se&&(Ie(),Promise.allSettled([Re(),He(),be()]),Oe(),Pe())}return De(),()=>{se=!0,ve.disconnect(),m.scoreAnimId&&cancelAnimationFrame(m.scoreAnimId),delete _.__setMaskOn,delete _.__clearIPHistory,delete _.__detectClaudeAvail}},[]);const M=_=>{S(_),p.current?.__setMaskOn?.(_)},D=()=>p.current?.__clearIPHistory?.(),q=()=>p.current?.__detectClaudeAvail?.(),R={__html:""};return n.jsx("div",{ref:p,className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:n.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:n.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[n.jsxs("div",{className:"flex items-start justify-between gap-4 mb-8",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white mb-3",children:t("ipcheck.page.title")}),n.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base max-w-3xl text-pretty",children:t("ipcheck.page.subtitle")})]}),n.jsxs("label",{className:"shrink-0 inline-flex items-center gap-2.5 cursor-pointer select-none group",children:[n.jsx("div",{className:"text-oai-gray-400 group-hover:text-oai-gray-600 dark:text-oai-gray-500 dark:group-hover:text-oai-gray-300 transition-colors duration-200",children:b?n.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"h-4.5 w-4.5 animate-scale-up-fade",children:[n.jsx("path",{d:"M9.88 9.88a3 3 0 1 0 4.24 4.24"}),n.jsx("path",{d:"M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68"}),n.jsx("path",{d:"M6.61 6.61A13.52 13.52 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61"}),n.jsx("line",{x1:"2",y1:"2",x2:"22",y2:"22"})]}):n.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"h-4.5 w-4.5 animate-scale-up-fade",children:[n.jsx("path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"}),n.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}),n.jsx("span",{className:"text-xs font-medium text-oai-gray-500 group-hover:text-oai-gray-700 dark:text-oai-gray-400 dark:group-hover:text-oai-gray-200 transition-colors duration-200",children:t("ipcheck.mask.toggle")}),n.jsxs("span",{className:"relative inline-block w-9 h-5",children:[n.jsx("input",{type:"checkbox",checked:b,onChange:_=>M(_.target.checked),className:"peer sr-only"}),n.jsx("span",{className:"absolute inset-0 rounded-full bg-oai-gray-200 dark:bg-oai-gray-800 peer-checked:bg-oai-brand-500 transition-colors duration-200"}),n.jsx("span",{className:"absolute top-0.5 left-0.5 h-4 w-4 rounded-full bg-white shadow-sm transition-transform duration-200 peer-checked:translate-x-4"})]})]})]}),n.jsx("div",{id:"ipv6Warn",className:"hidden mb-4 rounded-lg border border-amber-200 bg-amber-50 dark:border-amber-500/30 dark:bg-amber-500/10 px-4 py-3 text-sm text-amber-800 dark:text-amber-200",children:t("ipcheck.ipv6.warn")}),n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[n.jsx(me,{id:"CN",label:t("ipcheck.ip.cn"),icon:null,className:"animate-fade-in-up stagger-1"}),n.jsx(me,{id:"",label:t("ipcheck.ip.cloudflare"),icon:n.jsx("img",{src:`${j}/favicons/cloudflare.webp`,alt:"",className:"h-4 w-4"}),className:"animate-fade-in-up stagger-2"}),n.jsx(me,{id:"Claude",label:t("ipcheck.ip.claude"),icon:n.jsx("img",{src:`${j}/favicons/claude.webp`,alt:"",className:"h-4 w-4"}),statusDot:!0,className:"animate-fade-in-up stagger-3"})]}),n.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[n.jsx(V,{title:t("ipcheck.trust.title"),subtitle:t("ipcheck.trust.subtitle"),className:"animate-fade-in-up stagger-4",children:n.jsxs("div",{className:"px-1 py-2",children:[n.jsx("div",{className:"flex items-baseline justify-between mb-2 gap-3",children:n.jsx("div",{id:"gaugeScore",className:"flex items-baseline gap-2 min-h-[2.5rem]",dangerouslySetInnerHTML:R})}),n.jsx("div",{id:"gaugeText",className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 mb-4 min-h-[1rem]"}),n.jsxs("div",{children:[n.jsxs("div",{className:"relative",children:[n.jsx("div",{className:"h-1.5 rounded-full",style:{background:"linear-gradient(90deg, #ef4444 0%, #f59e0b 50%, #10b981 100%)"}}),n.jsx("span",{id:"gaugePointer",className:"absolute top-1/2 -translate-y-1/2 h-3.5 w-3.5 rounded-full bg-white dark:bg-oai-gray-900 border-2 border-oai-gray-300 dark:border-oai-gray-700 shadow-[0_2px_6px_rgba(0,0,0,0.15)] dark:shadow-[0_2px_6px_rgba(0,0,0,0.4)] -translate-x-1/2 transition-[left,border-color] duration-700 ease-out",style:{left:"0%"}})]}),n.jsxs("div",{className:"mt-2 flex justify-between text-[10px] uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500 font-medium",children:[n.jsx("span",{children:t("ipcheck.trust.gauge.low")}),n.jsx("span",{className:"tracking-normal",children:"25"}),n.jsx("span",{className:"tracking-normal",children:"50"}),n.jsx("span",{className:"tracking-normal",children:"75"}),n.jsx("span",{children:t("ipcheck.trust.gauge.high")})]})]}),n.jsx("div",{id:"regionWarn",className:"hidden mt-4 rounded-lg border border-red-200 bg-red-50 dark:border-red-500/30 dark:bg-red-500/10 px-3 py-2 text-xs text-red-800 dark:text-red-300"}),n.jsxs("div",{id:"claudeRegionSupportRow",className:"hidden mt-4 pt-4 border-t border-oai-gray-100 dark:border-oai-gray-800 flex items-center justify-between",children:[n.jsx("span",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:t("ipcheck.trust.region_support")}),n.jsx("span",{id:"claudeRegionSupport",className:"text-sm font-medium text-oai-black dark:text-white",dangerouslySetInnerHTML:R})]})]})}),n.jsx(V,{title:t("ipcheck.props.title"),className:"animate-fade-in-up stagger-4",children:n.jsx("div",{id:"propsContent",className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800 pt-1",dangerouslySetInnerHTML:R})}),n.jsx(V,{title:t("ipcheck.security.title"),className:"animate-fade-in-up stagger-4",children:n.jsx("div",{id:"securityContent",className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800 pt-1",dangerouslySetInnerHTML:R})})]}),n.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[n.jsx(V,{title:n.jsxs("span",{className:"flex items-center gap-1.5",children:[t("ipcheck.avail.title"),n.jsx(Ze,{text:t("ipcheck.avail.tooltip")})]}),action:n.jsx(Ae,{label:t("ipcheck.avail.refresh"),onClick:q}),className:"animate-fade-in-up stagger-5",children:n.jsx("div",{id:"claudeAvailContent",className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800 pt-1",dangerouslySetInnerHTML:R})}),n.jsx(V,{title:t("ipcheck.dns.title"),className:"animate-fade-in-up stagger-5",children:n.jsx("div",{id:"dnsLeakContent",className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800 pt-1",dangerouslySetInnerHTML:R})}),n.jsx(V,{title:t("ipcheck.udp.title"),className:"animate-fade-in-up stagger-5",children:n.jsx("div",{id:"udpLeakContent",className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800 pt-1",dangerouslySetInnerHTML:R})})]}),n.jsx(V,{title:t("ipcheck.device.title"),className:"animate-fade-in-up stagger-6",children:n.jsx("div",{id:"deviceContent",className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800 pt-1",dangerouslySetInnerHTML:R})}),n.jsx(V,{title:t("ipcheck.history.title"),subtitle:t("ipcheck.history.subtitle"),action:n.jsx(Ae,{label:t("ipcheck.history.clear"),onClick:D}),className:"animate-fade-in-up stagger-6",children:n.jsx("div",{id:"ipHistoryContent",dangerouslySetInnerHTML:R})})]})]})})})}function V({title:p,subtitle:b,action:S,children:M,className:D=""}){return n.jsxs("section",{className:`rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-5 sm:p-6 transition-colors duration-200 ${D}`,children:[n.jsxs("div",{className:"flex items-start justify-between gap-3 mb-4",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("h2",{className:"text-[15px] font-semibold text-oai-black dark:text-white",children:p}),b?n.jsx("p",{className:"mt-0.5 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:b}):null]}),S]}),M]})}function Ae({label:p,onClick:b}){return n.jsx("button",{type:"button",onClick:b,className:"shrink-0 inline-flex h-7 items-center px-2.5 rounded-md text-xs font-medium text-oai-gray-600 dark:text-oai-gray-300 border border-oai-gray-200 dark:border-oai-gray-700 hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",children:p})}function Ze({text:p}){return n.jsxs("span",{className:"relative inline-flex items-center group",children:[n.jsx("svg",{viewBox:"0 0 16 16",className:"h-3.5 w-3.5 text-oai-gray-400 dark:text-oai-gray-500",fill:"currentColor","aria-hidden":!0,children:n.jsx("path",{d:"M8 1.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13zM7.25 6.75a.75.75 0 0 1 1.5 0V11a.75.75 0 0 1-1.5 0V6.75zM8 4a.85.85 0 1 1 0 1.7A.85.85 0 0 1 8 4z"})}),n.jsx("span",{className:"pointer-events-none absolute left-1/2 top-full z-10 mt-1.5 -translate-x-1/2 w-56 rounded-md bg-oai-gray-900 dark:bg-oai-gray-800 px-2.5 py-2 text-[11px] font-normal text-white opacity-0 scale-95 translate-y-1 group-hover:opacity-100 group-hover:scale-100 group-hover:translate-y-0 transition-all duration-200 cubic-bezier(0.16, 1, 0.3, 1) leading-relaxed shadow-lg origin-top",children:p})]})}function me({id:p,label:b,icon:S,statusDot:M,className:D=""}){const q=`ipAddr${p}`,R=`ipGeo${p}`;return n.jsxs("article",{id:`ipHero${p}`,className:`rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-5 sm:p-6 cursor-default transition-colors duration-200 ${D}`,children:[n.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] uppercase tracking-wider font-medium text-oai-gray-500 dark:text-oai-gray-400 mb-2",children:[S,n.jsx("span",{children:b}),M?n.jsxs("span",{id:`statusDot${p}`,className:"relative inline-flex h-2 w-2 ml-1.5","aria-hidden":!0,children:[n.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-oai-gray-300 dark:bg-oai-gray-600 opacity-75"}),n.jsx("span",{className:"relative inline-flex h-2 w-2 rounded-full bg-oai-gray-400 dark:bg-oai-gray-500"})]}):null]}),n.jsx("div",{id:q,className:"text-xl sm:text-2xl font-semibold text-oai-black dark:text-white flex items-center gap-2 min-h-[2rem]",dangerouslySetInnerHTML:{__html:""}}),n.jsx("div",{id:R,className:"mt-1 text-xs text-oai-gray-500 dark:text-oai-gray-400 truncate min-h-[1rem]"})]})}export{Je as default};

Sorry, the diff of this file is too big to display

import{R as l,j as c,d as h}from"./__vite-browser-external-CeOnjjgl.js";function d(n){let t=0;const e=String(n??"");for(let r=0;r<e.length;r+=1)t=Math.imul(31,t)+e.charCodeAt(r)|0;return Math.abs(t)%360}function x(n){const t=String(n??"").trim();if(!t)return"?";const e=t.split(/\s+/).filter(Boolean);if(e.length>=2){const r=e[0][0]||"",i=e[1][0]||"";return`${r}${i}`.toUpperCase()}return t.slice(0,2).toUpperCase()}const m={sm:"h-7 w-7 min-h-7 min-w-7 text-[10px]",md:"h-8 w-8 min-h-8 min-w-8 text-[11px]",lg:"h-14 w-14 min-h-14 min-w-14 text-base",xl:"h-[68px] w-[68px] min-h-[68px] min-w-[68px] text-xl"};function g({avatarUrl:n,displayName:t,seed:e,size:r="md",className:i}){const o=m[r]||m.md,f=d(e??t??""),s=typeof n=="string"?n.trim():"",[u,a]=l.useState(!1);return l.useEffect(()=>{a(!1)},[s]),s&&!u?c.jsx("img",{src:s,alt:"",referrerPolicy:"no-referrer",onError:()=>a(!0),className:h("rounded-full object-cover ring-1 ring-white/10",o,i)}):c.jsx("div",{className:h("flex shrink-0 items-center justify-center rounded-full font-semibold text-white ring-1 ring-white/10",o,i),style:{backgroundColor:`hsl(${f} 42% 34%)`},"aria-hidden":!0,children:x(t)})}export{g as L};
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/LeaderboardProfileModal-DwpalEE6.js","assets/__vite-browser-external-CeOnjjgl.js","assets/__vite-browser-external-WKilYZnq.css","assets/provider-display-RBujrp08.js","assets/useCurrency-BS_xyhhg.js","assets/useTokenFormat-RvsCI_oE.js","assets/maximize-2-6nkX0TnZ.js","assets/terminal-Dbn_YmPM.js","assets/info-CkFEh5Zu.js","assets/LeaderboardAvatar-CRO38fgs.js","assets/ProviderIcon-C8fKhRQt.js","assets/AchievementBadge-BhAc3c3S.js","assets/zap-D0DQz21w.js","assets/flame-BEU-cqaV.js","assets/AchievementsSection-T-v65Q1T.js","assets/react-CgmQzSd0.js","assets/format-tokens-DJ-Y0jv5.js","assets/use-reduced-motion-DUgAHZln.js","assets/arrow-up-right-DAWmHSlU.js","assets/link-2-Cx8hG5wc.js","assets/check-DPhmDgw5.js","assets/DialogTitle-mSFue3N1.js","assets/useScrollLock-Ct5GyoVg.js","assets/store-BLjK5TrP.js","assets/CommunityStatsModal-s9IKLboA.js","assets/icons-mjdAc-2x.js","assets/TrendMonitor-C7g8DZSW.js","assets/chevron-right-kOKJJLco.js","assets/PopoverPopup-JsU4A3UY.js","assets/ToolbarRootContext-Bs1pZOOn.js","assets/DialogDescription-BFVeSjTD.js","assets/DialogClose-DaB9Ae7L.js"])))=>i.map(i=>d[i]);
import{l as ua,j as e,R as xa,c as s,d,r as c,am as ga,e as ba,u as pa,a as ha,an as fa,J as ya,ao as ka,ap as wa,aq as ze,ar as ja,as as ne,g as va,at as Na,L as _a,au as Sa,k as Ca,av as La,aw as Ea,a7 as Ta,_ as Fe,i as Aa,x as Ma}from"./__vite-browser-external-CeOnjjgl.js";import{S as Pa}from"./Select-DKmJyUtS.js";import{m as Ka}from"./react-CgmQzSd0.js";import{u as Ra,C as Ia,a as za,b as Ba,c as Be,D as Da,d as $a,S as Ua,h as Oa,s as Fa,K as Ga,P as Ha}from"./use-ordered-list-BTBKsubs.js";import{P as he}from"./ProviderIcon-C8fKhRQt.js";import{u as Ya}from"./useCurrency-BS_xyhhg.js";import{u as Q}from"./useTokenFormat-RvsCI_oE.js";import{L as Z}from"./LeaderboardAvatar-CRO38fgs.js";import{s as Wa,c as Va,A as Ja,t as qa,b as Za}from"./AchievementBadge-BhAc3c3S.js";import{u as Xa}from"./use-community-stats-CQQhhlw9.js";import"./ToolbarRootContext-Bs1pZOOn.js";import"./useScrollLock-Ct5GyoVg.js";import"./check-DPhmDgw5.js";import"./SelectItemText-BZFLz6Op.js";import"./zap-D0DQz21w.js";import"./flame-BEU-cqaV.js";const Qa=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],er=ua("arrow-right",Qa),ar=a=>{let{transform:r}=a;return{...r,y:0}};function H(a,{min:r,max:o,fallback:n}){const l=Number(a);if(!Number.isFinite(l))return n;const i=Math.floor(l);return i<r?r:i>o?o:i}function rr(a,r){const o=H(r,{min:0,max:1e6,fallback:0}),n=H(a,{min:1,max:Math.max(1,o||1),fallback:1});if(o<=1)return[1];const l=new Set([1,o,n-2,n-1,n,n+1,n+2]),i=Array.from(l).filter(x=>Number.isInteger(x)&&x>=1&&x<=o).sort((x,p)=>x-p),m=[];let b=null;for(const x of i)b!=null&&x-b>1&&m.push(null),m.push(x),b=x;return m}function tr({page:a,totalPages:r}){const o=typeof r=="number"&&Number.isFinite(r)&&r>=0,n=o?H(r,{min:0,max:1e6,fallback:0}):null,l=H(a,{min:1,max:o?Math.max(1,n||1):1e6,fallback:1}),i=l>1,m=o?l<n:!0;return{canPrev:i,canNext:m,safePage:l,safeTotal:n}}function or({entries:a,me:r,meLabel:o}){const n=Array.isArray(a)?a:[],l=r&&typeof r.rank=="number"?r.rank:null;return!l||n.some(m=>!!m?.is_me)?n:[{rank:l,is_me:!0,is_pinned:!0,user_id:r?.user_id??null,display_name:o,avatar_url:r?.avatar_url??null,github_url:null,is_public:!1,gpt_tokens:r?.gpt_tokens??"0",claude_tokens:r?.claude_tokens??"0",gemini_tokens:r?.gemini_tokens??"0",cursor_tokens:r?.cursor_tokens??"0",opencode_tokens:r?.opencode_tokens??"0",openclaw_tokens:r?.openclaw_tokens??"0",hermes_tokens:r?.hermes_tokens??"0",kiro_tokens:r?.kiro_tokens??"0",copilot_tokens:r?.copilot_tokens??"0",kimi_tokens:r?.kimi_tokens??"0",other_tokens:r?.other_tokens??"0",total_tokens:r?.total_tokens??"0",estimated_cost_usd:r?.estimated_cost_usd??null,badges:Array.isArray(r?.badges)?r.badges:[]},...n]}function sr(a,r){const o=Number(a),n=Number(r);return!Number.isFinite(o)||o<1||!Number.isFinite(n)||n<1?null:Math.ceil(o/n)}const nr=new Set(["/brand-logos/cursor.svg","/brand-logos/kimi.svg","/brand-logos/kiro.svg","/brand-logos/copilot.svg","/brand-logos/hermes.svg"]);function ir({iconSrc:a,label:r}){return e.jsxs("span",{className:"inline-flex items-center gap-3",children:[a?e.jsx("img",{src:a,alt:"",width:16,height:16,className:`h-4 w-4 shrink-0 object-contain opacity-90 ${nr.has(a)?"dark:invert":""}`}):null,e.jsx("span",{className:"whitespace-nowrap",children:r})]})}const ie=xa.memo(function({badges:r,max:o=3,className:n=""}){const l=Wa((r||[]).filter(i=>i&&Va.has(i.id)&&(i.tier||0)>=1)).slice(0,o);return l.length===0?null:e.jsx("span",{className:`pointer-events-none inline-flex shrink-0 items-center ${n}`,children:l.map((i,m)=>e.jsx("span",{title:s("achievements.mini.tooltip",{name:s(Za(i.id,"name")),tier:s(`achievements.tier.${qa(i.tier)}`)}),style:{zIndex:l.length-m},className:`pointer-events-auto relative inline-flex ${m>0?"-ml-1.5":""}`,children:e.jsx(Ja,{badgeId:i.id,tier:i.tier,size:"xs",className:"rounded-full ring-[1.5px] ring-white dark:ring-oai-gray-950"})},i.id))})}),X=[{key:"gpt_tokens",copyKey:"leaderboard.column.codex",icon:"/brand-logos/codex.svg"},{key:"claude_tokens",copyKey:"leaderboard.column.claude",icon:"/brand-logos/claude-code.svg"},{key:"gemini_tokens",copyKey:"leaderboard.column.gemini",icon:"/brand-logos/gemini.svg"},{key:"cursor_tokens",copyKey:"leaderboard.column.cursor",icon:"/brand-logos/cursor.svg"},{key:"kiro_tokens",copyKey:"leaderboard.column.kiro",icon:"/brand-logos/kiro.svg"},{key:"copilot_tokens",copyKey:"leaderboard.column.copilot",icon:"/brand-logos/copilot.svg"},{key:"kimi_tokens",copyKey:"leaderboard.column.kimi",icon:"/brand-logos/kimi.svg"},{key:"opencode_tokens",copyKey:"leaderboard.column.opencode",icon:"/brand-logos/opencode.svg"},{key:"openclaw_tokens",copyKey:"leaderboard.column.openclaw",icon:"/brand-logos/openclaw.svg"},{key:"hermes_tokens",copyKey:"leaderboard.column.hermes",icon:"/brand-logos/hermes.svg"},{key:"other_tokens",copyKey:"leaderboard.column.supplemental",icon:null}],Ge="sticky left-0 z-40 w-14 min-w-14 max-w-14 sm:w-[72px] sm:min-w-[72px] sm:max-w-[72px] bg-white dark:bg-oai-gray-950 px-2.5 sm:px-4 py-4 align-middle",He="sticky left-[55px] sm:left-[71px] z-40 min-w-[96px] sm:min-w-[200px] max-w-[170px] sm:max-w-[min(260px,45vw)] border-l border-r border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-950 px-3 sm:px-4 py-4 align-middle";function le(a){return d("sticky left-0 z-30 w-14 min-w-14 max-w-14 sm:w-[72px] sm:min-w-[72px] sm:max-w-[72px] px-2.5 sm:px-4 py-4 whitespace-nowrap",a?"bg-oai-brand-50 dark:bg-emerald-950":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900")}function de(a){return d("sticky left-[55px] sm:left-[71px] z-30 hover:z-50 min-w-[96px] sm:min-w-[200px] max-w-[170px] sm:max-w-[min(260px,45vw)] border-l border-r border-oai-gray-200 dark:border-oai-gray-800 px-3 sm:px-4 py-4 min-w-0",a?"bg-oai-brand-50 dark:bg-emerald-950":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900")}function y({className:a}){return e.jsx("div",{className:d("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",a)})}function lr({index:a}){const r=a<3?"w-24":a<8?"w-20":"w-16",o=a<3?"w-16":"w-12",n=a<5?"w-14":"w-10";return e.jsxs("tr",{className:"group",children:[e.jsx("td",{className:d(le(!1),"!group-hover:bg-transparent"),children:e.jsx(y,{className:"h-4 w-6"})}),e.jsx("td",{className:d(de(!1),"!group-hover:bg-transparent"),children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(y,{className:"h-8 w-8 min-w-8 rounded-full"}),e.jsx(y,{className:d("h-4",r)})]})}),e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(y,{className:d("h-4",o)})}),e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(y,{className:"h-4 w-12"})}),X.map(l=>e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(y,{className:d("h-4",n)})},l.key))]})}function dr({index:a}){const r=a<3?"w-24":a<8?"w-20":"w-16",o=a%3===0?3:a%3===1?2:1;return e.jsxs("div",{className:"mx-0 my-1 rounded-xl bg-white dark:bg-oai-gray-950 border border-oai-gray-100 dark:border-oai-gray-800/60 px-3.5 py-3 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(y,{className:"h-4 w-3 shrink-0 rounded"}),e.jsx(y,{className:"h-9 w-9 shrink-0 rounded-full"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx(y,{className:d("h-4",r)}),e.jsx(y,{className:"mt-2 h-3.5 w-20"})]}),e.jsxs("div",{className:"shrink-0 text-right",children:[e.jsx(y,{className:"ml-auto h-3 w-8"}),e.jsx(y,{className:"mt-1.5 ml-auto h-4 w-14"})]})]}),e.jsx("div",{className:"mt-3 flex flex-wrap items-center gap-2 border-t border-oai-gray-100 pt-2.5 dark:border-oai-gray-800/70",children:Array.from({length:o},(n,l)=>e.jsx(y,{className:"h-5 w-12 rounded-full"},l))})]})}function cr({rows:a=10}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"hidden w-full overflow-x-auto sm:block",children:e.jsxs("table",{className:"min-w-max w-full text-left text-sm",children:[e.jsx("thead",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800",children:e.jsxs("tr",{children:[e.jsx("th",{className:d(Ge,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx(y,{className:"h-3.5 w-6"})}),e.jsx("th",{className:d(He,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx(y,{className:"h-3.5 w-12"})}),e.jsx("th",{className:"px-4 py-4",children:e.jsx(y,{className:"h-3.5 w-10"})}),e.jsx("th",{className:"px-4 py-4",children:e.jsx(y,{className:"h-3.5 w-14"})}),X.map(r=>e.jsx("th",{className:"px-4 py-4",children:e.jsx(y,{className:"h-3.5 w-12"})},r.key))]})}),e.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:Array.from({length:a},(r,o)=>e.jsx(lr,{index:o},o))})]})}),e.jsx("div",{className:"flex flex-col py-1 sm:hidden",children:Array.from({length:a},(r,o)=>e.jsx(dr,{index:o},o))})]})}function mr({id:a,thClassName:r,children:o}){const{attributes:n,listeners:l,setNodeRef:i,transform:m,transition:b,isDragging:x}=Ra({id:a}),p=Ia.Transform.toString(m)||"";c.useLayoutEffect(()=>{const f=document.querySelectorAll(`td[data-column-key="${a}"]`),h="0 2px 10px rgba(15, 23, 42, 0.10), 0 1px 3px rgba(15, 23, 42, 0.06)";return f.forEach(g=>{g.style.transform=p,g.style.transition=b||"",g.style.zIndex=x?"20":"",g.style.position=p?"relative":"",g.style.boxShadow=x?h:""}),()=>{f.forEach(g=>{g.style.transform="",g.style.transition="",g.style.zIndex="",g.style.position="",g.style.boxShadow=""})}},[a,p,b,x]);const j={transform:p,transition:b,position:p?"relative":void 0,zIndex:x?20:void 0,boxShadow:x?"0 2px 10px rgba(15, 23, 42, 0.10), 0 1px 3px rgba(15, 23, 42, 0.06)":void 0};return e.jsx("th",{ref:i,style:j,className:d(r,"group/col select-none cursor-grab active:cursor-grabbing touch-none"),...n,...l,children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx("span",{"aria-hidden":"true",className:d("-mr-1 inline-flex h-4 w-3 shrink-0 items-center justify-center text-oai-gray-400 dark:text-oai-gray-600","opacity-0 transition-opacity duration-150 group-hover/col:opacity-100",x&&"opacity-100"),children:e.jsxs("svg",{viewBox:"0 0 8 14",width:"8",height:"14",fill:"currentColor","aria-hidden":"true",children:[e.jsx("circle",{cx:"2",cy:"2",r:"1"}),e.jsx("circle",{cx:"6",cy:"2",r:"1"}),e.jsx("circle",{cx:"2",cy:"7",r:"1"}),e.jsx("circle",{cx:"6",cy:"7",r:"1"}),e.jsx("circle",{cx:"2",cy:"12",r:"1"}),e.jsx("circle",{cx:"6",cy:"12",r:"1"})]})}),o]})})}const ur="tokentracker.leaderboard.columnOrder.v1";function xr(a){return za(ur,a)}const gr=50;function br(a,r){const o=Number(a),n=Number(r);return!Number.isFinite(o)||o<1||!Number.isFinite(n)||n<1?null:Math.min(100,Math.max(1,Math.ceil(o/n*100)))}function Ye(a){return typeof a=="string"?a.trim():""}function pr(a){const r=Ye(a);return r?r.toLowerCase()==="anonymous":!0}function hr({me:a,totalEntries:r,meLabel:o,onOpenProfile:n,onJumpToMe:l,canJump:i,className:m}){const b=a&&typeof a.rank=="number"?a.rank:null;if(!b)return null;const x=Number(r)||0,p=br(b,x),j=Ye(a?.display_name),f=!j||pr(j)?o||"You":j,h=a?.user_id||f,g=n||(i?l:null),T=typeof g=="function",C=T?"button":"div",ee=T?{type:"button",onClick:g,"aria-label":s(n?"leaderboard.summary.view_profile":"leaderboard.summary.jump_to_me")}:{};return e.jsxs(C,{...ee,className:d("group inline-flex h-9 items-center gap-2.5 rounded-full border pl-1 pr-3.5 transition-all duration-300 select-none",T?"border-oai-gray-200 hover:border-oai-brand-400 dark:border-oai-gray-800 dark:hover:border-oai-brand-500/80 bg-oai-gray-50/50 dark:bg-white/[0.02] backdrop-blur-md hover:bg-oai-brand-50/40 dark:hover:bg-oai-brand-950/20 active:scale-[0.97] dark:ring-1 dark:ring-white/[0.04] dark:hover:ring-white/[0.08]":"border-oai-gray-100 dark:border-oai-gray-800/60 bg-oai-gray-50/20 dark:bg-white/[0.01] backdrop-blur-sm dark:ring-1 dark:ring-white/[0.02]",m),children:[e.jsx(Z,{size:"sm",avatarUrl:a?.avatar_url,displayName:f,seed:h}),e.jsx("span",{className:"hidden sm:inline max-w-[120px] truncate text-xs font-semibold text-oai-black dark:text-oai-gray-200 group-hover:text-oai-brand-600 dark:group-hover:text-oai-brand-400 transition-colors",children:f}),e.jsxs("span",{className:"text-xs font-bold tabular-nums text-oai-gray-800 dark:text-white",children:["#",b.toLocaleString()]}),p!=null&&p<=gr&&e.jsx("span",{className:d("hidden sm:inline-flex items-center rounded-full px-2 py-0.5 text-[9px] font-extrabold tracking-wider tabular-nums uppercase transition-colors duration-300 ring-1",p<=10?"bg-amber-500/10 text-amber-600 dark:bg-amber-500/15 dark:text-amber-400 ring-amber-500/20":"bg-oai-brand-100/50 text-oai-brand-700 dark:bg-oai-brand-500/10 dark:text-oai-brand-400 ring-oai-brand-500/10"),children:s("leaderboard.summary.percentile",{p:String(p)})}),T?e.jsx(er,{"aria-hidden":!0,className:"size-3 text-oai-gray-400 transition-all duration-300 group-hover:text-oai-brand-500 dark:text-oai-gray-500 group-hover:translate-x-0.5 group-hover:scale-110"}):e.jsxs("span",{className:"relative flex h-1.5 w-1.5 shrink-0 items-center justify-center ml-1",title:"You are here",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-emerald-400 opacity-75 duration-1000"}),e.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-emerald-500"})]})]})}const fr=c.lazy(()=>Fe(()=>import("./LeaderboardProfileModal-DwpalEE6.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23])).then(a=>({default:a.LeaderboardProfileModal}))),yr=c.lazy(()=>Fe(()=>import("./CommunityStatsModal-s9IKLboA.js"),__vite__mapDeps([24,1,2,15,25,5,10,26,4,7,27,28,22,23,29,6,17,11,12,13,21,30,31])).then(a=>({default:a.CommunityStatsModal}))),ce=[10,20,50,100],me=20,We="tokentracker:leaderboard:pageSize";function kr(){if(typeof window>"u")return me;try{const a=window.localStorage.getItem(We),r=Number(a);if(ce.includes(r))return r}catch{}return me}function ue(a,r,o){const n=Number(a);if(!Number.isFinite(n)||n<=0)return"-";const l=Sa(r),i=r===Ma?n:n*o;return i>=1e3?`${l}${Math.round(i).toLocaleString()}`:i>=10?`${l}${Math.round(i)}`:`${l}${i.toFixed(2)}`}function wr(a){if(typeof a!="string"||!a.trim())return null;const r=new Date(a);if(!Number.isFinite(r.getTime()))return null;const o=Aa();return{dateTime:r.toISOString(),display:new Intl.DateTimeFormat(o,{dateStyle:"medium",timeStyle:"short"}).format(r),exact:new Intl.DateTimeFormat(o,{dateStyle:"full",timeStyle:"long"}).format(r)}}function xe({value:a}){const{formatTokens:r,formatTokensTooltip:o}=Q();return e.jsx("span",{title:o(a),children:r(a)})}function jr({communityStats:a,onClick:r}){const{formatTokens:o,formatTokensTooltip:n}=Q();return a.status!=="ready"?null:e.jsxs("button",{type:"button",onClick:r,className:"inline-flex min-w-0 max-w-full flex-1 items-center gap-1.5 whitespace-nowrap rounded-xl border border-oai-gray-200 bg-oai-gray-50/50 px-2.5 py-2 text-xs text-oai-gray-500 backdrop-blur-md transition-all duration-300 hover:border-oai-brand-400 hover:bg-oai-brand-50/40 active:scale-[0.97] dark:border-oai-gray-800 dark:bg-white/[0.02] dark:text-oai-gray-400 dark:hover:border-oai-brand-500/80 dark:hover:bg-oai-brand-950/20 sm:h-9 sm:flex-none sm:gap-2.5 sm:rounded-full sm:px-3.5 sm:py-0",title:s("leaderboard.community.view_stats"),children:[e.jsxs("span",{className:"relative flex h-1.5 w-1.5 shrink-0","aria-hidden":"true",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-emerald-500/80 opacity-75 duration-1000"}),e.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-emerald-500"})]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"font-semibold text-oai-black dark:text-white tabular-nums",children:e.jsx("span",{title:n(a.tokenFloor),children:o(a.tokenFloor)})}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:s("leaderboard.community.tokens_chip")})]}),e.jsx("span",{className:"text-oai-gray-200 dark:text-oai-gray-800 select-none",children:"·"}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsxs("span",{className:"font-semibold text-oai-black dark:text-white tabular-nums",children:[e.jsx("span",{className:"sm:hidden",children:Ca(a.totalEntries)}),e.jsx("span",{className:"hidden sm:inline",children:(Number(a.totalEntries)||0).toLocaleString("en-US")})]}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:s("leaderboard.community.devs_chip")})]})]})}function De({entry:a,isMe:r,orderedColumns:o}){const{formatTokens:n,formatTokensTooltip:l}=Q(),i=r?"text-oai-gray-700 dark:text-oai-gray-300":"text-oai-gray-500 dark:text-oai-gray-400",m=r?"bg-oai-brand-50 dark:bg-oai-brand-900/10":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900";return o.map(b=>e.jsx("td",{"data-column-key":b.key,title:l(a?.[b.key]),className:d("hidden sm:table-cell px-3 sm:px-4 py-4 whitespace-nowrap text-right tabular-nums",i,m),children:n(a?.[b.key])},b.key))}function vr(a){return a?.key==="gpt_tokens"?"CODEX":a?.key==="claude_tokens"?"CLAUDE":(a?.icon?.split("/").pop()||"").replace(/\.svg$/i,"").toUpperCase()||"OTHER"}const Nr={1:"ring-2 ring-amber-400 dark:ring-amber-500/80 shadow-[0_0_8px_rgba(245,158,11,0.25)]",2:"ring-2 ring-slate-350 dark:ring-slate-450 shadow-[0_0_8px_rgba(148,163,184,0.2)]",3:"ring-2 ring-orange-400 dark:ring-orange-500/70 shadow-[0_0_8px_rgba(249,115,22,0.25)]"};function _r({rank:a,placeholder:r}){return a===1?e.jsx("span",{className:"text-base font-extrabold italic text-amber-500 dark:text-amber-400 tracking-tighter",children:"1"}):a===2?e.jsx("span",{className:"text-base font-extrabold italic text-slate-400 dark:text-slate-350 tracking-tighter",children:"2"}):a===3?e.jsx("span",{className:"text-base font-extrabold italic text-orange-500 dark:text-orange-400 tracking-tighter",children:"3"}):e.jsx("span",{className:"text-[13px] font-bold tabular-nums text-oai-gray-400 dark:text-oai-gray-500",children:a==null?r:`#${a}`})}function Sr({githubUrl:a}){return e.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",onClick:r=>r.stopPropagation(),"aria-label":"GitHub profile",className:"absolute bottom-0 right-0 translate-x-1 translate-y-1 flex h-4.5 w-4.5 items-center justify-center rounded-full bg-white dark:bg-oai-gray-950 text-oai-black dark:text-oai-gray-100 shadow border border-oai-gray-100 dark:border-oai-gray-800 transition-transform active:scale-110",children:e.jsx(he,{provider:"GITHUB",size:11})})}function Cr({entry:a,orderedColumns:r}){const{formatTokens:o,formatTokensTooltip:n}=Q(),l=r.filter(i=>{const m=Number(a?.[i.key]);return Number.isFinite(m)&&m>0});return l.length===0?null:e.jsx("div",{className:"mt-3 flex flex-wrap items-center gap-x-1.5 gap-y-2 border-t border-oai-gray-100/70 pt-3 dark:border-oai-gray-800/60",children:l.map(i=>{const m=s(i.copyKey);return e.jsxs("span",{title:m,"aria-label":`${m}: ${n(a?.[i.key])}`,className:"inline-flex shrink-0 items-center gap-1 rounded-full bg-oai-gray-50/80 dark:bg-oai-gray-900/60 px-2 py-0.5 border border-oai-gray-100/80 dark:border-oai-gray-800/40 text-[10px] font-medium text-oai-gray-600 dark:text-oai-gray-300 transition-colors",children:[e.jsx(he,{provider:vr(i),size:12,className:"shrink-0 opacity-90"}),e.jsx("span",{className:"tabular-nums",children:o(a?.[i.key])})]},i.key)})})}function Lr({entry:a,entryIdx:r,name:o,meLabel:n,currency:l,rate:i,orderedColumns:m,placeholder:b,onOpenProfile:x}){if(a?.is_ellipsis)return e.jsx("div",{"aria-hidden":"true",className:"px-4 py-2 text-center text-xs tracking-[0.4em] text-oai-gray-400 dark:text-oai-gray-600",children:"···"},`mobile-ellipsis-${r}`);const p=!!a?.is_me,j=!p&&be(a?.display_name),f=typeof a?.user_id=="string"?a.user_id:null,h=!!f,g=p?n:o,T=C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),x(f))};return e.jsxs("div",{role:h?"button":void 0,tabIndex:h?0:void 0,onClick:h?()=>x(f):void 0,onKeyDown:h?T:void 0,"aria-label":h?s("leaderboard.profile_modal.row_aria",{name:g}):void 0,className:d("relative mx-0 my-1 rounded-xl px-3.5 py-3 transition-all duration-200 border shadow-sm select-none",p?"bg-gradient-to-br from-oai-brand-50/70 via-oai-brand-50/20 to-transparent dark:from-oai-brand-950/20 dark:via-oai-brand-950/5 dark:to-transparent border-oai-brand-200/60 dark:border-oai-brand-500/25":j?"bg-white/90 dark:bg-oai-gray-950/90 border-oai-gray-100/70 dark:border-oai-gray-800/40":"bg-white dark:bg-oai-gray-950 border-oai-gray-100 dark:border-oai-gray-800/60",h&&"cursor-pointer hover:border-oai-gray-200 dark:hover:border-oai-gray-700/80 active:scale-[0.985] active:bg-oai-gray-50/60 dark:active:bg-oai-gray-900/40 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-oai-brand-500/60"),children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e.jsx("span",{className:"flex w-5 shrink-0 items-center justify-center",children:e.jsx(_r,{rank:a?.rank,placeholder:b})}),e.jsxs("span",{className:"relative inline-flex shrink-0",children:[e.jsx("span",{className:d("inline-flex rounded-full p-0.5 transition-all duration-300",Nr[a?.rank]||"ring-1 ring-oai-gray-200 dark:ring-oai-gray-800/80",j&&"opacity-60 grayscale-[15%]"),children:e.jsx(Z,{size:"md",avatarUrl:a?.avatar_url,displayName:g,seed:pe(a,g)})}),a?.github_url&&e.jsx(Sr,{githubUrl:a.github_url})]}),e.jsxs("div",{className:"min-w-0 flex-1 pl-1",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[e.jsx("span",{className:d("min-w-0 truncate text-sm tracking-tight",p?"font-semibold text-oai-black dark:text-oai-white":j?"font-normal text-oai-gray-400 dark:text-oai-gray-500":"font-medium text-oai-gray-800 dark:text-oai-gray-200"),children:g}),e.jsx(ie,{badges:a?.badges,className:"shrink-0 scale-95"})]}),e.jsxs("div",{className:"mt-1 text-[11px] text-oai-gray-400 dark:text-oai-gray-500",children:[e.jsx("span",{children:s("leaderboard.column.est_cost")}),e.jsx("span",{className:d("ml-1 tabular-nums font-medium",j?"text-oai-gray-400/80 dark:text-oai-gray-500/80":"text-oai-gray-600 dark:text-oai-gray-300"),children:ue(a?.estimated_cost_usd,l,i)})]})]}),e.jsxs("div",{className:"shrink-0 text-right",children:[e.jsx("div",{className:"text-[9px] font-semibold uppercase tracking-[0.08em] text-oai-gray-400 dark:text-oai-gray-500",children:s("leaderboard.column.total")}),e.jsx("div",{className:d("mt-0.5 text-sm font-semibold tabular-nums tracking-tight",p?"text-oai-black dark:text-oai-white":j?"text-oai-gray-400 dark:text-oai-gray-500":"text-oai-gray-800 dark:text-oai-gray-200"),children:e.jsx(xe,{value:a?.total_tokens})})]})]}),e.jsx(Cr,{entry:a,orderedColumns:m})]},`mobile-row-${a?.rank}-${g}`)}const Er={1:{text:"text-amber-600 dark:text-amber-400",badge:"bg-amber-50 dark:bg-amber-900/20"},2:{text:"text-gray-500 dark:text-gray-300",badge:"bg-gray-50 dark:bg-gray-800/40"},3:{text:"text-orange-700 dark:text-orange-400",badge:"bg-orange-50 dark:bg-orange-900/20"}};function $e({rank:a,placeholder:r}){const o=Er[a];return o?e.jsx("span",{className:d("inline-flex items-center justify-center h-7 w-7 rounded-full text-xs font-bold",o.text,o.badge),children:a}):e.jsx("span",{className:"inline-flex items-center justify-center h-7 w-7 text-sm",children:a??r})}function Ue(a){if(typeof a!="string")return null;const r=a.trim().toLowerCase();return r==="week"||r==="month"||r==="total"?r:null}function Tr(a){if(!a)return s("shared.error.prefix",{error:s("leaderboard.error.unknown")});const r=a?.message||String(a),o=String(r||"").trim()||s("leaderboard.error.unknown");return s("shared.error.prefix",{error:o})}function ge(a){return typeof a!="string"?"":a.trim()}function be(a){const r=ge(a);return r?r.toLowerCase()==="anonymous":!0}function pe(a,r){const o=typeof a?.user_id=="string"?a.user_id.trim():"";return o||`${a?.rank??""}:${r}`}function Oe({githubUrl:a}){return e.jsxs("span",{className:"absolute left-1/2 top-full -translate-x-1/2 -translate-y-1/2 inline-flex group/gh",children:[e.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",onClick:r=>r.stopPropagation(),"aria-label":s("leaderboard.github.aria"),className:"flex h-4 w-4 items-center justify-center rounded-full bg-white dark:bg-oai-gray-950 text-oai-black dark:text-oai-gray-100 transition-transform hover:scale-110",children:e.jsx(he,{provider:"GITHUB",size:14})}),e.jsxs("span",{role:"tooltip",className:"invisible opacity-0 group-hover/gh:visible group-hover/gh:opacity-100 absolute left-0 bottom-full mb-2 whitespace-nowrap rounded-md bg-oai-black dark:bg-oai-gray-700 px-2.5 py-1.5 text-[11px] leading-relaxed text-white shadow-lg transition-opacity duration-150 z-50 before:content-[''] before:absolute before:inset-x-0 before:top-full before:h-2.5",children:[e.jsx("span",{className:"block",children:s("leaderboard.github.tooltipAction")}),e.jsxs("span",{className:"block text-oai-gray-300 dark:text-oai-gray-400",children:[s("leaderboard.github.tooltipPrefix")," ",e.jsx(_a,{to:"/settings",onClick:r=>r.stopPropagation(),className:"text-white underline underline-offset-2 decoration-oai-gray-400 hover:text-oai-brand-300 hover:decoration-oai-brand-300",children:s("leaderboard.github.tooltipSettingsLink")})," ",s("leaderboard.github.tooltipSuffix")]})]})]})}function Jr({auth:a,signedIn:r,sessionSoftExpired:o}){const n=ga(),l=ba(),{openLoginModal:i}=pa(),{signedIn:m,loading:b,user:x}=ha(),{currency:p,rate:j}=Ya(),f=c.useMemo(()=>fa(),[]),h=ya(),g=r&&!o,T=c.useMemo(()=>g&&(typeof a=="function"||typeof a=="string"||a&&typeof a=="object")?a:null,[a,g]),C=g?T:null,ee=g&&ka(C),ae=s("shared.placeholder.short"),Ve=c.useMemo(()=>X.map(t=>t.key),[]),{order:re,reorder:fe}=xr(Ve),ye=c.useMemo(()=>{const t=new Map;for(const u of X)t.set(u.key,u);return t},[]),B=c.useMemo(()=>re.map(t=>ye.get(t)).filter(Boolean),[re,ye]),Je=Ba(Be(Ha,{activationConstraint:{distance:6}}),Be(Ga,{coordinateGetter:Fa})),qe=c.useCallback(t=>{const{active:u,over:w}=t;!w||u.id===w.id||fe(String(u.id),String(w.id))},[fe]),[te,M]=c.useState(1),[_,Ze]=c.useState(kr),[ke,we]=c.useState(null),[Xe,je]=c.useState(!1),Y=c.useCallback(t=>{typeof t=="string"&&t.trim()&&we(t.trim())},[]),Qe=c.useCallback(()=>we(null),[]),ea=c.useCallback(t=>{const u=ce.includes(t)?t:me;Ze(u),M(1);try{window.localStorage.setItem(We,String(u))}catch{}},[]),[ve,aa]=c.useState(0),[ra,ta]=c.useState(()=>wa()),[Ne,_e]=c.useState(!1);c.useEffect(()=>{if(typeof window>"u")return;const t=()=>{aa(u=>u+1)};return window.addEventListener(ze,t),()=>{window.removeEventListener(ze,t)}},[]);const N=c.useMemo(()=>{const t=new URLSearchParams(n?.search||"");return Ue(t.get("period"))||"total"},[n?.search]),oa=t=>{const u=Ue(t);if(!u||u===N)return;const w=new URLSearchParams(n?.search||"");w.set("period",u),M(1),l(`${n?.pathname||"/leaderboard"}?${w.toString()}`,{replace:!0})};c.useEffect(()=>{b||h||m||i()},[m,b,h,i]),c.useEffect(()=>{M(1)},[N]);const W=c.useMemo(()=>(H(te,{min:1,max:1e6,fallback:1})-1)*_,[te,_]),R=c.useMemo(()=>h?"mock":b?"unavailable":m?"cloud":r?"local":f?"public":"unavailable",[b,m,f,h,r]),k=c.useMemo(()=>ja({accessMode:R,baseUrl:f,mockEnabled:h,userId:x?.id||null,period:N,pageSize:_,offset:W}),[x?.id,R,f,W,h,_,N]),[D,$]=c.useState(()=>{const t=ne(k);return t?{loading:!1,error:null,data:t.data,contextKey:k}:{loading:!1,error:null,data:null,contextKey:null}});c.useEffect(()=>{if(!f&&!h||!h&&R==="unavailable"){$({loading:!1,error:null,data:null,contextKey:null});return}const t=ne(k);let u=!0;return $(t?{loading:!1,error:null,data:t.data,contextKey:k}:{loading:!0,error:null,data:null,contextKey:null}),(async()=>{const w=await va({userId:x?.id||null,period:N,limit:_,offset:W});u&&(Na(w,{activeContextKey:k,contextKey:k,source:ve>0?"manual-refresh":"page-load"}),$({loading:!1,error:null,data:w,contextKey:k}))})().catch(w=>{if(!u)return;const A=Tr(w);$(F=>F.contextKey===k?{...F,loading:!1,error:A}:{loading:!1,error:A,data:null,contextKey:k})}),()=>{u=!1}},[f,R,x?.id,k,W,ve,h,N,_]);const oe=c.useMemo(()=>D.contextKey===k?null:ne(k),[k,D.contextKey]),v=c.useMemo(()=>D.contextKey===k?D:oe?{loading:!1,error:null,data:oe.data,contextKey:k}:{loading:!!(f||h)&&R!=="unavailable",error:null,data:null,contextKey:k},[R,f,k,D,h,oe]),S=v.data,U=S?.total_pages??null,sa=S?.total_entries??0,P=S?.page??te,na=c.useMemo(()=>rr(P,U),[P,U]),Se=S?.from||null,Ce=S?.to||null,ia=S?.generated_at||null,V=wr(ia),Le=Xa(),K=S?.me||null,I=s("leaderboard.me_label"),Ee=s("leaderboard.anon_label"),Te=s("leaderboard.period.week"),Ae=s("leaderboard.period.month"),Me=s("leaderboard.period.total"),Pe=N==="month"?Ae:N==="total"?Me:Te,J=c.useMemo(()=>{const t=Array.isArray(S?.entries)?S.entries:[];return or({entries:t,me:K,meLabel:I})},[S?.entries,K,I]),z=c.useMemo(()=>sr(K?.rank,_),[K?.rank,_]),la=z!=null&&z===P,da=c.useCallback(()=>{z!=null&&M(z)},[z]),ca=async()=>{_e(!0);try{La(!0),ta(!0),await Ea(()=>Ta(C))}catch(t){console.warn("[tokentracker] sync:",t)}finally{_e(!1)}},{canPrev:Ke,canNext:Re}=tr({page:P,totalPages:U}),q=Array.isArray(J)&&J.length!==0;let O=null;v.loading&&!q?O=e.jsx(cr,{rows:_}):v.error&&!q?O=e.jsx("div",{className:"px-6 py-12 text-center",children:e.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:v.error})}):q?O=e.jsxs(Da,{sensors:Je,collisionDetection:$a,modifiers:[ar],onDragEnd:qe,children:[e.jsx("div",{className:"hidden w-full overflow-x-auto sm:block",children:e.jsxs("table",{className:"min-w-full w-full text-left text-sm sm:min-w-max",children:[e.jsx("thead",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800",children:e.jsxs("tr",{children:[e.jsx("th",{className:d(Ge,"text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500"),children:s("leaderboard.column.rank")}),e.jsx("th",{className:d(He,"text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500"),children:s("leaderboard.column.user")}),e.jsx("th",{className:"px-3 sm:px-4 py-4 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500 whitespace-nowrap text-right align-middle",children:s("leaderboard.column.total")}),e.jsx("th",{className:"hidden sm:table-cell px-3 sm:px-4 py-4 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500 whitespace-nowrap text-right align-middle",title:"Based on estimated API pricing, not actual billing",children:s("leaderboard.column.est_cost")}),e.jsx(Ua,{items:re,strategy:Oa,children:B.map(t=>e.jsx(mr,{id:t.key,thClassName:"hidden sm:table-cell px-3 sm:px-4 py-4 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500 whitespace-nowrap align-middle",children:e.jsx(ir,{iconSrc:t.icon,label:s(t.copyKey)})},t.key))})]})}),e.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:J.map((t,u)=>{if(t?.is_ellipsis){const E=4+B.length;return e.jsx("tr",{"aria-hidden":"true",children:e.jsx("td",{colSpan:E,className:"px-4 py-2 text-center text-oai-gray-400 dark:text-oai-gray-600 bg-white dark:bg-oai-gray-950 select-none tracking-[0.4em] text-xs",children:"···"})},`ellipsis-${u}`)}const w=!!t?.is_me,A=typeof t?.user_id=="string"?t.user_id:null,F=ge(t?.display_name),ma=be(F)?Ee:F,L=w?I:ma,G=!!A,Ie=G?{role:"button",tabIndex:0,onClick:G?()=>Y(A):void 0,onKeyDown:G?E=>{(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),Y(A))}:void 0,"aria-label":s("leaderboard.profile_modal.row_aria",{name:L})}:{};if(w){const E=!!t?.is_pinned;return e.jsxs("tr",{...Ie,className:d("bg-oai-brand-50 dark:bg-oai-brand-900/10 transition-colors",E?"border-t border-b border-oai-brand-300/40 dark:border-oai-brand-500/20":"border-y border-oai-brand-300/40 dark:border-oai-brand-500/30",G&&"cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500/60"),children:[e.jsx("td",{className:d(le(!0),"font-semibold text-oai-brand-600 dark:text-oai-brand-400",E&&"before:absolute before:left-0 before:top-[15%] before:h-[70%] before:w-[3px] before:rounded-r before:bg-oai-brand-500 dark:before:bg-oai-brand-400"),children:e.jsx($e,{rank:t?.rank,placeholder:ae})}),e.jsx("td",{className:de(!0),children:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsxs("span",{className:d("relative inline-flex shrink-0 rounded-full p-[2px]",t?.github_url&&"gh-avatar-frame"),children:[e.jsx("span",{className:d("inline-flex rounded-full p-px",t?.github_url&&"bg-white dark:bg-oai-gray-950"),children:e.jsx(Z,{avatarUrl:t?.avatar_url,displayName:L,seed:pe(t,L)})}),t?.github_url&&e.jsx(Oe,{githubUrl:t.github_url})]}),e.jsx("span",{className:"truncate font-semibold text-oai-black dark:text-oai-white",children:L}),e.jsx(ie,{badges:t?.badges,className:"hidden sm:inline-flex"})]})}),e.jsx("td",{className:"px-3 sm:px-4 py-4 font-medium text-oai-black dark:text-oai-white whitespace-nowrap text-right tabular-nums bg-oai-brand-50 dark:bg-oai-brand-900/10",children:e.jsx(xe,{value:t?.total_tokens})}),e.jsx("td",{className:"hidden sm:table-cell px-3 sm:px-4 py-4 font-medium text-oai-brand-600 dark:text-oai-brand-400 whitespace-nowrap text-right tabular-nums bg-oai-brand-50 dark:bg-oai-brand-900/10",title:"Based on estimated API pricing, not actual billing",children:ue(t?.estimated_cost_usd,p,j)}),e.jsx(De,{entry:t,isMe:!0,orderedColumns:B})]},`row-${t?.rank}-${L}${E?"-pin":""}`)}return e.jsxs("tr",{...Ie,className:d("group transition-colors",G&&"cursor-pointer hover:bg-oai-gray-50 dark:hover:bg-oai-gray-900/60 focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500/60"),children:[e.jsx("td",{className:d(le(!1),"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx($e,{rank:t?.rank,placeholder:ae})}),e.jsx("td",{className:de(!1),children:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsxs("span",{className:d("relative inline-flex shrink-0 rounded-full p-[2px]",t?.github_url&&"gh-avatar-frame"),children:[e.jsx("span",{className:d("inline-flex rounded-full p-px",t?.github_url&&"bg-white dark:bg-oai-gray-950"),children:e.jsx(Z,{avatarUrl:t?.avatar_url,displayName:L,seed:pe(t,L)})}),t?.github_url&&e.jsx(Oe,{githubUrl:t.github_url})]}),e.jsx("span",{className:"truncate font-medium text-oai-gray-800 dark:text-oai-gray-200",children:L}),e.jsx(ie,{badges:t?.badges,className:"hidden sm:inline-flex"})]})}),e.jsx("td",{className:"px-3 sm:px-4 py-4 font-semibold text-oai-gray-800 dark:text-oai-gray-200 whitespace-nowrap text-right tabular-nums bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60",children:e.jsx(xe,{value:t?.total_tokens})}),e.jsx("td",{className:"hidden sm:table-cell px-3 sm:px-4 py-4 text-oai-gray-500 dark:text-oai-gray-400 whitespace-nowrap text-right tabular-nums bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60",title:"Based on estimated API pricing, not actual billing",children:ue(t?.estimated_cost_usd,p,j)}),e.jsx(De,{entry:t,isMe:!1,orderedColumns:B})]},`row-${t?.rank}-${L}`)})})]})}),e.jsx("div",{className:"flex flex-col py-1.5 sm:hidden",children:J.map((t,u)=>{const w=ge(t?.display_name),A=be(w)?Ee:w;return e.jsx(Lr,{entry:t,entryIdx:u,name:t?.is_me?I:A,meLabel:I,currency:p,rate:j,orderedColumns:B,placeholder:ae,onOpenProfile:Y},`mobile-${t?.rank??"ellipsis"}-${u}`)})})]}):O=e.jsx("div",{className:"px-6 py-12 text-center",children:e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("leaderboard.empty")})});let se=null;return typeof U=="number"?se=na.map((t,u)=>t==null?e.jsx("span",{className:"px-2 text-oai-gray-400 dark:text-oai-gray-500",children:s("leaderboard.pagination.ellipsis")},`ellipsis-${u}`):e.jsx("button",{className:d("flex h-8 w-8 items-center justify-center rounded-md text-sm font-medium transition-colors",t===P?"bg-oai-gray-200 dark:bg-oai-gray-800 text-oai-black dark:text-white":"text-oai-gray-500 dark:text-oai-gray-400 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white"),onClick:()=>M(t),disabled:v.loading,children:String(t)},`page-${t}`)):se=e.jsx("span",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("leaderboard.pagination.page_unknown",{page:String(P)})}),e.jsxs("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:[e.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:e.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[e.jsxs("div",{className:"mb-4 grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 gap-y-3.5 sm:mb-8 sm:grid-cols-[minmax(0,1fr)_auto] sm:gap-4",children:[e.jsx("h1",{className:"col-start-1 row-start-1 min-w-0 whitespace-nowrap text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:col-span-2 sm:row-start-1 sm:text-4xl",children:s("leaderboard.title")}),e.jsxs("p",{className:"col-span-2 row-start-2 hidden text-sm text-oai-gray-500 dark:text-oai-gray-400 sm:block sm:row-start-2 sm:text-base",children:[N==="total"?s("leaderboard.range.total"):Se&&Ce?s("leaderboard.range",{period:Pe,from:Se,to:Ce}):s("leaderboard.range_loading",{period:Pe}),V&&e.jsx("time",{dateTime:V.dateTime,title:s("leaderboard.generated_at",{ts:V.exact}),className:"ml-2 hidden border-l border-oai-gray-200 pl-2 text-xs text-oai-gray-500 dark:border-oai-gray-800 dark:text-oai-gray-400 sm:inline-block",children:s("leaderboard.generated_at",{ts:V.display})})]}),e.jsx("div",{className:"col-start-2 row-start-1 inline-flex h-9 shrink-0 items-center rounded-full border border-oai-gray-200 p-1 dark:border-oai-gray-800 sm:col-start-1 sm:row-start-3 sm:justify-self-start",children:["week","month","total"].map(t=>{const u=N===t;return e.jsxs("button",{onClick:()=>oa(t),disabled:v.loading,className:d("px-3 sm:px-4 h-7 text-sm font-medium rounded-full flex items-center justify-center transition-colors relative",u?"text-oai-black dark:text-white":"text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-800 dark:hover:text-oai-gray-200"),children:[e.jsx("span",{className:"relative z-10",children:t==="week"?Te:t==="month"?Ae:Me}),u&&e.jsx(Ka.div,{layoutId:"leaderboard-period-active-bg",className:"absolute inset-0 bg-oai-gray-200 dark:bg-oai-gray-800 rounded-full z-0",transition:{type:"spring",stiffness:380,damping:30}})]},t)})}),e.jsxs("div",{className:"col-span-2 row-start-2 mb-0 flex w-full min-w-0 items-center justify-between sm:justify-end gap-2.5 sm:col-span-1 sm:col-start-2 sm:row-start-3 sm:mb-0 sm:w-auto sm:shrink-0",children:[e.jsx(jr,{communityStats:Le,onClick:()=>je(!0)}),e.jsx(hr,{me:K,totalEntries:sa,meLabel:I,onOpenProfile:K?.user_id?()=>Y(K.user_id):void 0,onJumpToMe:da,canJump:z!=null&&!la&&!v.loading,className:"shrink-0"})]})]}),!r&&e.jsxs("div",{className:"mb-6 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between text-sm",children:[e.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:s("leaderboard.signin_prompt")}),e.jsx("button",{onClick:i,className:"shrink-0 whitespace-nowrap self-start sm:self-auto px-3 py-1.5 text-sm font-medium text-oai-gray-600 dark:text-oai-gray-300 border border-oai-gray-300 dark:border-oai-gray-700 rounded-md hover:text-oai-black dark:hover:text-white hover:border-oai-gray-400 dark:hover:border-oai-gray-600 transition-colors",children:s("leaderboard.signin_button")})]}),g&&ee&&!ra&&e.jsxs("div",{className:"mb-6 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between text-sm",children:[e.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:s("leaderboard.sync_prompt")}),e.jsx("button",{onClick:ca,disabled:Ne,className:"shrink-0 whitespace-nowrap self-start sm:self-auto px-3 py-1.5 text-sm font-medium text-oai-gray-600 dark:text-oai-gray-300 border border-oai-gray-300 dark:border-oai-gray-700 rounded-md hover:text-oai-black dark:hover:text-white hover:border-oai-gray-400 dark:hover:border-oai-gray-600 disabled:opacity-50 transition-colors",children:Ne?s("leaderboard.sync_button.busy"):s("leaderboard.sync_button.idle")})]}),e.jsxs("div",{className:"sm:rounded-xl sm:border sm:border-oai-gray-200 sm:dark:border-oai-gray-800 sm:overflow-hidden border-none bg-transparent",children:[v.error&&q?e.jsx("div",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800 px-6 py-3",children:e.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:v.error})}):null,O,e.jsxs("div",{className:"flex flex-col gap-3 sm:border-t border-oai-gray-200 px-4 py-3 sm:flex-row sm:items-center sm:justify-end sm:gap-x-4 sm:px-6 dark:border-oai-gray-800 border-none mt-2.5 sm:mt-0",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 text-sm text-oai-gray-500 dark:text-oai-gray-400 sm:justify-start",children:[e.jsx("label",{htmlFor:"leaderboard-page-size",className:"whitespace-nowrap",children:s("leaderboard.pagination.page_size_label")}),e.jsx(Pa,{id:"leaderboard-page-size",value:_,onValueChange:t=>ea(Number(t)),disabled:v.loading,ariaLabel:s("leaderboard.pagination.page_size_label"),options:ce.map(t=>({value:t,label:String(t)})),align:"end",className:"px-3 py-1 text-oai-gray-700 dark:text-oai-gray-300"})]}),e.jsx("div",{className:"hidden h-5 w-px bg-oai-gray-200 dark:bg-oai-gray-800 sm:block","aria-hidden":"true"}),e.jsxs("div",{className:"flex w-full items-center justify-between sm:w-auto sm:justify-end gap-1.5",children:[e.jsx("button",{className:d("whitespace-nowrap rounded-xl border border-oai-gray-100 bg-oai-gray-50/50 px-3.5 py-2 text-xs font-medium text-oai-gray-500 dark:border-oai-gray-800/80 dark:bg-white/[0.01] dark:text-oai-gray-400 transition-all duration-200 active:scale-[0.97] sm:rounded-md sm:border-0 sm:bg-transparent sm:px-3 sm:py-1.5 sm:text-sm sm:font-medium sm:active:scale-100",Ke&&!v.loading?"hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white":"opacity-50 cursor-not-allowed"),onClick:()=>M(t=>Math.max(1,t-1)),disabled:!Ke||v.loading,children:s("leaderboard.pagination.prev")}),e.jsxs("span",{className:"text-xs font-semibold tabular-nums text-oai-gray-500 dark:text-oai-gray-455 px-2 sm:hidden",children:[P," / ",U||"?"]}),e.jsx("div",{className:"hidden sm:flex items-center gap-1",children:se}),e.jsx("button",{className:d("whitespace-nowrap rounded-xl border border-oai-gray-100 bg-oai-gray-50/50 px-3.5 py-2 text-xs font-medium text-oai-gray-500 dark:border-oai-gray-800/80 dark:bg-white/[0.01] dark:text-oai-gray-400 transition-all duration-200 active:scale-[0.97] sm:rounded-md sm:border-0 sm:bg-transparent sm:px-3 sm:py-1.5 sm:text-sm sm:font-medium sm:active:scale-100",Re&&!v.loading?"hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white":"opacity-50 cursor-not-allowed"),onClick:()=>M(t=>t+1),disabled:!Re||v.loading,children:s("leaderboard.pagination.next")})]})]})]})]})}),e.jsx("footer",{className:"border-t border-oai-gray-200 dark:border-oai-gray-900 py-8 transition-colors duration-200",children:e.jsxs("div",{className:"mx-auto flex max-w-6xl items-center justify-between px-4 sm:px-6 text-sm text-oai-gray-400 dark:text-oai-gray-500",children:[e.jsx("p",{children:s("landing.v2.footer.line")}),e.jsx("a",{href:"https://github.com/mm7894215/TokenTracker",className:"text-oai-gray-400 dark:text-oai-gray-500 hover:text-oai-black dark:hover:text-white transition-colors",target:"_blank",rel:"noopener noreferrer",children:s("landing.v2.nav.github")})]})}),e.jsxs(c.Suspense,{fallback:null,children:[e.jsx(fr,{isOpen:!!ke,userId:ke,period:N,accessToken:C,onClose:Qe}),e.jsx(yr,{isOpen:Xe,onClose:()=>je(!1),communityStats:Le})]})]})}export{Jr as LeaderboardPage};
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/BadgeDetailModal-5FcY9olH.js","assets/__vite-browser-external-CeOnjjgl.js","assets/__vite-browser-external-WKilYZnq.css","assets/react-CgmQzSd0.js","assets/AchievementBadge-BhAc3c3S.js","assets/zap-D0DQz21w.js","assets/flame-BEU-cqaV.js","assets/use-transform-OnxHQlyh.js","assets/use-reduced-motion-DUgAHZln.js","assets/AchievementsSection-T-v65Q1T.js","assets/format-tokens-DJ-Y0jv5.js","assets/DialogTitle-mSFue3N1.js","assets/useScrollLock-Ct5GyoVg.js","assets/store-BLjK5TrP.js"])))=>i.map(i=>d[i]);
import{l as te,a as O,r as h,a5 as se,j as e,c as n,a6 as ie,a7 as oe,a8 as ne,d as c,a9 as le,Q as de,L as ce,R as W,U as me,m as xe,aa as ge,X as pe,k as he,_ as ue,a3 as fe,ab as be}from"./__vite-browser-external-CeOnjjgl.js";import{A as ye,f as ke}from"./provider-display-RBujrp08.js";import{u as ve}from"./useCurrency-BS_xyhhg.js";import{u as G}from"./useTokenFormat-RvsCI_oE.js";import{L as X}from"./LeaderboardAvatar-CRO38fgs.js";import{P as $}from"./ProviderIcon-C8fKhRQt.js";import{H as je,A as Y,s as Ne,c as _e,b as we,t as Ae,h as Se}from"./AchievementBadge-BhAc3c3S.js";import{A as ze}from"./AchievementsSection-T-v65Q1T.js";import{A as B}from"./arrow-up-right-DAWmHSlU.js";import{L as Ce}from"./link-2-Cx8hG5wc.js";import{C as Me}from"./check-DPhmDgw5.js";import{D as Ie,a as Pe,b as De,c as Le,d as Te,e as $e}from"./DialogTitle-mSFue3N1.js";import"./maximize-2-6nkX0TnZ.js";import"./terminal-Dbn_YmPM.js";import"./info-CkFEh5Zu.js";import"./zap-D0DQz21w.js";import"./flame-BEU-cqaV.js";import"./react-CgmQzSd0.js";import"./format-tokens-DJ-Y0jv5.js";import"./use-reduced-motion-DUgAHZln.js";import"./useScrollLock-Ct5GyoVg.js";import"./store-BLjK5TrP.js";const Be=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],Ue=te("code-xml",Be),U="tokentracker_anon_id";let A=null;function R(){try{if(typeof crypto<"u"&&crypto.randomUUID)return crypto.randomUUID()}catch{}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,a=>{const r=Math.random()*16|0;return(a==="x"?r:r&3|8).toString(16)})}function F(){if(A)return A;try{let a=localStorage.getItem(U);return a||(a=R(),localStorage.setItem(U,a)),A=a,a}catch{return A=R(),A}}function K({userId:a}){const{signedIn:r,getAccessToken:i}=O(),[t,s]=h.useState(!1),[l,x]=h.useState(0),[o,g]=h.useState(!1),[f,b]=h.useState(!1),[S,z]=h.useState(!1),[C,D]=h.useState([]),[j,N]=h.useState(!1),M=h.useRef(0),y=h.useCallback(async()=>{if(r)try{const d=await i();if(d)return{accessToken:d,anonId:F()}}catch{}return{anonId:F()}},[r,i]);h.useEffect(()=>{let d=!1;return a?(g(!1),(async()=>{const m=await y();try{const p=await se({userId:a,...m});if(d)return;x(Number(p?.count)||0),s(!!p?.liked),g(!0)}catch{if(d)return;x(0),s(!1),g(!0)}})(),()=>{d=!0}):(g(!1),()=>{d=!0})},[a,y]);const k=()=>{z(!0),setTimeout(()=>z(!1),450),N(!0),setTimeout(()=>N(!1),500);const d=["#ff4757","#ff6b81","#ffa502","#70a1ff","#2ed573","#a29bfe"],m=["circle","heart"],p=[];for(let u=0;u<12;u++){const v=(u*30+Math.random()*20-10)*(Math.PI/180),I=45+Math.random()*45,V=Math.cos(v)*I,Z=Math.sin(v)*I-(10+Math.random()*15),Q=Math.random()*360-180,J=6+Math.random()*8,ee=d[Math.floor(Math.random()*d.length)],ae=m[Math.floor(Math.random()*m.length)],re=++M.current;p.push({id:re,tx:V,ty:Z,rot:Q,size:J,color:ee,shape:ae})}D(u=>[...u,...p]),setTimeout(()=>{D(u=>u.filter(v=>!p.find(I=>I.id===v.id)))},850)},_=async d=>{b(!0);try{const m=await y(),p=await ie({userId:a,action:d,...m});p&&Number.isFinite(Number(p.count))&&x(Number(p.count)),p&&typeof p.liked=="boolean"&&s(p.liked)}catch{s(m=>!m),x(m=>d==="like"?Math.max(0,m-1):m+1)}finally{b(!1)}},w=d=>{d.stopPropagation(),!(!a||!o||f)&&(t?(s(!1),x(m=>Math.max(0,m-1)),_("unlike")):(s(!0),x(m=>m+1),k(),_("like")))};return e.jsxs("div",{className:"relative inline-flex items-center select-none z-10",children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:`
@keyframes tt-like-pop {
0% { transform: scale(1); }
25% { transform: scale(0.75); }
50% { transform: scale(1.35); }
75% { transform: scale(0.9); }
100% { transform: scale(1); }
}
@keyframes tt-particle-fly {
0% {
transform: translate(0, 0) scale(1) rotate(0deg);
opacity: 1;
}
70% {
opacity: 0.8;
}
100% {
transform: translate(var(--tx), var(--ty)) scale(0.2) rotate(var(--rot));
opacity: 0;
}
}
@keyframes tt-num-scroll {
0% { transform: translateY(8px); opacity: 0; }
100% { transform: translateY(0); opacity: 1; }
}
.tt-animate-pop {
animation: tt-like-pop 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
.tt-particle {
position: absolute;
top: 50%;
left: 50%;
margin-top: -6px;
margin-left: -6px;
pointer-events: none;
z-index: 50;
}
.tt-num-anim {
animation: tt-num-scroll 0.25s ease-out forwards;
}
`}}),C.map(d=>e.jsx("span",{className:"tt-particle",style:{"--tx":`${d.tx}px`,"--ty":`${d.ty}px`,"--rot":`${d.rot}deg`,width:`${d.size}px`,height:`${d.size}px`,backgroundColor:d.shape==="circle"?d.color:"transparent",borderRadius:d.shape==="circle"?"50%":"0",animation:"tt-particle-fly 0.8s cubic-bezier(0.1, 0.8, 0.3, 1) forwards"},children:d.shape==="heart"&&e.jsx("svg",{viewBox:"0 0 24 24",width:"100%",height:"100%",fill:d.color,className:"w-full h-full",children:e.jsx("path",{d:"M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"})})},d.id)),e.jsxs("button",{type:"button",onClick:w,disabled:!o||f,"aria-label":t?n("leaderboard.profile.like.aria_unlike"):n("leaderboard.profile.like.aria_like"),className:`group flex items-center justify-center gap-1.5 h-8 min-w-[48px] px-2.5 rounded-full border transition-all duration-300 outline-none focus-visible:ring-2 focus-visible:ring-rose-500/50 disabled:opacity-60 disabled:cursor-default ${t?"bg-rose-50/60 border-rose-200/80 text-rose-500 dark:bg-rose-950/20 dark:border-rose-900/40 dark:text-rose-400 shadow-sm":"bg-white/80 border-oai-gray-200 text-oai-gray-500 hover:border-rose-200 hover:text-rose-500 hover:bg-rose-50/30 dark:bg-oai-gray-950/50 dark:border-white/10 dark:text-oai-gray-400 dark:hover:border-rose-900/50 dark:hover:text-rose-400 dark:hover:bg-rose-950/5"}`,children:[e.jsx("span",{className:S?"tt-animate-pop":"group-active:scale-90 transition-transform duration-100",children:e.jsx(je,{size:14,className:`transition-all duration-300 ${t?"fill-rose-500 text-rose-500 dark:fill-rose-400 dark:text-rose-400":"fill-transparent"}`})}),e.jsx("span",{className:`text-[12px] font-bold font-mono tabular-nums tracking-tight ${t?"text-rose-600 dark:text-rose-400":"text-oai-gray-600 dark:text-oai-gray-400"} ${j?"tt-num-anim":""}`,children:o?l:"·"})]})]})}function Re({badge:a,badgeLabel:r,className:i="",...t}){return e.jsxs("div",{className:`relative inline-flex shrink-0 ${i}`,children:[e.jsx(X,{...t}),a?e.jsx("span",{className:"absolute -bottom-1 -right-1 inline-flex rounded-full ring-2 ring-white dark:ring-oai-gray-950",children:e.jsx(Y,{badgeId:a.id,tier:a.tier,size:"sm",label:r})}):null]})}function Fe({badges:a,isOwn:r=!1,onSelect:i,className:t=""}){const s=Ne((Array.isArray(a)?a:[]).filter(l=>l&&_e.has(l.id))).filter(l=>r||(l.tier||0)>=1);return s.length===0?null:e.jsx("div",{className:`flex flex-wrap items-center pr-2.5 ${t}`,children:s.map((l,x)=>{const o=(l.tier||0)>=1,g=n(we(l.id,"name")),f=o?n(`achievements.tier.${Ae(l.tier)}`):n("achievements.modal.locked");return e.jsx("button",{type:"button",onClick:i?()=>i(l):void 0,title:`${g} · ${f}`,"aria-label":n("achievements.badge.aria",{name:g,tier:f}),style:{zIndex:s.length-x},className:"group relative shrink-0 -mr-2.5 rounded-full transition-transform duration-200 ease-out hover:z-30 hover:-translate-y-1 active:scale-95 focus-visible:z-30 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand/60",children:e.jsx(Y,{badgeId:l.id,tier:l.tier,locked:!o,size:"md",className:"rounded-full ring-2 ring-white transition-shadow duration-200 group-hover:shadow-md dark:ring-oai-gray-950"})},l.id)})})}const He=W.lazy(()=>ue(()=>import("./BadgeDetailModal-5FcY9olH.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])));function Ee(a,r,i){const t=Number(a);return!Number.isFinite(t)||t<0?"—":t>0&&t<.01?`<${r==="USD"?"$":""}0.01`:fe(t,{decimals:2,currency:r,rate:i})}function H(a,r,i){const t=Number(a);if(!Number.isFinite(t)||t<0)return"—";if(t<1e3)return Ee(t,r,i);const s=r==="USD"?t:t*(i||1);return`${r==="USD"?"$":""}${he(s,{decimals:1})}`}function Oe(a){const r=Array.isArray(a)?a:[];if(r.length===0)return null;const i=r.map(s=>({day:s.date,total_tokens:s.total_tokens,models:s.models||null})),t=r[r.length-1]?.date;return ge({dailyRows:i,weeks:52,to:t})}const We=`
@keyframes tt-shimmer {
100% { transform: translateX(100%); }
}
.tt-shimmer-bar {
position: relative;
overflow: hidden;
}
.tt-shimmer-bar::after {
position: absolute;
top: 0; right: 0; bottom: 0; left: 0;
transform: translateX(-100%);
background-image: linear-gradient(
90deg,
rgba(0, 0, 0, 0) 0%,
rgba(0, 0, 0, 0.02) 20%,
rgba(0, 0, 0, 0.06) 60%,
rgba(0, 0, 0, 0) 100%
);
animation: tt-shimmer 1.6s infinite;
content: '';
}
.dark .tt-shimmer-bar::after {
background-image: linear-gradient(
90deg,
rgba(255, 255, 255, 0) 0%,
rgba(255, 255, 255, 0.02) 20%,
rgba(255, 255, 255, 0.06) 60%,
rgba(255, 255, 255, 0) 100%
);
}
`;function Ge({variant:a="modal"}){const r="rounded bg-oai-gray-200/50 dark:bg-oai-gray-800/40 tt-shimmer-bar",i=a==="page";return e.jsxs("div",{children:[e.jsx("style",{dangerouslySetInnerHTML:{__html:We}}),i?e.jsxs("div",{className:"flex items-start gap-5 px-6 sm:px-8 pt-8 pb-7 animate-fade-in",children:[e.jsx("div",{className:"h-[68px] w-[68px] rounded-full bg-oai-gray-200/50 dark:bg-oai-gray-800/40 tt-shimmer-bar shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0 flex items-start justify-between gap-4 pt-0.5",children:[e.jsxs("div",{className:"min-w-0 space-y-2.5",children:[e.jsx("div",{className:c(r,"h-7 w-48")}),e.jsx("div",{className:c(r,"h-3.5 w-32")})]}),e.jsxs("div",{className:"shrink-0 space-y-1.5 flex flex-col items-end",children:[e.jsx("div",{className:c(r,"h-2.5 w-8")}),e.jsx("div",{className:c(r,"h-7 w-12")})]})]})]}):e.jsxs("div",{className:"flex items-start gap-4 px-6 pt-6 pb-5 border-b border-oai-gray-200/80 dark:border-oai-gray-800/60 animate-fade-in",children:[e.jsx("div",{className:"h-14 w-14 rounded-full bg-oai-gray-200/50 dark:bg-oai-gray-800/40 tt-shimmer-bar shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0 space-y-2 pt-1",children:[e.jsx("div",{className:c(r,"h-4 w-40")}),e.jsx("div",{className:c(r,"h-3 w-56")})]}),e.jsx("div",{className:c(r,"h-4 w-4 shrink-0 mt-1")})]}),e.jsxs("div",{className:c("space-y-6",i?"px-6 sm:px-8 pt-6 pb-8 border-t border-oai-gray-200/80 dark:border-oai-gray-800/60":"px-6 py-5"),children:[e.jsx("div",{className:"grid grid-cols-4 gap-x-6 gap-y-4",children:Array.from({length:4}).map((t,s)=>e.jsxs("div",{children:[e.jsx("div",{className:c(r,"h-6 w-20")}),e.jsx("div",{className:c(r,"mt-2 h-3 w-14")})]},s))}),e.jsx("div",{className:"space-y-3 border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:Array.from({length:3}).map((t,s)=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:c(r,"h-3 w-24")}),e.jsx("div",{className:c(r,"h-3 w-44")})]},s))}),e.jsxs("div",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[e.jsx("div",{className:c(r,"h-3 w-44 mb-4")}),e.jsx("div",{className:"grid grid-cols-[repeat(52,1fr)] gap-[2px]",children:Array.from({length:364}).map((t,s)=>e.jsx("div",{className:"aspect-square rounded-[2px] bg-oai-gray-200/40 dark:bg-oai-gray-800/30 tt-shimmer-bar"},s))})]}),e.jsxs("div",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[e.jsx("div",{className:c(r,"h-3 w-28 mb-3")}),e.jsx("div",{className:"space-y-2.5",children:Array.from({length:5}).map((t,s)=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:c(r,"h-4 w-4")}),e.jsx("div",{className:c(r,"h-3 w-16")}),e.jsx("div",{className:c(r,"h-[3px] flex-1")}),e.jsx("div",{className:c(r,"h-3 w-12")})]},s))})]})]})]})}function q(a){if(!a)return null;const r=String(a).match(/github\.com\/([A-Za-z0-9][A-Za-z0-9-]{0,38})/i);return r?r[1]:null}function L({children:a}){return e.jsx("h3",{className:"text-[11px] uppercase tracking-[0.08em] text-oai-gray-500 dark:text-oai-gray-400 mb-3",children:a})}function P({value:a,label:r,title:i}){return e.jsxs("div",{children:[e.jsx("div",{title:i,className:"text-2xl font-black tabular-nums tracking-tight leading-none text-oai-black dark:text-white",style:{fontFamily:'"DIN Alternate-Bold", "DIN Alternate", "DIN Condensed-Bold", "Impact", -apple-system, sans-serif',fontWeight:900},children:a}),e.jsx("div",{className:"mt-1.5 text-[11px] text-oai-gray-500 dark:text-oai-gray-400",children:r})]})}function T({label:a,children:r}){return e.jsxs("div",{className:"flex items-baseline gap-3 text-sm",children:[e.jsx("dt",{className:"shrink-0 w-28 whitespace-nowrap text-oai-gray-500 dark:text-oai-gray-400",children:a}),e.jsx("dd",{className:"min-w-0 flex-1 text-oai-gray-900 dark:text-oai-gray-100 tabular-nums truncate flex items-baseline gap-2 flex-wrap",children:r})]})}function Xe({user:a,onClose:r}){const i=q(a?.github_url);return e.jsxs("div",{className:"flex items-center gap-4 px-6 pt-6 pb-5 border-b border-oai-gray-200/80 dark:border-oai-gray-800/60",children:[e.jsx(X,{avatarUrl:a?.avatar_url,displayName:a?.display_name||"",seed:a?.user_id||a?.display_name,size:"lg",className:"shrink-0 ring-1 ring-oai-gray-200 dark:ring-oai-gray-800"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"truncate text-base font-semibold text-oai-black dark:text-white",children:a?.display_name||"—"}),a?.rank?e.jsx("span",{className:c("shrink-0 inline-flex items-center px-2 py-0.5 rounded text-xs font-bold font-mono uppercase tracking-wider border shadow-sm",a.rank===1&&"bg-amber-500/10 text-amber-600 border-amber-500/20 dark:text-amber-400 dark:bg-amber-400/10",a.rank===2&&"bg-slate-500/10 text-slate-600 border-slate-500/20 dark:text-slate-400 dark:bg-slate-400/10",a.rank===3&&"bg-orange-500/10 text-orange-700 border-orange-500/20 dark:text-orange-400 dark:bg-orange-400/10",a.rank>3&&"bg-oai-gray-100 dark:bg-oai-gray-900/60 text-oai-gray-500 dark:text-oai-gray-400 border-oai-gray-200/60 dark:border-oai-gray-800"),children:n("leaderboard.profile_modal.rank",{rank:a.rank})}):null]}),i&&e.jsxs("a",{href:a.github_url,target:"_blank",rel:"noopener noreferrer",className:"mt-1 inline-flex items-center gap-1 text-[12px] text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-800 dark:hover:text-oai-gray-200 transition-colors",children:[e.jsx($,{provider:"GITHUB",size:11}),e.jsxs("span",{children:["@",i]})]})]}),a?.user_id&&e.jsx("div",{className:"shrink-0 flex items-center justify-center",children:e.jsx(K,{userId:a.user_id})}),r&&e.jsx("button",{type:"button",onClick:r,className:"shrink-0 -mr-1 -mt-1 flex h-8 w-8 items-center justify-center rounded-md text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-900 dark:hover:text-white 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 group","aria-label":n("leaderboard.profile_modal.close"),children:e.jsx(pe,{size:16,strokeWidth:2,"aria-hidden":!0,className:"transition-transform duration-200 group-hover:rotate-90 group-active:scale-90"})})]})}function Ye({user:a,topBadge:r}){const i=q(a?.github_url),t=Number(a?.rank)||0,s=t===1?"text-amber-500 dark:text-amber-400":t===2?"text-slate-500 dark:text-slate-300":t===3?"text-orange-600 dark:text-orange-400":"text-oai-gray-400 dark:text-oai-gray-500";return e.jsxs("div",{className:"flex items-center gap-5 px-6 sm:px-8 pt-8 pb-7",children:[e.jsx(Re,{badge:r,avatarUrl:a?.avatar_url,displayName:a?.display_name||"",seed:a?.user_id||a?.display_name,size:"xl",className:"shrink-0 ring-1 ring-oai-gray-200 dark:ring-oai-gray-800 rounded-full"}),e.jsxs("div",{className:"min-w-0 flex-1 flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsx("h1",{className:"truncate text-2xl sm:text-[28px] font-semibold tracking-tight leading-tight text-oai-black dark:text-white",children:a?.display_name||"—"}),a?.user_id&&e.jsx(K,{userId:a.user_id})]}),i?e.jsxs("a",{href:a.github_url,target:"_blank",rel:"noopener noreferrer",className:"mt-2 inline-flex items-center gap-1.5 text-sm text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-900 dark:hover:text-white transition-colors",children:[e.jsx($,{provider:"GITHUB",size:13}),e.jsxs("span",{children:["@",i]})]}):null]}),t?e.jsxs("div",{className:"shrink-0 text-right leading-none",children:[e.jsx("div",{className:"text-[10px] font-medium uppercase tracking-[0.14em] text-oai-gray-400 dark:text-oai-gray-500",children:n("leaderboard.profile.hero.rank_label")}),e.jsx("div",{className:c("mt-1.5 text-3xl font-black tabular-nums tracking-tight",s),children:n("leaderboard.profile_modal.rank",{rank:t})})]}):null]})]})}function Ke({data:a}){const{formatTokens:r,formatTokensTooltip:i}=G(),t=Array.isArray(a)?a:[];return t.length===0?e.jsx("p",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400",children:n("leaderboard.profile_modal.providers.none")}):e.jsx("ul",{className:"space-y-2",children:t.map(s=>{const l=Math.max(0,Math.min(1,Number(s?.percent)||0));return e.jsxs("li",{className:"flex items-center gap-3 text-xs",children:[e.jsx("span",{className:"shrink-0 inline-flex items-center justify-center w-4 h-4",children:e.jsx($,{provider:String(s.source).toUpperCase(),size:14})}),e.jsx("span",{className:"w-20 shrink-0 text-oai-gray-700 dark:text-oai-gray-300",children:ke(s.source)}),e.jsx("span",{className:"flex-1 h-[3px] rounded-full bg-oai-gray-200/60 dark:bg-oai-gray-800/80 overflow-hidden",children:e.jsx("span",{className:"block h-full bg-oai-brand-500 dark:bg-oai-brand-400",style:{width:`${(l*100).toFixed(1)}%`}})}),e.jsx("span",{title:i(s.total_tokens),className:"shrink-0 w-14 text-right tabular-nums text-oai-gray-700 dark:text-oai-gray-300",children:r(s.total_tokens)}),e.jsxs("span",{className:"shrink-0 w-10 text-right tabular-nums text-oai-gray-500 dark:text-oai-gray-400",children:[(l*100).toFixed(0),"%"]})]},s.source)})})}function E({icon:a,label:r,value:i}){const[t,s]=h.useState(!1),l=async()=>{await be(i)&&(s(!0),setTimeout(()=>s(!1),1600))};return e.jsxs("button",{type:"button",onClick:l,className:c("inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1 text-xs font-medium transition-colors",t?"border-emerald-500/30 text-emerald-600 dark:text-emerald-400 bg-emerald-500/[0.06]":"border-oai-gray-200 dark:border-oai-gray-800 text-oai-gray-600 dark:text-oai-gray-300 hover:text-oai-gray-900 dark:hover:text-oai-gray-100 hover:border-oai-gray-300 dark:hover:border-oai-gray-700 hover:bg-oai-gray-50 dark:hover:bg-oai-gray-900/40"),children:[t?e.jsx(Me,{size:13,strokeWidth:2,"aria-hidden":!0}):e.jsx(a,{size:13,strokeWidth:2,"aria-hidden":!0}),e.jsx("span",{children:t?n("leaderboard.profile_modal.badge.copied"):r})]})}function qe({data:a,currency:r,rate:i,onClose:t,variant:s="modal"}){const{formatTokens:l,formatTokensTooltip:x}=G(),{user:o,totals:g,streak:f,best_day:b,models:S,by_provider:z,heatmap:C,period:D}=a,j=s==="page",N=h.useMemo(()=>Oe(C),[C]),M=S?.favorite?.model_name,y=Number(S?.count)||0,k=Array.isArray(a.badges)?a.badges:[],[_,w]=h.useState(null),d=O(),m=!!(d?.user?.id&&o?.user_id&&d.user.id===o.user_id),p=o?.user_id?`https://www.tokentracker.cc/u/${o.user_id}`:null,u=o?.user_id?`[![My AI coding usage](${le()}/functions/tokentracker-embed-svg?user_id=${o.user_id}&theme=dark)](${p}?ref=readme)`:null;return e.jsxs(e.Fragment,{children:[j?e.jsx(Ye,{user:o,topBadge:Se(k)}):e.jsx(Xe,{user:o,onClose:t}),e.jsxs("div",{className:c("space-y-6",j?"px-6 sm:px-8 pt-6 pb-8 border-t border-oai-gray-200/80 dark:border-oai-gray-800/60":"flex-1 min-h-0 overflow-y-auto oai-scrollbar px-6 py-5"),children:[e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-x-6 gap-y-4",children:[e.jsx(P,{value:l(g?.total_tokens),title:x(g?.total_tokens),label:n("leaderboard.profile_modal.stat.total_tokens")}),e.jsx(P,{value:H(g?.estimated_cost_usd,r,i),label:n("leaderboard.profile_modal.stat.total_cost")}),e.jsx(P,{value:String(g?.active_days??0),label:n("leaderboard.profile_modal.stat.active_days")}),e.jsx(P,{value:H(g?.avg_per_day_usd,r,i),label:n("leaderboard.profile_modal.stat.avg_per_day")})]}),e.jsxs("dl",{className:"space-y-2 border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[e.jsxs(T,{label:n("leaderboard.profile_modal.streak.current"),children:[e.jsx("span",{className:"font-mono text-xs tracking-tight bg-oai-gray-100/60 dark:bg-oai-gray-900/50 px-1.5 py-0.5 rounded border border-oai-gray-200/30 dark:border-oai-gray-800/30",children:n("leaderboard.profile_modal.streak.days",{count:f?.current_days??0})}),e.jsxs("span",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 font-mono",children:["(max ",f?.longest_days??0,")"]})]}),e.jsx(T,{label:n("leaderboard.profile_modal.best_day.title"),children:b?e.jsxs(e.Fragment,{children:[e.jsx("span",{title:x(b.total_tokens),className:"font-mono text-xs tracking-tight bg-oai-gray-100/60 dark:bg-oai-gray-900/50 px-1.5 py-0.5 rounded border border-oai-gray-200/30 dark:border-oai-gray-800/30",children:l(b.total_tokens)}),e.jsxs("span",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 font-mono",children:["on ",b.date]})]}):e.jsx("span",{className:"text-xs text-oai-gray-400 dark:text-oai-gray-500 font-mono",children:n("leaderboard.profile_modal.best_day.none")})}),e.jsx(T,{label:n("leaderboard.profile_modal.models.favorite"),children:M?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-mono text-xs tracking-tight bg-oai-gray-100/60 dark:bg-oai-gray-900/50 px-1.5 py-0.5 rounded border border-oai-gray-200/30 dark:border-oai-gray-800/30 truncate max-w-[200px] inline-block align-bottom",children:M}),y>1&&e.jsx("span",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 font-mono",children:n("leaderboard.profile_modal.models.count",{count:y})})]}):e.jsx("span",{className:"text-xs text-oai-gray-400 dark:text-oai-gray-500 font-mono",children:n("leaderboard.profile_modal.models.none")})})]}),(m||k.some(v=>(v?.tier||0)>=1))&&e.jsxs("section",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[e.jsx(L,{children:n("achievements.section.title")}),j?e.jsx(ze,{achievements:k,isOwn:m&&!!a.badges_include_unearned,scope:"cloud",onSelect:w}):e.jsx(Fe,{badges:k,isOwn:m&&!!a.badges_include_unearned,onSelect:w})]}),N&&e.jsxs("section",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[e.jsx(L,{children:n("leaderboard.profile_modal.heatmap.title")}),e.jsx("div",{className:"min-w-0",children:e.jsx(ye,{heatmap:N,hideLegend:!0,embedded:!0})})]}),e.jsxs("section",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-5",children:[e.jsx(L,{children:n("leaderboard.profile_modal.providers.title")}),e.jsx(Ke,{data:z})]}),o?.user_id&&(t||m)&&e.jsxs("div",{className:"border-t border-oai-gray-200/70 dark:border-oai-gray-800/60 pt-4 flex flex-wrap items-center justify-between gap-x-4 gap-y-3",children:[t&&(de()?e.jsxs("a",{href:p,target:"_blank",rel:"noopener noreferrer",onClick:t,className:"group inline-flex items-center gap-1 text-xs font-medium text-oai-gray-700 hover:text-oai-gray-950 dark:text-oai-gray-300 dark:hover:text-oai-white transition-colors",children:[e.jsx("span",{children:n("leaderboard.profile_modal.view_full")}),e.jsx(B,{size:13,strokeWidth:2,"aria-hidden":!0,className:"transition-transform duration-200 group-hover:translate-x-0.5 group-hover:-translate-y-0.5"})]}):e.jsxs(ce,{to:`/u/${o.user_id}`,onClick:t,className:"group inline-flex items-center gap-1 text-xs font-medium text-oai-gray-700 hover:text-oai-gray-950 dark:text-oai-gray-300 dark:hover:text-oai-white transition-colors",children:[e.jsx("span",{children:n("leaderboard.profile_modal.view_full")}),e.jsx(B,{size:13,strokeWidth:2,"aria-hidden":!0,className:"transition-transform duration-200 group-hover:translate-x-0.5 group-hover:-translate-y-0.5"})]})),m&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(E,{icon:Ce,label:n("leaderboard.profile_modal.badge.copy_url"),value:p}),e.jsx(E,{icon:Ue,label:n("leaderboard.profile_modal.badge.copy"),value:u})]})]})]}),_&&e.jsx(W.Suspense,{fallback:null,children:e.jsx(He,{badge:_,onClose:()=>w(null)})})]})}function Ve({userId:a,period:r,accessToken:i,enabled:t=!0}){const[s,l]=h.useState({loading:!1,error:null,data:null});return h.useEffect(()=>{if(!t||!a)return;let x=!0;return l({loading:!0,error:null,data:null}),(async()=>{try{const o=i?await oe(i):null;if(!x)return;const g=await ne({accessToken:o,userId:a,period:r||"week"});if(!x)return;l({loading:!1,error:null,data:g})}catch(o){if(!x)return;o?.status===404?l({loading:!1,error:null,data:null}):l({loading:!1,error:o?.message||String(o),data:null})}})(),()=>{x=!1}},[t,a,r,i]),s}function ya({isOpen:a,onClose:r,userId:i,period:t,accessToken:s}){const{currency:l,rate:x}=ve(),o=Ve({userId:i,period:t,accessToken:s,enabled:a});return e.jsx(Ie,{open:a,onOpenChange:g=>{g||r?.()},children:e.jsxs(Pe,{children:[e.jsx(De,{className:"cost-modal-backdrop"}),e.jsx(Le,{className:"fixed inset-0 z-[101] flex items-center justify-center p-4",children:e.jsxs(Te,{className:c("cost-modal-popup","relative w-full max-w-[540px] 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","dark:border-t dark:border-white/[0.08]"),children:[e.jsx($e,{render:e.jsx("h2",{className:"sr-only"}),children:o.data?.user?.display_name||n("leaderboard.profile_modal.loading")}),o.loading&&e.jsx(Ge,{}),!o.loading&&o.error&&e.jsx("div",{className:"flex-1 flex items-center justify-center min-h-[280px]",children:e.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:n("leaderboard.profile_modal.error")})}),!o.loading&&!o.error&&!o.data&&e.jsx("div",{className:"flex-1 flex items-center justify-center min-h-[280px]",children:e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:n("leaderboard.profile_modal.empty")})}),!o.loading&&!o.error&&o.data&&e.jsx(me,{mode:xe.COMPACT,children:e.jsx(qe,{data:o.data,currency:l,rate:x,onClose:r})})]})})]})})}export{ya as LeaderboardProfileModal,qe as ProfileContent,Ge as ProfileSkeleton,Ve as useLeaderboardProfileData};
import{r as _,j as p,Y as xe,u as ge,a as ve,Q as be,L as Tt,Z as we,c as Y,$ as ye}from"./__vite-browser-external-CeOnjjgl.js";import{u as ke}from"./useCurrency-BS_xyhhg.js";import{H as Me}from"./HeaderGithubStar-8sRKKeCh.js";import{useLeaderboardProfileData as _e,ProfileSkeleton as Ce,ProfileContent as Se}from"./LeaderboardProfileModal-DwpalEE6.js";import{D as Te}from"./download-CH_YcQ58.js";import"./provider-display-RBujrp08.js";import"./useTokenFormat-RvsCI_oE.js";import"./maximize-2-6nkX0TnZ.js";import"./terminal-Dbn_YmPM.js";import"./info-CkFEh5Zu.js";import"./LeaderboardAvatar-CRO38fgs.js";import"./ProviderIcon-C8fKhRQt.js";import"./AchievementBadge-BhAc3c3S.js";import"./zap-D0DQz21w.js";import"./flame-BEU-cqaV.js";import"./AchievementsSection-T-v65Q1T.js";import"./react-CgmQzSd0.js";import"./format-tokens-DJ-Y0jv5.js";import"./use-reduced-motion-DUgAHZln.js";import"./arrow-up-right-DAWmHSlU.js";import"./link-2-Cx8hG5wc.js";import"./check-DPhmDgw5.js";import"./DialogTitle-mSFue3N1.js";import"./useScrollLock-Ct5GyoVg.js";import"./store-BLjK5TrP.js";function $e(t){let e=t.replace("#","");return e.length===3&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),[parseInt(e.slice(0,2),16)/255,parseInt(e.slice(2,4),16)/255,parseInt(e.slice(4,6),16)/255]}function Re(t,e,a){t/=255,e/=255,a/=255;const r=Math.max(t,e,a),o=Math.min(t,e,a),n=r-o;let i=0;const u=r===0?0:n/r;return n!==0&&(r===t?i=((e-a)/n+6)%6:r===e?i=(a-t)/n+2:i=(t-e)/n+4,i/=6),[i,u,r]}function Fe(t,e,a){const r=Math.floor(t*6),o=t*6-r,n=a*(1-e),i=a*(1-o*e),u=a*(1-(1-o)*e);let l=0,c=0,h=0;switch(r%6){case 0:l=a,c=u,h=n;break;case 1:l=i,c=a,h=n;break;case 2:l=n,c=a,h=u;break;case 3:l=n,c=i,h=a;break;case 4:l=u,c=n,h=a;break;case 5:l=a,c=n,h=i;break}return[Math.round(l*255),Math.round(c*255),Math.round(h*255)]}const Ie=66,Oe=66,Pe=1500,Ae=1,$t=16,je=16,Ee=8,Le=96,Ne=2,We={name:"chromatic",modes:{dark:{colors:["#000000","#aae8ff","#c5fe9e","#f7888d","#0d0d0d","#fffdc3","#007cff"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:1.6,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.26,vigOpacity:.6,shaderOpacity:1},light:{colors:["#ffffff","#ffffff","#ffffff","#ffb3b3","#adadad","#f5ff70","#007cff"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.24,vigOpacity:.16,shaderOpacity:1}}},Be={name:"silver",modes:{dark:{colors:["#000000","#dedede","#747270","#e5e5e5","#0d0d0d","#ffffff","#e6e6e6"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.26,vigOpacity:.6,shaderOpacity:.88},light:{colors:["#f6f6f6","#ffffff","#ffffff","#f7f7f7","#c9c9c9","#d0d0d0","#d1d1d1"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.2,vigOpacity:.26,shaderOpacity:1}}},ze={name:"gold",modes:{dark:{colors:["#000000","#ffffff","#ffffff","#f7d488","#0d0d0d","#fffdc3","#ffffff"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.26,vigOpacity:.6,shaderOpacity:.92},light:{colors:["#fff8e1","#fffbe0","#ffffff","#fff6d6","#d2c7a7","#dcd2bc","#f9f7e5"],alphas:[1,1,1,1,1,1,1],direction:80,speed:1.2,intensity:2,scale:2.5,softness:.18,distortion:.3,complexity:.68,shape:1,blur:1,vignette:.22,vigOpacity:.24,shaderOpacity:1}}},Xt={chromatic:We,silver:Be,gold:ze},He=`
attribute vec2 a_position;
void main() { gl_Position = vec4(a_position, 0.0, 1.0); }
`,Ge=`
precision highp float;
uniform vec2 u_resolution;
uniform float u_time;
uniform vec3 u_color1, u_color2, u_color3, u_color4, u_color5, u_color6, u_color7;
uniform float u_alpha1, u_alpha2, u_alpha3, u_alpha4, u_alpha5, u_alpha6, u_alpha7;
uniform float u_intensity, u_scale, u_direction;
uniform float u_softness, u_distortion, u_complexity, u_shape;
uniform float u_vignette, u_vigOpacity, u_blur, u_shaderOpacity;
vec3 mod289(vec3 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }
vec2 mod289v2(vec2 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }
vec3 permute(vec3 x) { return mod289((x * 34.0 + 1.0) * x); }
float snoise(vec2 v) {
const vec4 C = vec4(0.211324865405187, 0.366025403784439,
-0.577350269189626, 0.024390243902439);
vec2 i = floor(v + dot(v, C.yy));
vec2 x0 = v - i + dot(i, C.xx);
vec2 i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);
vec4 x12 = x0.xyxy + C.xxzz;
x12.xy -= i1;
i = mod289v2(i);
vec3 p = permute(permute(i.y + vec3(0.0, i1.y, 1.0)) + i.x + vec3(0.0, i1.x, 1.0));
vec3 m = max(0.5 - vec3(dot(x0, x0), dot(x12.xy, x12.xy), dot(x12.zw, x12.zw)), 0.0);
m = m * m; m = m * m;
vec3 x_ = 2.0 * fract(p * C.www) - 1.0;
vec3 h = abs(x_) - 0.5;
vec3 ox = floor(x_ + 0.5);
vec3 a0 = x_ - ox;
m *= 1.79284291400159 - 0.85373472095314 * (a0 * a0 + h * h);
vec3 g;
g.x = a0.x * x0.x + h.x * x0.y;
g.yz = a0.yz * x12.xz + h.yz * x12.yw;
return 130.0 * dot(m, g);
}
float fbm(vec2 p, float oct) {
float val = 0.0, amp = 0.5;
int n = int(oct);
for (int i = 0; i < 7; i++) {
if (i >= n) break;
val += amp * snoise(p);
p *= 2.0;
amp *= 0.5;
}
return val;
}
float nfbm(vec2 p) { return fbm(p, 3.0 + u_complexity * 4.0); }
/* 5-stop palette used by effect 1 (Plasma) — direct port of \`palette\` from
* the canonical engine. Stops at t = 0, 0.25, 0.5, 0.75, 1.0. */
vec3 palette(float t) {
t = clamp(t, 0.0, 1.0);
t = t * t * (3.0 - 2.0 * t);
float k = 64.0;
float w1 = u_alpha1 * exp(-k * t * t);
float w2 = u_alpha2 * exp(-k * (t - 0.25) * (t - 0.25));
float w3 = u_alpha3 * exp(-k * (t - 0.5) * (t - 0.5));
float w4 = u_alpha4 * exp(-k * (t - 0.75) * (t - 0.75));
float w5 = u_alpha5 * exp(-k * (t - 1.0) * (t - 1.0));
float total = w1 + w2 + w3 + w4 + w5 + 0.0001;
return (u_color1 * w1 + u_color2 * w2 + u_color3 * w3 +
u_color4 * w4 + u_color5 * w5) / total;
}
/* Per-pixel alpha that re-introduces transparency when the user dials any
* palette stop's alpha below 1. Same \`paletteAlpha\` from the canonical
* engine. With every preset shipping all-1 alphas, this returns ~1 for every
* pixel — but mirroring it keeps custom-preset behaviour identical. */
float paletteAlpha(float t) {
t = clamp(t, 0.0, 1.0);
t = t * t * (3.0 - 2.0 * t);
float k = 64.0;
float w1 = u_alpha1 * exp(-k * t * t);
float w2 = u_alpha2 * exp(-k * (t - 0.25) * (t - 0.25));
float w3 = u_alpha3 * exp(-k * (t - 0.5) * (t - 0.5));
float w4 = u_alpha4 * exp(-k * (t - 0.75) * (t - 0.75));
float w5 = u_alpha5 * exp(-k * (t - 1.0) * (t - 1.0));
float totalW = w1 + w2 + w3 + w4 + w5 + 0.0001;
float rawW = exp(-k * t * t)
+ exp(-k * (t - 0.25) * (t - 0.25))
+ exp(-k * (t - 0.5) * (t - 0.5))
+ exp(-k * (t - 0.75) * (t - 0.75))
+ exp(-k * (t - 1.0) * (t - 1.0))
+ 0.0001;
return totalW / rawW;
}
vec2 warp(vec2 p, float t) {
float str = u_distortion * 2.0;
return vec2(
nfbm(p + vec2(t * 0.1, 0.0)),
nfbm(p + vec2(0.0, t * 0.12) + 5.0)
) * str;
}
/* Plasma: four sine bands warped by an FBM field, mapped through the
* 5-stop palette. Identical to effect 1 in the canonical engine. */
vec3 computeEffect(vec2 uv, float aspect, float t, float dist, float cpx) {
vec2 p = (uv - 0.5) * u_scale;
p.x *= aspect;
p += vec2(cos(u_direction), sin(u_direction)) * t * 0.15;
float freq = 3.0 + cpx * 8.0;
float val = 0.0;
val += sin(p.x * freq + t);
val += sin(p.y * freq + t * 1.3);
val += sin((p.x + p.y) * freq * 0.7 + t * 0.7);
val += sin(length(p) * freq * 0.8 - t * 1.5);
vec2 w = warp(p, t);
val += (w.x + w.y) * dist;
val = val * 0.2 * u_intensity + 0.5;
return palette(clamp(val, 0.0, 1.0));
}
void main() {
vec2 uv = gl_FragCoord.xy / u_resolution;
float aspect = u_resolution.x / u_resolution.y;
float t = u_time; // JS already multiplied u_time by preset.speed.
float dist = u_distortion;
float cpx = u_complexity;
/* 5-tap cross blur (center + cardinal offsets). The chromatic/silver/gold
* presets all ship with blur=1 so this path is always active. 5 taps
* instead of the canonical engine's 9 saves ~44% fragment work; the
* perceptual difference is nil because the output is already soft from
* the plasma's low spatial frequency and CSS blur on reflections. */
vec3 col;
if (u_blur < 0.01) {
col = computeEffect(uv, aspect, t, dist, cpx);
} else {
float r = u_blur * 0.02;
col = computeEffect(uv, aspect, t, dist, cpx) * 0.4;
col += computeEffect(uv + vec2( r, 0.0), aspect, t, dist, cpx) * 0.15;
col += computeEffect(uv + vec2(-r, 0.0), aspect, t, dist, cpx) * 0.15;
col += computeEffect(uv + vec2(0.0, r), aspect, t, dist, cpx) * 0.15;
col += computeEffect(uv + vec2(0.0, -r), aspect, t, dist, cpx) * 0.15;
}
/* Gamma punch — adds the contrast pop that defines the chromatic
* highlights. From the canonical engine: \`col = pow(col, vec3(1.3))\`. */
col = pow(col, vec3(1.3));
/* Vignette — soft edge darkening so corners read as recessed. The 40-px
* scale at the bottom of the formula is hard-coded in the canonical
* engine; we keep it for visual parity. */
float edgeDist = min(min(uv.x, 1.0 - uv.x), min(uv.y, 1.0 - uv.y));
float vigPx = 40.0 / min(u_resolution.x, u_resolution.y);
float vigRange = vigPx * (1.0 + u_vignette * 3.0);
float vig = edgeDist * edgeDist / (vigRange * vigRange);
vig = smoothstep(0.0, 1.0, vig);
col *= mix(1.0, vig, u_vignette * u_vigOpacity);
/* Per-pixel alpha. With all-1 alphas the formula collapses to ~1 but the
* computation matches the canonical engine so custom presets behave the
* same. */
float colorAlpha = (u_alpha1 + u_alpha2 + u_alpha3 + u_alpha4 + u_alpha5) / 5.0;
if (colorAlpha < 0.999) {
vec3 c1d = col - u_color1, c2d = col - u_color2, c3d = col - u_color3,
c4d = col - u_color4, c5d = col - u_color5;
float prox1 = exp(-8.0 * dot(c1d, c1d));
float prox2 = exp(-8.0 * dot(c2d, c2d));
float prox3 = exp(-8.0 * dot(c3d, c3d));
float prox4 = exp(-8.0 * dot(c4d, c4d));
float prox5 = exp(-8.0 * dot(c5d, c5d));
float pTotal = prox1 + prox2 + prox3 + prox4 + prox5 + 0.0001;
colorAlpha = (prox1 * u_alpha1 + prox2 * u_alpha2 + prox3 * u_alpha3 +
prox4 * u_alpha4 + prox5 * u_alpha5) / pTotal;
}
float alpha = colorAlpha;
/* Touch the unused-at-effect-1 uniforms so GL drivers that complain about
* declared-but-unread uniforms (some Mali / Adreno builds do) keep them
* live. The contribution is provably zero. */
alpha += 0.0 * (u_softness + u_shape +
u_alpha6 + u_alpha7 +
u_color6.x + u_color7.x);
gl_FragColor = vec4(col, alpha * u_shaderOpacity);
}
`;function Rt(t,e,a){const r=t.createShader(e);if(!r)throw new Error("metal-fx: gl.createShader returned null");if(t.shaderSource(r,a),t.compileShader(r),!t.getShaderParameter(r,t.COMPILE_STATUS)){const o=t.getShaderInfoLog(r);throw t.deleteShader(r),new Error(`metal-fx: shader compile failed: ${o??"(no info log)"}`)}return r}function De(t,e,a){const r=t.createProgram();if(!r)throw new Error("metal-fx: gl.createProgram returned null");if(t.attachShader(r,e),t.attachShader(r,a),t.linkProgram(r),!t.getProgramParameter(r,t.LINK_STATUS)){const o=t.getProgramInfoLog(r);throw t.deleteProgram(r),new Error(`metal-fx: program link failed: ${o??"(no info log)"}`)}return r}const Yt=140,Zt=40,Kt=1.6,Jt=1.3;let s=null,bt=null;function Ue(t){bt=t}const qe=["u_resolution","u_time","u_color1","u_color2","u_color3","u_color4","u_color5","u_color6","u_color7","u_alpha1","u_alpha2","u_alpha3","u_alpha4","u_alpha5","u_alpha6","u_alpha7","u_intensity","u_scale","u_direction","u_softness","u_distortion","u_complexity","u_shape","u_vignette","u_vigOpacity","u_blur","u_shaderOpacity"];function Ft(t){t.enable(t.BLEND),t.blendFunc(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA);const e=Rt(t,t.VERTEX_SHADER,He),a=Rt(t,t.FRAGMENT_SHADER,Ge),r=De(t,e,a);t.useProgram(r);const o=t.createBuffer();if(!o)throw new Error("metal-fx: gl.createBuffer returned null");t.bindBuffer(t.ARRAY_BUFFER,o),t.bufferData(t.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]),t.STATIC_DRAW);const n=t.getAttribLocation(r,"a_position");t.enableVertexAttribArray(n),t.vertexAttribPointer(n,2,t.FLOAT,!1,0,0);const i={};for(const u of qe)i[u]=t.getUniformLocation(r,u);return{program:r,buffer:o,uniforms:i}}function te(){if(s)return s;const t=Math.min(Ne,typeof window<"u"&&window.devicePixelRatio||1),e=Math.round(Le*t),a=typeof OffscreenCanvas<"u";let r,o;if(a)r=new OffscreenCanvas(e,e),o=r.getContext("webgl",{alpha:!0,premultipliedAlpha:!1,antialias:!1});else{const h=document.createElement("canvas");h.width=e,h.height=e,o=h.getContext("webgl",{alpha:!0,premultipliedAlpha:!1,antialias:!1,preserveDrawingBuffer:!0})??h.getContext("experimental-webgl"),r=h}if(!o)throw new Error("metal-fx: WebGL not supported");const{program:n,buffer:i,uniforms:u}=Ft(o),l=h=>{h.preventDefault(),s&&(s.contextLost=!0)},c=()=>{if(!s)return;const h=Ft(s.gl);s.program=h.program,s.buffer=h.buffer,s.uniforms=h.uniforms,s.presetDirty=!0,s.contextLost=!1,bt?.()};return r.addEventListener("webglcontextlost",l,!1),r.addEventListener("webglcontextrestored",c,!1),s={glCanvas:r,gl:o,program:n,buffer:i,uniforms:u,preset:Xt.chromatic.modes.dark,presetDirty:!0,contextLost:!1,useOffscreen:a,frameBitmap:null,startMs:performance.now(),pausedMs:0,pausedAtMs:null,rafId:0,dpr:t,instances:new Set,frameCount:0,glowQueue:[],glowIdx:0,glowSkip:0,glowPixels:new Uint8Array(e*e*4),glowPixelsW:e,glowPixelsH:e},s}function Qe(){var t;if(!s)return;const{gl:e,program:a,buffer:r,frameBitmap:o}=s;try{o?.close(),e.deleteBuffer(r),e.deleteProgram(a),(t=e.getExtension("WEBGL_lose_context"))==null||t.loseContext()}catch{}s=null}let It=0;function dt(){if(!s)return;const t=performance.now();if(t-It<Pe)return;It=t;const{gl:e,glCanvas:a}=s,r=a.width,o=a.height;(s.glowPixelsW!==r||s.glowPixelsH!==o)&&(s.glowPixelsW=r,s.glowPixelsH=o,s.glowPixels=new Uint8Array(r*o*4)),e.readPixels(0,0,r,o,e.RGBA,e.UNSIGNED_BYTE,s.glowPixels)}const Z={bx:0,by:0};function kt(t,e,a){if(!s)return Z.bx=0,Z.by=0,Z;const{glCanvas:r}=s,o=r.width,n=r.height,i=t.dpr,u=t.cssWidth*i,l=t.cssHeight*i,c=Yt*i,h=Zt*i;let f=u*(o/c)/t.shaderScale,d=l*(n/h)/t.shaderScale;f>o&&(f=o),d>n&&(d=n);const g=(o-f)/2,x=(n-d)/2,m=g+e/t.cssWidth*f,F=x+a/t.cssHeight*d;return Z.bx=Math.round(m),Z.by=Math.round(n-1-F),Z}const G={r:0,g:0,b:0,lum:0,count:0};function ee(t,e,a,r,o,n){const i=Math.max(1,n|0),u=Math.max(0,r-i),l=Math.min(e,r+i+1),c=Math.max(0,o-i),h=Math.min(a,o+i+1);G.r=0,G.g=0,G.b=0,G.lum=0,G.count=0;for(let f=c;f<h;f++){const d=f*e;for(let g=u;g<l;g++){const x=(d+g)*4;G.r+=t[x],G.g+=t[x+1],G.b+=t[x+2],G.lum+=(.2126*t[x]+.7152*t[x+1]+.0722*t[x+2])/255,G.count++}}return G}const R={r:255,g:255,b:255};function Ot(t,e,a,r){if(!s)return 0;dt();const o=kt(t,e,a),n=ee(s.glowPixels,s.glowPixelsW,s.glowPixelsH,o.bx,o.by,r);return n.count>0?n.lum/n.count:0}function Ve(t,e,a,r){if(!s)return R.r=255,R.g=255,R.b=255,R;dt();const o=kt(t,e,a),n=ee(s.glowPixels,s.glowPixelsW,s.glowPixelsH,o.bx,o.by,r);return n.count===0?(R.r=255,R.g=255,R.b=255,R):(R.r=n.r/n.count,R.g=n.g/n.count,R.b=n.b/n.count,R)}function Xe(t,e,a,r){if(!s)return R.r=255,R.g=255,R.b=255,R;dt();const o=kt(t,e,a),{glowPixels:n,glowPixelsW:i,glowPixelsH:u}=s,l=Math.max(1,r|0),c=Math.max(0,o.bx-l),h=Math.min(i,o.bx+l+1),f=Math.max(0,o.by-l),d=Math.min(u,o.by+l+1);let g=-1;R.r=255,R.g=255,R.b=255;for(let x=f;x<d;x++){const m=x*i;for(let F=c;F<h;F++){const b=(m+F)*4,P=n[b],j=n[b+1],L=n[b+2],C=Math.max(P,j,L),E=Math.min(P,j,L),z=(C>0?(C-E)/C:0)*(.35+.65*(C/255));z>g&&(g=z,R.r=P,R.g=j,R.b=L)}}return R}Ue(()=>{s&&s.instances.size>0&&s.pausedAtMs===null&&nt()});typeof document<"u"&&document.addEventListener("visibilitychange",()=>{!s||s.pausedAtMs!==null||s.contextLost||(document.hidden?oe():s.instances.size>0&&nt())});function Ye(t){const e=te(),a=t.hostCanvas.getContext("2d",{alpha:!0});if(!a)throw new Error("metal-fx: canvas 2D context unavailable");const r=t.scale??1,o={canvas:t.hostCanvas,ctx:a,cssWidth:t.cssWidth,cssHeight:t.cssHeight,cornerRadius:t.cornerRadius,kind:t.kind,ringCssPx:t.ringCssPx??(t.kind==="circle"?2:1)*r,shaderScale:t.shaderScale??(t.kind==="circle"?Jt:Kt)*r,opacityMul:t.opacityMul??1,visible:!0,paused:t.paused??!1,everCopied:!1,dpr:typeof window<"u"&&window.devicePixelRatio||1,scale:r,onAfterFrame:t.onAfterFrame,onFirstCopy:t.onFirstCopy};return ae(o),e.instances.add(o),e.rafId===0&&e.pausedAtMs===null&&nt(),o}function Ze(t){if(!s)return;s.instances.delete(t);const e=s.glowQueue.indexOf(t);e!==-1&&s.glowQueue.splice(e,1),s.instances.size===0&&(oe(),Qe())}function Ke(t){s&&(s.glowQueue.includes(t)||s.glowQueue.push(t))}function Je(t){if(!s)return;const e=s.glowQueue.indexOf(t);e!==-1&&s.glowQueue.splice(e,1)}function rt(t,e){let a=!1;e.cssWidth!==void 0&&e.cssWidth!==t.cssWidth&&(t.cssWidth=e.cssWidth,a=!0),e.cssHeight!==void 0&&e.cssHeight!==t.cssHeight&&(t.cssHeight=e.cssHeight,a=!0),e.cornerRadius!==void 0&&(t.cornerRadius=e.cornerRadius),e.scale!==void 0&&(t.scale=e.scale),e.kind!==void 0&&e.kind!==t.kind&&(t.kind=e.kind,e.shaderScale===void 0&&(t.shaderScale=(e.kind==="circle"?Jt:Kt)*t.scale),e.ringCssPx===void 0&&(t.ringCssPx=(e.kind==="circle"?2:1)*t.scale)),e.shaderScale!==void 0&&(t.shaderScale=e.shaderScale),e.ringCssPx!==void 0&&(t.ringCssPx=e.ringCssPx),e.opacityMul!==void 0&&(t.opacityMul=e.opacityMul),e.paused!==void 0&&e.paused!==t.paused&&(t.paused=e.paused,!e.paused&&s&&s.rafId===0&&s.pausedAtMs===null&&!s.contextLost&&nt()),a&&ae(t)}function ta(t,e){t.visible=e,e&&s&&s.rafId===0&&s.pausedAtMs===null&&!s.contextLost&&nt()}function ea(t,e){const a=te();a.preset=Xt[t].modes[e],a.presetDirty=!0}let wt=null;function aa(t){wt=t}function ae(t){t.dpr=typeof window<"u"&&window.devicePixelRatio||1;const e=Math.max(1,Math.round(t.cssWidth*t.dpr)),a=Math.max(1,Math.round(t.cssHeight*t.dpr));t.canvas.width!==e&&(t.canvas.width=e),t.canvas.height!==a&&(t.canvas.height=a)}function ra(t){const{ctx:e,dpr:a,canvas:r}=t,o=t.ringCssPx*a,n=r.width,i=r.height,u=Math.max(0,(t.cornerRadius-t.ringCssPx)*a);e.save(),e.globalCompositeOperation="destination-out",e.fillStyle="#000",e.beginPath(),e.roundRect(o,o,n-2*o,i-2*o,u),e.fill(),e.restore()}function oa(t){var e;if(!s)return;const a=s.frameBitmap??s.glCanvas,r=t.dpr,o=t.canvas.width,n=t.canvas.height;if(o<1||n<1)return;const i=s.glCanvas.width,u=s.glCanvas.height,l=Yt*r,c=Zt*r;let h=o*(i/l)/t.shaderScale,f=n*(u/c)/t.shaderScale;h>i&&(h=i),f>u&&(f=u);const d=Math.max(0,(i-h)/2),g=Math.max(0,(u-f)/2);if(t.ctx.clearRect(0,0,o,n),t.opacityMul<1&&(t.ctx.globalAlpha=t.opacityMul),t.ctx.drawImage(a,d,g,h,f,0,0,o,n),t.opacityMul<1&&(t.ctx.globalAlpha=1),ra(t),t.onFirstCopy){const x=t.onFirstCopy;t.onFirstCopy=void 0,x()}(e=t.onAfterFrame)==null||e.call(t)}function na(){if(!s)return;const{gl:t,uniforms:e,preset:a,glCanvas:r}=s;e.u_resolution&&t.uniform2f(e.u_resolution,r.width,r.height);for(let o=0;o<7;o++){const n=e[`u_color${o+1}`];if(n){const[u,l,c]=$e(a.colors[o]);t.uniform3f(n,u,l,c)}const i=e[`u_alpha${o+1}`];i&&t.uniform1f(i,a.alphas[o])}e.u_intensity&&t.uniform1f(e.u_intensity,a.intensity),e.u_scale&&t.uniform1f(e.u_scale,a.scale),e.u_direction&&t.uniform1f(e.u_direction,a.direction*Math.PI/180),e.u_softness&&t.uniform1f(e.u_softness,a.softness),e.u_distortion&&t.uniform1f(e.u_distortion,a.distortion),e.u_complexity&&t.uniform1f(e.u_complexity,a.complexity),e.u_shape&&t.uniform1f(e.u_shape,a.shape),e.u_vignette&&t.uniform1f(e.u_vignette,a.vignette),e.u_vigOpacity&&t.uniform1f(e.u_vigOpacity,a.vigOpacity),e.u_blur&&t.uniform1f(e.u_blur,a.blur),e.u_shaderOpacity&&t.uniform1f(e.u_shaderOpacity,a.shaderOpacity),s.presetDirty=!1}function ia(t){if(!s)return;const{gl:e,uniforms:a,preset:r,glCanvas:o}=s,n=(t-s.startMs-s.pausedMs)/1e3*r.speed;e.viewport(0,0,o.width,o.height),e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),s.presetDirty&&na(),a.u_time&&e.uniform1f(a.u_time,n),e.drawArrays(e.TRIANGLES,0,6),s.frameCount++}let Pt=0;function re(t){var e;if(!s)return;if(s.contextLost){s.rafId=0;return}let a=!1;for(const r of s.instances)if(r.visible&&(!r.paused||!r.everCopied)){a=!0;break}if(!a){s.rafId=0;return}if(s.rafId=requestAnimationFrame(re),!(t-Pt<Ie)){Pt=t,ia(t),s.useOffscreen&&(s.glowQueue.length>0&&dt(),(e=s.frameBitmap)==null||e.close(),s.frameBitmap=s.glCanvas.transferToImageBitmap());for(const r of s.instances)r.visible&&(r.paused&&r.everCopied||(oa(r),r.everCopied=!0));if(wt&&s.glowQueue.length>0&&++s.glowSkip%Ae===0){const r=s.glowQueue;s.glowIdx>=r.length&&(s.glowIdx=0);const o=r[s.glowIdx];o.visible&&!o.paused&&wt(o,t),s.glowIdx++}}}function nt(){!s||s.rafId!==0||(s.rafId=requestAnimationFrame(re))}function oe(){s&&(s.rafId!==0&&cancelAnimationFrame(s.rafId),s.rafId=0)}const lt={linear:t=>t,smoothstep:t=>t*t*(3-2*t)};function K(t,e,a,r=lt.linear){return{from:t,to:e,dur:a,ease:r,startMs:-1,val:t,done:!1}}function J(t,e){t.startMs=e,t.val=t.from,t.done=!1}function At(t,e){if(t.done||t.startMs<0)return t.val;const a=Math.min(1,(e-t.startMs)/t.dur);return t.val=t.from+(t.to-t.from)*t.ease(a),a>=1&&(t.done=!0),t.val}const sa=1.5,it=1/3,la=4*it,ca=2*it,da=2*it,ua=1.35*it,ha=13*it;function Mt(t,e,a){const r=Math.max(0,Math.min(a,Math.min(t,e)/2));return 2*Math.max(0,t-2*r)+2*Math.max(0,e-2*r)+2*Math.PI*r}function _t(t,e,a,r){return r==="circle"?2*Math.PI*Math.max(0,Math.min(a,Math.min(t,e)/2)):Mt(t,e,a)}function ot(t,e,a,r,o,n,i,u){const l=u||{x:0,y:0},c=Math.max(0,Math.min(r,Math.min(e,a)/2));if(i==="circle"){const b=2*Math.PI*c;if(b<=1e-4)return l.x=e*.5,l.y=a*.5,l;t=(t%b+b)%b;const P=-Math.PI/2+t/b*Math.PI*2,j=Math.max(0,c-o+n);return l.x=e*.5+j*Math.cos(P),l.y=a*.5+j*Math.sin(P),l}const h=Math.max(0,e-2*c),f=Math.max(0,a-2*c),d=Math.PI*c/2,g=2*(h+f)+4*d;t=(t%g+g)%g;const x=Math.max(0,c-o+n);let m=t;if(m<h)return l.x=c+m,l.y=o-n,l;if(m-=h,m<d){const b=-Math.PI/2+(d>0?m/d:0)*(Math.PI/2);return l.x=e-c+x*Math.cos(b),l.y=c+x*Math.sin(b),l}if(m-=d,m<f)return l.x=e-o+n,l.y=c+m,l;if(m-=f,m<d){const b=(d>0?m/d:0)*(Math.PI/2);return l.x=e-c+x*Math.cos(b),l.y=a-c+x*Math.sin(b),l}if(m-=d,m<h)return l.x=e-c-m,l.y=a-o+n,l;if(m-=h,m<d){const b=Math.PI/2+(d>0?m/d:0)*(Math.PI/2);return l.x=c+x*Math.cos(b),l.y=a-c+x*Math.sin(b),l}if(m-=d,m<f)return l.x=o-n,l.y=a-c-m,l;m-=f;const F=Math.PI+(d>0?m/d:0)*(Math.PI/2);return l.x=c+x*Math.cos(F),l.y=c+x*Math.sin(F),l}function jt(t,e){const a=t*2/e;let r="";for(let o=0;o<=e;o++){const n=-t+o*a;r+=(o===0?"M ":"L ")+n.toFixed(3)+" 0 "}return r}const ft={x:0,y:0},pt={x:0,y:0};function fa(t,e,a,r,o,n){return ot(t-.1,e,a,r,o,0,n,ft),ot(t+.1,e,a,r,o,0,n,pt),Math.atan2(pt.y-ft.y,pt.x-ft.x)}function Et(t,e,a){const r=Math.max(0,Math.min(1,(a-t)/(e-t)));return r*r*(3-2*r)}function pa(t){const e=_t(t.width,t.height,t.cornerRadius,t.kind),a=sa*(t.scale??1),r=[];for(let o=0;o<$t;o++){const n=o/$t*e,i=ot(n,t.width,t.height,t.cornerRadius,a,0,t.kind);r.push({x:i.x,y:i.y,arc:n})}return r}function ma(t,e){const{width:a,height:r,cornerRadius:o}=t,n=t.scale??1,i=t.kind==="circle"?2:1,u=Math.max(0,o-i),l=(-200*n).toFixed(0),c=l,h=(540*n).toFixed(0),f=(440*n).toFixed(0),d=`x="${l}" y="${c}" width="${h}" height="${f}"`,g=`${d} filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"`,x=F=>(F*n).toFixed(3),m=F=>(F*n).toFixed(3);return["<defs>",`<filter id="${e}_bXl" ${g}><feGaussianBlur stdDeviation="${m(8.4)}"/></filter>`,`<filter id="${e}_bLg" ${g}><feGaussianBlur stdDeviation="${m(4.8)}"/></filter>`,`<filter id="${e}_bMd" ${g}><feGaussianBlur stdDeviation="${m(2.1)}"/></filter>`,`<filter id="${e}_bSm" ${g}><feGaussianBlur stdDeviation="${m(.9)}"/></filter>`,`<filter id="${e}_ebO" ${g}><feGaussianBlur stdDeviation="${m(da)}"/></filter>`,`<filter id="${e}_ebC" ${g}><feGaussianBlur stdDeviation="${m(ua)}"/></filter>`,`<radialGradient id="${e}_fg" cx="0.5" cy="0.5" r="0.5"><stop offset="0" stop-color="white"/><stop offset="0.30" stop-color="white"/><stop offset="0.65" stop-color="#404040"/><stop offset="1" stop-color="black"/></radialGradient>`,`<mask id="${e}_fm" maskUnits="userSpaceOnUse" ${d}><rect ${d} fill="black"/><circle id="${e}_fc" cx="0" cy="0" r="${(ha*n).toFixed(3)}" fill="url(#${e}_fg)"/></mask>`,`<mask id="${e}_rm" maskUnits="userSpaceOnUse" ${d}><rect ${d} fill="#808080"/><rect x="0" y="0" width="${a}" height="${r}" rx="${o}" ry="${o}" fill="white"/><rect x="${i}" y="${i}" width="${a-i*2}" height="${r-i*2}" rx="${u}" ry="${u}" fill="black"/></mask>`,"</defs>",`<g id="${e}_h" mask="url(#${e}_rm)" opacity="0">`,`<rect ${d} fill="none" pointer-events="none"/>`,`<g id="${e}_hI" stroke="white">`,`<path id="${e}_pXl" stroke-width="${x(26.4)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.385" filter="url(#${e}_bXl)"/>`,`<path id="${e}_pLg" stroke-width="${x(15.6)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.595" filter="url(#${e}_bLg)"/>`,`<path id="${e}_pMd" stroke-width="${x(7.2)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.70" filter="url(#${e}_bMd)"/>`,`<path id="${e}_pSm" stroke-width="${x(3)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.70" filter="url(#${e}_bSm)"/>`,"</g></g>",`<g id="${e}_e" mask="url(#${e}_rm)" opacity="0">`,`<rect ${d} fill="none" pointer-events="none"/>`,`<g mask="url(#${e}_fm)">`,`<g id="${e}_eI" stroke="white">`,`<path id="${e}_eO" stroke-width="${x(la)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="0.85" filter="url(#${e}_ebO)"/>`,`<path id="${e}_eC" stroke-width="${x(ca)}" stroke-linecap="round" stroke-linejoin="round" fill="none" opacity="1.0" filter="url(#${e}_ebC)"/>`,"</g></g></g>"].join("")}const xa=.00875,Lt=.08,Nt=.32,ga=.05,va=3e3,Wt=.85,st=.34,mt=1500,ba=15,wa=.0075,ya=120,ka=1.5,Ma=7.8,_a=9.13952,Ca=1,Sa=1/3,Ta=.8,$a=3.51,Bt=2e3,xt=400,Ra=2.625,Fa=1.008,Ia=.31,ne=140,ie=40,se=20;let Oa=0;const q={x:0,y:0};function zt(t,e){const a=`mfxg_${++Oa}`,r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("class","metal-fx-glow-svg"),r.setAttribute("preserveAspectRatio","none"),r.setAttribute("viewBox",`0 0 ${e.width} ${e.height}`),r.innerHTML=ma(e,a),t.appendChild(r);const o=b=>r.querySelector(`#${a}_${b}`),n=o("h"),i=o("hI"),u=o("e"),l=o("eI"),c=o("fc"),h=_t(e.width,e.height,e.cornerRadius,e.kind)/Mt(ne,ie,se),f=Math.max(1,Ma*h),d=Math.max(.6,_a*Sa*h),g=jt(f,je),x=jt(d,Ee),m=[o("pXl"),o("pLg"),o("pMd"),o("pSm")],F=[o("eO"),o("eC")];for(const b of m)b.setAttribute("d",g);for(const b of F)b.setAttribute("d",x);return i.style.transformOrigin="0 0",l.style.transformOrigin="0 0",i.style.willChange="transform",l.style.willChange="transform",i.style.transition="transform 100ms linear",l.style.transition="transform 100ms linear",n.style.willChange="opacity",u.style.willChange="opacity",n.style.transition="opacity 100ms linear",u.style.transition="opacity 100ms linear",c.style.willChange="transform",{svg:r,haloGroup:n,haloInner:i,extraGroup:u,extraInner:l,fadeCircle:c,width:e.width,height:e.height,cornerRadius:e.cornerRadius,kind:e.kind,scale:e.scale??1,perim:pa(e),currentIdx:0,appearedAt:0,glowOpacity:0,relocTween:null,relocNextIdx:-1,wanderS:0,wanderTargetS:0,wanderFrames:0,tintFrom:{r:255,g:255,b:255},tintTarget:{r:255,g:255,b:255},tintTween:null,tintHoldUntil:0,lastHaloStroke:"",lastExtraStroke:""}}function Pa(t,e,a,r,o="dark"){var n;const{width:i,height:u,cornerRadius:l,perim:c}=t;if(c.length===0)return;const h=2;let f=-1,d=t.currentIdx,g=0;for(let v=0;v<c.length;v++){const M=c[v],S=Ot(e,M.x,M.y,h);S>f&&(f=S,d=v),v===t.currentIdx&&(g=S)}const x=t.appearedAt>0&&a-t.appearedAt<va,m=st+(Wt-st)*Et(Lt,Nt,g),F=!x&&f-g>ga;if(!t.relocTween||t.relocTween.done)if(t.appearedAt===0)t.currentIdx=d,t.appearedAt=a,t.wanderS=0,t.wanderTargetS=0,t.wanderFrames=0,t.relocTween=K(0,m,mt,lt.smoothstep),J(t.relocTween,a);else if((n=t.relocTween)!=null&&n.done&&t.relocTween.to===0){t.currentIdx=t.relocNextIdx,t.appearedAt=a,t.wanderS=0,t.wanderTargetS=0,t.wanderFrames=0;const v=c[t.currentIdx],M=Ot(e,v.x,v.y,h),S=st+(Wt-st)*Et(Lt,Nt,M);t.relocTween=K(0,S,mt,lt.smoothstep),J(t.relocTween,a)}else F?(t.relocNextIdx=d,t.relocTween=K(t.glowOpacity,0,mt,lt.smoothstep),J(t.relocTween,a)):t.glowOpacity+=(m-t.glowOpacity)*xa;t.relocTween&&(t.glowOpacity=At(t.relocTween,a)),t.glowOpacity=Math.max(0,Math.min(1,t.glowOpacity));const b=_t(i,u,l,t.kind)/Mt(ne,ie,se),P=ba*b;t.wanderFrames++>=ya&&(t.wanderTargetS=(Math.random()*2-1)*P,t.wanderFrames=0),t.wanderS+=(t.wanderTargetS-t.wanderS)*wa;const j=c[t.currentIdx].arc+t.wanderS,L=ka*t.scale;ot(j,i,u,l,L,0,t.kind,q);const C=q.x,E=q.y,z=fa(j,i,u,l,L,t.kind),X=`translate(${C.toFixed(3)}px,${E.toFixed(3)}px) rotate(${z.toFixed(4)}rad)`;t.haloInner.style.transform=X;const N=Ca*b*t.scale;ot(j,i,u,l,L,N,t.kind,q),t.extraInner.style.transform=`translate(${q.x.toFixed(3)}px,${q.y.toFixed(3)}px) rotate(${z.toFixed(4)}rad)`,t.fadeCircle.style.transform=`translate(${q.x.toFixed(3)}px,${q.y.toFixed(3)}px)`;const $=o==="light",k=$?Xe(e,C,E,h):Ve(e,C,E,h);t.tintTween?t.tintTween.done&&($?(t.tintFrom={r:t.tintFrom.r+(t.tintTarget.r-t.tintFrom.r)*t.tintTween.val,g:t.tintFrom.g+(t.tintTarget.g-t.tintFrom.g)*t.tintTween.val,b:t.tintFrom.b+(t.tintTarget.b-t.tintFrom.b)*t.tintTween.val},t.tintTarget={...k},t.tintTween=K(0,1,xt),J(t.tintTween,a)):a>=t.tintHoldUntil&&(t.tintFrom={...t.tintTarget},t.tintTarget={...k},t.tintTween=K(0,1,xt),J(t.tintTween,a),t.tintHoldUntil=a+Bt)):(t.tintFrom={...k},t.tintTarget={...k},t.tintTween=K(0,1,xt),J(t.tintTween,a),t.tintHoldUntil=$?0:a+Bt),At(t.tintTween,a);const I=t.tintTween.val;let W,B,H;if($)W=Math.round(t.tintFrom.r+(t.tintTarget.r-t.tintFrom.r)*I),B=Math.round(t.tintFrom.g+(t.tintTarget.g-t.tintFrom.g)*I),H=Math.round(t.tintFrom.b+(t.tintTarget.b-t.tintFrom.b)*I);else{const v=t.tintFrom.r+(t.tintTarget.r-t.tintFrom.r)*I,M=t.tintFrom.g+(t.tintTarget.g-t.tintFrom.g)*I,S=t.tintFrom.b+(t.tintTarget.b-t.tintFrom.b)*I,O=Math.max(v,M,S)||1;W=Math.round(255*(v/O)),B=Math.round(255*(M/O)),H=Math.round(255*(S/O))}const y=`rgb(${W},${B},${H})`;if(y!==t.lastHaloStroke&&(t.lastHaloStroke=y,t.haloInner.style.stroke=y),$){const v=Re(W,B,H),[M,S,O]=Fe(v[0],Math.min(1,v[1]*Ra),Math.max(Ia,v[2]*Fa)),D=`rgb(${M},${S},${O})`;D!==t.lastExtraStroke&&(t.lastExtraStroke=D,t.extraInner.style.stroke=D)}else t.lastExtraStroke!=="#ffffff"&&(t.lastExtraStroke="#ffffff",t.extraInner.style.stroke="#ffffff");const w=Math.max(0,Math.min(1,r));t.haloGroup.style.opacity=(t.glowOpacity*Ta*w).toFixed(3),t.extraGroup.style.opacity=Math.min(1,t.glowOpacity*$a*w).toFixed(3)}const yt=12,Ht=32,Gt=1,Dt=.55,Aa=1,ja=1,Ea=.85,La=0,Na=1.3,Ut=3.6,Wa=.7,Ba=1,za=.52,Ha=1,Ga=.044,Da=235,Ua=2.535,qa=.7,Qa=.5,Va=new Set(["INPUT","TEXTAREA","SELECT","OPTION"]);function Xa(t,e){const a=Math.max(t.left-e.right,e.left-t.right,0),r=Math.max(t.top-e.bottom,e.top-t.bottom,0);return Math.sqrt(a*a+r*r)}function Ya(t,e,a,r){return!(Math.min(t.bottom,e.bottom)-Math.max(t.top,e.top)<a||Math.max(t.left-e.right,e.left-t.right,0)>r)}function Za(t,e,a,r){return Math.min(t.right,e.right)-Math.max(t.left,e.left)<a?!1:Math.max(t.top-e.bottom,e.top-t.bottom,0)<=r}function V(t,e,a,r,o,n){const i=Math.max(0,Math.min(n,r*.5,o*.5)),u=t.roundRect;if(typeof u=="function"){u.call(t,e,a,r,o,i);return}t.moveTo(e+i,a),t.lineTo(e+r-i,a),t.quadraticCurveTo(e+r,a,e+r,a+i),t.lineTo(e+r,a+o-i),t.quadraticCurveTo(e+r,a+o,e+r-i,a+o),t.lineTo(e+i,a+o),t.quadraticCurveTo(e,a+o,e,a+o-i),t.lineTo(e,a+i),t.quadraticCurveTo(e,a,e+i,a)}function le(t,e,a,r,o){if(!o.flipX&&!o.flipY){t.drawImage(e,0,0,a,r,o.x,o.y,o.w,o.h);return}t.save(),o.flipX&&(t.translate(o.x+o.w,0),t.scale(-1,1)),o.flipY&&(t.translate(0,o.y+o.h),t.scale(1,-1)),t.drawImage(e,0,0,a,r,o.flipX?0:o.x,o.flipY?0:o.y,o.w,o.h),t.restore()}const Ka=4;function Ja(t,e,a,r,o,n,i){if(r<=2*i||o<=2*i){t.beginPath(),V(t,e,a,r,o,n),t.clip();return}t.beginPath(),V(t,e,a,r,o,n),V(t,e+i,a+i,r-2*i,o-2*i,Math.max(0,n-i)),t.clip("evenodd")}function tr(t,e,a,r,o,n,i,u,l,c,h){const f=Math.max(1,Math.round((yt+Ka*3)*h));let d=Math.max(0,i),g=!0;for(let x=0;x<3&&d>1e-4;x++){const m=Math.min(1,d);t.save(),Ja(t,c.x,c.y,c.w,c.h,c.r,f),t.globalCompositeOperation=g?"source-over":"lighter",g=!1,t.globalAlpha=m,le(t,e,a,r,l),t.globalAlpha=1,t.globalCompositeOperation="destination-in",t.fillStyle=u,t.fillRect(0,0,o,n),t.restore(),d-=m}}function ce(t,e,a,r,o,n,i){const u=i|0;if(u<1||r<=2*u||o<=2*u){t.beginPath(),V(t,e,a,r,o,n),t.clip();return}t.beginPath(),V(t,e,a,r,o,n),V(t,e+u,a+u,r-2*u,o-2*u,Math.max(0,n-u)),t.clip("evenodd")}function er(t,e,a,r,o,n,i,u,l,c,h,f){let d=u*h,g=!0;for(let x=0;x<3&&d>1e-4;x++){const m=Math.min(1,d);t.save(),ce(t,i.x,i.y,i.w,i.h,i.r,l),t.globalCompositeOperation=g?"source-over":"lighter",g=!1,t.globalAlpha=m,le(t,e,a,r,f),t.globalAlpha=1,t.globalCompositeOperation="destination-in",t.fillStyle=c,t.fillRect(0,0,o,n),t.restore(),d-=m}}function ar(t,e,a,r,o,n,i,u){const l=t.createLinearGradient(r,o,n,i);l.addColorStop(0,`rgba(255,255,255,${u.toFixed(3)})`),l.addColorStop(.5,`rgba(255,255,255,${(u*.45).toFixed(3)})`),l.addColorStop(1,"rgba(255,255,255,0)"),t.save(),ce(t,e.x,e.y,e.w,e.h,e.r,a),t.globalCompositeOperation="lighter",t.lineWidth=a*2,t.strokeStyle=l,t.beginPath(),V(t,e.x,e.y,e.w,e.h,e.r),t.stroke(),t.restore()}function de(t){const e=getComputedStyle(t),a=[parseFloat(e.borderTopLeftRadius)||0,parseFloat(e.borderTopRightRadius)||0,parseFloat(e.borderBottomRightRadius)||0,parseFloat(e.borderBottomLeftRadius)||0].filter(r=>r>0);return a.length?Math.min.apply(null,a):0}function ue(t){const e=getComputedStyle(t),a=Math.max(parseFloat(e.borderTopWidth)||0,parseFloat(e.borderRightWidth)||0,parseFloat(e.borderBottomWidth)||0,parseFloat(e.borderLeftWidth)||0);let r=0,o=0;const n=e.boxShadow;if(n&&n!=="none"){const u=n.replace(/rgba?\([^)]*\)/g,h=>h.replace(/,/g,"\0")).split(/,\s*/);let l=1/0,c=1/0;for(const h of u){const f=h.match(/-?\d+(?:\.\d+)?px/g);if(!f||f.length<4)continue;const d=parseFloat(f[3]);d>0&&(/\binset\b/.test(h)?d<l&&(l=d):d<c&&(c=d))}Number.isFinite(l)&&(r=l),Number.isFinite(c)&&(o=c)}const i=Math.max(a,o);return{width:Math.max(a,r,o)||1,outerCssPx:i}}function qt(t){t.cornerRadius=de(t.el);const e=ue(t.el);t.hairlineWidth=e.width,t.hairlineOuterCssPx=e.outerCssPx}function rr(t){typeof ResizeObserver<"u"&&(t.resizeObserver=new ResizeObserver(()=>qt(t)),t.resizeObserver.observe(t.el)),typeof MutationObserver<"u"&&(t.mutationObserver=new MutationObserver(()=>qt(t)),t.mutationObserver.observe(t.el,{attributes:!0,attributeFilter:["style","class"]}))}function or(t){var e,a;(e=t.resizeObserver)==null||e.disconnect(),t.resizeObserver=null,(a=t.mutationObserver)==null||a.disconnect(),t.mutationObserver=null}const tt=new Set;function nr(t,e,a){if(typeof document>"u"||Va.has(t.tagName))return null;for(const g of tt)if(g.el===t)return g;const r=document.createElement("div");r.setAttribute("data-metal-fx-reflection",""),r.setAttribute("aria-hidden","true");const o=document.createElement("canvas");o.className="metal-fx-reflection-canvas";const n=o.getContext("2d",{alpha:!0});if(!n)return null;const i=document.createElement("canvas");i.className="metal-fx-reflection-stroke-canvas";const u=i.getContext("2d",{alpha:!0});if(!u)return null;r.appendChild(o),r.appendChild(i);const l=getComputedStyle(t);let c=!1;l.position==="static"&&(t.style.position="relative",c=!0);let h=!1;l.isolation!=="isolate"&&(t.style.isolation="isolate",h=!0),t.setAttribute("data-metal-fx-reflect-host",""),t.insertBefore(r,t.firstChild);const f=ue(t),d={el:t,anchor:e,anchorEl:a,wrap:r,canvas:o,ctx:n,strokeCanvas:i,strokeCtx:u,cornerRadius:de(t),hairlineWidth:f.width,hairlineOuterCssPx:f.outerCssPx,appliedPositionRelative:c,appliedIsolation:h,resizeObserver:null,mutationObserver:null};return rr(d),tt.add(d),d}function ir(t){for(const e of tt)if(e.el===t){or(e),e.canvas.width=0,e.canvas.height=0,e.strokeCanvas.width=0,e.strokeCanvas.height=0,e.wrap.parentNode===e.el&&e.el.removeChild(e.wrap),e.el.removeAttribute("data-metal-fx-reflect-host"),e.appliedPositionRelative&&(e.el.style.position=""),e.appliedIsolation&&(e.el.style.isolation=""),tt.delete(e);return}}function sr(){if(tt.size===0)return;const t=typeof window<"u"&&window.devicePixelRatio||1,e=new Map;for(const a of tt){const r=a.el.getBoundingClientRect();let o=e.get(a.anchorEl);if(o||(o=a.anchorEl.getBoundingClientRect(),e.set(a.anchorEl,o)),r.width<1||r.height<1||o.width<1||o.height<1)continue;if(!Ya(o,r,Gt,Ht)&&!Za(o,r,Gt,Ht)){a.canvas.width!==1&&(a.canvas.width=1,a.canvas.height=1),a.strokeCanvas.width!==1&&(a.strokeCanvas.width=1,a.strokeCanvas.height=1);continue}const n=a.anchor.canvas,i=n.width|0,u=n.height|0;if(i<4||u<4)continue;const l=(o.left+o.right)*.5,c=(o.top+o.bottom)*.5,h=(r.left+r.right)*.5,f=(r.top+r.bottom)*.5,d=l-h,g=c-f,x=Math.max(o.left-r.right,r.left-o.right,0),m=Math.max(o.top-r.bottom,r.top-o.bottom,0),F=x>=m,b=Xa(o,r);let P=1-Math.min(1,b/yt);P=P*P*(3-2*P);const j=Dt+(Aa-Dt)*P,L=Math.min(Ut,j*Na*Wa),C=a.anchor.scale??1,E=Math.max(Ba*C,a.hairlineWidth),z=Math.max(1,Math.round(E*t)),X=Math.max(1,Math.round(Math.max(Ha*C,a.hairlineWidth)*t)),N=a.hairlineOuterCssPx;a.wrap.style.inset=`${-N}px`,a.wrap.style.borderRadius=`${Math.max(0,a.cornerRadius)}px`;const $=Math.max(1,Math.round((r.width+N*2)*t)),k=Math.max(1,Math.round((r.height+N*2)*t));a.canvas.width!==$&&(a.canvas.width=$),a.canvas.height!==k&&(a.canvas.height=k),a.strokeCanvas.width!==$&&(a.strokeCanvas.width=$),a.strokeCanvas.height!==k&&(a.strokeCanvas.height=k);const I=a.ctx;I.setTransform(1,0,0,1,0,0),I.clearRect(0,0,$,k);const W=a.strokeCtx;W.setTransform(1,0,0,1,0,0),W.clearRect(0,0,$,k);const B=Math.min(yt*t,Math.max($,k));let H,y,w,v;F?(H=d>0?$:0,w=d>0?$-B:B,y=k*.5,v=k*.5):(y=g>0?k:0,v=g>0?k-B:B,H=$*.5,w=$*.5);const M=I.createLinearGradient(H,y,w,v);M.addColorStop(0,`rgba(0,0,0,${ja})`),M.addColorStop(.5,`rgba(0,0,0,${Ea})`),M.addColorStop(1,`rgba(0,0,0,${La})`);const S=i/t,O=Math.max(1,Math.round(Da*Math.max(.1,S/140)*t));let D,U,T,A,Q=!1,Ct=!1;if(F){const at=Math.max(o.top,r.top),ht=Math.min(o.bottom,r.bottom);Q=!0,D=d>0?$-O:0,U=Math.round((at-r.top+N)*t),T=O,A=Math.max(1,Math.round((ht-at)*t))}else{const at=Math.max(o.left,r.left),ht=Math.min(o.right,r.right);Ct=!0,D=Math.round((at-r.left+N)*t),U=g>0?k-O:0,T=Math.max(1,Math.round((ht-at)*t)),A=O}const St={x:D,y:U,w:T,h:A,flipX:Q,flipY:Ct},ut={x:0,y:0,w:$,h:k,r:Math.max(0,a.cornerRadius*t)},me=Math.min(Ut,L*Ua*qa*Qa);tr(I,n,i,u,$,k,me,M,St,ut,t),er(W,n,i,u,$,k,ut,L,z,M,za,St),ar(W,ut,X,H,y,w,v,Math.min(.85,Ga*L)),I.globalCompositeOperation="source-over",W.globalCompositeOperation="source-over"}}let gt=!1,Qt=0;function lr(){gt||(gt=!0,!(typeof requestAnimationFrame>"u")&&requestAnimationFrame(t=>{gt=!1,!(t-Qt<Oe)&&(Qt=t,sr())}))}const Vt="metal-fx-styles",cr=`
.metal-fx-root {
position: relative;
display: inline-flex;
align-items: center;
justify-content: center;
isolation: isolate;
overflow: visible;
background: #272727;
color: #f8f8f8;
}
.metal-fx-root[data-theme='light'] {
background: #ffffff;
color: #1d1d1d;
}
.metal-fx-root::before {
content: '';
position: absolute;
inset: 0;
border-radius: inherit;
pointer-events: none;
z-index: 2;
box-shadow: inset 0 0 50px 0 rgba(255, 255, 255, 0.02);
}
.metal-fx-root[data-theme='light']::before {
box-shadow: inset 0 0 50px 0 rgba(0, 0, 0, 0.02);
}
.metal-fx-root::after {
content: '';
position: absolute;
inset: 0;
border-radius: inherit;
pointer-events: none;
z-index: 4;
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}
.metal-fx-root[data-theme='light']::after {
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}
/* Circle variant gets a thicker outer rim than the button variant. */
.metal-fx-root[data-variant='circle']::after {
box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.1);
}
.metal-fx-root[data-theme='light'][data-variant='circle']::after {
box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.06);
}
.metal-fx-canvas {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
display: block;
z-index: 0;
pointer-events: none;
border-radius: inherit;
}
/* The inner spacer — defines the inset geometry where the metal ring meets
the interior (3 px for Button, 1-2 px for Circle) and carries the Circle dark
hairline ('box-shadow: inset' rules below). Intentionally transparent so
the wrapper's background propagates through to the punched shader centre,
giving consumers a single surface tone to override. See "Single-surface
background" in the file header for the rationale. */
.metal-fx-inner {
position: absolute;
inset: 3px;
border-radius: inherit;
z-index: 1;
pointer-events: none;
}
.metal-fx-root[data-variant='button'][data-shape='pill'] .metal-fx-inner {
border-radius: calc(var(--mfx-radius, 20px) - 3px);
}
.metal-fx-root[data-variant='button'][data-shape='circle'] .metal-fx-inner {
border-radius: calc(var(--mfx-radius, 16px) - 3px);
}
.metal-fx-root[data-variant='circle'][data-shape='pill'] .metal-fx-inner {
inset: 0;
border-radius: var(--mfx-radius, 20px);
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45);
}
.metal-fx-root[data-variant='circle'][data-shape='circle'] .metal-fx-inner {
inset: 0;
border-radius: var(--mfx-radius, 16px);
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45);
}
/* Circle-variant hairline alpha — light mode.
Source-of-truth: index.html L2261-2267. The 0.45-alpha black inset that
reads as a single-pixel frame against the dark interior is too heavy
on a #ffffff inner: it ends up looking like a hard 2-px black ring
against the iridescent shader. Suppressed entirely (alpha 0) — the
shader's own iridescent rim already defines the silhouette in light
mode, so an extra dark hairline only competes with it. The rule is
kept (rather than deleted) as a tunable hook in case a future variant
wants to re-introduce a soft edge. NOTE: we keep the dark-mode inset
and border-radius values because — unlike index.html — our renderer
does NOT overscan the canvas in light mode, so there is no 1-px gap
between inner element and shader to compensate for. */
.metal-fx-root[data-theme='light'][data-variant='circle'][data-shape='pill'] .metal-fx-inner,
.metal-fx-root[data-theme='light'][data-variant='circle'][data-shape='circle'] .metal-fx-inner {
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0);
}
/* ─── Combined glow SVG (z=3) ──────────────────────────────────────────────
Single SVG per instance that holds BOTH the wide-halo group
(#mfx_haloTravel) and the catch-light group (#mfx_extraTravel), exactly
mirroring canonical's _buildGlowSvgInner (index.html L8078). One
mix-blend-mode: screen lifts the combined composite onto the shader
ring; per-frame opacity attributes on each inner group still drive the
independent fade-in / fade-out cycles for the halo and the catch-light.
Why a single SVG: the circle variant anchors halo + catch-light at the same
perimeter point, so they overlap in the bright zone. Two separately-
screened SVGs would double-screen the overlap (A + B + C - AB - AC -
BC + ABC instead of A + B + C - AB - AC once both groups composite
in source-over inside one SVG and then screen against the host once).
That overlap looked muted versus canonical specifically on the circle
variant where both layers travel together.
Source-of-truth opacity: #btnGlowSvg drops to 0.7 in dark and 0.2746 in
light (index.html L632/L643). */
.metal-fx-glow-svg {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
overflow: visible;
z-index: 3;
pointer-events: none;
opacity: 0.7;
}
.metal-fx-root[data-theme='light'] .metal-fx-glow-svg {
/* Light-mode 1-px overscan mirrors .btn-glow-svg in metal.html so the
halo stays glued to the visible silhouette (the shader ring there sits
1 px outside the host's padding box). */
inset: -1px;
width: calc(100% + 2px);
height: calc(100% + 2px);
mix-blend-mode: multiply;
/* Source-of-truth: html[data-theme="light"] #btnGlowSvg { opacity: 0.2746 }
→ −35 % from 0.4225 from the original 0.7 dark-mode opacity. */
opacity: 0.2746;
filter: saturate(5.355) brightness(0.78);
}
/* Circle light-mode small variants (e.g. 36×36 send button): the geometrically
shrunk halo loses density when multiplied against #ffffff. Mirror the
canonical override at index.html L2316 — bump saturation + drop brightness
so the small glow holds together visually. */
.metal-fx-root[data-variant='circle'][data-shape='circle'][data-theme='light'] .metal-fx-glow-svg {
filter: saturate(7.5) brightness(0.6);
}
/* The wrapped child — hoisted into z=5 so it sits above every overlay, with
normalized chrome so consumer button styles don't fight the metal frame. */
.metal-fx-content {
position: relative;
z-index: 5;
display: inline-flex;
align-items: center;
justify-content: center;
width: 100%;
pointer-events: none;
}
.metal-fx-content > * {
pointer-events: auto;
}
.metal-fx-root[data-normalize='true'] .metal-fx-content > * {
background: transparent !important;
border: 0 !important;
outline: 0 !important;
box-shadow: none !important;
/* Sizing: we deliberately DO NOT force \`width: 100%; height: 100%\` on the
child here. That used to be the contract ("the wrapper is the visible
button surface; the child stretches to fill it"), but it created a cyclic
percentage dependency: the wrapper is \`inline-flex\` with no intrinsic
size, .metal-fx-content is \`width/height: 100%\` of the wrapper, and the
child was \`100%\` of .metal-fx-content. With nothing breaking the cycle,
icon-only / class-sized children collapsed.
The new contract: the child sizes itself (intrinsic content, CSS class,
or inline style — all work), and the wrapper's \`inline-flex\` wraps it
tightly. Consumers who want a metal frame BIGGER than the child (e.g.
padding around an icon) size <MetalFx style={{ width, height }}> AND
explicitly set width/height on the child to fill (or accept that the
child renders at its intrinsic size, centered).
Typography is intentionally NOT touched. We used to apply
\`color: inherit; font: inherit;\` here to "match" the wrapper, but
\`font: inherit\` is a shorthand that overrides font-family, font-size,
font-weight, AND line-height on the child — which (a) shrank the
button height (line-height changes propagate through the flex
content box) and (b) scaled em-based icons / font-icons inside the
child to whatever the wrapper inherited. The wrapper now stays out
of the child's typography entirely; consumers who want typographic
normalization can apply it themselves on the child element. */
}
[data-metal-fx-reflection] {
position: absolute;
inset: 0;
pointer-events: none;
border-radius: inherit;
overflow: hidden;
z-index: 0;
isolation: isolate;
}
.metal-fx-reflection-canvas {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
display: block;
filter: blur(4px) saturate(1.2) brightness(1.58);
}
.metal-fx-reflection-stroke-canvas {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
display: block;
filter: saturate(1.35) brightness(1.75);
}
/* Hosts that participate as reflection targets need positioning + isolation
so the wrap composites only against the host (not the parent stack). The
wrap injects these inline as well, but stating them here keeps reflections
working on hosts that already have other inline styles applied. */
[data-metal-fx-reflect-host] {
isolation: isolate;
}
`;let vt=!1;function dr(){if(vt||typeof document>"u")return;if(document.getElementById(Vt)){vt=!0;return}const t=document.createElement("style");t.id=Vt,t.textContent=cr,document.head.appendChild(t),vt=!0}dr();const ur={position:"absolute",inset:0,width:"100%",height:"100%"},hr={position:"absolute",inset:3},fr={position:"absolute",inset:0,pointerEvents:"none",zIndex:3,borderRadius:"inherit"},ct=new Map;aa((t,e)=>{const a=ct.get(t);a&&Pa(a.handles,t,e,t.opacityMul,a.themeRef.current)});function pr(t){const[e,a]=_.useState(()=>t!=="auto"?t:typeof window>"u"||!window.matchMedia||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light");return _.useEffect(()=>{if(t!=="auto"){a(t);return}if(typeof window>"u"||!window.matchMedia)return;const r=window.matchMedia("(prefers-color-scheme: dark)"),o=()=>a(r.matches?"dark":"light");return o(),r.addEventListener("change",o),()=>r.removeEventListener("change",o)},[t]),e}const he=_.forwardRef(function({children:t,variant:e="button",preset:a="chromatic",theme:r="auto",strength:o=1,paused:n=!1,borderRadius:i,normalizeHostStyles:u=!0,reflectionTargets:l,disableGlow:c=!1,shaderScale:h,ringCssPx:f,scale:d=1,className:g,style:x,...m},F){const b=_.useRef(null),P=_.useRef(null),j=_.useRef(null),L=_.useRef(null),C=_.useRef(null),E=_.useRef(null),z=_.useRef("dark"),X=_.useRef(0),[N,$]=_.useState(!1),k=pr(r);z.current=k;const I=e==="circle"?"circle":"pill",W=!c;_.useImperativeHandle(F,()=>b.current,[]);const B=(y,w)=>{if(I==="circle")return Math.min(y,w)/2;const v=typeof i=="number"?i:(()=>{var M;const S=(M=L.current)==null?void 0:M.firstElementChild;if(S){const O=parseFloat(getComputedStyle(S).borderTopLeftRadius);if(Number.isFinite(O)&&O>0)return O}return X.current})();return Math.min(v,Math.min(y,w)/2)};_.useEffect(()=>{ea(a,k)},[a,k]),_.useEffect(()=>{const y=C.current;y&&rt(y,{paused:n})},[n]),_.useEffect(()=>{const y=C.current;if(!y)return;const w={};h!==void 0&&(w.shaderScale=h),f!==void 0&&(w.ringCssPx=f),d!==void 0&&(w.scale=d),Object.keys(w).length>0&&rt(y,w)},[h,f,d]),_.useLayoutEffect(()=>{const y=P.current,w=b.current,v=j.current;if(!y||!w)return;{const T=getComputedStyle(w),A=parseFloat(T.borderTopLeftRadius);X.current=Number.isFinite(A)?A:0}const M=()=>{const T=w.getBoundingClientRect(),A=Math.max(1,Math.round(T.width)),Q=Math.max(1,Math.round(T.height));return{cssWidth:A,cssHeight:Q,cornerRadius:B(A,Q)}},S=M();C.current=Ye({hostCanvas:y,cssWidth:S.cssWidth,cssHeight:S.cssHeight,cornerRadius:S.cornerRadius,kind:I,paused:n,shaderScale:h,ringCssPx:f,scale:d,onFirstCopy:()=>$(!0)}),w.style.setProperty("--mfx-radius",`${S.cornerRadius}px`),w.style.borderRadius=`${S.cornerRadius}px`,v&&(E.current=zt(v,{width:S.cssWidth,height:S.cssHeight,cornerRadius:S.cornerRadius,kind:I,scale:d}));let O=0;const D=new ResizeObserver(()=>{O===0&&(O=requestAnimationFrame(()=>{O=0;const T=M(),A=C.current;A&&(rt(A,{cssWidth:T.cssWidth,cssHeight:T.cssHeight,cornerRadius:T.cornerRadius}),w.style.setProperty("--mfx-radius",`${T.cornerRadius}px`),w.style.borderRadius=`${T.cornerRadius}px`,v&&(v.innerHTML="",E.current=zt(v,{width:T.cssWidth,height:T.cssHeight,cornerRadius:T.cornerRadius,kind:I,scale:d}),A&&E.current&&ct.set(A,{handles:E.current,themeRef:z})))}))});D.observe(w);let U=null;return typeof IntersectionObserver<"u"&&(U=new IntersectionObserver(T=>{const A=C.current;if(A)for(const Q of T)ta(A,Q.isIntersecting)},{rootMargin:"64px"}),U.observe(w)),C.current&&E.current&&(ct.set(C.current,{handles:E.current,themeRef:z}),Ke(C.current)),()=>{D.disconnect(),U?.disconnect(),O!==0&&cancelAnimationFrame(O);const T=C.current;T&&(ct.delete(T),Je(T),Ze(T)),C.current=null,E.current=null,v&&(v.innerHTML="")}},[I]),_.useEffect(()=>{const y=C.current;y&&rt(y,{opacityMul:Math.max(0,Math.min(1,o))})},[o,e]),_.useEffect(()=>{const y=C.current,w=b.current;if(!y||!w||!l||k!=="dark")return;y.onAfterFrame=lr;const v=l.flatMap(M=>M.current?[M.current]:[]);for(const M of v)nr(M,y,w);return()=>{y.onAfterFrame=void 0;for(const M of v)ir(M)}},[l,k]),_.useEffect(()=>{const y=b.current,w=C.current;if(!y||!w)return;const v=B(w.cssWidth,w.cssHeight);rt(w,{cornerRadius:v}),y.style.setProperty("--mfx-radius",`${v}px`),y.style.borderRadius=`${v}px`},[i,k,e,I]);const H=_.useMemo(()=>({...x,"--mfx-strength":String(Math.min(1,Math.max(0,o))),opacity:N?1:0,visibility:N?"visible":"hidden",transition:N?"opacity 0.15s ease-out":"none"}),[x,o,N]);return p.jsxs("div",{...m,ref:b,className:g?`metal-fx-root ${g}`:"metal-fx-root","data-variant":e,"data-shape":I,"data-theme":k,"data-paused":n?"true":void 0,"data-normalize":u?"true":"false",style:H,children:[p.jsx("canvas",{ref:P,className:"metal-fx-canvas",style:ur}),p.jsx("div",{className:"metal-fx-inner","aria-hidden":"true",style:hr}),p.jsx("div",{ref:j,"aria-hidden":"true",style:{...fr,display:W?void 0:"none"}}),p.jsx("div",{ref:L,className:"metal-fx-content",children:t})]})});he.displayName="MetalFx";const et=18;function fe(){return p.jsxs("svg",{"aria-hidden":!0,width:et,height:et,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[p.jsx("circle",{cx:"12",cy:"12",r:"4"}),p.jsx("path",{d:"M12 2v2"}),p.jsx("path",{d:"M12 20v2"}),p.jsx("path",{d:"m4.93 4.93 1.41 1.41"}),p.jsx("path",{d:"m17.66 17.66 1.41 1.41"}),p.jsx("path",{d:"M2 12h2"}),p.jsx("path",{d:"M20 12h2"}),p.jsx("path",{d:"m6.34 17.66-1.41 1.41"}),p.jsx("path",{d:"m19.07 4.93-1.41 1.41"})]})}function pe(){return p.jsx("svg",{"aria-hidden":!0,width:et,height:et,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:p.jsx("path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"})})}function mr(){return p.jsxs("svg",{"aria-hidden":!0,width:et,height:et,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[p.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),p.jsx("path",{d:"M8 21h8"}),p.jsx("path",{d:"M12 17v4"})]})}const xr=[{value:"light",label:"Light",Icon:fe},{value:"dark",label:"Dark",Icon:pe},{value:"system",label:"System",Icon:mr}];function gr(t){return t==="dark"?pe:fe}function vr({theme:t,resolvedTheme:e,onSetTheme:a,className:r="",direction:o="down",align:n="right"}){const[i,u]=_.useState(!1),l=_.useRef(null),c=_.useCallback(()=>u(!1),[]);_.useEffect(()=>{if(!i)return;const f=d=>{l.current&&!l.current.contains(d.target)&&c()};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[i,c]),_.useEffect(()=>{if(!i)return;const f=d=>{d.key==="Escape"&&c()};return document.addEventListener("keydown",f),()=>document.removeEventListener("keydown",f)},[i,c]);const h=gr(e);return p.jsxs("div",{ref:l,className:`relative ${r}`,children:[p.jsx("button",{type:"button","aria-label":"Theme","aria-expanded":i,onClick:()=>u(f=>!f),className:"flex items-center justify-center w-9 h-9 rounded-lg text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white transition-colors",children:p.jsx(h,{})}),i&&p.jsx("div",{className:`absolute z-50 min-w-[140px] py-1 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 shadow-lg ${o==="up"?"bottom-full mb-1":"top-full mt-1"} ${n==="left"?"left-0":"right-0"}`,children:xr.map(({value:f,label:d,Icon:g})=>{const x=t===f;return p.jsxs("button",{type:"button",onClick:()=>{a(f),c()},className:`flex w-full items-center gap-2.5 px-3 py-2 text-sm transition-colors ${x?"text-oai-black dark:text-white bg-oai-gray-100 dark:bg-oai-gray-800":"text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/60 hover:text-oai-black dark:hover:text-white"}`,children:[p.jsx(g,{}),p.jsx("span",{children:d})]},f)})})]})}const br="https://github.com/mm7894215/TokenTracker/releases/latest";function Ur({auth:t,signedIn:e,sessionSoftExpired:a,userId:r}){const{currency:o,rate:n}=ke(),{theme:i,resolvedTheme:u,setTheme:l}=xe(),{openLoginModal:c}=ge(),{signedIn:h,loading:f}=ve(),d=!be(),g=e&&!a,x=_.useMemo(()=>g&&(typeof t=="function"||typeof t=="string"||t&&typeof t=="object")?t:null,[t,g]),m=_e({userId:r,period:"total",accessToken:x});return p.jsxs("div",{className:"flex flex-col min-h-screen bg-oai-gray-50 dark:bg-oai-gray-950 text-oai-black dark:text-oai-white font-oai antialiased transition-colors duration-200",children:[p.jsx("header",{className:"sticky top-0 z-50 w-full px-4 pt-4 pb-2 transition-all duration-300 pointer-events-none",children:p.jsxs("div",{className:"mx-auto max-w-3xl rounded-2xl border border-oai-gray-200/50 dark:border-white/10 bg-white/75 dark:bg-oai-gray-950/60 backdrop-blur-xl shadow-[0_8px_30px_rgb(0,0,0,0.04)] dark:shadow-[0_8px_30px_rgb(0,0,0,0.3)] flex h-14 items-center justify-between px-3 sm:px-4 pointer-events-auto transition-all duration-300",children:[p.jsxs("div",{className:"flex items-center gap-4",children:[p.jsxs(Tt,{to:"/",className:"flex items-center gap-3 no-underline outline-none rounded-md focus-visible:ring-2 focus-visible:ring-indigo-500 transition-opacity hover:opacity-80 active:scale-95",children:[p.jsx("img",{src:"/app-icon.png",alt:"",width:24,height:24,className:"rounded-md"}),p.jsx("span",{className:"text-sm font-semibold tracking-wide text-oai-black dark:text-white uppercase",children:"Token Tracker"})]}),p.jsx("div",{className:"hidden sm:block scale-90 origin-left opacity-90 hover:opacity-100 transition-opacity",children:p.jsx(Me,{})})]}),p.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2",children:[p.jsxs(Tt,{to:"/leaderboard",className:"group no-underline inline-flex items-center gap-1.5 h-8 px-3 text-xs font-bold rounded-full border border-oai-gray-200 dark:border-white/10 bg-transparent text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-white/5 hover:text-oai-black dark:hover:text-white transition-all duration-200 active:scale-95 shadow-sm",children:[p.jsx(we,{size:13,strokeWidth:2.5,"aria-hidden":!0,className:"transition-transform duration-150 ease-out group-hover:scale-110 group-hover:rotate-6"}),p.jsx("span",{children:Y("leaderboard.profile.nav.back")})]}),d&&p.jsx(he,{variant:"button",preset:"chromatic",theme:"dark",borderRadius:9999,disableGlow:!0,className:"!bg-black",children:p.jsxs("a",{href:br,target:"_blank",rel:"noopener noreferrer",className:"group no-underline inline-flex h-8 items-center gap-1.5 px-3 text-xs font-bold rounded-full bg-black text-white transition-transform duration-200 active:scale-[0.98]",children:[p.jsx(Te,{size:13,strokeWidth:2.5,"aria-hidden":!0,className:"transition-transform duration-150 ease-out group-hover:translate-y-0.5"}),p.jsx("span",{className:"hidden sm:inline",children:Y("leaderboard.profile.nav.download")})]})}),f?p.jsx("div",{className:"h-8 w-16 animate-pulse rounded-full bg-oai-gray-200 dark:bg-white/10","aria-hidden":!0}):h?p.jsx(ye,{}):p.jsx("button",{type:"button",onClick:c,className:"inline-flex h-8 min-w-[76px] items-center justify-center px-3 text-xs font-bold rounded-full border border-oai-gray-200 dark:border-white/10 bg-transparent text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-white/5 hover:text-oai-black dark:hover:text-white transition-all duration-200 active:scale-95 shadow-sm select-none",children:Y("header.auth.sign_in_aria")})]})]})}),p.jsx("main",{className:"flex-1 px-4 pt-4 pb-10 sm:pt-6 sm:pb-16",children:p.jsx("div",{className:"mx-auto max-w-3xl",children:p.jsxs("div",{className:"rounded-2xl bg-white dark:bg-oai-gray-950 ring-1 ring-oai-gray-200 dark:ring-oai-gray-800 overflow-hidden shadow-sm dark:shadow-none",children:[m.loading&&p.jsx(Ce,{variant:"page"}),!m.loading&&m.error&&p.jsx("div",{className:"px-6 py-16 text-center",children:p.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:Y("leaderboard.profile_modal.error")})}),!m.loading&&!m.error&&!m.data&&p.jsx("div",{className:"px-6 py-16 text-center",children:p.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:Y("leaderboard.profile_modal.empty")})}),!m.loading&&!m.error&&m.data&&p.jsx(Se,{data:m.data,currency:o,rate:n,variant:"page"})]})})}),p.jsx("footer",{className:"border-t border-oai-gray-200 dark:border-oai-gray-900 py-8 px-4 transition-colors duration-200",children:p.jsxs("div",{className:"mx-auto flex max-w-3xl items-center justify-between text-sm text-oai-gray-400 dark:text-oai-gray-500",children:[p.jsx("p",{children:Y("landing.v2.footer.line")}),p.jsx(vr,{theme:i,resolvedTheme:u,onSetTheme:l,direction:"up",align:"right"})]})})]})}export{Ur as LeaderboardProfilePage};
import{c as r}from"./__vite-browser-external-CeOnjjgl.js";const t=["claude","codex","cursor","gemini","kimi","kiro","grok","copilot","antigravity","zcode","opencodeGo"],e={claude:"CLAUDE",codex:"CODEX",cursor:"CURSOR",gemini:"GEMINI",kimi:"KIMI",kiro:"KIRO",grok:"GROK",copilot:"COPILOT",antigravity:"ANTIGRAVITY",zcode:"ZCODE",opencodeGo:"OPENCODE"};function c(i){return e[i]||null}function n(i){switch(i){case"claude":return r("limits.provider.claude");case"codex":return r("limits.provider.codex");case"cursor":return r("limits.provider.cursor");case"gemini":return r("limits.provider.gemini");case"kimi":return r("limits.provider.kimi");case"kiro":return r("limits.provider.kiro");case"grok":return r("limits.provider.grok");case"copilot":return r("limits.provider.copilot");case"antigravity":return r("limits.provider.antigravity");case"zcode":return r("limits.provider.zcode");case"opencodeGo":return r("limits.provider.opencode_go");default:return String(i||"")}}export{t as L,c as a,n as l};
import{l as G,j as t,d as H,c as r,i as $,r as b,ac as ee,R as te,J as ae,L as ie,ad as re,p as ne,ae as oe}from"./__vite-browser-external-CeOnjjgl.js";import{m as T}from"./react-CgmQzSd0.js";import{P as B,c as se,r as j,a as le,u as de,b as ce,s as ue}from"./use-usage-limits-Mnco2YgQ.js";import{L as m,u as me}from"./use-limits-display-prefs-CSxCVsC3.js";import{C as W}from"./Card-BBCwyki4.js";import{F as xe}from"./FadeIn-D4PsEvSg.js";import{L as pe,l as _,a as ge}from"./limits-providers-DoHPHfeA.js";import{P as fe}from"./ProviderIcon-C8fKhRQt.js";import{H as he}from"./HoverTooltip-8s49xhej.js";import{L as be}from"./LocalOnlyNotice-BZolN8xC.js";import{u as ye}from"./use-reduced-motion-DUgAHZln.js";import"./arrow-up-right-DAWmHSlU.js";import"./download-CH_YcQ58.js";const ve=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]],ke=G("bell-off",ve);const je=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],Ne=G("bell",je),_e=[3,2,3,3,2,2,3];function g({className:e}){return t.jsx("div",{className:H("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",e)})}function we(){return t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(g,{className:"h-3 w-12 shrink-0"}),t.jsx(g,{className:"flex-1 h-1.5 rounded-full min-w-0"}),t.jsx(g,{className:"h-3 w-[30px] shrink-0"}),t.jsx(g,{className:"h-3 w-6 shrink-0"})]})}function Me({bars:e,index:a}){const i=a%3===0?"w-24":a%3===1?"w-20":"w-[4.5rem]";return t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(g,{className:"h-[14px] w-[14px] rounded shrink-0"}),t.jsx(g,{className:H("h-4",i)})]}),Array.from({length:e},(o,n)=>t.jsx(we,{},n))]})}function Ee(){return t.jsx(W,{children:t.jsxs("div",{className:"flex flex-col gap-3",children:[t.jsx(g,{className:"h-3.5 w-28"}),_e.map((e,a)=>t.jsx(Me,{bars:e,index:a},a))]})})}const L=100;function A(e){const a=Date.parse(e);return Number.isFinite(a)?a:null}function Ie(e){return Math.max(0,Math.min(L,Math.round(e)))}function Le(e){return new Intl.DateTimeFormat($(),{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(new Date(e))}function Pe(e,a,i){if(e==null||e>=a)return L;const o=a-e,n=a-i;return Ie(n/o*L)}function Oe(e){const a=e.available_count;return a===null?null:Number.isInteger(a)&&a>=0?a:void 0}function Se(e,{now:a}={}){if(!e||typeof e!="object")return null;const i=Oe(e);if(i===void 0)return null;const o=Array.isArray(e.credits)?e.credits:[],n=a instanceof Date?a.getTime():Number(a??Date.now()),s=[];for(const c of o){const d=A(c?.expires_at);if(d==null)continue;const l=s.length+1;s.push({key:`reset-${l}`,label:r("limits.codex_reset_bank.row_label",{index:l}),expiresAt:Le(d),expiresMs:d,percent:Pe(A(c?.granted_at),d,n)})}return i===0?null:s.length>0?{kind:"rows",availableCount:i??s.length,rows:s}:i>0?{kind:"count_only",availableCount:i,rows:[]}:null}const Ce="shrink-0 text-oai-black dark:text-oai-white";function Re(e){const a=j(e);if(!Number.isFinite(a))return null;const i=a-Date.now();if(i<=0)return r("shared.time.now");const o=Math.floor(i/6e4);if(o<60)return`${o}m`;const n=Math.floor(o/60);return n<24?`${n}h`:`${Math.floor(n/24)}d`}function Te(e,a){const i=a===m.REMAINING?100-e:e;return i>=90?"bg-red-500":i>=70?"bg-amber-500":"bg-emerald-500"}function k(e,a="used_percent"){return e?a==="utilization"?e.utilization:e.used_percent:null}function N(e,a="reset_at"){return e?a==="resets_at"?e.resets_at:e.reset_at:null}function w(e){const a=Math.max(0,Math.min(100,Number(e)||0)),i=Math.round(a);return a>0&&i===0?r("limits.bar.sub_one_percent"):String(i)}function M(e){const a=Number(e);return Number.isFinite(a)?new Intl.NumberFormat(void 0,{minimumFractionDigits:0,maximumFractionDigits:a>=100?0:2}).format(a):null}function Ae(e){if(!e||typeof e!="object")return null;const a=M(e.used_credits),i=M(e.limit_credits),o=M(e.remaining_credits);return!a||!i||!o?null:r("limits.codex_credits.detail",{used:a,limit:i,remaining:o})}function De(e,a){return se({usedPercent:k(e.window,e.pctField),windowSeconds:le(e,e.window),resetMs:j(N(e.window,e.resetField)),mode:a})}function U(e){return Number.isFinite(e)?new Intl.DateTimeFormat($(),{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!1}).format(new Date(e)):null}function Fe(e,a,i){const o=[K(e,a,i)],n=j(N(e.window,e.resetField)),s=U(n);if(s&&o.push(r("limits.hover.resets_at",{time:s})),e.key==="credits"){const c=Ae(e.window);c&&o.push(c)}return o.join(`
`)}const z=he;function Ge({label:e,pct:a,reset:i,mode:o=m.USED,pacePercent:n=null,paceOver:s=!1,title:c=null}){const d=Math.max(0,Math.min(100,Number(a)||0)),l=o===m.REMAINING?100-d:d,u=Math.round(l),x=l>0&&u===0?Math.max(l,.35):l;let f=String(u);l>0&&u===0&&(f=r("limits.bar.sub_one_percent"));const h=n==null?null:Math.max(0,Math.min(100,n));return t.jsxs("div",{className:"group relative flex items-center gap-2",children:[t.jsx(z,{text:c}),t.jsx("span",{"data-limit-label":"",className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400 shrink-0 whitespace-nowrap",style:{width:"var(--tt-limits-label-w)"},children:e}),t.jsxs("div",{className:"relative flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:[t.jsx("div",{className:`${Te(l,o)} rounded-full h-full transition-[width] duration-500 ease-out`,style:{width:`${x}%`,minWidth:l>0?"3px":0}}),h!=null&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"absolute top-0 h-full bg-oai-gray-100 dark:bg-oai-gray-700/50",style:{left:`calc(${h}% - 3px)`,width:"6px"}}),t.jsx("div",{className:`absolute top-0 h-full ${s?"bg-red-500":"bg-emerald-500"}`,style:{left:`calc(${h}% - 1px)`,width:"2px"}})]})]}),t.jsxs("span",{className:"text-[11px] tabular-nums text-oai-gray-500 dark:text-oai-gray-400 w-9 text-right shrink-0 whitespace-nowrap",children:[f,"%"]}),i&&t.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500 w-6 text-right shrink-0",children:i})]})}function K(e,a,i){const o=e.label??r(e.labelKey),n=i===m.REMAINING,s=l=>n?100-l:l;if(a.expectedPercent==null){const l=Math.max(0,Math.min(100,Number(k(e.window,e.pctField))||0)),u=w(s(l));return n?r("limits.explain.remaining",{label:o,used:u}):r("limits.explain.used",{label:o,used:u})}if(a.paceOver){if(a.runsOutEta)return r("limits.explain.ahead_eta",{label:o,eta:a.runsOutEta});const l=w(s(a.projectedEnd??100));return r(n?"limits.explain.ahead_pct_remaining":"limits.explain.ahead_pct",{label:o,pct:l})}const c=Math.max(0,Math.min(100,Number(k(e.window,e.pctField))||0)),d=w(s(a.projectedEnd??c));return r(n?"limits.explain.on_track_remaining":"limits.explain.on_track",{label:o,pct:d})}function He({rows:e,mode:a}){if(e.length===0)return null;const i=a===m.REMAINING;return t.jsxs("div",{className:"mt-1 flex flex-col gap-1",children:[e.map(({spec:o,pace:n})=>{const s=U(j(N(o.window,o.resetField)));return t.jsxs("div",{className:"text-[11px] leading-snug text-oai-gray-600 dark:text-oai-gray-300",children:[K(o,n,a),s?t.jsxs("span",{className:"text-oai-gray-400 dark:text-oai-gray-500",children:[" · ",r("limits.hover.resets_at",{time:s})]}):null]},o.key)}),t.jsx("div",{className:"mt-1 pt-1.5 border-t border-oai-gray-200/70 dark:border-oai-gray-700/50 text-[10.5px] leading-snug text-oai-gray-400 dark:text-oai-gray-500",children:r(i?"limits.explain.body_remaining":"limits.explain.body")})]})}function E(e){if(!e)return null;const a=Date.now()-new Date(e).getTime();if(a<0)return null;const i=Math.floor(a/6e4);if(i<1)return r("shared.time.now");if(i<60)return r("shared.time.m_ago",{n:i});const o=Math.floor(i/60);if(o<24)return r("shared.time.h_ago",{n:o});const n=Math.floor(o/24);return r("shared.time.d_ago",{n})}const D={live:{surface:"bg-oai-gray-50 dark:bg-oai-gray-800 border-oai-gray-200/60 dark:border-oai-gray-700/60 text-oai-gray-500 dark:text-oai-gray-400",dot:"bg-emerald-500",pulse:"bg-emerald-400"},stale:{surface:"bg-oai-gray-50 dark:bg-oai-gray-800 border-oai-gray-200/60 dark:border-oai-gray-700/60 text-oai-gray-500 dark:text-oai-gray-400",dot:"bg-amber-500",pulse:"bg-amber-400"},cached:{surface:"bg-oai-gray-50 dark:bg-oai-gray-800 border-oai-gray-200/60 dark:border-oai-gray-700/60 text-oai-gray-500 dark:text-oai-gray-400",dot:"bg-amber-500",pulse:"bg-amber-400"}},$e={claude:"claude",codex:"codex"};function v({label:e,age:a=null,tone:i="live",tooltip:o=null}){const n=D[i]||D.live,s=i==="live";return t.jsxs("div",{className:"relative inline-flex items-center group cursor-help ml-1",onClick:c=>c.stopPropagation(),children:[t.jsxs("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded-full text-[9px] font-semibold uppercase tracking-wider border leading-normal ${n.surface}`,children:[s?t.jsxs("span",{className:"relative flex h-1.5 w-1.5",children:[t.jsx("span",{className:`animate-ping absolute inline-flex h-full w-full rounded-full ${n.pulse} opacity-75`}),t.jsx("span",{className:`relative inline-flex rounded-full h-1.5 w-1.5 ${n.dot}`})]}):t.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${n.dot}`}),e,a?t.jsxs(t.Fragment,{children:[" · ",a]}):null]}),o?t.jsxs("span",{className:"pointer-events-none absolute left-1/2 bottom-full z-20 mb-2 -translate-x-1/2 w-48 rounded-md bg-oai-gray-900 dark:bg-oai-gray-800 px-2.5 py-1.5 text-[10px] font-normal text-white text-center opacity-0 scale-95 translate-y-1 group-hover:opacity-100 group-hover:scale-100 group-hover:translate-y-0 transition-all duration-200 cubic-bezier(0.16, 1, 0.3, 1) leading-normal shadow-lg origin-bottom border border-oai-gray-800 dark:border-oai-gray-700",children:[o,t.jsx("span",{className:"absolute left-1/2 top-full -translate-x-1/2 border-4 border-transparent border-t-oai-gray-900 dark:border-t-oai-gray-800"})]}):null]})}function P({name:e,providerId:a,children:i,expandable:o=!1,expanded:n=!1,onToggle:s,badge:c=null}){const d=ge(a),l=t.jsxs("div",{className:"flex items-center gap-1.5",children:[d?t.jsx(fe,{provider:d,size:14,className:Ce}):null,t.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-oai-white",children:e}),c]});return o?t.jsxs("div",{role:"button",tabIndex:0,"aria-expanded":n,onClick:s,onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),s?.())},className:"flex flex-col gap-1.5 -mx-1.5 px-1.5 py-1 rounded-lg cursor-pointer transition-colors hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/40 aria-expanded:bg-oai-gray-50 dark:aria-expanded:bg-oai-gray-800/40",children:[l,i]}):t.jsxs("div",{className:"flex flex-col gap-1.5",children:[l,i]})}const Be=pe;function y({children:e,tone:a="neutral"}){const i=a==="error"?"text-red-600 dark:text-red-400":"text-oai-gray-500 dark:text-oai-gray-400";return t.jsx("div",{className:`text-[11px] leading-snug ${i}`,children:e})}function We({rows:e,mode:a,extra:i=null}){const o=e.length===0&&!i;return t.jsxs(t.Fragment,{children:[e.map(({spec:n,pace:s})=>t.jsx(Ge,{label:n.label??r(n.labelKey),pct:k(n.window,n.pctField),reset:Re(N(n.window,n.resetField)),mode:a,pacePercent:s.pacePercent,paceOver:s.paceOver,title:Fe(n,s,a)},n.key)),o?t.jsx(y,{children:r("limits.status.no_data")}):null,i]})}function Ue(e){if(!Number.isFinite(e.expiresMs))return null;const a=Math.floor((e.expiresMs-Date.now())/864e5);return a<0?null:a===0?r("limits.reset_bank.hover_detail_today",{date:e.expiresAt}):r("limits.reset_bank.hover_detail",{date:e.expiresAt,days:a})}function ze({row:e}){const a=Math.max(0,Math.min(100,Number(e.percent)||0));return t.jsxs("div",{className:"group relative flex items-center gap-2","data-reset-bank-row":"",children:[t.jsx(z,{text:Ue(e)}),t.jsx("span",{"data-limit-label":"",className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400 shrink-0 whitespace-nowrap",style:{width:"var(--tt-limits-label-w)"},children:e.label}),t.jsx("div",{className:"relative flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:t.jsx("div",{className:"bg-oai-gray-400 dark:bg-oai-gray-500 rounded-full h-full transition-[width] duration-500 ease-out",style:{width:`${a}%`,minWidth:a>0?"3px":0}})}),t.jsx("span",{className:"text-[10px] tabular-nums text-oai-gray-400 dark:text-oai-gray-500 w-[4.25rem] text-right shrink-0 whitespace-nowrap",children:e.expiresAt})]})}function Ke({model:e}){const a=e.kind==="count_only"?r("limits.codex_reset_bank.count_only",{count:e.availableCount}):null;return t.jsxs("div",{className:"mt-1 flex flex-col gap-1","data-reset-bank-section":e.kind,children:[t.jsx("div",{className:"text-[10.5px] font-medium uppercase tracking-wide text-oai-gray-400 dark:text-oai-gray-500",children:r("limits.codex_reset_bank.title")}),a?t.jsx("div",{className:"text-[11px] leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:a}):e.rows.map(i=>t.jsx(ze,{row:i},i.key))]})}function Ve(e,a){if(e==="codex_meta"){const i=Se(a.reset_credits);return i?t.jsx(Ke,{model:i}):null}return e==="kimi_parallel"&&a.parallel_limit?t.jsx(y,{children:r("limits.label.kimi_parallel",{count:a.parallel_limit})}):e==="copilot_otel"&&!a.otel_has_files&&!a.otel_enabled?t.jsx(Ye,{defaultDir:a.otel_default_dir}):null}function qe(e,a,i,o,n,s,c=null){const d=B[e];if(!d)return null;const l=d.windows(a).filter(x=>x.window).map(x=>({spec:x,pace:De(x,o)})),u=Ve(d.extra,a);return t.jsxs(P,{name:i,providerId:e,expandable:l.length>0,expanded:n,onToggle:s,badge:c,children:[t.jsx(We,{mode:o,rows:l,extra:u}),n?t.jsx(He,{rows:l,mode:o}):null]},e)}function Xe(e,a,i,o,n){if(!B[e])return null;if(!a?.configured)return t.jsxs(P,{name:_(e),providerId:e,children:[t.jsx(y,{children:r("limits.status.not_connected")}),e==="opencodeGo"?t.jsx(F,{}):null]},e);if(a.error)return t.jsxs(P,{name:_(e),providerId:e,children:[t.jsx(y,{tone:"error",children:r("shared.error.prefix",{error:a.error})}),e==="opencodeGo"?t.jsx(F,{}):null]},e);const s=_(e),c=a.plan_label?`${s} ${a.plan_label}`:s;let d=null;if(e==="antigravity")if(a.cached){const u=E(a.cached_at);d=t.jsx(v,{label:r("limits.label.antigravity_cached"),age:u,tone:"cached",tooltip:r("limits.tooltip.antigravity_cached")})}else d=t.jsx(v,{label:r("limits.label.antigravity_live"),tone:"live",tooltip:r("limits.tooltip.antigravity_live")});if(!d&&a.auth_action_required==="reauth"){const u=$e[e];d=t.jsx(v,{label:r("limits.reauth.badge"),age:E(a.cached_at),tone:"stale",tooltip:u?r("limits.reauth.tooltip",{command:u}):null})}const l=a.provenance;return l?.stale&&!d&&(d=t.jsx(v,{label:r("limits.provenance.stale"),age:E(l.captured_at),tone:"stale",tooltip:r("limits.provenance.tooltip",{source:l.source,confidence:l.confidence})})),qe(e,a,c,i,o,n,d)}function Ye({defaultDir:e}){const[a,i]=b.useState(!1),n=["export COPILOT_OTEL_ENABLED=true","export COPILOT_OTEL_EXPORTER_TYPE=file",`export COPILOT_OTEL_FILE_EXPORTER_PATH="${e||"$HOME/.copilot/otel"}/copilot-otel-$(date +%Y%m%d).jsonl"`].join(`
`),s=async c=>{c.stopPropagation();try{await navigator.clipboard.writeText(n),i(!0),setTimeout(()=>i(!1),1600)}catch{}};return t.jsxs("div",{className:"mt-1 rounded-md border border-amber-300/60 dark:border-amber-700/40 bg-amber-50/50 dark:bg-amber-900/10 px-2.5 py-2 text-[11px] text-oai-gray-600 dark:text-oai-gray-300",children:[t.jsx("div",{className:"font-medium text-oai-gray-700 dark:text-oai-gray-200",children:r("limits.copilot.otelHint.title")}),t.jsx("div",{className:"mt-0.5 leading-snug",children:r("limits.copilot.otelHint.body")}),t.jsx("pre",{className:"mt-1.5 overflow-x-auto rounded bg-oai-gray-100 dark:bg-oai-gray-900/60 px-2 py-1.5 font-mono text-[10.5px] leading-tight whitespace-pre",children:n}),t.jsx("button",{type:"button",onClick:s,className:"mt-1 inline-flex items-center gap-1 rounded border border-oai-gray-300 dark:border-oai-gray-700 px-1.5 py-0.5 text-[10.5px] text-oai-gray-700 dark:text-oai-gray-200 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors",children:a?r("limits.copilot.otelHint.copied"):r("limits.copilot.otelHint.copy")})]})}function I({n:e,children:a}){return t.jsxs("li",{className:"flex gap-2.5",children:[t.jsx("span",{className:"mt-[1px] flex h-4 w-4 shrink-0 items-center justify-center rounded-full bg-oai-brand/15 text-[9px] font-semibold text-oai-brand",children:e}),t.jsx("div",{className:"min-w-0 flex-1 leading-snug",children:a})]})}function Je(){return t.jsx("svg",{viewBox:"0 0 12 12","aria-hidden":"true",className:"h-2.5 w-2.5",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:t.jsx("path",{d:"M4.5 2.75h4.75V7.5M9.25 2.75 3 9"})})}function F(){const[e,a]=b.useState(!1),i=['export OPENCODE_GO_AUTH_COOKIE="..."','# Optional: export OPENCODE_GO_WORKSPACE_ID="wrk_..." (Only if auto-discovery fails)'].join(`
`),o=async n=>{n.stopPropagation();try{await navigator.clipboard.writeText(i),a(!0),setTimeout(()=>a(!1),1600)}catch{}};return t.jsxs("div",{className:"mt-1.5 rounded-lg border border-oai-gray-200 dark:border-oai-gray-700/60 bg-oai-gray-50/50 dark:bg-oai-gray-900/20 p-3 text-[11px] text-oai-gray-600 dark:text-oai-gray-300",children:[t.jsx("div",{className:"text-[12px] font-semibold text-oai-gray-800 dark:text-oai-gray-100",children:r("limits.opencodeGo.setupHint.title")}),t.jsx("div",{className:"mt-0.5 leading-snug text-oai-gray-500 dark:text-oai-gray-400",children:r("limits.opencodeGo.setupHint.subtitle")}),t.jsxs("ol",{className:"mt-2.5 space-y-2.5",children:[t.jsxs(I,{n:"1",children:[t.jsx("div",{children:r("limits.opencodeGo.setupHint.step1")}),t.jsxs("a",{href:"https://opencode.ai",target:"_blank",rel:"noreferrer",onClick:n=>n.stopPropagation(),className:"mt-1 inline-flex items-center gap-1 rounded-md bg-oai-brand/10 px-2 py-1 font-medium text-oai-brand hover:bg-oai-brand/15 transition-colors",children:[r("limits.opencodeGo.setupHint.cta"),t.jsx(Je,{})]})]}),t.jsxs(I,{n:"2",children:[t.jsx("div",{children:r("limits.opencodeGo.setupHint.step2")}),t.jsxs("ul",{className:"mt-1 space-y-0.5 text-oai-gray-500 dark:text-oai-gray-400",children:[t.jsx("li",{children:r("limits.opencodeGo.setupHint.step2_workspace")}),t.jsx("li",{children:r("limits.opencodeGo.setupHint.step2_cookie")})]})]}),t.jsxs(I,{n:"3",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{children:r("limits.opencodeGo.setupHint.step3")}),t.jsx("button",{type:"button",onClick:o,className:"shrink-0 rounded-md border border-oai-gray-300 dark:border-oai-gray-700 px-2 py-0.5 text-[10.5px] text-oai-gray-700 dark:text-oai-gray-200 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors",children:e?r("limits.opencodeGo.setupHint.copied"):r("limits.opencodeGo.setupHint.copy")})]}),t.jsx("pre",{className:"mt-1.5 overflow-x-auto rounded-md bg-oai-gray-100 dark:bg-oai-gray-900/60 px-2 py-1.5 font-mono text-[10.5px] leading-relaxed whitespace-pre",children:i}),t.jsx("div",{className:"mt-1 text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:r("limits.opencodeGo.setupHint.note_app")})]})]})]})}function Qe(e){const[a,i]=b.useState(0);return b.useLayoutEffect(()=>{const o=e.current;if(!o)return;const n=o.querySelectorAll("[data-limit-label]");let s=0,c=null;if(n.length>0)try{c=document.createElement("canvas").getContext("2d")}catch{c=null}if(c){const l=window.getComputedStyle(n[0]);c.font=`${l.fontStyle} ${l.fontWeight} ${l.fontSize} ${l.fontFamily}`;for(const u of n)s=Math.max(s,c.measureText(u.textContent).width)}const d=Math.ceil(s);i(l=>l===d?l:d)}),a}function Ze({claude:e,codex:a,cursor:i,gemini:o,kimi:n,kiro:s,grok:c,antigravity:d,copilot:l,zcode:u,opencodeGo:x,order:f,visibility:h,displayMode:V}){const q={claude:e,codex:a,cursor:i,gemini:o,kimi:n,kiro:s,grok:c,antigravity:d,copilot:l,zcode:u,opencodeGo:x},O=b.useRef(null),S=Qe(O),[X,Y]=b.useState(null),J=Array.isArray(f)&&f.length>0?f:Be,C=V===m.REMAINING?m.REMAINING:m.USED,Q=C===m.REMAINING?r("limits.settings.display_mode_remaining"):r("limits.settings.display_mode_used"),R=J.filter(p=>!h||h[p]!==!1).map(p=>Xe(p,q[p],C,X===p,()=>Y(Z=>Z===p?null:p))).filter(Boolean);return t.jsx(xe,{delay:.15,children:t.jsx(W,{children:t.jsxs("div",{ref:O,className:"flex flex-col gap-3",style:S>0?{"--tt-limits-label-w":`${S}px`}:void 0,children:[t.jsxs("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:[r("limits.panel.title"),r("limits.panel.mode_separator"),Q]}),R.length>0?R:t.jsx(y,{children:r("limits.status.all_hidden")})]})})})}const et=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),tt="x-apple.systempreferences:com.apple.preference.notifications";function at(){const e=ye(),a=ne(),i=r("limits.alert.blocked"),o=a?T.button:T.div;return t.jsxs(o,{type:a?"button":void 0,onClick:a?()=>oe({type:"action",name:"openURL",value:tt}):void 0,initial:e?!1:{opacity:0,x:14,scale:.9},animate:{opacity:1,x:0,scale:1},transition:{type:"spring",stiffness:320,damping:18},title:i,className:`relative hidden sm:inline-flex min-w-0 max-w-[360px] items-center gap-1.5 rounded-full border border-amber-300/70 bg-amber-50 px-3 py-1.5 text-xs text-amber-700 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-300 ${a?"cursor-pointer transition-colors hover:bg-amber-100 dark:hover:bg-amber-500/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-amber-500/60":""}`,children:[t.jsxs("span",{className:"relative flex h-1.5 w-1.5 shrink-0",children:[t.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-amber-400 opacity-75"}),t.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-amber-500"})]}),t.jsx("span",{className:"truncate",children:i}),t.jsx("span",{"aria-hidden":!0,className:"absolute left-full top-1/2 -translate-y-1/2 border-[5px] border-transparent border-l-amber-300/80 dark:border-l-amber-500/40"})]})}function ft(){const e=ee(),{data:a,error:i,isLoading:o}=de(e?{initialRefresh:!0,initialState:e,publishToPreloadCache:!0}:{initialRefresh:!0,publishToPreloadCache:!0}),n=me(),s=ce();return te.useEffect(()=>{s.enabled&&a&&ue(a)},[s.enabled,a]),!et&&!ae()?t.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:t.jsx(be,{})}):t.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:t.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:t.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[t.jsxs("div",{className:"flex flex-row items-start justify-between gap-4 mb-8",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white mb-3",children:r("nav.limits")}),t.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:r("limits.page.subtitle")})]}),t.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.enabled&&s.permissionBlocked?t.jsx(at,{}):null,t.jsx("button",{type:"button",onClick:()=>{s.setEnabled(!s.enabled)},"aria-label":s.enabled?r("limits.alert.disable"):r("limits.alert.enable"),title:s.enabled?r("limits.alert.disable"):r("limits.alert.enable"),className:`inline-flex h-9 w-9 items-center justify-center rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 ${s.enabled&&s.permissionBlocked?"text-amber-600 dark:text-amber-400":"text-oai-gray-600 dark:text-oai-gray-400 hover:text-oai-black dark:hover:text-white"}`,children:s.enabled?t.jsx(Ne,{className:"h-4 w-4","aria-hidden":!0}):t.jsx(ke,{className:"h-4 w-4","aria-hidden":!0})}),t.jsx(ie,{to:"/settings?section=limits","aria-label":r("limits.page.openSettings"),title:r("limits.page.openSettings"),className:"shrink-0 inline-flex h-9 w-9 items-center justify-center rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white transition-colors no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",children:t.jsx(re,{className:"h-4 w-4","aria-hidden":!0})})]})]}),o?t.jsx(Ee,{}):t.jsxs(t.Fragment,{children:[i?t.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400",children:r("shared.error.prefix",{error:i})}):null,t.jsx(Ze,{claude:a?.claude,codex:a?.codex,cursor:a?.cursor,gemini:a?.gemini,kimi:a?.kimi,kiro:a?.kiro,grok:a?.grok,antigravity:a?.antigravity,copilot:a?.copilot,zcode:a?.zcode,opencodeGo:a?.opencodeGo,order:n.order,visibility:n.visibility,displayMode:n.displayMode})]})]})})})}export{ft as LimitsPage};
import{l as e}from"./__vite-browser-external-CeOnjjgl.js";const o=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],t=e("link-2",o);export{t as L};
import{l as e}from"./__vite-browser-external-CeOnjjgl.js";const o=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],a=e("loader-circle",o);export{a as L};
import{j as e,c as t}from"./__vite-browser-external-CeOnjjgl.js";import{A as r}from"./arrow-up-right-DAWmHSlU.js";import{D as o}from"./download-CH_YcQ58.js";const i="https://github.com/mm7894215/TokenTracker/releases/latest";function c(){const a=()=>{try{window.location.href="tokentracker://open"}catch{}};return e.jsx("div",{className:"flex flex-1 flex-col items-center justify-center px-6 py-20 text-center",children:e.jsxs("div",{className:"max-w-md",children:[e.jsx("h2",{className:"text-lg font-semibold text-oai-black dark:text-white",children:t("local_only.title")}),e.jsx("p",{className:"mt-2 text-sm leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:t("local_only.body")}),e.jsxs("div",{className:"mt-6 flex flex-wrap items-center justify-center gap-3",children:[e.jsxs("button",{type:"button",onClick:a,className:"inline-flex h-9 items-center gap-1.5 rounded-full px-4 text-sm font-medium bg-oai-gray-900 text-white hover:bg-oai-gray-800 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100 transition-colors",children:[e.jsx("span",{children:t("local_only.open_app")}),e.jsx(r,{size:14,strokeWidth:2,"aria-hidden":!0})]}),e.jsxs("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"inline-flex h-9 items-center gap-1.5 rounded-full px-4 text-sm font-medium ring-1 ring-oai-gray-200 dark:ring-oai-gray-800 text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-900 transition-colors",children:[e.jsx(o,{size:14,strokeWidth:2,"aria-hidden":!0}),e.jsx("span",{children:t("local_only.download")})]})]})]})})}export{c as L};
import{l as re,a0 as ce,a as ge,r as o,c as a,j as e,d as h}from"./__vite-browser-external-CeOnjjgl.js";const ue=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],me=re("arrow-left",ue);const xe=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],he=re("mail",xe),be=e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",children:[e.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 0 1-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1Z",fill:"#4285F4"}),e.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23Z",fill:"#34A853"}),e.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18A10.96 10.96 0 0 0 1 12c0 1.77.42 3.44 1.18 4.93l3.66-2.84Z",fill:"#FBBC05"}),e.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53Z",fill:"#EA4335"})]}),fe=e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor",children:e.jsx("path",{d:"M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0 0 24 12c0-6.63-5.37-12-12-12Z"})}),pe={google:be,github:fe},ye={google:"Google",github:"GitHub",microsoft:"Microsoft",discord:"Discord",apple:"Apple"};function we(i){return ye[i]||String(i||"").replace(/-/g," ")}function ke(i){if(typeof i=="string"&&i.trim())return i.trim();if(i&&typeof i=="object"){if(typeof i.token=="string"&&i.token.trim())return i.token.trim();if(typeof i.otp=="string"&&i.otp.trim())return i.otp.trim()}return""}function je({title:i,subtitle:H,className:ae="",onSuccess:S,hideLogo:D=!1,initialMode:p="signin",tokenFromUrl:P="",initialEmail:y="",initialCode:v=""}){ce();const{enabled:w,signedIn:j,refreshUser:E,signInWithPassword:G,signUp:Z,signInWithOAuth:T,getPublicAuthConfig:V,sendResetPasswordEmail:$,exchangeResetPasswordToken:U,resetPassword:W}=ge(),[n,u]=o.useState(p),[c,k]=o.useState(y),[m,N]=o.useState(""),[A,L]=o.useState(""),[M,te]=o.useState(""),[q,z]=o.useState(v),[_,x]=o.useState(!1),[J,s]=o.useState(null),[C,b]=o.useState(null),[F,O]=o.useState(!1),[oe,se]=o.useState(!!(p!=="signin"||y)),[R,K]=o.useState(!0),[I,Q]=o.useState([]),[X,ie]=o.useState(8);o.useEffect(()=>{p&&u(p)},[p]),o.useEffect(()=>{y&&k(y)},[y]),o.useEffect(()=>{v&&z(v)},[v]),o.useEffect(()=>{if(!w)return;let r=!0;return K(!0),(async()=>{const{data:t,error:l}=await V();if(r){if(l||!t)Q(["google","github"]);else{const d=Array.isArray(t.oAuthProviders)?t.oAuthProviders:[],f=Array.isArray(t.customOAuthProviders)?t.customOAuthProviders:[];Q([...d,...f]),typeof t.passwordMinLength=="number"&&t.passwordMinLength>0&&ie(t.passwordMinLength)}K(!1)}})(),()=>{r=!1}},[w,V]),o.useEffect(()=>{j&&S&&S()},[j,S]);const Y=o.useMemo(()=>typeof window>"u"?"":!!window.webkit?.messageHandlers?.nativeOAuth?`${window.location.origin}/auth/callback`:`${window.location.origin}/`,[]),ee=o.useMemo(()=>typeof window>"u"?"/reset-password":`${window.location.origin}/reset-password`,[]),B=o.useCallback(async r=>{s(null),x(!0);try{const{error:t}=await T(r,Y);t&&s(t.message||String(t))}finally{x(!1)}},[T,Y]);o.useEffect(()=>{if(!w||R||j||typeof window>"u")return;const r=window.location.search;if(!r)return;const t=new URLSearchParams(r),l=t.get("native")==="1",d=t.get("provider");l&&d&&[...I].includes(d)&&B(d)},[w,R,j,I,B]);const ne=o.useCallback(async r=>{r.preventDefault(),s(null),x(!0);try{if(n==="signup"){const{data:l,error:d}=await Z({email:c.trim(),password:m,name:M.trim()||void 0});if(d){s(d.message||String(d));return}if(l?.requireEmailVerification){b(a("login.verify_email_pending")),u("signin");return}await E();return}const{error:t}=await G({email:c.trim(),password:m});if(t){s(t.message||String(t));return}await E()}finally{x(!1)}},[n,c,m,M,Z,G,E]),le=o.useCallback(async r=>{r.preventDefault(),s(null),x(!0);try{const t=c.trim(),{error:l}=await $({email:t,redirectTo:ee});if(l){s(l.message||String(l));return}k(t),b(a("reset_password.request.sent")),u("reset_confirm")}finally{x(!1)}},[c,ee,$]),de=o.useCallback(async r=>{if(r.preventDefault(),s(null),m!==A){s(a("reset_password.error.password_mismatch"));return}x(!0);try{let t=P;if(!t){const{data:d,error:f}=await U({email:c.trim(),code:q.trim()});if(f){s(f.message||String(f));return}if(t=ke(d),!t){s(a("reset_password.error.missing_token"));return}}const{error:l}=await W({newPassword:m,otp:t});if(l){s(l.message||String(l));return}O(!0),b(a("reset_password.success"))}finally{x(!1)}},[q,A,c,U,m,W,P]);if(!w)return null;const g=n==="reset_email"||n==="reset_confirm";return e.jsxs("div",{className:h("w-full bg-white dark:bg-oai-gray-950 p-6 transition-colors duration-200",ae),children:[g&&e.jsxs("button",{type:"button",onClick:()=>{u("signin"),b(null),s(null),O(!1),N(""),L("")},className:"flex items-center gap-1.5 text-xs font-medium text-oai-gray-500 hover:text-oai-black dark:hover:text-white transition-colors mb-4 focus:outline-none",children:[e.jsx(me,{className:"h-3.5 w-3.5"}),a("reset_password.back_to_sign_in")]}),e.jsxs("div",{className:h("mb-6",g?"text-left":"text-center"),children:[!D&&!g&&e.jsxs("div",{className:"flex items-center justify-center gap-2 mb-2",children:[e.jsx("img",{src:"/app-icon.png",alt:"",width:28,height:28,className:"rounded-md"}),e.jsx("span",{className:"text-lg font-semibold text-oai-black dark:text-white font-oai tracking-tight",children:a("shared.app_name")})]}),e.jsx("h2",{className:h("text-sm font-semibold text-oai-black dark:text-white tracking-tight mb-1",(D||g)&&"text-base font-bold md:text-lg"),children:g?a("reset_password.title"):i||a("login_modal.subtitle")}),!g&&H&&e.jsx("p",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 mt-1.5 leading-relaxed max-w-[320px] mx-auto",children:H}),g&&e.jsx("p",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 mt-1.5 leading-relaxed max-w-[320px]",children:C&&n==="reset_confirm"&&!F?C:a("reset_password.subtitle")})]}),C&&(!g||F)&&e.jsx("div",{className:"mb-4 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900/50 px-3 py-2 text-xs text-oai-gray-700 dark:text-oai-gray-300",children:C}),J&&e.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400 text-center",role:"alert",children:J}),n==="reset_email"&&e.jsxs("form",{onSubmit:le,className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-reset-email",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("login.field.email")}),e.jsx("input",{id:"card-reset-email",type:"email",autoComplete:"email",required:!0,value:c,onChange:r=>k(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),e.jsx("button",{type:"submit",disabled:_,className:"w-full h-10 rounded-lg bg-oai-gray-900 dark:bg-white text-white dark:text-oai-gray-950 text-sm font-semibold hover:bg-oai-gray-800 dark:hover:bg-oai-gray-100 transition-colors disabled:opacity-50",children:a("reset_password.request.submit")})]}),n==="reset_confirm"&&(F?e.jsx("button",{type:"button",onClick:()=>{u("signin"),O(!1),b(null),s(null),N(""),L("")},className:"w-full h-10 rounded-lg bg-oai-gray-900 dark:bg-white text-white dark:text-oai-gray-950 text-sm font-semibold hover:bg-oai-gray-800 dark:hover:bg-oai-gray-100 transition-colors text-center shadow-sm",children:a("reset_password.success_cta")}):e.jsxs("form",{onSubmit:de,className:"space-y-3",children:[!P&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-reset-email-confirm",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("login.field.email")}),e.jsx("input",{id:"card-reset-email-confirm",type:"email",autoComplete:"email",required:!0,value:c,onChange:r=>k(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-reset-code",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("reset_password.field.code")}),e.jsx("input",{id:"card-reset-code",type:"text",inputMode:"numeric",autoComplete:"one-time-code",required:!0,value:q,onChange:r=>z(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-reset-password",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("reset_password.field.new_password")}),e.jsx("input",{id:"card-reset-password",type:"password",autoComplete:"new-password",required:!0,minLength:8,value:m,onChange:r=>N(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-reset-password-confirm",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("reset_password.field.confirm_password")}),e.jsx("input",{id:"card-reset-password-confirm",type:"password",autoComplete:"new-password",required:!0,minLength:8,value:A,onChange:r=>L(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),e.jsx("button",{type:"submit",disabled:_,className:"w-full h-10 rounded-lg bg-oai-gray-900 dark:bg-white text-white dark:text-oai-gray-950 text-sm font-semibold hover:bg-oai-gray-800 dark:hover:bg-oai-gray-100 transition-colors disabled:opacity-50",children:a("reset_password.reset.submit")})]})),!g&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-2.5 mb-5",children:R?e.jsxs("div",{className:"space-y-2.5",children:[e.jsx("div",{className:"h-10 rounded-lg bg-oai-gray-100 dark:bg-oai-gray-900/50 animate-pulse"}),e.jsx("div",{className:"h-10 rounded-lg bg-oai-gray-100 dark:bg-oai-gray-900/50 animate-pulse"})]}):I.map(r=>e.jsxs("button",{type:"button",disabled:_,onClick:()=>B(r),className:h("w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-700 bg-oai-gray-50 dark:bg-oai-gray-900 text-sm font-medium text-oai-black dark:text-white","hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:border-oai-gray-300 dark:hover:border-oai-gray-600 transition-colors disabled:opacity-50","flex items-center justify-center gap-2.5"),children:[pe[r]||null,a("login.oauth.continue",{provider:we(r)})]},r))}),oe?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"relative mb-5",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("span",{className:"w-full border-t border-oai-gray-200 dark:border-oai-gray-800"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase tracking-wider",children:e.jsx("span",{className:"bg-white dark:bg-oai-gray-950 px-3 text-oai-gray-400 dark:text-oai-gray-600",children:a("login_modal.divider_email")})})]}),e.jsxs("div",{className:"flex rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 p-0.5 bg-oai-gray-50 dark:bg-oai-gray-900/50 mb-4",children:[e.jsx("button",{type:"button",className:h("flex-1 py-1.5 text-xs font-medium rounded-md transition-colors",n==="signin"?"bg-white dark:bg-oai-gray-800 text-oai-black dark:text-white shadow-sm":"text-oai-gray-500 hover:text-oai-gray-700 dark:hover:text-oai-gray-300"),onClick:()=>{u("signin"),s(null)},children:a("login.tab.sign_in")}),e.jsx("button",{type:"button",className:h("flex-1 py-1.5 text-xs font-medium rounded-md transition-colors",n==="signup"?"bg-white dark:bg-oai-gray-800 text-oai-black dark:text-white shadow-sm":"text-oai-gray-500 hover:text-oai-gray-700 dark:hover:text-oai-gray-300"),onClick:()=>{u("signup"),s(null)},children:a("login.tab.sign_up")})]}),e.jsxs("form",{onSubmit:ne,className:"space-y-3",children:[n==="signup"&&e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-name",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("login.field.name")}),e.jsx("input",{id:"card-name",type:"text",autoComplete:"name",value:M,onChange:r=>te(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500",placeholder:a("login.field.name_placeholder")})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-email",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("login.field.email")}),e.jsx("input",{id:"card-email",type:"email",autoComplete:"email",required:!0,value:c,onChange:r=>k(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"card-password",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:a("login.field.password")}),e.jsx("input",{id:"card-password",type:"password",autoComplete:n==="signup"?"new-password":"current-password",required:!0,minLength:n==="signup"?X:void 0,value:m,onChange:r=>N(r.target.value),className:"w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50 dark:bg-oai-gray-900 px-3 text-sm text-oai-black dark:text-white placeholder-oai-gray-400 dark:placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"}),n==="signup"&&e.jsx("p",{className:"mt-1 text-xs text-oai-gray-400 dark:text-oai-gray-600",children:a("login.password_hint",{min:String(X)})}),n==="signin"&&e.jsx("div",{className:"mt-1 text-right",children:e.jsx("button",{type:"button",onClick:()=>{u("reset_email"),s(null),b(null)},className:"text-xs font-medium text-oai-gray-500 hover:text-oai-black dark:hover:text-white no-underline bg-transparent border-0 p-0 cursor-pointer focus:outline-none",children:a("login.forgot_password")})})]}),e.jsx("button",{type:"submit",disabled:_,className:"w-full h-10 rounded-lg bg-oai-gray-900 dark:bg-white text-white dark:text-oai-gray-950 text-sm font-semibold hover:bg-oai-gray-800 dark:hover:bg-oai-gray-100 transition-colors disabled:opacity-50",children:n==="signup"?a("login.submit.sign_up"):a("login.submit.sign_in")})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"relative mb-5",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("span",{className:"w-full border-t border-oai-gray-200 dark:border-oai-gray-800"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase tracking-wider",children:e.jsx("span",{className:"bg-white dark:bg-oai-gray-950 px-3 text-oai-gray-400 dark:text-oai-gray-600",children:a("login.divider")})})]}),e.jsxs("button",{type:"button",onClick:()=>se(!0),className:h("w-full h-10 rounded-lg border border-oai-gray-200 dark:border-oai-gray-700 bg-oai-gray-50 dark:bg-oai-gray-900 text-sm font-medium text-oai-black dark:text-white","hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:border-oai-gray-300 dark:hover:border-oai-gray-600 transition-colors","flex items-center justify-center gap-2.5"),children:[e.jsx(he,{className:"h-[18px] w-[18px] text-oai-gray-500 dark:text-oai-gray-400",strokeWidth:1.75}),a("login_modal.continue_email")]})]})]})]})}export{je as L};
import{u as s,a as c,r as l,j as e,X as d}from"./__vite-browser-external-CeOnjjgl.js";import{m as o}from"./react-CgmQzSd0.js";import{L as m}from"./LoginCard-CyOwV4vy.js";import{A as p}from"./index-DtrsMn3Y.js";function b(){const{isOpen:i,closeLoginModal:a}=s(),{enabled:r}=c();return l.useEffect(()=>{if(!i)return;const t=n=>{n.key==="Escape"&&a()};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[i,a]),r?e.jsx(p,{children:i&&e.jsxs(o.div,{className:"fixed inset-0 z-[100] flex items-center justify-center p-4",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},children:[e.jsx(o.div,{className:"absolute inset-0 bg-black/40 dark:bg-black/60",onClick:a,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0}}),e.jsxs(o.div,{className:"relative w-full max-w-[420px] rounded-2xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-950 shadow-2xl overflow-hidden",initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},transition:{duration:.2},onClick:t=>t.stopPropagation(),children:[e.jsx("button",{type:"button",onClick:a,className:"absolute right-4 top-4 z-10 text-oai-gray-400 dark:text-oai-gray-500 hover:text-oai-black dark:hover:text-white transition-colors",children:e.jsx(d,{className:"h-5 w-5"})}),e.jsx(m,{onSuccess:a,className:"p-6 bg-transparent"})]})]})}):null}export{b as LoginModal};
import{e as p,f as w,a as v,r,c as s,j as e,L as y}from"./__vite-browser-external-CeOnjjgl.js";import{L as j}from"./LoginCard-CyOwV4vy.js";function N(i){const t=new URLSearchParams(i).get("next");return typeof t!="string"||t.length===0||!t.startsWith("/")||t.startsWith("//")?"/dashboard":t}function L(){const i=p(),[t,f]=w(),{enabled:n,loading:u,signedIn:x,refreshUser:g}=v(),c=r.useMemo(()=>N(t.toString()),[t]),[m,d]=r.useState(null);r.useEffect(()=>{const l=t.get("insforge_status"),a=t.get("insforge_type"),h=t.get("insforge_error");l==="success"&&a==="verify_email"?d(s("login.verify_email_success")):l==="error"&&a==="verify_email"&&h&&d(s("shared.error.prefix",{error:h}))},[t]);const o=r.useMemo(()=>t.get("native")==="1",[t]);r.useEffect(()=>{if(!(!n||u)&&x){if(o){window.location.href="/auth/native-callback";return}i(c,{replace:!0})}},[n,u,x,i,c,o]),r.useEffect(()=>{n&&g()},[n,g]),r.useEffect(()=>{if(o&&typeof window<"u")try{window.sessionStorage.setItem("tokentracker_native_login","1")}catch{}},[o]);const b=r.useCallback(()=>{f(l=>{const a=new URLSearchParams(l);return a.delete("insforge_status"),a.delete("insforge_type"),a.delete("insforge_error"),a},{replace:!0}),d(null)},[f]);return n?e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 h-16 flex items-center justify-between",children:e.jsx(y,{to:"/",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 rounded",children:s("login.back_home")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4 py-12",children:e.jsxs("div",{className:"w-full max-w-md space-y-6",children:[m?e.jsxs("div",{className:"rounded-lg border border-oai-gray-800 bg-oai-gray-900/50 px-4 py-3 text-sm text-oai-gray-300 flex justify-between gap-3 items-start",role:"status",children:[e.jsx("span",{children:m}),e.jsx("button",{type:"button",onClick:b,className:"shrink-0 text-oai-gray-500 hover:text-white text-xs",children:s("login.dismiss")})]}):null,e.jsx("div",{className:"border border-oai-gray-900 bg-oai-gray-950 rounded-2xl overflow-hidden shadow-2xl",children:e.jsx(j,{hideLogo:!0,title:s("login.title"),subtitle:s("login.subtitle"),className:"p-8 bg-transparent",onSuccess:()=>{o?window.location.href="/auth/native-callback":i(c,{replace:!0})}})})]})})]}):e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 py-4",children:e.jsx(y,{to:"/",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline",children:s("login.back_home")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4",children:e.jsx("p",{className:"text-oai-gray-400 text-center max-w-md",children:s("login.cloud_only")})})]})}export{L as LoginPage};
import{l as t}from"./__vite-browser-external-CeOnjjgl.js";const a=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],i=t("maximize-2",a);export{i as M};
import{l as E,Q as re,ai as ie,r as o,aj as se,ak as oe,al as le,w as H,c as r,j as e,d as b,a4 as U,X as ne}from"./__vite-browser-external-CeOnjjgl.js";import{u as de,T as O,S as ce}from"./use-native-settings-DlDAj7ZJ.js";import{P as pe}from"./ProviderIcon-C8fKhRQt.js";import{n as me,C as q}from"./ClawdAnimated-BZwEWFcR.js";import{F}from"./FadeIn-D4PsEvSg.js";import{L as xe}from"./link-2-Cx8hG5wc.js";import{L as W}from"./loader-circle-9rHTQTld.js";import{Z as ue}from"./zap-D0DQz21w.js";import{T as ge}from"./trash-2-CUUFECPP.js";import{D as be,a as he,b as fe,c as ye,d as ke,e as ve}from"./DialogTitle-mSFue3N1.js";import{D as je}from"./DialogDescription-BFVeSjTD.js";import{D as we}from"./DialogClose-DaB9Ae7L.js";import"./Card-BBCwyki4.js";import"./react-CgmQzSd0.js";import"./use-reduced-motion-DUgAHZln.js";import"./useScrollLock-Ct5GyoVg.js";import"./store-BLjK5TrP.js";const Ne=[["path",{d:"M13.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v11.5",key:"4pqfef"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M8 12v-1",key:"1ej8lb"}],["path",{d:"M8 18v-2",key:"qcmpov"}],["path",{d:"M8 7V6",key:"1nbb54"}],["circle",{cx:"8",cy:"20",r:"2",key:"ckkr5m"}]],Se=E("file-archive",Ne);const Ce=[["path",{d:"m9 10 3-3 3 3",key:"11gsxs"}],["path",{d:"M12 13V7",key:"h0r20n"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]],Pe=E("monitor-up",Ce);const ze=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],Ie=E("upload",ze),Ae={visible:!1,character:"clawd",size:"medium"};function De(){const t=re()&&ie(),[a,l]=o.useState(Ae);o.useEffect(()=>{if(!t)return;const p=se(s=>{l({visible:!!s.visible,character:me(s.character),size:["small","medium","large"].includes(s.size)?s.size:"medium"})});return oe(),p},[t]);const d=o.useCallback((p,s)=>{l(x=>({...x,[p]:s})),t&&le(p,s)},[t]);return{available:t,settings:a,setSetting:d}}const k=[{id:"clawd",displayName:"Clawd",nameKey:"pet.character.clawd",spriteVersionNumber:1,custom:!1},{id:"sprout",displayName:"Sprout",nameKey:"pet.character.sprout",spriteVersionNumber:1,custom:!1,assetUrl:"/pets/sprout/spritesheet.webp"},{id:"byte",displayName:"Byte",nameKey:"pet.character.byte",spriteVersionNumber:1,custom:!1,assetUrl:"/pets/byte/spritesheet.webp"},{id:"ember",displayName:"Ember",nameKey:"pet.character.ember",spriteVersionNumber:1,custom:!1,assetUrl:"/pets/ember/spritesheet.webp"}];async function C(t){const a=await t.json().catch(()=>null);if(!t.ok||a?.ok===!1)throw new Error(a?.error||`Pet request failed with HTTP ${t.status}`);return a}async function Te(){const t=await fetch("/functions/tokentracker-pets",{headers:{Accept:"application/json"},cache:"no-store"}),a=await C(t);return[...k,...Array.isArray(a.pets)?a.pets:[]]}async function M(t){const a=await H();return C(await fetch("/functions/tokentracker-pets",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json",...a},cache:"no-store",body:JSON.stringify(t)}))}function Ee(t){return M({action:"install_url",url:t})}async function $(t){const a=await H();return C(await fetch("/api/pets/import",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/zip",...a},cache:"no-store",body:t}))}function Me(t){return M({action:"remove",id:t})}async function Le(){const t=await fetch("/functions/tokentracker-pets?scope=codex",{headers:{Accept:"application/json"},cache:"no-store"}),a=await C(t);return{importable:Array.isArray(a.importable)?a.importable:[],codexDetected:a.codexDetected===!0}}function _e(t){return M({action:"import_codex",ids:t})}let T=k;function Ke(){const[t,a]=o.useState(T),[l,d]=o.useState(!0),[p,s]=o.useState(!1),x=o.useCallback(async()=>{d(!0);try{const u=await Te();return T=u,a(u),s(!0),u}catch{return T=k,a(k),s(!1),k}finally{d(!1)}},[]);return o.useEffect(()=>{x()},[x]),{pets:t,loading:l,available:p,refresh:x}}const Be={clawd:"from-oai-amber-50 dark:from-orange-950/70",sprout:"from-oai-brand-100 dark:from-emerald-950/70",byte:"from-oai-gray-200 dark:from-slate-800/70",ember:"from-orange-100 dark:from-orange-950/80"};function Ve(){const t=r("pet.import.subtitle"),a="codex-pets.net",l=t.indexOf(a);return l<0?t:e.jsxs(e.Fragment,{children:[t.slice(0,l),e.jsx("a",{href:"https://codex-pets.net",target:"_blank",rel:"noreferrer",className:"underline decoration-oai-gray-400 underline-offset-2 transition-colors hover:text-oai-black dark:decoration-oai-gray-500 dark:hover:text-white",children:a}),t.slice(l+a.length)]})}const v=[{id:"idle-living",labelKey:"pet.state.calm"},{id:"working-thinking",labelKey:"pet.state.focus"},{id:"working-juggling",labelKey:"pet.state.multitask"},{id:"working-wizard",labelKey:"pet.state.streak"},{id:"happy",labelKey:"pet.state.celebrate"},{id:"sleeping",labelKey:"pet.state.rest"}];function X({character:t,selected:a,onSelect:l,onRemove:d,removeDisabled:p}){const s=t.nameKey?r(t.nameKey):t.displayName;return e.jsxs("div",{className:"group relative",children:[e.jsxs("button",{type:"button",onClick:l,"aria-pressed":a,className:b("relative w-full overflow-hidden rounded-xl border p-2.5 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",a?"border-oai-brand-500/40 bg-white dark:border-oai-brand-500/25 dark:bg-oai-gray-900/80":"border-oai-gray-200/80 bg-white/55 hover:border-oai-gray-400 dark:border-oai-gray-800 dark:bg-oai-gray-950/55 dark:hover:border-oai-gray-600"),children:[e.jsx("div",{className:b("absolute inset-0 bg-gradient-to-br to-transparent opacity-80 dark:opacity-55",Be[t.id]||"from-oai-gray-200/80 dark:from-oai-gray-800/70")}),e.jsxs("div",{className:"relative flex items-center gap-2.5",children:[e.jsx("div",{className:"flex h-12 w-12 shrink-0 items-center justify-center",children:e.jsx(q,{state:"idle-living",character:t.id,pet:t,size:44})}),e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-semibold text-oai-black dark:text-white",children:s}),t.spriteVersionNumber===2?e.jsx("span",{className:"shrink-0 rounded border border-oai-gray-300/80 px-1 text-[9px] font-semibold text-oai-gray-500 dark:border-oai-gray-600 dark:text-oai-gray-400",children:r("pet.format.v2")}):null,a?e.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-oai-brand-500","aria-hidden":!0}):null]})]})]}),d?e.jsx("button",{type:"button",disabled:p,onClick:d,"aria-label":`${r("pet.import.remove")} · ${s}`,className:b("absolute right-1.5 top-1.5 flex h-6 w-6 items-center justify-center rounded-md border border-oai-gray-200/90 bg-white/95 text-oai-gray-500 transition-opacity hover:text-red-600 focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 disabled:opacity-40 dark:border-oai-gray-700 dark:bg-oai-gray-900/95 dark:text-oai-gray-400 dark:hover:text-red-400",a?"opacity-100":"opacity-0 group-hover:opacity-100"),children:e.jsx(ge,{className:"h-3 w-3","aria-hidden":!0})}):null]})}function Re({pet:t,state:a,onStateChange:l}){const[d,p]=o.useState(null),s=o.useRef(null),x=v.find(function(n){return n.id===a}),u=r(x?.labelKey||"pet.state.calm");return e.jsxs("section",{className:"relative flex min-h-[400px] flex-col overflow-hidden bg-oai-gray-50 dark:bg-oai-gray-950 sm:min-h-[440px] lg:min-h-[480px]",onPointerMove:m=>{if(t?.spriteVersionNumber!==2||!s.current)return;const n=s.current.getBoundingClientRect(),h=m.clientX-(n.left+n.width/2),c=m.clientY-(n.top+n.height/2),j=(Math.atan2(h,-c)*180/Math.PI+360)%360;p(Math.round(j/22.5)%16)},onPointerLeave:()=>p(null),children:[e.jsx("div",{className:"absolute inset-0 opacity-[0.16] dark:opacity-[0.12]",style:{backgroundImage:"radial-gradient(currentColor 0.7px, transparent 0.7px)",backgroundSize:"14px 14px"},"aria-hidden":!0}),e.jsxs("div",{className:"relative flex items-center justify-between gap-3 px-5 pt-5",children:[e.jsx("span",{className:"text-xs font-semibold uppercase tracking-[0.14em] text-oai-gray-500 dark:text-oai-gray-400",children:r("pet.preview.states")}),e.jsxs("div",{className:"flex items-center gap-2 rounded-full border border-black/5 bg-white/65 px-3 py-1.5 text-[11px] font-medium text-oai-gray-600 backdrop-blur-md dark:border-white/10 dark:bg-black/20 dark:text-oai-gray-300",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500","aria-hidden":!0}),u]})]}),e.jsx("div",{className:"relative flex flex-1 items-center justify-center px-6 py-5",children:e.jsx("div",{ref:s,className:"relative flex h-52 w-52 items-center justify-center sm:h-56 sm:w-56 lg:h-64 lg:w-64",children:e.jsx("div",{className:"origin-bottom lg:scale-[1.18]",children:e.jsx(q,{state:a,character:t?.id||"clawd",pet:t,size:190,lookDirectionIndex:d})})})}),e.jsx("div",{className:"relative border-t border-oai-gray-200/70 bg-white/85 px-3 py-2 dark:border-oai-gray-800 dark:bg-oai-gray-950/85",children:e.jsx("div",{className:"grid grid-cols-3 gap-1","aria-label":r("pet.preview.states"),children:v.map(m=>e.jsxs("button",{type:"button",onClick:()=>l(m.id),"aria-pressed":a===m.id,className:b("flex min-h-10 flex-col items-center justify-center gap-1 rounded-lg px-1.5 text-xs transition-colors duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-oai-brand-500",a===m.id?"font-semibold text-oai-black dark:text-white":"font-medium text-oai-gray-500 hover:text-oai-black dark:text-oai-gray-400 dark:hover:text-white"),children:[e.jsx("span",{children:r(m.labelKey)}),e.jsx("span",{className:b("h-1 w-1 rounded-full transition-colors duration-200",a===m.id?"bg-oai-black dark:bg-white":"bg-transparent"),"aria-hidden":!0})]},m.id))})})]})}function Ue({pets:t,busy:a,error:l,onImport:d,onClose:p}){const[s,x]=o.useState(()=>new Set),u=n=>x(h=>{const c=new Set(h);return c.has(n)?c.delete(n):c.add(n),c}),m=t.length!==0&&s.size===t.length;return e.jsx(be,{open:!0,onOpenChange:n=>{!n&&!a&&p()},children:e.jsxs(he,{children:[e.jsx(fe,{className:"fixed inset-0 z-50 bg-black/15 backdrop-blur-md dark:bg-black/40 animate-tt-fade-in"}),e.jsx(ye,{className:"fixed inset-0 z-50 flex items-center justify-center p-3 md:p-6",children:e.jsxs(ke,{className:"relative flex max-h-[86vh] w-full max-w-2xl flex-col overflow-hidden rounded-2xl border border-oai-gray-200/50 bg-white/95 shadow-2xl backdrop-blur-2xl dark:border-white/10 dark:bg-oai-gray-900/95 animate-tt-modal",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3 border-b border-oai-gray-200/70 px-5 py-4 dark:border-oai-gray-800",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx(ve,{className:"text-base font-semibold",children:r("pet.codex.title")}),e.jsx(je,{className:"mt-0.5 text-xs leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:r("pet.codex.subtitle")})]}),e.jsx(we,{type:"button",disabled:a,"aria-label":r("pet.codex.close"),className:"shrink-0 rounded-full border border-oai-gray-200/60 p-1.5 text-oai-gray-500 transition-colors hover:text-oai-black disabled:opacity-40 dark:border-oai-gray-800/60 dark:text-oai-gray-400 dark:hover:text-white",children:e.jsx(ne,{size:16})})]}),e.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-5 py-4",children:[t.length===0?e.jsx("p",{className:"py-8 text-center text-sm text-oai-gray-400 dark:text-oai-gray-500",children:r("pet.codex.empty")}):e.jsx("div",{className:"grid grid-cols-2 gap-2.5 sm:grid-cols-3",children:t.map(n=>e.jsx(X,{character:n,selected:s.has(n.id),onSelect:()=>u(n.id)},n.id))}),l?e.jsx("p",{role:"alert",className:"mt-3 text-xs text-red-600 dark:text-red-400",children:l}):null]}),e.jsxs("div",{className:"flex items-center justify-between gap-3 border-t border-oai-gray-200/70 px-5 py-3 dark:border-oai-gray-800",children:[e.jsx("button",{type:"button",disabled:a||t.length===0,onClick:()=>x(m?new Set:new Set(t.map(n=>n.id))),className:"text-xs font-medium text-oai-gray-500 underline-offset-2 hover:underline disabled:opacity-40 dark:text-oai-gray-400",children:r("pet.codex.select_all")}),e.jsxs("button",{type:"button",disabled:a||s.size===0,onClick:()=>d([...s]),className:"flex h-9 items-center gap-1.5 rounded-lg bg-oai-black px-4 text-xs font-semibold text-white transition-colors disabled:bg-oai-gray-200 disabled:text-oai-gray-400 dark:bg-white dark:text-black dark:disabled:bg-oai-gray-800 dark:disabled:text-oai-gray-500",children:[a?e.jsx(W,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):null,s.size>0?`${r("pet.codex.import")} · ${s.size}`:r("pet.codex.import")]})]})]})})]})})}function st(){const{available:t,settings:a,setSetting:l}=De(),{pets:d,loading:p,available:s,refresh:x}=Ke(),[u,m]=o.useState(""),[n,h]=o.useState(""),[c,j]=o.useState(!1),[L,P]=o.useState([]),[Z,z]=o.useState(!1),[w,_]=o.useState(!1),[J,I]=o.useState(""),[Q,K]=o.useState("idle-living"),[B,Y]=o.useState(!0),y=a.character||"clawd",A=de(),V=A.settings?.menuBarIconStyle==="pet",G=d.find(i=>i.id===y)||d[0],N=c?{kind:"busy",text:r("pet.import.busy")}:n?{kind:"error",text:n}:null,R=L.length!==0;o.useEffect(()=>{!p&&d.length>0&&!d.some(i=>i.id===y)&&l("character","clawd")},[p,d,y,l]);async function S(i,g=r("pet.import.success")){j(!0),h("");try{const f=await i();await x(),f?.pet?.id&&l("character",f.pet.id),U({title:g,timeout:4e3}),m("")}catch(f){h(f?.message||r("pet.import.failed"))}finally{j(!1)}}const D=o.useCallback(async()=>{if(!s){P([]);return}try{const i=await Le();P(i.importable)}catch{P([])}},[s]);o.useEffect(()=>{D()},[D]);async function ee(i){_(!0),I("");try{return await _e(i),await x(),await D(),U({title:r("pet.codex.imported"),timeout:4e3}),!0}catch(g){return I(g?.message||r("pet.import.failed")),!1}finally{_(!1)}}o.useEffect(()=>{if(!B)return;const i=window.setInterval(()=>{K(g=>{const f=v.findIndex(ae=>ae.id===g);return v[(f+1)%v.length].id})},5e3);return()=>window.clearInterval(i)},[B]);const te=[{value:"small",label:r("pet.size.small")},{value:"medium",label:r("pet.size.medium")},{value:"large",label:r("pet.size.large")}];return e.jsx("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:e.jsx("main",{className:"flex-1 pb-14 pt-8 sm:pt-10",children:e.jsxs("div",{className:"mx-auto max-w-5xl px-4 sm:px-6",children:[e.jsx(F,{y:12,children:e.jsxs("header",{className:"mb-8",children:[e.jsx("h1",{className:"text-3xl font-semibold tracking-tight sm:text-4xl",children:r("pet.page.title")}),e.jsx("p",{className:"mt-2 max-w-2xl text-sm leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:r("pet.page.subtitle")})]})}),e.jsx(F,{y:12,delay:.04,children:e.jsxs("div",{className:"overflow-hidden rounded-[28px] border border-oai-gray-200 bg-white/75 dark:border-oai-gray-800 dark:bg-oai-gray-900/60 lg:grid lg:grid-cols-[1.12fr_0.88fr]",children:[e.jsx(Re,{pet:G,state:Q,onStateChange:i=>{Y(!1),K(i)}}),e.jsxs("aside",{className:"flex flex-col border-t border-oai-gray-200 p-5 dark:border-oai-gray-800 lg:min-h-[480px] lg:border-l lg:border-t-0",children:[e.jsxs("section",{"aria-labelledby":"pet-character-title",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"pet-character-title",className:"text-sm font-semibold",children:r("pet.characters.title")}),e.jsx("p",{className:"mt-1 text-xs leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:r("pet.characters.subtitle")})]}),e.jsx("div",{className:"mt-4 grid max-h-72 grid-cols-2 gap-2 overflow-y-auto pr-1 -mr-1",children:d.map(i=>e.jsx(X,{character:i,selected:y===i.id,onSelect:()=>l("character",i.id),removeDisabled:c,onRemove:s&&i.custom?()=>S(async()=>(await Me(i.id),y===i.id&&l("character","clawd"),null),r("pet.import.removed")):void 0},i.id))}),A.available?e.jsxs("div",{className:"mt-4 flex items-center justify-between gap-3 rounded-xl border border-oai-gray-200/70 bg-oai-gray-50/60 px-3 py-2.5 dark:border-oai-gray-800 dark:bg-oai-gray-900/40",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-xs font-semibold",children:r("pet.menubar.title")}),e.jsx("p",{className:"mt-0.5 text-[11px] leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:r("pet.menubar.hint")})]}),e.jsx(O,{checked:V,onChange:()=>A.setSetting("menuBarIconStyle",V?"clawd":"pet"),ariaLabel:r("pet.menubar.title")})]}):null]}),s?e.jsxs("section",{className:"mt-6 border-t border-oai-gray-200/70 pt-5 dark:border-oai-gray-800","aria-labelledby":"pet-import-title",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ie,{className:"h-4 w-4 shrink-0 text-oai-gray-500","aria-hidden":!0}),e.jsx("h2",{id:"pet-import-title",className:"text-sm font-semibold",children:r("pet.import.title")})]}),e.jsx("p",{className:"mt-1 text-xs leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:e.jsx(Ve,{})}),e.jsxs("form",{className:"mt-3 flex gap-2",onSubmit:i=>{i.preventDefault(),!c&&u.trim()&&S(()=>Ee(u))},children:[e.jsxs("label",{className:"relative flex min-w-0 flex-1 items-center",children:[e.jsx(xe,{className:"pointer-events-none absolute left-3 h-3.5 w-3.5 text-oai-gray-400","aria-hidden":!0}),e.jsx("input",{value:u,onChange:i=>m(i.target.value),"aria-label":r("pet.import.url_label"),placeholder:"codex-pets.net/#/pets/…",className:"h-9 w-full rounded-lg border border-oai-gray-200 bg-white pl-9 pr-3 text-xs outline-none focus:border-oai-brand-500 dark:border-oai-gray-700 dark:bg-oai-gray-950"})]}),e.jsxs("button",{type:"submit",disabled:c||!u.trim(),className:"flex h-9 shrink-0 items-center gap-1.5 rounded-lg bg-oai-black px-3.5 text-xs font-semibold text-white transition-colors disabled:bg-oai-gray-200 disabled:text-oai-gray-400 dark:bg-white dark:text-black dark:disabled:bg-oai-gray-800 dark:disabled:text-oai-gray-500",children:[c?e.jsx(W,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):null,r("pet.import.add")]})]}),e.jsxs("div",{className:b("mt-2 grid gap-2",R?"grid-cols-2":"grid-cols-1"),children:[R?e.jsxs("button",{type:"button",disabled:c||w,onClick:()=>{I(""),z(!0)},className:b("flex h-9 cursor-pointer items-center justify-center gap-1.5 rounded-lg border border-dashed border-oai-gray-300 text-xs font-medium text-oai-gray-500 transition-colors hover:border-oai-gray-500 hover:text-oai-black dark:border-oai-gray-600 dark:text-oai-gray-400 dark:hover:border-oai-gray-400 dark:hover:text-white",(c||w)&&"pointer-events-none opacity-40"),children:[e.jsx(pe,{provider:"codex",size:14,className:"fill-current"}),r("pet.codex.browse")]}):null,e.jsxs("label",{onDragOver:i=>i.preventDefault(),onDrop:i=>{if(i.preventDefault(),c)return;const g=i.dataTransfer?.files?.[0];g&&S(()=>$(g))},className:b("flex h-9 cursor-pointer items-center justify-center gap-1.5 rounded-lg border border-dashed border-oai-gray-300 text-xs font-medium text-oai-gray-500 transition-colors hover:border-oai-gray-500 hover:text-oai-black dark:border-oai-gray-600 dark:text-oai-gray-400 dark:hover:border-oai-gray-400 dark:hover:text-white",c&&"pointer-events-none opacity-40"),children:[e.jsx(Se,{className:"h-3.5 w-3.5","aria-hidden":!0}),r("pet.import.zip"),e.jsx("input",{type:"file",accept:".zip,.codex-pet.zip,application/zip",className:"sr-only",disabled:c,onChange:i=>{const g=i.target.files?.[0];g&&S(()=>$(g)),i.target.value=""}})]})]}),N?e.jsx("p",{role:N.kind==="error"?"alert":"status",className:b("mt-2 text-xs",N.kind==="error"?"text-red-600 dark:text-red-400":"text-oai-gray-500 dark:text-oai-gray-400"),children:N.text}):null,Z?e.jsx(Ue,{pets:L,busy:w,error:J,onClose:()=>{w||z(!1)},onImport:async i=>{await ee(i)&&z(!1)}}):null]}):null,e.jsxs("section",{className:"mt-6 border-t border-oai-gray-200/70 pt-5 dark:border-oai-gray-800",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Pe,{className:"h-4 w-4 text-oai-gray-500 dark:text-oai-gray-400",strokeWidth:1.75,"aria-hidden":!0}),e.jsx("h2",{className:"text-sm font-semibold",children:r("pet.controls.title")})]}),e.jsxs("div",{className:"mt-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("div",{className:"text-sm font-medium",children:r("pet.controls.show")}),e.jsx(O,{checked:a.visible,onChange:()=>l("visible",!a.visible),disabled:!t,ariaLabel:r("pet.controls.show")})]}),e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("div",{className:"text-sm font-medium",children:r("pet.controls.size")}),e.jsx("div",{className:"shrink-0",children:e.jsx(ce,{options:te,value:a.size,onChange:i=>l("size",i),disabled:!t})})]})]})]}),t?null:e.jsxs("div",{className:"mt-6 flex gap-2 rounded-xl bg-oai-gray-100 p-3 text-xs leading-relaxed text-oai-gray-500 dark:bg-oai-gray-800/70 dark:text-oai-gray-400",children:[e.jsx(ue,{className:"mt-0.5 h-3.5 w-3.5 shrink-0","aria-hidden":!0}),r("pet.controls.native_only")]})]})]})})]})})})}export{st as PetPage};
import{aH as Xe,aQ as Ue,aR as le,aS as Ke,P as ne,aG as ge,r as m,aT as J,aU as me,aV as he,aW as oe,aD as Re,aX as We,aY as we,aE as z,A as $,aZ as W,a1 as ue,ax as pe,aF as qe,a_ as Ee,a$ as ze,E as Qe,b0 as $e,b1 as Te,V as q,j as V,aC as Je,W as Me,aK as Ze,b2 as et,b3 as tt,b4 as nt,b5 as ot,y as st,z as Ae,b6 as rt,b7 as ye,aA as it,b8 as at,b9 as ct,aB as lt,az as ut,ba as ft,ay as dt}from"./__vite-browser-external-CeOnjjgl.js";import{n as Pe,o as Le,q as He,r as Ce,v as se,P as pt,w as gt,k as mt,s as ht,x as Et,y as Tt,e as Pt,f as Ct,g as vt,h as Rt,a as Be,j as St,u as bt,z as Ot,A as It,t as Mt,B as yt,I as xt,D as Ft,c as kt,d as wt,b as At,p as Lt}from"./useScrollLock-Ct5GyoVg.js";import{c as Ht,p as Bt,a as Dt}from"./store-BLjK5TrP.js";import{a as _t,b as jt,c as Nt,d as Vt,e as Yt,f as Gt,g as Xt,h as Ut}from"./ToolbarRootContext-Bs1pZOOn.js";function Kt(e,n){return n!=null&&!Pe(n)?0:typeof e=="function"?e():e}function ve(e,n,t){const l=Kt(e,t);return typeof l=="number"?l:l?.[n]}function xe(e){return typeof e=="function"?e():e}function De(e,n){return n||e==="click"||e==="mousedown"}function Wt(e){return e?.includes("mouse")&&e!=="mousedown"}class Se{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new le,this.restTimeout=new le,this.handleCloseOptions=void 0}static create(){return new Se}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}const fe=new WeakMap;function de(e){if(!e.performedPointerEventsMutation)return;const n=e.pointerEventsScopeElement;n&&fe.get(n)===e&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),fe.delete(n)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function _e(e,n){const{scopeElement:t,referenceElement:l,floatingElement:i}=n,o=fe.get(t);o&&o!==e&&de(o),de(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=t,e.pointerEventsReferenceElement=l,e.pointerEventsFloatingElement=i,fe.set(t,e),t.style.pointerEvents="none",l.style.pointerEvents="auto",i.style.pointerEvents="auto"}function je(e){const n=e.context.dataRef.current,t=Xe(()=>n.hoverInteractionState??Se.create()).current;return n.hoverInteractionState||(n.hoverInteractionState=t),Ue(n.hoverInteractionState.disposeEffect),n.hoverInteractionState}function qt(e,n={}){const{enabled:t=!0,closeDelay:l=0,nodeId:i}=n,o="rootStore"in e?e.rootStore:e,p=o.useState("open"),E=o.useState("floatingElement"),b=o.useState("domReferenceElement"),{dataRef:c}=o.context,r=Le(),O=He(),h=je(o),N=Ke(),u=ne(()=>De(c.current.openEvent?.type,h.interactedInside)),B=ne(()=>Wt(c.current.openEvent?.type)),g=ne(()=>{de(h)});ge(()=>{p||(h.pointerType=void 0,h.restTimeoutPending=!1,h.interactedInside=!1,g())},[p,h,g]),m.useEffect(()=>g,[g]),ge(()=>{if(t&&p&&h.handleCloseOptions?.blockPointerEvents&&B()&&J(b)&&E){const x=b,a=E,d=me(E),F=r?.nodesRef.current.find(R=>R.id===O)?.context?.elements.floating;F&&(F.style.pointerEvents="");const H=h.pointerEventsScopeElement!==a?h.pointerEventsScopeElement:null,P=F!==a?F:null,v=h.handleCloseOptions?.getScope?.()??H??P??x.closest("[data-rootownerid]")??d.body;return _e(h,{scopeElement:v,referenceElement:x,floatingElement:a}),()=>{g()}}},[t,p,b,E,h,B,r,O,g]),m.useEffect(()=>{if(!t)return;function x(){return!!(r&&O&&Ce(r.nodesRef.current,O).length>0)}function a(R){const M=ve(l,"close",h.pointerType),_=()=>{o.setOpen(!1,$(W,R)),r?.events.emit("floating.closed",R)};M?h.openChangeTimeout.start(M,_):(h.openChangeTimeout.clear(),_())}function d(R){const M=Re(R);if(!We(M)){h.interactedInside=!1;return}h.interactedInside=M?.closest("[aria-haspopup]")!=null}function F(){h.openChangeTimeout.clear(),N.clear(),r?.events.off("floating.closed",P),g()}function H(R){if(x()&&r){r.events.on("floating.closed",P);return}if(we(R.relatedTarget,o.context.triggerElements))return;const M=c.current.floatingContext?.nodeId??i,_=R.relatedTarget;if(!(r&&M&&J(_)&&Ce(r.nodesRef.current,M,!1).some(X=>z(X.context?.elements.floating,_)))){if(h.handler){h.handler(R);return}g(),B()&&!u()&&a(R)}}function P(R){!r||!O||x()||N.start(0,()=>{r.events.off("floating.closed",P),o.setOpen(!1,$(W,R)),r.events.emit("floating.closed",R)})}const v=E;return he(v&&oe(v,"mouseenter",F),v&&oe(v,"mouseleave",H),v&&oe(v,"pointerdown",d,!0),()=>{r?.events.off("floating.closed",P)})},[t,E,o,c,l,i,B,u,g,h,r,O,N])}const zt={current:null};function Qt(e,n={}){const{enabled:t=!0,delay:l=0,handleClose:i=null,mouseOnly:o=!1,restMs:p=0,move:E=!0,triggerElementRef:b=zt,externalTree:c,isActiveTrigger:r=!0,getHandleCloseContext:O,isClosing:h,shouldOpen:N}=n,u="rootStore"in e?e.rootStore:e,{dataRef:B,events:g}=u.context,x=Le(c),a=je(u),d=m.useRef(!1),F=se(i),H=se(l),P=se(p),v=se(t),R=se(N),M=se(h),_=ne(()=>De(B.current.openEvent?.type,a.interactedInside)),G=ne(()=>R.current?.()!==!1),X=ne((s,T,A)=>{const S=u.context.triggerElements;if(S.hasElement(T))return!s||!z(s,T);if(!J(A))return!1;const f=A;return S.hasMatchingElement(L=>z(L,f))&&(!s||!z(s,f))}),j=ne(()=>{if(!a.handler)return;me(u.select("domReferenceElement")).removeEventListener("mousemove",a.handler),a.handler=void 0}),w=ne(()=>{de(a)});return r&&(a.handleCloseOptions=F.current?.__options),m.useEffect(()=>j,[j]),m.useEffect(()=>{if(!t)return;function s(T){T.open?d.current=!1:(d.current=T.reason===W,j(),a.openChangeTimeout.clear(),a.restTimeout.clear(),a.blockMouseMove=!0,a.restTimeoutPending=!1)}return g.on("openchange",s),()=>{g.off("openchange",s)}},[t,g,a,j]),m.useEffect(()=>{if(!t)return;function s(f,L=!0){const D=ve(H.current,"close",a.pointerType);D?a.openChangeTimeout.start(D,()=>{u.setOpen(!1,$(W,f)),x?.events.emit("floating.closed",f)}):L&&(a.openChangeTimeout.clear(),u.setOpen(!1,$(W,f)),x?.events.emit("floating.closed",f))}const T=b.current??(r?u.select("domReferenceElement"):null);if(!J(T))return;function A(f){if(a.openChangeTimeout.clear(),a.blockMouseMove=!1,o&&!Pe(a.pointerType))return;const L=xe(P.current),D=ve(H.current,"open",a.pointerType),Y=Re(f),U=f.currentTarget??null,I=u.select("domReferenceElement");let k=U;if(J(Y)&&!u.context.triggerElements.hasElement(Y)){for(const Ie of u.context.triggerElements.elements())if(z(Ie,Y)){k=Ie;break}}J(U)&&J(I)&&!u.context.triggerElements.hasElement(U)&&z(U,I)&&(k=I);const C=k==null?!1:X(I,k,Y),Q=u.select("open"),Z=M.current?.()??u.select("transitionStatus")==="ending",K=!Q&&Z&&d.current,ee=!C&&J(k)&&J(I)&&z(I,k)&&K,te=L>0&&!D,Ge=C&&(Q||K)||ee,Oe=!Q||C;if(Ge){G()&&u.setOpen(!0,$(W,f,k));return}te||(D?a.openChangeTimeout.start(D,()=>{Oe&&G()&&u.setOpen(!0,$(W,f,k))}):Oe&&G()&&u.setOpen(!0,$(W,f,k)))}function S(f){if(_()){w();return}j();const L=u.select("domReferenceElement"),D=me(L);a.restTimeout.clear(),a.restTimeoutPending=!1;const Y=B.current.floatingContext??O?.();if(we(f.relatedTarget,u.context.triggerElements))return;if(F.current&&Y){u.select("open")||a.openChangeTimeout.clear();const I=b.current;a.handler=F.current({...Y,tree:x,x:f.clientX,y:f.clientY,onClose(){w(),j(),v.current&&!_()&&I===u.select("domReferenceElement")&&s(f,!0)}}),D.addEventListener("mousemove",a.handler),a.handler(f);return}(a.pointerType!=="touch"||!z(u.select("floatingElement"),f.relatedTarget))&&s(f)}return E?he(oe(T,"mousemove",A,{once:!0}),oe(T,"mouseenter",A),oe(T,"mouseleave",S)):he(oe(T,"mouseenter",A),oe(T,"mouseleave",S))},[j,w,B,H,u,t,F,a,r,X,_,o,E,P,b,x,v,O,M,G]),m.useMemo(()=>{if(!t)return;function s(T){a.pointerType=T.pointerType}return{onPointerDown:s,onPointerEnter:s,onMouseMove(T){const{nativeEvent:A}=T,S=T.currentTarget,f=u.select("domReferenceElement"),L=u.select("open"),D=X(f,S,T.target);if(o&&!Pe(a.pointerType))return;if(L&&D&&a.handleCloseOptions?.blockPointerEvents){const I=u.select("floatingElement");if(I){const k=a.handleCloseOptions?.getScope?.()??S.ownerDocument.body;_e(a,{scopeElement:k,referenceElement:S,floatingElement:I})}}const Y=xe(P.current);if(L&&!D||Y===0||!D&&a.restTimeoutPending&&T.movementX**2+T.movementY**2<2)return;a.restTimeout.clear();function U(){if(a.restTimeoutPending=!1,_())return;const I=u.select("open");!a.blockMouseMove&&(!I||D)&&G()&&u.setOpen(!0,$(W,A,S))}a.pointerType==="touch"?ue.flushSync(()=>{U()}):D&&L?U():(a.restTimeoutPending=!0,a.restTimeout.start(Y,U))}}},[t,a,_,X,o,u,P,G])}const Fe=.1,$t=Fe*Fe,y=.5;function ie(e,n,t,l,i,o){return l>=n!=o>=n&&e<=(i-t)*(n-l)/(o-l)+t}function ae(e,n,t,l,i,o,p,E,b,c){let r=!1;return ie(e,n,t,l,i,o)&&(r=!r),ie(e,n,i,o,p,E)&&(r=!r),ie(e,n,p,E,b,c)&&(r=!r),ie(e,n,b,c,t,l)&&(r=!r),r}function Jt(e,n,t){return e>=t.x&&e<=t.x+t.width&&n>=t.y&&n<=t.y+t.height}function ce(e,n,t,l,i,o){const p=Math.min(t,i),E=Math.max(t,i),b=Math.min(l,o),c=Math.max(l,o);return e>=p&&e<=E&&n>=b&&n<=c}function Zt(e={}){const{blockPointerEvents:n=!1}=e,t=new le,l=({x:i,y:o,placement:p,elements:E,onClose:b,nodeId:c,tree:r})=>{const O=p?.split("-")[0];let h=!1,N=null,u=null,B=typeof performance<"u"?performance.now():0;function g(a,d){const F=performance.now(),H=F-B;if(N===null||u===null||H===0)return N=a,u=d,B=F,!1;const P=a-N,v=d-u,R=P*P+v*v,M=H*H*$t;return N=a,u=d,B=F,R<M}function x(){t.clear(),b()}return function(d){t.clear();const F=E.domReference,H=E.floating;if(!F||!H||O==null||i==null||o==null)return;const{clientX:P,clientY:v}=d,R=Re(d),M=d.type==="mouseleave",_=z(H,R),G=z(F,R);if(_&&(h=!0,!M))return;if(G&&(h=!1,!M)){h=!0;return}if(M&&J(d.relatedTarget)&&z(H,d.relatedTarget))return;function X(){return!!(r&&Ce(r.nodesRef.current,c).length>0)}function j(){X()||x()}if(X())return;const w=F.getBoundingClientRect(),s=H.getBoundingClientRect(),T=i>s.right-s.width/2,A=o>s.bottom-s.height/2,S=s.width>w.width,f=s.height>w.height,L=(S?w:s).left,D=(S?w:s).right,Y=(f?w:s).top,U=(f?w:s).bottom;if(O==="top"&&o>=w.bottom-1||O==="bottom"&&o<=w.top+1||O==="left"&&i>=w.right-1||O==="right"&&i<=w.left+1){j();return}let I=!1;switch(O){case"top":I=ce(P,v,L,w.top+1,D,s.bottom-1);break;case"bottom":I=ce(P,v,L,s.top+1,D,w.bottom-1);break;case"left":I=ce(P,v,s.right-1,U,w.left+1,Y);break;case"right":I=ce(P,v,w.right-1,U,s.left+1,Y);break}if(I)return;if(h&&!Jt(P,v,w)){j();return}if(!M&&g(P,v)){j();return}let k=!1;switch(O){case"top":{const C=S?y/2:y*4,Q=S||T?i+C:i-C,Z=S?i-C:T?i+C:i-C,K=o+y+1,ee=T||S?s.bottom-y:s.top,te=T?S?s.bottom-y:s.top:s.bottom-y;k=ae(P,v,Q,K,Z,K,s.left,ee,s.right,te);break}case"bottom":{const C=S?y/2:y*4,Q=S||T?i+C:i-C,Z=S?i-C:T?i+C:i-C,K=o-y,ee=T||S?s.top+y:s.bottom,te=T?S?s.top+y:s.bottom:s.top+y;k=ae(P,v,Q,K,Z,K,s.left,ee,s.right,te);break}case"left":{const C=f?y/2:y*4,Q=f||A?o+C:o-C,Z=f?o-C:A?o+C:o-C,K=i+y+1,ee=A||f?s.right-y:s.left,te=A?f?s.right-y:s.left:s.right-y;k=ae(P,v,ee,s.top,te,s.bottom,K,Q,K,Z);break}case"right":{const C=f?y/2:y*4,Q=f||A?o+C:o-C,Z=f?o-C:A?o+C:o-C,K=i-y,ee=A||f?s.left+y:s.right,te=A?f?s.left+y:s.right:s.left+y;k=ae(P,v,K,Q,K,Z,ee,s.top,te,s.bottom);break}}k?h||t.start(40,j):j()}};return l.__options={...e,blockPointerEvents:n},l}const Ne=m.createContext(void 0);function re(e){const n=m.useContext(Ne);if(n===void 0&&!e)throw new Error(pe(47));return n}function en(){return{...Dt(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}const tn={...Bt,disabled:q(e=>e.disabled),instantType:q(e=>e.instantType),openMethod:q(e=>e.openMethod),openChangeReason:q(e=>e.openChangeReason),modal:q(e=>e.modal),focusManagerModal:q(e=>e.focusManagerModal),stickIfOpen:q(e=>e.stickIfOpen),titleElementId:q(e=>e.titleElementId),descriptionElementId:q(e=>e.descriptionElementId),openOnHover:q(e=>e.openOnHover),closeDelay:q(e=>e.closeDelay),hasViewport:q(e=>e.hasViewport)};class be extends qe{constructor(n,t,l=!1){const i={...en(),...n},o=new pt;i.open&&n?.mounted===void 0&&(i.mounted=!0),i.floatingRootContext=Ht(o,t,l),super(i,{popupRef:m.createRef(),backdropRef:m.createRef(),internalBackdropRef:m.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:m.createRef(),beforeContentFocusGuardRef:m.createRef(),stickIfOpenTimeout:new le,triggerElements:o},tn)}setOpen=(n,t)=>{const l=t.reason===W,i=t.reason===Ee&&t.event.detail===0,o=!n&&(t.reason===ze||t.reason==null),p=gt(t),E=this.select("activeTriggerId");if(!n&&t.reason===Qe&&t.trigger==null&&E!=null&&(t.trigger=this.context.triggerElements.getById(E)??this.select("activeTriggerElement")??void 0),this.context.onOpenChange?.(n,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(n,t);const b=()=>{const c={open:n,openChangeReason:t.reason};ht(c,n,t.trigger,p()),this.update(c)};l?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start($e,()=>{this.set("stickIfOpen",!1)}),ue.flushSync(b)):b(),i||o?this.set("instantType",i?"click":"dismiss"):t.reason===Te?this.set("instantType","focus"):this.set("instantType",void 0)};static useStore(n,t){const{store:l,internalStore:i}=mt(n,(o,p)=>new be(t,o,p));return m.useEffect(()=>i?.disposeEffect(),[i]),l}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()}function ke({props:e}){const{children:n,open:t,defaultOpen:l=!1,onOpenChange:i,onOpenChangeComplete:o,modal:p=!1,handle:E,triggerId:b,defaultTriggerId:c=null}=e,r=be.useStore(E?.store,{modal:p,open:l,openProp:t,activeTriggerId:c,triggerIdProp:b});Tt(r,t,l,c),r.useControlledProp("openProp",t),r.useControlledProp("triggerIdProp",b);const O=r.useState("open"),h=r.useState("mounted"),N=r.useState("payload"),u=He()!=null;r.useContextCallback("onOpenChange",i),r.useContextCallback("onOpenChangeComplete",o),Pt(r,O),Ct(r);const{forceUnmount:B}=vt(O,r,()=>{r.update({stickIfOpen:!0,openChangeReason:null})});r.useSyncedValues({modal:p,nested:u}),m.useEffect(()=>{O||r.context.stickIfOpenTimeout.clear()},[r,O]);const g=m.useCallback(()=>{r.setOpen(!1,$(Je))},[r]);m.useImperativeHandle(e.actionsRef,()=>({unmount:B,close:g}),[B,g]);const x=O||h,a=m.useMemo(()=>({store:r}),[r]);return V.jsxs(Ne.Provider,{value:a,children:[x&&V.jsx(nn,{store:r,modal:p}),typeof n=="function"?n({payload:N}):n]})}function hn(e){return re(!0)?V.jsx(ke,{props:e}):V.jsx(Et,{children:V.jsx(ke,{props:e})})}function nn({store:e,modal:n}){const t=e.useState("floatingRootContext"),l=Rt(t,{outsidePressEvent:{mouse:n==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),i=l.reference??Me,o=l.trigger??Me,p=m.useMemo(()=>Ze(Be,l.floating),[l.floating]);return St(e,{activeTriggerProps:i,inactiveTriggerProps:o,popupProps:p}),null}const on=300;function sn(e,n){const t=m.useRef(null);function l(o){ue.flushSync(()=>{e.setOpen(!1,$(Te,o.nativeEvent,o.currentTarget))}),ot(t.current)?.focus()}function i(o){const p=e.select("positionerElement");if(p&&et(o,p))e.context.beforeContentFocusGuardRef.current?.focus();else{ue.flushSync(()=>{e.setOpen(!1,$(Te,o.nativeEvent,o.currentTarget))});let E=tt(e.context.triggerFocusTargetRef.current||n.current);for(;E!==null&&z(p,E);){const b=E;if(E=nt(E),E===b)break}E?.focus()}}return{preFocusGuardRef:t,handlePreFocusGuardFocus:l,handleFocusTargetFocus:i}}const En=m.forwardRef(function(n,t){const{render:l,className:i,style:o,disabled:p=!1,nativeButton:E=!0,handle:b,payload:c,openOnHover:r=!1,delay:O=on,closeDelay:h=0,id:N,...u}=n,B=re(!0),g=b?.store??B?.store;if(!g)throw new Error(pe(74));const x=bt(N),a=g.useState("isTriggerActive",x),d=g.useState("floatingRootContext"),F=g.useState("isOpenedByTrigger",x),H=g.useState("triggerPopupId",x),P=m.useRef(null),{registerTrigger:v,isMountedByThisTrigger:R}=Ot(x,P,g,{payload:c,disabled:p,openOnHover:r,closeDelay:h}),M=g.useState("openChangeReason"),_=g.useState("stickIfOpen"),G=g.useState("openMethod"),X=g.useState("focusManagerModal"),j=Qt(d,{enabled:!p&&d!=null&&r&&(G!=="touch"||M!==Ee),mouseOnly:!0,move:!1,handleClose:Zt(),restMs:O,delay:{close:h},triggerElementRef:P,isActiveTrigger:a,isClosing:()=>g.select("transitionStatus")==="ending"}),w=_t(d,{enabled:d!=null,stickIfOpen:_}),s=jt(()=>g.select("open"),k=>{g.set("openMethod",k)}),T=g.useState("triggerProps",R),{getButtonProps:A,buttonRef:S}=st({disabled:p,native:E}),f={open(k){return k&&M===Ee?It.open(k):Mt.open(k)}},{preFocusGuardRef:L,handlePreFocusGuardFocus:D,handleFocusTargetFocus:Y}=sn(g,P),I=Ae("button",n,{state:{disabled:p,open:F},ref:[S,t,v,P],props:[w.reference,j,T,s,{[rt]:"",id:x,"aria-haspopup":"dialog","aria-expanded":F,"aria-controls":H},u,A],stateAttributesMapping:f});return R&&!X?V.jsxs(m.Fragment,{children:[V.jsx(ye,{ref:L,onFocus:D}),V.jsx(m.Fragment,{children:I},x),V.jsx(ye,{ref:g.context.triggerFocusTargetRef,onFocus:Y})]}):V.jsx(m.Fragment,{children:I},x)}),Ve=m.createContext(void 0);function rn(){const e=m.useContext(Ve);if(e===void 0)throw new Error(pe(45));return e}const Tn=m.forwardRef(function(n,t){const{keepMounted:l=!1,...i}=n,{store:o}=re();return o.useState("mounted")||l?V.jsx(Ve.Provider,{value:l,children:V.jsx(it,{ref:t,...i})}):null}),Ye=m.createContext(void 0);function an(){const e=m.useContext(Ye);if(!e)throw new Error(pe(46));return e}const Pn=m.forwardRef(function(n,t){const{render:l,className:i,style:o,anchor:p,positionMethod:E="absolute",side:b="bottom",align:c="center",sideOffset:r=0,alignOffset:O=0,collisionBoundary:h="clipping-ancestors",collisionPadding:N=5,arrowPadding:u=5,sticky:B=!1,disableAnchorTracking:g=!1,collisionAvoidance:x=at,...a}=n,{store:d}=re(),F=rn(),H=yt(),P=d.useState("floatingRootContext"),v=d.useState("mounted"),R=d.useState("open"),M=d.useState("openChangeReason"),_=d.useState("activeTriggerElement"),G=d.useState("modal"),X=d.useState("openMethod"),j=d.useState("positionerElement"),w=d.useState("instantType"),s=d.useState("transitionStatus"),T=d.useState("hasViewport"),A=m.useRef(null),S=ct(j,!1,!1),f=Nt({anchor:p,floatingRootContext:P,positionMethod:E,mounted:v,side:b,sideOffset:r,align:c,alignOffset:O,arrowPadding:u,collisionBoundary:h,collisionPadding:N,sticky:B,disableAnchorTracking:g,keepMounted:F,nodeId:H,collisionAvoidance:x,adaptiveOrigin:T?Gt:void 0}),L=P.useState("domReferenceElement");ge(()=>{const I=L,k=A.current;if(I&&(A.current=I),k&&I&&I!==k){d.set("instantType",void 0);const C=new AbortController;return S(()=>{d.set("instantType","trigger-change")},C.signal),()=>{C.abort()}}},[L,S,d]),Vt(R&&G===!0&&M!==W,X==="touch",j,_);const D=m.useCallback(I=>{d.set("positionerElement",I)},[d]),Y={open:R,side:f.side,align:f.align,anchorHidden:f.anchorHidden,instant:w},U=Yt(n,Y,{styles:f.positionerStyles,transitionStatus:s,props:a,refs:[t,D],hidden:!v,inert:!R});return V.jsxs(Ye.Provider,{value:f,children:[v&&G===!0&&M!==W&&V.jsx(xt,{ref:d.context.internalBackdropRef,inert:lt(!R),cutout:_}),V.jsx(Ft,{id:H,children:U})]})}),cn=m.createContext(void 0);function ln(){const[e,n]=m.useState(0),t=ne(()=>(n(i=>i+1),()=>{n(i=>Math.max(0,i-1))}));return{context:m.useMemo(()=>({register:t}),[t]),hasClosePart:e>0}}function un(e){const{value:n,children:t}=e;return V.jsx(cn.Provider,{value:n,children:t})}const fn={...Lt,...dt},Cn=m.forwardRef(function(n,t){const{render:l,className:i,style:o,initialFocus:p,finalFocus:E,...b}=n,{store:c}=re(),r=an(),O=Xt()!=null,{context:h,hasClosePart:N}=ln(),u=c.useState("open"),B=c.useState("openMethod"),g=c.useState("instantType"),x=c.useState("transitionStatus"),a=c.useState("popupProps"),d=c.useState("titleElementId"),F=c.useState("descriptionElementId"),H=c.useState("modal"),P=c.useState("mounted"),v=c.useState("openChangeReason"),R=c.useState("activeTriggerElement"),M=c.useState("floatingRootContext"),_=M.useState("floatingId"),G=c.useState("disabled"),X=c.useState("openOnHover"),j=c.useState("closeDelay"),w=b.id??_;ut({open:u,ref:c.context.popupRef,onComplete(){u&&c.context.onOpenChangeComplete?.(!0)}}),qt(M,{enabled:X&&!G,closeDelay:j});const s=p===void 0?kt(c.context.popupRef):p,T=H!==!1&&N;c.useSyncedValue("focusManagerModal",T);const A=m.useCallback(L=>{c.set("popupElement",L)},[c]),S={open:u,side:r.side,align:r.align,instant:g,transitionStatus:x},f=Ae("div",n,{state:S,ref:[t,c.context.popupRef,A],props:[a,{id:w,role:"dialog",...Be,"aria-labelledby":d,"aria-describedby":F,onKeyDown(L){O&&At.has(L.key)&&L.stopPropagation()}},Ut(x),b],stateAttributesMapping:fn});return V.jsx(wt,{context:M,openInteractionType:B,modal:T,disabled:!P||v===W,initialFocus:s,returnFocus:E,restoreFocus:"popup",previousFocusableElement:ft(R)?R:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:V.jsx(un,{value:h,children:f})})});export{hn as P,En as a,Tn as b,Pn as c,Cn as d};
import{l as Ne,r as i,j as e,c as o,Y as Ie,aa as He,a3 as Ge,X as Oe,a1 as qe,m as Ke}from"./__vite-browser-external-CeOnjjgl.js";import{u as Ze}from"./useCurrency-BS_xyhhg.js";import{u as Ee}from"./useTokenFormat-RvsCI_oE.js";import{M as Ve}from"./maximize-2-6nkX0TnZ.js";import{T as Je}from"./terminal-Dbn_YmPM.js";import{I as Qe}from"./info-CkFEh5Zu.js";const et=[["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"}]],tt=Ne("pause",et);const at=[["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"}]],rt=Ne("play",at);const ot=[["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"}]],nt=Ne("rotate-ccw",ot),ae={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 st(l,u){const h=/^#([0-9a-f]{6})$/i.exec(l);if(!h)return l;const c=parseInt(h[1],16),b=c>>16&255,Y=c>>8&255,D=c&255,R=$=>Math.max(0,Math.min(255,Math.round($*u)));return`rgb(${R(b)}, ${R(Y)}, ${R(D)})`}function q(l,u,h,c,b){const Y=Math.cos(c),D=Math.sin(c),R=l*Y-u*D,$=l*D+u*Y,S=h,E=Math.cos(b),A=Math.sin(b),K=R,p=$*E-S*A,v=$*A+S*E;return{x:K,y:p,z:v}}function lt(l,u,h,c,b){return q(l,u,h,c,b)}function Se(l,u,h=c=>Number(c).toLocaleString()){const c=h(u);if(l>=4){const b=Math.floor(Math.random()*3)+1;return o(`heatmap.3d.voxel.joke.${b}`,{value:c})}else return l===3?o("heatmap.3d.voxel.level3",{value:c}):l===2?o("heatmap.3d.voxel.level2",{value:c}):l===1?o("heatmap.3d.voxel.level1",{value:c}):o("heatmap.3d.voxel.level0")}function Ae({weeks:l,palette:u="auto",isDark:h=!1,interactive:c=!1,autoRotateInit:b=!1,onResetViewRef:Y=null}){const{formatTokens:D,formatTokensTooltip:R}=Ee(),$=ae[u]||(u==="auto"?ae.emerald:null),S=$?h?$.dark:$.light:Array.isArray(u)?u:h?ae.emerald.dark:ae.emerald.light,E=$?h?$.gridColor.dark:$.gridColor.light:h?"rgba(255,255,255,0.06)":"rgba(0,0,0,0.06)",A=-.2,K=.88,[p,v]=i.useState({yaw:A,pitch:K}),[le,Z]=i.useState(b),[he,L]=i.useState(1),j=c?13:10.5,fe=i.useMemo(()=>{const t=[],r=l.length;if(r===0||!c)return[];for(let n=0;n<=7;n++){const s=(n-3.5)*j,d=q(-r/2*j,s,0,p.yaw,p.pitch),x=q(r/2*j,s,0,p.yaw,p.pitch);t.push({d:`M${d.x},${d.y} L${x.x},${x.y}`,key:`horiz-${n}`})}for(let n=0;n<=r;n+=4){const s=(n-r/2)*j,d=q(s,-3.5*j,0,p.yaw,p.pitch),x=q(s,3.5*j,0,p.yaw,p.pitch);t.push({d:`M${d.x},${d.y} L${x.x},${x.y}`,key:`vert-${n}`})}if(r%4!==0){const n=(r-r/2)*j,s=q(n,-3.5*j,0,p.yaw,p.pitch),d=q(n,3.5*j,0,p.yaw,p.pitch);t.push({d:`M${s.x},${s.y} L${d.x},${d.y}`,key:"vert-last"})}return t},[l.length,p,j,c]);i.useEffect(()=>{Y&&(Y.current={reset:()=>{v({yaw:A,pitch:K}),Z(!1),L(1),be()},toggleAutoRotate:t=>{Z(t)}})},[Y]);const V=i.useRef(null),I=i.useRef(null),B=i.useRef(!1),ie=i.useRef({x:0,y:0}),J=i.useRef({yaw:A,pitch:K}),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),Q=i.useRef(null),se=i.useRef(!0);i.useEffect(()=>(se.current=!0,()=>{se.current=!1}),[]);const be=()=>{Q.current&&cancelAnimationFrame(Q.current),ye(0);const t=performance.now(),r=1200,n=s=>{if(!se.current)return;const d=s-t,x=Math.min(1,d/r),C=1-Math.pow(1-x,3);ye(C),x<1?Q.current=requestAnimationFrame(n):Q.current=null};Q.current=requestAnimationFrame(n)};i.useEffect(()=>(be(),()=>{Q.current&&cancelAnimationFrame(Q.current)}),[c]),i.useEffect(()=>{if(!le||B.current||typeof window>"u"||typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches)return;let r;const n=()=>{if(typeof document<"u"&&document.visibilityState==="hidden"){r=requestAnimationFrame(n);return}v(s=>({yaw:s.yaw+.002,pitch:s.pitch})),r=requestAnimationFrame(n)};return r=requestAnimationFrame(n),()=>cancelAnimationFrame(r)},[le]);const ce=(t,r)=>{c&&(B.current=!0,ie.current={x:t,y:r},J.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(!B.current)return;const n=t-ie.current.x,s=r-ie.current.y,d=performance.now(),x=d-oe.current.time;x>0&&(U.current={x:(t-oe.current.x)/x,y:(r-oe.current.y)/x}),oe.current={x:t,y:r,time:d};const C=.005,T=J.current.yaw-n*C,k=Math.PI/2.3,y=Math.max(-k,Math.min(k,J.current.pitch-s*C));v({yaw:T,pitch:y})},ve=()=>{if(!B.current)return;B.current=!1;let t=-U.current.x*12,r=-U.current.y*12;const n=.95,s=()=>{B.current||(t*=n,r*=n,!(Math.abs(t)<.01&&Math.abs(r)<.01)&&(v(d=>{const x=d.yaw+t*.005,C=Math.PI/2.3,T=Math.max(-C,Math.min(C,d.pitch+r*.005));return{yaw:x,pitch:T}}),ne.current=requestAnimationFrame(s)))};ne.current=requestAnimationFrame(s)},[f,de]=i.useState(null),[ee,ue]=i.useState({x:0,y:0,shiftX:0}),g=i.useRef(null);i.useEffect(()=>()=>{g.current&&clearTimeout(g.current)},[]),i.useEffect(()=>{if(!c||!I.current)return;const t=n=>{n.preventDefault();const s=-n.deltaY*.0025;L(d=>{const x=d+s;return Math.max(.5,Math.min(3,x))})},r=I.current;return r.addEventListener("wheel",t,{passive:!1}),()=>{r.removeEventListener("wheel",t)}},[c]);const _=i.useMemo(()=>{const t=[];return l.forEach((r,n)=>{(Array.isArray(r)?r:[]).forEach((s,d)=>{s&&t.push({key:s.day||`${n}-${d}`,col:n,row:d,level:s.level||0,value:s.value||0,day:s.day,models:s.models||null})})}),t},[l]),pe=j-(c?1.8:1.5),ke=c?38:28,we=t=>Math.max(1.8,Number(t)/4*ke),te=i.useMemo(()=>{if(_.length===0)return[];const t=l.length;return _.map(r=>{const n=we(r.level),s=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)),x=s/d*.4,C=Math.min(1,Math.max(0,(ge-x)*(1/.6))),T=n*C,k=(r.col-t/2)*j,y=(r.row-3.5)*j,w=pe/2,G=[{x:k-w,y:y-w,z:0},{x:k+w,y:y-w,z:0},{x:k+w,y:y+w,z:0},{x:k-w,y:y+w,z:0},{x:k-w,y:y-w,z:T},{x:k+w,y:y-w,z:T},{x:k+w,y:y+w,z:T},{x:k-w,y:y+w,z:T}].map(W=>q(W.x,W.y,W.z,p.yaw,p.pitch)),xe=q(k,y,T/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=S[Math.min(4,Math.max(0,Number(r.level)||0))],ze=[],Ye=.35,De=-.4,Ue=.83;return Le.forEach(W=>{const je=lt(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`,Fe=je.x*Ye+je.y*De+je.z*Ue,We=h?.18:0,Be=W.scale*(.82+.28*Math.max(0,Fe))+We;ze.push({name:W.name,d:Xe,fill:st(Pe,Be)})}}),{...r,centerProj:xe,renderedFaces:ze}})},[_,p,S,l.length,ge,j,pe,ke]),O=i.useMemo(()=>[...te].sort((t,r)=>t.centerProj.z-r.centerProj.z),[te]),M=i.useMemo(()=>{if(O.length===0)return{minX:-100,minY:-100,maxX:100,maxY:100};let t=1/0,r=1/0,n=-1/0,s=-1/0;return O.forEach(d=>{const x=j*2,C=d.centerProj.x,T=d.centerProj.y;C-x<t&&(t=C-x),C+x>n&&(n=C+x),T-x<r&&(r=T-x),T+x>s&&(s=T+x)}),{minX:t,minY:r,maxX:n,maxY:s}},[O,j]),P=12,me=M.maxX-M.minX+P*2,a=M.maxY-M.minY+P*2,m=me/he,z=a/he,N=M.minX-P+(me-m)/2,F=M.minY-P+(a-z)/2,H=`${N} ${F} ${m} ${z}`;return _.length===0?e.jsx("div",{className:"py-8 text-center text-sm text-oai-gray-500",children:o("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;ce(t.clientX,t.clientY);const r=s=>X(s.clientX,s.clientY),n=()=>{ve(),window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",n)};window.addEventListener("mousemove",r),window.addEventListener("mouseup",n)},onTouchStart:t=>{!c||t.touches.length===0||ce(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:V,viewBox:H,width:c?"95%":"100%",height:c?"95%":"auto",role:"img","aria-label":o("heatmap.iso.aria")||"3D interactive activity heatmap",style:{display:"block",width:"100%",height:"auto",maxWidth:c?"none":`${me}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:E,strokeWidth:.25,strokeDasharray:"1.5 2.5",strokeLinecap:"round"},t.key)),O.map(t=>{const r=f&&f.key===t.key;return e.jsxs("g",{onMouseEnter:n=>{if(g.current&&(clearTimeout(g.current),g.current=null),de(t),c&&V.current){const s=q((t.col-l.length/2)*j,(t.row-3.5)*j,we(t.level),p.yaw,p.pitch);let d=0,x=0;const C=V.current;if(I.current&&typeof C.createSVGPoint=="function"&&typeof C.getScreenCTM=="function")try{const w=C.createSVGPoint();w.x=s.x,w.y=s.y;const re=C.getScreenCTM();if(re){const G=w.matrixTransform(re),xe=I.current.getBoundingClientRect();d=G.x-xe.left,x=G.y-xe.top}}catch{const re=C.getBoundingClientRect(),G=M.maxX-M.minX+P*2,xe=M.maxY-M.minY+P*2;d=(s.x-(M.minX-P))/G*re.width,x=(s.y-(M.minY-P))/xe*re.height}else{const w=C.getBoundingClientRect(),re=M.maxX-M.minX+P*2,G=M.maxY-M.minY+P*2;d=(s.x-(M.minX-P))/re*w.width,x=(s.y-(M.minY-P))/G*w.height}const T=140;let k=0;const y=I.current?I.current.getBoundingClientRect().width:C.getBoundingClientRect().width;d<T?k=T-d:d>y-T&&(k=y-T-d),ue({x:d,y:x,shiftX:k})}},onMouseLeave:()=>{g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{de(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:o("heatmap.tooltip.tokens",{day:t.day,value:R(t.value)})}),t.renderedFaces.map((n,s)=>e.jsx("path",{d:n.d,fill:n.fill,stroke:n.fill,strokeWidth:.25,strokeLinejoin:"round"},s))]},t.key)})]}),c&&f&&e.jsxs("div",{onMouseEnter:()=>{g.current&&(clearTimeout(g.current),g.current=null)},onMouseLeave:()=>{g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{de(null)},150)},className:"absolute z-[9999] w-0 h-0 transition-all duration-100 ease-out",style:{left:`${ee.x}px`,top:`${ee.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% + ${ee.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:f.day}),(()=>{const t=f.level===0?h?"#9ca3af":"#6b7280":S[f.level];return e.jsx("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:o("heatmap.tooltip.level",{level:f.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(f.value),className:"text-lg font-bold text-oai-gray-900 dark:text-white leading-none",children:D(f.value)}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 uppercase tracking-wider font-semibold",children:o("heatmap.unit.tokens")})]}),f.models&&Object.keys(f.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:o("heatmap.tooltip.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(f.models).map(([t,r])=>({name:t,val:Number(r)})).sort((t,r)=>r.val-t.val).map(({name:t,val:r})=>{const n=Number(f.value)||1,s=Math.round(r/n*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:D(r)}),e.jsxs("span",{className:"text-[9px] text-oai-gray-450 dark:text-oai-gray-500 min-w-[28px] text-right font-medium",children:[s,"%"]})]})]}),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:`${s}%`,backgroundColor:S[4],boxShadow:`0 0 4px ${S[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:Se(f.level,f.value,D)})]})]}),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 it=12,ct=3,dt=26,mt=["#ebedf0","#a7f3d0","#6ee7b7","#34d399","#10b981"],xt=["#121212","#065f46","#059669","#10b981","#34d399"];function ut(l){if(typeof l!="string")return null;const u=/^(\d{4})-(\d{2})-(\d{2})$/.exec(l.trim());if(!u)return null;const h=new Date(Date.UTC(Number(u[1]),Number(u[2])-1,Number(u[3])));return Number.isFinite(h.getTime())?h:null}function Re(l,u){return new Date(Date.UTC(l.getUTCFullYear(),l.getUTCMonth(),l.getUTCDate()+u))}function pt(l,u){return Math.floor((Date.UTC(u.getUTCFullYear(),u.getUTCMonth(),u.getUTCDate())-Date.UTC(l.getUTCFullYear(),l.getUTCMonth(),l.getUTCDate()))/864e5)}function ht(l,u){const h=u==="mon"?1:0,c=l.getUTCDay();return Re(l,-((c-h+7)%7))}function ft(l,u,h,c){if(!l)return[];const b=ut(u)||new Date,Y=[];for(let E=11;E>=0;E-=1)Y.push(new Date(Date.UTC(b.getUTCFullYear(),b.getUTCMonth()-E,1)));const D=ht(b,h),R=Re(D,-(l-1)*7),$=[],S=new Set;for(const E of Y){const A=Math.floor(pt(R,E)/7);A<0||A>=l||S.has(A)||(S.add(A),$.push({label:c[E.getUTCMonth()],index:A}))}return $}function Ct({heatmap:l,timeZoneLabel:u,timeZoneShortLabel:h,hideLegend:c=!1,embedded:b=!1}){const{resolvedTheme:Y}=Ie(),{currency:D,rate:R}=Ze(),{formatTokens:$,formatTokensTooltip:S}=Ee(),E=Y==="dark",A=E?xt:mt,K=i.useRef(null),p=i.useRef(null),[v,le]=i.useState(null),[Z,he]=i.useState({x:0,y:0,shiftX:0,flipY:!1}),L=i.useRef(null);i.useEffect(()=>()=>{L.current&&clearTimeout(L.current)},[]);const[j,fe]=i.useState(!1),[V,I]=i.useState(!1),[B,ie]=i.useState(!1),J=i.useRef(null),[U,oe]=i.useState("emerald"),ne=[o("heatmap.month.jan"),o("heatmap.month.feb"),o("heatmap.month.mar"),o("heatmap.month.apr"),o("heatmap.month.may"),o("heatmap.month.jun"),o("heatmap.month.jul"),o("heatmap.month.aug"),o("heatmap.month.sep"),o("heatmap.month.oct"),o("heatmap.month.nov"),o("heatmap.month.dec")],ge=(a,m)=>{if(!m||!m.day)return;L.current&&(clearTimeout(L.current),L.current=null),le(m);const z=a.currentTarget.getBoundingClientRect(),N=typeof window<"u"?window.innerWidth:1024,F=z.left+z.width/2,H=z.top<300,t=H?z.bottom:z.top,r=140;let n=0;F<r?n=r-F:F>N-r&&(n=N-r-F),he({x:F,y:t,shiftX:n,flipY:H})},ye=()=>{L.current&&clearTimeout(L.current),L.current=setTimeout(()=>{le(null)},150)},Q=()=>{I(!1),fe(!0)},se=()=>{I(!0)},be=a=>{a.target===a.currentTarget&&V&&(fe(!1),I(!1))};i.useEffect(()=>{if(!j||V)return;const a=m=>{m.key==="Escape"&&se()};return window.addEventListener("keydown",a),()=>{window.removeEventListener("keydown",a)}},[j,V]);const ce=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=ce[U]||ce.emerald,ve=ae[U]?E?ae[U].dark:ae[U].light:E?ae.emerald.dark:ae.emerald.light,[f,de]=i.useState(()=>{if(b)return"2d";try{return window.localStorage?.getItem("tt:heatmap-view")==="3d"?"3d":"2d"}catch{return"2d"}});i.useEffect(()=>{if(!b)try{window.localStorage?.setItem("tt:heatmap-view",f)}catch{}},[f,b]),i.useEffect(()=>{if(f!=="2d")return;const a=K.current;a&&(a.scrollLeft=a.scrollWidth)},[l?.weeks,f]),i.useEffect(()=>{const a=K.current;if(!a)return;const m=()=>{L.current&&(clearTimeout(L.current),L.current=null),le(null)};return a.addEventListener("scroll",m),()=>a.removeEventListener("scroll",m)},[]);const ee=l?.week_starts_on==="mon"?"mon":"sun",ue=i.useMemo(()=>{const a=Array.isArray(l?.weeks)?l.weeks:[];if(!a.length)return{weeks:[]};const m=[];for(const z of a)for(const N of Array.isArray(z)?z:[])N?.day&&m.push({day:N.day,total_tokens:N.total_tokens??N.value??0,billable_total_tokens:N.billable_total_tokens??N.value??N.total_tokens??0,models:N.models??null});return He({dailyRows:m,weeks:Math.max(52,a.length),to:l?.to,weekStartsOn:ee})},[l?.to,l?.weeks,ee]),g=ue?.weeks||[],_=i.useMemo(()=>{let a=0,m=0,z={day:null,value:0},N=0,F=0;const H=[];g.forEach(k=>{(Array.isArray(k)?k:[]).forEach(y=>{y&&y.day&&H.push(y)})}),H.sort((k,y)=>k.day.localeCompare(y.day)),H.forEach(k=>{const y=Number(k.value)||0;a+=y,y>0?(m++,N++,N>F&&(F=N)):N=0,y>z.value&&(z={day:k.day,value:y})});const t=H.length||365,r=(m/t*100).toFixed(1);let n="heatmap.3d.modal.ai.eval.default",s="heatmap.3d.modal.ai.title.default";a>=15e6?(s="heatmap.3d.modal.ai.title.peak",n="heatmap.3d.modal.ai.eval.peak"):a>=5e6?(s="heatmap.3d.modal.ai.title.heavy",n="heatmap.3d.modal.ai.eval.heavy"):a>=1e6?(s="heatmap.3d.modal.ai.title.core",n="heatmap.3d.modal.ai.eval.core"):a>=2e4&&(s="heatmap.3d.modal.ai.title.steady",n="heatmap.3d.modal.ai.eval.steady");const d=l?.total_cost_usd,x=Number(d),T=d!=null&&(typeof d!="string"||d.trim()!=="")&&Number.isFinite(x)?x:a/15e5;return{totalTokens:a,activeDays:m,activeRate:r,maxSingleDay:z,maxStreak:F,aiEvaluationTitleKey:s,aiEvaluationKey:n,totalCostUsd:T}},[g,l?.total_cost_usd]),Ce=i.useMemo(()=>Ge(_.totalCostUsd,{currency:D,rate:R}),[_.totalCostUsd,D,R]),pe=a=>$(a,{mode:Ke.COMPACT,decimals:2}),ke=ee==="mon"?["Mon","Tue","Wed","Thu","Fri","Sat","Sun"].map(a=>o(`heatmap.day.${a.toLowerCase()}`)):["Sun","Mon","Tue","Wed","Thu","Fri","Sat"].map(a=>o(`heatmap.day.${a.toLowerCase()}`)),we=i.useMemo(()=>ft(g.length,ue?.to,ee,ne),[ue?.to,g.length,ee,ne]);if(!g.length)return e.jsx("div",{className:"py-8 text-center text-sm text-oai-gray-500",children:o("heatmap.empty")});const te=b?10:it,O=b?2:ct,M=b?22:dt,P=M+g.length*te+Math.max(0,g.length-1)*O,me=`${M}px repeat(${g.length}, ${te}px)`;return e.jsxs("div",{ref:p,className:b?"relative":"relative rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-5",children:[!b&&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:o("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":f==="2d",onClick:()=>de("2d"),className:f==="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:o("heatmap.view.2d")}),e.jsx("button",{type:"button",role:"tab","aria-selected":f==="3d",onClick:()=>de("3d"),className:f==="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:o("heatmap.view.3d")})]}),e.jsx("span",{className:"text-xs text-oai-gray-400 dark:text-oai-gray-450",children:h||o("heatmap.legend.utc")})]})]}),f==="3d"&&e.jsxs("div",{onClick:Q,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:o("heatmap.3d.hover_tip"),children:[e.jsx(Ae,{weeks:g,isDark:E,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(Ve,{size:9}),o("heatmap.3d.hover_tip")]})})]}),f==="2d"&&e.jsx("div",{ref:K,className:`overflow-x-auto overflow-y-hidden heatmap-scroll-thin${b?"":" pb-1"}`,children:e.jsxs("div",{style:{minWidth:P},children:[e.jsxs("div",{className:"grid text-[10px] uppercase text-oai-gray-400 dark:text-oai-gray-400 mb-1",style:{gridTemplateColumns:me,columnGap:O},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:me,columnGap:O},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, ${te}px)`,rowGap:O},children:ke.map(a=>e.jsx("span",{className:"leading-none",children:a},a))}),e.jsx("div",{className:"grid",style:{gridAutoFlow:"column",gridTemplateRows:`repeat(7, ${te}px)`,gap:O},children:g.map((a,m)=>(Array.isArray(a)?a:[]).map((z,N)=>{if(!z)return null;const F=z.day||`e-${m}-${N}`,H=Number(z.level)||0,t=A[H]||A[0];return e.jsx("span",{onMouseEnter:r=>ge(r,z),onMouseLeave:ye,className:"rounded-[2px] transition-transform hover:scale-125 hover:z-10 cursor-pointer",style:{width:te,height:te,background:t}},F)}))})]})]})}),!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:o("heatmap.legend.less")}),e.jsx("div",{className:"flex gap-0.5",children:A.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:o("heatmap.legend.more")})]}),j&&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 ${V?"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 ${V?"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:o("heatmap.3d.modal.eyebrow")})]}),e.jsx("h4",{className:"text-xl font-black text-zinc-900 dark:text-zinc-50 tracking-tight leading-none mt-2 select-none",children:o("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:o("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:o("heatmap.3d.modal.stats.precision_total_tokens")}),e.jsxs("span",{className:"mt-0.5 font-bold text-zinc-900 dark:text-zinc-50",children:[S(_.totalTokens)," ",o("heatmap.unit.tokens")]})]})}),e.jsx("span",{className:"text-[9px] font-bold text-zinc-400 dark:text-zinc-500 uppercase tracking-widest font-mono",children:o("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:pe(_.totalTokens)}),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:o("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:o("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:[_.activeRate,"%"," ",e.jsxs("span",{className:"text-[10px] font-bold text-zinc-400 dark:text-zinc-500 font-mono",children:["(",_.activeDays,o("heatmap.3d.modal.stats.days_suffix"),")"]})]})]}),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:o("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:[_.maxStreak," ",e.jsx("span",{className:"text-[10px] font-bold text-amber-500/80 font-mono",children:o("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:o("heatmap.3d.modal.stats.precision_peak_value")}),e.jsx("span",{className:"mt-0.5 font-bold text-zinc-900 dark:text-zinc-50",children:_.maxSingleDay.value>0?`${S(_.maxSingleDay.value)} ${o("heatmap.unit.tokens")}`:o("heatmap.3d.modal.stats.no_data")}),e.jsx("span",{className:"text-[8px] text-zinc-400 dark:text-zinc-500 mt-0.5",children:_.maxSingleDay.day||o("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:o("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:[_.maxSingleDay.value>0?pe(_.maxSingleDay.value):o("heatmap.3d.modal.stats.no_data")," ",e.jsxs("span",{className:"text-[10px] font-bold text-zinc-400 dark:text-zinc-500 font-mono",children:["(",_.maxSingleDay.day||o("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(Je,{size:11,style:{color:X.rawColor}}),e.jsx("span",{className:"text-[9px] font-extrabold uppercase tracking-widest font-mono",style:{color:X.rawColor},children:o(_.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:o(_.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:o("heatmap.3d.modal.legend.title")}),e.jsx("span",{className:"text-[10px] font-medium text-zinc-500 dark:text-zinc-400",children:o(`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:o("heatmap.tooltip.level",{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(ce).map(a=>{const m=U===a;return e.jsx("button",{type:"button",onClick:()=>oe(a),title:o(`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=!B;ie(a),J.current&&J.current.toggleAutoRotate(a)},title:B?o("heatmap.3d.modal.control.pause"):o("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 ${B?X.accentText:"text-oai-gray-400 hover:text-oai-gray-600 dark:hover:text-oai-gray-250"}`,children:B?e.jsx(tt,{size:12}):e.jsx(rt,{size:12})}),e.jsx("button",{type:"button",onClick:()=>{ie(!1),J.current&&J.current.reset()},title:o("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(nt,{size:12})})]})]}),e.jsx(Ae,{weeks:g,isDark:E,interactive:!0,palette:U,autoRotateInit:B,onResetViewRef:J}),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(Qe,{size:10,className:X.accentText}),e.jsx("span",{children:o("heatmap.3d.modal.footer.tip")})]})]})]})}),v&&!j&&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:`${Z.x}px`,top:`${Z.y}px`},children:[e.jsxs("div",{className:`absolute left-0 ${Z.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% + ${Z.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:v.day}),(()=>{const a=v.level===0?E?"#9ca3af":"#6b7280":A[v.level];return e.jsx("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:o("heatmap.tooltip.level",{level:v.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:S(v.total_tokens??v.value),className:"text-lg font-bold text-oai-gray-900 dark:text-white leading-none",children:$(v.total_tokens??v.value)}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 uppercase tracking-wider font-semibold",children:o("heatmap.unit.tokens")})]}),v.models&&Object.keys(v.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:o("heatmap.tooltip.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(v.models).map(([a,m])=>({name:a,val:Number(m)})).sort((a,m)=>m.val-a.val).map(({name:a,val:m})=>{const z=Number(v.total_tokens??v.value)||1,N=Math.round(m/z*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:S(m),className:"font-mono text-oai-gray-900 dark:text-oai-gray-100 font-semibold",children:$(m)}),e.jsxs("span",{className:"text-[9px] text-oai-gray-450 dark:text-oai-gray-500 min-w-[28px] text-right font-medium",children:[N,"%"]})]})]}),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:`${N}%`,backgroundColor:A[4],boxShadow:`0 0 4px ${A[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:Se(v.level,v.total_tokens??v.value,$)})]})]}),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 ${Z.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:Z.flipY?{marginTop:"1px"}:{marginBottom:"1px"}})]}),document.body),e.jsx("style",{children:`
@keyframes tt-fade-in {
from { opacity: 0; }
to { opacity: 1; }
}
@keyframes tt-fade-out {
from { opacity: 1; }
to { opacity: 0; }
}
@keyframes tt-modal-entrance {
from {
opacity: 0;
transform: scale(0.96) translateY(10px);
}
to {
opacity: 1;
transform: scale(1) translateY(0);
}
}
@keyframes tt-modal-exit {
from {
opacity: 1;
transform: scale(1) translateY(0);
}
to {
opacity: 0;
transform: scale(0.96) translateY(10px);
}
}
.animate-tt-fade-in {
animation: tt-fade-in 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.animate-tt-fade-out {
animation: tt-fade-out 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.animate-tt-modal {
animation: tt-modal-entrance 0.3s cubic-bezier(0.34, 1.3, 0.64, 1) forwards;
}
.animate-tt-modal-exit {
animation: tt-modal-exit 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
`})]})}const gt={anythingllm:"AnythingLLM",pianthropic:"Pi · Anthropic",pigithubcopilot:"Pi · GitHub Copilot",picopilot:"Pi · Copilot"};function yt(l){return String(l||"").trim().toLowerCase().replace(/[\s_-]+/g,"")}function zt(l){const u=String(l||"").trim();if(!u)return"";const h=gt[yt(u)];return h||u.charAt(0).toUpperCase()+u.slice(1)}export{Ct as A,zt as f};
import{j as l}from"./__vite-browser-external-CeOnjjgl.js";function s({size:c=16,className:r=""}){return l.jsx("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:r,children:l.jsx("path",{d:"M4.709 15.955l4.72-2.647.08-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0 11.784l.055-.352.48-.321.686.06 1.52.103 2.278.158 1.652.097 2.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686 1.908 1.476 2.491 1.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97 2.97 0 01-.104-.729L6.283.134 6.696 0l.996.134.42.364.62 1.414 1.002 2.229 1.555 3.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.376-.91.747-.492.584.28.48.685-.067.444-.286 1.851-.559 2.903-.364 1.942h.212l.243-.242.985-1.306 1.652-2.064.73-.82.85-.904.547-.431h1.033l.76 1.129-.34 1.166-1.064 1.347-.881 1.142-1.264 1.7-.79 1.36.073.11.188-.02 2.856-.606 1.543-.28 1.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.049.061 1.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093 1.068 2.006 1.81 2.509 2.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649 2.345 3.521.122 1.08-.17.353-.608.213-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674 7.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434 1.967-2.18 2.945-1.726 1.845-.414.164-.717-.37.067-.662.401-.589 2.388-3.036 1.44-1.882.93-1.086-.006-.158h-.055L4.132 18.56l-1.13.146-.487-.456.061-.746.231-.243 1.908-1.312-.006.006z"})})}function h({size:c=16,className:r=""}){return l.jsx("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",className:r,children:l.jsx("path",{d:"M8.086.457a6.105 6.105 0 013.046-.415c1.333.153 2.521.72 3.564 1.7a.117.117 0 00.107.029c1.408-.346 2.762-.224 4.061.366l.063.03.154.076c1.357.703 2.33 1.77 2.918 3.198.278.679.418 1.388.421 2.126a5.655 5.655 0 01-.18 1.631.167.167 0 00.04.155 5.982 5.982 0 011.578 2.891c.385 1.901-.01 3.615-1.183 5.14l-.182.22a6.063 6.063 0 01-2.934 1.851.162.162 0 00-.108.102c-.255.736-.511 1.364-.987 1.992-1.199 1.582-2.962 2.462-4.948 2.451-1.583-.008-2.986-.587-4.21-1.736a.145.145 0 00-.14-.032c-.518.167-1.04.191-1.604.185a5.924 5.924 0 01-2.595-.622 6.058 6.058 0 01-2.146-1.781c-.203-.269-.404-.522-.551-.821a7.74 7.74 0 01-.495-1.283 6.11 6.11 0 01-.017-3.064.166.166 0 00.008-.074.115.115 0 00-.037-.064 5.958 5.958 0 01-1.38-2.202 5.196 5.196 0 01-.333-1.589 6.915 6.915 0 01.188-2.132c.45-1.484 1.309-2.648 2.577-3.493.282-.188.55-.334.802-.438.286-.12.573-.22.861-.304a.129.129 0 00.087-.087A6.016 6.016 0 015.635 2.31C6.315 1.464 7.132.846 8.086.457zm-.804 7.85a.848.848 0 00-1.473.842l1.694 2.965-1.688 2.848a.849.849 0 001.46.864l1.94-3.272a.849.849 0 00.007-.854l-1.94-3.393zm5.446 6.24a.849.849 0 000 1.695h4.848a.849.849 0 000-1.696h-4.848z"})})}function x({size:c=16,className:r=""}){return l.jsx("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:r,children:l.jsx("path",{d:"M22.106 5.68L12.5.135a.998.998 0 00-.998 0L1.893 5.68a.84.84 0 00-.419.726v11.186c0 .3.16.577.42.727l9.607 5.547a.999.999 0 00.998 0l9.608-5.547a.84.84 0 00.42-.727V6.407a.84.84 0 00-.42-.726zm-.603 1.176L12.228 22.92c-.063.108-.228.064-.228-.061V12.34a.59.59 0 00-.295-.51l-9.11-5.26c-.107-.062-.063-.228.062-.228h18.55c.264 0 .428.286.296.514z"})})}function v({size:c=16,className:r=""}){return l.jsx("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:r,children:l.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z"})})}function u({size:c=16,className:r=""}){return l.jsx("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:r,children:l.jsx("path",{d:"M9.27 15.29l7.978-5.897c.391-.29.95-.177 1.137.272.98 2.369.542 5.215-1.41 7.169-1.951 1.954-4.667 2.382-7.149 1.406l-2.711 1.257c3.889 2.661 8.611 2.003 11.562-.953 2.341-2.344 3.066-5.539 2.388-8.42l.006.007c-.983-4.232.242-5.924 2.75-9.383.06-.082.12-.164.179-.248l-3.301 3.305v-.01L9.267 15.292M7.623 16.723c-2.792-2.67-2.31-6.801.071-9.184 1.761-1.763 4.647-2.483 7.166-1.425l2.705-1.25a7.808 7.808 0 00-1.829-1A8.975 8.975 0 005.984 5.83c-2.533 2.536-3.33 6.436-1.962 9.764 1.022 2.487-.653 4.246-2.34 6.022-.599.63-1.199 1.259-1.682 1.925l7.62-6.815"})})}function C({size:c=16,className:r=""}){return l.jsx("svg",{width:c,height:c,viewBox:"0 -1 22 28",fill:"currentColor",fillRule:"evenodd",className:r,children:l.jsx("path",{d:"M4.125 20.149c-2.69 5.959 3.036 7.453 7.26 3.966 1.24 3.91 5.898.993 7.569-2.036 3.682-6.678 2.195-13.49 1.813-14.895-2.617-9.582-15.699-9.592-17.95.049-.526 1.687-.535 3.606-.833 5.598-.15 1.005-.256 1.646-.645 2.703-.223.607-.53 1.147-1.014 2.056-.75 1.412-.434 4.138 3.434 2.724v.001ZM11.895 11.332c-1.073 0-1.234-1.283-1.234-2.048 0-.69.124-1.239.358-1.586a1 1 0 0 1 .876-.462c.375 0 .697.158.924.47.259.354.395.9.395 1.578 0 1.283-.493 2.048-1.319 2.048Zm4.416 0c-1.073 0-1.234-1.283-1.234-2.048 0-.69.124-1.239.358-1.586a1 1 0 0 1 .876-.462c.375 0 .697.158.924.47.259.354.396.9.396 1.578 0 1.283-.494 2.048-1.32 2.048Z"})})}function g({size:c=16,className:r=""}){return l.jsx("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:r,children:l.jsx("path",{d:"M16 6H8v12h8V6zm4 16H4V2h16v20z"})})}function f({size:c=16,className:r=""}){return l.jsxs("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:r,children:[l.jsx("path",{d:"M21.846 0a1.923 1.923 0 110 3.846H20.15a.226.226 0 01-.227-.226V1.923C19.923.861 20.784 0 21.846 0z"}),l.jsx("path",{d:"M11.065 11.199l7.257-7.2c.137-.136.06-.41-.116-.41H14.3a.164.164 0 00-.117.051l-7.82 7.756c-.122.12-.302.013-.302-.179V3.82c0-.127-.083-.23-.185-.23H3.186c-.103 0-.186.103-.186.23V19.77c0 .128.083.23.186.23h2.69c.103 0 .186-.102.186-.23v-3.25c0-.069.025-.135.069-.178l2.424-2.406a.158.158 0 01.205-.023l6.484 4.772a7.677 7.677 0 003.453 1.283c.108.012.2-.095.2-.23v-3.06c0-.117-.07-.212-.164-.227a5.028 5.028 0 01-2.027-.807l-5.613-4.064c-.117-.078-.132-.279-.028-.381z"})]})}function j({size:c=16,className:r=""}){return l.jsx("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:r,"aria-hidden":"true",children:l.jsx("path",{d:"M16.278 2c1.156 0 2.093.927 2.093 2.07v12.501a.74.74 0 00.744.709.74.74 0 00.743-.709V9.099a2.06 2.06 0 012.071-2.049A2.06 2.06 0 0124 9.1v6.561a.649.649 0 01-.652.645.649.649 0 01-.653-.645V9.1a.762.762 0 00-.766-.758.762.762 0 00-.766.758v7.472a2.037 2.037 0 01-2.048 2.026 2.037 2.037 0 01-2.048-2.026v-12.5a.785.785 0 00-.788-.753.785.785 0 00-.789.752l-.001 15.904A2.037 2.037 0 0113.441 22a2.037 2.037 0 01-2.048-2.026V18.04c0-.356.292-.645.652-.645.36 0 .652.289.652.645v1.934c0 .263.142.506.372.638.23.131.514.131.744 0a.734.734 0 00.372-.638V4.07c0-1.143.937-2.07 2.093-2.07zm-5.674 0c1.156 0 2.093.927 2.093 2.07v11.523a.648.648 0 01-.652.645.648.648 0 01-.652-.645V4.07a.785.785 0 00-.789-.78.785.785 0 00-.789.78v14.013a2.06 2.06 0 01-2.07 2.048 2.06 2.06 0 01-2.071-2.048V9.1a.762.762 0 00-.766-.758.762.762 0 00-.766.758v3.8a2.06 2.06 0 01-2.071 2.049A2.06 2.06 0 010 12.9v-1.378c0-.357.292-.646.652-.646.36 0 .653.29.653.646V12.9c0 .418.343.757.766.757s.766-.339.766-.757V9.099a2.06 2.06 0 012.07-2.048 2.06 2.06 0 012.071 2.048v8.984c0 .419.343.758.767.758.423 0 .766-.339.766-.758V4.07c0-1.143.937-2.07 2.093-2.07z"})})}function w({size:c=16,className:r=""}){return l.jsx("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:r,children:l.jsx("path",{d:"M19.245 5.364c1.322 1.36 1.877 3.216 2.11 5.817.622 0 1.2.135 1.592.654l.73.964c.21.278.323.61.323.955v2.62c0 .339-.173.669-.453.868C20.239 19.602 16.157 21.5 12 21.5c-4.6 0-9.205-2.583-11.547-4.258-.28-.2-.452-.53-.453-.868v-2.62c0-.345.113-.679.321-.956l.73-.963c.392-.517.974-.654 1.593-.654l.029-.297c.25-2.446.81-4.213 2.082-5.52 2.461-2.54 5.71-2.851 7.146-2.864h.198c1.436.013 4.685.323 7.146 2.864zm-7.244 4.328c-.284 0-.613.016-.962.05-.123.447-.305.85-.57 1.108-1.05 1.023-2.316 1.18-2.994 1.18-.638 0-1.306-.13-1.851-.464-.516.165-1.012.403-1.044.996a65.882 65.882 0 00-.063 2.884l-.002.48c-.002.563-.005 1.126-.013 1.69.002.326.204.63.51.765 2.482 1.102 4.83 1.657 6.99 1.657 2.156 0 4.504-.555 6.985-1.657a.854.854 0 00.51-.766c.03-1.682.006-3.372-.076-5.053-.031-.596-.528-.83-1.046-.996-.546.333-1.212.464-1.85.464-.677 0-1.942-.157-2.993-1.18-.266-.258-.447-.661-.57-1.108-.32-.032-.64-.049-.96-.05zm-2.525 4.013c.539 0 .976.426.976.95v1.753c0 .525-.437.95-.976.95a.964.964 0 01-.976-.95v-1.752c0-.525.437-.951.976-.951zm5 0c.539 0 .976.426.976.95v1.753c0 .525-.437.95-.976.95a.964.964 0 01-.976-.95v-1.752c0-.525.437-.951.976-.951zM7.635 5.087c-1.05.102-1.935.438-2.385.906-.975 1.037-.765 3.668-.21 4.224.405.394 1.17.657 1.995.657h.09c.649-.013 1.785-.176 2.73-1.11.435-.41.705-1.433.675-2.47-.03-.834-.27-1.52-.63-1.813-.39-.336-1.275-.482-2.265-.394zm6.465.394c-.36.292-.6.98-.63 1.813-.03 1.037.24 2.06.675 2.47.968.957 2.136 1.104 2.776 1.11h.044c.825 0 1.59-.263 1.995-.657.555-.556.765-3.187-.21-4.224-.45-.468-1.335-.804-2.385-.906-.99-.088-1.875.058-2.265.394zM12 7.615c-.24 0-.525.015-.84.044.03.16.045.336.06.526l-.001.159a2.94 2.94 0 01-.014.25c.225-.022.425-.027.612-.028h.366c.187 0 .387.006.612.028-.015-.146-.015-.277-.015-.409.015-.19.03-.365.06-.526a9.29 9.29 0 00-.84-.044z"})})}function i({size:c=16,className:r=""}){return l.jsxs("svg",{width:c,height:c,viewBox:"0 0 64 60",fill:"none",className:r,"aria-hidden":"true",children:[l.jsx("path",{fill:"currentColor",d:"M37.2114 3.75318C37.6821 3.33106 37.7106 3.31457 38.0558 3.29385C38.6149 3.2531 39.1272 3.52199 39.9989 4.31564C42.0356 6.16652 44.8714 9.97183 46.6346 13.2212L47.3163 14.4819L48.2782 14.9605C49.2072 15.4299 50.7308 16.3923 51.3672 16.9085C51.655 17.1464 51.6956 17.1508 51.9947 17.0344C53.3454 16.5084 55.2803 17.206 56.9869 18.8432C58.5231 20.3155 59.9943 22.8312 60.558 24.9308C60.6403 25.2687 60.7493 25.9952 60.7891 26.5362C60.9177 28.4358 60.3092 29.9532 59.1362 30.64C58.8965 30.7784 58.8801 30.8158 58.8868 31.4132C58.9409 34.2583 58.1741 37.0985 56.6335 39.8679C54.8946 42.9773 51.7981 46.1938 47.6074 49.2243C45.357 50.8619 40.0323 53.964 37.6248 55.0532C31.8578 57.6496 27.2346 58.646 23.2188 58.154C20.8236 57.8638 18.1124 56.9287 16.5082 55.8433C16.086 55.5515 16.0191 55.5329 15.6966 55.6251C13.9793 56.1185 11.73 55.1053 9.81931 52.9844C9.05725 52.1366 7.82714 50.0548 7.42839 48.9409C6.50606 46.3339 6.68976 43.9816 7.91836 42.5767C8.23573 42.2149 8.2453 42.1995 8.17598 41.5912C8.06148 40.5951 8.00971 39.1206 8.06202 38.1692L8.10361 37.2803L6.76977 34.9212C4.70378 31.2451 3.3912 28.1582 2.88489 25.7998C2.61762 24.5066 2.63385 23.9324 2.96214 23.5078C3.16198 23.2515 3.81796 22.9866 4.60785 22.8407C6.59665 22.4917 10.9334 22.8076 15.7581 23.6595L16.259 23.7458L17.3608 22.7713C19.1891 21.1519 20.4038 20.244 22.6429 18.8478C24.9768 17.3876 27.6108 16.1858 30.577 15.2346L31.5295 14.9294L32.0526 13.5561C33.9257 8.61146 35.8437 4.96584 37.2114 3.75318ZM21.5208 29.0919C19.404 30.314 18.3453 30.9251 17.5676 31.6099C14.4179 34.3835 13.2414 38.777 14.5823 42.7537C14.9135 43.7357 15.5247 44.7942 16.7469 46.9111C17.9691 49.0279 18.5801 50.0865 19.2649 50.8643C22.0385 54.014 26.4316 55.1918 30.4084 53.8509C31.3904 53.5198 32.4489 52.9085 34.5657 51.6863L46.7442 44.6551C48.8613 43.4328 49.9205 42.8214 50.6983 42.1365C53.8479 39.363 55.0245 34.9695 53.6835 30.9927C53.3524 30.0107 52.7412 28.9522 51.519 26.8354C50.2968 24.7185 49.6858 23.66 49.0009 22.8822C46.2274 19.7325 41.8342 18.5547 37.8575 19.8956C36.8754 20.2267 35.8163 20.8383 33.6993 22.0606L21.5208 29.0919Z"}),l.jsx("g",{transform:"rotate(-30 22.6953 37.6011)",children:l.jsx("rect",{x:"22.6953",y:"37.6011",width:"4.81084",height:"9.99175",rx:"2.40542",fill:"currentColor"})}),l.jsx("g",{transform:"rotate(-30 35.6748 30.1074)",children:l.jsx("rect",{x:"35.6748",y:"30.1074",width:"4.81084",height:"9.99175",rx:"2.40542",fill:"currentColor"})})]})}function L({size:c=16,className:r=""}){return l.jsxs("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",className:r,children:[l.jsx("path",{d:"M5.938 12.835c.127-.039.285.02.373.143.028.038.036.092.046.14.003.014-.02.033-.04.05-.124-.098-.24-.194-.354-.291-.011-.01-.016-.027-.025-.042zM8.396 9.412c.195-.032.39-.06.588-.05a.54.54 0 01.148.026c.202.071.402.147.601.224.028.01.05.036.075.055l-.013.027a9.203 9.203 0 01-.26-.089c-.115-.038-.213-.077-.315-.098-.25-.05-.25-.046-.292-.014l.574.144c.275.139.55.276.823.417.042.022.09.057.107.098.026.06.063.076.117.072.066-.006.132-.017.213-.027l-.04.086c.051.08.142.02.216.064-.074.13-.247.09-.334.199l.061.074-.12.087c0 .106-.038.168-.306.243l.026.085-.196.042.07.124h-.25l-.007.137c-.081-.01-.161-.018-.244-.027l-.053.123c-.027-.008-.052-.011-.073-.023-.067-.038-.128-.056-.195.006-.019.017-.063.014-.093.008-.026-.006-.05-.029-.07-.042-.11.095-.11.095-.208.003-.057.046-.12.074-.186.011-.063.027-.123-.02-.178-.014-.07.007-.097-.035-.133-.07l-.13.033c-.013-.236-.194-.19-.34-.203.005-.072.05-.092.095-.094a.474.474 0 01.159.022c.164.05.32.12.496.138.203.021.405.029.601-.015.265-.059.52-.149.707-.365.049-.056.083-.127.117-.195.019-.038.02-.084-.02-.116a1.397 1.397 0 00-.382-.217c.024.12-.031.182-.115.221 0 .014-.004.025 0 .03.08.115.084.16-.007.267a1.39 1.39 0 01-.218.211.477.477 0 01-.641-.05 1.36 1.36 0 01-.133-.152c-.078-.107-.076-.108-.033-.236-.165-.08-.128-.226-.104-.364.008-.05.028-.096.049-.163-.04.014-.067.017-.087.032a.897.897 0 00-.316.357c-.007.016-.01.034-.02.047-.012.015-.034.038-.045.035-.02-.006-.037-.027-.05-.045-.008-.012-.007-.032-.012-.057h-.126l.053-.172a14.82 14.82 0 00-.039-.049l.11-.284c-.06.026-.091.044-.124.051-.03.007-.064 0-.095 0 0-.031-.01-.07.004-.092.149-.22.305-.428.593-.476z"}),l.jsx("path",{d:"M8.06 10.788c-.003-.038-.004-.075.037-.062.016.006.034.048.028.067-.01.04-.038.032-.064-.005z"}),l.jsx("path",{d:"M11.981.009c.226-.012.453-.011.679 0 .247.01.495.024.74.062.401.064.798.157 1.19.273.463.138.92.299 1.356.511a7.31 7.31 0 012.948 2.642c.292.469.536.963.739 1.479.219.556.446 1.11.623 1.683.204.654.329 1.326.458 1.997.097.504.182 1.01.29 1.511.156.722.329 1.44.494 2.16.186.812.4 1.615.63 2.415.102.355.193.713.282 1.072.11.436.202.876.254 1.323.031.278.066.557.073.837a7.56 7.56 0 01-.017.88c-.037.413-.1.818-.226 1.212a5.017 5.017 0 01-.915 1.649l-.13.156.018.023c.043-.023.088-.041.127-.068.2-.138.373-.307.531-.49.4-.46.721-.973.975-1.529a3.59 3.59 0 00.325-1.72c-.024-.424-.097-.834-.3-1.213-.013-.027-.015-.06-.03-.121.05.035.082.048.101.072.107.13.22.258.315.398.33.494.46 1.052.486 1.64a3.75 3.75 0 01-.47 1.97c-.36.655-.887 1.14-1.526 1.506-.193.111-.394.21-.595.308-.157.078-.248.211-.318.365a.522.522 0 00-.033.406.359.359 0 01.013.139c-.005.077-.077.155-.14.162-.054.006-.125-.043-.15-.116a1.206 1.206 0 01-.06-.233c-.04-.314-.155-.6-.308-.87a3.906 3.906 0 00-.73-.91 2.129 2.129 0 00-.897-.524 4.093 4.093 0 00-.692-.131c-.075-.008-.15-.04-.22.01.18.06.363.11.538.18.434.173.82.43 1.18.728.308.255.58.543.794.884.098.155.186.315.227.496.027.123.042.25.067.375.013.062-.002.109-.053.144-.047.033-.122.034-.163-.01a.455.455 0 01-.08-.14c-.03-.073-.038-.159-.078-.225a7.314 7.314 0 00-1.423-1.664c-.16-.137-.329-.26-.537-.323-.376-.114-.753-.203-1.15-.154-.213.025-.427.032-.64.053a1.6 1.6 0 00-.736.278 5.14 5.14 0 00-.834.72c-.329.342-.642.699-.955 1.055-.136.155-.264.319-.314.531a5.227 5.227 0 00-.012.051.096.096 0 01-.09.076h-.31c-.046 0-.082-.048-.072-.094.023-.108.045-.216.07-.324.075-.325.19-.635.368-.917.024-.039.04-.088.104-.08l.01.049.027.077c.28-.435.571-.834.996-1.135.283-.204.584-.378.89-.55a.196.196 0 00-.098-.002c-.162.043-.325.084-.485.134-.402.124-.764.33-1.11.566-.147.1-.298.193-.414.333a7.314 7.314 0 00-1.07 1.767.845.845 0 00-.04.12.075.075 0 01-.072.056h-.494c-.04 0-.062-.051-.036-.082.123-.14.246-.282.377-.415.275-.281.58-.532.777-.884.027-.048.063-.09.095-.135.238-.333.54-.607.818-.902.082-.086.175-.16.26-.24.029-.027.053-.057.079-.085l-.018-.025-.135.041c-.034.017-.07.031-.102.05-.248.144-.494.292-.743.433-.408.23-.825.439-1.209.711-.281.2-.591.358-.889.533-.02.012-.044.015-.08.028-.015-.135.143-.201.108-.336-.033.014-.064.02-.085.038-.111.096-.227.19-.328.296-.148.157-.284.325-.425.488-.125.143-.25.286-.373.431A.153.153 0 019.89 24H8.762a.316.316 0 00.016-.042c.028-.09.085-.172.083-.28-.091-.018-.162.001-.212.077a4.45 4.45 0 00-.136.215c-.01.016-.024.03-.042.03h-.093c-.019 0-.029-.022-.017-.037.071-.088.14-.178.209-.268.001-.002-.006-.012-.012-.024-.014.004-.03.006-.045.013-.176.09-.352.181-.527.274a.363.363 0 01-.168.042H5.202c-.026 0-.039-.036-.019-.053.21-.178.402-.374.558-.605.335-.496.538-1.047.667-1.629.004-.02-.003-.043-.006-.091-.037.048-.059.072-.076.1a1.943 1.943 0 01-.334.415c-.28.258-.59.448-.983.464-.297.012-.588 0-.865-.127-.46-.21-.722-.57-.794-1.072-.025-.17-.017-.171-.182-.219A3.513 3.513 0 011.97 20.6a2.286 2.286 0 01-.808-1.13 3.569 3.569 0 01-.16-1.245c.002-.034.016-.067.024-.1.032.023.046.043.05.066.033.153.059.308.096.46.086.355.257.664.516.92.258.256.571.419.91.532.358.118.717.138 1.07-.016a1.89 1.89 0 00.621-.452c.328-.348.533-.76.648-1.223.009-.034.005-.071.007-.11-.015.006-.026.006-.03.011-.031.05-.064.1-.093.152-.284.502-.679.887-1.196 1.135-.351.17-.718.255-1.11.159a1.607 1.607 0 01-.971-.64 2.006 2.006 0 01-.368-.924 2.903 2.903 0 01.02-.886c.05-.439.466-1.17.742-1.271-.02.063-.035.112-.053.16-.043.116-.097.227-.13.345a1.901 1.901 0 00-.05.82c.033.212.09.416.204.6.147.236.346.407.62.465.11.023.225.014.338.018a.576.576 0 00.386-.131c.164-.128.282-.292.366-.481.168-.375.24-.777.309-1.179.05-.296.093-.594.133-.893.039-.281.071-.563.104-.845.026-.232.048-.464.074-.696.024-.228.052-.455.076-.683.024-.227.047-.455.069-.683.013-.14.022-.28.034-.42l.037-.417c.022-.25.041-.5.065-.748.008-.082-.02-.132-.09-.177a2.46 2.46 0 01-.492-.418c-.1-.109-.188-.228-.282-.342-.035-.042-.056-.097-.116-.118a2.084 2.084 0 00.275.597c.06.092.131.176.196.265.063.086.182.115.234.226-.028.003-.046.01-.06.006a4.74 4.74 0 01-.22-.057 2.71 2.71 0 01-1.287-.819c-.435-.487-.656-1.076-.71-1.723a5.206 5.206 0 01.014-1.06c.072-.602.22-1.186.45-1.745.155-.376.338-.741.526-1.102.205-.393.466-.75.765-1.076.512-.559 1.104-1.024 1.726-1.448.717-.49 1.478-.898 2.277-1.233C8.244.828 8.767.632 9.31.494c.655-.166 1.31-.33 1.982-.415.229-.03.458-.058.688-.07zm-1.847 22.82c-.07.06-.147.111-.207.18-.238.27-.464.549-.668.869l-.044.108a.177.177 0 00.093-.057c.174-.19.351-.378.519-.574.104-.122.195-.255.288-.386.024-.034.03-.08.046-.12l-.027-.02zm1.65-3.695a5.51 5.51 0 00-.653.593l-.37.386a.963.963 0 01-.377.25 1.372 1.372 0 01-.467.09c-.044 0-.087.006-.151.012.028.058.043.097.064.131.15.242.301.482.45.724.136.22.276.438.399.666.068.125.105.267.156.404.077.027.14-.018.202-.048.29-.135.579-.274.867-.412.213-.101.437-.186.636-.31.347-.215.68-.455 1.018-.685.015-.01.026-.028.042-.046-.023-.019-.038-.037-.056-.044-.287-.111-.527-.3-.77-.482a5.319 5.319 0 01-.506-.42 1.757 1.757 0 01-.41-.653c-.019-.049-.045-.095-.075-.156zm-5.847.264c-.06.096-.097.194-.132.293a3.38 3.38 0 01-.555 1.01c-.2.25-.455.412-.762.493-.23.06-.464.076-.7.07-.048-.002-.097.002-.158.005.016.04.021.066.035.085.1.145.23.246.4.295.157.046.316.034.498.023.181-.037.343-.115.485-.234.238-.199.402-.454.536-.732.175-.363.264-.751.342-1.144.01-.053.008-.11.011-.164zm14.945-4.586c.008.029.016.057.027.107.024.155.051.31.072.464.03.219.067.437.078.657.017.344.027.689-.014 1.033-.037.315-.063.633-.116.946a6.153 6.153 0 01-.46 1.518c-.008.018-.01.039-.02.082.047-.03.077-.042.098-.064.085-.083.17-.167.248-.255.271-.305.458-.66.596-1.043.18-.498.228-1.011.145-1.531-.103-.65-.33-1.263-.597-1.881a9.055 9.055 0 00-.024-.055l-.033.022zM5.797 8.29a.26.26 0 00.018.153c.124.251.25.501.379.75.025.049.066.09.03.163-.284.06-.578.119-.88.255.059.038.097.06.132.087.042.032.112.058.09.12-.01.033-.075.048-.117.072.017.01.043.021.067.036.166.102.33.207.447.368.138.192.229.404.188.644-.079.469-.306.85-.69 1.132-.054.04-.106.083-.161.122a.243.243 0 00-.103.245.77.77 0 00.055.195c.083.196.22.35.375.492.083.076.159.164.222.257a.37.37 0 01.025.377c-.023.05-.05.099-.076.148-.03.06-.028.111.022.162.041.042.08.089.112.138.038.058.078.079.147.05a.486.486 0 01.333-.006c.16.046.302.126.444.21.13.077.264.149.4.219.067.035.14.05.219.026.071-.022.124.01.145.076.02.064-.003.108-.074.139-.07.03-.137.063-.209.088-.1.035-.201.073-.314.077-.013-.107.11-.088.127-.159-.206-.126-.643-.145-.801-.034.063.112.035.21-.096.313-.13-.1-.025-.202.002-.3a.209.209 0 00-.249.17c-.015.101.067.216.178.224.108.007.218-.005.326-.012.06-.005.12-.027.199 0-.103.123-.248.127-.357.19.002.05.07.086.019.131-.053.048-.095-.001-.132-.03-.08-.063-.16-.126-.231-.197a.474.474 0 01-.157-.311.52.52 0 00-.043-.172c-.032-.074-.032-.137.033-.19-.018-.03-.028-.053-.045-.072a1.222 1.222 0 01-.196-.369c-.053-.137-.046-.264.048-.381.024-.03.05-.06.064-.095a.664.664 0 00.047-.168c.017-.165-.064-.287-.182-.387-.186-.156-.36-.322-.46-.551-.005-.011-.024-.017-.037-.026-.011.017-.024.027-.025.038-.019.185-.045.37-.052.557-.014.377.058.743.162 1.104.118.41.289.798.488 1.173.267.502.537 1.002.812 1.5.055.098.13.189.208.27.198.202.452.272.724.273.202 0 .404-.006.605-.026.295-.03.59-.073.884-.113.183-.025.365-.057.548-.08.21-.026.38.073.522.21.16.156.305.327.447.5.22.265.397.56.554.867.05.098.07.1.147.03.13-.121.26-.242.394-.36.067-.059.088-.12.067-.213a3.535 3.535 0 01-.085-.796c.002-.157.006-.314.018-.471.015-.224.03-.45.06-.672a59.114 59.114 0 01.362-2.298c.087-.493.182-.984.268-1.477.06-.347.118-.694.162-1.043.034-.273.055-.55.063-.825.011-.332.003-.665.002-.998 0-.077.004-.155-.01-.23-.028-.142-.01-.155-.162-.19a5.826 5.826 0 00-.607-.107c-.146-.018-.207-.053-.221-.19-.006-.049-.025-.098-.041-.146-.009-.025-.024-.048-.046-.09l-.025.264c-.009.096-.029.116-.127.115-.055 0-.11-.008-.164-.008-.476 0-.952-.008-1.426.032-.095.008-.173-.015-.226-.103-.04-.066-.088-.126-.134-.186-.063-.084-.086-.093-.182-.06-.195.068-.388.138-.582.21a2.71 2.71 0 00-.675.394.986.986 0 01-.323.168c-.033.01-.07.008-.127.013.02-.066.024-.114.047-.15.064-.105.135-.205.205-.306.023-.033.049-.063.073-.095l-.015-.023-.201.037c-.146.04-.296.07-.437.122-.148.053-.266.023-.386-.072a3.623 3.623 0 01-.733-.786l-.093-.132zm8.592 8.963l-.147.09c-.22.134-.44.266-.659.402-.093.058-.184.12-.27.188-.085.07-.124.161-.072.272.047.1.093.2.147.294.047.08.124.138.213.147.11.01.228.012.336-.012.217-.05.372-.205.528-.357a.291.291 0 00.087-.308c-.046-.18-.079-.365-.118-.547-.011-.052-.027-.103-.045-.169zm-.257-2.409c-.12.291-.205.597-.325.91-.151.433-.294.87-.435 1.323.036-.01.054-.01.067-.018.261-.16.522-.324.785-.484.054-.033.071-.078.065-.138-.012-.13-.024-.262-.034-.393l-.068-.886c-.008-.103-.02-.206-.029-.31-.009 0-.017-.002-.026-.004zm3.081-8.13l.099.285c.08.231.159.463.24.714l.58 1.952c.187.63.372 1.262.558 1.893.114.382.235.762.343 1.146.072.257.126.519.186.799.044.206.087.413.127.64.034.106.023.226.077.325l.025-.006-.068-.362c-.038-.206-.077-.412-.113-.638-.015-.07-.029-.141-.046-.211-.095-.396-.177-.796-.29-1.187-.196-.685-.413-1.364-.618-2.046-.165-.549-.322-1.1-.488-1.648-.069-.227-.15-.45-.226-.695l-.117-.336c-.037-.107-.075-.216-.115-.322-.04-.106-.084-.21-.127-.314a7.558 7.558 0 01-.027.01zM6.225 14.304c-.063-.001-.115.014-.134.083a.35.35 0 00.41.012 4.533 4.533 0 00-.276-.095zM5.23 11.98c-.026-.027-.057-.048-.075.002-.012.032-.007.07-.01.113.082-.037.082-.037.085-.115zm.062-1.189a.135.135 0 00-.088.056.197.197 0 00-.025.11c.005.152.01.306.026.457a.751.751 0 00.066.218c.061.136.157.167.288.101.055-.027.06-.054.025-.11a4.52 4.52 0 01-.129-.211c-.015-.068-.066-.131-.033-.207.04-.09-.076-.116-.074-.19V10.874c-.003-.038-.006-.087-.056-.083zm-.017-.968a.867.867 0 00-.467.127c-.076.045-.084.07-.05.158.034.087.07.173.115.254.064.117.09.125.21.077a.657.657 0 01.336-.053c.202.022.357.136.504.264l.092.077c.007-.006.014-.013.022-.018-.019-.105-.035-.226-.149-.264-.157-.053-.324-.075-.508-.117l-.24-.005c.24-.169.452-.044.687.009-.063-.115-.153-.147-.23-.193-.082-.05-.17-.092-.25-.144-.06-.037-.12-.08-.072-.172zm10.233.325c-.23-.01-.427.08-.608.211-.034.026-.06.065-.105.117.087.026.15.046.232.065.044-.015.088-.03.13-.046.306-.114.61-.115.904.031.126.063.237.04.366-.005-.02-.031-.03-.054-.045-.071a.986.986 0 00-.448-.273c-.14-.044-.284-.024-.426-.03zM7.99 6.483a.308.308 0 00.002.133c.08.321.156.643.242.962.104.387.27.75.456 1.103.02.037.061.08.098.087a.404.404 0 00.253-.051l-.472-.84c-.23-.448-.405-.92-.579-1.394zM10.397.497c-.2-.008-.405.004-.603.034-.236.035-.47.087-.7.152-.287.08-.569.18-.852.273-.04.013-.074.038-.11.058.028.014.05.018.07.014.287-.068.58-.085.873-.09.134-.002.269.009.402.025.19.024.382.048.57.09.456.104.874.3 1.265.556.464.306.888.66 1.257 1.078.205.232.395.475.56.739.17.274.315.561.449.856.273.601.456 1.232.6 1.876.04.173.07.348.1.524.017.104.065.167.17.19.122.028.2.105.22.251-.003.102-.06.174-.129.24a1.065 1.065 0 00-.268.358.164.164 0 00.083-.039c.08-.086.162-.172.235-.265a.56.56 0 00.13-.333c.009-.05.022-.1.024-.15.007-.124-.017-.15-.143-.168-.025-.004-.049-.014-.073-.015-.082-.007-.125-.063-.137-.131-.033-.198-.004-.355.247-.408.086-.018.174-.03.26-.042.158-.023.315-.053.473-.067.14-.012.19.033.226.167.008.029.018.057.021.087.019.179-.008.225-.141.288-.027.013-.055.024-.078.042a.148.148 0 00-.051.067c-.039.144.073.382.206.445l.673.32c.023.011.05.015.075.023l.018-.026c-.015-.008-.032-.013-.044-.024a2.27 2.27 0 00-.544-.32 4.898 4.898 0 00-.173-.075.203.203 0 01-.126-.191c-.003-.085.045-.154.128-.187l.059-.025c.099-.044.118-.076.112-.187a.384.384 0 00-.008-.063c-.067-.294-.123-.59-.205-.88a9.478 9.478 0 00-.826-2.036 7.465 7.465 0 00-1.39-1.805 4.536 4.536 0 00-1.177-.824 3.656 3.656 0 00-1.016-.328 6.155 6.155 0 00-.712-.074zm6.719 5.955c.01.014.018.028.038.034l-.022-.044-.016.01zM4.103 3.917a.062.062 0 01-.03.012.455.455 0 01-.04.039c-.01.01-.02.02-.045.04l-.363.354c-.088.085-.17.178-.266.253-.284.22-.425.53-.544.855a.132.132 0 00-.007.071c.013.055.033.108.052.168l.074.026c-.017.056-.03.105-.047.152-.058.164-.118.327-.175.491-.005.015.008.036.019.077.08-.175.158-.33.225-.489.228-.544.484-1.074.819-1.561.09-.133.182-.266.283-.401.004-.006.007-.013.022-.03.001-.016.003-.032.015-.04l.008-.017zm12.976 2.408a.023.023 0 01.009.019.073.073 0 00-.006.01.188.188 0 00.007.02l.018.022c.002-.007.007-.016.005-.021-.003-.01-.012-.018-.02-.038a1.331 1.331 0 01-.013-.012zM4.199 4.48c-.003.004-.008.008-.027.014-.005.013-.011.025-.031.047a2.085 2.085 0 01-.124.167c-.048.07-.116.055-.181.041-.134-.028-.228.016-.287.143-.089.187-.187.37-.273.56-.049.108-.11.216-.118.36.081.003.154.007.228.008h.228a2.563 2.563 0 01-.079.264c-.01.052-.022.103-.033.155l.02.004c.018-.046.037-.092.067-.153.066-.142.13-.285.2-.426.02-.04.034-.1.116-.092 0 .043.004.084 0 .124-.005.045-.017.09-.028.143.141.043.086.174.115.269.102-.022.104-.195.248-.144v.205l.017.002.439-1.059c-.13 0-.246-.02-.358.033-.024.011-.058-.001-.108-.004.075-.15.139-.278.211-.417a.128.128 0 01.025-.036c0-.015-.001-.03.008-.038l.006-.02c-.005.006-.01.011-.028.017-.004.012-.009.024-.026.045a.085.085 0 01-.032.033c-.123.157-.09.164-.258.106-.079-.027-.078-.028-.047-.144.028-.046.056-.093.098-.15 0-.016-.001-.032.007-.042L4.2 4.48zm2.073-.67c-.003.006-.007.011-.027.016-.094.125-.194.246-.28.377-.155.238-.301.481-.451.723-.14.224-.345.368-.575.481-.017.008-.04.006-.079.011.012-.059.016-.109.033-.153a6.076 6.076 0 01.229-.518l-.007-.02a.138.138 0 01-.035.025c-.028.05-.055.1-.093.164-.26.424-.443.817-.442.95.024.004.048.011.073.013.177.013.188.007.26-.165.03-.07.077-.12.147-.15l.175-.07c.044-.018.085-.057.146-.032.003.05-.01.11.014.145.042.062.044.125.047.193.002.049.017.098.026.147.029-.034.039-.065.05-.097.142-.39.277-.782.428-1.17.1-.256.22-.504.33-.756.013-.03.013-.067.03-.092V3.81zm3.987-.34c0 .045.01.084.021.123.042.16.094.318.124.48.024.133.023.27.028.406 0 .033-.019.067-.032.11-.094-.058-.047-.158-.106-.215h-.125c-.015.072-.01.152-.046.2-.066.085-.155.154-.236.227-.043.038-.078.018-.103-.025l-.046-.087c-.065.035-.117.069-.172.093-.116.051-.235.095-.35.147-.085.038-.09.053-.07.147.014.075.034.148.047.223.013.072.05.109.123.124.233.05.462.115.657.265.058-.102.058-.102.168-.151.03-.014.06-.03.092-.042.08-.03.115-.017.15.06.023.048.041.098.066.158.06-.14-.042-.267.017-.416.157.18.24.39.375.567a.235.235 0 00.022-.098c.002-.124 0-.247.002-.371 0-.034.013-.067.02-.1l.032-.003c.11.155.13.354.226.52a3.036 3.036 0 00-.01-.392c-.004-.045 0-.074.05-.088.08.036.116.14.215.158-.03-.275-.423-1.137-.798-1.635-.114-.127-.2-.28-.34-.386zm-2.667.696c-.019.034-.03.05-.037.067-.061.185-.125.37-.18.556-.031.105-.087.169-.195.19-.09.019-.178.052-.268.073-.038.009-.089.015-.118-.003-.024-.016-.025-.069-.036-.106-.064.076-.082.087-.17.047-.133-.062-.262-.135-.393-.201-.048-.025-.093-.063-.17-.03-.043.12-.091.25-.137.382-.099.28-.087.242.095.453.046.048.102.03.154.023.054-.009.106-.03.16-.036.13-.013.26-.08.367-.015.204-.064.387-.122.571-.178.05-.015.089.005.114.054.022.042.034.093.082.121.038-.056-.013-.128.063-.178l.14.241-.042-1.46zm.278.358c-.096-.01-.107.01-.11.108-.002.038-.003.078.002.115.03.2.099.386.174.57.002.006.012.01.022.015l.078-.05c.052.036.081.088.153.088.205-.002.41.014.616.012.099-.001.158.042.205.12.018.03.024.077.088.066l-.08-.394c-.05-.195-.085-.395-.172-.589-.057.057-.114.068-.18.046a.72.72 0 00-.135-.028c-.22-.028-.44-.059-.66-.08zm10.254-1.727c.089.163.155.316.139.491-.016.168.026.342-.044.516-.047-.033-.088-.082-.112-.075-.117.035-.164-.057-.227-.115a4.772 4.772 0 01-.286-.29l-.104-.113a4.856 4.856 0 01-.023.019c.035.046.07.093.11.156.04.064.084.127.122.193.034.058.065.118.031.205-.082-.01-.164-.019-.246-.032-.06-.01-.101 0-.124.07-.031.098-.037.096-.15.09.02.042.036.08.057.116.041.074.03.138-.03.196-.06.06-.118.122-.178.181a.175.175 0 01-.185.046c-.222-.061-.447-.113-.67-.174-.032-.009-.063-.04-.086-.068-.03-.04-.052-.087-.08-.13-.044-.07-.09-.138-.136-.207a.18.18 0 00-.014.105c.012.127.03.253.035.38.005.1-.024.12-.121.104-.104-.017-.206-.04-.31-.058-.064-.012-.131-.028-.202.03l.081.208c.09 0 .166-.01.237.002a.819.819 0 01.458.251c.078.083.154.168.241.26l.018-.005c-.004-.006-.008-.013-.01-.04.014-.056-.062-.118.018-.178.031.03.064.057.088.09.058.078.111.159.169.257l.089.141.024-.013a2093.819 2093.819 0 01-.427-.934c.055.007.083.007.108.016.193.07.385.142.577.216.074.028.147.06.219.094.062.028.112.018.157-.033.05-.056.102-.112.154-.167.05-.051.095-.046.132.014.016.025.026.053.04.08.071.138.143.277.217.433l.159.308.025-.011c-.044-.106-.07-.218-.138-.334-.057-.182-.168-.346-.206-.545.136.034.362.326.567.732l.057.074.018-.011a1.563 1.563 0 01-.052-.127c-.046-.145-.097-.29-.136-.436-.022-.083-.036-.173.022-.26l.109.058-.026-.207.027-.016c.022.02.05.036.065.06.073.108.143.22.215.33.01.016.029.029.043.043-.036-.217-.2-.38-.229-.626l.155.112c.014-.166.012-.319.042-.465.032-.158-.023-.297-.063-.445.024.004.036.006.055.025.092.124.183.249.277.371.02.027.05.047.069.087l.04.063.019-.015a.293.293 0 01-.053-.082 27.922 27.922 0 01-.332-.49c-.221-.311-.363-.467-.485-.521zm-6.57.327c-.003.161.092.275.069.415l-.368.087c.09.139.032.237-.052.331-.05.057-.092.122-.143.178-.037.04-.046.078-.018.126l.16.275c.029.048.072.066.128.064.076-.003.152 0 .228-.001.116-.003.216.022.275.137.006.014.02.024.044.052.004-.059-.003-.098.01-.13.016-.04.04-.099.072-.108.084-.023.173-.024.26-.03.013-.001.027.018.04.029l.071.065c.019-.11-.082-.198-.024-.31l.126.04c-.026-.123-.07-.245-.071-.366 0-.123.051-.243.115-.36.107.062.16.156.234.253.183.265.36.533.494.834.165-.078.27.068.407.088-.003-.106-.133-.441-.197-.492a.142.142 0 00-.102-.028c-.06.011-.119.039-.191.063-.025-.039-.056-.078-.077-.122a3.936 3.936 0 00-.473-.783c-.076-.094-.16-.182-.228-.26l-.391.285c-.049.035-.094.03-.132-.017l-.169-.207c-.025-.03-.053-.059-.097-.108z"})]})}function m({size:c=16,className:r=""}){return l.jsx("svg",{width:c,height:c,viewBox:"0 0 16 16",fill:"currentColor",className:r,children:l.jsx("path",{d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8z"})})}function I({size:c=16,className:r=""}){return l.jsx("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"currentColor",className:r,children:l.jsx("path",{d:"M23.955 13.587l-1.342-4.135-2.664-8.189c-.135-.423-.73-.423-.867 0L16.418 9.45H7.582L4.919 1.263c-.135-.423-.73-.423-.867 0L1.388 9.452.045 13.587a.924.924 0 0 0 .331 1.03L12 23.054l11.625-8.436a.92.92 0 0 0 .33-1.031"})})}function M({size:c=16,className:r=""}){return l.jsx("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:r,"aria-hidden":"true",children:l.jsx("g",{transform:"translate(3.4502, 3)",fill:"#9570BE",children:l.jsx("path",{d:"M3.17890888,3.6 L3.17890888,0 L16,0 L16,3.6 L3.17890888,3.6 Z M9.642,7.2 L9.64218223,10.8 L0,10.8 L0,3.6 L16,3.6 L16,7.2 L9.642,7.2 Z M3.17890888,18 L3.178,14.4 L0,14.4 L0,10.8 L16,10.8 L16,18 L3.17890888,18 Z",fillRule:"nonzero"})})})}function p({size:c=16,className:r=""}){return l.jsxs("svg",{width:c,height:c,viewBox:"0 0 120 90",fill:"currentColor",className:r,children:[l.jsx("rect",{x:"10",y:"8",width:"100",height:"12",rx:"2"}),l.jsx("rect",{x:"25",y:"20",width:"12",height:"62",rx:"2"}),l.jsx("rect",{x:"75",y:"20",width:"12",height:"45",rx:"2"}),l.jsx("rect",{x:"71",y:"55",width:"20",height:"16",rx:"3"}),l.jsx("rect",{x:"76",y:"71",width:"3",height:"8",rx:"1"}),l.jsx("rect",{x:"82",y:"71",width:"3",height:"8",rx:"1"})]})}function e({size:c=16,className:r=""}){return l.jsxs("svg",{width:c,height:c,viewBox:"0 0 120 90",fill:"currentColor",className:r,children:[l.jsx("rect",{x:"10",y:"8",width:"100",height:"12",rx:"2"}),l.jsx("rect",{x:"25",y:"20",width:"12",height:"62",rx:"2"}),l.jsx("rect",{x:"83",y:"20",width:"12",height:"62",rx:"2"})]})}function H({size:c=16,className:r=""}){return l.jsxs("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",className:r,children:[l.jsx("path",{d:"M9 3v2"}),l.jsx("path",{d:"M15 3v2"}),l.jsx("rect",{x:"4",y:"6",width:"16",height:"13",rx:"3"}),l.jsx("circle",{cx:"9",cy:"13",r:"1.4",fill:"currentColor",stroke:"none"}),l.jsx("circle",{cx:"15",cy:"13",r:"1.4",fill:"currentColor",stroke:"none"}),l.jsx("path",{d:"M9 16h6"})]})}function O({size:c=16,className:r=""}){return l.jsx("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:r,children:l.jsx("path",{d:"M12.105 2L9.927 4.953H.653L2.83 2h9.276zM23.254 19.048L21.078 22h-9.242l2.174-2.952h9.244zM24 2L9.264 22H0L14.736 2H24z"})})}function V({size:c=16,className:r=""}){return l.jsx("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:r,children:l.jsx("path",{d:"M20.113 5.5l-.442 1.557a.157.157 0 01-.196.106l-7.414-2.157a.16.16 0 00-.143.028l-7.342 5.74a.159.159 0 01-.074.032l-4.37.656a.154.154 0 00-.132.162l.02.245c.005.078.071.14.152.141l5.074.128.058.002 3.75-1.953a.16.16 0 01.164.01l2.657 1.847a.152.152 0 01.066.125l-.023 2.45c0 .032.01.063.028.089l3.737 5.227c.03.04.077.065.129.065h1.182a.153.153 0 00.14-.224l-2.664-4.919a.15.15 0 01.005-.152l1.389-2.169a.156.156 0 01.062-.055l4.965-2.456a.16.16 0 01.158.01l1.418.921a.16.16 0 00.087.026h1.289c.125 0 .2-.136.13-.237l-3.578-5.29c-.074-.109-.246-.082-.282.044z"})})}function R({size:c=16,className:r=""}){return l.jsx("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:r,children:l.jsx("path",{d:"M21.595 23.61c1.167-.254 2.405-.944 2.405-.944l-2.167-1.784a12.124 12.124 0 01-2.695-3.131 12.127 12.127 0 00-3.97-4.049l-.794-.462a1.115 1.115 0 01-.488-.815.844.844 0 01.154-.575c.413-.582 2.548-3.115 2.94-3.44.503-.416 1.065-.762 1.586-1.159.074-.056.148-.112.221-.17.003-.002.007-.004.009-.007.167-.131.325-.272.45-.438.453-.524.563-.988.59-1.193-.061-.197-.244-.639-.753-1.148.319.02.705.272 1.056.569.235-.376.481-.773.727-1.171.165-.266-.08-.465-.086-.471h-.001V3.22c-.007-.007-.206-.25-.471-.086-.567.35-1.134.702-1.639 1.021 0 0-.597-.012-1.305.599a2.464 2.464 0 00-.438.45l-.007.009c-.058.072-.114.147-.17.221-.397.521-.743 1.083-1.16 1.587-.323.391-2.857 2.526-3.44 2.94a.842.842 0 01-.574.153 1.115 1.115 0 01-.815-.488l-.462-.794a12.123 12.123 0 00-4.049-3.97 12.133 12.133 0 01-3.13-2.695L1.332 0S.643 1.238.39 2.405c.352.428 1.27 1.49 2.34 2.302C1.58 4.167.73 3.75.06 3.4c-.103.765-.063 1.92.043 2.816.726.317 1.961.806 3.219 1.066-1.006.236-2.11.278-2.961.262.15.554.358 1.119.64 1.688.119.263.25.52.39.77.452.125 2.222.383 3.164.171l-2.51.897a27.776 27.776 0 002.544 2.726c2.031-1.092 2.494-1.241 4.018-2.238-2.467 2.008-3.108 2.828-3.8 3.67l-.483.678c-.25.351-.469.725-.65 1.117-.61 1.31-1.47 4.1-1.47 4.1-.154.486.202.842.674.674 0 0 2.79-.861 4.1-1.47.392-.182.766-.4 1.118-.65l.677-.483c.227-.187.453-.37.701-.586 0 0 1.705 2.02 3.458 3.349l.896-2.511c-.211.942.046 2.712.17 3.163.252.142.509.272.772.392.569.28 1.134.49 1.688.64-.016-.853.026-1.956.261-2.962.26 1.258.75 2.493 1.067 3.219.895.106 2.051.146 2.816.043a73.87 73.87 0 01-1.308-2.67c.811 1.07 1.874 1.988 2.302 2.34h-.001z"})})}function z({size:c=16,className:r=""}){return l.jsx("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:r,children:l.jsx("path",{d:"M0 0v24h24V0H0zm22.222 22.222H1.778V1.778h20.444v20.444zm-7.555-4.964h2.222v1.778h-2.794L12.89 17.83v-2.794h1.778v2.222zm4 0h-1.778v-2.222h-2.222v-1.778h2.793l1.207 1.207v2.793zm-7.556-2.591H9.333v-1.778h1.778v1.778zm-5.778-1.778h1.778v4h4v1.778H6.54L5.333 17.46V12.89zm13.334-3.556v1.778h-5.778V9.333h1.987V7.111h-1.987V5.333h2.558l1.206 1.207v2.793h2.014zm-11.556-2h2.222l1.778 1.778v2H9.333v-2H7.111v2H5.333V5.333h1.778v2zm4 0H9.333v-2h1.778v2z"})})}function E({size:c=16,className:r=""}){return l.jsx("svg",{width:c,height:c,viewBox:"0 0 16 16",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",className:r,children:l.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.125 2.75C2.9179 2.75 2.75 2.9179 2.75 3.125V11.375H2V3.125C2 2.50368 2.50368 2 3.125 2H13.1723C13.6735 2 13.9244 2.6059 13.5701 2.96025L7.38189 9.14843H9.125V8.375H9.875V9.33593C9.875 9.6466 9.6232 9.8984 9.3125 9.8984H6.63189L5.34282 11.1875H11.1875V6.5H11.9375V11.1875C11.9375 11.6017 11.6017 11.9375 11.1875 11.9375H4.59282L3.28032 13.25H12.875C13.0821 13.25 13.25 13.0821 13.25 12.875V4.625H14V12.875C14 13.4963 13.4963 14 12.875 14H2.82767C2.32653 14 2.07557 13.3941 2.42992 13.0397L8.59468 6.875H6.875V7.625H6.125V6.6875C6.125 6.37684 6.37684 6.125 6.6875 6.125H9.34468L10.6571 4.8125H4.8125V9.5H4.0625V4.8125C4.0625 4.39829 4.39829 4.0625 4.8125 4.0625H11.4071L12.7197 2.75H3.125Z"})})}function B({size:c=16,className:r=""}){return l.jsx("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",xmlns:"http://www.w3.org/2000/svg",className:r,children:l.jsx("path",{d:"M23.748 4.482c-.254-.124-.364.113-.512.234-.051.039-.094.09-.137.136-.372.397-.806.657-1.373.626-.829-.046-1.537.214-2.163.848-.133-.782-.575-1.248-1.247-1.548-.352-.156-.708-.311-.955-.65-.172-.241-.219-.51-.305-.774-.055-.16-.11-.323-.293-.35-.2-.031-.278.136-.356.276-.313.572-.434 1.202-.422 1.84.027 1.436.633 2.58 1.838 3.393.137.093.172.187.129.323-.082.28-.18.552-.266.833-.055.179-.137.217-.329.14a5.526 5.526 0 01-1.736-1.18c-.857-.828-1.631-1.742-2.597-2.458a11.365 11.365 0 00-.689-.471c-.985-.957.13-1.743.388-1.836.27-.098.093-.432-.779-.428-.872.004-1.67.295-2.687.684a3.055 3.055 0 01-.465.137 9.597 9.597 0 00-2.883-.102c-1.885.21-3.39 1.102-4.497 2.623C.082 8.606-.231 10.684.152 12.85c.403 2.284 1.569 4.175 3.36 5.653 1.858 1.533 3.997 2.284 6.438 2.14 1.482-.085 3.133-.284 4.994-1.86.47.234.962.327 1.78.397.63.059 1.236-.03 1.705-.128.735-.156.684-.837.419-.961-2.155-1.004-1.682-.595-2.113-.926 1.096-1.296 2.746-2.642 3.392-7.003.05-.347.007-.565 0-.845-.004-.17.035-.237.23-.256a4.173 4.173 0 001.545-.475c1.396-.763 1.96-2.015 2.093-3.517.02-.23-.004-.467-.247-.588zM11.581 18c-2.089-1.642-3.102-2.183-3.52-2.16-.392.024-.321.471-.235.763.09.288.207.486.371.739.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.167-1.361-.802-2.5-1.86-3.301-3.307-.774-1.393-1.224-2.887-1.298-4.482-.02-.386.093-.522.477-.592a4.696 4.696 0 011.529-.039c2.132.312 3.946 1.265 5.468 2.774.868.86 1.525 1.887 2.202 2.891.72 1.066 1.494 2.082 2.48 2.914.348.292.625.514.891.677-.802.09-2.14.11-3.054-.614zm1-6.44a.306.306 0 01.415-.287.302.302 0 01.2.288.306.306 0 01-.31.307.303.303 0 01-.304-.308zm3.11 1.596c-.2.081-.399.151-.59.16a1.245 1.245 0 01-.798-.254c-.274-.23-.47-.358-.552-.758a1.73 1.73 0 01.016-.588c.07-.327-.008-.537-.239-.727-.187-.156-.426-.199-.688-.199a.559.559 0 01-.254-.078c-.11-.054-.2-.19-.114-.358.028-.054.16-.186.192-.21.356-.202.767-.136 1.146.016.352.144.618.408 1.001.782.391.451.462.576.685.914.176.265.336.537.445.848.067.195-.019.354-.25.452z"})})}const D={CLAUDE:s,ZCODE:O,CODEBUDDY:i,WORKBUDDY:i,CODEX:h,COPILOT:w,CRAFT:M,CURSOR:x,DEEPSEEK:B,DROID:H,"EVERY-CODE":h,GEMINI:v,GITHUB:m,GITLAB:I,GOOSE:R,GROK:u,HERMES:L,KIMI:f,KIRO:C,KILOCODE:z,MINIMAX:j,OPENCODE:g,OMP:p,PI:e,"PI-ANTHROPIC":e,"PI-GITHUB-COPILOT":e,"PI-COPILOT":e,ROOCODE:V,ZED:E},P={ANTIGRAVITY:"/brand-logos/antigravity.svg",ANYTHINGLLM:"/brand-logos/anythingllm.svg",CLAUDE:"/brand-logos/claude-code.svg",CODEX:"/brand-logos/codex.svg",DEEPSEEK:"/brand-logos/deepseek.svg",GEMINI:"/brand-logos/gemini.svg","KILO-CLI":"/brand-logos/kilo.svg","KILO-CODE":"/brand-logos/kilo.svg",MIMO:"/brand-logos/mimo.svg",OPENCLAW:"/brand-logos/openclaw.svg",OPENCODE:"/brand-logos/opencode.svg"},A={ANYTHINGLLM:"brightness-0 dark:brightness-100"};function y({size:c=16,className:r=""}){return l.jsx("svg",{width:c,height:c,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:r,children:l.jsx("circle",{cx:"12",cy:"12",r:"7.5",strokeDasharray:"3 3"})})}function b({provider:c,size:r=16,color:k,className:t=""}){const o=c?.toUpperCase?.()||"",a=P[o];if(a){const d=`${A[o]||""} ${t}`.trim();return l.jsx("img",{src:a,alt:"",width:r,height:r,className:d,style:{width:r,height:r,objectFit:"contain"},"aria-hidden":!0})}const n=D[o];return n?l.jsx(n,{size:r,className:t}):l.jsx(y,{size:r,className:`text-oai-gray-400 dark:text-oai-gray-500 shrink-0 ${t}`})}export{b as P};

Sorry, the diff of this file is too big to display

import{f as d,a as m,r as o,j as e,L as l,c as t}from"./__vite-browser-external-CeOnjjgl.js";import{L as x}from"./LoginCard-CyOwV4vy.js";function n(s,a){for(const i of a){const r=s.get(i);if(typeof r=="string"&&r.trim())return r.trim()}return""}function h(){const[s]=d(),{enabled:a}=m(),i=o.useMemo(()=>n(s,["otp","token","reset_token","insforge_token"]),[s]),r=o.useMemo(()=>n(s,["email"]),[s]),c=o.useMemo(()=>n(s,["code"]),[s]);return a?e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 h-16 flex items-center justify-between",children:e.jsx(l,{to:"/login",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 rounded",children:t("reset_password.back_to_sign_in")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4 py-12",children:e.jsx("div",{className:"w-full max-w-md border border-oai-gray-900 bg-oai-gray-950 rounded-2xl overflow-hidden shadow-2xl",children:e.jsx(x,{hideLogo:!0,initialMode:i?"reset_confirm":"reset_email",tokenFromUrl:i,initialEmail:r,initialCode:c})})})]}):e.jsxs("div",{className:"min-h-screen bg-oai-gray-950 text-oai-white font-oai antialiased dark flex flex-col",children:[e.jsx("header",{className:"border-b border-oai-gray-900 px-4 sm:px-6 py-4",children:e.jsx(l,{to:"/login",className:"text-sm font-medium text-oai-gray-400 hover:text-white no-underline",children:t("reset_password.back_to_sign_in")})}),e.jsx("main",{className:"flex-1 flex items-center justify-center px-4",children:e.jsx("p",{className:"text-oai-gray-400 text-center max-w-md",children:t("login.cloud_only")})})]})}export{h as ResetPasswordPage};
import{l as c}from"./__vite-browser-external-CeOnjjgl.js";const e=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],o=c("search",e);export{o as S};
import{r as b,j as d,d as w}from"./__vite-browser-external-CeOnjjgl.js";function S({id:l,value:c,onChange:g,placeholder:x,disabled:u=!1,type:m="text",label:h,error:i,className:s="",...n}){const y=b.useId(),f=l||y,t=i?`${f}-error`:void 0,r=`w-full bg-oai-white dark:bg-oai-gray-900 border border-oai-gray-300 dark:border-oai-gray-700 rounded-md text-oai-black dark:text-oai-white placeholder-oai-gray-400 dark:placeholder-oai-gray-500 transition-all duration-200 focus:outline-none focus:border-oai-brand dark:focus:border-oai-brand focus:ring-1 focus:ring-oai-brand/30 ${u?"bg-oai-gray-50 dark:bg-oai-gray-800 text-oai-gray-400 dark:text-oai-gray-400 cursor-not-allowed":""} ${i?"border-oai-error focus:border-oai-error focus:ring-oai-error/30":""} h-10 px-3 text-sm ${s}`;return d.jsxs("div",{className:"w-full",children:[h&&d.jsx("label",{htmlFor:f,className:"block text-sm font-medium text-oai-gray-700 dark:text-oai-gray-300 mb-1.5 transition-colors duration-200",children:h}),d.jsx("input",{id:f,type:m,value:c,onChange:g,placeholder:x,disabled:u,"aria-invalid":i?!0:void 0,"aria-describedby":t,className:r,...n}),i&&d.jsx("p",{id:t,className:"mt-1.5 text-sm text-oai-error",children:i})]})}function j({options:l,value:c,onChange:g,leading:x=null,disabled:u=!1,ariaLabel:m,className:h=""}){const i=b.useRef(null),s=b.useRef(new Map),[n,y]=b.useState(null),f=(t,a)=>{const e=l.filter(k=>!u&&!k.disabled),o=e.findIndex(k=>k.id===a);if(o<0)return;let r=null;t.key==="ArrowRight"||t.key==="ArrowDown"?r=e[(o+1)%e.length]:t.key==="ArrowLeft"||t.key==="ArrowUp"?r=e[(o-1+e.length)%e.length]:t.key==="Home"?r=e[0]:t.key==="End"&&(r=e[e.length-1]),!(!r||r.id===a)&&(t.preventDefault(),g(r.id),s.current.get(r.id)?.focus())};return b.useLayoutEffect(()=>{const t=()=>{const e=s.current.get(c);if(!e||e.offsetWidth===0)return;const o={left:e.offsetLeft,top:e.offsetTop,width:e.offsetWidth,height:e.offsetHeight};y(r=>r&&r.left===o.left&&r.top===o.top&&r.width===o.width&&r.height===o.height?r:o)};if(t(),typeof ResizeObserver>"u"||!i.current)return;const a=new ResizeObserver(t);a.observe(i.current);for(const e of s.current.values())a.observe(e);return()=>a.disconnect()},[c,l]),d.jsxs("div",{ref:i,role:"tablist","aria-label":m,className:w("relative inline-flex h-8 items-center gap-1 rounded-md border border-oai-gray-200 bg-oai-gray-100 p-[3px] dark:border-oai-gray-700 dark:bg-oai-gray-800",h),children:[x,n?d.jsx("span",{"aria-hidden":!0,className:"pointer-events-none absolute left-0 top-0 rounded-sm bg-white shadow-sm transition-[transform,width] duration-200 ease-out motion-reduce:transition-none dark:bg-oai-gray-700",style:{transform:`translate(${n.left}px, ${n.top}px)`,width:`${n.width}px`,height:`${n.height}px`}}):null,l.map(t=>{const a=t.id===c;return d.jsxs("button",{ref:e=>{e?s.current.set(t.id,e):s.current.delete(t.id)},type:"button",role:"tab","aria-selected":a,tabIndex:a?0:-1,disabled:u||t.disabled,onClick:()=>g(t.id),onKeyDown:e=>f(e,t.id),className:w("relative z-10 inline-flex h-6 items-center gap-1.5 rounded px-2.5 text-xs font-medium transition-colors disabled:opacity-50",a?"text-oai-black dark:text-white":"text-oai-gray-500 hover:text-oai-black dark:text-oai-gray-400 dark:hover:text-white"),children:[t.icon,t.label]},t.id)})]})}export{S as I,j as S};
import{r as v,O as i,P as w,z as k,j as e,d as b}from"./__vite-browser-external-CeOnjjgl.js";import{C as j}from"./ToolbarRootContext-Bs1pZOOn.js";import{C as N}from"./check-DPhmDgw5.js";import{u as C,a as E,s as l,L as I,b as R,S as T,c as L,d as P,e as A,f as O,g as _,h as z,i as D,j as G}from"./SelectItemText-BZFLz6Op.js";const M=v.forwardRef(function(t,s){const{render:n,className:f,style:o,...c}=t,{store:r,scrollHandlerRef:d}=C(),{alignItemWithTriggerActive:g}=E(),u=i(r,l.hasScrollArrows),h=i(r,l.openMethod),a=i(r,l.multiple),m={id:`${i(r,l.id)}-list`,role:"listbox","aria-multiselectable":a||void 0,onScroll(x){d.current?.(x.currentTarget)},...g&&{style:I},className:u&&h!=="touch"?R.className:void 0},S=w(x=>{r.set("listElement",x)});return k("div",t,{ref:[s,S],props:[m,c]})}),V="relative inline-flex items-center justify-between gap-2 rounded-lg border border-oai-gray-200 bg-white text-oai-black transition-colors hover:border-oai-gray-300 focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-white dark:hover:border-oai-gray-700";function W({value:y,onValueChange:t,options:s=[],ariaLabel:n,id:f,disabled:o=!1,leadingIcon:c=null,className:r="",popupClassName:d="",align:g="start",matchTriggerWidth:u=!1}){const h=s.map(a=>({value:a.value,label:a.label}));return e.jsxs(T,{value:y,items:h,disabled:o,onValueChange:a=>{!o&&a!=null&&t?.(a)},children:[e.jsxs(L,{id:f,"aria-label":n,className:b(V,o&&"cursor-not-allowed opacity-50 hover:border-oai-gray-200 dark:hover:border-oai-gray-800",r),children:[e.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[c,e.jsx(P,{className:"truncate"})]}),e.jsx(j,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})]}),e.jsx(A,{children:e.jsx(O,{align:g,side:"bottom",sideOffset:4,className:"z-50",children:e.jsx(_,{className:b("max-h-[min(18rem,var(--available-height))] origin-[var(--transform-origin)] overflow-y-auto","rounded-xl border border-oai-gray-200 bg-white p-1 shadow-lg ring-1 ring-black/[0.04]","dark:border-oai-gray-700 dark:bg-oai-gray-900 dark:ring-white/[0.05]","transition-[opacity,transform] duration-150 ease-out","data-[starting-style]:scale-95 data-[starting-style]:opacity-0","data-[ending-style]:scale-95 data-[ending-style]:opacity-0",u&&"min-w-[var(--anchor-width)]",d),children:e.jsx(M,{role:"listbox","aria-label":n,children:s.map(a=>e.jsxs(z,{value:a.value,disabled:a.disabled,className:({selected:p,disabled:m})=>b("flex w-full cursor-pointer items-center gap-1.5 whitespace-nowrap rounded-lg py-1.5 pl-1.5 pr-6","text-left text-xs outline-none transition-colors",p?"bg-oai-gray-100 text-oai-black dark:bg-oai-gray-800/70 dark:text-white":"text-oai-gray-600 hover:bg-oai-gray-50 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800/60",m&&"cursor-not-allowed opacity-50 hover:bg-transparent dark:hover:bg-transparent"),children:[e.jsx("span",{className:"flex w-3.5 shrink-0 items-center justify-center text-oai-gray-500 dark:text-oai-gray-300",children:e.jsx(D,{children:e.jsx(N,{className:"h-3 w-3","aria-hidden":!0})})}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:e.jsx(G,{children:a.label})})]},String(a.value)))})})})})]})}export{W as S};
import{bP as Xt,bN as Rn,r,P as le,bc as Pt,aG as G,c8 as _t,c9 as Mt,ca as Bt,bT as Ct,aU as st,aE as He,A as Me,cb as zt,ba as jt,cc as at,aD as bn,b1 as Jt,cd as bt,ce as St,cf as Qt,cg as Lt,aS as ht,ch as Sn,bX as In,ci as At,ax as it,aI as be,W as Zt,aH as xt,aT as En,j as ye,V as Y,O as w,az as Ft,aK as Ot,aJ as Tn,aM as Mn,aN as Cn,aO as Dt,cj as vn,bU as wn,aL as yt,bL as Pn,y as en,z as Qe,ck as An,aA as On,cl as Vn,aB as Ln,bV as Fn,aW as Dn,cm as Nn,ay as tn,cn as vt}from"./__vite-browser-external-CeOnjjgl.js";import{v as We,q as kn,o as Un,E as Hn,G as Le,H as nn,J as _n,u as Bn,m as rn,h as zn,a as jn,l as Wn,A as Kn,I as Yn,d as qn,p as $n,b as Gn}from"./useScrollLock-Ct5GyoVg.js";import{i as Xn,u as Jn,j as Qn,a as Zn,d as er,c as tr,e as nr,g as rr,k as or,p as sr,r as ir,h as lr}from"./ToolbarRootContext-Bs1pZOOn.js";function tt(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}const cr="Escape";function It(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function ft(e,t){return It(t,e===Qt||e===Lt,e===bt||e===St)}function wt(e,t,n){return It(t,e===Lt,n?e===bt:e===St)||e==="Enter"||e===" "||e===""}function ur(e,t,n){return It(t,n?e===bt:e===St,e===Lt)}function ar(e,t,n,o){const l=n?e===St:e===bt,c=e===Qt;return t==="both"||t==="horizontal"&&o?e===cr:It(t,l,c)}function fr(e,t){const{listRef:n,activeIndex:o,onNavigate:l=()=>{},enabled:c=!0,selectedIndex:i=null,allowEscape:R=!1,loopFocus:u=!1,nested:m=!1,rtl:v=!1,virtual:a=!1,focusItemOnOpen:p="auto",focusItemOnHover:b=!0,openOnArrowKeyDown:y=!0,disabledIndices:O=void 0,orientation:g="vertical",parentOrientation:S,id:V,resetOnPointerLeave:E=!0,externalTree:d,grid:L}=t,j=L!=null,q="rootStore"in e?e.rootStore:e,D=q.useState("open"),W=q.useState("floatingElement"),J=q.useState("domReferenceElement"),me=q.context.dataRef,he=Xt(W),$=Rn(J),P=We(he),H=kn(),oe=Un(d),z=r.useRef(p),T=r.useRef(i??-1),K=r.useRef(null),k=r.useRef(!0),s=le(f=>{l(T.current===-1?null:T.current,f)}),M=r.useRef(!!W),ae=r.useRef(D),U=r.useRef(!1),pe=r.useRef(!1),ge=r.useRef(null),h=We(O),F=We(D),se=We(i),Se=We(E),B=Pt(),ne=Pt(),Q=le(()=>{function f(_){a?oe?.events.emit("virtualfocus",_):ge.current=Hn(_,{sync:U.current,preventScroll:!0})}const x=n.current[T.current],X=pe.current;x&&f(x),(U.current?_=>_():_=>B.request(_))(()=>{const _=n.current[T.current]||x;if(!_)return;x||f(_),Re&&(X||!k.current)&&_.scrollIntoView?.({block:"nearest",inline:"nearest"})})});G(()=>{me.current.orientation=g},[me,g]),G(()=>{c&&(D&&W?(T.current=i??-1,z.current&&i!=null&&(pe.current=!0,s())):M.current&&(T.current=-1,s()))},[c,D,W,i,s]),G(()=>{if(c){if(!D){U.current=!1;return}if(W)if(o==null){if(U.current=!1,se.current!=null)return;if(M.current&&(T.current=-1,Q()),(!ae.current||!M.current)&&z.current&&(K.current!=null||z.current===!0&&K.current==null)){let f=0;const x=()=>{n.current[0]==null?(f<2&&(f?I=>ne.request(I):queueMicrotask)(x),f+=1):(T.current=K.current==null||wt(K.current,g,v)||m?Mt(n):Bt(n),K.current=null,s())};x()}}else _t(n.current,o)||(T.current=o,Q(),pe.current=!1)}},[c,D,W,o,se,m,n,g,v,s,Q,ne]),G(()=>{if(!c||W||!oe||a||!M.current)return;const f=oe.nodesRef.current,x=f.find(_=>_.id===H)?.context?.elements.floating,X=Ct(st(J??x??null)),I=f.some(_=>_.context&&He(_.context.elements.floating,X));x&&!I&&k.current&&x.focus({preventScroll:!0})},[c,W,J,oe,H,a]),G(()=>{ae.current=D,M.current=!!W}),G(()=>{D||(K.current=null,z.current=p)},[D,p]);const xe=o!=null,ce=le(f=>{if(!F.current)return;const x=n.current.indexOf(f.currentTarget);x!==-1&&(T.current!==x||o!==x)&&(T.current=x,s(f))}),ue=le(()=>S??oe?.nodesRef.current.find(f=>f.id===H)?.context?.dataRef?.current.orientation),de=le(()=>Mt(n,h.current)),ee=le(f=>{if(k.current=!1,U.current=!0,f.which===229||!F.current&&f.currentTarget===P.current)return;if(m&&ar(f.key,g,v,j)){ft(f.key,ue())||Le(f),q.setOpen(!1,Me(zt,f.nativeEvent)),jt(J)&&(a?oe?.events.emit("virtualfocus",J):J.focus());return}const x=T.current,X=Mt(n,O),I=Bt(n,O);if($||(f.key==="Home"&&(Le(f),T.current=X,s(f)),f.key==="End"&&(Le(f),T.current=I,s(f))),L!=null){const _=L(f,T.current,n,g,u,v,O,X,I);if(_!=null&&(T.current=_,s(f)),g==="both")return}if(ft(f.key,g)){if(Le(f),D&&!a&&Ct(f.currentTarget.ownerDocument)===f.currentTarget){T.current=wt(f.key,g,v)?X:I,s(f);return}wt(f.key,g,v)?u?x>=I?R&&x!==n.current.length?T.current=-1:(U.current=!1,T.current=X):T.current=at(n.current,{startingIndex:x,disabledIndices:O}):T.current=Math.min(I,at(n.current,{startingIndex:x,disabledIndices:O})):u?x<=X?R&&x!==-1?T.current=n.current.length:(U.current=!1,T.current=I):T.current=at(n.current,{startingIndex:x,decrement:!0,disabledIndices:O}):T.current=Math.max(X,at(n.current,{startingIndex:x,decrement:!0,disabledIndices:O})),_t(n.current,T.current)&&(T.current=-1),s(f)}}),Re=r.useMemo(()=>({onFocus(x){U.current=!0,ce(x)},onClick:({currentTarget:x})=>x.focus({preventScroll:!0}),onMouseMove(x){U.current=!0,pe.current=!1,b&&ce(x)},onPointerLeave(x){if(!F.current||!k.current||x.pointerType==="touch")return;U.current=!0;const X=x.relatedTarget;if(!(!b||n.current.includes(X))&&Se.current&&(ge.current?.(),ge.current=null,T.current=-1,s(x),!a)){const I=P.current,_=Ct(st(I));I&&He(I,_)&&I.focus({preventScroll:!0})}}}),[ce,F,P,b,n,s,Se,a]),te=r.useMemo(()=>a&&D&&xe&&{"aria-activedescendant":`${V}-${o}`},[a,D,xe,V,o]),Z=r.useMemo(()=>({"aria-orientation":g==="both"?void 0:g,...$?{}:te,onKeyDown(f){if(f.key==="Tab"&&f.shiftKey&&D&&!a){const x=bn(f.nativeEvent);if(x&&!He(P.current,x))return;Le(f),q.setOpen(!1,Me(Jt,f.nativeEvent)),jt(J)&&J.focus();return}ee(f)},onPointerMove(){k.current=!0}}),[te,ee,P,g,$,q,D,a,J]),re=r.useMemo(()=>{function f(I){q.setOpen(!0,Me(zt,I.nativeEvent,I.currentTarget))}function x(I){p==="auto"&&nn(I.nativeEvent)&&(z.current=!a)}function X(I){z.current=p,p==="auto"&&_n(I.nativeEvent)&&(z.current=!0)}return{onKeyDown(I){const _=q.select("open");k.current=!1;const ve=I.key.startsWith("Arrow"),De=ur(I.key,ue(),v),Ee=ft(I.key,g),Ae=(m?De:Ee)||I.key==="Enter"||I.key.trim()==="";if(a&&_)return ee(I);if(!(!_&&!y&&ve)){if(Ae){const fe=ft(I.key,ue());K.current=m&&fe?null:I.key}if(m){De&&(Le(I),_?(T.current=de(),s(I)):f(I));return}Ee&&(se.current!=null&&(T.current=se.current),Le(I),!_&&y?f(I):ee(I),_&&s(I))}},onFocus(I){q.select("open")&&!a&&(T.current=-1,s(I))},onPointerDown:X,onPointerEnter:X,onMouseDown:x,onClick:x}},[ee,p,de,m,s,q,y,g,ue,v,se,a]),A=r.useMemo(()=>({...te,...re}),[te,re]);return r.useMemo(()=>c?{reference:A,floating:Z,item:Re,trigger:re}:{},[c,A,Z,re,Re])}function dr(e,t){const{listRef:n,elementsRef:o,activeIndex:l,onMatch:c,disabledIndices:i,onTyping:R,enabled:u=!0,resetMs:m=750,selectedIndex:v=null}=t,a="rootStore"in e?e.rootStore:e,p=a.useState("open"),b=ht(),y=r.useRef(""),O=r.useRef(v??l??-1),g=r.useRef(null),S=le(d=>{function L(P){const H=o?.current[P];return!H||In(H)}function j(P){return L(P)?i==null||!Sn(At,P,i):!1}function q(P,H,oe=0){if(P.length===0)return-1;const z=(oe%P.length+P.length)%P.length,T=H.toLowerCase();for(let K=0;K<P.length;K+=1){const k=(z+K)%P.length;if(!(!P[k]?.toLowerCase().startsWith(T)||!j(k)))return k}return-1}const D=n.current;if(y.current.length>0&&d.key===" "&&(Le(d),R?.(!0)),y.current.length>0&&y.current[0]!==" "&&q(D,y.current)===-1&&d.key!==" "&&R?.(!1),D==null||d.key.length!==1||d.ctrlKey||d.metaKey||d.altKey)return;p&&d.key!==" "&&(Le(d),R?.(!0));const W=y.current==="";W&&(O.current=v??l??-1),D.every((P,H)=>P&&j(H)?P[0]?.toLowerCase()!==P[1]?.toLowerCase():!0)&&y.current===d.key&&(y.current="",O.current=g.current),y.current+=d.key,b.start(m,()=>{y.current="",O.current=g.current,R?.(!1)});const he=((W?v??l??-1:O.current)??0)+1,$=q(D,y.current,he);$!==-1?(c?.($),g.current=$):d.key!==" "&&(y.current="",R?.(!1))}),V=le(d=>{const L=d.relatedTarget,j=a.select("domReferenceElement"),q=a.select("floatingElement");He(j,L)||He(q,L)||(b.clear(),y.current="",O.current=g.current,R?.(!1))});G(()=>{!p&&v!==null||(b.clear(),g.current=null,y.current!==""&&(y.current=""))},[p,v,b]),G(()=>{p&&y.current===""&&(O.current=v??l??-1)},[p,v,l]);const E=r.useMemo(()=>({onKeyDown:S,onBlur:V}),[S,V]);return r.useMemo(()=>u?{reference:E,floating:E}:{},[u,E])}function pr(e){const[t,n]=r.useState({current:e,previous:null});return e!==t.current&&n({current:e,previous:t.current}),t.previous}function gr(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}function Wt({controlled:e,default:t,name:n,state:o="value"}){const{current:l}=r.useRef(e!==void 0),[c,i]=r.useState(t),R=l?e:c,u=r.useCallback(m=>{l||i(m)},[]);return[R,u]}const on=r.createContext(null),sn=r.createContext(null);function Ye(){const e=r.useContext(on);if(e===null)throw new Error(it(60));return e}function ln(){const e=r.useContext(sn);if(e===null)throw new Error(it(61));return e}let Kt=(function(e){return e.disabled="data-disabled",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const mr={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},nt={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},hr={disabled:!1,...nt},yr={valid(e){return e===null?null:e?{[Kt.valid]:""}:{[Kt.invalid]:""}}},xr={invalid:void 0,name:void 0,validityData:{state:mr,errors:[],error:"",value:"",initialValue:null},setValidityData:be,disabled:void 0,touched:nt.touched,setTouched:be,dirty:nt.dirty,setDirty:be,filled:nt.filled,setFilled:be,focused:nt.focused,setFocused:be,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:hr,markedDirtyRef:{current:!1},registerFieldControl:be,validation:{getValidationProps:(e,t=Zt)=>t,inputRef:{current:null},registerInput:be,commit:async()=>{},change:be}},Rr=r.createContext(xr);function Nt(e=!0){const t=r.useContext(Rr);if(t.setValidityData===be&&!e)throw new Error(it(28));return t}function br(e,t,n,o,l=!0,c){const{registerFieldControl:i}=Nt(),R=r.useRef(null);R.current||(R.current=Symbol()),G(()=>{const u=R.current;return!u||!l?void 0:(i(u,{controlRef:e,getValue:o,id:t,name:c,value:n}),()=>{i(u,void 0)})},[e,l,o,t,c,i,n])}const Sr=r.createContext({controlId:void 0,registerControlId:be,labelId:void 0,setLabelId:be,messageIds:[],setMessageIds:be,getDescriptionProps:e=>e});function cn(){return r.useContext(Sr)}function un(e={}){const{id:t,implicit:n=!1,controlRef:o}=e,{controlId:l,registerControlId:c}=cn(),i=Bn(t),R=n?l:void 0,u=xt(()=>Symbol("labelable-control")),m=r.useRef(!1),v=r.useRef(t!=null),a=le(()=>{!m.current||c===be||(m.current=!1,c(u.current,void 0))});return G(()=>{if(c===be)return;let p;if(n){const b=o?.current;En(b)&&b.closest("label")!=null?p=t??null:p=R??i}else if(t!=null)v.current=!0,p=t;else if(v.current)p=i;else{a();return}if(p===void 0){a();return}m.current=!0,c(u.current,p)},[t,o,R,c,n,i,u,a]),r.useEffect(()=>a,[a]),l??i}const Ir=(e,t)=>Object.is(e,t);function Ke(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Er(e,t,n){return!e||e.length===0?!1:e.some(o=>o===void 0?!1:Ke(t,o,n))}function ot(e,t,n){return!e||e.length===0?-1:e.findIndex(o=>o===void 0?!1:Ke(o,t,n))}function Tr(e,t,n){return e.filter(o=>!Ke(t,o,n))}function Vt(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function an(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function Mr(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(an(t)){for(const n of t)for(const o of n.items)if(o&&o.value==null&&o.label!=null)return!0;return!1}for(const n of t)if(n&&n.value==null&&n.label!=null)return!0;return!1}function fn(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return Vt(e)}function je(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?Vt(e.value):Vt(e)}function dn(e,t,n){function o(){return fn(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??o();if(Array.isArray(t)){const l=t,c=an(l)?l.flatMap(i=>i.items):l;if(e==null||typeof e!="object"){const i=c.find(R=>R.value===e);return i&&i.label!=null?i.label:o()}if("value"in e){const i=c.find(R=>R&&R.value===e.value);if(i&&i.label!=null)return i.label}}return o()}function Cr(e,t,n){return e.reduce((o,l,c)=>(c>0&&o.push(", "),o.push(ye.jsx(r.Fragment,{children:dn(l,t,n)},c)),o),[])}const C={id:Y(e=>e.id),labelId:Y(e=>e.labelId),modal:Y(e=>e.modal),multiple:Y(e=>e.multiple),items:Y(e=>e.items),itemToStringLabel:Y(e=>e.itemToStringLabel),itemToStringValue:Y(e=>e.itemToStringValue),isItemEqualToValue:Y(e=>e.isItemEqualToValue),value:Y(e=>e.value),hasSelectedValue:Y(e=>{const{value:t,multiple:n,itemToStringValue:o}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:je(t,o)!==""}),hasNullItemLabel:Y((e,t)=>t?Mr(e.items):!1),open:Y(e=>e.open),mounted:Y(e=>e.mounted),forceMount:Y(e=>e.forceMount),transitionStatus:Y(e=>e.transitionStatus),openMethod:Y(e=>e.openMethod),activeIndex:Y(e=>e.activeIndex),selectedIndex:Y(e=>e.selectedIndex),isActive:Y((e,t)=>e.activeIndex===t),isSelected:Y((e,t)=>{const n=e.isItemEqualToValue,o=e.value;return e.multiple?Array.isArray(o)&&o.some(l=>Ke(t,l,n)):Ke(t,o,n)}),isSelectedByFocus:Y((e,t)=>e.selectedIndex===t),popupProps:Y(e=>e.popupProps),triggerProps:Y(e=>e.triggerProps),triggerElement:Y(e=>e.triggerElement),positionerElement:Y(e=>e.positionerElement),listElement:Y(e=>e.listElement),popupSide:Y(e=>e.popupSide),scrollUpArrowVisible:Y(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:Y(e=>e.scrollDownArrowVisible),hasScrollArrows:Y(e=>e.hasScrollArrows)},vr=r.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:be,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function wr(){return r.useContext(vr)}function Pr(e,t,n=(o,l)=>o===l){return e.length===t.length&&e.every((o,l)=>n(o,t[l]))}const Fe=1;function pn(e,t){return Math.max(0,e-t)}function Ar(e,t){if(t<=0)return 0;const n=tt(e,0,t),o=n,l=t-n,c=o<=Fe,i=l<=Fe;return c&&i?o<=l?0:t:c?0:i?t:n}function to(e){const{id:t,value:n,defaultValue:o=null,onValueChange:l,open:c,defaultOpen:i=!1,onOpenChange:R,name:u,form:m,autoComplete:v,disabled:a=!1,readOnly:p=!1,required:b=!1,modal:y=!0,actionsRef:O,inputRef:g,onOpenChangeComplete:S,items:V,multiple:E=!1,itemToStringLabel:d,itemToStringValue:L,isItemEqualToValue:j=Ir,highlightItemOnHover:q=!0,children:D}=e,{clearErrors:W}=wr(),{setDirty:J,setTouched:me,setFocused:he,validityData:$,setFilled:P,name:H,disabled:oe,validation:z,validationMode:T}=Nt(),K=un({id:t}),k=oe||a,s=H??u,[M,ae]=Wt({controlled:n,default:E?o??At:o,name:"Select",state:"value"}),[U,pe]=Wt({controlled:c,default:i,name:"Select",state:"open"}),ge=r.useRef([]),h=r.useRef([]),F=r.useRef(null),se=r.useRef(null),Se=r.useRef(0),B=r.useRef(null),ne=r.useRef([]),Q=r.useRef(!1),xe=r.useRef(null),ce=r.useRef(null),ue=r.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),de=r.useRef(!1),{mounted:ee,setMounted:Re,transitionStatus:te}=rn(U),{openMethod:Z,triggerProps:re}=Xn(U),A=xt(()=>new vn({id:K,labelId:void 0,modal:y,multiple:E,itemToStringLabel:d,itemToStringValue:L,isItemEqualToValue:j,value:M,open:U,mounted:ee,transitionStatus:te,items:V,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,f=w(A,C.activeIndex),x=w(A,C.selectedIndex),X=w(A,C.triggerElement),I=w(A,C.positionerElement),_=pr(Z),ve=Z??_??null,De=r.useMemo(()=>E?"":je(M,L),[E,M,L]),Ee=r.useMemo(()=>E&&Array.isArray(M)?M.map(N=>je(N,L)):je(M,L),[E,M,L]),Ae=We(A.state.triggerElement),fe=le(()=>Ee);br(Ae,K,M,fe,!k,u);const Oe=r.useRef(M),Ve=E?Array.isArray(M)&&M.length>0:M!=null&&je(M,L)!=="";G(()=>{M!==Oe.current&&A.set("forceMount",!0)},[A,M]),G(()=>{P(Ve)},[Ve,P]),G(function(){const ie=ne.current;let Te;if(E){const Ie=Array.isArray(M)?M:[];if(Ie.length===0)Te=null;else{const Ue=Ie[Ie.length-1],ze=ot(ie,Ue,j);Te=ze===-1?null:ze}}else{const Ie=ot(ie,M,j);Te=Ie===-1?null:Ie}Te===null&&(ce.current=null),!U&&A.set("selectedIndex",Te)},[Ve,E,U,M,ne,j,A,ce]);function we(N){const ie=$.initialValue;return Array.isArray(N)&&Array.isArray(ie)?!Pr(N,ie,(Te,Ie)=>Ke(Te,Ie,j)):N!==ie}Jn(M,()=>{W(s),J(we(M)),z.change(M)});const qe=le((N,ie)=>{R?.(N,ie),!ie.isCanceled&&(pe(N),!N&&(ie.reason===Jt||ie.reason===wn)&&(me(!0),he(!1),T==="onBlur"&&z.commit(M)))}),$e=le(()=>{Re(!1),A.update({activeIndex:null,openMethod:null}),S?.(!1)});Ft({enabled:!O,open:U,ref:F,onComplete(){U||$e()}}),r.useImperativeHandle(O,()=>({unmount:$e}),[$e]);const Ne=le((N,ie)=>{l?.(N,ie),!ie.isCanceled&&ae(N)}),Pe=le(()=>{const N=A.state.listElement||F.current;if(!N)return;const ie=pn(N.scrollHeight,N.clientHeight),Te=Ar(N.scrollTop,ie),Ie=Te>0,Ue=Te<ie;A.state.scrollUpArrowVisible!==Ie&&A.set("scrollUpArrowVisible",Ie),A.state.scrollDownArrowVisible!==Ue&&A.set("scrollDownArrowVisible",Ue)}),_e=Qn({open:U,onOpenChange:qe,elements:{reference:X,floating:I}}),Ge=Zn(_e,{enabled:!p&&!k,event:"mousedown"}),Xe=zn(_e),ke=fr(_e,{enabled:!p&&!k,listRef:ge,activeIndex:f,selectedIndex:x,disabledIndices:At,onNavigate(N){N===null&&!U||A.set("activeIndex",N)},focusItemOnHover:q}),Be=dr(_e,{enabled:!p&&!k&&(U||!E),listRef:h,activeIndex:f,selectedIndex:x,disabledIndices:N=>gr(ge.current[N]),onMatch(N){U?A.set("activeIndex",N):Ne(ne.current[N],Me("none"))},onTyping(N){Q.current=N}}),Ze=r.useMemo(()=>{const N=Ot(Be.reference,ke.reference,Xe.reference,Ge.reference,re);return K&&(N.id=K),N},[Ge.reference,Be.reference,ke.reference,Xe.reference,re,K]),et=r.useMemo(()=>Ot(jn,Be.floating,ke.floating,Xe.floating),[Be.floating,ke.floating,Xe.floating]),lt=ke.item??Zt;Wn(()=>{A.update({popupProps:et,triggerProps:Ze})}),G(()=>{A.update({id:K,modal:y,multiple:E,value:M,open:U,mounted:ee,transitionStatus:te,popupProps:et,triggerProps:Ze,items:V,itemToStringLabel:d,itemToStringValue:L,isItemEqualToValue:j,openMethod:ve})},[A,K,y,E,M,U,ee,te,et,Ze,V,d,L,j,ve]);const Ce=r.useMemo(()=>({store:A,name:s,required:b,disabled:k,readOnly:p,multiple:E,highlightItemOnHover:q,setValue:Ne,setOpen:qe,listRef:ge,popupRef:F,scrollHandlerRef:se,handleScrollArrowVisibility:Pe,scrollArrowsMountedCountRef:Se,itemProps:lt,valueRef:B,valuesRef:ne,labelsRef:h,typingRef:Q,selectionRef:ue,firstItemTextRef:xe,selectedItemTextRef:ce,validation:z,onOpenChangeComplete:S,alignItemWithTriggerActiveRef:de,initialValueRef:Oe}),[A,s,b,k,p,E,q,Ne,qe,lt,z,S,Pe]),Je=Tn(g,z.inputRef),ct=E&&Array.isArray(M)&&M.length>0,ut=E?void 0:s,Et=r.useMemo(()=>!E||!Array.isArray(M)||!s?null:M.map(N=>{const ie=je(N,L);return ye.jsx("input",{type:"hidden",form:m,name:s,value:ie,disabled:k},ie)}),[E,M,m,s,L,k]);return ye.jsx(on.Provider,{value:Ce,children:ye.jsxs(sn.Provider,{value:_e,children:[D,ye.jsx("input",{...z.getValidationProps(k,{onFocus(){A.state.triggerElement?.focus({focusVisible:!0})},onChange(N){if(N.nativeEvent.defaultPrevented||k||p)return;const ie=N.currentTarget.value,Te=Me(Dt,N.nativeEvent);function Ie(){if(E)return;const Ue=ie.toLowerCase();let ze=ne.current.findIndex(Tt=>je(Tt,L).toLowerCase()===Ue||fn(Tt,d).toLowerCase()===Ue);ze===-1&&(ze=ne.current.findIndex((Tt,xn)=>{const Ht=h.current[xn];return Ht!=null&&Ht.toLowerCase()===Ue}));const Ut=ze===-1?void 0:ne.current[ze];Ut!=null&&Ne(Ut,Te)}A.set("forceMount",!0),queueMicrotask(Ie)}}),id:K&&ut==null?`${K}-hidden-input`:void 0,form:m,name:ut,autoComplete:v,value:De,disabled:k,required:b&&!ct,readOnly:p,ref:Je,style:s?Mn:Cn,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Et]})})}function Or(e,t){return e??t}function Vr(e){const t=e.getBoundingClientRect(),n=yt(e);if(Pn)return t;const o=n.getComputedStyle(e,"::before"),l=n.getComputedStyle(e,"::after");if(!(o.content!=="none"||l.content!=="none"))return t;const i=parseFloat(o.width)||0,R=parseFloat(o.height)||0,u=parseFloat(l.width)||0,m=parseFloat(l.height)||0,v=Math.max(t.width,i,u),a=Math.max(t.height,R,m),p=v-t.width,b=a-t.height;return{left:t.left-p/2,right:t.right+p/2,top:t.top-b/2,bottom:t.bottom+b/2}}const dt=2,Lr=400,Fr={...Kn,...yr,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},no=r.forwardRef(function(t,n){const{render:o,className:l,id:c,disabled:i=!1,nativeButton:R=!0,style:u,...m}=t,{setTouched:v,setFocused:a,validationMode:p,state:b,disabled:y}=Nt(),{labelId:O}=cn(),{store:g,setOpen:S,selectionRef:V,validation:E,readOnly:d,required:L,alignItemWithTriggerActiveRef:j,disabled:q}=Ye(),D=y||q||i,W=w(g,C.open),J=w(g,C.mounted),me=w(g,C.value),he=w(g,C.triggerProps),$=w(g,C.positionerElement),P=w(g,C.listElement),H=w(g,C.popupSide),oe=w(g,C.id),z=w(g,C.labelId),T=w(g,C.hasSelectedValue),K=J&&$?H:null,k=c??oe,s=Or(O,z);un({id:k});const M=We($),ae=r.useRef(null),{getButtonProps:U,buttonRef:pe}=en({disabled:D,native:R}),ge=le(Q=>{g.set("triggerElement",Q)}),h=ht(),F=ht(),se=ht();r.useEffect(()=>{if(W)return se.start(Lr,()=>{V.current.allowUnselectedMouseUp=!0,V.current.allowSelectedMouseUp=!0}),()=>{se.clear()};V.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},F.clear()},[W,V,F,se]);const Se=Ot(he,{id:k,role:"combobox","aria-expanded":W?"true":"false","aria-haspopup":"listbox","aria-controls":W?P?.id??Xt($)?.id:void 0,"aria-labelledby":s,"aria-readonly":d||void 0,"aria-required":L||void 0,tabIndex:D?-1:0,onFocus(Q){a(!0),W&&j.current&&S(!1,Me(Dt,Q.nativeEvent)),h.start(0,()=>{g.set("forceMount",!0)})},onBlur(Q){He($,Q.relatedTarget)||(v(!0),a(!1),p==="onBlur"&&E.commit(me))},onMouseDown(Q){if(W)return;const xe=st(Q.currentTarget);function ce(ue){if(!ae.current)return;const de=ue.target;if(He(ae.current,de)||He(M.current,de))return;const ee=Vr(ae.current);ue.clientX>=ee.left-dt&&ue.clientX<=ee.right+dt&&ue.clientY>=ee.top-dt&&ue.clientY<=ee.bottom+dt||S(!1,Me(An,ue))}F.start(0,()=>{xe.addEventListener("mouseup",ce,{once:!0})})}},m,U),B=E.getValidationProps(D,Se);B.role="combobox";const ne={...b,open:W,disabled:D,value:me,readOnly:d,popupSide:K,placeholder:!T};return Qe("button",t,{ref:[n,ae,pe,ge],state:ne,stateAttributesMapping:Fr,props:B})}),Dr={value:()=>null},ro=r.forwardRef(function(t,n){const{className:o,render:l,children:c,placeholder:i,style:R,...u}=t,{store:m,valueRef:v}=Ye(),a=w(m,C.value),p=w(m,C.items),b=w(m,C.itemToStringLabel),y=w(m,C.hasSelectedValue),O=!y&&i!=null&&c==null,g=w(m,C.hasNullItemLabel,O),S={value:a,placeholder:!y};let V=null;return typeof c=="function"?V=c(a):c!=null?V=c:!y&&i!=null&&!g?V=i:Array.isArray(a)?V=Cr(a,p,b):V=dn(a,p,b),Qe("span",t,{state:S,ref:[n,v],props:[{children:V},u],stateAttributesMapping:Dr})}),Nr=r.createContext(void 0),oo=r.forwardRef(function(t,n){const{store:o}=Ye(),l=w(o,C.mounted),c=w(o,C.forceMount);return l||c?ye.jsx(Nr.Provider,{value:!0,children:ye.jsx(On,{ref:n,...t})}):null}),gn=r.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function kr(){return r.useContext(gn)}function Ur(e){const{children:t,elementsRef:n,labelsRef:o,onMapChange:l}=e,c=le(l),i=r.useRef(0),R=xt(_r).current,u=xt(Hr).current,[m,v]=r.useState(0),a=r.useRef(m),p=le((S,V)=>{u.set(S,V??null),a.current+=1,v(a.current)}),b=le(S=>{u.delete(S),a.current+=1,v(a.current)}),y=r.useMemo(()=>{const S=new Map;return Array.from(u.keys()).filter(E=>E.isConnected).sort(Br).forEach((E,d)=>{const L=u.get(E)??{};S.set(E,{...L,index:d})}),S},[u,m]);G(()=>{if(typeof MutationObserver!="function"||y.size===0)return;const S=new MutationObserver(V=>{const E=new Set,d=L=>E.has(L)?E.delete(L):E.add(L);V.forEach(L=>{L.removedNodes.forEach(d),L.addedNodes.forEach(d)}),E.size===0&&(a.current+=1,v(a.current))});return y.forEach((V,E)=>{E.parentElement&&S.observe(E.parentElement,{childList:!0})}),()=>{S.disconnect()}},[y]),G(()=>{a.current===m&&(n.current.length!==y.size&&(n.current.length=y.size),o&&o.current.length!==y.size&&(o.current.length=y.size),i.current=y.size),c(y)},[c,y,n,o,m]),G(()=>()=>{n.current=[]},[n]),G(()=>()=>{o&&(o.current=[])},[o]);const O=le(S=>(R.add(S),()=>{R.delete(S)}));G(()=>{R.forEach(S=>S(y))},[R,y]);const g=r.useMemo(()=>({register:p,unregister:b,subscribeMapChange:O,elementsRef:n,labelsRef:o,nextIndexRef:i}),[p,b,O,n,o,i]);return ye.jsx(gn.Provider,{value:g,children:t})}function Hr(){return new Map}function _r(){return new Set}function Br(e,t){const n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}const mn=r.createContext(void 0);function zr(){const e=r.useContext(mn);if(!e)throw new Error(it(59));return e}function Rt(e,t){e&&Object.assign(e.style,t)}const jr={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},Wr={position:"fixed"},so=r.forwardRef(function(t,n){const{anchor:o,positionMethod:l="absolute",className:c,render:i,side:R="bottom",align:u="center",sideOffset:m=0,alignOffset:v=0,collisionBoundary:a="clipping-ancestors",collisionPadding:p,arrowPadding:b=5,sticky:y=!1,disableAnchorTracking:O,alignItemWithTrigger:g=!0,collisionAvoidance:S=Vn,style:V,...E}=t,{store:d,listRef:L,labelsRef:j,alignItemWithTriggerActiveRef:q,selectedItemTextRef:D,valuesRef:W,initialValueRef:J,popupRef:me,setValue:he}=Ye(),$=ln(),P=w(d,C.open),H=w(d,C.mounted),oe=w(d,C.modal),z=w(d,C.value),T=w(d,C.openMethod),K=w(d,C.positionerElement),k=w(d,C.triggerElement),s=w(d,C.isItemEqualToValue),M=w(d,C.transitionStatus),ae=r.useRef(null),U=r.useRef(null),[pe,ge]=r.useState(g),h=H&&pe&&T!=="touch";!H&&pe!==g&&ge(g),G(()=>{H||(C.scrollUpArrowVisible(d.state)&&d.set("scrollUpArrowVisible",!1),C.scrollDownArrowVisible(d.state)&&d.set("scrollDownArrowVisible",!1))},[d,H]),r.useImperativeHandle(q,()=>h),er((h||oe)&&P,T==="touch",K,k);const F=tr({anchor:o,floatingRootContext:$,positionMethod:l,mounted:H,side:R,sideOffset:m,align:u,alignOffset:v,arrowPadding:b,collisionBoundary:a,collisionPadding:p,sticky:y,disableAnchorTracking:O??h,collisionAvoidance:S,keepMounted:!0}),se=h?"none":F.side,Se=h?Wr:F.positionerStyles,B={open:P,side:se,align:F.align,anchorHidden:F.anchorHidden};G(()=>{d.set("popupSide",F.side)},[d,F.side]);const ne=le(de=>{d.set("positionerElement",de)}),Q=nr(t,B,{styles:Se,transitionStatus:M,props:E,refs:[n,ne],hidden:!H,inert:!P}),xe=r.useRef(0),ce=le(de=>{if(de.size===0&&xe.current===0||W.current.length===0)return;const ee=xe.current;if(xe.current=de.size,de.size===ee)return;const Re=Me(Dt);if(ee!==0&&!d.state.multiple&&z!==null&&ot(W.current,z,s)===-1){const Z=J.current,A=Z!=null&&ot(W.current,Z,s)!==-1?Z:null;he(A,Re),A===null&&(d.set("selectedIndex",null),D.current=null)}if(ee!==0&&d.state.multiple&&Array.isArray(z)){const te=re=>ot(W.current,re,s)!==-1,Z=z.filter(re=>te(re));(Z.length!==z.length||Z.some(re=>!Er(z,re,s)))&&(he(Z,Re),Z.length===0&&(d.set("selectedIndex",null),D.current=null))}if(P&&h){d.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const te={height:""};Rt(K,te),Rt(me.current,te)}}),ue=r.useMemo(()=>({...F,side:se,alignItemWithTriggerActive:h,setControlledAlignItemWithTrigger:ge,scrollUpArrowRef:ae,scrollDownArrowRef:U}),[F,se,h,ge]);return ye.jsx(Ur,{elementsRef:L,labelsRef:j,onMapChange:ce,children:ye.jsxs(mn.Provider,{value:ue,children:[H&&oe&&ye.jsx(Yn,{inert:Ln(!P),cutout:k}),Q]})})}),pt="base-ui-disable-scrollbar",Yt={className:pt,getElement(e){return ye.jsx("style",{nonce:e,href:pt,precedence:"base-ui:low",children:`.${pt}{scrollbar-width:none}.${pt}::-webkit-scrollbar{display:none}`})}},Kr=r.createContext(void 0),Yr={disableStyleElements:!1};function qr(){return r.useContext(Kr)??Yr}const $r={...$n,...tn},io=r.forwardRef(function(t,n){const{render:o,className:l,style:c,finalFocus:i,...R}=t,{store:u,popupRef:m,onOpenChangeComplete:v,setOpen:a,valueRef:p,firstItemTextRef:b,selectedItemTextRef:y,multiple:O,handleScrollArrowVisibility:g,scrollHandlerRef:S,listRef:V,highlightItemOnHover:E}=Ye(),{side:d,align:L,alignItemWithTriggerActive:j,isPositioned:q,setControlledAlignItemWithTrigger:D}=zr(),W=rr()!=null,J=ln(),me=or(),{nonce:he,disableStyleElements:$}=qr(),P=w(u,C.id),H=w(u,C.open),oe=w(u,C.openMethod),z=w(u,C.mounted),T=w(u,C.popupProps),K=w(u,C.transitionStatus),k=w(u,C.triggerElement),s=w(u,C.positionerElement),M=w(u,C.listElement),ae=r.useRef(!1),U=r.useRef(!1),pe=r.useRef({}),ge=Pt(),h=le(B=>{if(!s||!m.current||!U.current)return;if(ae.current||!j){g();return}const ne=s.style.top==="0px",Q=s.style.bottom==="0px";if(!ne&&!Q){g();return}const xe=$t(s),ce=rt(s.getBoundingClientRect().height,"y",xe),ue=st(s),de=yt(s),ee=de.getComputedStyle(s),Re=parseFloat(ee.marginTop),te=parseFloat(ee.marginBottom),Z=qt(de.getComputedStyle(m.current)),re=Math.min(ue.documentElement.clientHeight-Re-te,Z),A=B.scrollTop,f=gt(B);let x=0,X=null,I=!1,_=!1;const ve=fe=>{s.style.height=`${fe}px`},De=(fe,Oe)=>{const Ve=tt(fe,0,re-ce);Ve>0&&ve(ce+Ve),B.scrollTop=Oe,re-(ce+Ve)<=Fe&&(ae.current=!0),g()},Ee=ne?f-A:A,Ae=Math.min(ce+Ee,re);if(x=Ae,Ee<=Fe){De(Ee,ne?f:0);return}if(re-Ae>Fe)ne?_=!0:X=0;else if(I=!0,Q&&A<f){const fe=ce+Ee-re;X=A-(Ee-fe)}if(x=Math.ceil(x),x!==0&&ve(x),_||X!=null){const fe=gt(B),Oe=_?fe:tt(X,0,fe);Math.abs(B.scrollTop-Oe)>Fe&&(B.scrollTop=Oe)}(I||x>=re-Fe)&&(ae.current=!0),g()});r.useImperativeHandle(S,()=>h,[h]),Ft({open:H,ref:m,onComplete(){H&&v?.(!0)}});const F={open:H,transitionStatus:K,side:d,align:L};G(()=>{!s||!m.current||Object.keys(pe.current).length||(pe.current={top:s.style.top||"0",left:s.style.left||"0",right:s.style.right,height:s.style.height,bottom:s.style.bottom,minHeight:s.style.minHeight,maxHeight:s.style.maxHeight,marginTop:s.style.marginTop,marginBottom:s.style.marginBottom})},[m,s]),G(()=>{H||j||(U.current=!1,ae.current=!1,Rt(s,pe.current))},[H,j,s,m]),G(()=>{const B=m.current;if(!H||!k||!s||!B||j&&!q||u.state.transitionStatus==="ending")return;if(!j){U.current=!0,ge.request(g),B.style.removeProperty("--transform-origin");return}const ne=Gr(B);B.style.removeProperty("--transform-origin");try{let Q=y.current;Q?.isConnected||(Q=!C.hasSelectedValue(u.state)&&b.current?.isConnected?b.current:null);const xe=p.current,ce=yt(s),ue=ce.getComputedStyle(s),de=ce.getComputedStyle(B),ee=st(k),Re=$t(k),te=mt(k.getBoundingClientRect(),Re),Z=mt(s.getBoundingClientRect(),Re),re=te.height,A=M||B,f=A.scrollHeight,x=parseFloat(de.borderBottomWidth),X=parseFloat(ue.marginTop)||10,I=parseFloat(ue.marginBottom)||10,_=parseFloat(ue.minHeight)||100,ve=qt(de),De=5,Ee=5,Ae=20,fe=ee.documentElement.clientHeight-X-I,Oe=ee.documentElement.clientWidth,Ve=fe-te.bottom+re;let we,qe=me==="rtl"?te.right-Z.width:te.left,$e=0;if(Q&&xe){const Ce=mt(xe.getBoundingClientRect(),Re);we=mt(Q.getBoundingClientRect(),Re),qe=Z.left+(me==="rtl"?Ce.right-we.right:Ce.left-we.left);const Je=Ce.top-te.top+Ce.height/2;$e=we.top-Z.top+we.height/2-Je}const Ne=Ve+$e+I+x;let Pe=Math.min(fe,Ne);const _e=fe-X-I,Ge=Ne-Pe,Xe=Oe-Ee;s.style.left=`${tt(qe,De,Xe-Z.width)}px`,s.style.height=`${Pe}px`,s.style.maxHeight="none",s.style.marginTop=`${X}px`,s.style.marginBottom=`${I}px`,B.style.height="100%";const ke=gt(A),Be=Ge>=ke-Fe;Be&&(Pe=Math.min(fe,Z.height)-(Ge-ke));const Ze=te.top<Ae||te.bottom>fe-Ae||Math.ceil(Pe)+Fe<Math.min(f,_),et=(ce.visualViewport?.scale??1)!==1&&Fn;if(Ze||et){U.current=!0,Rt(s,pe.current),D(!1);return}const lt=Math.max(_,Pe);if(Be){const Ce=Math.max(0,fe-Ne);s.style.top=Z.height>=_e?"0":`${Ce}px`,s.style.height=`${Pe}px`,A.scrollTop=gt(A)}else s.style.bottom="0",A.scrollTop=Ge;if(we){const Ce=Z.top,Je=Z.height,ct=we.top+we.height/2,ut=Je>0?(ct-Ce)/Je*100:50,Et=tt(ut,0,100);B.style.setProperty("--transform-origin",`50% ${Et}%`)}(lt===fe||Pe>=ve)&&(ae.current=!0),g(),E&&u.state.selectedIndex===null&&u.state.activeIndex===null&&V.current[0]!=null&&u.set("activeIndex",0),U.current=!0}finally{ne()}},[u,H,s,k,p,b,y,m,g,j,D,ge,M,V,E,me,q]),r.useEffect(()=>{if(!j||!s||!H)return;const B=yt(s);function ne(Q){a(!1,Me(Nn,Q))}return Dn(B,"resize",ne)},[a,j,s,H]);const se={...M?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":O||void 0,id:`${P}-list`},onKeyDown(B){W&&Gn.has(B.key)&&B.stopPropagation()},onScroll(B){M||h(B.currentTarget)},...j&&{style:M?{height:"100%"}:jr}},Se=Qe("div",t,{ref:[n,m],state:F,stateAttributesMapping:$r,props:[T,se,lr(K),{className:!M&&j?Yt.className:void 0},R]});return ye.jsxs(r.Fragment,{children:[!$&&Yt.getElement(he),ye.jsx(qn,{context:J,modal:!1,disabled:!z,openInteractionType:oe,returnFocus:i,restoreFocus:!0,children:Se})]})});function qt(e){const t=e.maxHeight||"";return t.endsWith("px")&&parseFloat(t)||1/0}function gt(e){return pn(e.scrollHeight,e.clientHeight)}function $t(e){return sr.getScale(e)}function rt(e,t,n){return e/n[t]}function mt(e,t){return ir({x:rt(e.x,"x",t),y:rt(e.y,"y",t),width:rt(e.width,"x",t),height:rt(e.height,"y",t)})}const Gt=[["transform","none"],["scale","1"],["translate","0 0"]];function Gr(e){const{style:t}=e,n={};for(const[o,l]of Gt)n[o]=t.getPropertyValue(o),t.setProperty(o,l,"important");return()=>{for(const[o]of Gt){const l=n[o];l?t.setProperty(o,l):t.removeProperty(o)}}}let hn=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function Xr(e={}){const{label:t,metadata:n,textRef:o,indexGuessBehavior:l,index:c}=e,{register:i,unregister:R,subscribeMapChange:u,elementsRef:m,labelsRef:v,nextIndexRef:a}=kr(),p=r.useRef(-1),[b,y]=r.useState(c??(l===hn.GuessFromOrder?()=>{if(p.current===-1){const S=a.current;a.current+=1,p.current=S}return p.current}:-1)),O=r.useRef(null),g=r.useCallback(S=>{if(O.current=S,b!==-1&&S!==null&&(m.current[b]=S,v)){const V=t!==void 0;v.current[b]=V?t:o?.current?.textContent??S.textContent}},[b,m,v,t,o]);return G(()=>{if(c!=null)return;const S=O.current;if(S)return i(S,n),()=>{R(S)}},[c,i,R,n]),G(()=>{if(c==null)return u(S=>{const V=O.current?S.get(O.current)?.index:null;V!=null&&y(V)})},[c,u,y]),{ref:g,index:b}}const yn=r.createContext(void 0);function kt(){const e=r.useContext(yn);if(!e)throw new Error(it(57));return e}const lo=r.memo(r.forwardRef(function(t,n){const{render:o,className:l,style:c,value:i=null,label:R,disabled:u=!1,nativeButton:m=!1,...v}=t,a=r.useRef(null),p=Xr({label:R,textRef:a,indexGuessBehavior:hn.GuessFromOrder}),{store:b,itemProps:y,setOpen:O,setValue:g,selectionRef:S,typingRef:V,valuesRef:E,multiple:d,selectedItemTextRef:L,disabled:j,readOnly:q}=Ye(),D=w(b,C.isActive,p.index),W=w(b,C.open),J=w(b,C.isSelected,i),me=w(b,C.isSelectedByFocus,p.index),he=w(b,C.isItemEqualToValue),$=p.index,P=$!==-1,H=r.useRef(null);G(()=>{if(!P)return;const h=E.current;return h[$]=i,()=>{delete h[$]}},[P,$,i,E]),G(()=>{if(!P)return;const h=b.state.value;let F=h;d&&Array.isArray(h)&&(F=h.length>0?h[h.length-1]:void 0),F!==void 0&&Ke(i,F,he)&&(b.set("selectedIndex",$),a.current&&(L.current=a.current))},[P,$,d,he,b,i,L]);const oe=r.useRef(null),z=r.useRef("mouse"),T=r.useRef(!1),{getButtonProps:K,buttonRef:k}=en({disabled:u,focusableWhenDisabled:!0,native:m,composite:!0}),s={disabled:u,selected:J,highlighted:D};function M(h){if(j||q)return;const F=b.state.value;if(d){const se=Array.isArray(F)?F:[],Se=J?Tr(se,i,he):[...se,i];g(Se,Me(vt,h))}else g(i,Me(vt,h)),O(!1,Me(vt,h))}function ae(){S.current.dragY=0}const U={role:"option","aria-selected":J,tabIndex:W&&D?0:-1,onKeyDown(h){oe.current=h.key,b.set("activeIndex",$),h.key===" "&&V.current&&h.preventDefault()},onClick(h){const F=h.type==="click"&&z.current!=="touch",se=h.nativeEvent.pointerType,Se=F&&nn(h.nativeEvent)&&(se!==void 0||D),B=F&&!Se&&!T.current;T.current=!1,!(h.type==="keydown"&&oe.current===null)&&(u||h.type==="keydown"&&oe.current===" "&&V.current||B||(oe.current=null,M(h.nativeEvent)))},onPointerEnter(h){z.current=h.pointerType},onPointerMove(h){if(h.pointerType==="mouse"&&h.buttons===1){const F=S.current;F.dragY+=h.movementY,F.dragY**2>=64&&(F.allowUnselectedMouseUp=!0)}},onPointerDown(h){z.current=h.pointerType,T.current=!0,ae()},onMouseUp(){if(ae(),u||z.current==="touch"||T.current)return;const h=!S.current.allowSelectedMouseUp&&J,F=!S.current.allowUnselectedMouseUp&&!J;h||F||(T.current=!0,H.current?.click(),T.current=!1)}},pe=Qe("div",t,{ref:[k,n,p.ref,H],state:s,props:[y,U,v,K]}),ge=r.useMemo(()=>({selected:J,index:$,textRef:a,selectedByFocus:me,hasRegistered:P}),[J,$,a,me,P]);return ye.jsx(yn.Provider,{value:ge,children:pe})})),co=r.forwardRef(function(t,n){const o=t.keepMounted??!1,{selected:l}=kt();return o||l?ye.jsx(Jr,{...t,ref:n}):null}),Jr=r.memo(r.forwardRef((e,t)=>{const{render:n,className:o,style:l,keepMounted:c,...i}=e,{selected:R}=kt(),u=r.useRef(null),{transitionStatus:m,setMounted:v}=rn(R),p=Qe("span",e,{ref:[t,u],state:{selected:R,transitionStatus:m},props:[{"aria-hidden":!0,children:"✔️"},i],stateAttributesMapping:tn});return Ft({open:R,ref:u,onComplete(){R||v(!1)}}),p})),uo=r.memo(r.forwardRef(function(t,n){const{index:o,textRef:l,selectedByFocus:c,hasRegistered:i}=kt(),{firstItemTextRef:R,selectedItemTextRef:u}=Ye(),{render:m,className:v,style:a,...p}=t,b=r.useCallback(O=>{O&&(i&&o===0&&(R.current=O),i&&c&&(u.current=O))},[R,u,o,c,i]);return Qe("div",t,{ref:[b,n,l],props:p})}));export{jr as L,to as S,zr as a,Yt as b,no as c,ro as d,oo as e,so as f,io as g,lo as h,co as i,uo as j,yr as k,wr as l,Nt as m,cn as n,Wt as o,br as p,C as s,Ye as u};
import{l as K,r as o,j as e,d as E,c as a,a0 as W,J as H,a2 as X,X as Y,R as ee,k as $,a3 as te,a4 as R}from"./__vite-browser-external-CeOnjjgl.js";import{S as U,I as ae}from"./SegmentedControl-LnVjL9no.js";import{C as re}from"./ToolbarRootContext-Bs1pZOOn.js";import{S as z}from"./search-BpgAnH3M.js";import{C as se}from"./check-DPhmDgw5.js";import{P as oe,a as ie,b as ne,c as le,d as ce}from"./PopoverPopup-JsU4A3UY.js";import{P as de}from"./ProviderIcon-C8fKhRQt.js";import{H as ue}from"./HoverTooltip-8s49xhej.js";import{L as xe}from"./LocalOnlyNotice-BZolN8xC.js";import{u as me}from"./useCurrency-BS_xyhhg.js";import{i as he}from"./host-mode-Bc_iTzHk.js";import{L as fe}from"./loader-circle-9rHTQTld.js";import{T as pe}from"./terminal-Dbn_YmPM.js";import"./useScrollLock-Ct5GyoVg.js";import"./store-BLjK5TrP.js";import"./arrow-up-right-DAWmHSlU.js";import"./download-CH_YcQ58.js";const ge=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],ye=K("calendar",ge);const be=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],ke=K("folder",be),ve="flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-sm text-oai-black outline-none hover:bg-oai-gray-100 dark:text-white dark:hover:bg-oai-gray-800";function je({options:r,value:t,onChange:s,allValue:d="all",allLabel:h,searchPlaceholder:k,emptyLabel:S,ariaLabel:u,disabled:x=!1,className:T=""}){const[p,I]=o.useState(!1),[g,w]=o.useState(""),[c,m]=o.useState(-1),F=o.useRef(null),C=`${o.useId()}-listbox`,M=t===d?h:r.find(n=>n.value===t)?.label??t,N=g.trim().toLowerCase(),v=o.useMemo(()=>N?r.filter(n=>n.label.toLowerCase().includes(N)):r,[r,N]),y=o.useMemo(()=>[{value:d,label:h},...v],[d,h,v]),O=c>=0&&c<y.length?y[c]:null,P=n=>{s(n),I(!1),w(""),m(-1)};o.useEffect(()=>{p&&F.current?.querySelector('[data-active="true"]')?.scrollIntoView?.({block:"nearest"})},[p,c]);const L=n=>{if(n.key==="ArrowDown"||n.key==="ArrowUp"){n.preventDefault();const f=n.key==="ArrowDown";m(_=>{const D=y.length;return D?f?_>=D-1?0:_+1:_<=0?D-1:_-1:-1});return}if(n.key==="Enter"){const f=O||(N&&v.length?v[0]:null);if(!f)return;n.preventDefault(),P(f.value)}};return e.jsxs(oe,{open:p,onOpenChange:n=>{I(n),m(-1),n||w("")},children:[e.jsxs(ie,{disabled:x,"aria-label":u,className:E("inline-flex h-8 max-w-[12rem] shrink-0 items-center gap-1.5 rounded-md border border-oai-gray-200 bg-oai-white px-2.5 text-xs font-medium transition hover:border-oai-gray-300 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 disabled:opacity-60 data-[popup-open]:border-oai-gray-300 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:hover:border-oai-gray-700",t!==d?"text-oai-black dark:text-white":"text-oai-gray-700 dark:text-oai-gray-200",T),children:[e.jsx(ke,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-400","aria-hidden":!0}),e.jsx("span",{className:"truncate",children:M}),e.jsx(re,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-400","aria-hidden":!0})]}),e.jsx(ne,{children:e.jsx(le,{sideOffset:4,side:"bottom",align:"start",className:"z-[60]",children:e.jsxs(ce,{className:"w-56 overflow-hidden rounded-md border border-oai-gray-200 bg-white p-1 shadow-[0_12px_32px_-12px_rgba(0,0,0,0.18)] outline-none dark:border-oai-gray-800 dark:bg-oai-gray-950 dark:shadow-[0_12px_32px_-12px_rgba(0,0,0,0.6)]",children:[e.jsxs("div",{className:"relative mb-1",children:[e.jsx(z,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-oai-gray-400","aria-hidden":!0}),e.jsx("input",{type:"text",role:"combobox","aria-expanded":!0,"aria-controls":C,"aria-activedescendant":O?`${C}-${c}`:void 0,value:g,onChange:n=>{w(n.target.value),m(-1)},onKeyDown:L,placeholder:k,className:"h-8 w-full rounded border border-oai-gray-200 bg-transparent pl-8 pr-2 text-xs text-oai-black outline-none placeholder:text-oai-gray-400 focus:border-oai-gray-400 dark:border-oai-gray-800 dark:text-white dark:focus:border-oai-gray-500"})]}),e.jsxs("div",{ref:F,id:C,role:"listbox","aria-label":u,className:"max-h-64 overflow-y-auto",children:[y.map((n,f)=>e.jsxs("button",{id:`${C}-${f}`,type:"button",role:"option","aria-selected":t===n.value,"data-active":f===c?"true":void 0,onMouseEnter:()=>m(f),onClick:()=>P(n.value),className:E(ve,t===n.value&&"bg-oai-gray-100 dark:bg-oai-gray-800",f===c&&"ring-1 ring-inset ring-oai-gray-300 dark:ring-oai-gray-600"),children:[e.jsx("span",{className:"flex-1 truncate",children:n.label}),t===n.value?e.jsx(se,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}):null]},n.value)),v.length===0?e.jsx("div",{className:"px-2 py-3 text-center text-xs text-oai-gray-400 dark:text-oai-gray-500",children:S}):null]})]})})})]})}const we="tokentracker-sessions";async function Ne(r={}){const t=new URL(`/functions/${we}`,window.location.origin);r.from&&t.searchParams.set("from",r.from),r.to&&t.searchParams.set("to",r.to),r.limit&&t.searchParams.set("limit",String(r.limit)),r.refresh&&t.searchParams.set("refresh","1");const s=await fetch(t.toString(),{headers:{Accept:"application/json"},cache:"no-store"}),d=await s.json().catch(()=>null);if(!s.ok){const h=s.status===404?a("sessions.error.outdated_app"):`Request failed with HTTP ${s.status}`,k=new Error(d?.error||h);throw k.status=s.status,k}return d}const Q=he(),_e=[],A=100,Se=[{id:"all",label:()=>a("sessions.filter.source_all")},{id:"claude",label:()=>"Claude Code"},{id:"codex",label:()=>"Codex"}],Z=[{id:"all",days:0,label:()=>a("sessions.filter.range_all")},{id:"7d",days:7,label:()=>a("sessions.filter.range_7d")},{id:"30d",days:30,label:()=>a("sessions.filter.range_30d")},{id:"90d",days:90,label:()=>a("sessions.filter.range_90d")}];function Ce(r){const t=Z.find(d=>d.id===r)?.days||0;if(!t)return 0;const s=new Date;return s.setDate(s.getDate()-(t-1)),s.setHours(0,0,0,0),s.getTime()}function Le(r,t){if(!t)return!0;const s=Date.parse(r.ended_at||r.started_at||"");return Number.isFinite(s)?s>=t:!0}function De(r,t){if(!r)return"—";const s=Date.parse(r);if(!Number.isFinite(s))return"—";try{return new Date(s).toLocaleString(t||void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return new Date(s).toISOString().slice(0,16).replace("T"," ")}}function Ie(r){const t=Number(r);if(!Number.isFinite(t)||t<=0)return null;const s=Math.round(t/6e4);if(s<60)return a("sessions.duration.minutes",{minutes:s});const d=Math.floor(s/60),h=s%60;return a("sessions.duration.hours",{hours:d,minutes:h})}async function G(r){if(navigator?.clipboard?.writeText)return await navigator.clipboard.writeText(r),!0;const t=document.createElement("textarea");t.value=r,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();const s=document.execCommand("copy");return document.body.removeChild(t),s}const Me=ee.memo(function({session:t,locale:s}){const{currency:d,rate:h}=me(),k=String(t.source||"").toUpperCase(),S=Ie(t.duration_ms),u=t.resume_command,x=t.project_key||a("sessions.project.unknown"),T=t.title||x,p=!!(t.title&&t.project_key),I=t.project_ref?`${t.project_ref}
${a("sessions.project.copy_hint")}`:void 0,g=async()=>{if(t.project_ref)try{await G(t.project_ref)?R({title:a("sessions.project.copied")}):R({title:a("sessions.project.copy_failed")})}catch{R({title:a("sessions.project.copy_failed")})}},w=m=>e.jsxs("span",{className:"group relative inline-flex min-w-0 max-w-full",children:[e.jsx(ue,{text:I,placement:"bottom"}),e.jsx("button",{type:"button",onClick:g,"aria-label":a("sessions.project.copy_aria",{project:x}),className:E("max-w-full truncate rounded text-left underline decoration-dotted decoration-oai-gray-300 underline-offset-4 hover:decoration-oai-gray-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:decoration-oai-gray-600 dark:hover:decoration-oai-gray-400",m),children:x})]}),c=async()=>{if(u)try{await G(u)?R({title:a("sessions.resume.copied")}):R({title:a("sessions.resume.copy_failed")})}catch{R({title:a("sessions.resume.copy_failed")})}};return e.jsxs("li",{className:"flex flex-col gap-3 py-4 sm:flex-row sm:items-start",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-start gap-2.5",children:[e.jsx("span",{className:"mt-0.5 shrink-0 text-oai-gray-400 dark:text-oai-gray-500",children:e.jsx(de,{provider:k,size:20})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[!t.title&&t.project_ref?w("font-medium text-oai-black dark:text-white"):e.jsx("span",{className:"truncate font-medium text-oai-black dark:text-white",children:T}),t.first_pass?e.jsx("span",{className:"inline-flex items-center rounded-full bg-emerald-50 px-2 py-0.5 text-[11px] font-medium text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-300",children:a("sessions.badge.first_pass")}):null]}),e.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:[p?e.jsxs(e.Fragment,{children:[t.project_ref?w("hover:text-oai-black dark:hover:text-white"):e.jsx("span",{className:"truncate",children:x}),e.jsx("span",{"aria-hidden":!0,children:"·"})]}):null,e.jsx("span",{className:"truncate",children:t.model||a("sessions.model.unknown")}),e.jsx("span",{"aria-hidden":!0,children:"·"}),e.jsx("span",{className:"tabular-nums",children:De(t.started_at,s)}),S?e.jsxs(e.Fragment,{children:[e.jsx("span",{"aria-hidden":!0,children:"·"}),e.jsx("span",{className:"tabular-nums",children:S})]}):null]})]})]}),e.jsxs("div",{className:"flex items-start gap-5 pl-[30px] sm:pl-0",children:[e.jsxs("dl",{className:"flex items-start gap-6 text-right",children:[e.jsxs("div",{className:"flex w-16 flex-col-reverse",children:[e.jsx("dt",{className:"text-[11px] text-oai-gray-400 dark:text-oai-gray-500",children:a("sessions.col.tokens")}),e.jsx("dd",{className:"tabular-nums text-sm font-medium text-oai-black dark:text-white",children:$(t.total_tokens)})]}),e.jsxs("div",{className:"flex w-16 flex-col-reverse",children:[e.jsx("dt",{className:"text-[11px] text-oai-gray-400 dark:text-oai-gray-500",children:a("sessions.col.cost")}),e.jsx("dd",{className:"tabular-nums text-sm font-medium text-oai-black dark:text-white",children:te(t.cost_usd,{currency:d,rate:h})})]}),e.jsxs("div",{className:"hidden w-10 flex-col-reverse sm:flex",children:[e.jsx("dt",{className:"text-[11px] text-oai-gray-400 dark:text-oai-gray-500",children:a("sessions.col.turns")}),e.jsx("dd",{className:"tabular-nums text-sm font-medium text-oai-black dark:text-white",children:$(t.turns)})]}),e.jsxs("div",{className:"hidden w-10 flex-col-reverse sm:flex",children:[e.jsx("dt",{className:"text-[11px] text-oai-gray-400 dark:text-oai-gray-500",children:a("sessions.col.edits")}),e.jsx("dd",{className:"tabular-nums text-sm font-medium text-oai-black dark:text-white",children:$(t.edit_turns)})]})]}),e.jsxs("button",{type:"button",onClick:c,disabled:!u,title:u||a("sessions.resume.unavailable"),"aria-label":u?a("sessions.resume.copy_aria",{command:u}):a("sessions.resume.unavailable"),className:E("-mt-0.5 inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",u?"text-oai-gray-500 hover:bg-oai-gray-100 hover:text-oai-black dark:text-oai-gray-400 dark:hover:bg-oai-gray-800 dark:hover:text-white":"cursor-not-allowed text-oai-gray-300 dark:text-oai-gray-600"),children:[e.jsx(pe,{className:"h-3.5 w-3.5","aria-hidden":!0}),e.jsx("span",{className:"hidden sm:inline",children:a("sessions.resume.copy")})]})]})]})});function Je(){const[r,t]=o.useState(null),[s,d]=o.useState(null),[h,k]=o.useState(!0),[S,u]=o.useState(!1),[x,T]=o.useState("all"),[p,I]=o.useState("all"),[g,w]=o.useState("all"),[c,m]=o.useState(""),[F,C]=o.useState(A),M=o.useRef(0),{resolvedLocale:N}=W(),v=o.useCallback(async(i=!1)=>{const b=++M.current;i?u(!0):k(!0),d(null);try{const l=await Ne({refresh:i});b===M.current&&t(l)}catch(l){b===M.current&&d(l?.message||String(l))}finally{b===M.current&&(k(!1),u(!1))}},[]);o.useEffect(()=>{Q||H()?v(!1):k(!1)},[v]);const y=r?.sessions||_e,O=o.useMemo(()=>{const i=new Set,b=[];for(const l of y){const j=l.project_key;!j||i.has(j)||(i.add(j),b.push({value:j,label:j}))}return b.sort((l,j)=>l.label.localeCompare(j.label))},[y]),P=o.useDeferredValue(c),L=o.useMemo(()=>{const i=P.trim().toLowerCase(),b=Ce(p);return y.filter(l=>x!=="all"&&l.source!==x||g!=="all"&&l.project_key!==g||!Le(l,b)?!1:i?`${l.title||""} ${l.project_key||""} ${l.model||""} ${l.project_ref||""} ${l.session_id||""}`.toLowerCase().includes(i):!0)},[y,x,g,p,P]),n=x!=="all"||p!=="all"||g!=="all"||c.trim()!=="";o.useEffect(()=>{C(A)},[x,g,p,P,y]);const f=o.useMemo(()=>L.slice(0,F),[L,F]),_=L.length>f.length,D=o.useCallback(()=>C(i=>i+A),[]),q=o.useRef(null);o.useEffect(()=>{if(!_||typeof IntersectionObserver>"u")return;const i=q.current;if(!i)return;const b=new IntersectionObserver(l=>{l.some(j=>j.isIntersecting)&&D()},{rootMargin:"400px"});return b.observe(i),()=>b.disconnect()},[_,D]);const B=o.useMemo(()=>Se.map(i=>({id:i.id,label:i.label()})),[N]),J=o.useMemo(()=>Z.map(i=>({id:i.id,label:i.label()})),[N]),V=Number(r?.session_count)>Number(r?.returned_count);return!Q&&!H()?e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx(xe,{})}):e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:e.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[e.jsxs("div",{className:"mb-8 flex flex-row items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"mb-3 text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:a("nav.sessions")}),e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400 sm:text-base",children:a("sessions.page.subtitle")})]}),e.jsx("button",{type:"button",onClick:()=>{v(!0)},disabled:S||h,"aria-label":a("sessions.page.refresh"),title:a("sessions.page.refresh"),className:"inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-oai-gray-200 text-oai-gray-600 transition-colors hover:bg-oai-gray-100 hover:text-oai-black focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-400 dark:hover:bg-oai-gray-800 dark:hover:text-white",children:e.jsx(X,{className:E("h-4 w-4",S&&"animate-spin"),"aria-hidden":!0})})]}),e.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2 pt-1 text-xs text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx(U,{ariaLabel:a("sessions.filter.source_aria"),options:B,value:x,onChange:T}),e.jsx(U,{className:"pl-2",ariaLabel:a("sessions.filter.range_aria"),leading:e.jsx(ye,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-400","aria-hidden":!0}),options:J,value:p,onChange:I}),e.jsx(je,{options:O,value:g,onChange:w,allLabel:a("sessions.filter.project_all"),searchPlaceholder:a("sessions.filter.project_search"),emptyLabel:a("sessions.filter.project_empty"),ariaLabel:a("sessions.filter.project_aria")}),e.jsxs("div",{className:"relative w-72 max-w-full",children:[e.jsx(z,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-oai-gray-400","aria-hidden":!0}),e.jsx(ae,{type:"search",value:c,onChange:i=>m(i.target.value),onKeyDown:i=>{i.key==="Escape"&&c&&(i.preventDefault(),m(""))},"aria-label":a("sessions.action.search_aria"),placeholder:a("sessions.search.placeholder"),className:"h-8 pl-9 pr-8 !border-oai-gray-200 dark:!border-oai-gray-800 focus:!border-oai-gray-400 focus:!ring-oai-gray-400/20 dark:focus:!border-oai-gray-500 dark:focus:!ring-oai-gray-500/20 [&::-webkit-search-cancel-button]:appearance-none"}),e.jsx("button",{type:"button",onMouseDown:i=>i.preventDefault(),onClick:()=>m(""),"aria-label":a("sessions.action.search_clear"),"aria-hidden":!c,tabIndex:c?0:-1,className:E("absolute right-2 top-1/2 flex h-6 w-6 -translate-y-1/2 items-center justify-center rounded-full text-oai-gray-400 transition duration-150 ease-out hover:bg-oai-gray-100 hover:text-oai-gray-600 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-gray-400/40 dark:hover:bg-oai-gray-800 dark:hover:text-oai-gray-200",c?"scale-100 opacity-100":"pointer-events-none scale-90 opacity-0"),children:e.jsx(Y,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),e.jsx("span",{className:"ml-auto shrink-0 tabular-nums text-oai-gray-500 dark:text-oai-gray-400",children:a("sessions.filter.result_count",{filtered:L.length,total:y.length})})]}),V?e.jsx("p",{className:"mb-4 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:a("sessions.truncated",{shown:r.returned_count,total:r.session_count})}):null,s&&!r?e.jsxs("div",{className:"rounded-xl border border-dashed border-red-300 py-16 text-center dark:border-red-500/40",children:[e.jsx("p",{className:"text-sm font-medium text-oai-black dark:text-white",children:a("sessions.error.title")}),e.jsx("p",{className:"mt-1 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s}),e.jsx("button",{type:"button",onClick:()=>{v(!1)},className:"mt-4 inline-flex h-8 items-center rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 hover:text-oai-black focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:border-oai-gray-800 dark:text-oai-gray-200 dark:hover:bg-oai-gray-800 dark:hover:text-white",children:a("sessions.error.retry")})]}):h?e.jsxs("div",{className:"flex items-center gap-2 py-16 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:[e.jsx(fe,{className:"h-4 w-4 animate-spin","aria-hidden":!0}),a("sessions.loading")]}):L.length===0?e.jsxs("div",{className:"rounded-xl border border-dashed border-oai-gray-200 py-16 text-center dark:border-oai-gray-800",children:[e.jsx("p",{className:"text-sm font-medium text-oai-black dark:text-white",children:n?a("sessions.empty.filtered_title"):a("sessions.empty.title")}),e.jsx("p",{className:"mt-1 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:n?a("sessions.empty.filtered_body"):a("sessions.empty.body")})]}):e.jsxs(e.Fragment,{children:[s?e.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400",children:a("shared.error.prefix",{error:s})}):null,e.jsx("ul",{className:"divide-y divide-oai-gray-200/70 dark:divide-oai-gray-800/70",children:f.map(i=>e.jsx(Me,{session:i,locale:N},i.session_hash))}),_?e.jsx("div",{ref:q,className:"flex justify-center pt-6",children:e.jsx("button",{type:"button",onClick:D,className:"inline-flex h-8 items-center rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-600 transition-colors hover:bg-oai-gray-100 hover:text-oai-black focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800 dark:hover:text-white",children:a("sessions.action.load_more")})}):null]}),e.jsx("p",{className:"mt-6 text-xs text-oai-gray-400 dark:text-oai-gray-500",children:a("sessions.privacy")})]})})})}export{Je as SessionsPage};
import{l as C,r as u,j as t,d as N,c as a,a as ie,ap as oe,bv as re,av as le,aw as ce,a7 as F,bw as ue,bx as de,u as ge,R as L,Y as me,a0 as H,m as I,by as he,bz as pe,N as $,bA as be,x as fe,bB as xe,bC as ye,bD as ve,bE as ke,bF as je,bG as Ne,bH as Se,L as Ce,a2 as we,bI as Le,a4 as _,f as Ae,bJ as Oe}from"./__vite-browser-external-CeOnjjgl.js";import{b as Ee,g as Pe,L as G,m as V}from"./react-CgmQzSd0.js";import{u as Ie,L as T}from"./use-limits-display-prefs-CSxCVsC3.js";import{P as _e}from"./ProviderIcon-C8fKhRQt.js";import{a as D,l as R}from"./limits-providers-DoHPHfeA.js";import{a as S,T as k,b as f,S as A,u as O}from"./use-native-settings-DlDAj7ZJ.js";import{P as Ge,u as Te,a as De}from"./use-session-efficiency-pref-C_65WyiQ.js";import{C as Re}from"./check-DPhmDgw5.js";import{C as Me}from"./copy-gCs3DnsV.js";import{A as Ue}from"./index-DtrsMn3Y.js";import{u as Fe}from"./useCurrency-BS_xyhhg.js";import{u as He}from"./useTokenFormat-RvsCI_oE.js";import{S as B}from"./Select-DKmJyUtS.js";import{I as $e}from"./info-CkFEh5Zu.js";import{C as Ve}from"./ConfirmModal-_Mz-U7UW.js";import{A as Be}from"./arrow-up-right-DAWmHSlU.js";import{D as ze}from"./download-CH_YcQ58.js";import"./Card-BBCwyki4.js";import"./ToolbarRootContext-Bs1pZOOn.js";import"./useScrollLock-Ct5GyoVg.js";import"./SelectItemText-BZFLz6Op.js";import"./DialogTitle-mSFue3N1.js";import"./store-BLjK5TrP.js";import"./DialogDescription-BFVeSjTD.js";const qe=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Ke=C("activity",qe);const Ze=[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]],We=C("flask-conical",Ze);const Ye=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],Je=C("grip-vertical",Ye);const Qe=[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]],Xe=C("languages",Qe);const et=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],tt=C("log-out",et);const nt=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],at=C("palette",nt);const st=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],it=C("user-round",st),ot=e=>!e.isLayoutDirty&&e.willUpdate(!1);function M(){const e=new Set,n=new WeakMap,s=()=>e.forEach(ot);return{add:i=>{e.add(i),n.set(i,i.addEventListener("willUpdate",s))},remove:i=>{e.delete(i);const o=n.get(i);o&&(o(),n.delete(i)),s()},dirty:s}}const rt=u.createContext(null);function lt(){const e=u.useRef(!1);return Ee(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function ct(){const e=lt(),[n,s]=u.useState(0),i=u.useCallback(()=>{e.current&&s(n+1)},[n]);return[u.useCallback(()=>Pe.postRender(i),[i]),n]}const z=e=>e===!0,ut=e=>z(e===!0)||e==="id",dt=({children:e,id:n,inherit:s=!0})=>{const i=u.useContext(G),o=u.useContext(rt),[r,l]=ct(),d=u.useRef(null),g=i.id||o;d.current===null&&(ut(s)&&g&&(n=n?g+"-"+n:g),d.current={id:n,group:z(s)&&i.group||M()});const p=u.useMemo(()=>({...d.current,forceRender:r}),[l]);return t.jsx(G.Provider,{value:p,children:e})},gt="shrink-0 text-oai-gray-900 dark:text-oai-gray-200";function mt({checked:e,onChange:n,ariaLabel:s}){return t.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":s,onClick:n,className:N("relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",e?"bg-oai-brand-500":"bg-oai-gray-300 dark:bg-oai-gray-700"),children:t.jsx("span",{className:N("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",e?"translate-x-[18px]":"translate-x-[3px]")})})}function ht({prefs:e}){const{order:n,visibility:s,toggle:i,moveToward:o}=e,[r,l]=u.useState(null),[d,g]=u.useState(null),p=c=>h=>{l(c),h.dataTransfer.effectAllowed="move",h.dataTransfer.setData("text/plain",c)},m=c=>h=>{h.preventDefault(),h.dataTransfer.dropEffect="move",r&&r!==c&&d!==c&&(g(c),o(r,c))},x=()=>{l(null),g(null)},y=c=>{c.preventDefault(),l(null),g(null)};return t.jsx(dt,{children:t.jsx("div",{className:"flex flex-col",children:n.map(c=>{const h=s[c]!==!1,b=r===c;return t.jsxs(V.div,{layout:!0,transition:{duration:.28,ease:[.22,1,.36,1]},draggable:!0,onDragStart:p(c),onDragOver:m(c),onDragEnd:x,onDrop:y,className:N("flex items-center gap-3 py-2 rounded-md","hover:bg-oai-gray-100/60 dark:hover:bg-oai-gray-800/60",b&&"opacity-40"),style:{cursor:b?"grabbing":"grab"},children:[t.jsx(Je,{className:"h-4 w-4 shrink-0 text-oai-gray-400 dark:text-oai-gray-500",strokeWidth:1.75,"aria-hidden":!0}),D(c)?t.jsx(_e,{provider:D(c),size:18,className:N("pointer-events-none",gt)}):null,t.jsx("span",{className:"flex-1 text-sm text-oai-gray-900 dark:text-oai-gray-200 select-none",children:R(c)}),t.jsx("div",{onMouseDown:v=>v.stopPropagation(),draggable:!1,children:t.jsx(mt,{checked:h,onChange:()=>i(c),ariaLabel:`${a("limits.settings.toggle_visible")}: ${R(c)}`})})]},c)})})})}function pt(e){if(!e||typeof e!="object")return"";const n=e.user_metadata&&typeof e.user_metadata=="object"?e.user_metadata:{},s=e.profile&&typeof e.profile=="object"?e.profile:{},i=n.full_name||n.name||s.name||n.user_name||n.preferred_username;return typeof i=="string"&&i.trim()?i.trim():typeof e.email=="string"&&e.email.includes("@")?e.email.split("@")[0].trim()||e.email.trim():typeof e.email=="string"?e.email.trim():""}function bt(e){return!e||typeof e!="object"?"":typeof e.email=="string"?e.email.trim():""}function ft(e){const n=typeof e=="string"?e.trim():"";if(!n)return null;const s=n.match(/^@?([A-Za-z0-9][A-Za-z0-9-]{0,38})$/),i=n.match(/^https:\/\/github\.com\/([A-Za-z0-9][A-Za-z0-9-]{0,38})\/?$/i),o=s?.[1]||i?.[1];return o?`https://github.com/${o}`:null}function E(e,n){console.warn(`[tokentracker] settings ${e}:`,n)}function xt(e,n,s){const[i,o]=u.useState(()=>oe()),r=n&&s&&re(),l=u.useCallback(async()=>{const d=!i;if(le(d),o(d),!!d)try{await ce(()=>e())}catch(g){E("cloud sync",g)}},[i,e]);return{cloudSyncOn:i,handleCloudSyncToggle:l,showLocalCloudSync:r}}function yt(e){const[n,s]=u.useState(!1),[i,o]=u.useState(!1),[r,l]=u.useState(!1),[d,g]=u.useState(!1),[p,m]=u.useState(null),[x,y]=u.useState(!1),[c,h]=u.useState(""),[b,v]=u.useState(!1),[w,P]=u.useState(""),[W,Y]=u.useState(""),[J,Q]=u.useState(!1),[X,ee]=u.useState(null),te=u.useMemo(()=>pt(e),[e]),ne=u.useMemo(()=>bt(e),[e]),ae=u.useMemo(()=>typeof e?.id=="string"?e.id.trim():"",[e]),se=u.useMemo(()=>({setAnonymousOn:o,setCustomDisplayName:m,setGithubUrl:P,setProfileLoading:l,setPublicProfileOn:s,setShowGithubOn:v}),[]);return{anonymousOn:i,customDisplayName:p,displayName:te,editingGithub:J,editingName:x,email:ne,githubError:X,githubInput:W,githubUrl:w,loadSetters:se,nameInput:c,profileLoading:r,profileSaving:d,publicProfileOn:n,setAnonymousOn:o,setCustomDisplayName:m,setEditingGithub:Q,setEditingName:y,setGithubError:ee,setGithubInput:Y,setGithubUrl:P,setNameInput:h,setProfileLoading:l,setProfileSaving:g,setPublicProfileOn:s,setShowGithubOn:v,showGithubOn:b,userId:ae}}function vt(e,n,s){u.useEffect(()=>{if(!n)return;let i=!0;return s.setProfileLoading(!0),(async()=>{try{const o=await F({getAccessToken:e});if(!i||!o)return;const r=await ue({accessToken:o});if(!i)return;s.setPublicProfileOn(!!r?.enabled),s.setAnonymousOn(!!r?.anonymous),r?.display_name&&s.setCustomDisplayName(r.display_name),s.setShowGithubOn(!!r?.show_github_url),s.setGithubUrl(r?.github_url||"")}catch(o){E("load public profile",o)}finally{i&&s.setProfileLoading(!1)}})(),()=>{i=!1}},[e,n,s])}function kt(e,n){return u.useCallback(async(s,{label:i,onError:o,onSuccess:r}={})=>{if(n.profileSaving)return!1;n.setProfileSaving(!0);try{const l=await F({getAccessToken:e});if(!l)return!1;const d=await de({accessToken:l,...s});return r?.(d),!0}catch(l){return o?o(l):E(i||"mutate profile",l),!1}finally{n.setProfileSaving(!1)}},[e,n])}function jt(e,n){return{anonymousOn:e.anonymousOn,customDisplayName:e.customDisplayName,displayName:e.displayName,editingName:e.editingName,handleAnonymousToggle:n.handleAnonymousToggle,handleSaveName:n.handleSaveName,nameInput:e.nameInput,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingName:e.setEditingName,setNameInput:e.setNameInput,startEditingName:n.startEditingName}}function Nt(e,n){return{editingGithub:e.editingGithub,githubError:e.githubError,githubInput:e.githubInput,githubUrl:e.githubUrl,handleSaveGithub:n.handleSaveGithub,handleShowGithubToggle:n.handleShowGithubToggle,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingGithub:e.setEditingGithub,setGithubError:e.setGithubError,setGithubInput:e.setGithubInput,showGithubOn:e.showGithubOn,startEditingGithub:n.startEditingGithub}}function St(e,n){const s=u.useCallback(async()=>{const o=!e.publicProfileOn;await n({enabled:o},{label:"toggle public profile",onSuccess:()=>e.setPublicProfileOn(o)})},[n,e]);return{handleAnonymousToggle:u.useCallback(async()=>{const o=!e.anonymousOn;await n({anonymous:o},{label:"toggle anonymous",onSuccess:()=>e.setAnonymousOn(o)})},[n,e]),handlePublicProfileToggle:s}}function Ct(e,n,s){const i=u.useCallback(async()=>{const r=e.nameInput.trim().slice(0,50);r&&await n({display_name:r},{label:"save display name",onSuccess:()=>{e.setCustomDisplayName(r),e.setEditingName(!1),s?.()}})},[n,e,s]),o=u.useCallback(()=>{e.setNameInput(e.customDisplayName||e.displayName),e.setEditingName(!0)},[e]);return{handleSaveName:i,startEditingName:o}}function wt(e,n){const s=u.useCallback(async()=>{if(!e.showGithubOn&&!e.githubUrl){e.setEditingGithub(!0),e.setGithubInput(""),e.setGithubError(null);return}const r=!e.showGithubOn;await n({show_github_url:r},{label:"toggle GitHub profile",onSuccess:()=>e.setShowGithubOn(r)})},[n,e]),i=u.useCallback(async()=>{const r=ft(e.githubInput);if(e.githubInput.trim()&&!r){e.setGithubError(a("settings.account.githubUrlInvalid"));return}e.setGithubError(null),await n({github_url:r,show_github_url:!!r},{label:"save GitHub profile",onError:l=>e.setGithubError(l?.message||a("settings.account.githubUrlInvalid")),onSuccess:l=>{e.setGithubUrl(l?.github_url||r||""),e.setShowGithubOn(!!r),e.setEditingGithub(!1)}})},[n,e]),o=u.useCallback(()=>{e.setGithubInput(e.githubUrl),e.setGithubError(null),e.setEditingGithub(!0)},[e]);return{handleSaveGithub:i,handleShowGithubToggle:s,startEditingGithub:o}}function Lt(){const e=ie(),n=yt(e.user),s=xt(e.getAccessToken,e.enabled,e.signedIn);vt(e.getAccessToken,e.signedIn,n.loadSetters);const i=kt(e.getAccessToken,n),o=St(n,i),r=Ct(n,i,e.refreshDisplayName),l=wt(n,i);return{...e,...s,email:n.email,handlePublicProfileToggle:o.handlePublicProfileToggle,userId:n.userId,name:jt(n,{...o,...r}),github:Nt(n,l),profileLoading:n.profileLoading,profileSaving:n.profileSaving,publicProfileOn:n.publicProfileOn}}function q({disabled:e,onCancel:n,onSave:s,saveLabel:i=a("settings.account.save")}){return t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",onClick:s,disabled:e,className:"rounded-md bg-oai-brand-500 px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-oai-brand-600 disabled:opacity-50",children:i}),t.jsx("button",{type:"button",onClick:n,className:"rounded-md px-2 py-1.5 text-xs text-oai-gray-500 transition-colors hover:text-oai-gray-700 dark:hover:text-oai-gray-300",children:a("settings.account.cancel")})]})}function At({nameInput:e,setEditingName:n,setNameInput:s,profileSaving:i,handleSaveName:o}){return t.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[t.jsx("input",{type:"text",value:e,onChange:r=>s(r.target.value),onKeyDown:r=>{r.key==="Enter"&&o(),r.key==="Escape"&&n(!1)},maxLength:50,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white",placeholder:a("settings.account.displayName")}),t.jsx(q,{disabled:i||!e.trim(),onCancel:()=>n(!1),onSave:o,saveLabel:i?a("settings.account.saving"):void 0})]})}function Ot({githubError:e,githubInput:n,handleSaveGithub:s,profileSaving:i,setEditingGithub:o,setGithubError:r,setGithubInput:l}){return t.jsxs("div",{className:"mt-2",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("input",{type:"text",value:n,onChange:d=>{l(d.target.value),e&&r(null)},onKeyDown:d=>{d.key==="Enter"&&s(),d.key==="Escape"&&(o(!1),r(null))},maxLength:100,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white",placeholder:a("settings.account.githubUrlPlaceholder")}),t.jsx(q,{disabled:i,onCancel:()=>{o(!1),r(null)},onSave:s,saveLabel:i?a("settings.account.saving"):void 0})]}),e?t.jsx("div",{className:"mt-1.5 text-xs text-red-600 dark:text-red-400",children:e}):null]})}function K({disabled:e=!1,label:n,onClick:s,title:i}){return t.jsxs("button",{type:"button",onClick:s,disabled:e,title:i,className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-40 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[t.jsx(Ge,{className:"h-3.5 w-3.5","aria-hidden":!0}),n]})}function Z({actions:e,editing:n,editor:s,hint:i,label:o}){return t.jsx("div",{className:"py-3",children:t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:o}),n?s:t.jsx("div",{className:"mt-0.5 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:i})]}),n?null:e]})})}function Et({name:e}){const n=e.anonymousOn?a("settings.account.displayNameDisabledWhileAnon"):void 0;return t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsx(K,{disabled:e.anonymousOn,label:a("settings.account.edit"),onClick:e.startEditingName,title:n}),t.jsx(k,{checked:!e.anonymousOn,onChange:e.handleAnonymousToggle,disabled:e.profileLoading||e.profileSaving,ariaLabel:a("settings.account.displayName")})]})}function Pt({name:e}){const{anonymousOn:n,customDisplayName:s,displayName:i,editingName:o,handleAnonymousToggle:r,handleSaveName:l,nameInput:d,profileLoading:g,profileSaving:p,setEditingName:m,setNameInput:x,startEditingName:y}=e,c=n?a("settings.account.displayNameAnonymousHint"):s||i;return t.jsx(Z,{label:a("settings.account.displayName"),editing:o,hint:c,editor:t.jsx(At,{nameInput:d,setEditingName:m,setNameInput:x,profileSaving:p,handleSaveName:l}),actions:t.jsx(Et,{name:e})})}function It({github:e}){const{editingGithub:n,githubError:s,githubInput:i,githubUrl:o,handleSaveGithub:r,handleShowGithubToggle:l,profileLoading:d,profileSaving:g,setEditingGithub:p,setGithubError:m,setGithubInput:x,showGithubOn:y,startEditingGithub:c}=e;return t.jsx(t.Fragment,{children:t.jsx(Z,{label:a("settings.account.githubUrl"),editing:n,hint:o||a("settings.account.githubUrlHint"),editor:t.jsx(Ot,{githubError:s,githubInput:i,handleSaveGithub:r,profileSaving:g,setEditingGithub:p,setGithubError:m,setGithubInput:x}),actions:t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsx(K,{label:a("settings.account.edit"),onClick:c}),t.jsx(k,{checked:y,onChange:l,disabled:d||g,ariaLabel:a("settings.account.githubUrl")})]})})})}function _t(){const{openLoginModal:e}=ge();return t.jsx(S,{title:a("settings.section.account"),children:t.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[t.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:a("settings.account.signedOutHint")}),t.jsx("button",{type:"button",onClick:e,className:"inline-flex h-8 shrink-0 items-center justify-center rounded-md bg-oai-gray-900 px-4 text-xs font-medium text-white transition-colors hover:bg-oai-gray-800 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100",children:a("settings.account.signIn")})]})})}function Gt({name:e,github:n}){return t.jsxs(t.Fragment,{children:[t.jsx(Pt,{name:e}),t.jsx(It,{github:n})]})}function Tt(){const e=Lt();return e.enabled?e.signedIn?t.jsxs(S,{title:a("settings.section.account"),subtitle:e.email||e.name.customDisplayName||e.name.displayName,action:t.jsx(Rt,{onSignOut:e.signOut}),children:[t.jsx(Dt,{userId:e.userId}),t.jsx(Mt,{settings:e}),t.jsx(Ut,{checked:e.publicProfileOn,disabled:e.profileLoading||e.profileSaving,onChange:e.handlePublicProfileToggle}),t.jsx(Ft,{visible:e.publicProfileOn,name:e.name,github:e.github})]}):t.jsx(_t,{}):null}function Dt({userId:e}){const[n,s]=L.useState(!1);if(!e)return null;const i=async()=>{try{if(typeof navigator>"u"||!navigator.clipboard?.writeText)return;await navigator.clipboard.writeText(e),s(!0),globalThis.setTimeout(()=>s(!1),1200)}catch{s(!1)}};return t.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:a("settings.account.userId")}),t.jsx("div",{className:"mt-0.5 truncate font-mono text-xs text-oai-gray-500 dark:text-oai-gray-400",children:e})]}),t.jsxs("button",{type:"button",onClick:i,className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800","aria-label":a("settings.account.copyUserId"),children:[n?t.jsx(Re,{className:"h-3.5 w-3.5","aria-hidden":!0}):t.jsx(Me,{className:"h-3.5 w-3.5","aria-hidden":!0}),n?a("settings.account.copied"):a("settings.account.copy")]})]})}function Rt({onSignOut:e}){return t.jsxs("button",{type:"button",onClick:()=>e(),className:"inline-flex h-7 items-center gap-1.5 text-xs font-medium text-oai-gray-500 transition-colors hover:text-oai-gray-700 dark:hover:text-oai-gray-300",children:[t.jsx(tt,{className:"h-3.5 w-3.5","aria-hidden":!0}),a("settings.account.signOut")]})}function Mt({settings:e}){return e.showLocalCloudSync?t.jsx(f,{label:a("settings.account.cloudSync"),hint:a("settings.account.cloudSyncHint"),control:t.jsx(k,{checked:e.cloudSyncOn,onChange:e.handleCloudSyncToggle,ariaLabel:a("settings.account.cloudSync")})}):null}function Ut({checked:e,disabled:n,onChange:s}){return t.jsx(f,{label:a("settings.account.publicProfile"),hint:a("settings.account.publicProfileHint"),control:t.jsx(k,{checked:e,onChange:s,disabled:n,ariaLabel:a("settings.account.publicProfile")})})}function Ft({visible:e,name:n,github:s}){return t.jsx(Ue,{initial:!1,children:e?t.jsx(V.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{height:{duration:.28,ease:[.22,1,.36,1]},opacity:{duration:.2,ease:[.22,1,.36,1]}},style:{overflow:"hidden"},className:"divide-y divide-oai-gray-200/60 dark:divide-oai-gray-800/60",children:t.jsx(Gt,{name:n,github:s})},"public-profile-fields"):null})}function Ht(){return[{value:"light",label:a("settings.appearance.theme.light"),Icon:he},{value:"dark",label:a("settings.appearance.theme.dark"),Icon:pe},{value:"system",label:a("settings.appearance.theme.system"),Icon:$}]}function $t(){return[{value:xe,label:a("settings.appearance.language.system")},{value:ye,label:a("settings.appearance.language.english")},{value:ve,label:a("settings.appearance.language.chinese")},{value:ke,label:a("settings.appearance.language.traditional_chinese")},{value:je,label:a("settings.appearance.language.japanese")},{value:Ne,label:a("settings.appearance.language.korean")},{value:Se,label:a("settings.appearance.language.german")}]}function Vt(e){if(!e)return null;try{const n=new Date(e);return Number.isNaN(n.getTime())?null:n.toLocaleString()}catch{return null}}function Bt(e,n){const s=a(`settings.appearance.currency.rate_source.${e}`),i=Vt(n),o=i?a("settings.appearance.currency.rate_updated",{when:i}):a("settings.appearance.currency.rate_never");return`${s} · ${o}`}function zt({locale:e,setLocale:n}){const s=$t();return t.jsx(B,{value:e,onValueChange:n,options:s,ariaLabel:a("settings.appearance.language.label"),className:"px-2.5 py-1.5 text-xs font-medium",leadingIcon:t.jsx(Xe,{className:"h-3.5 w-3.5 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})})}function qt({currency:e,setCurrency:n}){const s=be().map(i=>({value:i.code,label:a(i.labelKey)}));return t.jsx(B,{value:e,onValueChange:n,options:s,ariaLabel:a("settings.appearance.currency.label"),className:"px-3 py-1.5 text-xs font-medium"})}function Kt({currency:e,rate:n,rateSource:s,rateFetchedAt:i}){if(e===fe)return t.jsx(t.Fragment,{children:a("settings.appearance.currency.hint")});const o=Bt(s,i);return t.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[t.jsx("span",{children:`1 USD = ${n.toFixed(4)} ${e}`}),t.jsx("span",{role:"img","aria-label":o,title:o,className:"inline-flex h-4 w-4 cursor-help items-center justify-center text-oai-gray-400 hover:text-oai-gray-600 dark:text-oai-gray-500 dark:hover:text-oai-gray-300",children:t.jsx($e,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})}function Zt(){const{theme:e,setTheme:n}=me(),{locale:s,setLocale:i}=H(),{currency:o,rate:r,rateSource:l,rateFetchedAt:d,setCurrency:g}=Fe(),{mode:p,setMode:m}=He();return t.jsxs(S,{title:a("settings.section.appearance"),children:[t.jsx(f,{label:a("settings.appearance.theme.label"),hint:a("settings.appearance.theme.hint"),control:t.jsx(A,{options:Ht(),value:e,onChange:n})}),t.jsx(f,{label:a("settings.appearance.language.label"),hint:a("settings.appearance.language.hint"),control:t.jsx(zt,{locale:s,setLocale:i})}),t.jsx(f,{label:a("settings.appearance.currency.label"),hint:t.jsx(Kt,{currency:o,rate:r,rateSource:l,rateFetchedAt:d}),control:t.jsx(qt,{currency:o,setCurrency:g})}),t.jsx(f,{label:a("settings.appearance.token_format.label"),hint:a("settings.appearance.token_format.hint"),control:t.jsx(A,{options:[{value:I.COMPACT,label:a("settings.appearance.token_format.compact")},{value:I.FULL,label:a("settings.appearance.token_format.full")}],value:p,onChange:m})})]})}function U({labelKey:e}){return t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("span",{children:a(e)}),t.jsx("span",{className:"px-1.5 py-0.5 text-[8px] 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 scale-90 origin-left",children:a("qpd.card.badge")})]})}function Wt(){const{enabled:e,toggle:n}=Te(),{enabled:s,toggle:i}=De();return t.jsxs(S,{title:a("settings.section.labs"),children:[t.jsx(f,{label:t.jsx(U,{labelKey:"settings.labs.qpd.label"}),hint:a("settings.labs.qpd.hint"),control:t.jsx(k,{checked:e,onChange:n,ariaLabel:a("settings.labs.qpd.aria")})}),t.jsx(f,{label:t.jsx(U,{labelKey:"settings.labs.sessions.label"}),hint:a("settings.labs.sessions.hint"),control:t.jsx(k,{checked:s,onChange:i,ariaLabel:a("settings.labs.sessions.aria")})})]})}function Yt(){const{available:e,settings:n,setSetting:s,runAction:i}=O();if(!e)return null;const o=!!n?.launchAtLogin,r=n?.toastOnReset!==!1,l=n?.confettiOnReset!==!1,d=n?.launchAtLoginSupported!==!1,g=n?.updateStatus||null,p=!!n?.updateBusy,m=!!n?.isSyncing;return t.jsxs(S,{title:a("settings.section.menubar"),children:[t.jsx(f,{label:a("settings.menubar.appearance"),hint:a("settings.menubar.appearanceHint"),control:t.jsxs(Ce,{to:"/widgets",className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 no-underline transition-colors hover:bg-oai-gray-100 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[a("settings.menubar.appearanceLink"),t.jsx(Be,{className:"h-3.5 w-3.5","aria-hidden":!0})]})}),t.jsx(f,{label:a("settings.menubar.toastOnReset"),hint:a("settings.menubar.toastOnResetHint"),control:t.jsx(k,{checked:r,onChange:()=>s("toastOnReset",!r),ariaLabel:a("settings.menubar.toastOnReset")})}),t.jsx(f,{label:a("settings.menubar.confettiOnReset"),hint:a("settings.menubar.confettiOnResetHint"),control:t.jsx(k,{checked:l,onChange:()=>s("confettiOnReset",!l),ariaLabel:a("settings.menubar.confettiOnReset")})}),d?t.jsx(f,{label:a("settings.menubar.launchAtLogin"),hint:a("settings.menubar.launchAtLoginHint"),control:t.jsx(k,{checked:o,onChange:()=>s("launchAtLogin",!o),ariaLabel:a("settings.menubar.launchAtLogin")})}):null,t.jsx(f,{label:a("settings.menubar.syncNow"),hint:a("settings.menubar.syncNowHint"),control:t.jsxs("button",{type:"button",onClick:()=>i("syncNow"),disabled:m,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[t.jsx(we,{className:N("h-3.5 w-3.5",m&&"animate-spin"),"aria-hidden":!0}),m?a("settings.menubar.syncing"):a("settings.menubar.syncNow")]})}),t.jsx(f,{label:a("settings.menubar.updates"),hint:g||void 0,control:t.jsxs("button",{type:"button",onClick:()=>i("checkForUpdates"),disabled:p,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[t.jsx(ze,{className:"h-3.5 w-3.5","aria-hidden":!0}),a("settings.menubar.checkUpdates")]})})]})}function Jt(e,n){function s(r){return r.replace(/^v/,"").split(".").map(Number)}const i=s(e),o=s(n);for(let r=0;r<Math.max(i.length,o.length);r++){const l=i[r]||0,d=o[r]||0;if(l<d)return!0;if(l>d)return!1}return!1}function Qt(){const{available:e,settings:n,runAction:s}=O(),i=e&&n?.version,[o,r]=L.useState(!1),[l,d]=L.useState({open:!1,latestVersion:"",htmlUrl:""}),{resolvedLocale:g}=H(),p="0.84.1",m=async()=>{r(!0);try{const b=await fetch("https://api.github.com/repos/mm7894215/TokenTracker/releases/latest");if(!b.ok)throw new Error("Failed to fetch");const v=await b.json(),w=v.tag_name;Jt(p,w)?d({open:!0,latestVersion:w,htmlUrl:v.html_url}):_({title:a("settings.menubar.updates.upToDate")})}catch(b){console.error("Check updates failed:",b),_({title:a("settings.menubar.updates.failed")})}finally{r(!1)}},x=a("settings.menubar.updates.modalTitle"),y=a("settings.menubar.updates.modalDescription",{version:l.latestVersion}),c=a("settings.menubar.updates.modalConfirm"),h=a("settings.menubar.updates.modalCancel");return t.jsxs("div",{className:"mt-6 flex flex-col items-center justify-center gap-4 text-xs text-oai-gray-500 dark:text-oai-gray-500",children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[i?t.jsxs(t.Fragment,{children:[t.jsx("span",{children:a("settings.menubar.updates.footerCombined",{barVersion:n.version,coreVersion:p})}),t.jsx("span",{"aria-hidden":!0,children:"·"}),t.jsx("button",{type:"button",onClick:()=>s("openAbout"),className:"underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300",children:"GitHub"}),t.jsx("span",{"aria-hidden":!0,children:"·"})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{children:a("settings.menubar.updates.footerCore",{version:p})}),t.jsx("span",{"aria-hidden":!0,children:"·"}),t.jsx("button",{type:"button",onClick:m,disabled:o,className:"underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300 disabled:opacity-50",children:o?a("settings.menubar.updates.checking"):a("settings.menubar.checkUpdates")}),t.jsx("span",{"aria-hidden":!0,children:"·"})]}),t.jsxs("a",{href:Le,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300",children:[t.jsx(Ke,{className:"h-3.5 w-3.5","aria-hidden":!0}),a("settings.footer.statusPage")]})]}),t.jsx(Ve,{open:l.open,title:x,description:y,confirmLabel:c,cancelLabel:h,onConfirm:()=>{window.open(l.htmlUrl,"_blank"),d(b=>({...b,open:!1}))},onCancel:()=>d(b=>({...b,open:!1}))})]})}const j={APPEARANCE:"appearance",NATIVE_APP:"native-app",ACCOUNT:"account",LIMITS:"limits",LABS:"labs"};function Xt({prefs:e}){return t.jsx(A,{options:[{value:T.USED,label:a("limits.settings.display_mode_used")},{value:T.REMAINING,label:a("limits.settings.display_mode_remaining")}],value:e.displayMode,onChange:e.setDisplayMode})}function Cn(){const e=Ie(),{available:n,settings:s,setSetting:i}=O(),o=s?.toastOnReset!==!1,r=s?.confettiOnReset!==!1,[l,d]=Ae(),g=l.get("section"),m=Object.values(j).includes(g)&&(g!==j.NATIVE_APP||n)?g:j.APPEARANCE,x=c=>{const h=new URLSearchParams(l);c===j.APPEARANCE?h.delete("section"):h.set("section",c),d(h,{replace:!0})},y=[{id:j.APPEARANCE,label:a("settings.section.appearance"),Icon:at,content:t.jsx(Zt,{})},...n?[{id:j.NATIVE_APP,label:a("settings.section.menubar"),Icon:$,content:t.jsx(Yt,{})}]:[],{id:j.ACCOUNT,label:a("settings.section.account"),Icon:it,content:t.jsx(Tt,{})},{id:j.LIMITS,label:a("settings.section.limits"),Icon:Oe,content:t.jsxs("div",{className:"space-y-4",children:[t.jsxs(S,{title:a("settings.section.limits"),children:[t.jsx(f,{label:a("limits.settings.display_mode_label"),control:t.jsx(Xt,{prefs:e})}),t.jsx(f,{label:a("settings.menubar.toastOnReset"),hint:a("settings.menubar.toastOnResetHint"),control:t.jsx(k,{checked:o,disabled:!n,onChange:()=>i("toastOnReset",!o),ariaLabel:a("settings.menubar.toastOnReset")})}),t.jsx(f,{label:a("settings.menubar.confettiOnReset"),hint:a("settings.menubar.confettiOnResetHint"),control:t.jsx(k,{checked:r,disabled:!n,onChange:()=>i("confettiOnReset",!r),ariaLabel:a("settings.menubar.confettiOnReset")})})]}),t.jsx(S,{title:a("settings.limits.providers"),children:t.jsx(ht,{prefs:e})})]})},{id:j.LABS,label:a("settings.section.labs"),Icon:We,content:t.jsx(Wt,{})}];return t.jsx("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:t.jsx("main",{className:"flex-1 pb-12 pt-8 sm:pb-16 sm:pt-10",children:t.jsxs("div",{className:"mx-auto w-full max-w-5xl px-4 sm:px-6",children:[t.jsx("div",{className:"mb-7",children:t.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:a("settings.page.title")})}),t.jsxs("div",{className:"grid min-w-0 gap-6 md:grid-cols-[12rem_minmax(0,1fr)] md:gap-8 lg:grid-cols-[13.5rem_minmax(0,1fr)]",children:[t.jsx("aside",{className:"min-w-0 border-b border-oai-gray-200 pb-3 dark:border-oai-gray-800 md:border-b-0 md:border-r md:pb-0 md:pr-5",children:t.jsx("nav",{"aria-label":a("settings.page.title"),className:"flex gap-0 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden md:sticky md:top-6 md:flex-col md:gap-1 md:overflow-visible",children:y.map(({id:c,label:h,Icon:b})=>{const v=m===c;return t.jsxs("button",{id:`settings-nav-${c}`,type:"button","aria-current":v?"page":void 0,"aria-controls":`settings-panel-${c}`,onClick:()=>x(c),className:N("inline-flex min-h-10 min-w-max shrink-0 items-center gap-1.5 rounded-md px-2 py-2 text-left text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-oai-brand-500 md:w-full md:min-w-0 md:gap-2 md:px-3",v?"bg-oai-gray-100 text-oai-black dark:bg-oai-gray-800 dark:text-white":"text-oai-gray-500 hover:bg-oai-gray-50 hover:text-oai-gray-900 dark:text-oai-gray-400 dark:hover:bg-oai-gray-900 dark:hover:text-oai-gray-200"),children:[t.jsx(b,{className:N("h-4 w-4 shrink-0",v?"text-oai-black dark:text-white":"text-oai-gray-400 dark:text-oai-gray-500"),"aria-hidden":!0}),t.jsx("span",{className:"truncate",children:h})]},c)})})}),t.jsxs("div",{className:"min-w-0",children:[y.map(({id:c,label:h,content:b})=>t.jsx("section",{id:`settings-panel-${c}`,"aria-labelledby":`settings-nav-${c}`,"aria-label":h,"data-settings-panel":c,hidden:m!==c,children:b},c)),t.jsx(Qt,{})]})]})]})})})}export{Cn as SettingsPage};
import{w as l}from"./__vite-browser-external-CeOnjjgl.js";const i="tokentracker-skills";async function r(t){const e=new URL(`/functions/${i}`,window.location.origin);if(t)for(const[c,s]of Object.entries(t))s!=null&&s!==""&&e.searchParams.set(c,String(s));const o=await fetch(e.toString(),{headers:{Accept:"application/json"},cache:"no-store"}),a=await o.json().catch(()=>null);if(!o.ok)throw new Error(a?.error||`Request failed with HTTP ${o.status}`);return a}async function n(t){const e=await l(),o=await fetch(`/functions/${i}`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json",...e},cache:"no-store",body:JSON.stringify(t)}),a=await o.json().catch(()=>null);if(!o.ok||a?.ok===!1)throw new Error(a?.error||`Request failed with HTTP ${o.status}`);return a}function f(){return r({mode:"installed"})}function d(t={}){return r({mode:"discover",...t.force?{force:1}:{}})}function p(t,e=0,o=20){return r({mode:"search",q:t,offset:e,limit:o})}function k(){return r({mode:"repos"})}function S(t,e){return n({action:"install",skill:t,targets:e})}function h(t){return n({action:"uninstall",id:t})}function g(t){return n({action:"restore",id:t})}function m(t,e){return n({action:"set_targets",id:t,targets:e})}function w(t,e){return n({action:"import_local",directory:t,targets:e})}function y(t,e){return n({action:"delete_local",directory:t,targets:e||[]})}function j(t){return n({action:"add_repo",repo:t})}function T(t,e){return n({action:"remove_repo",owner:t,name:e})}function R(t={}){return r({mode:"popular",...t.force?{force:1}:{}})}function _(t={}){return r({mode:"updates",...t.force?{force:1}:{}})}function v(t={}){return r({mode:"skill_usage",...t.force?{force:1}:{}})}export{k as a,R as b,_ as c,d,v as e,y as f,f as g,m as h,S as i,w as j,T as k,j as l,g as r,p as s,h as u};
import{l as da,r as i,O as it,z as ca,j as e,X as Se,c as r,d as me,aG as na,ax as _a,aH as ot,y as lt,aI as ha,aJ as dt,aK as ct,W as ut,aL as xa,aM as mt,aN as gt,A as ht,aO as xt,az as pt,ay as ft,aP as yt,a3 as bt,J as kt,B as G,a2 as wt,R as vt,a4 as Ce}from"./__vite-browser-external-CeOnjjgl.js";import{L as jt}from"./LocalOnlyNotice-BZolN8xC.js";import{C as Nt}from"./Card-BBCwyki4.js";import{C as pa}from"./ConfirmModal-_Mz-U7UW.js";import{S as Ct,I as ua}from"./SegmentedControl-LnVjL9no.js";import{I as La}from"./info-CkFEh5Zu.js";import{P as be}from"./ProviderIcon-C8fKhRQt.js";import{m as fa}from"./react-CgmQzSd0.js";import{u as St}from"./useCurrency-BS_xyhhg.js";import{L as Z}from"./loader-circle-9rHTQTld.js";import{C as _e}from"./check-DPhmDgw5.js";import{T as ma}from"./trash-2-CUUFECPP.js";import{A as _t}from"./index-DtrsMn3Y.js";import{u as Lt}from"./use-reduced-motion-DUgAHZln.js";import{u as Pt,s as Rt,k as Pa,l as It,m as Et,n as Bt,o as $t,p as Tt,S as Ra,c as Ia,d as Ea,e as Ba,f as $a,g as Ta,h as Ge,j as We,i as Je}from"./SelectItemText-BZFLz6Op.js";import{t as Dt,u as ia,m as Mt}from"./useScrollLock-Ct5GyoVg.js";import{u as Ot,C as ga}from"./ToolbarRootContext-Bs1pZOOn.js";import{g as Ut,a as Ft,d as zt,b as At,c as Kt,e as Vt,s as qt,i as ya,u as ba,f as ka,r as Ht,h as wa,j as va,k as Gt,l as Wt}from"./skills-api-CcfxTvl9.js";import{F as Jt}from"./flame-BEU-cqaV.js";import{S as oa}from"./search-BpgAnH3M.js";import{D as Da}from"./download-CH_YcQ58.js";import{C as Qt}from"./chevron-right-kOKJJLco.js";import{P as Ma,a as Oa,b as Ua,c as Fa,d as za}from"./PopoverPopup-JsU4A3UY.js";import"./arrow-up-right-DAWmHSlU.js";import"./DialogTitle-mSFue3N1.js";import"./store-BLjK5TrP.js";import"./DialogDescription-BFVeSjTD.js";const Xt=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]],Aa=da("circle-arrow-up",Xt);const Yt=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],la=da("external-link",Yt);const Zt=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Ka=da("plus",Zt),Va=i.forwardRef(function(s,l){const{render:u,className:c,style:p,...m}=s,{store:h}=Pt(),b={open:it(h,Rt.open)};return ca("span",s,{state:b,ref:l,props:[{"aria-hidden":!0,children:"▼"},m],stateAttributesMapping:Dt})}),er="tt:hint:dismissed:";function qa(a){return er+a}function ar(a){if(typeof window>"u")return!1;try{return window.localStorage.getItem(qa(a))==="1"}catch{return!1}}function tr({id:a,children:s,className:l,ariaLabel:u}){const[c,p]=i.useState(()=>ar(a)),m=i.useCallback(()=>{if(typeof window<"u")try{window.localStorage.setItem(qa(a),"1")}catch{}p(!0)},[a]);return c?null:e.jsxs("div",{role:"note","aria-label":u||r("hint.dismissible_aria"),className:me("relative rounded-lg border border-oai-gray-200 bg-oai-gray-50 px-4 py-3 text-sm text-oai-gray-700","dark:border-oai-gray-800 dark:bg-oai-gray-900/40 dark:text-oai-gray-300",l),children:[e.jsx("button",{type:"button",onClick:m,"aria-label":r("hint.dismiss"),className:"absolute top-2 right-2 inline-flex h-7 w-7 items-center justify-center rounded-md text-oai-gray-500 transition-colors hover:bg-oai-gray-200/70 hover:text-oai-gray-700 focus:outline-none focus:ring-2 focus:ring-oai-blue/30 dark:text-oai-gray-400 dark:hover:bg-oai-gray-800/70 dark:hover:text-oai-gray-200",children:e.jsx(Se,{className:"h-4 w-4","aria-hidden":"true"})}),e.jsxs("div",{className:"flex items-start gap-2 pr-8",children:[e.jsx(La,{className:"mt-0.5 h-4 w-4 shrink-0 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":"true"}),e.jsx("div",{className:"min-w-0 flex-1",children:s})]})]})}function rr(a){if(!a)return null;for(const s of a.elements){const l=s.tagName;if(l==="BUTTON"||l==="INPUT"){const u=s;if(u.type==="submit")return u}}return null}let ja=(function(a){return a.checked="data-checked",a.unchecked="data-unchecked",a.indeterminate="data-indeterminate",a.disabled="data-disabled",a.readonly="data-readonly",a.required="data-required",a.valid="data-valid",a.invalid="data-invalid",a.touched="data-touched",a.dirty="data-dirty",a.filled="data-filled",a.focused="data-focused",a})({});function Ha(a){return i.useMemo(()=>({checked(s){return a.indeterminate?{}:s?{[ja.checked]:""}:{[ja.unchecked]:""}},...Pa}),[a.indeterminate])}const sr=i.createContext({disabled:!1});function nr(){return i.useContext(sr)}function ir(a,s,l,u=!0,c){const[p,m]=i.useState(),h=ia(c?`${c}-label`:void 0),x=a??s??p;return na(()=>{const b=a||s||!u?void 0:or(l.current,h);p!==b&&m(b)}),x}function or(a,s){const l=lr(a);if(l)return!l.id&&s&&(l.id=s),l.id||void 0}function lr(a){if(!a)return;const s=a.parentElement;if(s&&s.tagName==="LABEL")return s;const l=a.id;if(l){const c=a.nextElementSibling;if(c&&c.htmlFor===l)return c}const u=a.labels;return u&&u[0]}const dr=i.createContext(void 0);function cr(a=!0){const s=i.useContext(dr);if(s===void 0&&!a)throw new Error(_a(3));return s}const Ga=i.createContext(void 0);function ur(){const a=i.useContext(Ga);if(a===void 0)throw new Error(_a(14));return a}const mr="data-parent",gr=i.forwardRef(function(s,l){const{checked:u,className:c,defaultChecked:p=!1,"aria-labelledby":m,disabled:h=!1,form:x,id:b,indeterminate:o=!1,inputRef:j,name:C,onCheckedChange:k,parent:v=!1,readOnly:y=!1,render:N,required:E=!1,uncheckedValue:O,value:W,nativeButton:U=!1,style:ge,...w}=s,{clearErrors:ee}=It(),{disabled:B,name:K,setDirty:J,setFilled:ae,setFocused:F,setTouched:ke,state:we,validationMode:Ue,validityData:Le,validation:Fe}=Et(),ze=nr(),{labelId:T,controlId:te,registerControlId:Q,getDescriptionProps:ve}=Bt(),L=cr(),V=L?.parent,re=V&&L.allValues,I=B||ze.disabled||L?.disabled||h,se=K??C,P=W??se,Pe=ia(),je=ia();let ne=te;re?ne=v?je:`${V.id}-${P}`:b&&(ne=b);let pe={};re&&(v?pe=L.parent.getParentProps():P&&(pe=L.parent.getChildProps(P)));const{checked:Re=u,indeterminate:Ie=o,onCheckedChange:Ee,...Ne}=pe,q=L?.value,ie=L?.setValue,fe=L?.defaultValue,oe=i.useRef(null),le=ot(()=>Symbol("checkbox-control")),he=i.useRef(!1),{getButtonProps:Xe,buttonRef:Ae}=lt({disabled:I,native:U}),de=L?.validation??Fe,[_,Ye]=$t({controlled:P&&q&&!v?q.includes(P):Re,default:P&&fe&&!v?fe.includes(P):p,name:"Checkbox",state:"checked"}),Be=re?!!Re:_,ye=re&&Ie||o;na(()=>{Q!==ha&&(he.current=!0,Q(le.current,ne))},[ne,Q,le]),i.useEffect(()=>{const f=le.current;return()=>{!he.current||Q===ha||(he.current=!1,Q(f,void 0))}},[Q,le]),Tt(oe,Pe,_,void 0,!L&&!I,C);const X=i.useRef(null),$e=dt(j,X,de.inputRef,de.registerInput),Ze=ir(m,T,X,!U,ne??void 0);na(()=>{X.current&&(X.current.indeterminate=ye,_&&ae(!0))},[_,ye,ae]),Ot(_,()=>{L||(ee(se),ae(_),J(_!==Le.initialValue),de.change(_))});const Ke=ct({checked:_,disabled:I,form:x,name:v?void 0:se,id:U?void 0:ne??void 0,required:E,ref:$e,style:se?mt:gt,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(f){if(f.nativeEvent.defaultPrevented)return;if(y){f.preventDefault();return}const D=f.currentTarget.checked,ce=ht(xt,f.nativeEvent);if(k?.(D,ce),!ce.isCanceled&&(Ee?.(D,ce),!ce.isCanceled&&(Ye(D),P&&q&&ie&&!v&&!re))){const ue=D?[...q,P]:q.filter($=>$!==P);ie(ue,ce)}},onFocus(){oe.current?.focus()}},W!==void 0?{value:(L?_&&W:W)||""}:ut,ve,f=>de.getValidationProps(I,f));i.useEffect(()=>{if(!V||!P)return;const f=V.disabledStatesRef.current;return f.set(P,I),()=>{f.delete(P)}},[V,I,P]);const Te=i.useMemo(()=>({...we,checked:Be,disabled:I,readOnly:y,required:E,indeterminate:ye}),[we,Be,I,y,E,ye]),ea=Ha(Te),aa=ca("span",s,{state:Te,ref:[Ae,oe,l,L?.registerControlRef],props:[{id:U?ne??void 0:Pe,role:"checkbox","aria-checked":ye?"mixed":Be,"aria-readonly":y||void 0,"aria-required":E||void 0,"aria-labelledby":Ze,[mr]:v?"":void 0,onFocus(){I||F(!0)},onBlur(){const f=X.current;f&&(ke(!0),F(!1),Ue==="onBlur"&&de.commit(L?q:f.checked))},onKeyDown(f){if(f.key!=="Enter"||(f.preventBaseUIHandler(),f.defaultPrevented))return;const D=X.current?.form??null,ce=f.currentTarget,ue=f.nativeEvent,$=f.preventDefault,H=ue.preventDefault;let De=!1;f.preventDefault=()=>{De=!0,$.call(f)},ue.preventDefault=()=>{De=!0,H.call(ue)},H.call(ue),xa(ce).queueMicrotask(()=>{f.preventDefault=$,ue.preventDefault=H,De||rr(D)?.click()})},onClick(f){if(y||I)return;f.preventDefault();const D=X.current;D&&D.dispatchEvent(new(xa(D)).PointerEvent("click",{bubbles:!0,shiftKey:f.shiftKey,ctrlKey:f.ctrlKey,altKey:f.altKey,metaKey:f.metaKey}))}},w,Ne,Xe,ve,f=>de.getValidationProps(I,f)],stateAttributesMapping:ea});return e.jsxs(Ga.Provider,{value:Te,children:[aa,!_&&!L&&se&&!v&&O!==void 0&&e.jsx("input",{type:"hidden",form:x,name:se,value:O,disabled:I}),e.jsx("input",{...Ke,suppressHydrationWarning:!0})]})}),hr=i.forwardRef(function(s,l){const{render:u,className:c,style:p,keepMounted:m=!1,...h}=s,x=ur(),b=x.checked||x.indeterminate,{mounted:o,transitionStatus:j,setMounted:C}=Mt(b),k=i.useRef(null),v={...x,transitionStatus:j};pt({open:b,ref:k,onComplete(){b||C(!1)}});const N={...Ha(x),...ft,...Pa},E=m||o,O=ca("span",s,{ref:[l,k],state:v,stateAttributesMapping:N,props:h});return E?O:null});function xr(a,s){return`target:${a}:${s}`}function pr(a){return`remove:${a.id||a.directory}`}function Wa(a){if(!a)return null;const s=new Date(a).getTime();return Number.isFinite(s)?Math.floor((Date.now()-s)/864e5):null}function fr(a){const s=Wa(a);if(s==null)return null;if(s<=0)return r("skills.usage.today");if(s<30)return r("skills.usage.days_ago",{days:s});const l=Math.max(1,Math.floor(s/30));return r("skills.usage.months_ago",{months:l})}function yr(a){const s=Wa(a);return s==null?"bg-oai-gray-300 dark:bg-oai-gray-600":s<=7?"bg-emerald-500":s<=30?"bg-amber-500":"bg-oai-gray-300 dark:bg-oai-gray-600"}function ra({label:a,children:s}){return e.jsxs("div",{className:"flex items-center justify-between gap-3 py-2 text-sm",children:[e.jsx("dt",{className:"flex items-center gap-1 text-oai-gray-500 dark:text-oai-gray-400",children:a}),e.jsx("dd",{className:"text-right font-medium tabular-nums text-oai-black dark:text-white",children:s})]})}function br({skill:a,targets:s,busyKey:l,usage:u,hasUpdate:c,updating:p,onUpdate:m,onClose:h,onToggleTarget:x,onRemove:b}){return e.jsx(_t,{children:a?e.jsx(kr,{skill:a,targets:s,busyKey:l,usage:u,hasUpdate:c,updating:p,onUpdate:m,onClose:h,onToggleTarget:x,onRemove:b},a.id||a.directory):null})}function kr({skill:a,targets:s,busyKey:l,usage:u,hasUpdate:c,updating:p,onUpdate:m,onClose:h,onToggleTarget:x,onRemove:b}){const o=Lt(),{currency:j,rate:C}=St(),k=i.useRef(null);i.useEffect(()=>{const w=B=>{B.key==="Escape"&&(B.stopPropagation(),h?.())},ee=B=>{const K=B.target;K instanceof Element&&(k.current?.contains(K)||K.closest('[data-skill-row="1"]')||h?.())};return document.addEventListener("keydown",w),document.addEventListener("mousedown",ee),()=>{document.removeEventListener("keydown",w),document.removeEventListener("mousedown",ee)}},[h]);const v=a.name||a.directory,y=!!(a.repoOwner&&a.repoName),N=y?`https://github.com/${a.repoOwner}/${a.repoName}`:null,E=new Set(a.targets||[]),O=l===pr(a),W=fr(u?.lastUsedAt),U=!!(u&&u.invocations>0),ge=o?{duration:0}:{type:"spring",stiffness:320,damping:30,mass:.7};return e.jsxs(e.Fragment,{children:[e.jsx(fa.div,{className:"fixed inset-0 z-20 bg-oai-black/30 backdrop-blur-[2px] lg:hidden",initial:o?!1:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:o?0:.15},onClick:h,"aria-hidden":!0}),e.jsxs(fa.aside,{ref:k,role:"complementary","aria-label":v,initial:o?!1:{opacity:0,x:24,scale:.98},animate:{opacity:1,x:0,scale:1},exit:o?{opacity:0}:{opacity:0,x:24,scale:.98},transition:ge,className:"fixed inset-x-3 bottom-3 top-20 z-30 flex flex-col overflow-hidden rounded-2xl border border-white/40 bg-white/75 shadow-[0_24px_60px_-20px_rgba(15,23,42,0.25)] backdrop-blur-xl backdrop-saturate-150 supports-[backdrop-filter]:bg-white/65 dark:border-white/10 dark:bg-oai-gray-950/70 dark:shadow-[0_24px_60px_-20px_rgba(0,0,0,0.7)] dark:supports-[backdrop-filter]:bg-oai-gray-950/55 lg:inset-auto lg:right-6 lg:top-24 lg:bottom-6 lg:w-[22rem] lg:max-h-[calc(100vh-7.5rem)]",children:[e.jsxs("header",{className:"flex items-center gap-3 border-b border-white/40 bg-gradient-to-b from-white/30 to-transparent px-5 pb-4 pt-5 dark:border-white/10 dark:from-white/[0.04]",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h2",{className:"truncate text-base font-semibold text-oai-black dark:text-white",title:v,children:v}),y?e.jsxs("a",{href:N,target:"_blank",rel:"noreferrer noopener",className:"mt-1 inline-flex max-w-full items-center gap-1 truncate text-xs text-oai-gray-500 transition-colors hover:text-oai-black hover:underline dark:text-oai-gray-400 dark:hover:text-white",title:N,children:[e.jsxs("span",{className:"truncate",children:[a.repoOwner,"/",a.repoName]}),e.jsx(la,{className:"h-3 w-3 shrink-0","aria-hidden":!0})]}):a.directory&&a.directory!==v?e.jsx("div",{className:"mt-1 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",title:a.directory,children:a.directory}):null]}),e.jsx("button",{type:"button",onClick:h,"aria-label":r("skills.detail.close"),className:"-mr-1 inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-full text-oai-gray-500 transition hover:bg-oai-gray-100 hover:text-oai-black focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:text-oai-gray-400 dark:hover:bg-oai-gray-800 dark:hover:text-white",children:e.jsx(Se,{className:"h-4 w-4","aria-hidden":!0})})]}),e.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-5 py-5",children:[c?e.jsxs("div",{className:"mb-4 flex items-center gap-3 rounded-xl bg-sky-50/80 px-3 py-2.5 ring-1 ring-sky-200 dark:bg-sky-950/30 dark:ring-sky-800/60",children:[e.jsx(Aa,{className:"h-4 w-4 shrink-0 text-sky-600 dark:text-sky-300","aria-hidden":!0}),e.jsx("span",{className:"min-w-0 flex-1 text-xs text-sky-800 dark:text-sky-200",children:r("skills.update.available")}),e.jsxs("button",{type:"button",onClick:()=>m?.(a),disabled:p,className:"inline-flex h-7 shrink-0 items-center gap-1 rounded-md bg-sky-600 px-2.5 text-xs font-semibold text-white transition hover:bg-sky-700 focus:outline-none focus:ring-2 focus:ring-sky-400/40 disabled:cursor-not-allowed disabled:opacity-60 dark:bg-sky-500 dark:hover:bg-sky-400",children:[p?e.jsx(Z,{className:"h-3 w-3 animate-spin","aria-hidden":!0}):null,r("skills.update.action")]})]}):null,a.description?e.jsx("p",{className:"text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:a.description}):null,e.jsxs("section",{className:"mt-6",children:[e.jsx("h3",{className:"mb-1 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.usage.section_title")}),e.jsxs("dl",{className:"divide-y divide-oai-gray-200/60 dark:divide-white/[0.06]",children:[e.jsx(ra,{label:r("skills.usage.invocations"),children:yt(u?.invocations||0)}),e.jsx(ra,{label:r("skills.usage.last_used"),children:e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx("span",{className:me("h-1.5 w-1.5 rounded-full",yr(u?.lastUsedAt)),"aria-hidden":!0}),U?W||r("skills.usage.unknown"):r("skills.usage.never")]})}),e.jsx(ra,{label:e.jsxs(e.Fragment,{children:[r("skills.usage.cost"),e.jsx("span",{title:r("skills.usage.disclaimer"),className:"inline-flex cursor-help text-oai-gray-400 dark:text-oai-gray-500",children:e.jsx(La,{className:"h-3 w-3","aria-label":r("skills.usage.disclaimer")})})]}),children:bt(u?.cost||0,{currency:j,rate:C})})]}),U?null:e.jsx("p",{className:"mt-2 text-[11px] leading-4 text-oai-gray-400 dark:text-oai-gray-500",children:r("skills.usage.unused")})]}),e.jsxs("section",{className:"mt-6",children:[e.jsx("h3",{className:"mb-1 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.detail.sync_section_title")}),e.jsx("div",{children:(s||[]).map(w=>{const ee=E.has(w.id),B=l===xr(a.id,w.id),K=`skill-detail-sync-${a.id||a.directory}-${w.id}`;return e.jsxs("label",{htmlFor:K,className:"-mx-2 flex cursor-pointer items-center gap-3 rounded-md px-2 py-2 text-sm text-oai-black transition-colors hover:bg-oai-gray-100/70 dark:text-white dark:hover:bg-white/[0.05]",children:[e.jsx(gr,{id:K,checked:ee,disabled:B,onCheckedChange:J=>x?.(a,w.id,!!J),className:"peer flex h-4 w-4 shrink-0 items-center justify-center rounded-[4px] border border-oai-gray-300/80 bg-white/80 shadow-sm transition-colors hover:border-oai-gray-400 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-gray-400/40 focus-visible:ring-offset-1 focus-visible:ring-offset-transparent disabled:cursor-not-allowed disabled:opacity-50 data-[checked]:border-oai-black data-[checked]:bg-oai-black dark:border-oai-gray-500/60 dark:bg-oai-gray-900/60 dark:hover:border-oai-gray-400 dark:data-[checked]:border-white dark:data-[checked]:bg-white",children:e.jsx(hr,{className:"flex items-center justify-center text-white dark:text-oai-black",children:e.jsx(_e,{className:"h-3 w-3",strokeWidth:3.5,"aria-hidden":!0})})}),e.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center","aria-hidden":!0,children:e.jsx(be,{provider:w.id,size:16})}),e.jsx("span",{className:"flex-1",children:w.label}),B?e.jsx(Z,{className:"h-3.5 w-3.5 animate-spin text-oai-gray-400","aria-hidden":!0}):null]},w.id)})})]})]}),e.jsxs("footer",{className:"border-t border-white/40 bg-white/30 px-5 py-4 dark:border-white/10 dark:bg-white/[0.02]",children:[e.jsxs("button",{type:"button",onClick:()=>b?.(a),disabled:O,className:"inline-flex w-full items-center justify-center gap-2 rounded-lg border border-red-200/70 bg-white px-3 py-2 text-sm font-medium text-red-600 transition hover:border-red-300 hover:bg-red-50 focus:outline-none focus:ring-2 focus:ring-red-400/30 disabled:cursor-not-allowed disabled:opacity-60 dark:border-red-900/60 dark:bg-oai-gray-950 dark:text-red-300 dark:hover:border-red-800 dark:hover:bg-red-950/30",children:[O?e.jsx(Z,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):e.jsx(ma,{className:"h-3.5 w-3.5","aria-hidden":!0}),r("skills.detail.remove_button")]}),e.jsx("p",{className:"mt-2 text-center text-[11px] text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.detail.remove_confirm_hint")})]})]})]})}const wr=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),sa=["claude","codex"],A="popular",vr={claude:"text-orange-500 dark:text-orange-300",codex:"text-emerald-600 dark:text-emerald-300",grok:"text-zinc-700 dark:text-zinc-200",antigravity:"text-violet-600 dark:text-violet-300",gemini:"text-sky-600 dark:text-sky-300",opencode:"text-amber-600 dark:text-amber-300",hermes:"text-indigo-500 dark:text-indigo-300"},xe="all",M="skillssh";function Qe(a){return`${a.repoOwner||"local"}/${a.repoName||"local"}:${a.directory}`}function Ja(a){return String(a||"").replace(/\\/g,"/").trim().toLowerCase()}function jr(a){return Ja(a).split("/").filter(Boolean).pop()||""}function Nr(a){if(a.repoOwner||a.repoName)return"";const s=Ja(a.directory);return!s||s.includes("/")?"":`dir:${s}`}function Na(a){const s=jr(a.directory);return s?`dir:${s}`:""}function Ca(a){const s=new Set([Qe(a).toLowerCase()]);a.repoOwner&&a.repoName&&s.add(`${a.repoOwner}/${a.repoName}:${a.sourceDirectory||a.directory}`.toLowerCase());const l=Nr(a);return l&&s.add(l),s}function He(a){return`install:${Qe(a)}`}function Sa(a){return`remove:${a.id||a.directory}`}function Qa(a,s){return`target:${a}:${s}`}function Cr({target:a,state:s,busy:l,onToggle:u}){const c=s==="synced",p=s==="orphan",m=p?r("skills.dot.orphan_aria",{agent:a.label}):c?r("skills.dot.synced_aria",{agent:a.label}):r("skills.dot.off_aria",{agent:a.label});return e.jsxs("button",{type:"button",title:m,"aria-label":m,"aria-pressed":c,disabled:l,onClick:h=>{h.stopPropagation(),u?.(a.id,!c)},className:"relative flex h-7 w-7 items-center justify-center rounded-md transition-colors hover:bg-oai-gray-100 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/40 disabled:cursor-not-allowed dark:hover:bg-oai-gray-800/60",children:[l?e.jsx(Z,{className:"h-4 w-4 animate-spin text-oai-gray-400","aria-hidden":!0}):e.jsx("span",{className:me("flex h-[18px] w-[18px] items-center justify-center transition",c&&vr[a.id],!c&&!p&&"opacity-35 grayscale"),"aria-hidden":!0,children:e.jsx(be,{provider:a.id,size:18})}),p&&!l?e.jsx("span",{className:"absolute -bottom-px -right-px h-2 w-2 rounded-full bg-amber-500 ring-2 ring-oai-white dark:ring-oai-gray-900","aria-hidden":!0}):null]})}function Sr({skill:a,targets:s,onToggleTarget:l,busyKey:u}){return e.jsx("div",{className:"flex items-center gap-1",onClick:c=>c.stopPropagation(),children:s.map(c=>e.jsx(Cr,{target:c,state:a.targetStates?.[c.id]||"off",busy:u===Qa(a.id,c.id),onToggle:(p,m)=>l?.(a,p,m)},c.id))})}function _r({skill:a,targets:s,selected:l,onSelect:u,selectable:c,checked:p,onToggleSelect:m,onToggleTarget:h,hasUpdate:x,busyKey:b}){const o=a.repoOwner&&a.repoName?`${a.repoOwner}/${a.repoName}`:null,j=o?`${a.directory} · ${o}`:a.directory,C=k=>{(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),u?.(a))};return e.jsxs("div",{"data-skill-row":"1",role:"button",tabIndex:0,"aria-pressed":l,"aria-label":r("skills.row.open_details",{name:a.name||a.directory}),onClick:()=>u?.(a),onKeyDown:C,className:me("cursor-pointer rounded-md py-3 pr-2 transition focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30",l?"bg-oai-gray-100 ring-1 ring-oai-gray-200 dark:bg-oai-gray-800/60 dark:ring-oai-gray-800":p?"bg-oai-gray-50 dark:bg-oai-gray-900/40":"hover:bg-oai-gray-50 dark:hover:bg-oai-gray-900/40"),children:[e.jsxs("div",{className:"flex items-center gap-3",children:[c?e.jsx("label",{className:"flex shrink-0 items-center",onClick:k=>k.stopPropagation(),children:e.jsx("input",{type:"checkbox",checked:p,onChange:k=>m?.(a,k.target.checked),"aria-label":r("skills.select.row_aria",{name:a.name||a.directory}),className:"h-4 w-4 rounded border-oai-gray-300 text-oai-black focus:ring-oai-gray-400 dark:border-oai-gray-600 dark:bg-oai-gray-900 dark:text-white"})}):null,e.jsx("h2",{className:"min-w-0 flex-1 truncate text-sm font-semibold text-oai-black dark:text-white",title:j,children:a.name||a.directory}),x?e.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-full bg-sky-50 px-1.5 py-0.5 text-[10px] font-semibold text-sky-700 ring-1 ring-sky-200 dark:bg-sky-950/40 dark:text-sky-300 dark:ring-sky-800/60",children:[e.jsx(Aa,{className:"h-2.5 w-2.5","aria-hidden":!0}),r("skills.update.badge")]}):null,e.jsx(Sr,{skill:a,targets:s,onToggleTarget:h,busyKey:b}),e.jsx(Qt,{className:me("hidden h-4 w-4 shrink-0 text-oai-gray-300 transition-colors dark:text-oai-gray-600 lg:block",l&&"text-oai-gray-500 dark:text-oai-gray-300"),"aria-hidden":!0})]}),a.description?e.jsx("p",{className:me("mt-1 line-clamp-2 text-xs text-oai-gray-500 dark:text-oai-gray-400",c&&"pl-7"),children:a.description}):null]})}function Lr({agentFilter:a,agentOptions:s,onAgentFilter:l,filteredCount:u,totalCount:c,anyFilter:p,onClearFilters:m,searchQuery:h,onSearchQuery:x,searchPlaceholder:b}){return e.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2 pt-1 text-xs text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsxs(Ra,{value:a,onValueChange:l,children:[e.jsxs(Ia,{"aria-label":r("skills.filter.agent_label"),className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 bg-oai-white px-2.5 text-xs font-medium text-oai-gray-700 transition hover:border-oai-gray-300 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 data-[popup-open]:border-oai-gray-300 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-oai-gray-200 dark:hover:border-oai-gray-700",children:[e.jsxs("span",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:[r("skills.filter.agent_label"),":"]}),e.jsx(Ea,{children:o=>o==="all"?r("skills.filter.agent_all"):s.find(j=>j.id===o)?.label||o}),e.jsx(Va,{className:"text-oai-gray-400",children:e.jsx(ga,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),e.jsx(Ba,{children:e.jsx($a,{sideOffset:4,alignItemWithTrigger:!1,className:"z-[60]",children:e.jsxs(Ta,{className:"min-w-[var(--anchor-width)] overflow-hidden rounded-md border border-oai-gray-200 bg-white p-1 shadow-[0_12px_32px_-12px_rgba(0,0,0,0.18)] outline-none dark:border-oai-gray-800 dark:bg-oai-gray-950 dark:shadow-[0_12px_32px_-12px_rgba(0,0,0,0.6)]",children:[e.jsxs(Ge,{value:"all",className:"flex cursor-default select-none items-center justify-between gap-2 rounded px-3 py-1.5 text-sm text-oai-black outline-none data-[highlighted]:bg-oai-gray-100 dark:text-white dark:data-[highlighted]:bg-oai-gray-800",children:[e.jsx(We,{children:r("skills.filter.agent_all")}),e.jsx(Je,{children:e.jsx(_e,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),s.map(o=>e.jsxs(Ge,{value:o.id,className:"flex cursor-default select-none items-center justify-between gap-2 rounded px-3 py-1.5 text-sm text-oai-black outline-none data-[highlighted]:bg-oai-gray-100 dark:text-white dark:data-[highlighted]:bg-oai-gray-800",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(be,{provider:o.id,size:14}),e.jsx(We,{children:o.label})]}),e.jsx(Je,{children:e.jsx(_e,{className:"h-3.5 w-3.5","aria-hidden":!0})})]},o.id))]})})})]}),e.jsxs("div",{className:"relative w-56 max-w-full",children:[e.jsx(oa,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-oai-gray-400","aria-hidden":!0}),e.jsx(ua,{type:"search",value:h,onChange:o=>x(o.target.value),onKeyDown:o=>{o.key==="Escape"&&h&&(o.preventDefault(),x(""))},"aria-label":r("skills.action.search_aria"),placeholder:b,className:"h-8 pl-9 pr-8 !border-oai-gray-200 dark:!border-oai-gray-800 focus:!border-oai-gray-400 focus:!ring-oai-gray-400/20 dark:focus:!border-oai-gray-500 dark:focus:!ring-oai-gray-500/20 [&::-webkit-search-cancel-button]:appearance-none"}),e.jsx("button",{type:"button",onMouseDown:o=>o.preventDefault(),onClick:()=>x(""),"aria-label":r("skills.action.search_clear"),"aria-hidden":!h,tabIndex:h?0:-1,className:me("absolute right-2 top-1/2 flex h-6 w-6 -translate-y-1/2 items-center justify-center rounded-full text-oai-gray-400 transition duration-150 ease-out before:absolute before:-inset-1.5 before:content-[''] hover:bg-oai-gray-100 hover:text-oai-gray-600 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-gray-400/40 motion-reduce:transition-none dark:hover:bg-oai-gray-800 dark:hover:text-oai-gray-200",h?"scale-100 opacity-100":"pointer-events-none scale-90 opacity-0"),children:e.jsx(Se,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),e.jsx("span",{role:"status","aria-live":"polite",className:"ml-auto shrink-0 tabular-nums text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.filter.result_count",{filtered:u,total:c})}),p?e.jsxs("button",{type:"button",onClick:m,className:"shrink-0 inline-flex h-7 items-center gap-1 rounded-full bg-oai-gray-100 px-2.5 text-[11px] font-medium text-oai-gray-700 transition hover:bg-oai-gray-200 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:bg-oai-gray-800/70 dark:text-oai-gray-200 dark:hover:bg-oai-gray-700",children:[e.jsx(Se,{className:"h-3 w-3","aria-hidden":!0}),r("skills.filter.clear")]}):null]})}function Pr({count:a,targets:s,busy:l,onBulkSync:u,onBulkRemove:c,onClear:p}){return e.jsxs("div",{role:"toolbar","aria-label":r("skills.select.toolbar_aria"),className:"mb-2 flex flex-wrap items-center gap-2 rounded-lg border border-oai-gray-200 bg-oai-gray-50 px-3 py-2 dark:border-oai-gray-800 dark:bg-oai-gray-900/50",children:[e.jsx("span",{className:"text-xs font-medium text-oai-gray-700 dark:text-oai-gray-200","aria-live":"polite",children:r("skills.select.count",{count:a})}),e.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[e.jsxs(Ma,{children:[e.jsxs(Oa,{disabled:l,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 bg-oai-white px-2.5 text-xs font-medium text-oai-gray-700 transition hover:border-oai-gray-300 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 disabled:opacity-60 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-oai-gray-200",children:[e.jsx(Da,{className:"h-3.5 w-3.5","aria-hidden":!0}),r("skills.select.bulk_sync"),e.jsx(ga,{className:"h-3 w-3","aria-hidden":!0})]}),e.jsx(Ua,{children:e.jsx(Fa,{sideOffset:6,side:"bottom",align:"end",className:"!z-[80]",children:e.jsxs(za,{className:"min-w-[200px] rounded-lg bg-white p-1.5 shadow-lg ring-1 ring-oai-gray-200 dark:bg-oai-gray-950 dark:ring-oai-gray-800",children:[e.jsx("div",{className:"px-2 pb-1 pt-0.5 text-[11px] font-medium uppercase tracking-wide text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.select.bulk_sync_hint")}),s.map(m=>e.jsxs("button",{type:"button",onClick:()=>u(m.id),className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm text-oai-black hover:bg-oai-gray-100 dark:text-white dark:hover:bg-oai-gray-800",children:[e.jsx(be,{provider:m.id,size:16}),e.jsx("span",{className:"flex-1",children:m.label})]},m.id))]})})})]}),e.jsxs(G,{type:"button",variant:"ghost",size:"sm",disabled:l,onClick:c,children:[e.jsx(ma,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),r("skills.select.bulk_remove")]}),e.jsxs("button",{type:"button",onClick:p,className:"inline-flex h-7 items-center gap-1 rounded-full px-2 text-[11px] font-medium text-oai-gray-500 transition hover:text-oai-black focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:text-oai-gray-400 dark:hover:text-white",children:[e.jsx(Se,{className:"h-3 w-3","aria-hidden":!0}),r("skills.select.clear")]})]})]})}function Rr({items:a,totalCount:s,targets:l,agentOptions:u,agentFilter:c,onAgentFilter:p,anyFilter:m,onClearFilters:h,searchQuery:x,onSearchQuery:b,searchPlaceholder:o,selectedId:j,onSelect:C,onToggleTarget:k,busyKey:v,updates:y,selectedIds:N,onToggleSelect:E,onClearSelection:O,onBulkSync:W,onBulkRemove:U}){const ge=N.size;return e.jsxs("div",{children:[ge>0?e.jsx(Pr,{count:ge,targets:l,busy:v==="batch",onBulkSync:W,onBulkRemove:U,onClear:O}):e.jsx(Lr,{agentFilter:c,agentOptions:u,onAgentFilter:p,filteredCount:a.length,totalCount:s,anyFilter:m,onClearFilters:h,searchQuery:x,onSearchQuery:b,searchPlaceholder:o}),a.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-lg border border-dashed border-oai-gray-200 px-4 py-10 text-center text-sm text-oai-gray-500 dark:border-oai-gray-800 dark:text-oai-gray-400",children:[e.jsx("p",{children:r("skills.empty.no_match")}),e.jsx(G,{type:"button",variant:"secondary",size:"sm",onClick:h,children:r("skills.filter.clear")})]}):e.jsx("div",{className:"divide-y divide-oai-gray-200/70 dark:divide-oai-gray-800/70",children:a.map(w=>e.jsx(_r,{skill:w,targets:l,selected:j===(w.id||w.directory),onSelect:C,selectable:!0,checked:N.has(w.id),onToggleSelect:E,onToggleTarget:k,hasUpdate:!!(w.id&&y?.[w.id]),busyKey:v},w.id||w.key))})]})}const Ir={contentVisibility:"auto",containIntrinsicSize:"0 240px"},Er=vt.memo(function({skill:s,installed:l,installing:u,allTargets:c,defaultTargets:p,onInstall:m,onManage:h}){const[x,b]=i.useState(()=>(p||[]).filter(y=>c.some(N=>N.id===y))),o=y=>{b(N=>N.includes(y)?N.filter(E=>E!==y):[...N,y])},j=s.repoOwner&&s.repoName?`${s.repoOwner}/${s.repoName}`:null,C=j?`https://github.com/${s.repoOwner}/${s.repoName}`:null,k=s.installs!=null?r("skills.card.installs",{count:Number(s.installs||0).toLocaleString()}):null,v=x.length?x.map(y=>c.find(N=>N.id===y)?.label||y).join(", "):r("skills.action.choose_targets");return e.jsxs(Nt,{className:"h-full rounded-lg",bodyClassName:"flex h-full flex-col",children:[e.jsx("div",{className:"flex items-start justify-between gap-3",children:e.jsxs("div",{className:"min-w-0",children:[s.readmeUrl?e.jsxs("a",{href:s.readmeUrl,target:"_blank",rel:"noopener noreferrer",className:"group inline-flex max-w-full items-center gap-1 truncate text-base font-semibold text-oai-black hover:underline dark:text-white",title:s.readmeUrl,children:[e.jsx("span",{className:"truncate",children:s.name||s.directory}),e.jsx(la,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-400 opacity-0 transition-opacity group-hover:opacity-100","aria-hidden":!0})]}):e.jsx("h2",{className:"truncate text-base font-semibold text-oai-black dark:text-white",children:s.name||s.directory}),j||k?e.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-x-1.5 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:[C?e.jsxs("a",{href:C,target:"_blank",rel:"noopener noreferrer",onClick:y=>y.stopPropagation(),className:"inline-flex items-center gap-1 truncate rounded text-oai-gray-500 hover:text-oai-black hover:underline focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:text-oai-gray-400 dark:hover:text-white",title:C,children:[e.jsx("span",{className:"truncate",children:j}),e.jsx(la,{className:"h-2.5 w-2.5 shrink-0","aria-hidden":!0})]}):null,j&&k?e.jsx("span",{"aria-hidden":!0,children:"·"}):null,k?e.jsx("span",{className:"truncate",children:k}):null]}):null]})}),s.description?e.jsx("p",{className:"mt-3 line-clamp-3 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:s.description}):null,e.jsx("div",{className:"mt-auto pt-5",children:l?e.jsxs(G,{type:"button",variant:"secondary",size:"sm",onClick:()=>h?.(s),className:"w-full",children:[e.jsx(_e,{className:"mr-1.5 h-3.5 w-3.5 text-emerald-500 dark:text-emerald-400","aria-hidden":!0}),r("skills.card.manage")]}):e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-1 text-xs text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx("span",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.card.targets_prefix")}),e.jsx("span",{className:"min-w-0 truncate font-medium text-oai-black dark:text-white",children:x.length?v:r("skills.target.none")}),e.jsxs(Ma,{children:[e.jsx(Oa,{disabled:u,"aria-label":r("skills.action.choose_targets"),className:"rounded text-xs font-medium text-oai-gray-500 underline decoration-oai-gray-300 decoration-dotted underline-offset-2 transition hover:text-oai-black hover:decoration-oai-gray-500 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 disabled:cursor-not-allowed disabled:opacity-60 dark:text-oai-gray-400 dark:decoration-oai-gray-600 dark:hover:text-white dark:hover:decoration-oai-gray-400",children:r("skills.card.targets_change")}),e.jsx(Ua,{children:e.jsx(Fa,{sideOffset:6,side:"bottom",align:"end",className:"!z-[80]",children:e.jsxs(za,{className:"min-w-[220px] rounded-lg bg-white p-1.5 shadow-lg ring-1 ring-oai-gray-200 dark:bg-oai-gray-950 dark:ring-oai-gray-800",children:[e.jsx("div",{className:"px-2 pb-1 pt-0.5 text-[11px] font-medium uppercase tracking-wide text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.target.menu_label")}),c.map(y=>{const N=x.includes(y.id);return e.jsxs("label",{className:"flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-sm text-oai-black hover:bg-oai-gray-100 dark:text-white dark:hover:bg-oai-gray-800",children:[e.jsx("input",{type:"checkbox",className:"h-4 w-4 shrink-0 rounded border-oai-gray-300 text-oai-black focus:ring-oai-gray-400 dark:border-oai-gray-600 dark:bg-oai-gray-900 dark:text-white",checked:N,onChange:()=>o(y.id)}),e.jsx(be,{provider:y.id,size:16}),e.jsx("span",{className:"flex-1 text-left",children:y.label})]},y.id)})]})})})]})]}),e.jsxs(G,{type:"button",size:"sm",onClick:()=>m(s,x),disabled:u||x.length===0,className:"w-full",children:[u?e.jsx(Z,{className:"mr-1.5 h-3.5 w-3.5 animate-spin","aria-hidden":!0}):e.jsx(Da,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),r("skills.action.install")]})]})})]})});function Br({repos:a,repoInput:s,onRepoInput:l,busyKey:u,onAdd:c,onRemove:p}){return e.jsxs("div",{className:"rounded-lg border border-oai-gray-200 bg-white p-4 dark:border-oai-gray-800 dark:bg-oai-gray-950",children:[e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[e.jsx(ua,{value:s,onChange:m=>l(m.target.value),placeholder:r("skills.repo.placeholder"),className:"min-w-0 flex-1"}),e.jsxs(G,{type:"button",variant:"secondary",size:"md",onClick:c,disabled:u==="repo:add",className:"shrink-0 whitespace-nowrap",children:[u==="repo:add"?e.jsx(Z,{className:"mr-1.5 h-4 w-4 animate-spin","aria-hidden":!0}):e.jsx(Ka,{className:"mr-1.5 h-4 w-4","aria-hidden":!0}),r("skills.repo.add")]})]}),a.length?e.jsx("div",{className:"mt-3 divide-y divide-oai-gray-200/70 dark:divide-oai-gray-800/70",children:a.map(m=>{const h=u===`repo:${m.owner}/${m.name}`;return e.jsxs("div",{className:"flex items-center justify-between gap-3 py-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"truncate text-sm font-medium text-oai-black dark:text-white",children:[m.owner,"/",m.name]}),e.jsx("div",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400",children:m.branch})]}),e.jsxs(G,{type:"button",variant:"ghost",size:"sm",disabled:h,onClick:()=>p(m),className:"shrink-0",children:[h?e.jsx(Z,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):e.jsx(ma,{className:"h-3.5 w-3.5","aria-hidden":!0}),e.jsx("span",{className:"sr-only",children:r("skills.repo.remove")})]})]},`${m.owner}/${m.name}`)})}):null]})}function $r(){return typeof window>"u"?"my":new URLSearchParams(window.location.search).get("tab")==="browse"?"browse":"my"}function ls(){const[a,s]=i.useState($r),[l,u]=i.useState({skills:[],targets:[]}),[c,p]=i.useState([]),[m,h]=i.useState([]),[x,b]=i.useState([]),[o,j]=i.useState(xe),[C,k]=i.useState(""),[v,y]=i.useState(""),[N,E]=i.useState(""),[O,W]=i.useState(""),[U,ge]=i.useState(""),[w,ee]=i.useState(!1),[B,K]=i.useState("all"),[J,ae]=i.useState(null),[F,ke]=i.useState(""),[we,Ue]=i.useState(!0),[Le,Fe]=i.useState(!1),[ze,T]=i.useState(""),[te,Q]=i.useState(null),[ve,L]=i.useState(null),[V,re]=i.useState(()=>new Set),[I,se]=i.useState({}),[P,Pe]=i.useState({}),[je,ne]=i.useState([]),[pe,Re]=i.useState(!1),Ie=i.useRef(!1),Ee=i.useMemo(()=>{const t=new Set;for(const n of l.skills||[])for(const d of Ca(n))t.add(d);return t},[l.skills]),Ne=i.useCallback(async()=>{const t=await Ut();u({skills:t.skills||[],targets:t.targets||[]})},[]),q=i.useCallback(async()=>{const t=await Ft();b(t.repos||[])},[]),ie=i.useCallback(async({force:t=!1}={})=>{Fe(!0);try{const n=await zt({force:t});p(n.skills||[])}finally{Fe(!1)}},[]),fe=i.useCallback(async({force:t=!1}={})=>{Re(!0);try{const n=await At({force:t});ne(n.skills||[])}finally{Re(!1)}},[]),oe=i.useCallback(async()=>{try{const t=await Kt();se(t?.updates||{})}catch{se({})}},[]),le=i.useCallback(async()=>{try{const t=await Vt(),n={};for(const d of t?.skills||[])d.installed&&(d.directory&&(n[String(d.directory).toLowerCase()]=d),n[String(d.skill).toLowerCase()]=d);Pe(n)}catch{Pe({})}},[]),he=i.useCallback(async()=>{Ue(!0),T("");try{await Promise.all([Ne(),q()])}catch(t){T(t?.message||r("skills.error.generic"))}finally{Ue(!1)}},[Ne,q]),Xe=i.useCallback(async()=>{await he();const t=n=>T(n?.message||r("skills.error.generic"));a==="my"?(oe(),le()):o===A?fe({force:!0}).catch(t):o!==M&&ie({force:!0}).catch(t)},[ie,he,fe,oe,le,o,a]);i.useEffect(()=>{he()},[he]),i.useEffect(()=>{if(Ie.current||typeof window>"u")return;const t=new URLSearchParams(window.location.search),n=t.get("skill");if(!n){Ie.current=!0;return}const d=l.skills||[];if(!d.length)return;const g=d.find(S=>S.directory===n||S.id===n);g&&(s("my"),ae(g.id||g.directory)),Ie.current=!0,t.delete("skill");const R=t.toString();window.history.replaceState({},"",`${window.location.pathname}${R?`?${R}`:""}${window.location.hash}`)},[l.skills]),i.useEffect(()=>{a==="browse"&&(o===M||o===A||c.length===0&&ie().catch(t=>T(t?.message||r("skills.error.generic"))))},[c.length,ie,o,a]),i.useEffect(()=>{a!=="browse"||o!==A||je.length===0&&fe().catch(t=>T(t?.message||r("skills.error.generic")))},[fe,je.length,o,a]);const Ae=Object.keys(I).length>0,de=Object.keys(P).length>0;if(i.useEffect(()=>{a==="my"&&(Ae||oe(),de||le())},[a,Ae,de,oe,le]),i.useEffect(()=>{const t=setTimeout(()=>y(C),200);return()=>clearTimeout(t)},[C]),i.useEffect(()=>{const t=setTimeout(()=>W(N),120);return()=>clearTimeout(t)},[N]),i.useEffect(()=>{if(typeof window>"u")return;const t=new URLSearchParams(window.location.search),n=t.get("tab");if(a==="my"){if(!n)return;t.delete("tab")}else{if(n===a)return;t.set("tab",a)}const d=t.toString(),g=`${window.location.pathname}${d?`?${d}`:""}${window.location.hash}`;window.history.replaceState({},"",g)},[a]),!wr&&!kt())return e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx(jt,{})});const _=async(t,n)=>{ke(t),T("");try{await n(),await Ne()}catch(d){T(d?.message||r("skills.error.generic"))}finally{ke("")}},Ye=(t,n)=>{const d=(n&&n.length?n:sa).filter(g=>(l.targets||[]).some(R=>R.id===g));_(He(t),async()=>{await ya(t,d);const g=d.map(R=>(l.targets||[]).find(S=>S.id===R)?.label||R).join(", ");Ce({title:r("skills.toast.installed",{name:t.name||t.directory,targets:g||r("skills.target.none")}),timeout:4e3})})},Be=t=>{Q(t)},ye=()=>{const t=te;t&&(Q(null),_(Sa(t),async()=>{let n=null;t.managed?n=await ba(t.id):await ka(t.directory,t.targets||[]);const d=!!(n?.trashed&&t.managed&&t.id);Ce({title:r("skills.toast.removed",{name:t.name||t.directory}),timeout:6e3,data:d?{onUndo:async()=>{try{await Ht(t.id),await Ne()}catch(g){T(g?.message||r("skills.error.generic"))}}}:void 0})}))},X=(t,n,d)=>_(Qa(t.id,n),async()=>{const g=new Set(t.targets||[]);d?g.add(n):g.delete(n),t.managed?await wa(t.id,Array.from(g)):await va(t.directory,Array.from(g));const R={name:t.name||t.directory,agent:Ke(n)};Ce({title:d?r("skills.toast.synced_one",R):r("skills.toast.unsynced_one",R),timeout:3e3})}),$e=i.useCallback(()=>re(new Set),[]),Ze=i.useCallback((t,n)=>{re(d=>{const g=new Set(d);return n?g.add(t.id):g.delete(t.id),g})},[]),Ke=t=>(l.targets||[]).find(n=>n.id===t)?.label||t,Te=t=>{const n=(l.skills||[]).filter(d=>V.has(d.id));n.length&&_("batch",async()=>{for(const d of n){const g=new Set(d.targets||[]);g.add(t),d.managed?await wa(d.id,Array.from(g)):await va(d.directory,Array.from(g))}$e(),Ce({title:r("skills.toast.bulk_synced",{count:n.length,agent:Ke(t)}),timeout:4e3})})},ea=()=>{const t=(l.skills||[]).filter(n=>V.has(n.id));t.length&&L(t)},aa=()=>{const t=ve;t&&(L(null),_("batch",async()=>{for(const n of t)n.managed?await ba(n.id):await ka(n.directory,n.targets||[]);$e(),Ce({title:r("skills.toast.bulk_removed",{count:t.length}),timeout:4e3})}))},f=t=>{!t?.repoOwner||!t?.repoName||_(He(t),async()=>{await ya({key:t.key,name:t.name,description:t.description,directory:t.sourceDirectory||t.directory,repoOwner:t.repoOwner,repoName:t.repoName,repoBranch:t.repoBranch,readmeUrl:t.readmeUrl},t.targets&&t.targets.length?t.targets:sa),await oe(),Ce({title:r("skills.toast.updated",{name:t.name||t.directory}),timeout:4e3})})},D=async()=>{const t=C.trim();if(!(t.length<2)){ke("search"),T("");try{const n=await qt(t);h(n.skills||[])}catch(n){T(n?.message||r("skills.error.generic"))}finally{ke("")}}},ce=async()=>{const t=U.trim().replace(/^https:\/\/github\.com\//,"").replace(/\.git$/,""),[n,d]=t.split("/");if(!n||!d){T(r("skills.repo.invalid"));return}await _("repo:add",async()=>{await Wt({owner:n,name:d,branch:"main",enabled:!0}),ge(""),await q(),await ie()})},ue=async t=>{await _(`repo:${t.owner}/${t.name}`,async()=>{await Gt(t.owner,t.name),await q(),await ie()})},$=l.targets||[],H=l.skills||[],De=i.useMemo(()=>{const t=B==="all"?H:H.filter(d=>(d.targets||[]).includes(B)),n=O.trim().toLowerCase();return n?t.filter(d=>(d.name||"").toLowerCase().includes(n)||(d.directory||"").toLowerCase().includes(n)||(d.description||"").toLowerCase().includes(n)):t},[H,B,O]),Xa=B!=="all",Y=i.useMemo(()=>J&&H.find(t=>(t.id||t.directory)===J)||null,[H,J]),Ya=i.useCallback(()=>{K("all"),E("")},[]),Za=i.useCallback(t=>{ae(n=>{const d=t?.id||t?.directory||null;return n===d?null:d})},[]),et=i.useCallback(()=>ae(null),[]),at=i.useCallback(t=>{const n=Qe(t).toLowerCase(),d=Na(t),g=(l.skills||[]).find(R=>{const S=Ca(R);return S.has(n)||d&&S.has(d)});g&&ae(g.id||g.directory)},[l.skills]);i.useEffect(()=>{a!=="my"&&V.size&&re(new Set)},[a,V.size]),i.useEffect(()=>{J&&!Y&&ae(null)},[Y,J]);const Me=i.useMemo(()=>{const t=o===M?m:o===A?je:c,d=o===M||o===A||o===xe?t:t.filter(S=>`${S.repoOwner}/${S.repoName}`===o),g=v.trim().toLowerCase();return(o===M||!g?d:d.filter(S=>(S.name||"").toLowerCase().includes(g)||(S.directory||"").toLowerCase().includes(g)||(S.description||"").toLowerCase().includes(g))).map(S=>{const ta=Qe(S).toLowerCase(),z=Na(S);return{...S,installed:Ee.has(ta)||z&&Ee.has(z)}})},[v,c,Ee,je,m,o]),tt=e.jsx("div",{className:"flex h-64 items-center justify-center",children:e.jsx(Z,{className:"h-8 w-8 animate-spin text-oai-gray-400","aria-hidden":!0})}),rt=e.jsxs("div",{className:"flex h-64 flex-col items-center justify-center gap-3 px-6 text-center",children:[e.jsx(Z,{className:"h-8 w-8 animate-spin text-oai-gray-400","aria-hidden":!0}),e.jsx("p",{className:"max-w-md text-xs text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.browse.loading_hint")})]}),Ve=(t,n=null)=>e.jsxs("div",{className:"flex flex-col items-center gap-4 rounded-lg border border-dashed border-oai-gray-200 px-4 py-10 text-center text-sm text-oai-gray-500 dark:border-oai-gray-800 dark:text-oai-gray-400",children:[e.jsx("p",{children:r(t)}),n]});let qe;if(we)qe=tt;else if(a==="my")qe=H.length?e.jsx(Rr,{items:De,totalCount:H.length,targets:$,agentOptions:$,agentFilter:B,onAgentFilter:K,anyFilter:Xa,onClearFilters:Ya,searchQuery:N,onSearchQuery:E,searchPlaceholder:r("skills.my.placeholder"),selectedId:J,onSelect:Za,onToggleTarget:X,busyKey:F,updates:I,selectedIds:V,onToggleSelect:Ze,onClearSelection:$e,onBulkSync:Te,onBulkRemove:ea}):e.jsxs("div",{className:"flex flex-col items-center gap-4 rounded-lg border border-dashed border-oai-gray-200 px-4 py-10 text-center dark:border-oai-gray-800",children:[$.length>0?e.jsxs("div",{className:"relative h-11 w-80 overflow-hidden","aria-hidden":!0,children:[e.jsx("div",{className:"pointer-events-none absolute inset-0",style:{maskImage:"linear-gradient(to right, transparent 8%, black 20%, black 32%, transparent 44%, transparent 56%, black 68%, black 80%, transparent 92%)",WebkitMaskImage:"linear-gradient(to right, transparent 8%, black 20%, black 32%, transparent 44%, transparent 56%, black 68%, black 80%, transparent 92%)"},children:e.jsx("div",{className:"absolute inset-y-0 left-0 flex w-max items-center animate-marquee-x",style:{filter:"blur(2.5px)"},children:[...$,...$].map((t,n)=>e.jsx("span",{className:"shrink-0 px-3",children:e.jsx(be,{provider:t.id,size:30})},`b-${n}`))})}),e.jsx("div",{className:"pointer-events-none absolute inset-0",style:{maskImage:"linear-gradient(to right, transparent 28%, black 42%, black 58%, transparent 72%)",WebkitMaskImage:"linear-gradient(to right, transparent 28%, black 42%, black 58%, transparent 72%)"},children:e.jsx("div",{className:"absolute inset-y-0 left-0 flex w-max items-center animate-marquee-x",children:[...$,...$].map((t,n)=>e.jsx("span",{className:"shrink-0 px-3",children:e.jsx(be,{provider:t.id,size:30})},`c-${n}`))})}),e.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-0 w-20 bg-gradient-to-r from-oai-white to-transparent dark:from-oai-gray-900"}),e.jsx("div",{className:"pointer-events-none absolute inset-y-0 right-0 w-20 bg-gradient-to-l from-oai-white to-transparent dark:from-oai-gray-900"})]}):null,e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.empty.my")}),e.jsx(G,{type:"button",size:"sm",onClick:()=>s("browse"),children:r("skills.empty.my_cta")})]});else{const t=o===M,n=o===A,d=x.length===0&&!t&&!n,g=Le&&!t&&!n||n&&pe,R=!t&&!n&&(v.trim()!==""||o!==xe),S=()=>{k(""),j(xe)},ta=!d&&!g&&(Me.length>0||R)?e.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2 px-1 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:[e.jsx("span",{children:r("skills.filter.result_count_browse",{count:Me.length})}),R?e.jsxs("button",{type:"button",onClick:S,className:"ml-auto inline-flex h-7 items-center gap-1 rounded-full bg-oai-gray-100 px-2.5 text-[11px] font-medium text-oai-gray-700 transition hover:bg-oai-gray-200 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:bg-oai-gray-800/70 dark:text-oai-gray-200 dark:hover:bg-oai-gray-700",children:[e.jsx(Se,{className:"h-3 w-3","aria-hidden":!0}),r("skills.filter.clear")]}):null]}):null;let z;d?z=e.jsx("div",{className:"rounded-lg border border-dashed border-oai-gray-200 p-6 text-center dark:border-oai-gray-800",children:e.jsx("p",{className:"text-sm text-oai-gray-600 dark:text-oai-gray-300",children:r("skills.browse.empty_sources")})}):g?z=rt:t&&C.trim().length<2?z=e.jsx("div",{className:"rounded-lg border border-dashed border-oai-gray-200 px-4 py-6 text-center text-sm text-oai-gray-500 dark:border-oai-gray-800 dark:text-oai-gray-400",children:r("skills.browse.hint_skillssh")}):Me.length?z=e.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:Me.map(Oe=>e.jsx("div",{style:Ir,children:e.jsx(Er,{skill:Oe,installed:!!Oe.installed,installing:F===He(Oe),allTargets:$,defaultTargets:sa,onInstall:Ye,onManage:at})},Oe.id||Oe.key))}):R?z=Ve("skills.empty.no_match",e.jsx(G,{type:"button",variant:"secondary",size:"sm",onClick:S,children:r("skills.filter.clear")})):t?z=Ve("skills.empty.search"):n?z=Ve("skills.empty.popular"):z=Ve("skills.empty.browse");const st=d||w?e.jsx("div",{className:"mb-5",children:e.jsx(Br,{repos:x,repoInput:U,onRepoInput:ge,busyKey:F,onAdd:ce,onRemove:ue})}):null,nt=!w&&!t&&!n&&x.length<=1&&Me.length>0?e.jsx(tr,{id:"skills-browse-intro",className:"mt-6",children:e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[e.jsx("span",{children:r("skills.browse.add_repo_hint")}),e.jsx("button",{type:"button",onClick:()=>ee(!0),className:"rounded font-medium text-oai-gray-700 underline decoration-dotted underline-offset-2 transition hover:text-oai-black focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:text-oai-gray-200 dark:hover:text-white",children:r("skills.browse.manage_sources")})]})}):null;qe=e.jsxs(e.Fragment,{children:[st,ta,z,nt]})}return e.jsxs("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:[e.jsx("main",{className:"flex-1 pb-12 pt-8 sm:pb-16 sm:pt-10",children:e.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[e.jsxs("div",{className:"mb-6 flex items-end justify-between gap-4",children:[e.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:r("skills.page.title")}),e.jsxs(G,{type:"button",variant:"secondary",size:"sm",onClick:Xe,disabled:we||Le||pe,children:[e.jsx(wt,{className:me("mr-1.5 h-3.5 w-3.5",(we||Le||pe)&&"animate-spin"),"aria-hidden":!0}),r("skills.action.refresh")]})]}),e.jsx("div",{className:"mb-5 flex gap-6 border-b border-oai-gray-200 dark:border-oai-gray-800",children:[["my",r("skills.tab.my")],["browse",r("skills.tab.browse")]].map(([t,n])=>e.jsx("button",{type:"button","aria-pressed":a===t,onClick:()=>s(t),className:me("-mb-px border-b-2 pb-2 text-sm font-medium transition-colors",a===t?"border-oai-black text-oai-black dark:border-white dark:text-white":"border-transparent text-oai-gray-500 hover:text-oai-black dark:text-oai-gray-400 dark:hover:text-white"),children:n},t))}),ze?e.jsx("div",{className:"mb-4 rounded-lg border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700 dark:border-red-900/60 dark:bg-red-950/30 dark:text-red-200",children:ze}):null,a==="browse"?e.jsxs("div",{className:"mb-5 flex flex-col gap-3 sm:flex-row sm:items-center",children:[e.jsx(Ct,{className:"shrink-0",ariaLabel:r("skills.source.label"),options:[{id:"repo",label:r("skills.mode.repo")},{id:"popular",label:r("skills.mode.popular"),icon:e.jsx(Jt,{className:"h-3.5 w-3.5","aria-hidden":!0})},{id:"skillssh",label:r("skills.mode.skillssh")}],value:o===M?"skillssh":o===A?"popular":"repo",onChange:t=>{t==="skillssh"?j(M):t==="popular"?j(A):(o===M||o===A)&&j(xe)}}),o!==M&&o!==A?e.jsxs(Ra,{value:o,onValueChange:j,children:[e.jsxs(Ia,{"aria-label":r("skills.source.label"),className:"inline-flex h-8 w-44 shrink-0 items-center justify-between gap-2 rounded-md border border-oai-gray-200 bg-oai-white px-2.5 text-xs text-oai-black focus:outline-none data-[popup-open]:border-oai-gray-300 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-white dark:data-[popup-open]:border-oai-gray-700",children:[e.jsx(Ea,{children:t=>t===xe?r("skills.source.all"):t}),e.jsx(Va,{className:"text-oai-gray-400",children:e.jsx(ga,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),e.jsx(Ba,{children:e.jsx($a,{sideOffset:4,alignItemWithTrigger:!1,className:"z-[60]",children:e.jsxs(Ta,{className:"min-w-[var(--anchor-width)] overflow-hidden rounded-md border border-oai-gray-200 bg-white p-1 shadow-[0_12px_32px_-12px_rgba(0,0,0,0.18)] outline-none transition-[opacity,transform] duration-150 ease-out data-[ending-style]:scale-[0.97] data-[ending-style]:opacity-0 data-[starting-style]:scale-[0.97] data-[starting-style]:opacity-0 dark:border-oai-gray-800 dark:bg-oai-gray-950 dark:shadow-[0_12px_32px_-12px_rgba(0,0,0,0.6)]",children:[e.jsxs(Ge,{value:xe,className:"flex cursor-default select-none items-center justify-between gap-2 rounded px-3 py-1.5 text-sm text-oai-black outline-none data-[highlighted]:bg-oai-gray-100 dark:text-white dark:data-[highlighted]:bg-oai-gray-800",children:[e.jsx(We,{children:r("skills.source.all")}),e.jsx(Je,{children:e.jsx(_e,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),x.map(t=>{const n=`${t.owner}/${t.name}`;return e.jsxs(Ge,{value:n,className:"flex cursor-default select-none items-center justify-between gap-2 rounded px-3 py-1.5 text-sm text-oai-black outline-none data-[highlighted]:bg-oai-gray-100 dark:text-white dark:data-[highlighted]:bg-oai-gray-800",children:[e.jsx(We,{children:n}),e.jsx(Je,{children:e.jsx(_e,{className:"h-3.5 w-3.5","aria-hidden":!0})})]},n)})]})})})]}):null,e.jsxs("div",{className:"relative flex-1",children:[e.jsx(oa,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-oai-gray-400","aria-hidden":!0}),e.jsx(ua,{type:"search",value:C,onChange:t=>k(t.target.value),onKeyDown:t=>{t.key==="Enter"&&o===M&&D()},"aria-label":r("skills.action.search_aria"),placeholder:o===M?r("skills.browse.placeholder_skillssh"):o===A?r("skills.browse.placeholder_popular"):o===xe?r("skills.browse.placeholder_all"):r("skills.browse.placeholder_repo",{repo:o}),className:"h-8 pl-9 !border-oai-gray-200 dark:!border-oai-gray-800 focus:!border-oai-gray-400 focus:!ring-oai-gray-400/20 dark:focus:!border-oai-gray-500 dark:focus:!ring-oai-gray-500/20"})]}),o===M?e.jsxs(G,{type:"button",size:"sm",onClick:D,disabled:C.trim().length<2||F==="search",className:"focus:!ring-oai-gray-400/30",children:[F==="search"?e.jsx(Z,{className:"mr-1.5 h-4 w-4 animate-spin","aria-hidden":!0}):e.jsx(oa,{className:"mr-1.5 h-4 w-4","aria-hidden":!0}),r("skills.action.search")]}):o===A?null:e.jsxs(G,{type:"button",variant:"secondary",size:"sm",onClick:()=>ee(t=>!t),"aria-expanded":w,className:"!h-8 shrink-0 whitespace-nowrap !border-oai-gray-200 dark:!border-oai-gray-800 hover:!border-oai-gray-300 dark:hover:!border-oai-gray-700 hover:!text-oai-black dark:hover:!text-white focus:!ring-oai-gray-400/30",children:[e.jsx(Ka,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),r("skills.browse.manage_sources"),e.jsx("span",{className:"ml-1.5 rounded bg-oai-gray-100 px-1.5 py-0.5 text-xs font-medium text-oai-gray-600 dark:bg-oai-gray-800 dark:text-oai-gray-300",children:x.length})]})]}):null,qe,e.jsx(br,{skill:Y,targets:$,busyKey:F,usage:Y&&(P[String(Y.directory||"").toLowerCase()]||P[String(Y.name||"").toLowerCase()])||null,hasUpdate:!!(Y?.id&&I?.[Y.id]),updating:Y?F===He(Y):!1,onUpdate:f,onClose:et,onToggleTarget:X,onRemove:Be})]})}),e.jsx(pa,{open:!!te,title:r("skills.confirm.remove_title",{name:te?.name||te?.directory||""}),description:te?te.managed?r("skills.confirm.remove_managed"):r("skills.confirm.remove_local"):"",confirmLabel:r("skills.action.remove"),cancelLabel:r("shared.action.cancel"),destructive:!0,busy:F===Sa(te||{}),onCancel:()=>Q(null),onConfirm:ye}),e.jsx(pa,{open:!!ve,title:r("skills.confirm.bulk_remove_title",{count:ve?.length||0}),description:r("skills.confirm.bulk_remove_desc"),confirmLabel:r("skills.action.remove"),cancelLabel:r("shared.action.cancel"),destructive:!0,busy:F==="batch",onCancel:()=>L(null),onConfirm:aa})]})}export{ls as SkillsPage};
import{V as o,W as r}from"./__vite-browser-external-CeOnjjgl.js";import{F as u,P as d}from"./useScrollLock-Ct5GyoVg.js";function a(){return new u({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new d,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function m(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:a(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:r,inactiveTriggerProps:r,popupProps:r}}function P(e,n,g=!1){return new u({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:n,syncOnly:!0,nested:g,onOpenChange:void 0})}const t=o(e=>e.triggerIdProp??e.activeTriggerId),i=o(e=>e.openProp??e.open),p=o(e=>(e.popupElement?.id??e.floatingId)||void 0);function l(e,n){return n!==void 0&&i(e)&&t(e)===n}function s(e,n){return l(e,n)?!0:n!==void 0&&i(e)&&t(e)==null&&e.triggerCount===1}const E={open:i,mounted:o(e=>e.mounted),transitionStatus:o(e=>e.transitionStatus),floatingRootContext:o(e=>e.floatingRootContext),triggerCount:o(e=>e.triggerCount),preventUnmountingOnClose:o(e=>e.preventUnmountingOnClose),payload:o(e=>e.payload),activeTriggerId:t,activeTriggerElement:o(e=>e.mounted?e.activeTriggerElement:null),popupId:p,isTriggerActive:o((e,n)=>n!==void 0&&t(e)===n),isOpenedByTrigger:o((e,n)=>l(e,n)),isMountedByTrigger:o((e,n)=>n!==void 0&&t(e)===n&&e.mounted),triggerProps:o((e,n)=>n?e.activeTriggerProps:e.inactiveTriggerProps),triggerPopupId:o((e,n)=>s(e,n)?p(e):void 0),popupProps:o(e=>e.popupProps),popupElement:o(e=>e.popupElement),positionerElement:o(e=>e.positionerElement)};export{m as a,P as c,E as p};
import{l as e}from"./__vite-browser-external-CeOnjjgl.js";const o=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],a=e("terminal",o);export{a as T};

Sorry, the diff of this file is too big to display

import{l as on,a_ as sn,r as R,bc as rn,aS as cn,aD as ln,bd as an,W as $t,A as fn,aT as B,be as Z,bf as Ne,ba as se,bg as J,aL as K,bh as je,bi as pe,bj as Se,bk as un,bl as Ht,bm as dn,bn as qe,bo as Ue,bp as De,bq as vt,br as It,a1 as gn,bs as mn,aH as hn,aG as G,aU as Ce,P as Ke,bt as pn,z as xn,bu as wn}from"./__vite-browser-external-CeOnjjgl.js";import{n as At,q as yn,F as bn,P as Rn,o as vn,v as Re,p as An,i as On}from"./useScrollLock-Ct5GyoVg.js";const Sn=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Bo=on("chevron-down",Sn),Cn=["top","right","bottom","left"],de=Math.min,z=Math.max,Ee=Math.round,ve=Math.floor,q=e=>({x:e,y:e}),En={left:"right",right:"left",bottom:"top",top:"bottom"};function Xe(e,t,o){return z(e,de(t,o))}function Q(e,t){return typeof e=="function"?e(t):e}function V(e){return e.split("-")[0]}function te(e){return e.split("-")[1]}function Ge(e){return e==="x"?"y":"x"}function Je(e){return e==="y"?"height":"width"}function X(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Qe(e){return Ge(X(e))}function Pn(e,t,o){o===void 0&&(o=!1);const n=te(e),i=Qe(e),s=Je(i);let r=i==="x"?n===(o?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(r=Pe(r)),[r,Pe(r)]}function Tn(e){const t=Pe(e);return[Ye(e),t,Ye(t)]}function Ye(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Ot=["left","right"],St=["right","left"],Mn=["top","bottom"],Dn=["bottom","top"];function kn(e,t,o){switch(e){case"top":case"bottom":return o?t?St:Ot:t?Ot:St;case"left":case"right":return t?Mn:Dn;default:return[]}}function Ln(e,t,o,n){const i=te(e);let s=kn(V(e),o==="start",n);return i&&(s=s.map(r=>r+"-"+i),t&&(s=s.concat(s.map(Ye)))),s}function Pe(e){const t=V(e);return En[t]+e.slice(t.length)}function Fn(e){return{top:0,right:0,bottom:0,left:0,...e}}function Bt(e){return typeof e!="number"?Fn(e):{top:e,right:e,bottom:e,left:e}}function Te(e){const{x:t,y:o,width:n,height:i}=e;return{width:n,height:i,top:o,left:t,right:t+n,bottom:o+i,x:t,y:o}}function Vo(e,t={}){const{enabled:o=!0,event:n="click",toggle:i=!0,ignoreMouse:s=!1,stickIfOpen:r=!0,touchOpenDelay:c=0,reason:l=sn}=t,u="rootStore"in e?e.rootStore:e,a=u.context.dataRef,f=R.useRef(void 0),g=rn(),d=cn(),h=R.useMemo(()=>{function m(p,w,x,y){const v=fn(l,w,x);p&&y==="touch"&&c>0?d.start(c,()=>{u.setOpen(!0,v)}):u.setOpen(p,v)}function b(p,w,x){const y=a.current.openEvent,v=u.select("domReferenceElement")!==w;return p&&v||!p||!i?!0:y&&r?!x(y.type):!1}return{onPointerDown(p){f.current=p.pointerType},onMouseDown(p){const w=f.current,x=p.nativeEvent,y=u.select("open");if(p.button!==0||n==="click"||At(w,!0)&&s)return;const v=b(y,p.currentTarget,E=>E==="click"||E==="mousedown"),A=ln(x);if(an(A)){m(v,x,A,w);return}const P=p.currentTarget;g.request(()=>{m(v,x,P,w)})},onClick(p){if(n==="mousedown-only")return;const w=f.current;if(n==="mousedown"&&w){f.current=void 0;return}if(At(w,!0)&&s)return;const x=u.select("open"),y=b(x,p.currentTarget,v=>v==="click"||v==="mousedown"||v==="keydown"||v==="keyup");m(y,p.nativeEvent,p.currentTarget,w)},onKeyDown(){f.current=void 0}}},[a,n,s,l,u,r,i,g,d,c]);return R.useMemo(()=>o?{reference:h}:$t,[o,h])}function Ct(e,t,o){let{reference:n,floating:i}=e;const s=X(t),r=Qe(t),c=Je(r),l=V(t),u=s==="y",a=n.x+n.width/2-i.width/2,f=n.y+n.height/2-i.height/2,g=n[c]/2-i[c]/2;let d;switch(l){case"top":d={x:a,y:n.y-i.height};break;case"bottom":d={x:a,y:n.y+n.height};break;case"right":d={x:n.x+n.width,y:f};break;case"left":d={x:n.x-i.width,y:f};break;default:d={x:n.x,y:n.y}}switch(te(t)){case"start":d[r]-=g*(o&&u?-1:1);break;case"end":d[r]+=g*(o&&u?-1:1);break}return d}async function Wn(e,t){var o;t===void 0&&(t={});const{x:n,y:i,platform:s,rects:r,elements:c,strategy:l}=e,{boundary:u="clippingAncestors",rootBoundary:a="viewport",elementContext:f="floating",altBoundary:g=!1,padding:d=0}=Q(t,e),h=Bt(d),b=c[g?f==="floating"?"reference":"floating":f],p=Te(await s.getClippingRect({element:(o=await(s.isElement==null?void 0:s.isElement(b)))==null||o?b:b.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:u,rootBoundary:a,strategy:l})),w=f==="floating"?{x:n,y:i,width:r.floating.width,height:r.floating.height}:r.reference,x=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),y=await(s.isElement==null?void 0:s.isElement(x))?await(s.getScale==null?void 0:s.getScale(x))||{x:1,y:1}:{x:1,y:1},v=Te(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:w,offsetParent:x,strategy:l}):w);return{top:(p.top-v.top+h.top)/y.y,bottom:(v.bottom-p.bottom+h.bottom)/y.y,left:(p.left-v.left+h.left)/y.x,right:(v.right-p.right+h.right)/y.x}}const $n=50,Hn=async(e,t,o)=>{const{placement:n="bottom",strategy:i="absolute",middleware:s=[],platform:r}=o,c=r.detectOverflow?r:{...r,detectOverflow:Wn},l=await(r.isRTL==null?void 0:r.isRTL(t));let u=await r.getElementRects({reference:e,floating:t,strategy:i}),{x:a,y:f}=Ct(u,n,l),g=n,d=0;const h={};for(let m=0;m<s.length;m++){const b=s[m];if(!b)continue;const{name:p,fn:w}=b,{x,y,data:v,reset:A}=await w({x:a,y:f,initialPlacement:n,placement:g,strategy:i,middlewareData:h,rects:u,platform:c,elements:{reference:e,floating:t}});a=x??a,f=y??f,h[p]={...h[p],...v},A&&d<$n&&(d++,typeof A=="object"&&(A.placement&&(g=A.placement),A.rects&&(u=A.rects===!0?await r.getElementRects({reference:e,floating:t,strategy:i}):A.rects),{x:a,y:f}=Ct(u,g,l)),m=-1)}return{x:a,y:f,placement:g,strategy:i,middlewareData:h}},In=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var o,n;const{placement:i,middlewareData:s,rects:r,initialPlacement:c,platform:l,elements:u}=t,{mainAxis:a=!0,crossAxis:f=!0,fallbackPlacements:g,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:m=!0,...b}=Q(e,t);if((o=s.arrow)!=null&&o.alignmentOffset)return{};const p=V(i),w=X(c),x=V(c)===c,y=await(l.isRTL==null?void 0:l.isRTL(u.floating)),v=g||(x||!m?[Pe(c)]:Tn(c)),A=h!=="none";!g&&A&&v.push(...Ln(c,m,h,y));const P=[c,...v],E=await l.detectOverflow(t,b),k=[];let D=((n=s.flip)==null?void 0:n.overflows)||[];if(a&&k.push(E[p]),f){const W=Pn(i,r,y);k.push(E[W[0]],E[W[1]])}if(D=[...D,{placement:i,overflows:k}],!k.every(W=>W<=0)){var F,S;const W=(((F=s.flip)==null?void 0:F.index)||0)+1,H=P[W];if(H&&(!(f==="alignment"?w!==X(H):!1)||D.every(O=>X(O.placement)===w?O.overflows[0]>0:!0)))return{data:{index:W,overflows:D},reset:{placement:H}};let $=(S=D.filter(L=>L.overflows[0]<=0).sort((L,O)=>L.overflows[1]-O.overflows[1])[0])==null?void 0:S.placement;if(!$)switch(d){case"bestFit":{var M;const L=(M=D.filter(O=>{if(A){const I=X(O.placement);return I===w||I==="y"}return!0}).map(O=>[O.placement,O.overflows.filter(I=>I>0).reduce((I,C)=>I+C,0)]).sort((O,I)=>O[1]-I[1])[0])==null?void 0:M[0];L&&($=L);break}case"initialPlacement":$=c;break}if(i!==$)return{reset:{placement:$}}}return{}}}};function Et(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Pt(e){return Cn.some(t=>e[t]>=0)}const Bn=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:o,platform:n}=t,{strategy:i="referenceHidden",...s}=Q(e,t);switch(i){case"referenceHidden":{const r=await n.detectOverflow(t,{...s,elementContext:"reference"}),c=Et(r,o.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:Pt(c)}}}case"escaped":{const r=await n.detectOverflow(t,{...s,altBoundary:!0}),c=Et(r,o.floating);return{data:{escapedOffsets:c,escaped:Pt(c)}}}default:return{}}}}},Vt=new Set(["left","top"]);async function Vn(e,t){const{placement:o,platform:n,elements:i}=e,s=await(n.isRTL==null?void 0:n.isRTL(i.floating)),r=V(o),c=te(o),l=X(o)==="y",u=Vt.has(r)?-1:1,a=s&&l?-1:1,f=Q(t,e);let{mainAxis:g,crossAxis:d,alignmentAxis:h}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&typeof h=="number"&&(d=c==="end"?h*-1:h),l?{x:d*a,y:g*u}:{x:g*u,y:d*a}}const _n=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var o,n;const{x:i,y:s,placement:r,middlewareData:c}=t,l=await Vn(t,e);return r===((o=c.offset)==null?void 0:o.placement)&&(n=c.arrow)!=null&&n.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:r}}}}},zn=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:o,y:n,placement:i,platform:s}=t,{mainAxis:r=!0,crossAxis:c=!1,limiter:l={fn:p=>{let{x:w,y:x}=p;return{x:w,y:x}}},...u}=Q(e,t),a={x:o,y:n},f=await s.detectOverflow(t,u),g=X(V(i)),d=Ge(g);let h=a[d],m=a[g];if(r){const p=d==="y"?"top":"left",w=d==="y"?"bottom":"right",x=h+f[p],y=h-f[w];h=Xe(x,h,y)}if(c){const p=g==="y"?"top":"left",w=g==="y"?"bottom":"right",x=m+f[p],y=m-f[w];m=Xe(x,m,y)}const b=l.fn({...t,[d]:h,[g]:m});return{...b,data:{x:b.x-o,y:b.y-n,enabled:{[d]:r,[g]:c}}}}}},Nn=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:o,y:n,placement:i,rects:s,middlewareData:r}=t,{offset:c=0,mainAxis:l=!0,crossAxis:u=!0}=Q(e,t),a={x:o,y:n},f=X(i),g=Ge(f);let d=a[g],h=a[f];const m=Q(c,t),b=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){const x=g==="y"?"height":"width",y=s.reference[g]-s.floating[x]+b.mainAxis,v=s.reference[g]+s.reference[x]-b.mainAxis;d<y?d=y:d>v&&(d=v)}if(u){var p,w;const x=g==="y"?"width":"height",y=Vt.has(V(i)),v=s.reference[f]-s.floating[x]+(y&&((p=r.offset)==null?void 0:p[f])||0)+(y?0:b.crossAxis),A=s.reference[f]+s.reference[x]+(y?0:((w=r.offset)==null?void 0:w[f])||0)-(y?b.crossAxis:0);h<v?h=v:h>A&&(h=A)}return{[g]:d,[f]:h}}}},Xn=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var o,n;const{placement:i,rects:s,platform:r,elements:c}=t,{apply:l=()=>{},...u}=Q(e,t),a=await r.detectOverflow(t,u),f=V(i),g=te(i),d=X(i)==="y",{width:h,height:m}=s.floating;let b,p;f==="top"||f==="bottom"?(b=f,p=g===(await(r.isRTL==null?void 0:r.isRTL(c.floating))?"start":"end")?"left":"right"):(p=f,b=g==="end"?"top":"bottom");const w=m-a.top-a.bottom,x=h-a.left-a.right,y=de(m-a[b],w),v=de(h-a[p],x),A=!t.middlewareData.shift;let P=y,E=v;if((o=t.middlewareData.shift)!=null&&o.enabled.x&&(E=x),(n=t.middlewareData.shift)!=null&&n.enabled.y&&(P=w),A&&!g){const D=z(a.left,0),F=z(a.right,0),S=z(a.top,0),M=z(a.bottom,0);d?E=h-2*(D!==0||F!==0?D+F:z(a.left,a.right)):P=m-2*(S!==0||M!==0?S+M:z(a.top,a.bottom))}await l({...t,availableWidth:E,availableHeight:P});const k=await r.getDimensions(c.floating);return h!==k.width||m!==k.height?{reset:{rects:!0}}:{}}}};function _t(e){const t=J(e);let o=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const i=se(e),s=i?e.offsetWidth:o,r=i?e.offsetHeight:n,c=Ee(o)!==s||Ee(n)!==r;return c&&(o=s,n=r),{width:o,height:n,$:c}}function Ze(e){return B(e)?e:e.contextElement}function ue(e){const t=Ze(e);if(!se(t))return q(1);const o=t.getBoundingClientRect(),{width:n,height:i,$:s}=_t(t);let r=(s?Ee(o.width):o.width)/n,c=(s?Ee(o.height):o.height)/i;return(!r||!Number.isFinite(r))&&(r=1),(!c||!Number.isFinite(c))&&(c=1),{x:r,y:c}}const Yn=q(0);function zt(e){const t=K(e);return!It()||!t.visualViewport?Yn:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function jn(e,t,o){return t===void 0&&(t=!1),!o||t&&o!==K(e)?!1:t}function ie(e,t,o,n){t===void 0&&(t=!1),o===void 0&&(o=!1);const i=e.getBoundingClientRect(),s=Ze(e);let r=q(1);t&&(n?B(n)&&(r=ue(n)):r=ue(e));const c=jn(s,o,n)?zt(s):q(0);let l=(i.left+c.x)/r.x,u=(i.top+c.y)/r.y,a=i.width/r.x,f=i.height/r.y;if(s){const g=K(s),d=n&&B(n)?K(n):n;let h=g,m=vt(h);for(;m&&n&&d!==h;){const b=ue(m),p=m.getBoundingClientRect(),w=J(m),x=p.left+(m.clientLeft+parseFloat(w.paddingLeft))*b.x,y=p.top+(m.clientTop+parseFloat(w.paddingTop))*b.y;l*=b.x,u*=b.y,a*=b.x,f*=b.y,l+=x,u+=y,h=K(m),m=vt(h)}}return Te({width:a,height:f,x:l,y:u})}function ke(e,t){const o=De(e).scrollLeft;return t?t.left+o:ie(Z(e)).left+o}function Nt(e,t){const o=e.getBoundingClientRect(),n=o.left+t.scrollLeft-ke(e,o),i=o.top+t.scrollTop;return{x:n,y:i}}function qn(e){let{elements:t,rect:o,offsetParent:n,strategy:i}=e;const s=i==="fixed",r=Z(n),c=t?je(t.floating):!1;if(n===r||c&&s)return o;let l={scrollLeft:0,scrollTop:0},u=q(1);const a=q(0),f=se(n);if((f||!f&&!s)&&((qe(n)!=="body"||Ue(r))&&(l=De(n)),f)){const d=ie(n);u=ue(n),a.x=d.x+n.clientLeft,a.y=d.y+n.clientTop}const g=r&&!f&&!s?Nt(r,l):q(0);return{width:o.width*u.x,height:o.height*u.y,x:o.x*u.x-l.scrollLeft*u.x+a.x+g.x,y:o.y*u.y-l.scrollTop*u.y+a.y+g.y}}function Un(e){return Array.from(e.getClientRects())}function Kn(e){const t=Z(e),o=De(e),n=e.ownerDocument.body,i=z(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),s=z(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let r=-o.scrollLeft+ke(e);const c=-o.scrollTop;return J(n).direction==="rtl"&&(r+=z(t.clientWidth,n.clientWidth)-i),{width:i,height:s,x:r,y:c}}const Tt=25;function Gn(e,t){const o=K(e),n=Z(e),i=o.visualViewport;let s=n.clientWidth,r=n.clientHeight,c=0,l=0;if(i){s=i.width,r=i.height;const a=It();(!a||a&&t==="fixed")&&(c=i.offsetLeft,l=i.offsetTop)}const u=ke(n);if(u<=0){const a=n.ownerDocument,f=a.body,g=getComputedStyle(f),d=a.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,h=Math.abs(n.clientWidth-f.clientWidth-d);h<=Tt&&(s-=h)}else u<=Tt&&(s+=u);return{width:s,height:r,x:c,y:l}}function Jn(e,t){const o=ie(e,!0,t==="fixed"),n=o.top+e.clientTop,i=o.left+e.clientLeft,s=se(e)?ue(e):q(1),r=e.clientWidth*s.x,c=e.clientHeight*s.y,l=i*s.x,u=n*s.y;return{width:r,height:c,x:l,y:u}}function Mt(e,t,o){let n;if(t==="viewport")n=Gn(e,o);else if(t==="document")n=Kn(Z(e));else if(B(t))n=Jn(t,o);else{const i=zt(e);n={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return Te(n)}function Xt(e,t){const o=pe(e);return o===t||!B(o)||Se(o)?!1:J(o).position==="fixed"||Xt(o,t)}function Qn(e,t){const o=t.get(e);if(o)return o;let n=Ne(e,[],!1).filter(c=>B(c)&&qe(c)!=="body"),i=null;const s=J(e).position==="fixed";let r=s?pe(e):e;for(;B(r)&&!Se(r);){const c=J(r),l=Ht(r);!l&&c.position==="fixed"&&(i=null),(s?!l&&!i:!l&&c.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||Ue(r)&&!l&&Xt(e,r))?n=n.filter(a=>a!==r):i=c,r=pe(r)}return t.set(e,n),n}function Zn(e){let{element:t,boundary:o,rootBoundary:n,strategy:i}=e;const r=[...o==="clippingAncestors"?je(t)?[]:Qn(t,this._c):[].concat(o),n],c=Mt(t,r[0],i);let l=c.top,u=c.right,a=c.bottom,f=c.left;for(let g=1;g<r.length;g++){const d=Mt(t,r[g],i);l=z(d.top,l),u=de(d.right,u),a=de(d.bottom,a),f=z(d.left,f)}return{width:u-f,height:a-l,x:f,y:l}}function eo(e){const{width:t,height:o}=_t(e);return{width:t,height:o}}function to(e,t,o){const n=se(t),i=Z(t),s=o==="fixed",r=ie(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const l=q(0);function u(){l.x=ke(i)}if(n||!n&&!s)if((qe(t)!=="body"||Ue(i))&&(c=De(t)),n){const d=ie(t,!0,s,t);l.x=d.x+t.clientLeft,l.y=d.y+t.clientTop}else i&&u();s&&!n&&i&&u();const a=i&&!n&&!s?Nt(i,c):q(0),f=r.left+c.scrollLeft-l.x-a.x,g=r.top+c.scrollTop-l.y-a.y;return{x:f,y:g,width:r.width,height:r.height}}function _e(e){return J(e).position==="static"}function Dt(e,t){if(!se(e)||J(e).position==="fixed")return null;if(t)return t(e);let o=e.offsetParent;return Z(e)===o&&(o=o.ownerDocument.body),o}function Yt(e,t){const o=K(e);if(je(e))return o;if(!se(e)){let i=pe(e);for(;i&&!Se(i);){if(B(i)&&!_e(i))return i;i=pe(i)}return o}let n=Dt(e,t);for(;n&&un(n)&&_e(n);)n=Dt(n,t);return n&&Se(n)&&_e(n)&&!Ht(n)?o:n||dn(e)||o}const no=async function(e){const t=this.getOffsetParent||Yt,o=this.getDimensions,n=await o(e.floating);return{reference:to(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function oo(e){return J(e).direction==="rtl"}const io={convertOffsetParentRelativeRectToViewportRelativeRect:qn,getDocumentElement:Z,getClippingRect:Zn,getOffsetParent:Yt,getElementRects:no,getClientRects:Un,getDimensions:eo,getScale:ue,isElement:B,isRTL:oo};function jt(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function so(e,t){let o=null,n;const i=Z(e);function s(){var c;clearTimeout(n),(c=o)==null||c.disconnect(),o=null}function r(c,l){c===void 0&&(c=!1),l===void 0&&(l=1),s();const u=e.getBoundingClientRect(),{left:a,top:f,width:g,height:d}=u;if(c||t(),!g||!d)return;const h=ve(f),m=ve(i.clientWidth-(a+g)),b=ve(i.clientHeight-(f+d)),p=ve(a),x={rootMargin:-h+"px "+-m+"px "+-b+"px "+-p+"px",threshold:z(0,de(1,l))||1};let y=!0;function v(A){const P=A[0].intersectionRatio;if(P!==l){if(!y)return r();P?r(!1,P):n=setTimeout(()=>{r(!1,1e-7)},1e3)}P===1&&!jt(u,e.getBoundingClientRect())&&r(),y=!1}try{o=new IntersectionObserver(v,{...x,root:i.ownerDocument})}catch{o=new IntersectionObserver(v,x)}o.observe(e)}return r(!0),s}function kt(e,t,o,n){n===void 0&&(n={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:r=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:l=!1}=n,u=Ze(e),a=i||s?[...u?Ne(u):[],...t?Ne(t):[]]:[];a.forEach(p=>{i&&p.addEventListener("scroll",o,{passive:!0}),s&&p.addEventListener("resize",o)});const f=u&&c?so(u,o):null;let g=-1,d=null;r&&(d=new ResizeObserver(p=>{let[w]=p;w&&w.target===u&&d&&t&&(d.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var x;(x=d)==null||x.observe(t)})),o()}),u&&!l&&d.observe(u),t&&d.observe(t));let h,m=l?ie(e):null;l&&b();function b(){const p=ie(e);m&&!jt(m,p)&&o(),m=p,h=requestAnimationFrame(b)}return o(),()=>{var p;a.forEach(w=>{i&&w.removeEventListener("scroll",o),s&&w.removeEventListener("resize",o)}),f?.(),(p=d)==null||p.disconnect(),d=null,l&&cancelAnimationFrame(h)}}const ro=_n,co=zn,lo=In,ao=Xn,fo=Bn,uo=Nn,go=(e,t,o)=>{const n=new Map,i={platform:io,...o},s={...i.platform,_c:n};return Hn(e,t,{...i,platform:s})};var mo=typeof document<"u",ho=function(){},Ae=mo?R.useLayoutEffect:ho;function Me(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let o,n,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(o=e.length,o!==t.length)return!1;for(n=o;n--!==0;)if(!Me(e[n],t[n]))return!1;return!0}if(i=Object.keys(e),o=i.length,o!==Object.keys(t).length)return!1;for(n=o;n--!==0;)if(!{}.hasOwnProperty.call(t,i[n]))return!1;for(n=o;n--!==0;){const s=i[n];if(!(s==="_owner"&&e.$$typeof)&&!Me(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function qt(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Lt(e,t){const o=qt(e);return Math.round(t*o)/o}function ze(e){const t=R.useRef(e);return Ae(()=>{t.current=e}),t}function po(e){e===void 0&&(e={});const{placement:t="bottom",strategy:o="absolute",middleware:n=[],platform:i,elements:{reference:s,floating:r}={},transform:c=!0,whileElementsMounted:l,open:u}=e,[a,f]=R.useState({x:0,y:0,strategy:o,placement:t,middlewareData:{},isPositioned:!1}),[g,d]=R.useState(n);Me(g,n)||d(n);const[h,m]=R.useState(null),[b,p]=R.useState(null),w=R.useCallback(O=>{O!==A.current&&(A.current=O,m(O))},[]),x=R.useCallback(O=>{O!==P.current&&(P.current=O,p(O))},[]),y=s||h,v=r||b,A=R.useRef(null),P=R.useRef(null),E=R.useRef(a),k=l!=null,D=ze(l),F=ze(i),S=ze(u),M=R.useCallback(()=>{if(!A.current||!P.current)return;const O={placement:t,strategy:o,middleware:g};F.current&&(O.platform=F.current),go(A.current,P.current,O).then(I=>{const C={...I,isPositioned:S.current!==!1};W.current&&!Me(E.current,C)&&(E.current=C,gn.flushSync(()=>{f(C)}))})},[g,t,o,F,S]);Ae(()=>{u===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,f(O=>({...O,isPositioned:!1})))},[u]);const W=R.useRef(!1);Ae(()=>(W.current=!0,()=>{W.current=!1}),[]),Ae(()=>{if(y&&(A.current=y),v&&(P.current=v),y&&v){if(D.current)return D.current(y,v,M);M()}},[y,v,M,D,k]);const H=R.useMemo(()=>({reference:A,floating:P,setReference:w,setFloating:x}),[w,x]),$=R.useMemo(()=>({reference:y,floating:v}),[y,v]),L=R.useMemo(()=>{const O={position:o,left:0,top:0};if(!$.floating)return O;const I=Lt($.floating,a.x),C=Lt($.floating,a.y);return c?{...O,transform:"translate("+I+"px, "+C+"px)",...qt($.floating)>=1.5&&{willChange:"transform"}}:{position:o,left:I,top:C}},[o,c,$.floating,a.x,a.y]);return R.useMemo(()=>({...a,update:M,refs:H,elements:$,floatingStyles:L}),[a,M,H,$,L])}const xo=(e,t)=>{const o=ro(e);return{name:o.name,fn:o.fn,options:[e,t]}},wo=(e,t)=>{const o=co(e);return{name:o.name,fn:o.fn,options:[e,t]}},yo=(e,t)=>({fn:uo(e).fn,options:[e,t]}),bo=(e,t)=>{const o=lo(e);return{name:o.name,fn:o.fn,options:[e,t]}},Ro=(e,t)=>{const o=ao(e);return{name:o.name,fn:o.fn,options:[e,t]}},vo=(e,t)=>{const o=fo(e);return{name:o.name,fn:o.fn,options:[e,t]}};function Ao(e){const{open:t=!1,onOpenChange:o,elements:n={}}=e,i=mn(),s=yn()!=null,r=hn(()=>new bn({open:t,transitionStatus:void 0,onOpenChange:o,referenceElement:n.reference??null,floatingElement:n.floating??null,triggerElements:new Rn,floatingId:i,syncOnly:!1,nested:s})).current;return G(()=>{const c={open:t,floatingId:i};n.reference!==void 0&&(c.referenceElement=n.reference,c.domReferenceElement=B(n.reference)?n.reference:null),n.floating!==void 0&&(c.floatingElement=n.floating),r.update(c)},[t,i,n.reference,n.floating,r]),r.context.onOpenChange=o,r.context.nested=s,r}function Oo(e={}){const{nodeId:t,externalTree:o}=e,n=Ao(e),i=e.rootContext||n,s=i.useState("referenceElement"),r=i.useState("floatingElement"),c=i.useState("domReferenceElement"),l=i.useState("open"),u=i.useState("floatingId"),[a,f]=R.useState(null),[g,d]=R.useState(void 0),[h,m]=R.useState(void 0),b=R.useRef(null),p=vn(o),w=R.useMemo(()=>({reference:s,floating:r,domReference:c}),[s,r,c]),x=po({...e,elements:{...w,...a&&{reference:a}}}),y=B(g)?g:null,v=h===void 0?i.state.floatingElement:h;i.useSyncedValue("referenceElement",g??null),i.useSyncedValue("domReferenceElement",g===void 0?c:y),i.useSyncedValue("floatingElement",v);const A=R.useCallback(S=>{const M=B(S)?{getBoundingClientRect:()=>S.getBoundingClientRect(),getClientRects:()=>S.getClientRects(),contextElement:S}:S;f(M),x.refs.setReference(M)},[x.refs]),P=R.useCallback(S=>{(B(S)||S===null)&&(b.current=S,d(S)),(B(x.refs.reference.current)||x.refs.reference.current===null||S!==null&&!B(S))&&x.refs.setReference(S)},[x.refs,d]),E=R.useCallback(S=>{m(S),x.refs.setFloating(S)},[x.refs]),k=R.useMemo(()=>({...x.refs,setReference:P,setFloating:E,setPositionReference:A,domReference:b}),[x.refs,P,E,A]),D=R.useMemo(()=>({...x.elements,domReference:c}),[x.elements,c]),F=R.useMemo(()=>({...x,dataRef:i.context.dataRef,open:l,onOpenChange:i.setOpen,events:i.context.events,floatingId:u,refs:k,elements:D,nodeId:t,rootStore:i}),[x,k,D,t,i,l,u]);return G(()=>{c&&(b.current=c)},[c]),G(()=>{i.context.dataRef.current.floatingContext=F;const S=p?.nodesRef.current.find(M=>M.id===t);S&&(S.context=F)}),R.useMemo(()=>({...x,context:F,refs:k,elements:D,rootStore:i}),[x,k,D,F,i])}const So=R.createContext(void 0);function Co(){return R.useContext(So)?.direction??"ltr"}const Eo=e=>({name:"arrow",options:e,async fn(t){const{x:o,y:n,placement:i,rects:s,platform:r,elements:c,middlewareData:l}=t,{element:u,padding:a=0,offsetParent:f="real"}=Q(e,t)||{};if(u==null)return{};const g=Bt(a),d={x:o,y:n},h=Qe(i),m=Je(h),b=await r.getDimensions(u),p=h==="y",w=p?"top":"left",x=p?"bottom":"right",y=p?"clientHeight":"clientWidth",v=s.reference[m]+s.reference[h]-d[h]-s.floating[m],A=d[h]-s.reference[h],P=f==="real"?await r.getOffsetParent?.(u):c.floating;let E=c.floating[y]||s.floating[m];(!E||!await r.isElement?.(P))&&(E=c.floating[y]||s.floating[m]);const k=v/2-A/2,D=E/2-b[m]/2-1,F=Math.min(g[w],D),S=Math.min(g[x],D),M=F,W=E-b[m]-S,H=E/2-b[m]/2+k,$=Xe(M,H,W),L=!l.arrow&&te(i)!=null&&H!==$&&s.reference[m]/2-(H<M?F:S)-b[m]/2<0,O=L?H<M?H-M:H-W:0;return{[h]:d[h]+O,data:{[h]:$,centerOffset:H-$-O,...L&&{alignmentOffset:O}},reset:L}}}),Po=(e,t)=>({...Eo(e),options:[e,t]}),To=vo().fn,Mo={name:"hide",async fn(e){const{width:t,height:o,x:n,y:i}=e.rects.reference,s=t===0&&o===0&&n===0&&i===0;return{data:{referenceHidden:(await To(e)).data?.referenceHidden||s}}}},Oe={sideX:"left",sideY:"top"},_o={name:"adaptiveOrigin",async fn(e){const{x:t,y:o,rects:{floating:n},elements:{floating:i},platform:s,strategy:r,placement:c}=e,l=K(i),u=l.getComputedStyle(i);if(!(u.transitionDuration!=="0s"&&u.transitionDuration!==""))return{x:t,y:o,data:Oe};const f=await s.getOffsetParent?.(i);let g={width:0,height:0};if(r==="fixed"&&l?.visualViewport)g={width:l.visualViewport.width,height:l.visualViewport.height};else if(f===l){const w=Ce(i);g={width:w.documentElement.clientWidth,height:w.documentElement.clientHeight}}else await s.isElement?.(f)&&(g=await s.getDimensions(f));const d=V(c);let h=t,m=o;d==="left"&&(h=g.width-(t+n.width)),d==="top"&&(m=g.height-(o+n.height));const b=d==="left"?"right":Oe.sideX,p=d==="top"?"bottom":Oe.sideY;return{x:h,y:m,data:{sideX:b,sideY:p}}}};function Ut(e,t,o){const n=e==="inline-start"||e==="inline-end";return{top:"top",right:n?o?"inline-start":"inline-end":"right",bottom:"bottom",left:n?o?"inline-end":"inline-start":"left"}[t]}function Ft(e,t,o){const{rects:n,placement:i}=e;return{side:Ut(t,V(i),o),align:te(i)||"center",anchor:{width:n.reference.width,height:n.reference.height},positioner:{width:n.floating.width,height:n.floating.height}}}function zo(e){const{anchor:t,positionMethod:o="absolute",side:n="bottom",sideOffset:i=0,align:s="center",alignOffset:r=0,collisionBoundary:c,collisionPadding:l=5,sticky:u=!1,arrowPadding:a=5,disableAnchorTracking:f=!1,inline:g,keepMounted:d=!1,floatingRootContext:h,mounted:m,collisionAvoidance:b,shiftCrossAxis:p=!1,nodeId:w,adaptiveOrigin:x,lazyFlip:y=!1,externalTree:v}=e,[A,P]=R.useState(null);!m&&A!==null&&P(null);const E=b.side||"flip",k=b.align||"flip",D=b.fallbackAxisSide||"end",F=typeof t=="function"?t:void 0,S=Ke(F),M=F?S:t,W=Re(t),H=Re(m),L=Co()==="rtl",O=A||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":L?"left":"right","inline-start":L?"right":"left"}[n],I=s==="center"?O:`${O}-${s}`;let C=l;const ee=1,et=n==="bottom"?ee:0,tt=n==="top"?ee:0,nt=n==="right"?ee:0,ot=n==="left"?ee:0;typeof C=="number"?C={top:C+et,right:C+ot,bottom:C+tt,left:C+nt}:C&&(C={top:(C.top||0)+et,right:(C.right||0)+ot,bottom:(C.bottom||0)+tt,left:(C.left||0)+nt});const xe={boundary:c==="clipping-ancestors"?"clippingAncestors":c,padding:C},re=R.useRef(null),Le=Re(i),Fe=Re(r),Kt=typeof i!="function"?i:0,Gt=typeof r!="function"?r:0,ce=[];g&&ce.push(g),ce.push(xo(T=>{const _=Ft(T,n,L),j=typeof Le.current=="function"?Le.current(_):Le.current,N=typeof Fe.current=="function"?Fe.current(_):Fe.current;return{mainAxis:j,crossAxis:N,alignmentAxis:N}},[Kt,Gt,L,n]));const it=k==="none"&&E!=="shift",st=!it&&(u||p||E==="shift"),rt=E==="none"?null:bo({...xe,padding:{top:C.top+ee,right:C.right+ee,bottom:C.bottom+ee,left:C.left+ee},mainAxis:!p&&E==="flip",crossAxis:k==="flip"?"alignment":!1,fallbackAxisSideDirection:D}),ct=it?null:wo(T=>{const _=Ce(T.elements.floating).documentElement;return{...xe,rootBoundary:p?{x:0,y:0,width:_.clientWidth,height:_.clientHeight}:void 0,mainAxis:k!=="none",crossAxis:st,limiter:u||p?void 0:yo(j=>{if(!re.current)return{};const{width:N,height:U}=re.current.getBoundingClientRect(),Y=X(V(j.placement)),oe=Y==="y"?N:U,fe=Y==="y"?C.left+C.right:C.top+C.bottom;return{offset:oe/2+fe/2}})}},[xe,u,p,C,k]);E==="shift"||k==="shift"||s==="center"?ce.push(ct,rt):ce.push(rt,ct),ce.push(Ro({...xe,apply({elements:{floating:T},availableWidth:_,availableHeight:j,rects:N}){if(!H.current)return;const U=T.style;U.setProperty("--available-width",`${_}px`),U.setProperty("--available-height",`${j}px`);const Y=K(T).devicePixelRatio||1,{x:oe,y:fe,width:be,height:He}=N.reference,Ie=(Math.round((oe+be)*Y)-Math.round(oe*Y))/Y,Be=(Math.round((fe+He)*Y)-Math.round(fe*Y))/Y;U.setProperty("--anchor-width",`${Ie}px`),U.setProperty("--anchor-height",`${Be}px`)}}),Po(T=>({element:re.current||Ce(T.elements.floating).createElement("div"),padding:a,offsetParent:"floating"}),[a]),{name:"transformOrigin",fn(T){const{elements:_,middlewareData:j,placement:N,rects:U,y:Y}=T,oe=V(N),fe=X(oe),be=re.current,He=j.arrow?.x||0,Ie=j.arrow?.y||0,Be=be?.clientWidth||0,Jt=be?.clientHeight||0,Ve=He+Be/2,Rt=Ie+Jt/2,Qt=Math.abs(j.shift?.y||0),Zt=U.reference.height/2,he=typeof i=="function"?i(Ft(T,n,L)):i,en=Qt>he,tn={top:`${Ve}px calc(100% + ${he}px)`,bottom:`${Ve}px ${-he}px`,left:`calc(100% + ${he}px) ${Rt}px`,right:`${-he}px ${Rt}px`}[oe],nn=`${Ve}px ${U.reference.y+Zt-Y}px`;return _.floating.style.setProperty("--transform-origin",st&&fe==="y"&&en?nn:tn),{}}},Mo,x),G(()=>{!m&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[m,h]);const We=R.useMemo(()=>({elementResize:!f&&typeof ResizeObserver<"u",layoutShift:!f&&typeof IntersectionObserver<"u"}),[f]),{refs:le,elements:ge,x:lt,y:at,middlewareData:ae,update:we,placement:ft,context:ut,isPositioned:ne,floatingStyles:dt}=Oo({rootContext:h,open:d?m:void 0,placement:I,middleware:ce,strategy:o,whileElementsMounted:d?void 0:(...T)=>kt(...T,We),nodeId:w,externalTree:v}),{sideX:gt,sideY:mt}=ae.adaptiveOrigin||Oe,$e=ne?o:"fixed",ht=R.useMemo(()=>{const T=x?{position:$e,[gt]:lt,[mt]:at}:{position:$e,...dt};return ne||(T.opacity=0),T},[x,$e,gt,lt,mt,at,dt,ne]),ye=R.useRef(null);G(()=>{if(!m)return;const T=W.current,_=typeof T=="function"?T():T,N=(Wt(_)?_.current:_)||null||null;N!==ye.current&&(le.setPositionReference(N),ye.current=N)},[m,le,M,W]),R.useEffect(()=>{if(!m)return;const T=W.current;typeof T!="function"&&Wt(T)&&T.current!==ye.current&&(le.setPositionReference(T.current),ye.current=T.current)},[m,le,M,W]),R.useEffect(()=>{if(d&&m&&ge.reference&&ge.floating)return kt(ge.reference,ge.floating,we,We)},[d,m,ge,we,We]);const me=V(ft),pt=Ut(n,me,L),xt=te(ft)||"center",wt=!!ae.hide?.referenceHidden;G(()=>{y&&m&&ne&&P(me)},[y,m,ne,me]);const yt=R.useMemo(()=>({position:"absolute",top:ae.arrow?.y,left:ae.arrow?.x}),[ae.arrow]),bt=ae.arrow?.centerOffset!==0;return R.useMemo(()=>({positionerStyles:ht,arrowStyles:yt,arrowRef:re,arrowUncentered:bt,side:pt,align:xt,physicalSide:me,anchorHidden:wt,refs:le,context:ut,isPositioned:ne,update:we}),[ht,yt,re,bt,pt,xt,me,wt,le,ut,ne,we])}function Wt(e){return e!=null&&"current"in e}function Do(e){return e==="starting"?pn:$t}function No(e,t,{styles:o,transitionStatus:n,props:i,refs:s,hidden:r,inert:c=!1}){const l={...o};return c&&(l.pointerEvents="none"),xn("div",e,{state:t,ref:s,props:[{role:"presentation",hidden:r,style:l},Do(n),i],stateAttributesMapping:An})}function ko(e){const t=R.useRef(""),o=R.useCallback(i=>{i.defaultPrevented||(t.current=i.pointerType,e(i,i.pointerType))},[e]);return{onClick:R.useCallback(i=>{if(i.detail===0){e(i,"keyboard");return}"pointerType"in i?e(i,i.pointerType):e(i,t.current),t.current=""},[e]),onPointerDown:o}}function Lo(e,t){const o=R.useRef(e),n=Ke(t);G(()=>{o.current!==e&&n(o.current)},[e,n]),G(()=>{o.current=e},[e])}function Fo(e,t){const o=Ke((s,r)=>{(typeof e=="function"?e():e)||t(r||(wn?"touch":""))}),{onClick:n,onPointerDown:i}=ko(o);return R.useMemo(()=>({onClick:n,onPointerDown:i}),[n,i])}function Xo(e){const[t,o]=R.useState(null),n=Fo(e,o);return Lo(e,i=>{i&&!e&&o(null)}),R.useMemo(()=>({openMethod:t,triggerProps:n}),[t,n])}const Wo=20;function Yo(e,t,o,n){const[i,s]=R.useState(!1);G(()=>{if(!e||!t||o==null){s(!1);return}const r=Ce(o).documentElement.clientWidth,c=o.offsetWidth;s(r>0&&c>0&&c>=r-Wo)},[e,t,o]),On(e&&(!t||i),n)}const $o=R.createContext(void 0);function jo(e){return R.useContext($o)}export{Bo as C,Vo as a,Fo as b,zo as c,Yo as d,No as e,_o as f,jo as g,Do as h,Xo as i,Ao as j,Co as k,io as p,Te as r,Lo as u};
import{l as a}from"./__vite-browser-external-CeOnjjgl.js";const t=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],o=a("trash-2",t);export{o as T};

Sorry, the diff of this file is too big to display

import{r as p,g as N,b as M}from"./__vite-browser-external-CeOnjjgl.js";const D=6e3,S=2500,E=100;function h(t,r){let o;const n=new Promise((a,i)=>{o=setTimeout(()=>i(new Error("landing stats timeout")),r)});return Promise.race([t,n]).finally(()=>{o!=null&&clearTimeout(o)})}const A=5*6e4,P=1440*6e4,k="tokentracker:community-stats:v2";let s=null;function C(t){const r=Number(t?.tokenFloor)||0,o=Number(t?.totalEntries)||0;return!(r>0)||!(o>0)?null:{tokenFloor:r,totalEntries:o,top:Array.isArray(t?.top)?t.top:[],topModels:Array.isArray(t?.topModels)?t.topModels:[],providers:Array.isArray(t?.providers)?t.providers:[],dailyGrowth:Array.isArray(t?.dailyGrowth)?t.dailyGrowth:[],tokenMix:Array.isArray(t?.tokenMix)?t.tokenMix:[],userDistribution:Array.isArray(t?.userDistribution)?t.userDistribution:[],platforms:Array.isArray(t?.platforms)?t.platforms:[],activeDevelopersTotal:Number(t?.activeDevelopersTotal)||0,activeDevelopers30d:Number(t?.activeDevelopers30d)||0,tokens30d:Number(t?.tokens30d)||0,tokenGrowthPct:t?.tokenGrowthPct!=null&&Number.isFinite(Number(t.tokenGrowthPct))?Number(t.tokenGrowthPct):null,developerGrowthPct:t?.developerGrowthPct!=null&&Number.isFinite(Number(t.developerGrowthPct))?Number(t.developerGrowthPct):null,generatedAt:typeof t?.generatedAt=="string"?t.generatedAt:null}}function G(){if(typeof window>"u"||!window.localStorage)return null;try{const t=JSON.parse(window.localStorage.getItem(k)||"null"),r=Number(t?.cachedAt)||0,o=C(t?.data),n=Date.now()-r;return!o||n<0||n>P?null:{data:o,isFresh:n<A}}catch{return null}}function I(t){if(!(typeof window>"u"||!window.localStorage))try{window.localStorage.setItem(k,JSON.stringify({cachedAt:Date.now(),data:t}))}catch{}}function F(){if(s&&Date.now()-s.at<A)return s.promise;const t=Promise.all([h(N({period:"total",limit:E,offset:0}),D),h(M(),S).catch(()=>null)]);return s={at:Date.now(),promise:t},t.catch(()=>{s?.promise===t&&(s=null)}),t}function O({enabled:t=!0}={}){const[r]=p.useState(()=>G()),[o,n]=p.useState(()=>r?{status:"ready",...r.data}:{status:"loading",tokenFloor:null,totalEntries:null,top:[]});return p.useEffect(()=>{if(!t||r?.isFresh)return;let a=!1,i=null,u=null;const y=async()=>{try{const[l,e]=await F();if(a)return;const c=Array.isArray(l?.entries)?l.entries:[],b=c.reduce((m,T)=>m+(Number(T?.total_tokens)||0),0),d=Number(e?.total_tokens)||0;d>0||(s=null);const w=Number(r?.data?.tokenFloor)||0,f=d>0?d:w>0?w:b;if(!c.length||!(f>0)){n(m=>({...m,status:"error"}));return}const g=Array.isArray(e?.top_models)?e.top_models:r?.data?.topModels||[],_={tokenFloor:f,totalEntries:Number(l?.total_entries)||c.length,top:c.slice(0,3),topModels:g,providers:Array.isArray(e?.providers)?e.providers:[],dailyGrowth:Array.isArray(e?.daily_growth)?e.daily_growth:[],tokenMix:Array.isArray(e?.token_mix)?e.token_mix:[],userDistribution:Array.isArray(e?.user_distribution)?e.user_distribution:[],platforms:Array.isArray(e?.platforms)?e.platforms:[],activeDevelopersTotal:Number(e?.active_developers_total)||0,activeDevelopers30d:Number(e?.active_developers_30d)||0,tokens30d:Number(e?.tokens_30d)||0,tokenGrowthPct:e?.token_growth_pct==null?null:Number(e.token_growth_pct),developerGrowthPct:e?.developer_growth_pct==null?null:Number(e.developer_growth_pct),generatedAt:typeof e?.generated_at=="string"?e.generated_at:null};n({status:"ready",..._}),d>0&&I(_)}catch{a||n(e=>e.status==="ready"?e:{...e,status:"error"})}};return typeof window<"u"&&"requestIdleCallback"in window?i=window.requestIdleCallback(y,{timeout:1500}):u=setTimeout(y,400),()=>{a=!0,i!=null&&typeof window.cancelIdleCallback=="function"&&window.cancelIdleCallback(i),u!=null&&clearTimeout(u)}},[t,r]),o}export{O as u};
import{r as a,p as D,q as K,t as j,v as J}from"./__vite-browser-external-CeOnjjgl.js";import{L as q}from"./limits-providers-DoHPHfeA.js";const p=q,g="tt.limits.providerOrder",E="tt.limits.providerVisibility",h="tt.limits.displayMode",O="tt.limits.updatedAt",M="limitsPreferences",B="limitsDisplayMode",w=Object.freeze({USED:"used",REMAINING:"remaining"}),v=new Set(Object.values(w)),L=new Set([g,E,h,O]);function A(){return[...p]}function b(){return Object.fromEntries(p.map(e=>[e,!0]))}function _(e){const t=[];if(Array.isArray(e))for(const n of e)p.includes(n)&&!t.includes(n)&&t.push(n);for(const n of p)t.includes(n)||t.push(n);return t}function N(e){const t=b();if(!e||typeof e!="object"||Array.isArray(e))return t;for(const n of p)typeof e[n]=="boolean"&&(t[n]=e[n]);return t}function G(e){return v.has(e)?e:w.USED}function y(e){if(e!=null){if(typeof e=="number")return Number.isSafeInteger(e)?e:void 0;if(typeof e=="string"){const t=e.trim();if(t==="")return;const n=Number(t);return Number.isSafeInteger(n)?n:void 0}}}function m(e={}){const t=e&&typeof e=="object"?e:{};return{displayMode:G(t.displayMode),providerOrder:_(t.providerOrder),providerVisibility:N(t.providerVisibility),updatedAt:y(t.updatedAt)}}function F(){if(typeof window>"u")return A();try{const e=window.localStorage.getItem(g);return _(e?JSON.parse(e):void 0)}catch{return A()}}function H(){if(typeof window>"u")return b();try{const e=window.localStorage.getItem(E);return N(e?JSON.parse(e):void 0)}catch{return b()}}function Q(){if(typeof window>"u")return w.USED;try{const e=window.localStorage.getItem(h);return v.has(e)?e:w.USED}catch{return w.USED}}function W(){if(!(typeof window>"u"))try{return y(window.localStorage.getItem(O))}catch{return}}function X(){if(typeof window>"u")return!1;try{for(const e of L)if(window.localStorage.getItem(e)!==null)return!0}catch{return!1}return!1}function S(){return m({displayMode:Q(),providerOrder:F(),providerVisibility:H(),updatedAt:W()})}function Z(e){if(typeof window>"u")return;const t=m(e);try{window.localStorage.setItem(g,JSON.stringify(t.providerOrder)),window.localStorage.setItem(E,JSON.stringify(t.providerVisibility)),window.localStorage.setItem(h,t.displayMode),t.updatedAt===void 0?window.localStorage.removeItem(O):window.localStorage.setItem(O,String(t.updatedAt))}catch(n){console.warn("[tokentracker] limits preferences localStorage write failed:",n)}}function $(e){const t=m(e);return{displayMode:t.displayMode,providerOrder:[...t.providerOrder],providerVisibility:{...t.providerVisibility},updatedAt:t.updatedAt??null}}function ee(...e){let t;for(const s of e){const c=y(s);c!==void 0&&(t=t===void 0?c:Math.max(t,c))}const n=Date.now();return t!==void 0&&n<=t?t+1:n}function te(e,t){return e.length===t.length&&e.every((n,s)=>n===t[s])}function re(e,t){return p.every(n=>e[n]===t[n])}function k(e,t){return e.displayMode===t.displayMode&&te(e.providerOrder,t.providerOrder)&&re(e.providerVisibility,t.providerVisibility)}function ie(e,t){return k(e,t)&&y(e.updatedAt)===y(t.updatedAt)}function V(e,t){const n=y(e.updatedAt),s=y(t.updatedAt);return n!==void 0&&(s===void 0||n>s)}function de(){const[e,t]=a.useState(S),n=a.useRef(e),s=a.useCallback((o,r={})=>{const i=m(o);return n.current=i,t(i),r.writeLocal&&Z(i),i},[]),c=a.useCallback(o=>{D()&&K(M,$(o))},[]),u=a.useCallback(o=>{const r=S(),i=V(r,n.current)?s(r):n.current,d=m(o(i));if(k(i,d))return;const f=ee(r.updatedAt,i.updatedAt),l=s({...d,updatedAt:f},{writeLocal:!0});c(l)},[s,c]),P=a.useCallback(o=>{v.has(o)&&u(r=>({...r,displayMode:o}))},[u]),I=a.useCallback(o=>{if(!v.has(o))return;const r=S();if(r.updatedAt!==void 0){s(r);return}s({...r,displayMode:o,updatedAt:void 0},{writeLocal:!0})},[s]);a.useEffect(()=>{if(!D())return;const o=j(r=>{const i=r?.[M];if(i&&typeof i=="object"){const d=m(i);if(!X()){s(d,{writeLocal:!0});return}const f=S();if(V(d,f))s(d,{writeLocal:!0});else{const l=s(f);ie(d,f)||c(l)}return}I(r?.[B])});return J(),o},[I,s,c]),a.useEffect(()=>{if(typeof window>"u")return;const o=r=>{(r.key===null||L.has(r.key))&&s(S())};return window.addEventListener("storage",o),()=>window.removeEventListener("storage",o)},[s]);const U=a.useCallback(o=>{p.includes(o)&&u(r=>({...r,providerVisibility:{...r.providerVisibility,[o]:!r.providerVisibility[o]}}))},[u]),x=a.useCallback(o=>{u(r=>{const i=r.providerOrder.indexOf(o);if(i<=0)return r;const d=[...r.providerOrder];return[d[i-1],d[i]]=[d[i],d[i-1]],{...r,providerOrder:d}})},[u]),C=a.useCallback(o=>{u(r=>{const i=r.providerOrder.indexOf(o);if(i<0||i>=r.providerOrder.length-1)return r;const d=[...r.providerOrder];return[d[i],d[i+1]]=[d[i+1],d[i]],{...r,providerOrder:d}})},[u]),R=a.useCallback((o,r)=>{o!==r&&u(i=>{const d=i.providerOrder.indexOf(o),f=i.providerOrder.indexOf(r);if(d<0||f<0)return i;const l=[...i.providerOrder],[z]=l.splice(d,1);return l.splice(f,0,z),{...i,providerOrder:l}})},[u]),Y=a.useCallback(()=>{u(()=>({displayMode:w.USED,providerOrder:A(),providerVisibility:b()}))},[u]),T=a.useMemo(()=>e.providerOrder.filter(o=>e.providerVisibility[o]!==!1),[e.providerOrder,e.providerVisibility]);return{order:e.providerOrder,visibility:e.providerVisibility,displayMode:e.displayMode,setDisplayMode:P,visibleOrdered:T,toggle:U,moveUp:x,moveDown:C,moveToward:R,reset:Y}}export{w as L,de as u};
import{j as a,d as x,r as o,Q as m,S as g,t as b,v as u,q as f,M as h}from"./__vite-browser-external-CeOnjjgl.js";import{C as y}from"./Card-BBCwyki4.js";function j({checked:t,onChange:s,disabled:e,ariaLabel:r}){return a.jsx("button",{type:"button",role:"switch","aria-checked":t,"aria-label":r,onClick:s,disabled:e,className:x("relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 disabled:opacity-50 disabled:cursor-not-allowed",t?"bg-oai-brand-500":"bg-oai-gray-300 dark:bg-oai-gray-700"),children:a.jsx("span",{className:x("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",t?"translate-x-[18px]":"translate-x-[3px]")})})}function k({label:t,hint:s,control:e}){return a.jsxs("div",{className:"flex flex-col gap-2 py-3 sm:flex-row sm:items-center sm:justify-between sm:gap-4",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:t}),s?a.jsx("div",{className:"mt-0.5 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:s}):null]}),a.jsx("div",{className:"self-end sm:shrink-0 sm:self-auto",children:e})]})}function N({title:t,subtitle:s,action:e,children:r}){return a.jsxs(y,{className:"rounded-lg",children:[a.jsxs("div",{className:"mb-3 flex items-start justify-between gap-4",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("h2",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:t}),s?a.jsx("p",{className:"mt-1 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:s}):null]}),e?a.jsx("div",{className:"shrink-0",children:e}):null]}),a.jsx("div",{className:"-mb-3 divide-y divide-oai-gray-200/60 dark:divide-oai-gray-800/60",children:r})]})}function w({options:t,value:s,onChange:e,disabled:r=!1}){return a.jsx("div",{className:"inline-flex items-center rounded-lg border border-oai-gray-200 bg-oai-gray-50 p-0.5 dark:border-oai-gray-800 dark:bg-oai-gray-900",children:t.map(({value:l,label:d,Icon:i})=>{const n=s===l;return a.jsxs("button",{type:"button",onClick:()=>e(l),"aria-pressed":n,disabled:r,className:x("inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50",n?"bg-white text-oai-black shadow-sm dark:bg-oai-gray-800 dark:text-white":"text-oai-gray-500 hover:text-oai-black dark:text-oai-gray-400 dark:hover:text-white"),children:[i?a.jsx(i,{className:"h-3.5 w-3.5","aria-hidden":!0}):null,a.jsx("span",{children:d})]},l)})})}function S(){const[t,s]=o.useState(null),e=m()&&g();o.useEffect(()=>{if(!e)return;const i=b(n=>s(n));return u(),i},[e]);const r=o.useCallback((i,n)=>{e&&(s(c=>c&&{...c,[i]:n}),f(i,n))},[e]),l=o.useCallback(i=>{e&&h(i)},[e]),d=o.useCallback(()=>{e&&u()},[e]);return{available:e,settings:t,setSetting:r,runAction:l,refresh:d}}export{w as S,j as T,N as a,k as b,S as u};
import{r as c,R as P,a1 as Oe}from"./__vite-browser-external-CeOnjjgl.js";function In(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return c.useMemo(()=>r=>{t.forEach(o=>o(r))},t)}const tt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function me(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function wt(e){return"nodeType"in e}function B(e){var t,n;return e?me(e)?e:wt(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function mt(e){const{Document:t}=B(e);return e instanceof t}function Be(e){return me(e)?!1:e instanceof B(e).HTMLElement}function Vt(e){return e instanceof B(e).SVGElement}function ye(e){return e?me(e)?e.document:wt(e)?mt(e)?e:Be(e)||Vt(e)?e.ownerDocument:document:document:document}const Q=tt?c.useLayoutEffect:c.useEffect;function yt(e){const t=c.useRef(e);return Q(()=>{t.current=e}),c.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function Mn(){const e=c.useRef(null),t=c.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=c.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function ke(e,t){t===void 0&&(t=[e]);const n=c.useRef(e);return Q(()=>{n.current!==e&&(n.current=e)},t),n}function Fe(e,t){const n=c.useRef();return c.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Ke(e){const t=yt(e),n=c.useRef(null),r=c.useCallback(o=>{o!==n.current&&t?.(o,n.current),n.current=o},[]);return[n,r]}function ht(e){const t=c.useRef();return c.useEffect(()=>{t.current=e},[e]),t.current}let ct={};function $e(e,t){return c.useMemo(()=>{if(t)return t;const n=ct[e]==null?0:ct[e]+1;return ct[e]=n,e+"-"+n},[e,t])}function qt(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((i,a)=>{const s=Object.entries(a);for(const[l,u]of s){const f=i[l];f!=null&&(i[l]=f+e*u)}return i},{...t})}}const we=qt(1),ze=qt(-1);function An(e){return"clientX"in e&&"clientY"in e}function xt(e){if(!e)return!1;const{KeyboardEvent:t}=B(e.target);return t&&e instanceof t}function On(e){if(!e)return!1;const{TouchEvent:t}=B(e.target);return t&&e instanceof t}function gt(e){if(On(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return An(e)?{x:e.clientX,y:e.clientY}:null}const _e=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[_e.Translate.toString(e),_e.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),Nt="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Tn(e){return e.matches(Nt)?e:e.querySelector(Nt)}const Nn={display:"none"};function Ln(e){let{id:t,value:n}=e;return P.createElement("div",{id:t,style:Nn},n)}function kn(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return P.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function zn(){const[e,t]=c.useState("");return{announce:c.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const Gt=c.createContext(null);function Pn(e){const t=c.useContext(Gt);c.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Bn(){const[e]=c.useState(()=>new Set),t=c.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[c.useCallback(r=>{let{type:o,event:i}=r;e.forEach(a=>{var s;return(s=a[o])==null?void 0:s.call(a,i)})},[e]),t]}const Fn={draggable:`
To pick up a draggable item, press the space bar.
While dragging, use the arrow keys to move the item.
Press space again to drop the item in its new position, or press escape to cancel.
`},$n={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Xn(e){let{announcements:t=$n,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=Fn}=e;const{announce:i,announcement:a}=zn(),s=$e("DndLiveRegion"),[l,u]=c.useState(!1);if(c.useEffect(()=>{u(!0)},[]),Pn(c.useMemo(()=>({onDragStart(d){let{active:h}=d;i(t.onDragStart({active:h}))},onDragMove(d){let{active:h,over:g}=d;t.onDragMove&&i(t.onDragMove({active:h,over:g}))},onDragOver(d){let{active:h,over:g}=d;i(t.onDragOver({active:h,over:g}))},onDragEnd(d){let{active:h,over:g}=d;i(t.onDragEnd({active:h,over:g}))},onDragCancel(d){let{active:h,over:g}=d;i(t.onDragCancel({active:h,over:g}))}}),[i,t])),!l)return null;const f=P.createElement(P.Fragment,null,P.createElement(Ln,{id:r,value:o.draggable}),P.createElement(kn,{id:s,announcement:a}));return n?Oe.createPortal(f,n):f}var O;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(O||(O={}));function Qe(){}function uo(e,t){return c.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function fo(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return c.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const q=Object.freeze({x:0,y:0});function Jt(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Kt(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Yn(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Lt(e){let{left:t,top:n,height:r,width:o}=e;return[{x:t,y:n},{x:t+o,y:n},{x:t,y:n+r},{x:t+o,y:n+r}]}function _t(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function kt(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const ho=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=kt(t,t.left,t.top),i=[];for(const a of r){const{id:s}=a,l=n.get(s);if(l){const u=Jt(kt(l),o);i.push({id:s,data:{droppableContainer:a,value:u}})}}return i.sort(Kt)},jn=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=Lt(t),i=[];for(const a of r){const{id:s}=a,l=n.get(s);if(l){const u=Lt(l),f=o.reduce((h,g,C)=>h+Jt(u[C],g),0),d=Number((f/4).toFixed(4));i.push({id:s,data:{droppableContainer:a,value:d}})}}return i.sort(Kt)};function Un(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),a=o-r,s=i-n;if(r<o&&n<i){const l=t.width*t.height,u=e.width*e.height,f=a*s,d=f/(l+u-f);return Number(d.toFixed(4))}return 0}const Wn=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const i of r){const{id:a}=i,s=n.get(a);if(s){const l=Un(s,t);l>0&&o.push({id:a,data:{droppableContainer:i,value:l}})}}return o.sort(Yn)};function Hn(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Qt(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:q}function Vn(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return o.reduce((a,s)=>({...a,top:a.top+e*s.y,bottom:a.bottom+e*s.y,left:a.left+e*s.x,right:a.right+e*s.x}),{...n})}}const qn=Vn(1);function Gn(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function Jn(e,t,n){const r=Gn(t);if(!r)return e;const{scaleX:o,scaleY:i,x:a,y:s}=r,l=e.left-a-(1-o)*parseFloat(n),u=e.top-s-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),f=o?e.width/o:e.width,d=i?e.height/i:e.height;return{width:f,height:d,top:u,right:l+f,bottom:u+d,left:l}}const Kn={ignoreTransform:!1};function xe(e,t){t===void 0&&(t=Kn);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:f}=B(e).getComputedStyle(e);u&&(n=Jn(n,u,f))}const{top:r,left:o,width:i,height:a,bottom:s,right:l}=n;return{top:r,left:o,width:i,height:a,bottom:s,right:l}}function zt(e){return xe(e,{ignoreTransform:!0})}function _n(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Qn(e,t){return t===void 0&&(t=B(e).getComputedStyle(e)),t.position==="fixed"}function Zn(e,t){t===void 0&&(t=B(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const i=t[o];return typeof i=="string"?n.test(i):!1})}function nt(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(mt(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Be(o)||Vt(o)||n.includes(o))return n;const i=B(e).getComputedStyle(o);return o!==e&&Zn(o,i)&&n.push(o),Qn(o,i)?n:r(o.parentNode)}return e?r(e):n}function Zt(e){const[t]=nt(e,1);return t??null}function lt(e){return!tt||!e?null:me(e)?e:wt(e)?mt(e)||e===ye(e).scrollingElement?window:Be(e)?e:null:null}function en(e){return me(e)?e.scrollX:e.scrollLeft}function tn(e){return me(e)?e.scrollY:e.scrollTop}function vt(e){return{x:en(e),y:tn(e)}}var N;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(N||(N={}));function nn(e){return!tt||!e?!1:e===document.scrollingElement}function rn(e){const t={x:0,y:0},n=nn(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,a=e.scrollTop>=r.y,s=e.scrollLeft>=r.x;return{isTop:o,isLeft:i,isBottom:a,isRight:s,maxScroll:r,minScroll:t}}const er={x:.2,y:.2};function tr(e,t,n,r,o){let{top:i,left:a,right:s,bottom:l}=n;r===void 0&&(r=10),o===void 0&&(o=er);const{isTop:u,isBottom:f,isLeft:d,isRight:h}=rn(e),g={x:0,y:0},C={x:0,y:0},v={height:t.height*o.y,width:t.width*o.x};return!u&&i<=t.top+v.height?(g.y=N.Backward,C.y=r*Math.abs((t.top+v.height-i)/v.height)):!f&&l>=t.bottom-v.height&&(g.y=N.Forward,C.y=r*Math.abs((t.bottom-v.height-l)/v.height)),!h&&s>=t.right-v.width?(g.x=N.Forward,C.x=r*Math.abs((t.right-v.width-s)/v.width)):!d&&a<=t.left+v.width&&(g.x=N.Backward,C.x=r*Math.abs((t.left+v.width-a)/v.width)),{direction:g,speed:C}}function nr(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:a}=window;return{top:0,left:0,right:i,bottom:a,width:i,height:a}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function on(e){return e.reduce((t,n)=>we(t,vt(n)),q)}function rr(e){return e.reduce((t,n)=>t+en(n),0)}function or(e){return e.reduce((t,n)=>t+tn(n),0)}function ir(e,t){if(t===void 0&&(t=xe),!e)return;const{top:n,left:r,bottom:o,right:i}=t(e);Zt(e)&&(o<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const sr=[["x",["left","right"],rr],["y",["top","bottom"],or]];class Dt{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=nt(n),o=on(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,a,s]of sr)for(const l of a)Object.defineProperty(this,l,{get:()=>{const u=s(r),f=o[i]-u;return this.rect[l]+f},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Te{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function ar(e){const{EventTarget:t}=B(e);return e instanceof t?e:ye(e)}function ut(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var W;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(W||(W={}));function Pt(e){e.preventDefault()}function cr(e){e.stopPropagation()}var w;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(w||(w={}));const sn={start:[w.Space,w.Enter],cancel:[w.Esc],end:[w.Space,w.Enter,w.Tab]},lr=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case w.Right:return{...n,x:n.x+25};case w.Left:return{...n,x:n.x-25};case w.Down:return{...n,y:n.y+25};case w.Up:return{...n,y:n.y-25}}};class an{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Te(ye(n)),this.windowListeners=new Te(B(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(W.Resize,this.handleCancel),this.windowListeners.add(W.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(W.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&ir(r),n(q)}handleKeyDown(t){if(xt(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:i=sn,coordinateGetter:a=lr,scrollBehavior:s="smooth"}=o,{code:l}=t;if(i.end.includes(l)){this.handleEnd(t);return}if(i.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:u}=r.current,f=u?{x:u.left,y:u.top}:q;this.referenceCoordinates||(this.referenceCoordinates=f);const d=a(t,{active:n,context:r.current,currentCoordinates:f});if(d){const h=ze(d,f),g={x:0,y:0},{scrollableAncestors:C}=r.current;for(const v of C){const p=t.code,{isTop:m,isRight:y,isLeft:b,isBottom:S,maxScroll:R,minScroll:E}=rn(v),x=nr(v),D={x:Math.min(p===w.Right?x.right-x.width/2:x.right,Math.max(p===w.Right?x.left:x.left+x.width/2,d.x)),y:Math.min(p===w.Down?x.bottom-x.height/2:x.bottom,Math.max(p===w.Down?x.top:x.top+x.height/2,d.y))},A=p===w.Right&&!y||p===w.Left&&!b,T=p===w.Down&&!S||p===w.Up&&!m;if(A&&D.x!==d.x){const M=v.scrollLeft+h.x,H=p===w.Right&&M<=R.x||p===w.Left&&M>=E.x;if(H&&!h.y){v.scrollTo({left:M,behavior:s});return}H?g.x=v.scrollLeft-M:g.x=p===w.Right?v.scrollLeft-R.x:v.scrollLeft-E.x,g.x&&v.scrollBy({left:-g.x,behavior:s});break}else if(T&&D.y!==d.y){const M=v.scrollTop+h.y,H=p===w.Down&&M<=R.y||p===w.Up&&M>=E.y;if(H&&!h.x){v.scrollTo({top:M,behavior:s});return}H?g.y=v.scrollTop-M:g.y=p===w.Down?v.scrollTop-R.y:v.scrollTop-E.y,g.y&&v.scrollBy({top:-g.y,behavior:s});break}}this.handleMove(t,we(ze(d,this.referenceCoordinates),g))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}an.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=sn,onActivation:o}=t,{active:i}=n;const{code:a}=e.nativeEvent;if(r.start.includes(a)){const s=i.activatorNode.current;return s&&e.target!==s?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function Bt(e){return!!(e&&"distance"in e)}function Ft(e){return!!(e&&"delay"in e)}class Ct{constructor(t,n,r){var o;r===void 0&&(r=ar(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:i}=t,{target:a}=i;this.props=t,this.events=n,this.document=ye(a),this.documentListeners=new Te(this.document),this.listeners=new Te(r),this.windowListeners=new Te(B(a)),this.initialCoordinates=(o=gt(i))!=null?o:q,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(W.Resize,this.handleCancel),this.windowListeners.add(W.DragStart,Pt),this.windowListeners.add(W.VisibilityChange,this.handleCancel),this.windowListeners.add(W.ContextMenu,Pt),this.documentListeners.add(W.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Ft(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Bt(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:o}=this.props;o(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(W.Click,cr,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(W.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:i}=this,{onMove:a,options:{activationConstraint:s}}=i;if(!o)return;const l=(n=gt(t))!=null?n:q,u=ze(o,l);if(!r&&s){if(Bt(s)){if(s.tolerance!=null&&ut(u,s.tolerance))return this.handleCancel();if(ut(u,s.distance))return this.handleStart()}if(Ft(s)&&ut(u,s.tolerance))return this.handleCancel();this.handlePending(s,u);return}t.cancelable&&t.preventDefault(),a(l)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===w.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const ur={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class cn extends Ct{constructor(t){const{event:n}=t,r=ye(n.target);super(t,ur,r)}}cn.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const dr={move:{name:"mousemove"},end:{name:"mouseup"}};var pt;(function(e){e[e.RightClick=2]="RightClick"})(pt||(pt={}));class fr extends Ct{constructor(t){super(t,dr,ye(t.event.target))}}fr.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===pt.RightClick?!1:(r?.({event:n}),!0)}}];const dt={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class hr extends Ct{constructor(t){super(t,dt)}static setup(){return window.addEventListener(dt.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(dt.move.name,t)};function t(){}}}hr.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r?.({event:n}),!0)}}];var Ne;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Ne||(Ne={}));var Ze;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Ze||(Ze={}));function gr(e){let{acceleration:t,activator:n=Ne.Pointer,canScroll:r,draggingRect:o,enabled:i,interval:a=5,order:s=Ze.TreeOrder,pointerCoordinates:l,scrollableAncestors:u,scrollableAncestorRects:f,delta:d,threshold:h}=e;const g=pr({delta:d,disabled:!i}),[C,v]=Mn(),p=c.useRef({x:0,y:0}),m=c.useRef({x:0,y:0}),y=c.useMemo(()=>{switch(n){case Ne.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Ne.DraggableRect:return o}},[n,o,l]),b=c.useRef(null),S=c.useCallback(()=>{const E=b.current;if(!E)return;const x=p.current.x*m.current.x,D=p.current.y*m.current.y;E.scrollBy(x,D)},[]),R=c.useMemo(()=>s===Ze.TreeOrder?[...u].reverse():u,[s,u]);c.useEffect(()=>{if(!i||!u.length||!y){v();return}for(const E of R){if(r?.(E)===!1)continue;const x=u.indexOf(E),D=f[x];if(!D)continue;const{direction:A,speed:T}=tr(E,D,y,t,h);for(const M of["x","y"])g[M][A[M]]||(T[M]=0,A[M]=0);if(T.x>0||T.y>0){v(),b.current=E,C(S,a),p.current=T,m.current=A;return}}p.current={x:0,y:0},m.current={x:0,y:0},v()},[t,S,r,v,i,a,JSON.stringify(y),JSON.stringify(g),C,u,R,f,JSON.stringify(h)])}const vr={x:{[N.Backward]:!1,[N.Forward]:!1},y:{[N.Backward]:!1,[N.Forward]:!1}};function pr(e){let{delta:t,disabled:n}=e;const r=ht(t);return Fe(o=>{if(n||!r||!o)return vr;const i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[N.Backward]:o.x[N.Backward]||i.x===-1,[N.Forward]:o.x[N.Forward]||i.x===1},y:{[N.Backward]:o.y[N.Backward]||i.y===-1,[N.Forward]:o.y[N.Forward]||i.y===1}}},[n,t,r])}function br(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return Fe(o=>{var i;return t==null?null:(i=r??o)!=null?i:null},[r,t])}function wr(e,t){return c.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,i=o.activators.map(a=>({eventName:a.eventName,handler:t(a.handler,r)}));return[...n,...i]},[]),[e,t])}var Pe;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Pe||(Pe={}));var bt;(function(e){e.Optimized="optimized"})(bt||(bt={}));const $t=new Map;function mr(e,t){let{dragging:n,dependencies:r,config:o}=t;const[i,a]=c.useState(null),{frequency:s,measure:l,strategy:u}=o,f=c.useRef(e),d=p(),h=ke(d),g=c.useCallback(function(m){m===void 0&&(m=[]),!h.current&&a(y=>y===null?m:y.concat(m.filter(b=>!y.includes(b))))},[h]),C=c.useRef(null),v=Fe(m=>{if(d&&!n)return $t;if(!m||m===$t||f.current!==e||i!=null){const y=new Map;for(let b of e){if(!b)continue;if(i&&i.length>0&&!i.includes(b.id)&&b.rect.current){y.set(b.id,b.rect.current);continue}const S=b.node.current,R=S?new Dt(l(S),S):null;b.rect.current=R,R&&y.set(b.id,R)}return y}return m},[e,i,n,d,l]);return c.useEffect(()=>{f.current=e},[e]),c.useEffect(()=>{d||g()},[n,d]),c.useEffect(()=>{i&&i.length>0&&a(null)},[JSON.stringify(i)]),c.useEffect(()=>{d||typeof s!="number"||C.current!==null||(C.current=setTimeout(()=>{g(),C.current=null},s))},[s,d,g,...r]),{droppableRects:v,measureDroppableContainers:g,measuringScheduled:i!=null};function p(){switch(u){case Pe.Always:return!1;case Pe.BeforeDragging:return n;default:return!n}}}function ln(e,t){return Fe(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function yr(e,t){return ln(e,t)}function xr(e){let{callback:t,disabled:n}=e;const r=yt(t),o=c.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return c.useEffect(()=>()=>o?.disconnect(),[o]),o}function rt(e){let{callback:t,disabled:n}=e;const r=yt(t),o=c.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return c.useEffect(()=>()=>o?.disconnect(),[o]),o}function Dr(e){return new Dt(xe(e),e)}function Xt(e,t,n){t===void 0&&(t=Dr);const[r,o]=c.useState(null);function i(){o(l=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=l??n)!=null?u:null}const f=t(e);return JSON.stringify(l)===JSON.stringify(f)?l:f})}const a=xr({callback(l){if(e)for(const u of l){const{type:f,target:d}=u;if(f==="childList"&&d instanceof HTMLElement&&d.contains(e)){i();break}}}}),s=rt({callback:i});return Q(()=>{i(),e?(s?.observe(e),a?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),a?.disconnect())},[e]),r}function Cr(e){const t=ln(e);return Qt(e,t)}const Yt=[];function Sr(e){const t=c.useRef(e),n=Fe(r=>e?r&&r!==Yt&&e&&t.current&&e.parentNode===t.current.parentNode?r:nt(e):Yt,[e]);return c.useEffect(()=>{t.current=e},[e]),n}function Rr(e){const[t,n]=c.useState(null),r=c.useRef(e),o=c.useCallback(i=>{const a=lt(i.target);a&&n(s=>s?(s.set(a,vt(a)),new Map(s)):null)},[]);return c.useEffect(()=>{const i=r.current;if(e!==i){a(i);const s=e.map(l=>{const u=lt(l);return u?(u.addEventListener("scroll",o,{passive:!0}),[u,vt(u)]):null}).filter(l=>l!=null);n(s.length?new Map(s):null),r.current=e}return()=>{a(e),a(i)};function a(s){s.forEach(l=>{const u=lt(l);u?.removeEventListener("scroll",o)})}},[o,e]),c.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,a)=>we(i,a),q):on(e):q,[e,t])}function jt(e,t){t===void 0&&(t=[]);const n=c.useRef(null);return c.useEffect(()=>{n.current=null},t),c.useEffect(()=>{const r=e!==q;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?ze(e,n.current):q}function Er(e){c.useEffect(()=>{if(!tt)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function Ir(e,t){return c.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:i}=r;return n[o]=a=>{i(a,t)},n},{}),[e,t])}function un(e){return c.useMemo(()=>e?_n(e):null,[e])}const Ut=[];function Mr(e,t){t===void 0&&(t=xe);const[n]=e,r=un(n?B(n):null),[o,i]=c.useState(Ut);function a(){i(()=>e.length?e.map(l=>nn(l)?r:new Dt(t(l),l)):Ut)}const s=rt({callback:a});return Q(()=>{s?.disconnect(),a(),e.forEach(l=>s?.observe(l))},[e]),o}function Ar(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Be(t)?t:e}function Or(e){let{measure:t}=e;const[n,r]=c.useState(null),o=c.useCallback(u=>{for(const{target:f}of u)if(Be(f)){r(d=>{const h=t(f);return d?{...d,width:h.width,height:h.height}:h});break}},[t]),i=rt({callback:o}),a=c.useCallback(u=>{const f=Ar(u);i?.disconnect(),f&&i?.observe(f),r(f?t(f):null)},[t,i]),[s,l]=Ke(a);return c.useMemo(()=>({nodeRef:s,rect:n,setRef:l}),[n,s,l])}const Tr=[{sensor:cn,options:{}},{sensor:an,options:{}}],Nr={current:{}},Je={draggable:{measure:zt},droppable:{measure:zt,strategy:Pe.WhileDragging,frequency:bt.Optimized},dragOverlay:{measure:xe}};class Le extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const Lr={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Le,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Qe},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Je,measureDroppableContainers:Qe,windowRect:null,measuringScheduled:!1},kr={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Qe,draggableNodes:new Map,over:null,measureDroppableContainers:Qe},ot=c.createContext(kr),dn=c.createContext(Lr);function zr(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Le}}}function Pr(e,t){switch(t.type){case O.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case O.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case O.DragEnd:case O.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case O.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new Le(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case O.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const a=new Le(e.droppable.containers);return a.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:a}}}case O.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new Le(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function Br(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=c.useContext(ot),i=ht(r),a=ht(n?.id);return c.useEffect(()=>{if(!t&&!r&&i&&a!=null){if(!xt(i)||document.activeElement===i.target)return;const s=o.get(a);if(!s)return;const{activatorNode:l,node:u}=s;if(!l.current&&!u.current)return;requestAnimationFrame(()=>{for(const f of[l.current,u.current]){if(!f)continue;const d=Tn(f);if(d){d.focus();break}}})}},[r,t,o,a,i]),null}function Fr(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,i)=>i({transform:o,...r}),n):n}function $r(e){return c.useMemo(()=>({draggable:{...Je.draggable,...e?.draggable},droppable:{...Je.droppable,...e?.droppable},dragOverlay:{...Je.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Xr(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const i=c.useRef(!1),{x:a,y:s}=typeof o=="boolean"?{x:o,y:o}:o;Q(()=>{if(!a&&!s||!t){i.current=!1;return}if(i.current||!r)return;const u=t?.node.current;if(!u||u.isConnected===!1)return;const f=n(u),d=Qt(f,r);if(a||(d.x=0),s||(d.y=0),i.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const h=Zt(u);h&&h.scrollBy({top:d.y,left:d.x})}},[t,a,s,r,n])}const fn=c.createContext({...q,scaleX:1,scaleY:1});var ue;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(ue||(ue={}));const go=c.memo(function(t){var n,r,o,i;let{id:a,accessibility:s,autoScroll:l=!0,children:u,sensors:f=Tr,collisionDetection:d=Wn,measuring:h,modifiers:g,...C}=t;const v=c.useReducer(Pr,void 0,zr),[p,m]=v,[y,b]=Bn(),[S,R]=c.useState(ue.Uninitialized),E=S===ue.Initialized,{draggable:{active:x,nodes:D,translate:A},droppable:{containers:T}}=p,M=x!=null?D.get(x):null,H=c.useRef({initial:null,translated:null}),V=c.useMemo(()=>{var k;return x!=null?{id:x,data:(k=M?.data)!=null?k:Nr,rect:H}:null},[x,M]),G=c.useRef(null),[De,Xe]=c.useState(null),[F,Ye]=c.useState(null),Z=ke(C,Object.values(C)),Ce=$e("DndDescribedBy",a),je=c.useMemo(()=>T.getEnabled(),[T]),z=$r(h),{droppableRects:ee,measureDroppableContainers:de,measuringScheduled:Se}=mr(je,{dragging:E,dependencies:[A.x,A.y],config:z.droppable}),j=br(D,x),Ue=c.useMemo(()=>F?gt(F):null,[F]),oe=En(),te=yr(j,z.draggable.measure);Xr({activeNode:x!=null?D.get(x):null,config:oe.layoutShiftCompensation,initialRect:te,measure:z.draggable.measure});const I=Xt(j,z.draggable.measure,te),Re=Xt(j?j.parentElement:null),J=c.useRef({activatorEvent:null,active:null,activeNode:j,collisionRect:null,collisions:null,droppableRects:ee,draggableNodes:D,draggingNode:null,draggingNodeRect:null,droppableContainers:T,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),fe=T.getNodeFor((n=J.current.over)==null?void 0:n.id),ne=Or({measure:z.dragOverlay.measure}),he=(r=ne.nodeRef.current)!=null?r:j,ge=E?(o=ne.rect)!=null?o:I:null,St=!!(ne.nodeRef.current&&ne.rect),Rt=Cr(St?null:I),it=un(he?B(he):null),ie=Sr(E?fe??j:null),We=Mr(ie),He=Fr(g,{transform:{x:A.x-Rt.x,y:A.y-Rt.y,scaleX:1,scaleY:1},activatorEvent:F,active:V,activeNodeRect:I,containerNodeRect:Re,draggingNodeRect:ge,over:J.current.over,overlayNodeRect:ne.rect,scrollableAncestors:ie,scrollableAncestorRects:We,windowRect:it}),Et=Ue?we(Ue,A):null,It=Rr(ie),mn=jt(It),yn=jt(It,[I]),ve=we(He,mn),pe=ge?qn(ge,He):null,Ee=V&&pe?d({active:V,collisionRect:pe,droppableRects:ee,droppableContainers:je,pointerCoordinates:Et}):null,Mt=_t(Ee,"id"),[se,At]=c.useState(null),xn=St?He:we(He,yn),Dn=Hn(xn,(i=se?.rect)!=null?i:null,I),st=c.useRef(null),Ot=c.useCallback((k,$)=>{let{sensor:X,options:ae}=$;if(G.current==null)return;const U=D.get(G.current);if(!U)return;const Y=k.nativeEvent,K=new X({active:G.current,activeNode:U,event:Y,options:ae,context:J,onAbort(L){if(!D.get(L))return;const{onDragAbort:_}=Z.current,re={id:L};_?.(re),y({type:"onDragAbort",event:re})},onPending(L,ce,_,re){if(!D.get(L))return;const{onDragPending:Me}=Z.current,le={id:L,constraint:ce,initialCoordinates:_,offset:re};Me?.(le),y({type:"onDragPending",event:le})},onStart(L){const ce=G.current;if(ce==null)return;const _=D.get(ce);if(!_)return;const{onDragStart:re}=Z.current,Ie={activatorEvent:Y,active:{id:ce,data:_.data,rect:H}};Oe.unstable_batchedUpdates(()=>{re?.(Ie),R(ue.Initializing),m({type:O.DragStart,initialCoordinates:L,active:ce}),y({type:"onDragStart",event:Ie}),Xe(st.current),Ye(Y)})},onMove(L){m({type:O.DragMove,coordinates:L})},onEnd:be(O.DragEnd),onCancel:be(O.DragCancel)});st.current=K;function be(L){return async function(){const{active:_,collisions:re,over:Ie,scrollAdjustedTranslate:Me}=J.current;let le=null;if(_&&Me){const{cancelDrop:Ae}=Z.current;le={activatorEvent:Y,active:_,collisions:re,delta:Me,over:Ie},L===O.DragEnd&&typeof Ae=="function"&&await Promise.resolve(Ae(le))&&(L=O.DragCancel)}G.current=null,Oe.unstable_batchedUpdates(()=>{m({type:L}),R(ue.Uninitialized),At(null),Xe(null),Ye(null),st.current=null;const Ae=L===O.DragEnd?"onDragEnd":"onDragCancel";if(le){const at=Z.current[Ae];at?.(le),y({type:Ae,event:le})}})}}},[D]),Cn=c.useCallback((k,$)=>(X,ae)=>{const U=X.nativeEvent,Y=D.get(ae);if(G.current!==null||!Y||U.dndKit||U.defaultPrevented)return;const K={active:Y};k(X,$.options,K)===!0&&(U.dndKit={capturedBy:$.sensor},G.current=ae,Ot(X,$))},[D,Ot]),Tt=wr(f,Cn);Er(f),Q(()=>{I&&S===ue.Initializing&&R(ue.Initialized)},[I,S]),c.useEffect(()=>{const{onDragMove:k}=Z.current,{active:$,activatorEvent:X,collisions:ae,over:U}=J.current;if(!$||!X)return;const Y={active:$,activatorEvent:X,collisions:ae,delta:{x:ve.x,y:ve.y},over:U};Oe.unstable_batchedUpdates(()=>{k?.(Y),y({type:"onDragMove",event:Y})})},[ve.x,ve.y]),c.useEffect(()=>{const{active:k,activatorEvent:$,collisions:X,droppableContainers:ae,scrollAdjustedTranslate:U}=J.current;if(!k||G.current==null||!$||!U)return;const{onDragOver:Y}=Z.current,K=ae.get(Mt),be=K&&K.rect.current?{id:K.id,rect:K.rect.current,data:K.data,disabled:K.disabled}:null,L={active:k,activatorEvent:$,collisions:X,delta:{x:U.x,y:U.y},over:be};Oe.unstable_batchedUpdates(()=>{At(be),Y?.(L),y({type:"onDragOver",event:L})})},[Mt]),Q(()=>{J.current={activatorEvent:F,active:V,activeNode:j,collisionRect:pe,collisions:Ee,droppableRects:ee,draggableNodes:D,draggingNode:he,draggingNodeRect:ge,droppableContainers:T,over:se,scrollableAncestors:ie,scrollAdjustedTranslate:ve},H.current={initial:ge,translated:pe}},[V,j,Ee,pe,D,he,ge,ee,T,se,ie,ve]),gr({...oe,delta:A,draggingRect:pe,pointerCoordinates:Et,scrollableAncestors:ie,scrollableAncestorRects:We});const Sn=c.useMemo(()=>({active:V,activeNode:j,activeNodeRect:I,activatorEvent:F,collisions:Ee,containerNodeRect:Re,dragOverlay:ne,draggableNodes:D,droppableContainers:T,droppableRects:ee,over:se,measureDroppableContainers:de,scrollableAncestors:ie,scrollableAncestorRects:We,measuringConfiguration:z,measuringScheduled:Se,windowRect:it}),[V,j,I,F,Ee,Re,ne,D,T,ee,se,de,ie,We,z,Se,it]),Rn=c.useMemo(()=>({activatorEvent:F,activators:Tt,active:V,activeNodeRect:I,ariaDescribedById:{draggable:Ce},dispatch:m,draggableNodes:D,over:se,measureDroppableContainers:de}),[F,Tt,V,I,m,Ce,D,se,de]);return P.createElement(Gt.Provider,{value:b},P.createElement(ot.Provider,{value:Rn},P.createElement(dn.Provider,{value:Sn},P.createElement(fn.Provider,{value:Dn},u)),P.createElement(Br,{disabled:s?.restoreFocus===!1})),P.createElement(Xn,{...s,hiddenTextDescribedById:Ce}));function En(){const k=De?.autoScrollEnabled===!1,$=typeof l=="object"?l.enabled===!1:l===!1,X=E&&!k&&!$;return typeof l=="object"?{...l,enabled:X}:{enabled:X}}}),Yr=c.createContext(null),Wt="button",jr="Draggable";function Ur(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const i=$e(jr),{activators:a,activatorEvent:s,active:l,activeNodeRect:u,ariaDescribedById:f,draggableNodes:d,over:h}=c.useContext(ot),{role:g=Wt,roleDescription:C="draggable",tabIndex:v=0}=o??{},p=l?.id===t,m=c.useContext(p?fn:Yr),[y,b]=Ke(),[S,R]=Ke(),E=Ir(a,t),x=ke(n);Q(()=>(d.set(t,{id:t,key:i,node:y,activatorNode:S,data:x}),()=>{const A=d.get(t);A&&A.key===i&&d.delete(t)}),[d,t]);const D=c.useMemo(()=>({role:g,tabIndex:v,"aria-disabled":r,"aria-pressed":p&&g===Wt?!0:void 0,"aria-roledescription":C,"aria-describedby":f.draggable}),[r,g,v,p,C,f.draggable]);return{active:l,activatorEvent:s,activeNodeRect:u,attributes:D,isDragging:p,listeners:r?void 0:E,node:y,over:h,setNodeRef:b,setActivatorNodeRef:R,transform:m}}function Wr(){return c.useContext(dn)}const Hr="Droppable",Vr={timeout:25};function qr(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const i=$e(Hr),{active:a,dispatch:s,over:l,measureDroppableContainers:u}=c.useContext(ot),f=c.useRef({disabled:n}),d=c.useRef(!1),h=c.useRef(null),g=c.useRef(null),{disabled:C,updateMeasurementsFor:v,timeout:p}={...Vr,...o},m=ke(v??r),y=c.useCallback(()=>{if(!d.current){d.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{u(Array.isArray(m.current)?m.current:[m.current]),g.current=null},p)},[p]),b=rt({callback:y,disabled:C||!a}),S=c.useCallback((D,A)=>{b&&(A&&(b.unobserve(A),d.current=!1),D&&b.observe(D))},[b]),[R,E]=Ke(S),x=ke(t);return c.useEffect(()=>{!b||!R.current||(b.disconnect(),d.current=!1,b.observe(R.current))},[R,b]),c.useEffect(()=>(s({type:O.RegisterDroppable,element:{id:r,key:i,disabled:n,node:R,rect:h,data:x}}),()=>s({type:O.UnregisterDroppable,key:i,id:r})),[r]),c.useEffect(()=>{n!==f.current.disabled&&(s({type:O.SetDroppableDisabled,id:r,key:i,disabled:n}),f.current.disabled=n)},[r,i,n,s]),{active:a,rect:h,isOver:l?.id===r,node:R,over:l,setNodeRef:E}}function hn(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Gr(e,t){return e.reduce((n,r,o)=>{const i=t.get(r);return i&&(n[o]=i),n},Array(e.length))}function Ve(e){return e!==null&&e>=0}function Jr(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Kr(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const qe={scaleX:1,scaleY:1},vo=e=>{var t;let{rects:n,activeNodeRect:r,activeIndex:o,overIndex:i,index:a}=e;const s=(t=n[o])!=null?t:r;if(!s)return null;const l=_r(n,a,o);if(a===o){const u=n[i];return u?{x:o<i?u.left+u.width-(s.left+s.width):u.left-s.left,y:0,...qe}:null}return a>o&&a<=i?{x:-s.width-l,y:0,...qe}:a<o&&a>=i?{x:s.width+l,y:0,...qe}:{x:0,y:0,...qe}};function _r(e,t,n){const r=e[t],o=e[t-1],i=e[t+1];return!r||!o&&!i?0:n<t?o?r.left-(o.left+o.width):i.left-(r.left+r.width):i?i.left-(r.left+r.width):r.left-(o.left+o.width)}const gn=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const i=hn(t,r,n),a=t[o],s=i[o];return!s||!a?null:{x:s.left-a.left,y:s.top-a.top,scaleX:s.width/a.width,scaleY:s.height/a.height}},Ge={scaleX:1,scaleY:1},po=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:i,overIndex:a}=e;const s=(t=i[n])!=null?t:r;if(!s)return null;if(o===n){const u=i[a];return u?{x:0,y:n<a?u.top+u.height-(s.top+s.height):u.top-s.top,...Ge}:null}const l=Qr(i,o,n);return o>n&&o<=a?{x:0,y:-s.height-l,...Ge}:o<n&&o>=a?{x:0,y:s.height+l,...Ge}:{x:0,y:0,...Ge}};function Qr(e,t,n){const r=e[t],o=e[t-1],i=e[t+1];return r?n<t?o?r.top-(o.top+o.height):i?i.top-(r.top+r.height):0:i?i.top-(r.top+r.height):o?r.top-(o.top+o.height):0:0}const vn="Sortable",pn=P.createContext({activeIndex:-1,containerId:vn,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:gn,disabled:{draggable:!1,droppable:!1}});function bo(e){let{children:t,id:n,items:r,strategy:o=gn,disabled:i=!1}=e;const{active:a,dragOverlay:s,droppableRects:l,over:u,measureDroppableContainers:f}=Wr(),d=$e(vn,n),h=s.rect!==null,g=c.useMemo(()=>r.map(E=>typeof E=="object"&&"id"in E?E.id:E),[r]),C=a!=null,v=a?g.indexOf(a.id):-1,p=u?g.indexOf(u.id):-1,m=c.useRef(g),y=!Jr(g,m.current),b=p!==-1&&v===-1||y,S=Kr(i);Q(()=>{y&&C&&f(g)},[y,g,C,f]),c.useEffect(()=>{m.current=g},[g]);const R=c.useMemo(()=>({activeIndex:v,containerId:d,disabled:S,disableTransforms:b,items:g,overIndex:p,useDragOverlay:h,sortedRects:Gr(g,l),strategy:o}),[v,d,S.draggable,S.droppable,b,g,p,l,h,o]);return P.createElement(pn.Provider,{value:R},t)}const Zr=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return hn(n,r,o).indexOf(t)},eo=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:i,newIndex:a,previousItems:s,previousContainerId:l,transition:u}=e;return!u||!r||s!==i&&o===a?!1:n?!0:a!==o&&t===l},to={duration:200,easing:"ease"},bn="transform",no=_e.Transition.toString({property:bn,duration:0,easing:"linear"}),ro={roleDescription:"sortable"};function oo(e){let{disabled:t,index:n,node:r,rect:o}=e;const[i,a]=c.useState(null),s=c.useRef(n);return Q(()=>{if(!t&&n!==s.current&&r.current){const l=o.current;if(l){const u=xe(r.current,{ignoreTransform:!0}),f={x:l.left-u.left,y:l.top-u.top,scaleX:l.width/u.width,scaleY:l.height/u.height};(f.x||f.y)&&a(f)}}n!==s.current&&(s.current=n)},[t,n,r,o]),c.useEffect(()=>{i&&a(null)},[i]),i}function wo(e){let{animateLayoutChanges:t=eo,attributes:n,disabled:r,data:o,getNewIndex:i=Zr,id:a,strategy:s,resizeObserverConfig:l,transition:u=to}=e;const{items:f,containerId:d,activeIndex:h,disabled:g,disableTransforms:C,sortedRects:v,overIndex:p,useDragOverlay:m,strategy:y}=c.useContext(pn),b=io(r,g),S=f.indexOf(a),R=c.useMemo(()=>({sortable:{containerId:d,index:S,items:f},...o}),[d,o,S,f]),E=c.useMemo(()=>f.slice(f.indexOf(a)),[f,a]),{rect:x,node:D,isOver:A,setNodeRef:T}=qr({id:a,data:R,disabled:b.droppable,resizeObserverConfig:{updateMeasurementsFor:E,...l}}),{active:M,activatorEvent:H,activeNodeRect:V,attributes:G,setNodeRef:De,listeners:Xe,isDragging:F,over:Ye,setActivatorNodeRef:Z,transform:Ce}=Ur({id:a,data:R,attributes:{...ro,...n},disabled:b.draggable}),je=In(T,De),z=!!M,ee=z&&!C&&Ve(h)&&Ve(p),de=!m&&F,Se=de&&ee?Ce:null,Ue=ee?Se??(s??y)({rects:v,activeNodeRect:V,activeIndex:h,overIndex:p,index:S}):null,oe=Ve(h)&&Ve(p)?i({id:a,items:f,activeIndex:h,overIndex:p}):S,te=M?.id,I=c.useRef({activeId:te,items:f,newIndex:oe,containerId:d}),Re=f!==I.current.items,J=t({active:M,containerId:d,isDragging:F,isSorting:z,id:a,index:S,items:f,newIndex:I.current.newIndex,previousItems:I.current.items,previousContainerId:I.current.containerId,transition:u,wasDragging:I.current.activeId!=null}),fe=oo({disabled:!J,index:S,node:D,rect:x});return c.useEffect(()=>{z&&I.current.newIndex!==oe&&(I.current.newIndex=oe),d!==I.current.containerId&&(I.current.containerId=d),f!==I.current.items&&(I.current.items=f)},[z,oe,d,f]),c.useEffect(()=>{if(te===I.current.activeId)return;if(te&&!I.current.activeId){I.current.activeId=te;return}const he=setTimeout(()=>{I.current.activeId=te},50);return()=>clearTimeout(he)},[te]),{active:M,activeIndex:h,attributes:G,data:R,rect:x,index:S,newIndex:oe,items:f,isOver:A,isSorting:z,isDragging:F,listeners:Xe,node:D,overIndex:p,over:Ye,setNodeRef:je,setActivatorNodeRef:Z,setDroppableNodeRef:T,setDraggableNodeRef:De,transform:fe??Ue,transition:ne()};function ne(){if(fe||Re&&I.current.newIndex===S)return no;if(!(de&&!xt(H)||!u)&&(z||J))return _e.Transition.toString({...u,property:bn})}}function io(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}function et(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const so=[w.Down,w.Right,w.Up,w.Left],mo=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:o,droppableContainers:i,over:a,scrollableAncestors:s}}=t;if(so.includes(e.code)){if(e.preventDefault(),!n||!r)return;const l=[];i.getEnabled().forEach(d=>{if(!d||d!=null&&d.disabled)return;const h=o.get(d.id);if(h)switch(e.code){case w.Down:r.top<h.top&&l.push(d);break;case w.Up:r.top>h.top&&l.push(d);break;case w.Left:r.left>h.left&&l.push(d);break;case w.Right:r.left<h.left&&l.push(d);break}});const u=jn({collisionRect:r,droppableRects:o,droppableContainers:l});let f=_t(u,"id");if(f===a?.id&&u.length>1&&(f=u[1].id),f!=null){const d=i.get(n.id),h=i.get(f),g=h?o.get(h.id):null,C=h?.node.current;if(C&&g&&d&&h){const p=nt(C).some((E,x)=>s[x]!==E),m=wn(d,h),y=ao(d,h),b=p||!m?{x:0,y:0}:{x:y?r.width-g.width:0,y:y?r.height-g.height:0},S={x:g.left,y:g.top};return b.x&&b.y?S:ze(S,b)}}}};function wn(e,t){return!et(e)||!et(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function ao(e,t){return!et(e)||!et(t)||!wn(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function co(e){if(typeof window>"u")return null;try{const t=window.localStorage.getItem(e);if(!t)return null;const n=JSON.parse(t);return Array.isArray(n)?n.filter(r=>typeof r=="string"):null}catch{return null}}function ft(e,t){if(!(typeof window>"u"))try{window.localStorage.setItem(e,JSON.stringify(t))}catch{}}function Ht(e,t){if(!e)return t;const n=new Set(t),r=e.filter(i=>n.has(i)),o=t.filter(i=>!r.includes(i));return[...r,...o]}function yo(e,t){const n=c.useMemo(()=>t.join("|"),[t]),[r,o]=c.useState(()=>Ht(co(e),t));c.useEffect(()=>{o(s=>{const l=Ht(s,t);return l.length===s.length&&l.every((f,d)=>f===s[d])?s:(ft(e,l),l)})},[n,t,e]);const i=c.useCallback((s,l)=>{!s||!l||s===l||o(u=>{const f=u.indexOf(s),d=u.indexOf(l);if(f===-1||d===-1)return u;const h=u.slice(),[g]=h.splice(f,1);return h.splice(d,0,g),ft(e,h),h})},[e]),a=c.useCallback(()=>{ft(e,t),o(t)},[e,t]);return{order:r,reorder:i,reset:a}}export{_e as C,go as D,an as K,cn as P,bo as S,yo as a,fo as b,uo as c,ho as d,vo as h,mo as s,wo as u,po as v};
import{r as o}from"./__vite-browser-external-CeOnjjgl.js";import{h as r,i as t,p as s}from"./react-CgmQzSd0.js";function i(){!r.current&&t();const[e]=o.useState(s.current);return e}export{i as u};
import{l as u,r as n}from"./__vite-browser-external-CeOnjjgl.js";const f=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],E=u("pencil",f),i="tt.qualityPerDollar.enabled";function l(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(i)==="1"}catch{return!1}}function y(){const[r,o]=n.useState(l);n.useEffect(()=>{if(typeof window>"u")return;const t=e=>{(e.key===null||e.key===i)&&o(l())};return window.addEventListener("storage",t),()=>window.removeEventListener("storage",t)},[]);const a=n.useCallback(t=>{const e=!!t;o(e);try{window.localStorage.setItem(i,e?"1":"0")}catch{}},[]),s=n.useCallback(()=>a(!l()),[a]);return{enabled:r,setEnabled:a,toggle:s}}const d="tt.sessionEfficiency.enabled";function c(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(d)==="1"}catch{return!1}}function g(){const[r,o]=n.useState(c);n.useEffect(()=>{if(typeof window>"u")return;const t=e=>{(e.key===null||e.key===d)&&o(c())};return window.addEventListener("storage",t),()=>window.removeEventListener("storage",t)},[]);const a=n.useCallback(t=>{const e=!!t;o(e);try{window.localStorage.setItem(d,e?"1":"0")}catch{}},[]),s=n.useCallback(()=>a(!c()),[a]);return{enabled:r,setEnabled:a,toggle:s}}export{E as P,g as a,y as u};
import{d as y,u as l,e as A,M as p,b as h,f as C,g as V,j as u}from"./react-CgmQzSd0.js";import{r as f}from"./__vite-browser-external-CeOnjjgl.js";function x(...t){const e=!Array.isArray(t[0]),n=e?0:-1,o=t[0+n],s=t[1+n],c=t[2+n],r=t[3+n],a=y(s,c,r);return e?a(o):a}function E(t){const e=l(()=>A(t)),{isStatic:n}=f.useContext(p);if(n){const[,o]=f.useState(t);f.useEffect(()=>e.on("change",o),[])}return e}function m(t,e){const n=E(e()),o=()=>n.set(e());return o(),h(()=>{const s=()=>V.preRender(o,!1,!0),c=t.map(r=>r.on("change",s));return()=>{c.forEach(r=>r()),C(o)}}),n}function L(t){u.current=[],t();const e=m(u.current,t);return u.current=void 0,e}function g(t,e,n,o){if(typeof t=="function")return L(t);const c=typeof e=="function"?e:x(e,n,o),r=Array.isArray(t)?i(t,c):i([t],([d])=>c(d)),a=Array.isArray(t)?void 0:t.accelerate;return a&&!a.isTransformed&&typeof e!="function"&&Array.isArray(n)&&o?.clamp!==!1&&(r.accelerate={...a,times:e,keyframes:n,isTransformed:!0}),r}function i(t,e){const n=l(()=>[]);return m(t,()=>{n.length=0;const o=t.length;for(let s=0;s<o;s++)n[s]=t[s].get();return e(n)})}export{g as a,E as u};
import{p as _,ae as K,r as w,c as g,af as F,ag as M,ah as b}from"./__vite-browser-external-CeOnjjgl.js";import{l as x}from"./limits-providers-DoHPHfeA.js";const S="native:notificationPermission";let E=null;function N(){return typeof window<"u"&&!!window.chrome?.webview}function v(){return _()?E||"unknown":N()?"granted":typeof Notification>"u"?"unsupported":Notification.permission}function L(e){if(typeof window>"u")return()=>{};const i=t=>{const a=t?.detail?.status;typeof a=="string"&&(E=a),e(v())};return window.addEventListener(S,i),e(v()),_()&&K({type:"getNotificationStatus"}),()=>window.removeEventListener(S,i)}async function I(){if(_()){K({type:"requestNotificationPermission"});return}N()||typeof Notification<"u"&&Notification.permission==="default"&&await Notification.requestPermission().catch(()=>"denied")}const p="tt.limitAlerts.enabled";function O(){try{return window.localStorage.getItem(p)==="1"}catch{return!1}}function U(){const[e,i]=w.useState(O),[t,a]=w.useState("unknown");w.useEffect(()=>L(a),[]);const y=w.useCallback(async n=>{const l=!!n;l&&await I();try{window.localStorage.setItem(p,l?"1":"0")}catch{}i(l)},[]);return{enabled:e,setEnabled:y,permissionBlocked:t==="denied"}}function A(e,i){if(!(e>0))return null;const t=(e-i)/e;return Number.isFinite(t)?Math.min(Math.max(t,0),1):null}function z(e,i,t=.03){return e>i+t}function D(e){const i=Math.max(0,Math.floor(e)),t=Math.floor(i/3600);return t>24?`${Math.floor(t/24)}d`:t>0?`${t}h`:`${Math.floor(i/60)}m`}function j(e,i){if(typeof e.windowSeconds=="number")return e.windowSeconds;if(e.windowSecondsField&&i){const t=i[e.windowSecondsField];return typeof t=="number"&&t>0?t:null}return null}function R(e){return e==null?NaN:typeof e=="number"?e*1e3:Date.parse(e)}function C({usedPercent:e,windowSeconds:i,resetMs:t,mode:a,now:y=Date.now()}){const n=Math.min(Math.max(Number(e)||0,0),100)/100,l={pacePercent:null,paceOver:!1,expectedPercent:null,runsOutEta:null,projectedEnd:null};if(!(i>0)||!Number.isFinite(t))return l;const r=Math.max(0,(t-y)/1e3),s=A(i,r);if(s==null)return l;if(l.expectedPercent=Math.round(s*100),l.paceOver=z(n,s),n>=.05){const u=a==="remaining"?1-s:s;l.pacePercent=u*100}if(s>.02&&n>0){const u=i*s,c=n/u,m=n/s;m>=1&&c>0?l.runsOutEta=D((1-n)/c):l.projectedEnd=Math.round(Math.min(m,1)*100)}return l}const T={claude:{windows(e){const i=Array.isArray(e.weekly_scoped)?e.weekly_scoped.map(t=>({key:`scoped-${t.label}`,label:t.label,window:t,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},...i]}},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){const i=typeof e.period_type=="string"?e.period_type:null,t=i==="weekly"?"limits.label.grok_week":i==="daily"?"limits.label.grok_day":"limits.label.grok_month",a=i==="weekly"?7*86400:i==="daily"?86400:void 0;return[{key:i==="weekly"?"week":i==="daily"?"day":"month",labelKey:t,window:e.primary_window,windowSeconds:a},{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}]}}},P="tt.limitAlerts.cycles.v1";function $(){try{return JSON.parse(window.localStorage.getItem(P)||"{}")}catch{return{}}}function B(e){try{window.localStorage.setItem(P,JSON.stringify(e))}catch{}}function V(e,{now:i=Date.now()}={}){const t=[],a=T;for(const[y,n]of Object.entries(e||{})){const l=a[y];if(!(!n?.configured||n.error||!l))for(const r of l.windows(n)){if(!r.window)continue;const s=Number(r.pctField==="utilization"?r.window.utilization:r.window.used_percent),u=r.resetField==="resets_at"?r.window.resets_at:r.window.reset_at,c=R(u),m=C({usedPercent:s,windowSeconds:j(r,r.window),resetMs:c,mode:"used",now:i});!m.runsOutEta||!m.paceOver||s<20||!(c>i)||t.push({id:`${y}:${r.key}:${c}`,providerId:y,windowKey:r.key,resetMs:c,usedPercent:s,runsOutEta:m.runsOutEta})}}return t}function q(e){const i=$(),t=V(e);for(const n of t){if(i[n.id])continue;const l=x(n.providerId),r=g("limits.alert.title",{provider:l}),s=g("limits.alert.body",{eta:n.runsOutEta,percent:Math.round(n.usedPercent)});let u=F({title:r,body:s,id:n.id});!u&&typeof Notification<"u"&&Notification.permission==="granted"&&(new Notification(r,{body:s,tag:n.id}),u=!0),u&&(i[n.id]=Date.now())}const a=Date.now()-864e5,y=Object.fromEntries(Object.entries(i).filter(([n,l])=>{const r=Number(n.split(":").at(-1));return Number.isFinite(r)?r>=a:Number(l)>=a}).slice(-100));return B(y),t.length}function W(e){const i=!!e?.initialState,[t,a]=w.useState(()=>i?e?.initialState?.data??null:null),[y,n]=w.useState(()=>i?e?.initialState?.error??null:null),[l,r]=w.useState(!i),s=!!e?.initialRefresh,u=!!e?.publishToPreloadCache;w.useEffect(()=>{if(!(!t||typeof window>"u"))try{window.localStorage.getItem(p)==="1"&&q(t)}catch{}},[t]);const c=w.useCallback((o,d)=>{!u||!o||typeof o!="object"||M(o,{source:d})},[u]),m=w.useCallback(async()=>{try{const o=await b({refresh:!0}),d=o&&typeof o=="object"?o:null;a(d),n(null),c(d,"manual-refresh")}catch(o){n(o?.message||String(o))}},[c]),k=w.useCallback(async()=>{try{const o=await b(),d=o&&typeof o=="object"?o:null;a(d),n(null),c(d,"page-load")}catch(o){n(o?.message||String(o))}},[c]);return w.useEffect(()=>{if(typeof window>"u"||typeof document>"u")return;const o=15e3;let d=Date.now();const f=()=>{if(document.visibilityState!=="visible")return;const h=Date.now();h-d<o||(d=h,k())};return window.addEventListener("focus",f),document.addEventListener("visibilitychange",f),()=>{window.removeEventListener("focus",f),document.removeEventListener("visibilitychange",f)}},[k]),w.useEffect(()=>{if(i&&!s)return;let o=!1;return(async()=>{try{const d=await b();if(o)return;const f=d&&typeof d=="object"?d:null;a(f),n(null),c(f,"page-load")}catch(d){if(o)return;n(d?.message||String(d))}finally{o||r(!1)}})(),()=>{o=!0}},[i,s,c]),{data:t,error:y,isLoading:l,refresh:m}}export{T as P,j as a,U as b,C as c,R as r,q as s,W as u};
import{r as e,C as t,D as r,x as c}from"./__vite-browser-external-CeOnjjgl.js";const s=Object.freeze({currency:c,rate:1,symbol:"$",rates:{...r},rateSource:"default",rateFetchedAt:null,setCurrency:()=>{}});function a(){return e.useContext(t)??s}export{a as u};
import{bK as Ve,bL as _t,aH as Ot,aG as H,aI as wt,aU as K,bM as Ct,bn as je,j as Se,bs as ze,r as g,P as X,bN as ot,bO as Dt,aJ as it,aS as Ne,bc as Gt,bP as ct,bQ as xt,aW as x,aV as ke,ba as he,bR as Xe,bS as le,bT as ae,aE as C,aZ as Ut,bU as It,bV as Je,bd as Kt,b7 as ut,b2 as lt,b4 as Vt,bW as Xt,aD as be,b6 as $t,bX as qt,A as Pe,b1 as jt,bY as Ze,aL as Ye,bZ as zt,b_ as He,a_ as Jt,aR as Le,a$ as Zt,aT as Ie,bj as _e,bi as Qt,b$ as en,bg as tn,aF as nn,V as Te,c0 as me,c1 as rn,aO as sn,az as on,W as De,c2 as at,bu as cn,bo as Qe}from"./__vite-browser-external-CeOnjjgl.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:Ve&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function fn(e){return _t?!1:!Ve&&e.width===0&&e.height===0||Ve&&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 qn(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,H(t.effect),t}function pn(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}let We=0;function Ge(e,t={}){const{preventScroll:n=!1,sync:r=!1,shouldFocus:s}=t;cancelAnimationFrame(We);function o(){s&&!s()||e?.focus({preventScroll:n})}if(r)return o(),wt;const i=requestAnimationFrame(o);return We=i,()=>{We===i&&(cancelAnimationFrame(i),We=0)}}const Ue={inert:new WeakMap,"aria-hidden":new WeakMap},dt="data-base-ui-inert",$e={inert:new WeakSet,"aria-hidden":new WeakSet};let xe=new WeakMap,Ke=0;function gn(e){return $e[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=>{je(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=Ue[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),Z=E!==null&&E!=="false",B=(b.get(y)||0)+1;b.set(y,B),k.push(y),B===1&&Z&&T.add(y),Z||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,"")}),Ke+=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)}),Ke-=1,Ke||(Ue.inert=new WeakMap,Ue["aria-hidden"]=new WeakMap,$e.inert=new WeakSet,$e["aria-hidden"]=new WeakSet,xe=new WeakMap)}}function mt(e,t={}){const{ariaHidden:n=!1,inert:r=!1,mark:s=!0}=t,o=K(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 jn(e){const t=ze(),n=tt(e),r=et();return H(()=>{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=Ye(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&&je(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?Ze(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 Ze(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 Zn(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:Z,dataRef:B}=P.context,$=X(()=>B.current.floatingContext?.nodeId),J=s===!1,D=ot(y)&&J,se=Ae(s),F=Ae(o),q=Ae(f),ve=Ae(_),W=tt(T),R=Dt(),Y=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),j=it(ye,R?.afterInsideRef),ie=Ne(),ce=Ne(),Oe=Gt(),Me=R!=null,p=ct(E),ne=X((m=p)=>m?xt(m):[]),Q=X(()=>A?.().filter(m=>m!=null)??[]);g.useEffect(()=>{if(r||!u)return;function m(N){N.key==="Tab"&&C(p,ae(K(p)))&&ne().length===0&&!D&&un(N)}const I=K(p);return x(I,"keydown",m)},[r,p,u,D,ne]),g.useEffect(()=>{if(r||!_)return;const m=K(p);function I(){ee.current=!1}function N(z){const a=be(z),O=Q(),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(`[${$t}]`)&&(oe.current=!0,ce.start(0,()=>{oe.current=!1}))}function G(){de.current="keyboard"}return ke(x(m,"pointerdown",N,!0),x(m,"pointerup",I,!0),x(m,"pointercancel",I,!0),x(m,"keydown",G,!0),I)},[r,E,y,p,_,R,ce,Q]),g.useEffect(()=>{if(r||!h)return;const m=K(p);function I(){oe.current=!0,ce.start(0,()=>{oe.current=!1})}function N(O){const d=be(O);Ze(d)&&(te.current=d)}function G(O){const d=O.relatedTarget,M=O.currentTarget,U=be(O);u&&d==null&&U!=null&&C(E,U)&&Et(U),queueMicrotask(()=>{const w=$(),Re=P.context.triggerElements,c=Q(),l=d?.hasAttribute(Xe("focus-guard"))&&[pe.current,ye.current,R?.beforeInsideRef.current,R?.afterInsideRef.current,R?.beforeOutsideRef.current,R?.afterOutsideRef.current,le(L),le(k)].includes(d),V=!(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||W&&(Fe(W.nodesRef.current,w).find(v=>C(v.context?.elements.floating,d)||C(v.context?.elements.domReference,d))||ft(W.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&&!qt(U)&&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(B.current.insideReactTree){B.current.insideReactTree=!1;return}(D||!u)&&d&&V&&!oe.current&&(D||d!==yt())&&(Y.current=!0,P.setOpen(!1,Pe(jt,O)))})}function z(){ee.current||(B.current.insideReactTree=!0,ie.start(0,()=>{B.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",N),E&&x(E,"focusout",G),E&&R&&x(E,"focusout",z,!0))},[r,y,E,p,u,W,R,P,h,i,ne,D,$,B,ie,ce,Oe,k,L,Q]),g.useEffect(()=>{if(r||!E||!_)return;const m=Array.from(R?.portalNode?.querySelectorAll(`[${Xe("portal")}]`)||[]),N=(W?ft(W.nodesRef.current,$()):[]).find(M=>ot(M.context?.elements.domReference||null))?.context?.elements.domReference,z=[...[E,...m,pe.current,ye.current,R?.beforeOutsideRef.current,R?.afterOutsideRef.current,...Q()],N,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,W,$,k,L,Q]),H(()=>{if(!_||r||!he(p))return;const m=K(p),I=ae(m);queueMicrotask(()=>{const N=se.current,G=typeof N=="function"?N(q.current||""):N;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 U=ae(m);return!(U!==d&&C(p,U))}})})},[r,_,p,ne,se,q,ve]),H(()=>{if(r||!p)return;const m=K(p),I=ae(m),N=q.current==null;Et(I);function G(a){if(a.open||(Ee.current=bn(a.nativeEvent,de.current)),a.reason===Ut&&a.nativeEvent.type==="mouseleave"&&(Y.current=!0),a.reason===It)if(a.nested)Y.current=!1;else if(an(a.nativeEvent)||fn(a.nativeEvent))Y.current=!1;else{let O=!1;K(p).createElement("div").focus({get preventScroll(){return O=!0,!1}}),O?Y.current=!1:Y.current=!0}}Z.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&&je(I)!=="body"?I:null;let U=N?M||d:d||M;return U||(U=yt()||null),typeof O=="boolean"?U:le(O)||U||null}return()=>{Z.off("openchange",G);const a=ae(m),O=Q(),d=C(E,a)||O.some(w=>w===a||C(w,a))||W&&Fe(W.nodesRef.current,$(),!1).some(w=>C(w.context?.elements.floating,a)),M=F.current,U=z();queueMicrotask(()=>{const w=En(U),Re=typeof M!="boolean";M&&!Y.current&&he(w)&&(!(!Re&&w!==a&&a!==m.body)||d)&&w.focus({preventScroll:!0}),Y.current=!1})}},[r,E,p,F,q,Z,W,y,$,Q]),H(()=>{if(!Je||_||!E)return;const m=ae(K(E));!he(m)||!Kt(m)||C(E,m)&&m.blur()},[_,E]),H(()=>{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]),H(()=>{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&&(Y.current=!1,lt(m,R.portalNode)?Vt(y)?.focus():le(L??R.beforeOutsideRef)?.focus())}}),n,ge&&Se.jsx(ut,{"data-type":"inside",ref:j,onFocus:m=>{u?Ge(ne()[0]):R?.portalNode&&(h&&(Y.current=!0),lt(m,R.portalNode)?Xt(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 Qn(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=X(typeof s=="function"?s:()=>!1),P=typeof s=="function"?A:s,_=P!==!1,y=X(()=>o),{escapeKey:E,outsidePress:Z}=Rn(u),B=g.useRef(!1),$=g.useRef(!1),J=g.useRef(!1),D=g.useRef(!1),se=g.useRef(""),F=g.useRef(null),q=Ne(),ve=Ne(),W=X(()=>{ve.clear(),b.current.insideReactTree=!1}),R=X(S=>{const j=b.current.floatingContext?.nodeId;return(T?Fe(T.nodesRef.current,j):[]).some(ce=>ce.context?.open&&!ce.context.dataRef.current[S])}),Y=X(S=>He(S,f.select("floatingElement"))||He(S,f.select("domReferenceElement"))),oe=X(S=>{i()&&f.setOpen(!1,Pe(Jt,S.nativeEvent))}),ee=X(S=>{if(!k||!n||!r||S.key!=="Escape"||D.current||!E&&R("__escapeKeyBubbles"))return;const j=ln(S)?S.nativeEvent:S,ie=Pe(Zt,j);f.setOpen(!1,ie),ie.isCanceled||S.preventDefault(),!E&&!ie.isPropagationAllowed&&S.stopPropagation()}),te=X(()=>{b.current.insideReactTree=!0,ve.start(0,W)}),Ee=X(S=>{if(!k||!n||S.button!==0)return;const j=be(S.nativeEvent);C(f.select("floatingElement"),j)&&(B.current||(B.current=!0,$.current=!1))}),de=X(S=>{!k||!n||(S.defaultPrevented||S.nativeEvent.defaultPrevented)&&B.current&&($.current=!0)});g.useEffect(()=>{if(!k||!n)return;b.current.__escapeKeyBubbles=E,b.current.__outsidePressBubbles=Z;const S=new Le,j=new Le;function ie(){S.clear(),D.current=!0}function ce(){S.start(Je?5:0,()=>{D.current=!1})}function Oe(){J.current=!0,j.start(0,()=>{J.current=!1})}function Me(){B.current=!1,$.current=!1}function p(){const c=se.current,l=c==="pen"||!c?"mouse":c,V=y(),v=typeof V=="function"?V():V;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 Q(c){const l=b.current.floatingContext?.nodeId,V=T&&Fe(T.nodesRef.current,l).some(v=>He(c,v.context?.elements.floating));return Y(c)||V}function ge(c){if(ne(c)){c.type!=="click"&&!Y(c)&&(j.clear(),J.current=!1),W();return}if(b.current.insideReactTree){W();return}const l=be(c),V=`[${Xe("inert")}]`,v=Ie(l)?l.getRootNode():null,ue=Array.from((Ct(v)?v:K(f.select("floatingElement"))).querySelectorAll(V)),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=Qt(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),Be=tn(l),st=/auto|scroll/,At=re||st.test(Be.overflowX),Wt=re||st.test(Be.overflowY),Nt=At&&l.clientWidth>0&&l.scrollWidth>l.clientWidth,Lt=Wt&&l.clientHeight>0&&l.scrollHeight>l.clientHeight,Yt=Be.direction==="rtl",Bt=Lt&&(Yt?c.offsetX<=l.offsetWidth-l.clientWidth:c.offsetX>l.clientWidth),Ht=Nt&&c.offsetY>l.clientHeight;if(Bt||Ht)return}if(!Q(c)){if(p()==="intentional"&&J.current){j.clear(),J.current=!1;return}typeof P=="function"&&!P(c)||R("__outsidePressBubbles")||(f.setOpen(!1,Pe(It,c)),W())}}}function m(c){p()!=="sloppy"||c.pointerType==="touch"||!f.select("open")||!n||Y(c)||ge(c)}function I(c){if(p()!=="sloppy"||!f.select("open")||!n||Y(c))return;const l=c.touches[0];l&&(F.current={startTime:Date.now(),startX:l.clientX,startY:l.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},q.start(1e3,()=>{F.current&&(F.current.dismissOnTouchEnd=!1,F.current.dismissOnMouseDown=!1)}))}function N(c,l){const V=be(c);if(!V)return;const v=x(V,c.type,()=>{l(c),v()})}function G(c){se.current="touch",N(c,I)}function z(c){q.clear(),c.type==="pointerdown"&&(se.current=c.pointerType),!(c.type==="mousedown"&&F.current&&!F.current.dismissOnMouseDown)&&N(c,l=>{l.type==="pointerdown"?m(l):ge(l)})}function a(c){if(!B.current)return;const l=$.current;if(Me(),p()==="intentional"){if(c.type==="pointercancel"){l&&Oe();return}if(!Q(c)){if(l){Oe();return}typeof P=="function"&&!P(c)||(j.clear(),J.current=!0,W())}}}function O(c){if(p()!=="sloppy"||!F.current||Y(c))return;const l=c.touches[0];if(!l)return;const V=Math.abs(l.clientX-F.current.startX),v=Math.abs(l.clientY-F.current.startY),ue=Math.sqrt(V*V+v*v);ue>5&&(F.current.dismissOnTouchEnd=!0),ue>10&&(ge(c),q.clear(),F.current=null)}function d(c){N(c,O)}function M(c){p()!=="sloppy"||!F.current||Y(c)||(F.current.dismissOnTouchEnd&&ge(c),q.clear(),F.current=null)}function U(c){N(c,M)}const w=K(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",U,!0)));return()=>{Re(),S.clear(),j.clear(),Me(),J.current=!1}},[b,L,r,_,P,k,n,E,Z,ee,W,y,R,Y,T,f,q]),g.useEffect(W,[P,W]);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),H(()=>{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),H(()=>{if(!e&&o&&r!=="ending"&&n){const u=me.request(()=>{s("ending")});return()=>{me.cancel(u)}}},[e,o,r,n]),H(()=>{if(!e||t)return;const u=me.request(()=>{s(void 0)});return()=>{me.cancel(u)}},[t,e]),H(()=>{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=X(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 H(()=>{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");H(()=>{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=X(()=>{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),H(()=>()=>{e.update({activeTriggerProps:De,inactiveTriggerProps:De,popupProps:De})},[e])}function ar(e,t){H(()=>{!t&&e.state.openMethod!==null&&e.set("openMethod",null)},[t,e]),H(()=>()=>{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})({}),qe=(function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e})({});const xn={[qe.popupOpen]:""},In={[qe.popupOpen]:"",[qe.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",Wn="ArrowLeft",Nn="ArrowRight",Ln="Home",Yn="End",Bn=new Set([Wn,Nn]),Hn=new Set([Mn,An]),_n=new Set([...Bn,...Hn]),mr=new Set([..._n,Ln,Yn]),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=K(e);return Ye(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=K(e),r=n.documentElement,s=n.body,o=Qe(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 Un(e){const t=K(e),n=t.documentElement,r=t.body,s=Qe(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 Kn(e){const t=K(e),n=t.documentElement,r=t.body,s=Ye(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,Z=n.scrollWidth>n.clientWidth,B=T.overflowY==="scroll"||A.overflowY==="scroll",$=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),q=Qe(n)?n:r;if(u=Gn(e),u){n.style.scrollbarGutter=y,q.style.overflowY="hidden",q.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:y,overflowY:"hidden",overflowX:"hidden"}),(E||B)&&(n.style.overflowY="scroll"),(Z||$)&&(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 Vn{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=K(t).documentElement,s=Ye(r).getComputedStyle(r).overflowY;if(s==="hidden"||s==="clip"){this.restore=wt;return}const o=cn||!Dn(t);this.restore=o?Un(t):Kn(t)}}const Xn=new Vn;function Er(e=!0,t=null){H(()=>{if(e)return Xn.acquire(t)},[e,t])}export{pr as A,jn 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,Zn as d,ar as e,cr as f,ur as g,Qn as h,Er as i,lr as j,nr as k,Tn as l,wn as m,qn 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};
import{r as e,T as r,m as n,n as a,o as s}from"./__vite-browser-external-CeOnjjgl.js";const T=Object.freeze({mode:n.COMPACT,setMode:()=>{},formatTokens:(o,t={})=>s(o,t),formatTokensTooltip:(o,t={})=>a(o,t)});function f(){return e.useContext(r)??T}export{f as u};
import{j as e,c as a,M as I,N as R,r as u,p as $,R as E,d as M}from"./__vite-browser-external-CeOnjjgl.js";import{S as W}from"./Select-DKmJyUtS.js";import{u as K,T as O}from"./use-native-settings-DlDAj7ZJ.js";import{F as L,S as D,a as G}from"./FadeIn-D4PsEvSg.js";import{A as z}from"./arrow-up-right-DAWmHSlU.js";import{D as H}from"./download-CH_YcQ58.js";import"./ToolbarRootContext-Bs1pZOOn.js";import"./useScrollLock-Ct5GyoVg.js";import"./check-DPhmDgw5.js";import"./SelectItemText-BZFLz6Op.js";import"./Card-BBCwyki4.js";import"./react-CgmQzSd0.js";import"./use-reduced-motion-DUgAHZln.js";const U=["todayTokens","todayCost"],F=[{id:"todayTokens",label:"Today Tokens",shortLabel:"Tokens",category:"tokens"},{id:"todayCost",label:"Today Cost",shortLabel:"Cost",category:"cost"},{id:"last7dTokens",label:"Last 7 Days",shortLabel:"7d",category:"tokens"},{id:"totalTokens",label:"Total Tokens",shortLabel:"Total",category:"tokens"},{id:"totalCost",label:"Total Cost",shortLabel:"All $",category:"cost"},{id:"claude5h",label:"Claude 5h Limit",shortLabel:"Cl 5h",category:"limits"},{id:"claude7d",label:"Claude 7d Limit",shortLabel:"Cl 7d",category:"limits"},{id:"codex5h",label:"Codex 5h Limit",shortLabel:"Cx 5h",category:"limits"},{id:"codex7d",label:"Codex 7d Limit",shortLabel:"Cx 7d",category:"limits"},{id:"codexCredits",label:"Codex Credit Limit",shortLabel:"Cx Cred",category:"limits"},{id:"codexSpark5h",label:"Codex Spark 5h Limit",shortLabel:"Cx Spark 5h",category:"limits"},{id:"codexSpark7d",label:"Codex Spark 7d Limit",shortLabel:"Cx Spark 7d",category:"limits"},{id:"cursorPlan",label:"Cursor Plan Limit",shortLabel:"Cu Plan",category:"limits"},{id:"cursorAuto",label:"Cursor Auto Limit",shortLabel:"Cu Auto",category:"limits"},{id:"cursorAPI",label:"Cursor API Limit",shortLabel:"Cu API",category:"limits"},{id:"geminiPro",label:"Gemini Pro Limit",shortLabel:"Gm Pro",category:"limits"},{id:"geminiFlash",label:"Gemini Flash Limit",shortLabel:"Gm Flash",category:"limits"},{id:"geminiLite",label:"Gemini Lite Limit",shortLabel:"Gm Lite",category:"limits"},{id:"kimiWeekly",label:"Kimi Weekly Limit",shortLabel:"Km Wk",category:"limits"},{id:"kimi5h",label:"Kimi 5h Limit",shortLabel:"Km 5h",category:"limits"},{id:"kimiTotal",label:"Kimi Total Limit",shortLabel:"Km Tot",category:"limits"},{id:"kiroMonth",label:"Kiro Monthly Limit",shortLabel:"Kr Mo",category:"limits"},{id:"kiroBonus",label:"Kiro Bonus Limit",shortLabel:"Kr Bn",category:"limits"},{id:"copilotPremium",label:"Copilot Premium Limit",shortLabel:"Co Prem",category:"limits"},{id:"copilotChat",label:"Copilot Chat Limit",shortLabel:"Co Chat",category:"limits"},{id:"antigravityClaudeWeekly",label:"Antigravity Claude 7d Limit",shortLabel:"Ag Cl 7d",category:"limits"},{id:"antigravityClaude5h",label:"Antigravity Claude 5h Limit",shortLabel:"Ag Cl 5h",category:"limits"},{id:"antigravityGeminiWeekly",label:"Antigravity Gemini 7d Limit",shortLabel:"Ag Gm 7d",category:"limits"},{id:"antigravityGemini5h",label:"Antigravity Gemini 5h Limit",shortLabel:"Ag Gm 5h",category:"limits"}];function N(t,i=F,l=2){const s=new Set(i.map(n=>n.id)),o=new Set,r=Array.isArray(t)?t.filter(n=>!s.has(n)||o.has(n)?!1:(o.add(n),!0)):[];return(r.length>0?r:U).slice(0,Math.max(1,Number(l)||2))}const V=264,X=124,g="ui-rounded, -apple-system, system-ui",S=["#5A8CF2","#9973E6","#4DB8A6","#E68C59"],Y={claude:"#C77DFF",codex:"#34C759",cursor:"#FFCC00",gemini:"#0A84FF"};function Z(t){return t>=.9?"#E64D4D":t>=.7?"#D9A633":"#33B866"}function b({size:t="sm",children:i}){const l=t==="lg",s=l?560:264,o=l?32:22;return e.jsx("div",{className:M("flex w-full items-center justify-center rounded-xl bg-oai-gray-100 dark:bg-oai-gray-950/60",l?"py-10 sm:py-14 px-6":"py-6 px-4"),children:e.jsx("div",{className:"overflow-hidden bg-white dark:bg-oai-gray-800 shadow-oai-md dark:shadow-[0_2px_4px_rgba(0,0,0,0.4),0_8px_24px_rgba(0,0,0,0.5)]",style:{width:"100%",maxWidth:s,aspectRatio:`${V} / ${X}`,borderRadius:o},children:i})})}function q({size:t="sm"}){const i="M0,104 L14,104 C26,98 34,100 44,96 S58,88 68,92 80,100 90,94 102,80 112,82 126,92 136,88 150,74 162,76 178,88 188,86 204,72 216,74 236,84 250,80 L264,80",l=`${i} L264,124 L0,124 Z`,s=`sparkArea-${t}`;return e.jsx(b,{size:t,children:e.jsxs("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:s,x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"#0A84FF",stopOpacity:"0.18"}),e.jsx("stop",{offset:"100%",stopColor:"#0A84FF",stopOpacity:"0"})]})}),e.jsx("text",{x:"14",y:"20",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"700",letterSpacing:"0.6",children:a("widgets.preview.today")}),e.jsx("text",{x:"14",y:"46",className:"fill-oai-black dark:fill-white",fontSize:"22",fontWeight:"700",fontFamily:g,children:"203.2M"}),e.jsx("text",{x:"14",y:"60",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"500",fontFamily:g,children:"$129.56 ±0%"}),e.jsx("text",{x:"134",y:"20",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"700",letterSpacing:"0.6",children:a("widgets.preview.seven_days")}),e.jsx("text",{x:"134",y:"46",className:"fill-oai-black dark:fill-white",fontSize:"22",fontWeight:"700",fontFamily:g,children:"880.9M"}),e.jsx("text",{x:"134",y:"60",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"500",fontFamily:g,children:"$673.61"}),e.jsx("path",{d:l,fill:`url(#${s})`,stroke:"none"}),e.jsx("path",{d:i,fill:"none",stroke:"#0A84FF",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})})}const C=(()=>{const l=[];for(let s=0;s<26;s++)for(let o=0;o<7;o++){const r=Math.sin((s+1)*12.9898+(o+1)*78.233+17)*43758.5453,c=Math.floor(Math.abs(r-Math.floor(r))*100);l.push({w:s,d:o,v:c})}return l})();function _(t,i){return t<18?i?"#262626":"#e5e5e5":t<38?"rgba(10, 132, 255, 0.28)":t<58?"rgba(10, 132, 255, 0.50)":t<80?"rgba(10, 132, 255, 0.75)":"#0A84FF"}function J(){return e.jsx(b,{children:e.jsxs("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:[e.jsx("g",{transform:`translate(${19.5}, 10)`,className:"hidden dark:inline",children:C.map(r=>e.jsx("rect",{x:r.w*(7.5+1.2),y:r.d*(8+1.2),width:7.5,height:8,rx:"1.3",fill:_(r.v,!0)},`d-${r.w}-${r.d}`))}),e.jsx("g",{transform:`translate(${19.5}, 10)`,className:"dark:hidden",children:C.map(r=>e.jsx("rect",{x:r.w*(7.5+1.2),y:r.d*(8+1.2),width:7.5,height:8,rx:"1.3",fill:_(r.v,!1)},`l-${r.w}-${r.d}`))}),e.jsx("text",{x:19.5,y:"102",className:"fill-oai-black dark:fill-white",fontSize:"10",fontWeight:"700",fontFamily:g,children:"10.3B"}),e.jsx("text",{x:19.5+30,y:"102",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"9",fontWeight:"500",children:a("widgets.preview.heatmap_summary",{days:202})})]})})}function Q(){const t=[{name:"claude-opus-4-6",value:"586.4M",pct:59},{name:"claude-sonnet-4-5-20250929",value:"218.7M",pct:22},{name:"gpt-5.4",value:"80.6M",pct:8},{name:"composer-2-fast",value:"52.1M",pct:5}],i=22,l=28,s=14,o=236;return e.jsx(b,{children:e.jsx("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:t.map((r,c)=>{const n=l+c*i,h=S[c%S.length];return e.jsxs("g",{children:[e.jsx("circle",{cx:"18",cy:n-3,r:"2.5",fill:h}),e.jsx("text",{x:"26",y:n,className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"500",children:r.name}),e.jsx("text",{x:"218",y:n,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"9",fontWeight:"600",fontFamily:g,children:r.value}),e.jsxs("text",{x:"250",y:n,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"600",fontFamily:g,children:[r.pct,"%"]}),e.jsx("rect",{x:s,y:n+4,width:o,height:"2.8",rx:"1.4",className:"fill-oai-gray-200 dark:fill-oai-gray-700"}),e.jsx("rect",{x:s,y:n+4,width:Math.max(o*(r.pct/100),4),height:"2.8",rx:"1.4",fill:h})]},r.name)})})})}function ee(){const t=[{label:`${a("limits.provider.claude")} · ${a("limits.label.claude_7d")}`,source:"claude",reset:a("widgets.preview.reset_days",{days:1}),pct:61},{label:`${a("limits.provider.claude")} · ${a("limits.label.claude_5h")}`,source:"claude",reset:a("widgets.preview.reset_hours_minutes",{hours:4,minutes:28}),pct:4},{label:a("limits.provider.cursor"),source:"cursor",reset:a("widgets.preview.reset_days",{days:25}),pct:51},{label:`${a("limits.provider.codex")} · ${a("limits.label.codex_7d")}`,source:"codex",reset:a("widgets.preview.reset_days",{days:1}),pct:32}],i=22,l=28,s=14,o=236;return e.jsx(b,{children:e.jsx("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:t.map((r,c)=>{const n=l+c*i,h=Y[r.source],y=Z(r.pct/100);return e.jsxs("g",{children:[e.jsx("circle",{cx:"18",cy:n-3,r:"2.5",fill:h}),e.jsx("text",{x:"26",y:n,className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"500",children:r.label}),e.jsx("text",{x:"218",y:n,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"500",fontFamily:g,children:r.reset}),e.jsxs("text",{x:"250",y:n,textAnchor:"end",className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"700",fontFamily:g,children:[r.pct,"%"]}),e.jsx("rect",{x:s,y:n+4,width:o,height:"2.8",rx:"1.4",className:"fill-oai-gray-200 dark:fill-oai-gray-700"}),e.jsx("rect",{x:s,y:n+4,width:Math.max(o*(r.pct/100),4),height:"2.8",rx:"1.4",fill:y})]},r.label)})})})}function te(t){switch(t.category){case"cost":return"$8.42";case"limits":return"62%";default:return t.id==="last7dTokens"?"1.8B":"203M"}}function ae(t,i){switch(t){case"todayTokens":return a("menubar.metric.today_tokens");case"todayCost":return a("menubar.metric.today_cost");case"last7dTokens":return a("menubar.metric.last_7d_tokens");case"totalTokens":return a("menubar.metric.total_tokens");case"totalCost":return a("menubar.metric.total_cost");case"claude5h":return a("menubar.metric.claude_5h");case"claude7d":return a("menubar.metric.claude_7d");case"codex5h":return a("menubar.metric.codex_5h");case"codex7d":return a("menubar.metric.codex_7d");case"codexCredits":return a("menubar.metric.codex_credits");case"codexSpark5h":return a("menubar.metric.codex_spark_5h");case"codexSpark7d":return a("menubar.metric.codex_spark_7d");default:return i}}function ie(t,i){const l=new Set(i.map(o=>o.id)),s=t.filter(o=>l.has(o));for(const o of i){if(s.length>=2)break;s.includes(o.id)||s.push(o.id)}return s.slice(0,2)}function se({slotConfigs:t,showStats:i}){return e.jsx("div",{className:"flex justify-center rounded-xl bg-gradient-to-b from-oai-gray-100 to-oai-gray-200 px-6 py-8 dark:from-oai-gray-950/80 dark:to-oai-gray-900/80",children:e.jsxs("div",{className:"inline-flex items-stretch rounded-md shadow-[0_1px_3px_rgba(0,0,0,0.18)] ring-1 ring-black/10 dark:ring-white/10 px-3",style:{background:"linear-gradient(180deg, #2c2c2e 0%, #1c1c1e 100%)"},children:[e.jsx("div",{className:"flex items-center pl-2 pr-1 py-2.5",children:e.jsx("img",{src:"/clawd/mini/idle-tight.svg",alt:"","aria-hidden":"true",className:"block shrink-0",style:{height:22,width:"auto"},draggable:"false"})}),i?t.map(({slot:l,item:s},o)=>e.jsxs(E.Fragment,{children:[o>0?e.jsx("span",{className:"my-1 w-px bg-white/20","aria-hidden":"true"}):null,e.jsxs("div",{className:M("flex min-w-[52px] flex-col items-center justify-center py-1.5",o===0?"pl-1 pr-2":"px-2"),children:[e.jsx("span",{className:"text-[13px] font-semibold leading-none tabular-nums text-white",children:s?.previewValue||"--"}),e.jsx("span",{className:"mt-[2px] text-[6px] font-semibold uppercase leading-none text-white/75",children:s?.shortLabel||a("widgets.preview.metric")})]})]},l)):null]})})}function re({slot:t,value:i,options:l,disabled:s,onChange:o}){const r=t===0?a("menubar.slot.primary"):a("menubar.slot.secondary");return e.jsxs("div",{className:"flex min-w-0 flex-col gap-1.5",children:[e.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-[0.08em] text-oai-gray-500 dark:text-oai-gray-400",children:r}),e.jsx(W,{value:i,disabled:s,ariaLabel:r,onValueChange:c=>o(t,c),options:l.map(c=>({value:c.id,label:c.displayLabel})),matchTriggerWidth:!0,className:"w-full px-3 py-2 text-sm font-medium"})]})}function p({label:t,hint:i,checked:l,disabled:s,onChange:o}){return e.jsxs("div",{className:"flex items-center justify-between gap-3 py-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-oai-black dark:text-white",children:t}),i?e.jsx("p",{className:"mt-0.5 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:i}):null]}),e.jsx(O,{checked:l,disabled:s,onChange:o,ariaLabel:t})]})}function le({label:t,hint:i,value:l,options:s,disabled:o,onChange:r}){return e.jsxs("div",{className:"flex items-center justify-between gap-3 py-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-oai-black dark:text-white",children:t}),i?e.jsx("p",{className:"mt-0.5 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:i}):null]}),e.jsx(W,{value:l,disabled:o,ariaLabel:t,onValueChange:r,options:s,className:"shrink-0 px-3 py-2 text-sm font-medium"})]})}function oe(){const{available:t,settings:i,setSetting:l}=K(),s=u.useMemo(()=>(Array.isArray(i?.menuBarAvailableItems)?i.menuBarAvailableItems:F).map(m=>({...m,displayLabel:ae(m.id,m.label),previewValue:te(m)})),[i?.menuBarAvailableItems]),o=Number(i?.menuBarMaxItems)||2,r=u.useMemo(()=>N(i?.menuBarItems,s,o),[s,o,i?.menuBarItems]),c=u.useMemo(()=>ie(r,s),[s,r]),n=i?.showStats!==!1,h=d=>{l("menuBarItems",N(d,s,o))},y=(d,m)=>{const x=[...c];x[d===0?1:0]!==m&&(x[d]=m,h(x))},w=[0,1].map(d=>{const m=c[d]||s[d]?.id||"",v=c[d===0?1:0],B=s.filter(f=>f.id===m||f.id!==v),P=s.find(f=>f.id===m);return{slot:d,currentValue:m,options:B,item:P}}),T=["clawd","cat","pet","static"].includes(i?.menuBarIconStyle)?i.menuBarIconStyle:"clawd",k=i?.toastOnReset!==!1,j=i?.confettiOnReset!==!1;return e.jsxs("article",{className:"rounded-xl border border-oai-gray-200 bg-white p-5 transition-colors duration-200 dark:border-oai-gray-800 dark:bg-oai-gray-900 sm:p-6",children:[e.jsx(se,{slotConfigs:w,showStats:n}),e.jsx("div",{className:"mt-5 grid grid-cols-1 gap-3 sm:grid-cols-2 sm:gap-4",children:w.map(({slot:d,currentValue:m,options:x})=>e.jsx(re,{slot:d,value:m,options:x,disabled:!t||!n,onChange:y},d))}),e.jsxs("div",{className:"mt-5 divide-y divide-oai-gray-100 border-t border-oai-gray-100 dark:divide-oai-gray-800 dark:border-oai-gray-800",children:[e.jsx(p,{label:a("settings.menubar.showStats"),hint:t?a("settings.menubar.showStatsHint"):a("menubar.native_only"),checked:n,disabled:!t,onChange:()=>l("showStats",!n)}),e.jsx(le,{label:a("settings.menubar.iconStyle"),hint:a("settings.menubar.iconStyleHint"),value:T,disabled:!t,options:[{value:"clawd",label:a("settings.menubar.iconStyle.clawd")},{value:"cat",label:a("settings.menubar.iconStyle.cat")},{value:"pet",label:a("settings.menubar.iconStyle.pet")},{value:"static",label:a("settings.menubar.iconStyle.static")}],onChange:d=>l("menuBarIconStyle",d)}),e.jsx(p,{label:a("settings.menubar.toastOnReset"),hint:a("settings.menubar.toastOnResetHint"),checked:k,disabled:!t,onChange:()=>l("toastOnReset",!k)}),e.jsx(p,{label:a("settings.menubar.confettiOnReset"),hint:a("settings.menubar.confettiOnResetHint"),checked:j,disabled:!t,onChange:()=>l("confettiOnReset",!j)})]})]})}function ne(){const[t,i]=u.useState("loading");return u.useEffect(()=>{if(typeof window>"u")return;if($()){i("native");return}const l=(navigator.userAgent||"").toLowerCase(),s=/mac/.test(l)&&!/iphone|ipad/.test(l);i(s?"mac-web":"other")},[]),t}function ce(){const t=ne();return t==="loading"?e.jsx("div",{className:"h-10 w-40","aria-hidden":"true"}):t==="native"?e.jsxs("button",{type:"button",onClick:()=>I("openWidgetGallery"),className:"inline-flex h-10 items-center gap-2 rounded-lg bg-oai-black px-4 text-sm font-medium text-white transition-colors hover:bg-oai-gray-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 focus-visible:ring-offset-2 dark:bg-white dark:text-oai-black dark:hover:bg-oai-gray-200",children:[a("widgets.cta.open_gallery"),e.jsx(z,{className:"h-4 w-4","aria-hidden":"true"})]}):t==="mac-web"?e.jsxs("a",{href:"https://github.com/mm7894215/TokenTracker/releases/latest",target:"_blank",rel:"noopener noreferrer",className:"inline-flex h-10 items-center gap-2 rounded-lg bg-oai-black px-4 text-sm font-medium text-white no-underline transition-colors hover:bg-oai-gray-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 focus-visible:ring-offset-2 dark:bg-white dark:text-oai-black dark:hover:bg-oai-gray-200",children:[e.jsx(H,{className:"h-4 w-4","aria-hidden":"true"}),a("widgets.cta.download")]}):e.jsxs("span",{className:"inline-flex h-10 items-center gap-2 rounded-lg border border-oai-gray-200 bg-oai-gray-50 px-4 text-sm font-medium text-oai-gray-500 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-oai-gray-400",children:[e.jsx(R,{className:"h-4 w-4","aria-hidden":"true"}),a("widgets.cta.macos_only")]})}const de=[{id:"summary",Preview:q,nameKey:"widgets.summary.name",descKey:"widgets.summary.description"},{id:"heatmap",Preview:J,nameKey:"widgets.heatmap.name",descKey:"widgets.heatmap.description"},{id:"topModels",Preview:Q,nameKey:"widgets.topModels.name",descKey:"widgets.topModels.description"},{id:"limits",Preview:ee,nameKey:"widgets.limits.name",descKey:"widgets.limits.description"}];function me({Preview:t,nameKey:i,descKey:l}){return e.jsxs("article",{className:"flex h-full flex-col rounded-xl border border-oai-gray-200 bg-white p-4 transition-colors duration-200 dark:border-oai-gray-800 dark:bg-oai-gray-900 sm:p-5",children:[e.jsx(t,{}),e.jsxs("div",{className:"mt-4",children:[e.jsx("h3",{className:"text-[15px] font-semibold text-oai-black dark:text-white",children:a(i)}),e.jsx("p",{className:"mt-1.5 text-sm leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:a(l)})]})]})}function A({titleKey:t}){return e.jsx("h2",{className:"mb-4 text-xl font-semibold tracking-tight text-oai-black dark:text-white sm:mb-5 sm:text-2xl",children:a(t)})}function Se(){return e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:e.jsxs("div",{className:"mx-auto max-w-5xl px-4 sm:px-6",children:[e.jsx(L,{y:12,children:e.jsxs("header",{className:"mb-10 flex items-start justify-between gap-4 sm:mb-12",children:[e.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:a("widgets.page.title")}),e.jsx("div",{className:"shrink-0",children:e.jsx(ce,{})})]})}),e.jsx(L,{y:12,delay:.06,children:e.jsxs("section",{"aria-label":a("widgets.menubar.section.title"),className:"mb-12 sm:mb-14",children:[e.jsx(A,{titleKey:"widgets.menubar.section.title"}),e.jsx(oe,{})]})}),e.jsxs("section",{"aria-label":a("widgets.gallery.section.title"),children:[e.jsx(A,{titleKey:"widgets.gallery.section.title"}),e.jsx(D,{staggerDelay:.08,initialDelay:.04,children:e.jsx("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-2 lg:gap-5",children:de.map(({id:t,Preview:i,nameKey:l,descKey:s})=>e.jsx(G,{children:e.jsx(me,{Preview:i,nameKey:l,descKey:s})},t))})})]})]})})})}export{Se as WidgetsPage};
import{r as x,j as e,c as s,i as j,k as f}from"./__vite-browser-external-CeOnjjgl.js";function c(a){return Number.isFinite(a)?Math.abs(a)>=1e12?(a/1e12).toFixed(2).replace(/\.?0+$/,"")+"T":f(a,{decimals:2}):"0"}function o({children:a,accent:d=!1,className:n=""}){const l="rounded-2xl border border-oai-gray-200 dark:border-oai-gray-800 p-6 bg-white dark:bg-oai-gray-900",p=d?"bg-gradient-to-br from-emerald-50 to-cyan-50 dark:from-emerald-900/30 dark:to-cyan-900/30 border-transparent":"";return e.jsx("div",{className:`${l} ${p} ${n}`,children:a})}function N(){const[a,d]=x.useState(null),[n,l]=x.useState("loading"),[p,y]=x.useState("");if(x.useEffect(()=>{let t=!1;const g=new URLSearchParams(window.location.search).get("year"),k=g?`/functions/tokentracker-wrapped?year=${encodeURIComponent(g)}`:"/functions/tokentracker-wrapped";return fetch(k).then(async r=>{if(!r.ok)throw new Error(`HTTP ${r.status}`);return r.json()}).then(r=>{t||(d(r),l(r.totals&&r.totals.tokens>0?"ready":"empty"))}).catch(r=>{t||(y(String(r?.message||r)),l("error"))}),()=>{t=!0}},[]),n==="loading")return e.jsx("div",{className:"min-h-screen bg-white dark:bg-oai-gray-950 flex items-center justify-center",children:e.jsx("p",{className:"text-oai-gray-500",children:s("wrapped.loading")})});if(n==="error")return e.jsx("div",{className:"min-h-screen bg-white dark:bg-oai-gray-950 flex items-center justify-center px-6",children:e.jsx(o,{children:e.jsx("p",{className:"text-red-600 dark:text-red-300",children:s("wrapped.error",{error:p})})})});if(n==="empty"||!a)return e.jsx("div",{className:"min-h-screen bg-white dark:bg-oai-gray-950 flex items-center justify-center px-6",children:e.jsx(o,{children:e.jsx("p",{className:"text-oai-gray-500",children:s("wrapped.empty",{command:"tracker sync"})})})});const m=t=>`${(t*100).toFixed(0)}%`,u=j(),i=[];if(a.top.models.length>0){const t=a.top.models[0];i.push(s("wrapped.highlight.model",{model:t.model,percent:(t.share*100).toFixed(0)}))}if(a.top.days.length>0){const t=a.top.days[0];i.push(s("wrapped.highlight.day",{day:t.day,tokens:c(t.tokens)}))}return a.peak_hour&&i.push(s("wrapped.highlight.hour",{hour:String(a.peak_hour.hour).padStart(2,"0")})),a.longest_streak?.days>=2&&i.push(s("wrapped.highlight.streak",{days:a.longest_streak.days})),a.totals.sources>=4&&i.push(s("wrapped.highlight.tools",{count:a.totals.sources})),e.jsx("div",{className:"min-h-screen bg-gradient-to-b from-white to-oai-gray-50 dark:from-oai-gray-950 dark:to-oai-gray-900 px-6 py-12",children:e.jsxs("div",{className:"max-w-3xl mx-auto space-y-6",children:[e.jsxs("header",{className:"text-center pb-6",children:[e.jsx("p",{className:"text-sm uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400",children:s("wrapped.kicker")}),e.jsx("h1",{className:"text-6xl font-bold text-oai-gray-900 dark:text-white mt-2",children:a.year})]}),e.jsxs(o,{accent:!0,className:"text-center",children:[e.jsx("p",{className:"text-xs uppercase tracking-widest text-oai-gray-600 dark:text-oai-gray-300",children:s("wrapped.total_tokens")}),e.jsx("p",{className:"text-7xl font-bold text-emerald-700 dark:text-emerald-300 mt-2",children:c(a.totals.tokens)}),e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400 mt-4",children:s("wrapped.summary",{conversations:a.totals.conversations.toLocaleString(u),days:a.totals.active_days,tools:a.totals.sources})})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs(o,{children:[e.jsx("h3",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400 mb-4",children:s("wrapped.top_tools")}),e.jsx("ul",{className:"space-y-3",children:a.top.sources.slice(0,5).map(t=>e.jsxs("li",{className:"flex items-baseline justify-between",children:[e.jsx("span",{className:"text-oai-gray-900 dark:text-white",children:t.source}),e.jsxs("span",{className:"text-oai-gray-500 dark:text-oai-gray-400 font-mono text-sm",children:[c(t.tokens)," · ",m(t.share)]})]},t.source))})]}),e.jsxs(o,{children:[e.jsx("h3",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400 mb-4",children:s("wrapped.top_models")}),e.jsx("ul",{className:"space-y-3",children:a.top.models.slice(0,5).map(t=>e.jsxs("li",{className:"flex items-baseline justify-between",children:[e.jsx("span",{className:"text-oai-gray-900 dark:text-white truncate pr-3",children:t.model}),e.jsxs("span",{className:"text-oai-gray-500 dark:text-oai-gray-400 font-mono text-sm whitespace-nowrap",children:[c(t.tokens)," · ",m(t.share)]})]},t.model))})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.peak_hour&&e.jsxs(o,{children:[e.jsx("p",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400",children:s("wrapped.peak_hour")}),e.jsxs("p",{className:"text-4xl font-semibold text-oai-gray-900 dark:text-white mt-2",children:[String(a.peak_hour.hour).padStart(2,"0"),":00 UTC"]}),e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400 mt-1",children:s("wrapped.tokens",{count:c(a.peak_hour.tokens)})})]}),a.longest_streak&&a.longest_streak.days>0&&e.jsxs(o,{children:[e.jsx("p",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400",children:s("wrapped.longest_streak")}),e.jsx("p",{className:"text-4xl font-semibold text-oai-gray-900 dark:text-white mt-2",children:s("wrapped.days",{count:a.longest_streak.days})}),e.jsxs("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400 mt-1",children:[a.longest_streak.from," → ",a.longest_streak.to]})]})]}),a.top.days.length>0&&e.jsxs(o,{children:[e.jsx("h3",{className:"text-xs uppercase tracking-widest text-oai-gray-500 dark:text-oai-gray-400 mb-4",children:s("wrapped.top_days")}),e.jsx("ul",{className:"space-y-2",children:a.top.days.slice(0,5).map(t=>e.jsxs("li",{className:"flex items-baseline justify-between",children:[e.jsx("span",{className:"text-oai-gray-900 dark:text-white font-mono text-sm",children:t.day}),e.jsx("span",{className:"text-oai-gray-500 dark:text-oai-gray-400 font-mono text-sm",children:c(t.tokens)})]},t.day))})]}),i.length>0&&e.jsxs(o,{accent:!0,children:[e.jsx("h3",{className:"text-xs uppercase tracking-widest text-oai-gray-600 dark:text-oai-gray-300 mb-3",children:s("wrapped.highlights")}),e.jsx("ul",{className:"space-y-2 text-oai-gray-800 dark:text-oai-gray-200",children:i.map((t,h)=>e.jsxs("li",{className:"text-base",children:["· ",t]},h))})]}),e.jsx("footer",{className:"text-center text-xs text-oai-gray-400 dark:text-oai-gray-500 pt-6",children:s("wrapped.footer",{command:"tracker wrapped --json"})})]})})}export{N as default};
import{l as a}from"./__vite-browser-external-CeOnjjgl.js";const o=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],e=a("zap",o);export{e as Z};

Sorry, the diff of this file is too big to display