tokentracker-cli 0.33.0 → 0.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dashboard/dist/assets/{ActivityHeatmap-C5lQst9A.js → ActivityHeatmap-_zJmKtP2.js} +1 -1
- package/dashboard/dist/assets/{Card-CTEL3aXx.js → Card-BS2ABbwq.js} +1 -1
- package/dashboard/dist/assets/DashboardPage-DlkR4Y-l.js +19 -0
- package/dashboard/dist/assets/{DevicePage-D4bkFEEt.js → DevicePage-BS_MwVUp.js} +1 -1
- package/dashboard/dist/assets/DialogTitle-CSNWjYGj.js +12 -0
- package/dashboard/dist/assets/{FadeIn-BXVxQ51G.js → FadeIn-DIxWR6-M.js} +1 -1
- package/dashboard/dist/assets/{HeaderGithubStar-BxYJXuVn.js → HeaderGithubStar-CLeDseVx.js} +1 -1
- package/dashboard/dist/assets/{IpCheckPage-B3Se3vu3.js → IpCheckPage-BltMdT8r.js} +4 -4
- package/dashboard/dist/assets/{LandingPage-B-AM1mgc.js → LandingPage-Ckmf_iGO.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardAvatar-BNpzqU-s.js → LeaderboardAvatar-aZZacexT.js} +1 -1
- package/dashboard/dist/assets/LeaderboardPage-Chm7475Z.js +6 -0
- package/dashboard/dist/assets/{LeaderboardProfileModal-BXUUSlGG.js → LeaderboardProfileModal-B9iPWc5O.js} +1 -1
- package/dashboard/dist/assets/LeaderboardProfilePage-B268HOjB.js +1 -0
- package/dashboard/dist/assets/LimitsPage-BsLzNCO6.js +2 -0
- package/dashboard/dist/assets/{LocalOnlyNotice-ilp-Q8oP.js → LocalOnlyNotice-DFg7yglW.js} +1 -1
- package/dashboard/dist/assets/LoginPage-DVCpTEii.js +1 -0
- package/dashboard/dist/assets/{PopoverPopup-BvUHJ3fH.js → PopoverPopup-DzFBEvzq.js} +1 -1
- package/dashboard/dist/assets/SettingsPage-D2gehORd.js +1 -0
- package/dashboard/dist/assets/SkillsPage-CDIbfAxi.js +1 -0
- package/dashboard/dist/assets/{WidgetsPage-DEsp4TVs.js → WidgetsPage-DnrCBswn.js} +1 -1
- package/dashboard/dist/assets/{WrappedPage-3kImp9sV.js → WrappedPage-BXbapLiE.js} +1 -1
- package/dashboard/dist/assets/{agent-logos-4uqTG-g5.js → agent-logos-BT_3vfG7.js} +1 -1
- package/dashboard/dist/assets/{arrow-up-right-C6REzMq8.js → arrow-up-right-U3GN7ZK8.js} +1 -1
- package/dashboard/dist/assets/check-Bdnp5EHR.js +1 -0
- package/dashboard/dist/assets/{chevron-down-p9KAHQhU.js → chevron-down-BdbYSxLt.js} +1 -1
- package/dashboard/dist/assets/{download-CvJjPKnF.js → download-Cgae7DJA.js} +1 -1
- package/dashboard/dist/assets/{info-R9MgHQlV.js → info-lAuE6Iqy.js} +1 -1
- package/dashboard/dist/assets/main-BJQZ96HP.js +964 -0
- package/dashboard/dist/assets/{use-limits-display-prefs-CbobmO9m.js → use-limits-display-prefs-BOMVZxxS.js} +1 -1
- package/dashboard/dist/assets/{use-native-settings-DtFQtjxR.js → use-native-settings-CDAuv4ZG.js} +1 -1
- package/dashboard/dist/assets/use-usage-limits-CvfL47sK.js +1 -0
- package/dashboard/dist/assets/{useCurrency-D8PqG8hW.js → useCurrency-B562nxEx.js} +1 -1
- package/dashboard/dist/index.html +1 -1
- package/dashboard/dist/share.html +1 -1
- package/package.json +1 -1
- package/src/lib/pricing/seed-snapshot.json +1 -1
- package/dashboard/dist/assets/DashboardPage-D7Zl3qdP.js +0 -19
- package/dashboard/dist/assets/DialogTitle-DD717-IL.js +0 -12
- package/dashboard/dist/assets/LeaderboardPage-BwlrqFjQ.js +0 -6
- package/dashboard/dist/assets/LeaderboardProfilePage-CBXZv4R_.js +0 -1
- package/dashboard/dist/assets/LimitsPage-Cnk3Do9Y.js +0 -2
- package/dashboard/dist/assets/LoginPage-69LMUSLd.js +0 -1
- package/dashboard/dist/assets/SettingsPage-B5XGzOcZ.js +0 -1
- package/dashboard/dist/assets/SkillsPage-tCvpIDbZ.js +0 -1
- package/dashboard/dist/assets/check-DF1-jcTm.js +0 -1
- package/dashboard/dist/assets/main-DdKVCJWa.js +0 -964
- package/dashboard/dist/assets/use-usage-limits-BwMwzl_A.js +0 -1
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import{co as rt,cp as mn,b5 as Be,aR as $,u as ne,bV as _e,r as d,aV as Q,bS as Wt,aT as A,aS as mt,cq as hn,b8 as ht,a$ as Ve,bi as bn,aQ as st,cr as Vt,cs as at,aY as Ee,bW as it,ct as se,aU as we,aW as K,ba as En,bY as yn,bc as jt,c4 as bt,c6 as Et,c8 as vn,cu as Sn,aZ as ee,x as de,a_ as Rn,cv as Bt,bj as Ke,c3 as Tn,cw as Cn,bK as _t,b4 as ae,bO as ze,bN as xn,cx as wn,cy as Z,bH as Xe,bZ as ct,bF as yt,b$ as On,bL as In,bb as kn,b1 as lt,cz as Kt,cA as Mn,b2 as Yt,cB as le,b6 as $t,b3 as We,cC as Pn,cD as Ht,cE as Gt,cF as vt,cG as Ut,bd as Ie,bT as qt,bk as Fn,w as Ye,bm as dt,bf as Ln,bh as Dn,c2 as Nn}from"./main-DdKVCJWa.js";function ye(e,t,n=!0){return e.filter(r=>r.parentId===t&&(!n||r.context?.open)).flatMap(r=>[r,...ye(e,r.id,n)])}function St(e,t){let n=[],o=e.find(r=>r.id===t)?.parentId;for(;o;){const r=e.find(s=>s.id===o);o=r?.parentId,r&&(n=n.concat(r))}return n}function An(e){e.preventDefault(),e.stopPropagation()}function Wn(e){return"nativeEvent"in e}function Vn(e){return e.mozInputSource===0&&e.isTrusted?!0:rt&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function jn(e){return mn?!1:!rt&&e.width===0&&e.height===0||rt&&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 gr(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function Bn(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}function Fe(e){const t=Be(_n,e).current;return t.next=e,$(t.effect),t}function _n(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}function zt(){const e=new Map;return{emit(t,n){e.get(t)?.forEach(o=>o(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 Kn{nodesRef={current:[]};events=zt();addNode(t){this.nodesRef.current.push(t)}removeNode(t){const n=this.nodesRef.current.findIndex(o=>o===t);n!==-1&&this.nodesRef.current.splice(n,1)}}const Xt=d.createContext(null),Jt=d.createContext(null),$e=()=>d.useContext(Xt)?.id||null,ft=e=>{const t=d.useContext(Jt);return e??t};function mr(e){const t=_e(),n=ft(e),o=$e();return $(()=>{if(!t)return;const r={id:t,parentId:o};return n?.addNode(r),()=>{n?.removeNode(r)}},[n,t,o]),t}function hr(e){const{children:t,id:n}=e,o=$e();return ne.jsx(Xt.Provider,{value:d.useMemo(()=>({id:n,parentId:o}),[n,o]),children:t})}function br(e){const{children:t,externalTree:n}=e,o=Be(()=>n??new Kn).current;return ne.jsx(Jt.Provider,{value:o,children:t})}let Rt=0;function Je(e,t={}){const{preventScroll:n=!1,cancelPrevious:o=!0,sync:r=!1}=t;o&&cancelAnimationFrame(Rt);const s=()=>e?.focus({preventScroll:n});r?s():Rt=requestAnimationFrame(s)}const ve={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function Tt(e){return e==="inert"?ve.inert:e==="aria-hidden"?ve["aria-hidden"]:ve.none}let Le=new WeakSet,De={},Ze=0;const Zt=e=>e&&(e.host||Zt(e.parentNode)),Yn=(e,t)=>t.map(n=>{if(e.contains(n))return n;const o=Zt(n);return e.contains(o)?o:null}).filter(n=>n!=null);function $n(e,t,n,o){const r="data-base-ui-inert",s=o?"inert":n?"aria-hidden":null,u=Yn(t,e),a=new Set,i=new Set(u),l=[];De[r]||(De[r]=new WeakMap);const b=De[r];u.forEach(f),p(t),a.clear();function f(g){!g||a.has(g)||(a.add(g),g.parentNode&&f(g.parentNode))}function p(g){!g||i.has(g)||[].forEach.call(g.children,h=>{if(Wt(h)!=="script")if(a.has(h))p(h);else{const y=s?h.getAttribute(s):null,C=y!==null&&y!=="false",O=Tt(s),v=(O.get(h)||0)+1,R=(b.get(h)||0)+1;O.set(h,v),b.set(h,R),l.push(h),v===1&&C&&Le.add(h),R===1&&h.setAttribute(r,""),!C&&s&&h.setAttribute(s,s==="inert"?"":"true")}})}return Ze+=1,()=>{l.forEach(g=>{const h=Tt(s),C=(h.get(g)||0)-1,O=(b.get(g)||0)-1;h.set(g,C),b.set(g,O),C||(!Le.has(g)&&s&&g.removeAttribute(s),Le.delete(g)),O||g.removeAttribute(r)}),Ze-=1,Ze||(ve.inert=new WeakMap,ve["aria-hidden"]=new WeakMap,ve.none=new WeakMap,Le=new WeakSet,De={})}}function Hn(e,t=!1,n=!1){const o=Q(e[0]).body;return $n(e.concat(Array.from(o.querySelectorAll("[aria-live]"))),o,t,n)}function Gn(e,t){const n=Ke(e.target);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 Ct=20;let ie=[];function pt(){ie=ie.filter(e=>e.isConnected)}function Un(e){pt(),e&&Wt(e)!=="body"&&(ie.push(e),ie.length>Ct&&(ie=ie.slice(-Ct)))}function Qe(){return pt(),ie[ie.length-1]}function qn(e){if(!e)return null;const t=at();return Bt(e,t)?e:Vt(e,t)[0]||e}function zn(e){return!e||!e.isConnected?!1:typeof e.checkVisibility=="function"?e.checkVisibility():_t(e).display!=="none"}function xt(e,t){if(!t.current.includes("floating")&&!e.getAttribute("role")?.includes("dialog"))return;const n=at(),r=Cn(e,n).filter(u=>{const a=u.getAttribute("data-tabindex")||"";return Bt(u,n)||u.hasAttribute("data-tabindex")&&!a.startsWith("-")}),s=e.getAttribute("tabindex");t.current.includes("floating")||r.length===0?s!=="0"&&e.setAttribute("tabindex","0"):(s!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function Xn(e){const{context:t,children:n,disabled:o=!1,order:r=["content"],initialFocus:s=!0,returnFocus:u=!0,restoreFocus:a=!1,modal:i=!0,closeOnFocusOut:l=!0,openInteractionType:b="",getInsideElements:f=()=>[],nextFocusableElement:p,previousFocusableElement:g,beforeContentFocusGuardRef:h,externalTree:y}=e,C="rootStore"in t?t.rootStore:t,O=C.useState("open"),v=C.useState("domReferenceElement"),R=C.useState("floatingElement"),{events:N,dataRef:F}=C.context,M=A(()=>F.current.floatingContext?.nodeId),B=A(f),L=s===!1,j=mt(v)&&L,W=Fe(r),_=Fe(s),q=Fe(u),Re=Fe(b),G=ft(y),k=hn(),re=d.useRef(null),He=d.useRef(null),Y=d.useRef(!1),oe=d.useRef(!1),fe=d.useRef(!1),ke=d.useRef(-1),pe=d.useRef(""),J=d.useRef(""),Te=d.useRef(null),ce=d.useRef(null),Ge=ht(Te,h,k?.beforeInsideRef),Ce=ht(ce,k?.afterInsideRef),ge=Ve(),ue=Ve(),me=bn(),he=k!=null,c=st(R),w=A((m=c)=>m?Vt(m,at()):[]),E=A(m=>{const T=w(m);return W.current.map(()=>T).filter(Boolean).flat()});d.useEffect(()=>{if(o||!i)return;function m(I){I.key==="Tab"&&K(c,we(Q(c)))&&w().length===0&&!j&&An(I)}const T=Q(c);return T.addEventListener("keydown",m),()=>{T.removeEventListener("keydown",m)}},[o,v,c,i,W,j,w,E]),d.useEffect(()=>{if(o||!R)return;function m(T){const I=ee(T),V=w().indexOf(I);V!==-1&&(ke.current=V)}return R.addEventListener("focusin",m),()=>{R.removeEventListener("focusin",m)}},[o,R,w]),d.useEffect(()=>{if(o||!O)return;const m=Q(c);function T(){fe.current=!1}function I(V){const x=ee(V),S=K(R,x)||K(v,x)||K(k?.portalNode,x);fe.current=!S,J.current=V.pointerType||"keyboard"}function D(){J.current="keyboard"}return m.addEventListener("pointerdown",I,!0),m.addEventListener("pointerup",T,!0),m.addEventListener("pointercancel",T,!0),m.addEventListener("keydown",D,!0),()=>{m.removeEventListener("pointerdown",I,!0),m.removeEventListener("pointerup",T,!0),m.removeEventListener("pointercancel",T,!0),m.removeEventListener("keydown",D,!0)}},[o,R,v,c,O,k]),d.useEffect(()=>{if(o||!l)return;function m(){oe.current=!0,ue.start(0,()=>{oe.current=!1})}function T(x){const S=x.relatedTarget,z=x.currentTarget,U=ee(x);queueMicrotask(()=>{const be=M(),Me=C.context.triggerElements,Ue=S?.hasAttribute(it("focus-guard"))&&[Te.current,ce.current,k?.beforeInsideRef.current,k?.afterInsideRef.current,k?.beforeOutsideRef.current,k?.afterOutsideRef.current,se(g),se(p)].includes(S),qe=!(K(v,S)||K(R,S)||K(S,R)||K(k?.portalNode,S)||S!=null&&Me.hasElement(S)||Me.hasMatchingElement(X=>K(X,S))||Ue||G&&(ye(G.nodesRef.current,be).find(X=>K(X.context?.elements.floating,S)||K(X.context?.elements.domReference,S))||St(G.nodesRef.current,be).find(X=>[X.context?.elements.floating,st(X.context?.elements.floating)].includes(S)||X.context?.elements.domReference===S)));if(z===v&&c&&xt(c,W),a&&z!==v&&!zn(U)&&we(Q(c))===Q(c).body){if(Ee(c)&&(c.focus(),a==="popup")){me.request(()=>{c.focus()});return}const X=ke.current,xe=w(),Pe=xe[X]||xe[xe.length-1]||c;Ee(Pe)&&Pe.focus()}if(F.current.insideReactTree){F.current.insideReactTree=!1;return}(j||!i)&&S&&qe&&!oe.current&&(j||S!==Qe())&&(Y.current=!0,C.setOpen(!1,de(Rn,x)))})}function I(){fe.current||(F.current.insideReactTree=!0,ge.start(0,()=>{F.current.insideReactTree=!1}))}const D=Ee(v)?v:null,V=[];if(!(!R&&!D))return D&&(D.addEventListener("focusout",T),D.addEventListener("pointerdown",m),V.push(()=>{D.removeEventListener("focusout",T),D.removeEventListener("pointerdown",m)})),R&&(R.addEventListener("focusout",T),k&&(R.addEventListener("focusout",I,!0),V.push(()=>{R.removeEventListener("focusout",I,!0)})),V.push(()=>{R.removeEventListener("focusout",T)})),()=>{V.forEach(x=>{x()})}},[o,v,R,c,i,G,k,C,l,a,w,j,M,W,F,ge,ue,me,p,g]),d.useEffect(()=>{if(o||!R||!O)return;const m=Array.from(k?.portalNode?.querySelectorAll(`[${it("portal")}]`)||[]),I=(G?St(G.nodesRef.current,M()):[]).find(x=>mt(x.context?.elements.domReference||null))?.context?.elements.domReference,D=[R,I,...m,...B(),re.current,He.current,Te.current,ce.current,k?.beforeOutsideRef.current,k?.afterOutsideRef.current,se(g),se(p),j?v:null].filter(x=>x!=null),V=Hn(D,i||j);return()=>{V()}},[O,o,v,R,i,W,k,j,G,M,B,p,g]),$(()=>{if(!O||o||!Ee(c))return;const m=Q(c),T=we(m);queueMicrotask(()=>{const I=E(c),D=_.current,V=typeof D=="function"?D(Re.current||""):D;if(V===void 0||V===!1)return;let x;V===!0||V===null?x=I[0]||c:x=se(V),x=x||I[0]||c,!K(c,T)&&Je(x,{preventScroll:x===c})})},[o,O,c,L,E,_,Re]),$(()=>{if(o||!c)return;const m=Q(c),T=we(m);Un(T);function I(x){if(x.open||(pe.current=Gn(x.nativeEvent,J.current)),x.reason===yn&&x.nativeEvent.type==="mouseleave"&&(Y.current=!0),x.reason===jt)if(x.nested)Y.current=!1;else if(Vn(x.nativeEvent)||jn(x.nativeEvent))Y.current=!1;else{let S=!1;document.createElement("div").focus({get preventScroll(){return S=!0,!1}}),S?Y.current=!1:Y.current=!0}}N.on("openchange",I);const D=m.createElement("span");D.setAttribute("tabindex","-1"),D.setAttribute("aria-hidden","true"),Object.assign(D.style,En),he&&v&&v.insertAdjacentElement("afterend",D);function V(){const x=q.current;let S=typeof x=="function"?x(pe.current):x;if(S===void 0||S===!1)return null;if(S===null&&(S=!0),typeof S=="boolean"){const U=v||Qe();return U&&U.isConnected?U:D}const z=v||Qe()||D;return se(S)||z}return()=>{N.off("openchange",I);const x=we(m),S=K(R,x)||G&&ye(G.nodesRef.current,M(),!1).some(U=>K(U.context?.elements.floating,x)),z=V();queueMicrotask(()=>{const U=qn(z),be=typeof q.current!="boolean";q.current&&!Y.current&&Ee(U)&&(!(!be&&U!==x&&x!==m.body)||S)&&U.focus({preventScroll:!0}),D.remove()})}},[o,R,c,q,F,N,G,he,v,M]),d.useEffect(()=>{queueMicrotask(()=>{Y.current=!1})},[o]),d.useEffect(()=>{if(o||!O)return;function m(I){ee(I)?.closest(`[${Tn}]`)&&(oe.current=!0)}const T=Q(c);return T.addEventListener("pointerdown",m,!0),()=>{T.removeEventListener("pointerdown",m,!0)}},[o,O,c]),$(()=>{if(!o&&k)return k.setFocusManagerState({modal:i,closeOnFocusOut:l,open:O,onOpenChange:C.setOpen,domReference:v}),()=>{k.setFocusManagerState(null)}},[o,k,i,O,C,l,v]),$(()=>{if(!(o||!c))return xt(c,W),()=>{queueMicrotask(pt)}},[o,c,W]);const H=!o&&(i?!j:!0)&&(he||i);return ne.jsxs(d.Fragment,{children:[H&&ne.jsx(bt,{"data-type":"inside",ref:Ge,onFocus:m=>{if(i){const T=E();Je(T[T.length-1])}else k?.portalNode&&(Y.current=!1,Et(m,k.portalNode)?vn(v)?.focus():se(g??k.beforeOutsideRef)?.focus())}}),n,H&&ne.jsx(bt,{"data-type":"inside",ref:Ce,onFocus:m=>{i?Je(E()[0]):k?.portalNode&&(l&&(Y.current=!0),Et(m,k.portalNode)?Sn(v)?.focus():se(p??k.afterOutsideRef)?.focus())}})]})}const Jn={intentional:"onClick",sloppy:"onPointerDown"};function Zn(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function Qn(e,t={}){const n="rootStore"in e?e.rootStore:e,o=n.useState("open"),r=n.useState("floatingElement"),s=n.useState("referenceElement"),u=n.useState("domReferenceElement"),{onOpenChange:a,dataRef:i}=n.context,{enabled:l=!0,escapeKey:b=!0,outsidePress:f=!0,outsidePressEvent:p="sloppy",referencePress:g=!1,referencePressEvent:h="sloppy",ancestorScroll:y=!1,bubbles:C,externalTree:O}=t,v=ft(O),R=A(typeof f=="function"?f:()=>!1),N=typeof f=="function"?R:f,F=d.useRef(!1),{escapeKey:M,outsidePress:B}=Zn(C),L=d.useRef(null),j=Ve(),W=Ve(),_=A(()=>{W.clear(),i.current.insideReactTree=!1}),q=d.useRef(!1),Re=d.useRef(""),G=A(c=>{Re.current=c.pointerType}),k=A(()=>{const c=Re.current,w=c==="pen"||!c?"mouse":c,E=typeof p=="function"?p():p;return typeof E=="string"?E:E[w]}),re=A(c=>{if(!o||!l||!b||c.key!=="Escape"||q.current)return;const w=i.current.floatingContext?.nodeId,E=v?ye(v.nodesRef.current,w):[];if(!M&&E.length>0){let T=!0;if(E.forEach(I=>{I.context?.open&&!I.context.dataRef.current.__escapeKeyBubbles&&(T=!1)}),!T)return}const H=Wn(c)?c.nativeEvent:c,m=de(On,H);n.setOpen(!1,m),!M&&!m.isPropagationAllowed&&c.stopPropagation()}),He=A(c=>{const w=k();return w==="intentional"&&c.type!=="click"||w==="sloppy"&&c.type==="click"}),Y=A(()=>{i.current.insideReactTree=!0,W.start(0,_)}),oe=A((c,w=!1)=>{if(He(c)){_();return}if(i.current.insideReactTree){_();return}if(k()==="intentional"&&w||typeof N=="function"&&!N(c))return;const E=ee(c),H=`[${it("inert")}]`,m=Q(n.select("floatingElement")).querySelectorAll(H),T=n.context.triggerElements;if(E&&(T.hasElement(E)||T.hasMatchingElement(S=>K(S,E))))return;let I=ae(E)?E:null;for(;I&&!ze(I);){const S=xn(I);if(ze(S)||!ae(S))break;I=S}if(m.length&&ae(E)&&!wn(E)&&!K(E,n.select("floatingElement"))&&Array.from(m).every(S=>!K(I,S)))return;if(Ee(E)&&!("touches"in c)){const S=ze(E),z=_t(E),U=/auto|scroll/,be=S||U.test(z.overflowX),Me=S||U.test(z.overflowY),Ue=be&&E.clientWidth>0&&E.scrollWidth>E.clientWidth,qe=Me&&E.clientHeight>0&&E.scrollHeight>E.clientHeight,X=z.direction==="rtl",xe=qe&&(X?c.offsetX<=E.offsetWidth-E.clientWidth:c.offsetX>E.clientWidth),Pe=Ue&&c.offsetY>E.clientHeight;if(xe||Pe)return}const D=i.current.floatingContext?.nodeId,V=v&&ye(v.nodesRef.current,D).some(S=>Z(c,S.context?.elements.floating));if(Z(c,n.select("floatingElement"))||Z(c,n.select("domReferenceElement"))||V)return;const x=v?ye(v.nodesRef.current,D):[];if(x.length>0){let S=!0;if(x.forEach(z=>{z.context?.open&&!z.context.dataRef.current.__outsidePressBubbles&&(S=!1)}),!S)return}n.setOpen(!1,de(jt,c)),_()}),fe=A(c=>{k()!=="sloppy"||c.pointerType==="touch"||!n.select("open")||!l||Z(c,n.select("floatingElement"))||Z(c,n.select("domReferenceElement"))||oe(c)}),ke=A(c=>{if(k()!=="sloppy"||!n.select("open")||!l||Z(c,n.select("floatingElement"))||Z(c,n.select("domReferenceElement")))return;const w=c.touches[0];w&&(L.current={startTime:Date.now(),startX:w.clientX,startY:w.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},j.start(1e3,()=>{L.current&&(L.current.dismissOnTouchEnd=!1,L.current.dismissOnMouseDown=!1)}))}),pe=A(c=>{const w=ee(c);function E(){ke(c),w?.removeEventListener(c.type,E)}w?.addEventListener(c.type,E)}),J=A(c=>{const w=F.current;if(F.current=!1,j.clear(),c.type==="mousedown"&&L.current&&!L.current.dismissOnMouseDown)return;const E=ee(c);function H(){c.type==="pointerdown"?fe(c):oe(c,w),E?.removeEventListener(c.type,H)}E?.addEventListener(c.type,H)}),Te=A(c=>{if(k()!=="sloppy"||!L.current||Z(c,n.select("floatingElement"))||Z(c,n.select("domReferenceElement")))return;const w=c.touches[0];if(!w)return;const E=Math.abs(w.clientX-L.current.startX),H=Math.abs(w.clientY-L.current.startY),m=Math.sqrt(E*E+H*H);m>5&&(L.current.dismissOnTouchEnd=!0),m>10&&(oe(c),j.clear(),L.current=null)}),ce=A(c=>{const w=ee(c);function E(){Te(c),w?.removeEventListener(c.type,E)}w?.addEventListener(c.type,E)}),Ge=A(c=>{k()!=="sloppy"||!L.current||Z(c,n.select("floatingElement"))||Z(c,n.select("domReferenceElement"))||(L.current.dismissOnTouchEnd&&oe(c),j.clear(),L.current=null)}),Ce=A(c=>{const w=ee(c);function E(){Ge(c),w?.removeEventListener(c.type,E)}w?.addEventListener(c.type,E)});d.useEffect(()=>{if(!o||!l)return;i.current.__escapeKeyBubbles=M,i.current.__outsidePressBubbles=B;const c=new ct;function w(I){n.setOpen(!1,de(kn,I))}function E(){c.clear(),q.current=!0}function H(){c.start(In()?5:0,()=>{q.current=!1})}const m=Q(r);m.addEventListener("pointerdown",G,!0),b&&(m.addEventListener("keydown",re),m.addEventListener("compositionstart",E),m.addEventListener("compositionend",H)),N&&(m.addEventListener("click",J,!0),m.addEventListener("pointerdown",J,!0),m.addEventListener("touchstart",pe,!0),m.addEventListener("touchmove",ce,!0),m.addEventListener("touchend",Ce,!0),m.addEventListener("mousedown",J,!0));let T=[];return y&&(ae(u)&&(T=Xe(u)),ae(r)&&(T=T.concat(Xe(r))),!ae(s)&&s&&s.contextElement&&(T=T.concat(Xe(s.contextElement)))),T=T.filter(I=>I!==m.defaultView?.visualViewport),T.forEach(I=>{I.addEventListener("scroll",w,{passive:!0})}),()=>{m.removeEventListener("pointerdown",G,!0),b&&(m.removeEventListener("keydown",re),m.removeEventListener("compositionstart",E),m.removeEventListener("compositionend",H)),N&&(m.removeEventListener("click",J,!0),m.removeEventListener("pointerdown",J,!0),m.removeEventListener("touchstart",pe,!0),m.removeEventListener("touchmove",ce,!0),m.removeEventListener("touchend",Ce,!0),m.removeEventListener("mousedown",J,!0)),T.forEach(I=>{I.removeEventListener("scroll",w)}),c.clear(),F.current=!1}},[i,r,s,u,b,N,o,a,y,l,M,B,re,oe,J,fe,pe,ce,Ce,G,n]),d.useEffect(_,[N,_]);const ge=d.useMemo(()=>({onKeyDown:re,...g&&{[Jn[h]]:c=>{n.setOpen(!1,de(yt,c.nativeEvent))},...h!=="intentional"&&{onClick(c){n.setOpen(!1,de(yt,c.nativeEvent))}}}}),[re,n,g,h]),ue=A(c=>{const w=ee(c.nativeEvent);!K(n.select("floatingElement"),w)||c.button!==0||(F.current=!0)}),me=A(c=>{!o||!l||c.button!==0||(F.current=!0)}),he=d.useMemo(()=>({onKeyDown:re,onPointerDown:ue,onMouseDown:ue,onMouseUp:ue,onClickCapture:Y,onMouseDownCapture(c){Y(),me(c)},onPointerDownCapture(c){Y(),me(c)},onMouseUpCapture:Y,onTouchEndCapture:Y,onTouchMoveCapture:Y}),[re,ue,Y,me]);return d.useMemo(()=>l?{reference:ge,floating:he,trigger:ge}:{},[l,ge,he])}var je=Symbol("NOT_FOUND");function eo(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function to(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function no(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(n=>typeof n=="function")){const n=e.map(o=>typeof o=="function"?`function ${o.name||"unnamed"}()`:typeof o).join(", ");throw new TypeError(`${t}[${n}]`)}}var wt=e=>Array.isArray(e)?e:[e];function oo(e){const t=Array.isArray(e[0])?e[0]:e;return no(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function ro(e,t){const n=[],{length:o}=e;for(let r=0;r<o;r++)n.push(e[r].apply(null,t));return n}function so(e){let t;return{get(n){return t&&e(t.key,n)?t.value:je},put(n,o){t={key:n,value:o}},getEntries(){return t?[t]:[]},clear(){t=void 0}}}function io(e,t){let n=[];function o(a){const i=n.findIndex(l=>t(a,l.key));if(i>-1){const l=n[i];return i>0&&(n.splice(i,1),n.unshift(l)),l.value}return je}function r(a,i){o(a)===je&&(n.unshift({key:a,value:i}),n.length>e&&n.pop())}function s(){return n}function u(){n=[]}return{get:o,put:r,getEntries:s,clear:u}}var co=(e,t)=>e===t;function uo(e){return function(n,o){if(n===null||o===null||n.length!==o.length)return!1;const{length:r}=n;for(let s=0;s<r;s++)if(!e(n[s],o[s]))return!1;return!0}}function ao(e,t){const n=typeof t=="object"?t:{equalityCheck:t},{equalityCheck:o=co,maxSize:r=1,resultEqualityCheck:s}=n,u=uo(o);let a=0;const i=r<=1?so(u):io(r,u);function l(){let b=i.get(arguments);if(b===je){if(b=e.apply(null,arguments),a++,s){const p=i.getEntries().find(g=>s(g.value,b));p&&(b=p.value,a!==0&&a--)}i.put(arguments,b)}return b}return l.clearCache=()=>{i.clear(),l.resetResultsCount()},l.resultsCount=()=>a,l.resetResultsCount=()=>{a=0},l}var lo=class{constructor(e){this.value=e}deref(){return this.value}},fo=typeof WeakRef<"u"?WeakRef:lo,po=0,Ot=1;function Ne(){return{s:po,v:void 0,o:null,p:null}}function Qt(e,t={}){let n=Ne();const{resultEqualityCheck:o}=t;let r,s=0;function u(){let a=n;const{length:i}=arguments;for(let f=0,p=i;f<p;f++){const g=arguments[f];if(typeof g=="function"||typeof g=="object"&&g!==null){let h=a.o;h===null&&(a.o=h=new WeakMap);const y=h.get(g);y===void 0?(a=Ne(),h.set(g,a)):a=y}else{let h=a.p;h===null&&(a.p=h=new Map);const y=h.get(g);y===void 0?(a=Ne(),h.set(g,a)):a=y}}const l=a;let b;if(a.s===Ot)b=a.v;else if(b=e.apply(null,arguments),s++,o){const f=r?.deref?.()??r;f!=null&&o(f,b)&&(b=f,s!==0&&s--),r=typeof b=="object"&&b!==null||typeof b=="function"?new fo(b):b}return l.s=Ot,l.v=b,b}return u.clearCache=()=>{n=Ne(),u.resetResultsCount()},u.resultsCount=()=>s,u.resetResultsCount=()=>{s=0},u}function en(e,...t){const n=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,o=(...r)=>{let s=0,u=0,a,i={},l=r.pop();typeof l=="object"&&(i=l,l=r.pop()),eo(l,`createSelector expects an output function after the inputs, but received: [${typeof l}]`);const b={...n,...i},{memoize:f,memoizeOptions:p=[],argsMemoize:g=Qt,argsMemoizeOptions:h=[]}=b,y=wt(p),C=wt(h),O=oo(r),v=f(function(){return s++,l.apply(null,arguments)},...y),R=g(function(){u++;const F=ro(O,arguments);return a=v.apply(null,F),a},...C);return Object.assign(R,{resultFunc:l,memoizedResultFunc:v,dependencies:O,dependencyRecomputations:()=>u,resetDependencyRecomputations:()=>{u=0},lastResult:()=>a,recomputations:()=>s,resetRecomputations:()=>{s=0},memoize:f,argsMemoize:g})};return Object.assign(o,{withTypes:()=>o}),o}var go=en(Qt),mo=Object.assign((e,t=go)=>{to(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const n=Object.keys(e),o=n.map(s=>e[s]);return t(o,(...s)=>s.reduce((u,a,i)=>(u[n[i]]=a,u),{}))},{withTypes:()=>mo});en({memoize:ao,memoizeOptions:{maxSize:1,equalityCheck:Object.is}});const P=(e,t,n,o,r,s,...u)=>{if(u.length>0)throw new Error(lt(1));let a;if(e)a=e;else throw new Error("Missing arguments");return a};var et={exports:{}},tt={};var It;function ho(){if(It)return tt;It=1;var e=Kt();function t(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}var n=typeof Object.is=="function"?Object.is:t,o=e.useState,r=e.useEffect,s=e.useLayoutEffect,u=e.useDebugValue;function a(f,p){var g=p(),h=o({inst:{value:g,getSnapshot:p}}),y=h[0].inst,C=h[1];return s(function(){y.value=g,y.getSnapshot=p,i(y)&&C({inst:y})},[f,g,p]),r(function(){return i(y)&&C({inst:y}),f(function(){i(y)&&C({inst:y})})},[f]),u(g),g}function i(f){var p=f.getSnapshot;f=f.value;try{var g=p();return!n(f,g)}catch{return!0}}function l(f,p){return p()}var b=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?l:a;return tt.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:b,tt}var kt;function tn(){return kt||(kt=1,et.exports=ho()),et.exports}var bo=tn(),nt={exports:{}},ot={};var Mt;function Eo(){if(Mt)return ot;Mt=1;var e=Kt(),t=tn();function n(l,b){return l===b&&(l!==0||1/l===1/b)||l!==l&&b!==b}var o=typeof Object.is=="function"?Object.is:n,r=t.useSyncExternalStore,s=e.useRef,u=e.useEffect,a=e.useMemo,i=e.useDebugValue;return ot.useSyncExternalStoreWithSelector=function(l,b,f,p,g){var h=s(null);if(h.current===null){var y={hasValue:!1,value:null};h.current=y}else y=h.current;h=a(function(){function O(M){if(!v){if(v=!0,R=M,M=p(M),g!==void 0&&y.hasValue){var B=y.value;if(g(B,M))return N=B}return N=M}if(B=N,o(R,M))return B;var L=p(M);return g!==void 0&&g(B,L)?(R=M,B):(R=M,N=L)}var v=!1,R,N,F=f===void 0?null:f;return[function(){return O(b())},F===null?void 0:function(){return O(F())}]},[b,f,p,g]);var C=r(l,h[0],h[1]);return u(function(){y.hasValue=!0,y.value=C},[C]),i(C),C},ot}var Pt;function yo(){return Pt||(Pt=1,nt.exports=Eo()),nt.exports}var vo=yo();const So=Mn(19),Ro=So?Co:xo;function To(e,t,n,o,r){return Ro(e,t,n,o,r)}function Co(e,t,n,o,r){const s=d.useCallback(()=>t(e.getSnapshot(),n,o,r),[e,t,n,o,r]);return bo.useSyncExternalStore(e.subscribe,s,s)}function xo(e,t,n,o,r){return vo.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,s=>t(s,n,o,r))}class Oe{constructor(t){this.state=t,this.listeners=new Set,this.updateTick=0}subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t)});getSnapshot=()=>this.state;setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const n=this.updateTick;for(const o of this.listeners){if(n!==this.updateTick)return;o(t)}}update(t){for(const n in t)if(!Object.is(this.state[n],t[n])){Oe.prototype.setState.call(this,{...this.state,...t});return}}set(t,n){Object.is(this.state[t],n)||Oe.prototype.setState.call(this,{...this.state,[t]:n})}notifyAll(){const t={...this.state};Oe.prototype.setState.call(this,t)}}class nn extends Oe{constructor(t,n={},o){super(t),this.context=n,this.selectors=o}controlledValues=new Map;useSyncedValue(t,n){d.useDebugValue(t),$(()=>{this.state[t]!==n&&this.set(t,n)},[t,n])}useSyncedValueWithCleanup(t,n){const o=this;$(()=>(o.state[t]!==n&&o.set(t,n),()=>{o.set(t,void 0)}),[o,t,n])}useSyncedValues(t){const n=this,o=Object.values(t);$(()=>{n.update(t)},[n,...o])}useControlledProp(t,n,o){d.useDebugValue(t);const r=this,s=n!==void 0;this.controlledValues.has(t)||(this.controlledValues.set(t,s),!s&&!Object.is(this.state[t],o)&&super.setState({...this.state,[t]:o})),$(()=>{s&&!Object.is(r.state[t],n)&&super.setState({...r.state,[t]:n})},[r,t,n,o,s])}set(t,n){this.controlledValues.get(t)!==!0&&super.set(t,n)}update(t){const n={...t};for(const o in n)if(Object.hasOwn(n,o)&&this.controlledValues.get(o)===!0){delete n[o];continue}super.update(n)}setState(t){const n={...t};for(const o in n)if(Object.hasOwn(n,o)&&this.controlledValues.get(o)===!0){delete n[o];continue}super.setState({...this.state,...n})}select=(t,n,o,r)=>{const s=this.selectors[t];return s(this.state,n,o,r)};useState=(t,n,o,r)=>{d.useDebugValue(t);const s=this.selectors[t];return To(this,s,n,o,r)};useContextCallback(t,n){d.useDebugValue(t);const o=A(n??Yt);this.context[t]=o}useStateSetter(t){const n=d.useRef(void 0);return n.current===void 0&&(n.current=o=>{this.set(t,o)}),n.current}observe(t,n){let o;typeof t=="function"?o=t:o=this.selectors[t];let r=o(this.state);return n(r,r,this),this.subscribe(s=>{const u=o(s);if(!Object.is(r,u)){const a=r;r=u,n(u,a,this)}})}}const wo={open:P(e=>e.open),domReferenceElement:P(e=>e.domReferenceElement),referenceElement:P(e=>e.positionReference??e.referenceElement),floatingElement:P(e=>e.floatingElement),floatingId:P(e=>e.floatingId)};class on extends nn{constructor(t){const{nested:n,noEmit:o,onOpenChange:r,triggerElements:s,...u}=t;super({...u,positionReference:u.referenceElement,domReferenceElement:u.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:zt(),nested:n,noEmit:o,triggerElements:s},wo)}setOpen=(t,n)=>{if((!t||!this.state.open||Bn(n.event))&&(this.context.dataRef.current.openEvent=t?n.event:void 0),!this.context.noEmit){const o={open:t,reason:n.reason,nativeEvent:n.event,nested:this.context.nested,triggerElement:n.trigger};this.context.events.emit("openchange",o)}this.context.onOpenChange?.(t,n)}}function Oo(e,t=!1,n=!1){const[o,r]=d.useState(e&&t?"idle":void 0),[s,u]=d.useState(e);return e&&!s&&(u(!0),r("starting")),!e&&s&&o!=="ending"&&!n&&r("ending"),!e&&!s&&o==="ending"&&r(void 0),$(()=>{if(!e&&s&&o!=="ending"&&n){const a=le.request(()=>{r("ending")});return()=>{le.cancel(a)}}},[e,s,o,n]),$(()=>{if(!e||t)return;const a=le.request(()=>{r(void 0)});return()=>{le.cancel(a)}},[t,e]),$(()=>{if(!e||!t)return;e&&s&&o!=="idle"&&r("starting");const a=le.request(()=>{r("idle")});return()=>{le.cancel(a)}},[t,e,s,r,o]),d.useMemo(()=>({mounted:s,setMounted:u,transitionStatus:o}),[s,o])}function Io(e,t){const n=d.useRef(null),o=d.useRef(null);return d.useCallback(r=>{if(e!==void 0){if(n.current!==null){const s=n.current,u=o.current,a=t.context.triggerElements.getById(s);u&&a===u&&t.context.triggerElements.delete(s),n.current=null,o.current=null}r!==null&&(n.current=e,o.current=r,t.context.triggerElements.add(e,r))}},[t,e])}function Er(e,t,n,o){const r=n.useState("isMountedByTrigger",e),s=Io(e,n),u=A(a=>{if(s(a),!a||!n.select("open"))return;const i=n.select("activeTriggerId");if(i===e){n.update({activeTriggerElement:a,...o});return}i==null&&n.update({activeTriggerId:e,activeTriggerElement:a,...o})});return $(()=>{r&&n.update({activeTriggerElement:t.current,...o})},[r,n,t,...Object.values(o)]),{registerTrigger:u,isMountedByThisTrigger:r}}function ko(e){const t=e.useState("open");$(()=>{if(t&&!e.select("activeTriggerId")&&e.context.triggerElements.size===1){const n=e.context.triggerElements.entries().next();if(!n.done){const[o,r]=n.value;e.update({activeTriggerId:o,activeTriggerElement:r})}}},[t,e])}function Mo(e,t,n){const{mounted:o,setMounted:r,transitionStatus:s}=Oo(e);t.useSyncedValues({mounted:o,transitionStatus:s});const u=A(()=>{r(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)}),a=t.useState("preventUnmountingOnClose");return $t({enabled:!a,open:e,ref:t.context.popupRef,onComplete(){e||u()}}),{forceUnmount:u,transitionStatus:s}}class rn{constructor(){this.elements=new Set,this.idMap=new Map}add(t,n){const o=this.idMap.get(t);o!==n&&(o!==void 0&&this.elements.delete(o),this.elements.add(n),this.idMap.set(t,n))}delete(t){const n=this.idMap.get(t);n&&(this.elements.delete(n),this.idMap.delete(t))}hasElement(t){return this.elements.has(t)}hasMatchingElement(t){for(const n of this.elements)if(t(n))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}get size(){return this.idMap.size}}function Po(){return new on({open:!1,floatingElement:null,referenceElement:null,triggerElements:new rn,floatingId:"",nested:!1,noEmit:!1,onOpenChange:void 0})}function Fo(){return{open:!1,mounted:!1,transitionStatus:"idle",floatingRootContext:Po(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,popupElement:null,positionerElement:null,activeTriggerProps:We,inactiveTriggerProps:We,popupProps:We}}const Lo={open:P(e=>e.open),mounted:P(e=>e.mounted),transitionStatus:P(e=>e.transitionStatus),floatingRootContext:P(e=>e.floatingRootContext),preventUnmountingOnClose:P(e=>e.preventUnmountingOnClose),payload:P(e=>e.payload),activeTriggerId:P(e=>e.activeTriggerId),activeTriggerElement:P(e=>e.mounted?e.activeTriggerElement:null),isTriggerActive:P((e,t)=>t!==void 0&&e.activeTriggerId===t),isOpenedByTrigger:P((e,t)=>t!==void 0&&e.activeTriggerId===t&&e.open),isMountedByTrigger:P((e,t)=>t!==void 0&&e.activeTriggerId===t&&e.mounted),triggerProps:P((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),popupProps:P(e=>e.popupProps),popupElement:P(e=>e.popupElement),positionerElement:P(e=>e.positionerElement)};function Do(e){const{popupStore:t,noEmit:n=!1,treatPopupAsFloatingElement:o=!1,onOpenChange:r}=e,s=_e(),u=$e()!=null,a=t.useState("open"),i=t.useState("activeTriggerElement"),l=t.useState(o?"popupElement":"positionerElement"),b=t.context.triggerElements,f=Be(()=>new on({open:a,referenceElement:i,floatingElement:l,triggerElements:b,onOpenChange:r,floatingId:s,nested:u,noEmit:n})).current;return $(()=>{const p={open:a,floatingId:s,referenceElement:i,floatingElement:l};ae(i)&&(p.domReferenceElement=i),f.state.positionReference===f.state.referenceElement&&(p.positionReference=i),f.update(p)},[a,s,i,l,f]),f.context.onOpenChange=r,f.context.nested=u,f.context.noEmit=n,f}function No(e=[]){const t=e.map(l=>l?.reference),n=e.map(l=>l?.floating),o=e.map(l=>l?.item),r=e.map(l=>l?.trigger),s=d.useCallback(l=>Ae(l,e,"reference"),t),u=d.useCallback(l=>Ae(l,e,"floating"),n),a=d.useCallback(l=>Ae(l,e,"item"),o),i=d.useCallback(l=>Ae(l,e,"trigger"),r);return d.useMemo(()=>({getReferenceProps:s,getFloatingProps:u,getItemProps:a,getTriggerProps:i}),[s,u,a,i])}function Ae(e,t,n){const o=new Map,r=n==="item",s={};n==="floating"&&(s.tabIndex=-1,s[Pn]="");for(const u in e)r&&e&&(u===Ht||u===Gt)||(s[u]=e[u]);for(let u=0;u<t.length;u+=1){let a;const i=t[u]?.[n];typeof i=="function"?a=e?i(e):null:a=i,a&&Ft(s,a,r,o)}return Ft(s,e,r,o),s}function Ft(e,t,n,o){for(const r in t){const s=t[r];n&&(r===Ht||r===Gt)||(r.startsWith("on")?(o.has(r)||o.set(r,[]),typeof s=="function"&&(o.get(r)?.push(s),e[r]=(...u)=>o.get(r)?.map(a=>a(...u)).find(a=>a!==void 0))):e[r]=s)}}const Ao=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function Wo(e,t={}){const n="rootStore"in e?e.rootStore:e,o=n.useState("open"),r=n.useState("floatingId"),s=n.useState("domReferenceElement"),u=n.useState("floatingElement"),{enabled:a=!0,role:i="dialog"}=t,l=_e(),b=s?.id||l,f=d.useMemo(()=>st(u)?.id||r,[u,r]),p=Ao.get(i)??i,h=$e()!=null,y=d.useMemo(()=>p==="tooltip"||i==="label"?We:{"aria-haspopup":p==="alertdialog"?"dialog":p,"aria-expanded":"false",...p==="listbox"&&{role:"combobox"},...p==="menu"&&h&&{role:"menuitem"},...i==="select"&&{"aria-autocomplete":"none"},...i==="combobox"&&{"aria-autocomplete":"list"}},[p,h,i]),C=d.useMemo(()=>p==="tooltip"||i==="label"?{[`aria-${i==="label"?"labelledby":"describedby"}`]:o?f:void 0}:{...y,"aria-expanded":o?"true":"false","aria-controls":o?f:void 0,...p==="menu"&&{id:b}},[p,f,o,b,i,y]),O=d.useMemo(()=>{const R={id:f,...p&&{role:p}};return p==="tooltip"||i==="label"?R:{...R,...p==="menu"&&{"aria-labelledby":b}}},[p,f,b,i]),v=d.useCallback(({active:R,selected:N})=>{const F={role:"option",...R&&{id:`${f}-fui-option`}};switch(i){case"select":case"combobox":return{...F,"aria-selected":N}}return{}},[f,i]);return d.useMemo(()=>a?{reference:C,floating:O,item:v,trigger:y}:{},[a,C,O,y,v])}let te=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=vt.startingStyle]="startingStyle",e[e.endingStyle=vt.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e})({}),ut=(function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e})({});const Vo={[ut.popupOpen]:""},jo={[ut.popupOpen]:"",[ut.pressed]:""},Bo={[te.open]:""},_o={[te.closed]:""},Ko={[te.anchorHidden]:""},yr={open(e){return e?Vo:null}},vr={open(e){return e?jo:null}},gt={open(e){return e?Bo:_o},anchorHidden(e){return e?Ko:null}};function Yo(e){return _e(e,"base-ui")}function $o(e){const t=d.useRef(""),n=d.useCallback(r=>{r.defaultPrevented||(t.current=r.pointerType,e(r,r.pointerType))},[e]);return{onClick:d.useCallback(r=>{if(r.detail===0){e(r,"keyboard");return}"pointerType"in r&&e(r,r.pointerType),e(r,t.current),t.current=""},[e]),onPointerDown:n}}function Ho(e){const[t,n]=d.useState(null),o=A((a,i)=>{e||n(i||(Ut?"touch":""))}),r=d.useCallback(()=>{n(null)},[]),{onClick:s,onPointerDown:u}=$o(o);return d.useMemo(()=>({openMethod:t,reset:r,triggerProps:{onClick:s,onPointerDown:u}}),[t,r,s,u])}let Lt={},Dt={},Nt="";function Go(e){if(typeof document>"u")return!1;const t=Ie(e);return Ke(t).innerWidth-t.documentElement.clientWidth>0}function Uo(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const o=Ie(e).documentElement,r={scrollbarGutter:o.style.scrollbarGutter,overflowY:o.style.overflowY};o.style.scrollbarGutter="stable",o.style.overflowY="scroll";const s=o.offsetWidth;o.style.overflowY="hidden";const u=o.offsetWidth;return Object.assign(o.style,r),s===u}function qo(e){const t=Ie(e),n=t.documentElement,o=t.body,r=qt(n)?n:o,s=r.style.overflow;return r.style.overflow="hidden",()=>{r.style.overflow=s}}function zo(e){const t=Ie(e),n=t.documentElement,o=t.body,r=Ke(n);let s=0,u=0,a=!1;const i=le.create();if(Fn&&(r.visualViewport?.scale??1)!==1)return()=>{};function l(){const p=r.getComputedStyle(n),g=r.getComputedStyle(o),C=(p.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";s=n.scrollTop,u=n.scrollLeft,Lt={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},Nt=n.style.scrollBehavior,Dt={position:o.style.position,height:o.style.height,width:o.style.width,boxSizing:o.style.boxSizing,overflowY:o.style.overflowY,overflowX:o.style.overflowX,scrollBehavior:o.style.scrollBehavior};const O=n.scrollHeight>n.clientHeight,v=n.scrollWidth>n.clientWidth,R=p.overflowY==="scroll"||g.overflowY==="scroll",N=p.overflowX==="scroll"||g.overflowX==="scroll",F=Math.max(0,r.innerWidth-o.clientWidth),M=Math.max(0,r.innerHeight-o.clientHeight),B=parseFloat(g.marginTop)+parseFloat(g.marginBottom),L=parseFloat(g.marginLeft)+parseFloat(g.marginRight),j=qt(n)?n:o;if(a=Uo(e),a){n.style.scrollbarGutter=C,j.style.overflowY="hidden",j.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:C,overflowY:"hidden",overflowX:"hidden"}),(O||R)&&(n.style.overflowY="scroll"),(v||N)&&(n.style.overflowX="scroll"),Object.assign(o.style,{position:"relative",height:B||M?`calc(100dvh - ${B+M}px)`:"100dvh",width:L||F?`calc(100vw - ${L+F}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),o.scrollTop=s,o.scrollLeft=u,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function b(){Object.assign(n.style,Lt),Object.assign(o.style,Dt),a||(n.scrollTop=s,n.scrollLeft=u,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=Nt)}function f(){b(),i.request(l)}return l(),r.addEventListener("resize",f),()=>{i.cancel(),b(),typeof r.removeEventListener=="function"&&r.removeEventListener("resize",f)}}class Xo{lockCount=0;restore=null;timeoutLock=ct.create();timeoutUnlock=ct.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 o=Ie(t).documentElement,r=Ke(o).getComputedStyle(o).overflowY;if(r==="hidden"||r==="clip"){this.restore=Yt;return}const s=Ut||!Go(t);this.restore=s?qo(t):zo(t)}}const Jo=new Xo;function Zo(e=!0,t=null){$(()=>{if(e)return Jo.acquire(t)},[e,t])}const Qo=d.forwardRef(function(t,n){const{cutout:o,...r}=t;let s;if(o){const u=o?.getBoundingClientRect();s=`polygon(
|
|
2
|
-
0% 0%,
|
|
3
|
-
100% 0%,
|
|
4
|
-
100% 100%,
|
|
5
|
-
0% 100%,
|
|
6
|
-
0% 0%,
|
|
7
|
-
${u.left}px ${u.top}px,
|
|
8
|
-
${u.left}px ${u.bottom}px,
|
|
9
|
-
${u.right}px ${u.bottom}px,
|
|
10
|
-
${u.right}px ${u.top}px,
|
|
11
|
-
${u.left}px ${u.top}px
|
|
12
|
-
)`}return ne.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...r,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:s}})}),sn="ArrowUp",cn="ArrowDown",un="ArrowLeft",an="ArrowRight",ln="Home",dn="End",er=new Set([un,an]),tr=new Set([sn,cn]),nr=new Set([...er,...tr]);[...nr];const or=new Set([sn,cn,un,an,ln,dn]),fn=d.createContext(void 0);function Se(e){const t=d.useContext(fn);if(e===!1&&t===void 0)throw new Error(lt(27));return t}const rr={...gt,...dt},Sr=d.forwardRef(function(t,n){const{render:o,className:r,forceRender:s=!1,...u}=t,{store:a}=Se(),i=a.useState("open"),l=a.useState("nested"),b=a.useState("mounted"),f=a.useState("transitionStatus"),p=d.useMemo(()=>({open:i,transitionStatus:f}),[i,f]);return Ye("div",t,{state:p,ref:[a.context.backdropRef,n],stateAttributesMapping:rr,props:[{role:"presentation",hidden:!b,style:{userSelect:"none",WebkitUserSelect:"none"}},u],enabled:s||!l})});let sr=(function(e){return e.nestedDialogs="--nested-dialogs",e})({}),ir=(function(e){return e[e.open=te.open]="open",e[e.closed=te.closed]="closed",e[e.startingStyle=te.startingStyle]="startingStyle",e[e.endingStyle=te.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const pn=d.createContext(void 0);function gn(){const e=d.useContext(pn);if(e===void 0)throw new Error(lt(26));return e}const cr={...gt,...dt,nestedDialogOpen(e){return e?{[ir.nestedDialogOpen]:""}:null}},Rr=d.forwardRef(function(t,n){const{className:o,finalFocus:r,initialFocus:s,render:u,...a}=t,{store:i}=Se(),l=i.useState("descriptionElementId"),b=i.useState("disablePointerDismissal"),f=i.useState("floatingRootContext"),p=i.useState("popupProps"),g=i.useState("modal"),h=i.useState("mounted"),y=i.useState("nested"),C=i.useState("nestedOpenDialogCount"),O=i.useState("open"),v=i.useState("openMethod"),R=i.useState("titleElementId"),N=i.useState("transitionStatus"),F=i.useState("role");gn(),$t({open:O,ref:i.context.popupRef,onComplete(){O&&i.context.onOpenChangeComplete?.(!0)}});function M(_){return _==="touch"?i.context.popupRef.current:!0}const B=s===void 0?M:s,L=C>0,j=d.useMemo(()=>({open:O,nested:y,transitionStatus:N,nestedDialogOpen:L}),[O,y,N,L]),W=Ye("div",t,{state:j,props:[p,{"aria-labelledby":R??void 0,"aria-describedby":l??void 0,role:F,tabIndex:-1,hidden:!h,onKeyDown(_){or.has(_.key)&&_.stopPropagation()},style:{[sr.nestedDialogs]:C}},a],ref:[n,i.context.popupRef,i.useStateSetter("popupElement")],stateAttributesMapping:cr});return ne.jsx(Xn,{context:f,openInteractionType:v,disabled:!h,closeOnFocusOut:!b,initialFocus:B,returnFocus:r,modal:g!==!1,restoreFocus:"popup",children:W})}),Tr=d.forwardRef(function(t,n){const{keepMounted:o=!1,...r}=t,{store:s}=Se(),u=s.useState("mounted"),a=s.useState("modal"),i=s.useState("open");return u||o?ne.jsx(pn.Provider,{value:o,children:ne.jsxs(Ln,{ref:n,...r,children:[u&&a===!0&&ne.jsx(Qo,{ref:s.context.internalBackdropRef,inert:Dn(!i)}),t.children]})}):null});function ur(e){const{store:t,parentContext:n,actionsRef:o}=e,r=t.useState("open"),s=t.useState("disablePointerDismissal"),u=t.useState("modal"),a=t.useState("popupElement"),{openMethod:i,triggerProps:l,reset:b}=Ho(r);ko(t);const{forceUnmount:f}=Mo(r,t,()=>{b()}),p=A(W=>{const _=de(W);return _.preventUnmountOnClose=()=>{t.set("preventUnmountingOnClose",!0)},_}),g=d.useCallback(()=>{t.setOpen(!1,p(Nn))},[t,p]);d.useImperativeHandle(o,()=>({unmount:f,close:g}),[f,g]);const h=Do({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[y,C]=d.useState(0),O=y===0,v=Wo(h),R=Qn(h,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?"intentional":{mouse:u==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(W){if("button"in W&&W.button!==0||"touches"in W&&W.touches.length!==1)return!1;const _=ee(W);if(O&&!s){const q=_;return u&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===q||t.context.backdropRef.current===q||K(q,a)&&!q?.hasAttribute("data-base-ui-portal"):!0}return!1},escapeKey:O});Zo(r&&u===!0,a);const{getReferenceProps:N,getFloatingProps:F,getTriggerProps:M}=No([v,R]);t.useContextCallback("onNestedDialogOpen",W=>{C(W+1)}),t.useContextCallback("onNestedDialogClose",()=>{C(0)}),d.useEffect(()=>(n?.onNestedDialogOpen&&r&&n.onNestedDialogOpen(y),n?.onNestedDialogClose&&!r&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&r&&n.onNestedDialogClose()}),[r,n,y]);const B=d.useMemo(()=>N(l),[N,l]),L=d.useMemo(()=>M(l),[M,l]),j=d.useMemo(()=>F(),[F]);t.useSyncedValues({openMethod:i,activeTriggerProps:B,inactiveTriggerProps:L,popupProps:j,floatingRootContext:h,nestedOpenDialogCount:y})}const ar={...Lo,modal:P(e=>e.modal),nested:P(e=>e.nested),nestedOpenDialogCount:P(e=>e.nestedOpenDialogCount),disablePointerDismissal:P(e=>e.disablePointerDismissal),openMethod:P(e=>e.openMethod),descriptionElementId:P(e=>e.descriptionElementId),titleElementId:P(e=>e.titleElementId),viewportElement:P(e=>e.viewportElement),role:P(e=>e.role)};class lr extends nn{constructor(t){super(dr(t),{popupRef:d.createRef(),backdropRef:d.createRef(),internalBackdropRef:d.createRef(),triggerElements:new rn,onOpenChange:void 0,onOpenChangeComplete:void 0},ar)}setOpen=(t,n)=>{if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!t&&n.trigger==null&&this.state.activeTriggerId!=null&&(n.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(t,n),n.isCanceled)return;const o={open:t,nativeEvent:n.event,reason:n.reason,nested:this.state.nested};this.state.floatingRootContext.context.events?.emit("openchange",o);const r={open:t},s=n.trigger?.id??null;(s||t)&&(r.activeTriggerId=s,r.activeTriggerElement=n.trigger??null),this.update(r)}}function dr(e={}){return{...Fo(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:"dialog",...e}}function Cr(e){const{children:t,open:n,defaultOpen:o=!1,onOpenChange:r,onOpenChangeComplete:s,disablePointerDismissal:u=!1,modal:a=!0,actionsRef:i,handle:l,triggerId:b,defaultTriggerId:f=null}=e,p=Se(!0),g=!!p,h=Be(()=>l?.store??new lr({open:n??o,activeTriggerId:b!==void 0?b:f,modal:a,disablePointerDismissal:u,nested:g})).current;h.useControlledProp("open",n,o),h.useControlledProp("activeTriggerId",b,f),h.useSyncedValues({disablePointerDismissal:u,nested:g,modal:a}),h.useContextCallback("onOpenChange",r),h.useContextCallback("onOpenChangeComplete",s);const y=h.useState("payload");ur({store:h,actionsRef:i,parentContext:p?.store.context});const C=d.useMemo(()=>({store:h}),[h]);return ne.jsx(fn.Provider,{value:C,children:typeof t=="function"?t({payload:y}):t})}let At=(function(e){return e[e.open=te.open]="open",e[e.closed=te.closed]="closed",e[e.startingStyle=te.startingStyle]="startingStyle",e[e.endingStyle=te.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const fr={...gt,...dt,nested(e){return e?{[At.nested]:""}:null},nestedDialogOpen(e){return e?{[At.nestedDialogOpen]:""}:null}},xr=d.forwardRef(function(t,n){const{className:o,render:r,children:s,...u}=t,a=gn(),{store:i}=Se(),l=i.useState("open"),b=i.useState("nested"),f=i.useState("transitionStatus"),p=i.useState("nestedOpenDialogCount"),g=i.useState("mounted"),h=p>0,y=d.useMemo(()=>({open:l,nested:b,transitionStatus:f,nestedDialogOpen:h}),[l,b,f,h]);return Ye("div",t,{enabled:a||g,state:y,ref:[n,i.useStateSetter("viewportElement")],stateAttributesMapping:fr,props:[{role:"presentation",hidden:!g,children:s},u]})}),wr=d.forwardRef(function(t,n){const{render:o,className:r,id:s,...u}=t,{store:a}=Se(),i=Yo(s);return a.useSyncedValueWithCleanup("titleElementId",i),Ye("h2",t,{ref:n,props:[{id:i},u]})});export{on as A,ye as B,or as C,Cr as D,Lo as E,Xn as F,Fo as G,br as H,Qo as I,ko as J,Mo as K,Do as L,Wo as M,Er as N,mr as O,rn as P,hr as Q,nn as R,Oe as S,Tr as a,Sr as b,xr as c,Rr as d,wr as e,Fe as f,$e as g,ft as h,Je as i,Vn as j,jn as k,Yo as l,P as m,Oo as n,Ho as o,To as p,Qn as q,No as r,An as s,vr as t,Se as u,yr as v,Zo as w,gt as x,gr as y,Bn as z};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/LeaderboardProfileModal-BXUUSlGG.js","assets/main-DdKVCJWa.js","assets/main-Ctn8FyBC.css","assets/useCurrency-D8PqG8hW.js","assets/LeaderboardAvatar-BNpzqU-s.js","assets/ActivityHeatmap-C5lQst9A.js","assets/info-R9MgHQlV.js","assets/arrow-up-right-C6REzMq8.js","assets/check-DF1-jcTm.js","assets/DialogTitle-DD717-IL.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{c as Zr,r as i,R as q,M as rt,u as l,N as T,s as y,aj as Qr,ak as en,O as tn,Q as rn,al as nn,i as on,a as an,am as sn,V as ln,A as cn,P as dn,L as un,D as fn,a5 as wr,B as gn,an as hn,ao as bn,ap as Zt,aq as pn,_ as mn,E as xn}from"./main-DdKVCJWa.js";import{u as vn}from"./useCurrency-D8PqG8hW.js";import{L as Tt}from"./LeaderboardAvatar-BNpzqU-s.js";import{C as yn}from"./chevron-down-p9KAHQhU.js";const wn=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],kn=Zr("arrow-right",wn);function Sn(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return i.useMemo(()=>n=>{t.forEach(o=>o(n))},t)}const kt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ye(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function Yt(e){return"nodeType"in e}function J(e){var t,r;return e?Ye(e)?e:Yt(e)&&(t=(r=e.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function Wt(e){const{Document:t}=J(e);return e instanceof t}function ut(e){return Ye(e)?!1:e instanceof J(e).HTMLElement}function kr(e){return e instanceof J(e).SVGElement}function We(e){return e?Ye(e)?e.document:Yt(e)?Wt(e)?e:ut(e)||kr(e)?e.ownerDocument:document:document:document}const me=kt?i.useLayoutEffect:i.useEffect;function Xt(e){const t=i.useRef(e);return me(()=>{t.current=e}),i.useCallback(function(){for(var r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return t.current==null?void 0:t.current(...n)},[])}function Nn(){const e=i.useRef(null),t=i.useCallback((n,o)=>{e.current=setInterval(n,o)},[]),r=i.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,r]}function it(e,t){t===void 0&&(t=[e]);const r=i.useRef(e);return me(()=>{r.current!==e&&(r.current=e)},t),r}function ft(e,t){const r=i.useRef();return i.useMemo(()=>{const n=e(r.current);return r.current=n,n},[...t])}function mt(e){const t=Xt(e),r=i.useRef(null),n=i.useCallback(o=>{o!==r.current&&t?.(o,r.current),r.current=o},[]);return[r,n]}function Lt(e){const t=i.useRef();return i.useEffect(()=>{t.current=e},[e]),t.current}let Et={};function gt(e,t){return i.useMemo(()=>{if(t)return t;const r=Et[e]==null?0:Et[e]+1;return Et[e]=r,e+"-"+r},[e,t])}function Sr(e){return function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return n.reduce((a,s)=>{const c=Object.entries(s);for(const[d,u]of c){const g=a[d];g!=null&&(a[d]=g+e*u)}return a},{...t})}}const Ke=Sr(1),st=Sr(-1);function Cn(e){return"clientX"in e&&"clientY"in e}function Ht(e){if(!e)return!1;const{KeyboardEvent:t}=J(e.target);return t&&e instanceof t}function Rn(e){if(!e)return!1;const{TouchEvent:t}=J(e.target);return t&&e instanceof t}function Ot(e){if(Rn(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:r}=e.touches[0];return{x:t,y:r}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:r}=e.changedTouches[0];return{x:t,y:r}}}return Cn(e)?{x:e.clientX,y:e.clientY}:null}const lt=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:r}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:r}=e;return"scaleX("+t+") scaleY("+r+")"}},Transform:{toString(e){if(e)return[lt.Translate.toString(e),lt.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:r,easing:n}=e;return t+" "+r+"ms "+n}}}),Qt="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Dn(e){return e.matches(Qt)?e:e.querySelector(Qt)}const jn={display:"none"};function En(e){let{id:t,value:r}=e;return q.createElement("div",{id:t,style:jn},r)}function _n(e){let{id:t,announcement:r,ariaLiveType:n="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 q.createElement("div",{id:t,style:o,role:"status","aria-live":n,"aria-atomic":!0},r)}function An(){const[e,t]=i.useState("");return{announce:i.useCallback(n=>{n!=null&&t(n)},[]),announcement:e}}const Nr=i.createContext(null);function Mn(e){const t=i.useContext(Nr);i.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function In(){const[e]=i.useState(()=>new Set),t=i.useCallback(n=>(e.add(n),()=>e.delete(n)),[e]);return[i.useCallback(n=>{let{type:o,event:a}=n;e.forEach(s=>{var c;return(c=s[o])==null?void 0:c.call(s,a)})},[e]),t]}const Tn={draggable:`
|
|
3
|
-
To pick up a draggable item, press the space bar.
|
|
4
|
-
While dragging, use the arrow keys to move the item.
|
|
5
|
-
Press space again to drop the item in its new position, or press escape to cancel.
|
|
6
|
-
`},Ln={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was moved over droppable area "+r.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:r}=e;return r?"Draggable item "+t.id+" was dropped over droppable area "+r.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function On(e){let{announcements:t=Ln,container:r,hiddenTextDescribedById:n,screenReaderInstructions:o=Tn}=e;const{announce:a,announcement:s}=An(),c=gt("DndLiveRegion"),[d,u]=i.useState(!1);if(i.useEffect(()=>{u(!0)},[]),Mn(i.useMemo(()=>({onDragStart(f){let{active:p}=f;a(t.onDragStart({active:p}))},onDragMove(f){let{active:p,over:h}=f;t.onDragMove&&a(t.onDragMove({active:p,over:h}))},onDragOver(f){let{active:p,over:h}=f;a(t.onDragOver({active:p,over:h}))},onDragEnd(f){let{active:p,over:h}=f;a(t.onDragEnd({active:p,over:h}))},onDragCancel(f){let{active:p,over:h}=f;a(t.onDragCancel({active:p,over:h}))}}),[a,t])),!d)return null;const g=q.createElement(q.Fragment,null,q.createElement(En,{id:n,value:o.draggable}),q.createElement(_n,{id:c,announcement:s}));return r?rt.createPortal(g,r):g}var z;(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"})(z||(z={}));function xt(){}function er(e,t){return i.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Pn(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return i.useMemo(()=>[...t].filter(n=>n!=null),[...t])}const ue=Object.freeze({x:0,y:0});function Cr(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Rr(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return r-n}function zn(e,t){let{data:{value:r}}=e,{data:{value:n}}=t;return n-r}function tr(e){let{left:t,top:r,height:n,width:o}=e;return[{x:t,y:r},{x:t+o,y:r},{x:t,y:r+n},{x:t+o,y:r+n}]}function Dr(e,t){if(!e||e.length===0)return null;const[r]=e;return r[t]}function rr(e,t,r){return t===void 0&&(t=e.left),r===void 0&&(r=e.top),{x:t+e.width*.5,y:r+e.height*.5}}const Bn=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const o=rr(t,t.left,t.top),a=[];for(const s of n){const{id:c}=s,d=r.get(c);if(d){const u=Cr(rr(d),o);a.push({id:c,data:{droppableContainer:s,value:u}})}}return a.sort(Rr)},$n=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const o=tr(t),a=[];for(const s of n){const{id:c}=s,d=r.get(c);if(d){const u=tr(d),g=o.reduce((p,h,w)=>p+Cr(u[w],h),0),f=Number((g/4).toFixed(4));a.push({id:c,data:{droppableContainer:s,value:f}})}}return a.sort(Rr)};function Fn(e,t){const r=Math.max(t.top,e.top),n=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),s=o-n,c=a-r;if(n<o&&r<a){const d=t.width*t.height,u=e.width*e.height,g=s*c,f=g/(d+u-g);return Number(f.toFixed(4))}return 0}const Un=e=>{let{collisionRect:t,droppableRects:r,droppableContainers:n}=e;const o=[];for(const a of n){const{id:s}=a,c=r.get(s);if(c){const d=Fn(c,t);d>0&&o.push({id:s,data:{droppableContainer:a,value:d}})}}return o.sort(zn)};function Kn(e,t,r){return{...e,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function jr(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:ue}function Yn(e){return function(r){for(var n=arguments.length,o=new Array(n>1?n-1:0),a=1;a<n;a++)o[a-1]=arguments[a];return o.reduce((s,c)=>({...s,top:s.top+e*c.y,bottom:s.bottom+e*c.y,left:s.left+e*c.x,right:s.right+e*c.x}),{...r})}}const Wn=Yn(1);function Xn(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 Hn(e,t,r){const n=Xn(t);if(!n)return e;const{scaleX:o,scaleY:a,x:s,y:c}=n,d=e.left-s-(1-o)*parseFloat(r),u=e.top-c-(1-a)*parseFloat(r.slice(r.indexOf(" ")+1)),g=o?e.width/o:e.width,f=a?e.height/a:e.height;return{width:g,height:f,top:u,right:d+g,bottom:u+f,left:d}}const Gn={ignoreTransform:!1};function Xe(e,t){t===void 0&&(t=Gn);let r=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:g}=J(e).getComputedStyle(e);u&&(r=Hn(r,u,g))}const{top:n,left:o,width:a,height:s,bottom:c,right:d}=r;return{top:n,left:o,width:a,height:s,bottom:c,right:d}}function nr(e){return Xe(e,{ignoreTransform:!0})}function Vn(e){const t=e.innerWidth,r=e.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function qn(e,t){return t===void 0&&(t=J(e).getComputedStyle(e)),t.position==="fixed"}function Jn(e,t){t===void 0&&(t=J(e).getComputedStyle(e));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const a=t[o];return typeof a=="string"?r.test(a):!1})}function St(e,t){const r=[];function n(o){if(t!=null&&r.length>=t||!o)return r;if(Wt(o)&&o.scrollingElement!=null&&!r.includes(o.scrollingElement))return r.push(o.scrollingElement),r;if(!ut(o)||kr(o)||r.includes(o))return r;const a=J(e).getComputedStyle(o);return o!==e&&Jn(o,a)&&r.push(o),qn(o,a)?r:n(o.parentNode)}return e?n(e):r}function Er(e){const[t]=St(e,1);return t??null}function _t(e){return!kt||!e?null:Ye(e)?e:Yt(e)?Wt(e)||e===We(e).scrollingElement?window:ut(e)?e:null:null}function _r(e){return Ye(e)?e.scrollX:e.scrollLeft}function Ar(e){return Ye(e)?e.scrollY:e.scrollTop}function Pt(e){return{x:_r(e),y:Ar(e)}}var F;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(F||(F={}));function Mr(e){return!kt||!e?!1:e===document.scrollingElement}function Ir(e){const t={x:0,y:0},r=Mr(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},n={x:e.scrollWidth-r.width,y:e.scrollHeight-r.height},o=e.scrollTop<=t.y,a=e.scrollLeft<=t.x,s=e.scrollTop>=n.y,c=e.scrollLeft>=n.x;return{isTop:o,isLeft:a,isBottom:s,isRight:c,maxScroll:n,minScroll:t}}const Zn={x:.2,y:.2};function Qn(e,t,r,n,o){let{top:a,left:s,right:c,bottom:d}=r;n===void 0&&(n=10),o===void 0&&(o=Zn);const{isTop:u,isBottom:g,isLeft:f,isRight:p}=Ir(e),h={x:0,y:0},w={x:0,y:0},m={height:t.height*o.y,width:t.width*o.x};return!u&&a<=t.top+m.height?(h.y=F.Backward,w.y=n*Math.abs((t.top+m.height-a)/m.height)):!g&&d>=t.bottom-m.height&&(h.y=F.Forward,w.y=n*Math.abs((t.bottom-m.height-d)/m.height)),!p&&c>=t.right-m.width?(h.x=F.Forward,w.x=n*Math.abs((t.right-m.width-c)/m.width)):!f&&s<=t.left+m.width&&(h.x=F.Backward,w.x=n*Math.abs((t.left+m.width-s)/m.width)),{direction:h,speed:w}}function eo(e){if(e===document.scrollingElement){const{innerWidth:a,innerHeight:s}=window;return{top:0,left:0,right:a,bottom:s,width:a,height:s}}const{top:t,left:r,right:n,bottom:o}=e.getBoundingClientRect();return{top:t,left:r,right:n,bottom:o,width:e.clientWidth,height:e.clientHeight}}function Tr(e){return e.reduce((t,r)=>Ke(t,Pt(r)),ue)}function to(e){return e.reduce((t,r)=>t+_r(r),0)}function ro(e){return e.reduce((t,r)=>t+Ar(r),0)}function no(e,t){if(t===void 0&&(t=Xe),!e)return;const{top:r,left:n,bottom:o,right:a}=t(e);Er(e)&&(o<=0||a<=0||r>=window.innerHeight||n>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const oo=[["x",["left","right"],to],["y",["top","bottom"],ro]];class Gt{constructor(t,r){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 n=St(r),o=Tr(n);this.rect={...t},this.width=t.width,this.height=t.height;for(const[a,s,c]of oo)for(const d of s)Object.defineProperty(this,d,{get:()=>{const u=c(n),g=o[a]-u;return this.rect[d]+g},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class nt{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var n;return(n=this.target)==null?void 0:n.removeEventListener(...r)})},this.target=t}add(t,r,n){var o;(o=this.target)==null||o.addEventListener(t,r,n),this.listeners.push([t,r,n])}}function ao(e){const{EventTarget:t}=J(e);return e instanceof t?e:We(e)}function At(e,t){const r=Math.abs(e.x),n=Math.abs(e.y);return typeof t=="number"?Math.sqrt(r**2+n**2)>t:"x"in t&&"y"in t?r>t.x&&n>t.y:"x"in t?r>t.x:"y"in t?n>t.y:!1}var oe;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(oe||(oe={}));function or(e){e.preventDefault()}function io(e){e.stopPropagation()}var j;(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"})(j||(j={}));const Lr={start:[j.Space,j.Enter],cancel:[j.Esc],end:[j.Space,j.Enter,j.Tab]},so=(e,t)=>{let{currentCoordinates:r}=t;switch(e.code){case j.Right:return{...r,x:r.x+25};case j.Left:return{...r,x:r.x-25};case j.Down:return{...r,y:r.y+25};case j.Up:return{...r,y:r.y-25}}};class Vt{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:r}}=t;this.props=t,this.listeners=new nt(We(r)),this.windowListeners=new nt(J(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(oe.Resize,this.handleCancel),this.windowListeners.add(oe.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(oe.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,n=t.node.current;n&&no(n),r(ue)}handleKeyDown(t){if(Ht(t)){const{active:r,context:n,options:o}=this.props,{keyboardCodes:a=Lr,coordinateGetter:s=so,scrollBehavior:c="smooth"}=o,{code:d}=t;if(a.end.includes(d)){this.handleEnd(t);return}if(a.cancel.includes(d)){this.handleCancel(t);return}const{collisionRect:u}=n.current,g=u?{x:u.left,y:u.top}:ue;this.referenceCoordinates||(this.referenceCoordinates=g);const f=s(t,{active:r,context:n.current,currentCoordinates:g});if(f){const p=st(f,g),h={x:0,y:0},{scrollableAncestors:w}=n.current;for(const m of w){const x=t.code,{isTop:k,isRight:S,isLeft:v,isBottom:C,maxScroll:E,minScroll:R}=Ir(m),N=eo(m),D={x:Math.min(x===j.Right?N.right-N.width/2:N.right,Math.max(x===j.Right?N.left:N.left+N.width/2,f.x)),y:Math.min(x===j.Down?N.bottom-N.height/2:N.bottom,Math.max(x===j.Down?N.top:N.top+N.height/2,f.y))},L=x===j.Right&&!S||x===j.Left&&!v,I=x===j.Down&&!C||x===j.Up&&!k;if(L&&D.x!==f.x){const _=m.scrollLeft+p.x,Z=x===j.Right&&_<=E.x||x===j.Left&&_>=R.x;if(Z&&!p.y){m.scrollTo({left:_,behavior:c});return}Z?h.x=m.scrollLeft-_:h.x=x===j.Right?m.scrollLeft-E.x:m.scrollLeft-R.x,h.x&&m.scrollBy({left:-h.x,behavior:c});break}else if(I&&D.y!==f.y){const _=m.scrollTop+p.y,Z=x===j.Down&&_<=E.y||x===j.Up&&_>=R.y;if(Z&&!p.x){m.scrollTo({top:_,behavior:c});return}Z?h.y=m.scrollTop-_:h.y=x===j.Down?m.scrollTop-E.y:m.scrollTop-R.y,h.y&&m.scrollBy({top:-h.y,behavior:c});break}}this.handleMove(t,Ke(st(f,this.referenceCoordinates),h))}}}handleMove(t,r){const{onMove:n}=this.props;t.preventDefault(),n(r)}handleEnd(t){const{onEnd:r}=this.props;t.preventDefault(),this.detach(),r()}handleCancel(t){const{onCancel:r}=this.props;t.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Vt.activators=[{eventName:"onKeyDown",handler:(e,t,r)=>{let{keyboardCodes:n=Lr,onActivation:o}=t,{active:a}=r;const{code:s}=e.nativeEvent;if(n.start.includes(s)){const c=a.activatorNode.current;return c&&e.target!==c?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function ar(e){return!!(e&&"distance"in e)}function ir(e){return!!(e&&"delay"in e)}class qt{constructor(t,r,n){var o;n===void 0&&(n=ao(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=r;const{event:a}=t,{target:s}=a;this.props=t,this.events=r,this.document=We(s),this.documentListeners=new nt(this.document),this.listeners=new nt(n),this.windowListeners=new nt(J(s)),this.initialCoordinates=(o=Ot(a))!=null?o:ue,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:r,bypassActivationConstraint:n}}}=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(oe.Resize,this.handleCancel),this.windowListeners.add(oe.DragStart,or),this.windowListeners.add(oe.VisibilityChange,this.handleCancel),this.windowListeners.add(oe.ContextMenu,or),this.documentListeners.add(oe.Keydown,this.handleKeydown),r){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(ir(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(ar(r)){this.handlePending(r);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,r){const{active:n,onPending:o}=this.props;o(n,t,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:t}=this,{onStart:r}=this.props;t&&(this.activated=!0,this.documentListeners.add(oe.Click,io,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(oe.SelectionChange,this.removeTextSelection),r(t))}handleMove(t){var r;const{activated:n,initialCoordinates:o,props:a}=this,{onMove:s,options:{activationConstraint:c}}=a;if(!o)return;const d=(r=Ot(t))!=null?r:ue,u=st(o,d);if(!n&&c){if(ar(c)){if(c.tolerance!=null&&At(u,c.tolerance))return this.handleCancel();if(At(u,c.distance))return this.handleStart()}if(ir(c)&&At(u,c.tolerance))return this.handleCancel();this.handlePending(c,u);return}t.cancelable&&t.preventDefault(),s(d)}handleEnd(){const{onAbort:t,onEnd:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleCancel(){const{onAbort:t,onCancel:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleKeydown(t){t.code===j.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const lo={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Jt extends qt{constructor(t){const{event:r}=t,n=We(r.target);super(t,lo,n)}}Jt.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return!r.isPrimary||r.button!==0?!1:(n?.({event:r}),!0)}}];const co={move:{name:"mousemove"},end:{name:"mouseup"}};var zt;(function(e){e[e.RightClick=2]="RightClick"})(zt||(zt={}));class uo extends qt{constructor(t){super(t,co,We(t.event.target))}}uo.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;return r.button===zt.RightClick?!1:(n?.({event:r}),!0)}}];const Mt={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class fo extends qt{constructor(t){super(t,Mt)}static setup(){return window.addEventListener(Mt.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Mt.move.name,t)};function t(){}}}fo.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:r}=e,{onActivation:n}=t;const{touches:o}=r;return o.length>1?!1:(n?.({event:r}),!0)}}];var ot;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(ot||(ot={}));var vt;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(vt||(vt={}));function go(e){let{acceleration:t,activator:r=ot.Pointer,canScroll:n,draggingRect:o,enabled:a,interval:s=5,order:c=vt.TreeOrder,pointerCoordinates:d,scrollableAncestors:u,scrollableAncestorRects:g,delta:f,threshold:p}=e;const h=bo({delta:f,disabled:!a}),[w,m]=Nn(),x=i.useRef({x:0,y:0}),k=i.useRef({x:0,y:0}),S=i.useMemo(()=>{switch(r){case ot.Pointer:return d?{top:d.y,bottom:d.y,left:d.x,right:d.x}:null;case ot.DraggableRect:return o}},[r,o,d]),v=i.useRef(null),C=i.useCallback(()=>{const R=v.current;if(!R)return;const N=x.current.x*k.current.x,D=x.current.y*k.current.y;R.scrollBy(N,D)},[]),E=i.useMemo(()=>c===vt.TreeOrder?[...u].reverse():u,[c,u]);i.useEffect(()=>{if(!a||!u.length||!S){m();return}for(const R of E){if(n?.(R)===!1)continue;const N=u.indexOf(R),D=g[N];if(!D)continue;const{direction:L,speed:I}=Qn(R,D,S,t,p);for(const _ of["x","y"])h[_][L[_]]||(I[_]=0,L[_]=0);if(I.x>0||I.y>0){m(),v.current=R,w(C,s),x.current=I,k.current=L;return}}x.current={x:0,y:0},k.current={x:0,y:0},m()},[t,C,n,m,a,s,JSON.stringify(S),JSON.stringify(h),w,u,E,g,JSON.stringify(p)])}const ho={x:{[F.Backward]:!1,[F.Forward]:!1},y:{[F.Backward]:!1,[F.Forward]:!1}};function bo(e){let{delta:t,disabled:r}=e;const n=Lt(t);return ft(o=>{if(r||!n||!o)return ho;const a={x:Math.sign(t.x-n.x),y:Math.sign(t.y-n.y)};return{x:{[F.Backward]:o.x[F.Backward]||a.x===-1,[F.Forward]:o.x[F.Forward]||a.x===1},y:{[F.Backward]:o.y[F.Backward]||a.y===-1,[F.Forward]:o.y[F.Forward]||a.y===1}}},[r,t,n])}function po(e,t){const r=t!=null?e.get(t):void 0,n=r?r.node.current:null;return ft(o=>{var a;return t==null?null:(a=n??o)!=null?a:null},[n,t])}function mo(e,t){return i.useMemo(()=>e.reduce((r,n)=>{const{sensor:o}=n,a=o.activators.map(s=>({eventName:s.eventName,handler:t(s.handler,n)}));return[...r,...a]},[]),[e,t])}var ct;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(ct||(ct={}));var Bt;(function(e){e.Optimized="optimized"})(Bt||(Bt={}));const sr=new Map;function xo(e,t){let{dragging:r,dependencies:n,config:o}=t;const[a,s]=i.useState(null),{frequency:c,measure:d,strategy:u}=o,g=i.useRef(e),f=x(),p=it(f),h=i.useCallback(function(k){k===void 0&&(k=[]),!p.current&&s(S=>S===null?k:S.concat(k.filter(v=>!S.includes(v))))},[p]),w=i.useRef(null),m=ft(k=>{if(f&&!r)return sr;if(!k||k===sr||g.current!==e||a!=null){const S=new Map;for(let v of e){if(!v)continue;if(a&&a.length>0&&!a.includes(v.id)&&v.rect.current){S.set(v.id,v.rect.current);continue}const C=v.node.current,E=C?new Gt(d(C),C):null;v.rect.current=E,E&&S.set(v.id,E)}return S}return k},[e,a,r,f,d]);return i.useEffect(()=>{g.current=e},[e]),i.useEffect(()=>{f||h()},[r,f]),i.useEffect(()=>{a&&a.length>0&&s(null)},[JSON.stringify(a)]),i.useEffect(()=>{f||typeof c!="number"||w.current!==null||(w.current=setTimeout(()=>{h(),w.current=null},c))},[c,f,h,...n]),{droppableRects:m,measureDroppableContainers:h,measuringScheduled:a!=null};function x(){switch(u){case ct.Always:return!1;case ct.BeforeDragging:return r;default:return!r}}}function Or(e,t){return ft(r=>e?r||(typeof t=="function"?t(e):e):null,[t,e])}function vo(e,t){return Or(e,t)}function yo(e){let{callback:t,disabled:r}=e;const n=Xt(t),o=i.useMemo(()=>{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:a}=window;return new a(n)},[n,r]);return i.useEffect(()=>()=>o?.disconnect(),[o]),o}function Nt(e){let{callback:t,disabled:r}=e;const n=Xt(t),o=i.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:a}=window;return new a(n)},[r]);return i.useEffect(()=>()=>o?.disconnect(),[o]),o}function wo(e){return new Gt(Xe(e),e)}function lr(e,t,r){t===void 0&&(t=wo);const[n,o]=i.useState(null);function a(){o(d=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=d??r)!=null?u:null}const g=t(e);return JSON.stringify(d)===JSON.stringify(g)?d:g})}const s=yo({callback(d){if(e)for(const u of d){const{type:g,target:f}=u;if(g==="childList"&&f instanceof HTMLElement&&f.contains(e)){a();break}}}}),c=Nt({callback:a});return me(()=>{a(),e?(c?.observe(e),s?.observe(document.body,{childList:!0,subtree:!0})):(c?.disconnect(),s?.disconnect())},[e]),n}function ko(e){const t=Or(e);return jr(e,t)}const cr=[];function So(e){const t=i.useRef(e),r=ft(n=>e?n&&n!==cr&&e&&t.current&&e.parentNode===t.current.parentNode?n:St(e):cr,[e]);return i.useEffect(()=>{t.current=e},[e]),r}function No(e){const[t,r]=i.useState(null),n=i.useRef(e),o=i.useCallback(a=>{const s=_t(a.target);s&&r(c=>c?(c.set(s,Pt(s)),new Map(c)):null)},[]);return i.useEffect(()=>{const a=n.current;if(e!==a){s(a);const c=e.map(d=>{const u=_t(d);return u?(u.addEventListener("scroll",o,{passive:!0}),[u,Pt(u)]):null}).filter(d=>d!=null);r(c.length?new Map(c):null),n.current=e}return()=>{s(e),s(a)};function s(c){c.forEach(d=>{const u=_t(d);u?.removeEventListener("scroll",o)})}},[o,e]),i.useMemo(()=>e.length?t?Array.from(t.values()).reduce((a,s)=>Ke(a,s),ue):Tr(e):ue,[e,t])}function dr(e,t){t===void 0&&(t=[]);const r=i.useRef(null);return i.useEffect(()=>{r.current=null},t),i.useEffect(()=>{const n=e!==ue;n&&!r.current&&(r.current=e),!n&&r.current&&(r.current=null)},[e]),r.current?st(e,r.current):ue}function Co(e){i.useEffect(()=>{if(!kt)return;const t=e.map(r=>{let{sensor:n}=r;return n.setup==null?void 0:n.setup()});return()=>{for(const r of t)r?.()}},e.map(t=>{let{sensor:r}=t;return r}))}function Ro(e,t){return i.useMemo(()=>e.reduce((r,n)=>{let{eventName:o,handler:a}=n;return r[o]=s=>{a(s,t)},r},{}),[e,t])}function Pr(e){return i.useMemo(()=>e?Vn(e):null,[e])}const ur=[];function Do(e,t){t===void 0&&(t=Xe);const[r]=e,n=Pr(r?J(r):null),[o,a]=i.useState(ur);function s(){a(()=>e.length?e.map(d=>Mr(d)?n:new Gt(t(d),d)):ur)}const c=Nt({callback:s});return me(()=>{c?.disconnect(),s(),e.forEach(d=>c?.observe(d))},[e]),o}function jo(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return ut(t)?t:e}function Eo(e){let{measure:t}=e;const[r,n]=i.useState(null),o=i.useCallback(u=>{for(const{target:g}of u)if(ut(g)){n(f=>{const p=t(g);return f?{...f,width:p.width,height:p.height}:p});break}},[t]),a=Nt({callback:o}),s=i.useCallback(u=>{const g=jo(u);a?.disconnect(),g&&a?.observe(g),n(g?t(g):null)},[t,a]),[c,d]=mt(s);return i.useMemo(()=>({nodeRef:c,rect:r,setRef:d}),[r,c,d])}const _o=[{sensor:Jt,options:{}},{sensor:Vt,options:{}}],Ao={current:{}},pt={draggable:{measure:nr},droppable:{measure:nr,strategy:ct.WhileDragging,frequency:Bt.Optimized},dragOverlay:{measure:Xe}};class at extends Map{get(t){var r;return t!=null&&(r=super.get(t))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:r}=t;return!r})}getNodeFor(t){var r,n;return(r=(n=this.get(t))==null?void 0:n.node.current)!=null?r:void 0}}const Mo={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new at,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:xt},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:pt,measureDroppableContainers:xt,windowRect:null,measuringScheduled:!1},Io={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:xt,draggableNodes:new Map,over:null,measureDroppableContainers:xt},Ct=i.createContext(Io),zr=i.createContext(Mo);function To(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new at}}}function Lo(e,t){switch(t.type){case z.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case z.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 z.DragEnd:case z.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case z.RegisterDroppable:{const{element:r}=t,{id:n}=r,o=new at(e.droppable.containers);return o.set(n,r),{...e,droppable:{...e.droppable,containers:o}}}case z.SetDroppableDisabled:{const{id:r,key:n,disabled:o}=t,a=e.droppable.containers.get(r);if(!a||n!==a.key)return e;const s=new at(e.droppable.containers);return s.set(r,{...a,disabled:o}),{...e,droppable:{...e.droppable,containers:s}}}case z.UnregisterDroppable:{const{id:r,key:n}=t,o=e.droppable.containers.get(r);if(!o||n!==o.key)return e;const a=new at(e.droppable.containers);return a.delete(r),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Oo(e){let{disabled:t}=e;const{active:r,activatorEvent:n,draggableNodes:o}=i.useContext(Ct),a=Lt(n),s=Lt(r?.id);return i.useEffect(()=>{if(!t&&!n&&a&&s!=null){if(!Ht(a)||document.activeElement===a.target)return;const c=o.get(s);if(!c)return;const{activatorNode:d,node:u}=c;if(!d.current&&!u.current)return;requestAnimationFrame(()=>{for(const g of[d.current,u.current]){if(!g)continue;const f=Dn(g);if(f){f.focus();break}}})}},[n,t,o,s,a]),null}function Po(e,t){let{transform:r,...n}=t;return e!=null&&e.length?e.reduce((o,a)=>a({transform:o,...n}),r):r}function zo(e){return i.useMemo(()=>({draggable:{...pt.draggable,...e?.draggable},droppable:{...pt.droppable,...e?.droppable},dragOverlay:{...pt.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Bo(e){let{activeNode:t,measure:r,initialRect:n,config:o=!0}=e;const a=i.useRef(!1),{x:s,y:c}=typeof o=="boolean"?{x:o,y:o}:o;me(()=>{if(!s&&!c||!t){a.current=!1;return}if(a.current||!n)return;const u=t?.node.current;if(!u||u.isConnected===!1)return;const g=r(u),f=jr(g,n);if(s||(f.x=0),c||(f.y=0),a.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const p=Er(u);p&&p.scrollBy({top:f.y,left:f.x})}},[t,s,c,n,r])}const Br=i.createContext({...ue,scaleX:1,scaleY:1});var Me;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Me||(Me={}));const $o=i.memo(function(t){var r,n,o,a;let{id:s,accessibility:c,autoScroll:d=!0,children:u,sensors:g=_o,collisionDetection:f=Un,measuring:p,modifiers:h,...w}=t;const m=i.useReducer(Lo,void 0,To),[x,k]=m,[S,v]=In(),[C,E]=i.useState(Me.Uninitialized),R=C===Me.Initialized,{draggable:{active:N,nodes:D,translate:L},droppable:{containers:I}}=x,_=N!=null?D.get(N):null,Z=i.useRef({initial:null,translated:null}),G=i.useMemo(()=>{var K;return N!=null?{id:N,data:(K=_?.data)!=null?K:Ao,rect:Z}:null},[N,_]),Q=i.useRef(null),[xe,ze]=i.useState(null),[H,Be]=i.useState(null),ae=it(w,Object.values(w)),B=gt("DndDescribedBy",s),ke=i.useMemo(()=>I.getEnabled(),[I]),W=zo(p),{droppableRects:ie,measureDroppableContainers:fe,measuringScheduled:Se}=xo(ke,{dragging:R,dependencies:[L.x,L.y],config:W.droppable}),O=po(D,N),$e=i.useMemo(()=>H?Ot(H):null,[H]),se=Pe(),P=vo(O,W.draggable.measure);Bo({activeNode:N!=null?D.get(N):null,config:se.layoutShiftCompensation,initialRect:P,measure:W.draggable.measure});const A=lr(O,W.draggable.measure,P),Ie=lr(O?O.parentElement:null),U=i.useRef({activatorEvent:null,active:null,activeNode:O,collisionRect:null,collisions:null,droppableRects:ie,draggableNodes:D,draggingNode:null,draggingNodeRect:null,droppableContainers:I,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ne=I.getNodeFor((r=U.current.over)==null?void 0:r.id),te=Eo({measure:W.dragOverlay.measure}),ve=(n=te.nodeRef.current)!=null?n:O,ye=R?(o=te.rect)!=null?o:A:null,ge=!!(te.nodeRef.current&&te.rect),Te=ko(ge?null:A),He=Pr(ve?J(ve):null),le=So(R?Ne??O:null),Le=Do(le),Oe=Po(h,{transform:{x:L.x-Te.x,y:L.y-Te.y,scaleX:1,scaleY:1},activatorEvent:H,active:G,activeNodeRect:A,containerNodeRect:Ie,draggingNodeRect:ye,over:U.current.over,overlayNodeRect:te.rect,scrollableAncestors:le,scrollableAncestorRects:Le,windowRect:He}),Ge=$e?Ke($e,L):null,Fe=No(le),Ce=dr(Fe),Rt=dr(Fe,[A]),Re=Ke(Oe,Ce),De=ye?Wn(ye,Oe):null,je=G&&De?f({active:G,collisionRect:De,droppableRects:ie,droppableContainers:ke,pointerCoordinates:Ge}):null,Ve=Dr(je,"id"),[he,Ee]=i.useState(null),qe=ge?Oe:Ke(Oe,Rt),b=Kn(qe,(a=he?.rect)!=null?a:null,A),M=i.useRef(null),re=i.useCallback((K,V)=>{let{sensor:X,options:$}=V;if(Q.current==null)return;const ne=D.get(Q.current);if(!ne)return;const ee=K.nativeEvent,be=new X({active:Q.current,activeNode:ne,event:ee,options:$,context:U,onAbort(Y){if(!D.get(Y))return;const{onDragAbort:pe}=ae.current,we={id:Y};pe?.(we),S({type:"onDragAbort",event:we})},onPending(Y,_e,pe,we){if(!D.get(Y))return;const{onDragPending:et}=ae.current,Ae={id:Y,constraint:_e,initialCoordinates:pe,offset:we};et?.(Ae),S({type:"onDragPending",event:Ae})},onStart(Y){const _e=Q.current;if(_e==null)return;const pe=D.get(_e);if(!pe)return;const{onDragStart:we}=ae.current,Qe={activatorEvent:ee,active:{id:_e,data:pe.data,rect:Z}};rt.unstable_batchedUpdates(()=>{we?.(Qe),E(Me.Initializing),k({type:z.DragStart,initialCoordinates:Y,active:_e}),S({type:"onDragStart",event:Qe}),ze(M.current),Be(ee)})},onMove(Y){k({type:z.DragMove,coordinates:Y})},onEnd:Ue(z.DragEnd),onCancel:Ue(z.DragCancel)});M.current=be;function Ue(Y){return async function(){const{active:pe,collisions:we,over:Qe,scrollAdjustedTranslate:et}=U.current;let Ae=null;if(pe&&et){const{cancelDrop:tt}=ae.current;Ae={activatorEvent:ee,active:pe,collisions:we,delta:et,over:Qe},Y===z.DragEnd&&typeof tt=="function"&&await Promise.resolve(tt(Ae))&&(Y=z.DragCancel)}Q.current=null,rt.unstable_batchedUpdates(()=>{k({type:Y}),E(Me.Uninitialized),Ee(null),ze(null),Be(null),M.current=null;const tt=Y===z.DragEnd?"onDragEnd":"onDragCancel";if(Ae){const jt=ae.current[tt];jt?.(Ae),S({type:tt,event:Ae})}})}}},[D]),Je=i.useCallback((K,V)=>(X,$)=>{const ne=X.nativeEvent,ee=D.get($);if(Q.current!==null||!ee||ne.dndKit||ne.defaultPrevented)return;const be={active:ee};K(X,V.options,be)===!0&&(ne.dndKit={capturedBy:V.sensor},Q.current=$,re(X,V))},[D,re]),Ze=mo(g,Je);Co(g),me(()=>{A&&C===Me.Initializing&&E(Me.Initialized)},[A,C]),i.useEffect(()=>{const{onDragMove:K}=ae.current,{active:V,activatorEvent:X,collisions:$,over:ne}=U.current;if(!V||!X)return;const ee={active:V,activatorEvent:X,collisions:$,delta:{x:Re.x,y:Re.y},over:ne};rt.unstable_batchedUpdates(()=>{K?.(ee),S({type:"onDragMove",event:ee})})},[Re.x,Re.y]),i.useEffect(()=>{const{active:K,activatorEvent:V,collisions:X,droppableContainers:$,scrollAdjustedTranslate:ne}=U.current;if(!K||Q.current==null||!V||!ne)return;const{onDragOver:ee}=ae.current,be=$.get(Ve),Ue=be&&be.rect.current?{id:be.id,rect:be.rect.current,data:be.data,disabled:be.disabled}:null,Y={active:K,activatorEvent:V,collisions:X,delta:{x:ne.x,y:ne.y},over:Ue};rt.unstable_batchedUpdates(()=>{Ee(Ue),ee?.(Y),S({type:"onDragOver",event:Y})})},[Ve]),me(()=>{U.current={activatorEvent:H,active:G,activeNode:O,collisionRect:De,collisions:je,droppableRects:ie,draggableNodes:D,draggingNode:ve,draggingNodeRect:ye,droppableContainers:I,over:he,scrollableAncestors:le,scrollAdjustedTranslate:Re},Z.current={initial:ye,translated:De}},[G,O,je,De,D,ve,ye,ie,I,he,le,Re]),go({...se,delta:L,draggingRect:De,pointerCoordinates:Ge,scrollableAncestors:le,scrollableAncestorRects:Le});const Dt=i.useMemo(()=>({active:G,activeNode:O,activeNodeRect:A,activatorEvent:H,collisions:je,containerNodeRect:Ie,dragOverlay:te,draggableNodes:D,droppableContainers:I,droppableRects:ie,over:he,measureDroppableContainers:fe,scrollableAncestors:le,scrollableAncestorRects:Le,measuringConfiguration:W,measuringScheduled:Se,windowRect:He}),[G,O,A,H,je,Ie,te,D,I,ie,he,fe,le,Le,W,Se,He]),ce=i.useMemo(()=>({activatorEvent:H,activators:Ze,active:G,activeNodeRect:A,ariaDescribedById:{draggable:B},dispatch:k,draggableNodes:D,over:he,measureDroppableContainers:fe}),[H,Ze,G,A,k,B,D,he,fe]);return q.createElement(Nr.Provider,{value:v},q.createElement(Ct.Provider,{value:ce},q.createElement(zr.Provider,{value:Dt},q.createElement(Br.Provider,{value:b},u)),q.createElement(Oo,{disabled:c?.restoreFocus===!1})),q.createElement(On,{...c,hiddenTextDescribedById:B}));function Pe(){const K=xe?.autoScrollEnabled===!1,V=typeof d=="object"?d.enabled===!1:d===!1,X=R&&!K&&!V;return typeof d=="object"?{...d,enabled:X}:{enabled:X}}}),Fo=i.createContext(null),fr="button",Uo="Draggable";function Ko(e){let{id:t,data:r,disabled:n=!1,attributes:o}=e;const a=gt(Uo),{activators:s,activatorEvent:c,active:d,activeNodeRect:u,ariaDescribedById:g,draggableNodes:f,over:p}=i.useContext(Ct),{role:h=fr,roleDescription:w="draggable",tabIndex:m=0}=o??{},x=d?.id===t,k=i.useContext(x?Br:Fo),[S,v]=mt(),[C,E]=mt(),R=Ro(s,t),N=it(r);me(()=>(f.set(t,{id:t,key:a,node:S,activatorNode:C,data:N}),()=>{const L=f.get(t);L&&L.key===a&&f.delete(t)}),[f,t]);const D=i.useMemo(()=>({role:h,tabIndex:m,"aria-disabled":n,"aria-pressed":x&&h===fr?!0:void 0,"aria-roledescription":w,"aria-describedby":g.draggable}),[n,h,m,x,w,g.draggable]);return{active:d,activatorEvent:c,activeNodeRect:u,attributes:D,isDragging:x,listeners:n?void 0:R,node:S,over:p,setNodeRef:v,setActivatorNodeRef:E,transform:k}}function Yo(){return i.useContext(zr)}const Wo="Droppable",Xo={timeout:25};function Ho(e){let{data:t,disabled:r=!1,id:n,resizeObserverConfig:o}=e;const a=gt(Wo),{active:s,dispatch:c,over:d,measureDroppableContainers:u}=i.useContext(Ct),g=i.useRef({disabled:r}),f=i.useRef(!1),p=i.useRef(null),h=i.useRef(null),{disabled:w,updateMeasurementsFor:m,timeout:x}={...Xo,...o},k=it(m??n),S=i.useCallback(()=>{if(!f.current){f.current=!0;return}h.current!=null&&clearTimeout(h.current),h.current=setTimeout(()=>{u(Array.isArray(k.current)?k.current:[k.current]),h.current=null},x)},[x]),v=Nt({callback:S,disabled:w||!s}),C=i.useCallback((D,L)=>{v&&(L&&(v.unobserve(L),f.current=!1),D&&v.observe(D))},[v]),[E,R]=mt(C),N=it(t);return i.useEffect(()=>{!v||!E.current||(v.disconnect(),f.current=!1,v.observe(E.current))},[E,v]),i.useEffect(()=>(c({type:z.RegisterDroppable,element:{id:n,key:a,disabled:r,node:E,rect:p,data:N}}),()=>c({type:z.UnregisterDroppable,key:a,id:n})),[n]),i.useEffect(()=>{r!==g.current.disabled&&(c({type:z.SetDroppableDisabled,id:n,key:a,disabled:r}),g.current.disabled=r)},[n,a,r,c]),{active:s,rect:p,isOver:d?.id===n,node:E,over:d,setNodeRef:R}}const Go=e=>{let{transform:t}=e;return{...t,y:0}};function $r(e,t,r){const n=e.slice();return n.splice(r<0?n.length+r:r,0,n.splice(t,1)[0]),n}function Vo(e,t){return e.reduce((r,n,o)=>{const a=t.get(n);return a&&(r[o]=a),r},Array(e.length))}function ht(e){return e!==null&&e>=0}function qo(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function Jo(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const bt={scaleX:1,scaleY:1},Zo=e=>{var t;let{rects:r,activeNodeRect:n,activeIndex:o,overIndex:a,index:s}=e;const c=(t=r[o])!=null?t:n;if(!c)return null;const d=Qo(r,s,o);if(s===o){const u=r[a];return u?{x:o<a?u.left+u.width-(c.left+c.width):u.left-c.left,y:0,...bt}:null}return s>o&&s<=a?{x:-c.width-d,y:0,...bt}:s<o&&s>=a?{x:c.width+d,y:0,...bt}:{x:0,y:0,...bt}};function Qo(e,t,r){const n=e[t],o=e[t-1],a=e[t+1];return!n||!o&&!a?0:r<t?o?n.left-(o.left+o.width):a.left-(n.left+n.width):a?a.left-(n.left+n.width):n.left-(o.left+o.width)}const Fr=e=>{let{rects:t,activeIndex:r,overIndex:n,index:o}=e;const a=$r(t,n,r),s=t[o],c=a[o];return!c||!s?null:{x:c.left-s.left,y:c.top-s.top,scaleX:c.width/s.width,scaleY:c.height/s.height}},Ur="Sortable",Kr=q.createContext({activeIndex:-1,containerId:Ur,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Fr,disabled:{draggable:!1,droppable:!1}});function ea(e){let{children:t,id:r,items:n,strategy:o=Fr,disabled:a=!1}=e;const{active:s,dragOverlay:c,droppableRects:d,over:u,measureDroppableContainers:g}=Yo(),f=gt(Ur,r),p=c.rect!==null,h=i.useMemo(()=>n.map(R=>typeof R=="object"&&"id"in R?R.id:R),[n]),w=s!=null,m=s?h.indexOf(s.id):-1,x=u?h.indexOf(u.id):-1,k=i.useRef(h),S=!qo(h,k.current),v=x!==-1&&m===-1||S,C=Jo(a);me(()=>{S&&w&&g(h)},[S,h,w,g]),i.useEffect(()=>{k.current=h},[h]);const E=i.useMemo(()=>({activeIndex:m,containerId:f,disabled:C,disableTransforms:v,items:h,overIndex:x,useDragOverlay:p,sortedRects:Vo(h,d),strategy:o}),[m,f,C.draggable,C.droppable,v,h,x,d,p,o]);return q.createElement(Kr.Provider,{value:E},t)}const ta=e=>{let{id:t,items:r,activeIndex:n,overIndex:o}=e;return $r(r,n,o).indexOf(t)},ra=e=>{let{containerId:t,isSorting:r,wasDragging:n,index:o,items:a,newIndex:s,previousItems:c,previousContainerId:d,transition:u}=e;return!u||!n||c!==a&&o===s?!1:r?!0:s!==o&&t===d},na={duration:200,easing:"ease"},Yr="transform",oa=lt.Transition.toString({property:Yr,duration:0,easing:"linear"}),aa={roleDescription:"sortable"};function ia(e){let{disabled:t,index:r,node:n,rect:o}=e;const[a,s]=i.useState(null),c=i.useRef(r);return me(()=>{if(!t&&r!==c.current&&n.current){const d=o.current;if(d){const u=Xe(n.current,{ignoreTransform:!0}),g={x:d.left-u.left,y:d.top-u.top,scaleX:d.width/u.width,scaleY:d.height/u.height};(g.x||g.y)&&s(g)}}r!==c.current&&(c.current=r)},[t,r,n,o]),i.useEffect(()=>{a&&s(null)},[a]),a}function sa(e){let{animateLayoutChanges:t=ra,attributes:r,disabled:n,data:o,getNewIndex:a=ta,id:s,strategy:c,resizeObserverConfig:d,transition:u=na}=e;const{items:g,containerId:f,activeIndex:p,disabled:h,disableTransforms:w,sortedRects:m,overIndex:x,useDragOverlay:k,strategy:S}=i.useContext(Kr),v=la(n,h),C=g.indexOf(s),E=i.useMemo(()=>({sortable:{containerId:f,index:C,items:g},...o}),[f,o,C,g]),R=i.useMemo(()=>g.slice(g.indexOf(s)),[g,s]),{rect:N,node:D,isOver:L,setNodeRef:I}=Ho({id:s,data:E,disabled:v.droppable,resizeObserverConfig:{updateMeasurementsFor:R,...d}}),{active:_,activatorEvent:Z,activeNodeRect:G,attributes:Q,setNodeRef:xe,listeners:ze,isDragging:H,over:Be,setActivatorNodeRef:ae,transform:B}=Ko({id:s,data:E,attributes:{...aa,...r},disabled:v.draggable}),ke=Sn(I,xe),W=!!_,ie=W&&!w&&ht(p)&&ht(x),fe=!k&&H,Se=fe&&ie?B:null,$e=ie?Se??(c??S)({rects:m,activeNodeRect:G,activeIndex:p,overIndex:x,index:C}):null,se=ht(p)&&ht(x)?a({id:s,items:g,activeIndex:p,overIndex:x}):C,P=_?.id,A=i.useRef({activeId:P,items:g,newIndex:se,containerId:f}),Ie=g!==A.current.items,U=t({active:_,containerId:f,isDragging:H,isSorting:W,id:s,index:C,items:g,newIndex:A.current.newIndex,previousItems:A.current.items,previousContainerId:A.current.containerId,transition:u,wasDragging:A.current.activeId!=null}),Ne=ia({disabled:!U,index:C,node:D,rect:N});return i.useEffect(()=>{W&&A.current.newIndex!==se&&(A.current.newIndex=se),f!==A.current.containerId&&(A.current.containerId=f),g!==A.current.items&&(A.current.items=g)},[W,se,f,g]),i.useEffect(()=>{if(P===A.current.activeId)return;if(P&&!A.current.activeId){A.current.activeId=P;return}const ve=setTimeout(()=>{A.current.activeId=P},50);return()=>clearTimeout(ve)},[P]),{active:_,activeIndex:p,attributes:Q,data:E,rect:N,index:C,newIndex:se,items:g,isOver:L,isSorting:W,isDragging:H,listeners:ze,node:D,overIndex:x,over:Be,setNodeRef:ke,setActivatorNodeRef:ae,setDroppableNodeRef:I,setDraggableNodeRef:xe,transform:Ne??$e,transition:te()};function te(){if(Ne||Ie&&A.current.newIndex===C)return oa;if(!(fe&&!Ht(Z)||!u)&&(W||U))return lt.Transition.toString({...u,property:Yr})}}function la(e,t){var r,n;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(r=e?.draggable)!=null?r:t.draggable,droppable:(n=e?.droppable)!=null?n:t.droppable}}function yt(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 ca=[j.Down,j.Right,j.Up,j.Left],da=(e,t)=>{let{context:{active:r,collisionRect:n,droppableRects:o,droppableContainers:a,over:s,scrollableAncestors:c}}=t;if(ca.includes(e.code)){if(e.preventDefault(),!r||!n)return;const d=[];a.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;const p=o.get(f.id);if(p)switch(e.code){case j.Down:n.top<p.top&&d.push(f);break;case j.Up:n.top>p.top&&d.push(f);break;case j.Left:n.left>p.left&&d.push(f);break;case j.Right:n.left<p.left&&d.push(f);break}});const u=$n({collisionRect:n,droppableRects:o,droppableContainers:d});let g=Dr(u,"id");if(g===s?.id&&u.length>1&&(g=u[1].id),g!=null){const f=a.get(r.id),p=a.get(g),h=p?o.get(p.id):null,w=p?.node.current;if(w&&h&&f&&p){const x=St(w).some((R,N)=>c[N]!==R),k=Wr(f,p),S=ua(f,p),v=x||!k?{x:0,y:0}:{x:S?n.width-h.width:0,y:S?n.height-h.height:0},C={x:h.left,y:h.top};return v.x&&v.y?C:st(C,v)}}}};function Wr(e,t){return!yt(e)||!yt(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function ua(e,t){return!yt(e)||!yt(t)||!Wr(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function dt(e,{min:t,max:r,fallback:n}){const o=Number(e);if(!Number.isFinite(o))return n;const a=Math.floor(o);return a<t?t:a>r?r:a}function fa(e,t){const r=dt(t,{min:0,max:1e6,fallback:0}),n=dt(e,{min:1,max:Math.max(1,r||1),fallback:1});if(r<=1)return[1];const o=new Set([1,r,n-2,n-1,n,n+1,n+2]),a=Array.from(o).filter(d=>Number.isInteger(d)&&d>=1&&d<=r).sort((d,u)=>d-u),s=[];let c=null;for(const d of a)c!=null&&d-c>1&&s.push(null),s.push(d),c=d;return s}function ga({page:e,totalPages:t}){const r=typeof t=="number"&&Number.isFinite(t)&&t>=0,n=r?dt(t,{min:0,max:1e6,fallback:0}):null,o=dt(e,{min:1,max:r?Math.max(1,n||1):1e6,fallback:1}),a=o>1,s=r?o<n:!0;return{canPrev:a,canNext:s,safePage:o,safeTotal:n}}function ha({entries:e,me:t,meLabel:r}){const n=Array.isArray(e)?e:[],o=t&&typeof t.rank=="number"?t.rank:null;return!o||n.some(s=>!!s?.is_me)?n:[{rank:o,is_me:!0,is_pinned:!0,user_id:t?.user_id??null,display_name:r,avatar_url:t?.avatar_url??null,github_url:null,is_public:!1,gpt_tokens:t?.gpt_tokens??"0",claude_tokens:t?.claude_tokens??"0",gemini_tokens:t?.gemini_tokens??"0",cursor_tokens:t?.cursor_tokens??"0",opencode_tokens:t?.opencode_tokens??"0",openclaw_tokens:t?.openclaw_tokens??"0",hermes_tokens:t?.hermes_tokens??"0",kiro_tokens:t?.kiro_tokens??"0",copilot_tokens:t?.copilot_tokens??"0",kimi_tokens:t?.kimi_tokens??"0",other_tokens:t?.other_tokens??"0",total_tokens:t?.total_tokens??"0",estimated_cost_usd:t?.estimated_cost_usd??null},...n]}function ba(e,t){const r=Number(e),n=Number(t);return!Number.isFinite(r)||r<1||!Number.isFinite(n)||n<1?null:Math.ceil(r/n)}const pa=new Set(["/brand-logos/cursor.svg","/brand-logos/kimi.svg","/brand-logos/kiro.svg","/brand-logos/copilot.svg"]);function ma({iconSrc:e,label:t}){return l.jsxs("span",{className:"inline-flex items-center gap-3",children:[e?l.jsx("img",{src:e,alt:"",width:16,height:16,className:`h-4 w-4 shrink-0 object-contain opacity-90 ${pa.has(e)?"dark:invert":""}`}):null,l.jsx("span",{className:"whitespace-nowrap",children:t})]})}const wt=[{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}],Xr="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",Hr="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 $t(e){return T("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",e?"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/60")}function Ft(e){return T("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",e?"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/60")}function de({className:e}){return l.jsx("div",{className:T("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",e)})}function xa({index:e}){const t=e<3?"w-24":e<8?"w-20":"w-16",r=e<3?"w-16":"w-12",n=e<5?"w-14":"w-10";return l.jsxs("tr",{className:"group",children:[l.jsx("td",{className:T($t(!1),"!group-hover:bg-transparent"),children:l.jsx(de,{className:"h-4 w-6"})}),l.jsx("td",{className:T(Ft(!1),"!group-hover:bg-transparent"),children:l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsx(de,{className:"h-8 w-8 min-w-8 rounded-full"}),l.jsx(de,{className:T("h-4",t)})]})}),l.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:l.jsx(de,{className:T("h-4",r)})}),l.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:l.jsx(de,{className:"h-4 w-12"})}),wt.map(o=>l.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:l.jsx(de,{className:T("h-4",n)})},o.key))]})}function va({rows:e=10}){return l.jsx("div",{className:"w-full overflow-x-auto",children:l.jsxs("table",{className:"min-w-max w-full text-left text-sm",children:[l.jsx("thead",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800",children:l.jsxs("tr",{children:[l.jsx("th",{className:T(Xr,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:l.jsx(de,{className:"h-3.5 w-6"})}),l.jsx("th",{className:T(Hr,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:l.jsx(de,{className:"h-3.5 w-12"})}),l.jsx("th",{className:"px-4 py-4",children:l.jsx(de,{className:"h-3.5 w-10"})}),l.jsx("th",{className:"px-4 py-4",children:l.jsx(de,{className:"h-3.5 w-14"})}),wt.map(t=>l.jsx("th",{className:"px-4 py-4",children:l.jsx(de,{className:"h-3.5 w-12"})},t.key))]})}),l.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:Array.from({length:e},(t,r)=>l.jsx(xa,{index:r},r))})]})})}function ya({id:e,thClassName:t,children:r}){const{attributes:n,listeners:o,setNodeRef:a,transform:s,transition:c,isDragging:d}=sa({id:e}),u=lt.Transform.toString(s)||"";i.useLayoutEffect(()=>{const f=document.querySelectorAll(`td[data-column-key="${e}"]`),p="0 2px 10px rgba(15, 23, 42, 0.10), 0 1px 3px rgba(15, 23, 42, 0.06)";return f.forEach(h=>{h.style.transform=u,h.style.transition=c||"",h.style.zIndex=d?"20":"",h.style.position=u?"relative":"",h.style.boxShadow=d?p:""}),()=>{f.forEach(h=>{h.style.transform="",h.style.transition="",h.style.zIndex="",h.style.position="",h.style.boxShadow=""})}},[e,u,c,d]);const g={transform:u,transition:c,position:u?"relative":void 0,zIndex:d?20:void 0,boxShadow:d?"0 2px 10px rgba(15, 23, 42, 0.10), 0 1px 3px rgba(15, 23, 42, 0.06)":void 0};return l.jsx("th",{ref:a,style:g,className:T(t,"group/col select-none cursor-grab active:cursor-grabbing touch-none"),...n,...o,children:l.jsxs("div",{className:"flex items-center justify-end gap-2",children:[l.jsx("span",{"aria-hidden":"true",className:T("-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",d&&"opacity-100"),children:l.jsxs("svg",{viewBox:"0 0 8 14",width:"8",height:"14",fill:"currentColor","aria-hidden":"true",children:[l.jsx("circle",{cx:"2",cy:"2",r:"1"}),l.jsx("circle",{cx:"6",cy:"2",r:"1"}),l.jsx("circle",{cx:"2",cy:"7",r:"1"}),l.jsx("circle",{cx:"6",cy:"7",r:"1"}),l.jsx("circle",{cx:"2",cy:"12",r:"1"}),l.jsx("circle",{cx:"6",cy:"12",r:"1"})]})}),r]})})}const Gr="tokentracker.leaderboard.columnOrder.v1";function wa(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(Gr);if(!e)return null;const t=JSON.parse(e);return Array.isArray(t)?t.filter(r=>typeof r=="string"):null}catch{return null}}function It(e){if(!(typeof window>"u"))try{window.localStorage.setItem(Gr,JSON.stringify(e))}catch{}}function gr(e,t){if(!e)return t;const r=new Set(t),n=e.filter(a=>r.has(a)),o=t.filter(a=>!n.includes(a));return[...n,...o]}function ka(e){const t=i.useMemo(()=>e.join("|"),[e]),[r,n]=i.useState(()=>gr(wa(),e));i.useEffect(()=>{n(s=>{const c=gr(s,e);return c.length===s.length&&c.every((u,g)=>u===s[g])?s:(It(c),c)})},[t,e]);const o=i.useCallback((s,c)=>{!s||!c||s===c||n(d=>{const u=d.indexOf(s),g=d.indexOf(c);if(u===-1||g===-1)return d;const f=d.slice(),[p]=f.splice(u,1);return f.splice(g,0,p),It(f),f})},[]),a=i.useCallback(()=>{It(e),n(e)},[e]);return{order:r,reorder:o,reset:a}}function Sa(e,t){const r=Number(e),n=Number(t);return!Number.isFinite(r)||r<1||!Number.isFinite(n)||n<1?null:Math.min(100,Math.max(1,Math.ceil(r/n*100)))}function Vr(e){return typeof e=="string"?e.trim():""}function Na(e){const t=Vr(e);return t?t.toLowerCase()==="anonymous":!0}function Ca({me:e,totalEntries:t,meLabel:r,onOpenProfile:n,onJumpToMe:o,canJump:a,className:s}){const c=e&&typeof e.rank=="number"?e.rank:null;if(!c)return null;const d=Number(t)||0,u=Sa(c,d),g=Vr(e?.display_name),f=!g||Na(g)?r||"You":g,p=e?.user_id||f,h=n||(a?o:null),w=typeof h=="function",m=w?"button":"div",x=w?{type:"button",onClick:h,"aria-label":y(n?"leaderboard.summary.view_profile":"leaderboard.summary.jump_to_me")}:{};return l.jsxs(m,{...x,className:T("group inline-flex h-9 items-center gap-2.5 rounded-full border pl-1 pr-3.5 transition-all duration-300 select-none shadow-[0_1px_2px_rgba(0,0,0,0.03)]",w?"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] hover:shadow-[0_4px_12px_rgba(0,0,0,0.05)] dark:hover:shadow-[0_4px_20px_rgba(0,0,0,0.25)] 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]",s),children:[l.jsx(Tt,{size:"sm",avatarUrl:e?.avatar_url,displayName:f,seed:p}),l.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}),l.jsxs("span",{className:"text-xs font-bold tabular-nums text-oai-gray-800 dark:text-white",children:["#",c.toLocaleString()]}),u!=null&&l.jsx("span",{className:T("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",u<=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:y("leaderboard.summary.percentile",{p:String(u)})}),w?l.jsx(kn,{"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"}):l.jsxs("span",{className:"relative flex h-1.5 w-1.5 shrink-0 items-center justify-center ml-1",title:"You are here",children:[l.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-emerald-400 opacity-75 duration-1000"}),l.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-emerald-500"})]})]})}const Ra=i.lazy(()=>mn(()=>import("./LeaderboardProfileModal-BXUUSlGG.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])).then(e=>({default:e.LeaderboardProfileModal}))),Ut=[10,20,50,100],Kt=20,qr="tokentracker:leaderboard:pageSize";function Da(){if(typeof window>"u")return Kt;try{const e=window.localStorage.getItem(qr),t=Number(e);if(Ut.includes(t))return t}catch{}return Kt}function hr(e,t,r){const n=Number(e);if(!Number.isFinite(n)||n<=0)return"-";const o=gn(t),a=t===xn?n:n*r;return a>=1e3?`${o}${Math.round(a).toLocaleString()}`:a>=10?`${o}${Math.round(a)}`:`${o}${a.toFixed(2)}`}function br({value:e}){return l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"sm:hidden",children:fn(e)}),l.jsx("span",{className:"hidden sm:inline",children:wr(e)})]})}function pr(e,t,r){const n=t?"text-oai-gray-700 dark:text-oai-gray-300":"text-oai-gray-500 dark:text-oai-gray-400",o=t?"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/60";return r.map(a=>l.jsx("td",{"data-column-key":a.key,className:T("hidden sm:table-cell px-3 sm:px-4 py-4 whitespace-nowrap text-right tabular-nums",n,o),children:wr(e?.[a.key])},a.key))}const ja={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 mr({rank:e,placeholder:t}){const r=ja[e];return r?l.jsx("span",{className:T("inline-flex items-center justify-center h-7 w-7 rounded-full text-xs font-bold",r.text,r.badge),children:e}):l.jsx("span",{className:"inline-flex items-center justify-center h-7 w-7 text-sm",children:e??t})}function xr(e){if(typeof e!="string")return null;const t=e.trim().toLowerCase();return t==="week"||t==="month"||t==="total"?t:null}function Ea(e){if(!e)return y("shared.error.prefix",{error:y("leaderboard.error.unknown")});const t=e?.message||String(e),r=String(t||"").trim()||y("leaderboard.error.unknown");return y("shared.error.prefix",{error:r})}function Jr(e){return typeof e!="string"?"":e.trim()}function _a(e){const t=Jr(e);return t?t.toLowerCase()==="anonymous":!0}function vr(e,t){const r=typeof e?.user_id=="string"?e.user_id.trim():"";return r||`${e?.rank??""}:${t}`}function yr({githubUrl:e}){return l.jsxs("span",{className:"relative inline-flex items-center group/gh shrink-0",children:[l.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",onClick:t=>t.stopPropagation(),"aria-label":y("leaderboard.github.aria"),className:"text-oai-black hover:text-oai-gray-500 dark:text-white dark:hover:text-oai-gray-400 transition-colors",children:l.jsx(dn,{provider:"GITHUB",size:16})}),l.jsxs("span",{role:"tooltip",className:"invisible opacity-0 group-hover/gh:visible group-hover/gh:opacity-100 absolute right-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:[l.jsx("span",{className:"block",children:y("leaderboard.github.tooltipAction")}),l.jsxs("span",{className:"block text-oai-gray-300 dark:text-oai-gray-400",children:[y("leaderboard.github.tooltipPrefix")," ",l.jsx(un,{to:"/settings",onClick:t=>t.stopPropagation(),className:"text-white underline underline-offset-2 decoration-oai-gray-400 hover:text-oai-brand-300 hover:decoration-oai-brand-300",children:y("leaderboard.github.tooltipSettingsLink")}),y("leaderboard.github.tooltipSuffix")]})]})]})}function La({auth:e,signedIn:t,sessionSoftExpired:r}){const n=Qr(),o=en(),{openLoginModal:a}=tn(),{signedIn:s,loading:c,user:d}=rn(),{currency:u,rate:g}=vn(),f=i.useMemo(()=>nn(),[]),p=on(),h=t&&!r,w=i.useMemo(()=>h&&(typeof e=="function"||typeof e=="string"||e&&typeof e=="object")?e:null,[e,h]),m=h?w:null,x=h&&an(m),k=y("shared.placeholder.short"),S=i.useMemo(()=>wt.map(b=>b.key),[]),{order:v,reorder:C}=ka(S),E=i.useMemo(()=>{const b=new Map;for(const M of wt)b.set(M.key,M);return b},[]),R=i.useMemo(()=>v.map(b=>E.get(b)).filter(Boolean),[v,E]),N=Pn(er(Jt,{activationConstraint:{distance:6}}),er(Vt,{coordinateGetter:da})),D=i.useCallback(b=>{const{active:M,over:re}=b;!re||M.id===re.id||C(String(M.id),String(re.id))},[C]),[L,I]=i.useState(1),[_,Z]=i.useState(Da),[G,Q]=i.useState(null),xe=i.useCallback(b=>{typeof b=="string"&&b.trim()&&Q(b.trim())},[]),ze=i.useCallback(()=>Q(null),[]),H=i.useCallback(b=>{const M=Ut.includes(b)?b:Kt;Z(M),I(1);try{window.localStorage.setItem(qr,String(M))}catch{}},[]),[Be,ae]=i.useState(0),[B,ke]=i.useState(()=>({loading:!1,error:null,data:null})),[W,ie]=i.useState(()=>sn()),[fe,Se]=i.useState(!1),O=i.useMemo(()=>{const b=new URLSearchParams(n?.search||"");return xr(b.get("period"))||"total"},[n?.search]),$e=b=>{const M=xr(b);if(!M||M===O)return;const re=new URLSearchParams(n?.search||"");re.set("period",M),I(1),o(`${n?.pathname||"/leaderboard"}?${re.toString()}`,{replace:!0})};i.useEffect(()=>{c||p||s||a()},[s,c,p,a]),i.useEffect(()=>{I(1)},[O]);const se=i.useMemo(()=>(dt(L,{min:1,max:1e6,fallback:1})-1)*_,[L,_]);i.useEffect(()=>{if(!f&&!p)return;let b=!0;return ke(M=>({...M,loading:!0,error:null})),(async()=>{const M=await ln({userId:d?.id||null,period:O,limit:_,offset:se});b&&ke({loading:!1,error:null,data:M})})().catch(M=>{b&&ke({loading:!1,error:Ea(M),data:null})}),()=>{b=!1}},[f,d?.id,se,Be,p,O,_]);const P=B.data,A=P?.total_pages??null,Ie=P?.total_entries??0,U=P?.page??L,Ne=i.useMemo(()=>fa(U,A),[U,A]),te=P?.from||null,ve=P?.to||null,ye=P?.generated_at||null,ge=P?.me||null,Te=y("leaderboard.me_label"),He=y("leaderboard.anon_label"),le=y("leaderboard.period.week"),Le=y("leaderboard.period.month"),Oe=y("leaderboard.period.total"),Ge=O==="month"?Le:O==="total"?Oe:le,Fe=i.useMemo(()=>{const b=Array.isArray(P?.entries)?P.entries:[];return ha({entries:b,me:ge,meLabel:Te})},[P?.entries,ge,Te]),Ce=i.useMemo(()=>ba(ge?.rank,_),[ge?.rank,_]),Rt=Ce!=null&&Ce===U,Re=i.useCallback(()=>{Ce!=null&&I(Ce)},[Ce]),De=async()=>{Se(!0);try{hn(!0),ie(!0),await bn(()=>Zt(m));const b=await Zt(m);b&&await pn({accessToken:b,period:O,source:"leaderboard-enable-sync"}),ae(M=>M+1)}catch(b){console.warn("[tokentracker] sync:",b)}finally{Se(!1)}},{canPrev:je,canNext:Ve}=ga({page:U,totalPages:A}),he=Array.isArray(Fe)&&Fe.length!==0;let Ee=null;B.loading?Ee=l.jsx(va,{rows:_}):B.error?Ee=l.jsx("div",{className:"px-6 py-12 text-center",children:l.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:B.error})}):he?Ee=l.jsx($o,{sensors:N,collisionDetection:Bn,modifiers:[Go],onDragEnd:D,children:l.jsx("div",{className:"w-full overflow-x-auto",children:l.jsxs("table",{className:"min-w-full sm:min-w-max w-full text-left text-sm",children:[l.jsx("thead",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800",children:l.jsxs("tr",{children:[l.jsx("th",{className:T(Xr,"text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500"),children:y("leaderboard.column.rank")}),l.jsx("th",{className:T(Hr,"text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500"),children:y("leaderboard.column.user")}),l.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:y("leaderboard.column.total")}),l.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:y("leaderboard.column.est_cost")}),l.jsx(ea,{items:v,strategy:Zo,children:R.map(b=>l.jsx(ya,{id:b.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:l.jsx(ma,{iconSrc:b.icon,label:y(b.copyKey)})},b.key))})]})}),l.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:Fe.map((b,M)=>{if(b?.is_ellipsis){const $=4+R.length;return l.jsx("tr",{"aria-hidden":"true",children:l.jsx("td",{colSpan:$,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-${M}`)}const re=!!b?.is_me,Je=typeof b?.user_id=="string"?b.user_id:null,Ze=Jr(b?.display_name),Dt=_a(Ze)?He:Ze,ce=re?Te:Dt,Pe=!!Je,X=Pe?{role:"button",tabIndex:0,onClick:Pe?()=>xe(Je):void 0,onKeyDown:Pe?$=>{($.key==="Enter"||$.key===" ")&&($.preventDefault(),xe(Je))}:void 0,"aria-label":y("leaderboard.profile_modal.row_aria",{name:ce})}:{};if(re){const $=!!b?.is_pinned;return l.jsxs("tr",{...X,className:T("bg-oai-brand-50 dark:bg-oai-brand-900/10 transition-colors",$?"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",Pe&&"cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500/60"),children:[l.jsx("td",{className:T($t(!0),"relative font-semibold text-oai-brand-600 dark:text-oai-brand-400",$&&"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:l.jsx(mr,{rank:b?.rank,placeholder:k})}),l.jsx("td",{className:Ft(!0),children:l.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[l.jsx(Tt,{avatarUrl:b?.avatar_url,displayName:ce,seed:vr(b,ce)}),l.jsx("span",{className:"truncate font-semibold text-oai-black dark:text-oai-white",children:ce}),b?.github_url&&l.jsx(yr,{githubUrl:b.github_url})]})}),l.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:l.jsx(br,{value:b?.total_tokens})}),l.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:hr(b?.estimated_cost_usd,u,g)}),pr(b,!0,R)]},`row-${b?.rank}-${ce}${$?"-pin":""}`)}return l.jsxs("tr",{...X,className:T("group transition-colors",Pe&&"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:[l.jsx("td",{className:T($t(!1),"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:l.jsx(mr,{rank:b?.rank,placeholder:k})}),l.jsx("td",{className:Ft(!1),children:l.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[l.jsx(Tt,{avatarUrl:b?.avatar_url,displayName:ce,seed:vr(b,ce)}),l.jsx("span",{className:"truncate font-medium text-oai-gray-800 dark:text-oai-gray-200",children:ce}),b?.github_url&&l.jsx(yr,{githubUrl:b.github_url})]})}),l.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:l.jsx(br,{value:b?.total_tokens})}),l.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:hr(b?.estimated_cost_usd,u,g)}),pr(b,!1,R)]},`row-${b?.rank}-${ce}`)})})]})})}):Ee=l.jsx("div",{className:"px-6 py-12 text-center",children:l.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:y("leaderboard.empty")})});let qe=null;return typeof A=="number"?qe=Ne.map((b,M)=>b==null?l.jsx("span",{className:"px-2 text-oai-gray-400 dark:text-oai-gray-500",children:y("leaderboard.pagination.ellipsis")},`ellipsis-${M}`):l.jsx("button",{className:T("flex h-8 w-8 items-center justify-center rounded-md text-sm font-medium transition-colors",b===U?"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:()=>I(b),disabled:B.loading,children:String(b)},`page-${b}`)):qe=l.jsx("span",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:y("leaderboard.pagination.page_unknown",{page:String(U)})}),l.jsxs("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:[l.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:l.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[l.jsxs("div",{className:"mb-5 sm:mb-6",children:[l.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white mb-2 sm:mb-3",children:y("leaderboard.title")}),l.jsxs("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:[O==="total"?y("leaderboard.range.total"):te&&ve?y("leaderboard.range",{period:Ge,from:te,to:ve}):y("leaderboard.range_loading",{period:Ge}),ye&&l.jsx("span",{className:"ml-2 pl-2 border-l border-oai-gray-200 dark:border-oai-gray-800 hidden sm:inline-block text-oai-gray-400 dark:text-oai-gray-500 text-xs",children:y("leaderboard.generated_at",{ts:ye})})]})]}),l.jsxs("div",{className:"mb-6 sm:mb-8 flex flex-row items-center justify-between gap-3",children:[l.jsx("div",{className:"inline-flex h-9 p-1 border border-oai-gray-200 dark:border-oai-gray-800 rounded-full items-center relative",children:["week","month","total"].map(b=>{const M=O===b;return l.jsxs("button",{onClick:()=>$e(b),disabled:B.loading,className:T("px-3 sm:px-4 h-7 text-sm font-medium rounded-full flex items-center justify-center transition-colors relative",M?"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:[l.jsx("span",{className:"relative z-10",children:b==="week"?le:b==="month"?Le:Oe}),M&&l.jsx(cn.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}})]},b)})}),l.jsx(Ca,{me:ge,totalEntries:Ie,meLabel:Te,onOpenProfile:ge?.user_id?()=>xe(ge.user_id):void 0,onJumpToMe:Re,canJump:Ce!=null&&!Rt&&!B.loading,className:"shrink-0"})]}),!t&&l.jsxs("div",{className:"mb-6 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between text-sm",children:[l.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:y("leaderboard.signin_prompt")}),l.jsx("button",{onClick:a,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:y("leaderboard.signin_button")})]}),h&&x&&!W&&l.jsxs("div",{className:"mb-6 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between text-sm",children:[l.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:y("leaderboard.sync_prompt")}),l.jsx("button",{onClick:De,disabled:fe,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:fe?y("leaderboard.sync_button.busy"):y("leaderboard.sync_button.idle")})]}),l.jsxs("div",{className:"rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 overflow-hidden",children:[Ee,l.jsxs("div",{className:"px-6 py-3 border-t border-oai-gray-200 dark:border-oai-gray-800 flex flex-wrap items-center justify-end gap-x-4 gap-y-2",children:[l.jsxs("div",{className:"flex items-center gap-2 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:[l.jsx("label",{htmlFor:"leaderboard-page-size",className:"whitespace-nowrap",children:y("leaderboard.pagination.page_size_label")}),l.jsxs("div",{className:"relative",children:[l.jsx("select",{id:"leaderboard-page-size",value:_,onChange:b=>H(Number(b.target.value)),disabled:B.loading,className:"appearance-none pl-3 pr-8 py-1 rounded-md bg-white dark:bg-oai-gray-950 border border-oai-gray-300 dark:border-oai-gray-700 text-oai-gray-700 dark:text-oai-gray-300 hover:border-oai-gray-400 dark:hover:border-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500 disabled:opacity-50 transition-colors",children:Ut.map(b=>l.jsx("option",{value:b,children:b},b))}),l.jsx(yn,{className:"pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-oai-gray-500 dark:text-oai-gray-400",strokeWidth:2,"aria-hidden":"true"})]})]}),l.jsx("div",{className:"h-5 w-px bg-oai-gray-200 dark:bg-oai-gray-800","aria-hidden":"true"}),l.jsx("button",{className:T("px-3 py-1.5 text-sm font-medium text-oai-gray-500 dark:text-oai-gray-400 rounded-md transition-colors",je&&!B.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:()=>I(b=>Math.max(1,b-1)),disabled:!je||B.loading,children:y("leaderboard.pagination.prev")}),l.jsx("div",{className:"flex flex-wrap items-center gap-1",children:qe}),l.jsx("button",{className:T("px-3 py-1.5 text-sm font-medium text-oai-gray-500 dark:text-oai-gray-400 rounded-md transition-colors",Ve&&!B.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:()=>I(b=>b+1),disabled:!Ve||B.loading,children:y("leaderboard.pagination.next")})]})]})]})}),l.jsx("footer",{className:"border-t border-oai-gray-200 dark:border-oai-gray-900 py-8 transition-colors duration-200",children:l.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:[l.jsx("p",{children:y("landing.v2.footer.line")}),l.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:y("landing.v2.nav.github")})]})}),l.jsx(i.Suspense,{fallback:null,children:l.jsx(Ra,{isOpen:!!G,userId:G,period:O,accessToken:m,onClose:ze})})]})}export{La as LeaderboardPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as d,u as e,K as j,O as w,Q as N,L as k,ar as L,s,a7 as I}from"./main-DdKVCJWa.js";import{u as T}from"./useCurrency-D8PqG8hW.js";import{H as M}from"./HeaderGithubStar-BxYJXuVn.js";import{useLeaderboardProfileData as C,ProfileSkeleton as _,ProfileContent as E}from"./LeaderboardProfileModal-BXUUSlGG.js";import"./LeaderboardAvatar-BNpzqU-s.js";import"./ActivityHeatmap-C5lQst9A.js";import"./info-R9MgHQlV.js";import"./arrow-up-right-C6REzMq8.js";import"./check-DF1-jcTm.js";import"./DialogTitle-DD717-IL.js";const l=18;function y(){return e.jsxs("svg",{"aria-hidden":!0,width:l,height:l,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"4"}),e.jsx("path",{d:"M12 2v2"}),e.jsx("path",{d:"M12 20v2"}),e.jsx("path",{d:"m4.93 4.93 1.41 1.41"}),e.jsx("path",{d:"m17.66 17.66 1.41 1.41"}),e.jsx("path",{d:"M2 12h2"}),e.jsx("path",{d:"M20 12h2"}),e.jsx("path",{d:"m6.34 17.66-1.41 1.41"}),e.jsx("path",{d:"m19.07 4.93-1.41 1.41"})]})}function v(){return e.jsx("svg",{"aria-hidden":!0,width:l,height:l,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"})})}function S(){return e.jsxs("svg",{"aria-hidden":!0,width:l,height:l,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),e.jsx("path",{d:"M8 21h8"}),e.jsx("path",{d:"M12 17v4"})]})}const P=[{value:"light",label:"Light",Icon:y},{value:"dark",label:"Dark",Icon:v},{value:"system",label:"System",Icon:S}];function O(a){return a==="dark"?v:y}function W({theme:a,resolvedTheme:h,onSetTheme:g,className:u="",direction:m="down",align:p="right"}){const[o,x]=d.useState(!1),c=d.useRef(null),n=d.useCallback(()=>x(!1),[]);d.useEffect(()=>{if(!o)return;const r=i=>{c.current&&!c.current.contains(i.target)&&n()};return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[o,n]),d.useEffect(()=>{if(!o)return;const r=i=>{i.key==="Escape"&&n()};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[o,n]);const b=O(h);return e.jsxs("div",{ref:c,className:`relative ${u}`,children:[e.jsx("button",{type:"button","aria-label":"Theme","aria-expanded":o,onClick:()=>x(r=>!r),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:e.jsx(b,{})}),o&&e.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 ${m==="up"?"bottom-full mb-1":"top-full mt-1"} ${p==="left"?"left-0":"right-0"}`,children:P.map(({value:r,label:i,Icon:f})=>{const t=a===r;return e.jsxs("button",{type:"button",onClick:()=>{g(r),n()},className:`flex w-full items-center gap-2.5 px-3 py-2 text-sm transition-colors ${t?"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:[e.jsx(f,{}),e.jsx("span",{children:i})]},r)})})]})}function Q({auth:a,signedIn:h,sessionSoftExpired:g,userId:u}){const{currency:m,rate:p}=T(),{theme:o,resolvedTheme:x,setTheme:c}=j(),{openLoginModal:n}=w(),{signedIn:b,loading:r}=N(),i=h&&!g,f=d.useMemo(()=>i&&(typeof a=="function"||typeof a=="string"||a&&typeof a=="object")?a:null,[a,i]),t=C({userId:u,period:"total",accessToken:f});return e.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:[e.jsx("header",{className:"sticky top-0 z-50 w-full px-4 pt-4 pb-2 transition-all duration-300 pointer-events-none",children:e.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:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs(k,{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:[e.jsx("img",{src:"/app-icon.png",alt:"",width:24,height:24,className:"rounded-md"}),e.jsx("span",{className:"text-sm font-semibold tracking-wide text-oai-black dark:text-white uppercase",children:"Token Tracker"})]}),e.jsx("div",{className:"hidden sm:block scale-90 origin-left opacity-90 hover:opacity-100 transition-opacity",children:e.jsx(M,{})})]}),e.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-2",children:[e.jsxs(k,{to:"/leaderboard",className:"group no-underline inline-flex items-center gap-1.5 h-8 px-3 text-xs font-bold rounded-lg 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:[e.jsx(L,{size:13,strokeWidth:2.5,"aria-hidden":!0,className:"transition-transform duration-150 ease-out group-hover:scale-110 group-hover:rotate-6"}),e.jsx("span",{children:s("leaderboard.profile.nav.back")})]}),r?e.jsx("div",{className:"h-8 w-16 animate-pulse rounded-lg bg-oai-gray-200 dark:bg-white/10","aria-hidden":!0}):b?e.jsx(I,{}):e.jsx("button",{type:"button",onClick:n,className:"inline-flex h-8 min-w-[76px] items-center justify-center rounded-lg bg-oai-gray-900 dark:bg-white text-white dark:text-oai-gray-950 hover:bg-oai-gray-800 dark:hover:bg-oai-gray-100 transition-all duration-200 active:scale-[0.98] select-none text-xs font-bold shadow-sm",children:s("header.auth.sign_in_aria")})]})]})}),e.jsx("main",{className:"flex-1 pt-4 pb-10 sm:pt-6 sm:pb-16",children:e.jsx("div",{className:"mx-auto max-w-2xl px-4 sm:px-6",children:e.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:[t.loading&&e.jsx(_,{variant:"page"}),!t.loading&&t.error&&e.jsx("div",{className:"px-6 py-16 text-center",children:e.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:s("leaderboard.profile_modal.error")})}),!t.loading&&!t.error&&!t.data&&e.jsx("div",{className:"px-6 py-16 text-center",children:e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("leaderboard.profile_modal.empty")})}),!t.loading&&!t.error&&t.data&&e.jsx(E,{data:t.data,currency:m,rate:p,variant:"page"})]})})}),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-2xl 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.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(W,{theme:o,resolvedTheme:x,onSetTheme:c,direction:"up",align:"right"}),e.jsx(k,{to:"/leaderboard",className:"text-oai-gray-400 dark:text-oai-gray-500 hover:text-oai-black dark:hover:text-white transition-colors",children:s("leaderboard.profile.nav.back")})]})]})})]})}export{Q as LeaderboardProfilePage};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{u as r,N as g,s as n,r as j,i as v,L as k,at as N}from"./main-DdKVCJWa.js";import{u as L}from"./use-usage-limits-BwMwzl_A.js";import{u as E}from"./use-limits-display-prefs-CbobmO9m.js";import{C as h}from"./Card-CTEL3aXx.js";import{F as O}from"./FadeIn-BXVxQ51G.js";import{L as P}from"./LocalOnlyNotice-ilp-Q8oP.js";import"./arrow-up-right-C6REzMq8.js";import"./download-CvJjPKnF.js";const C=[3,2,3,3,2,2,3];function m({className:s}){return r.jsx("div",{className:g("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",s)})}function T(){return r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(m,{className:"h-3 w-12 shrink-0"}),r.jsx(m,{className:"flex-1 h-1.5 rounded-full min-w-0"}),r.jsx(m,{className:"h-3 w-[30px] shrink-0"}),r.jsx(m,{className:"h-3 w-6 shrink-0"})]})}function R({bars:s,index:e}){const i=e%3===0?"w-24":e%3===1?"w-20":"w-[4.5rem]";return r.jsxs("div",{className:"flex flex-col gap-1.5",children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(m,{className:"h-[14px] w-[14px] rounded shrink-0"}),r.jsx(m,{className:g("h-4",i)})]}),Array.from({length:s},(l,a)=>r.jsx(T,{},a))]})}function S(){return r.jsx(h,{children:r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx(m,{className:"h-3.5 w-28"}),C.map((s,e)=>r.jsx(R,{bars:s,index:e},e))]})})}function t(s){if(!s)return null;const e=typeof s=="number"?s*1e3:Date.parse(s);if(!Number.isFinite(e))return null;const i=e-Date.now();if(i<=0)return n("shared.time.now");const l=Math.floor(i/6e4);if(l<60)return`${l}m`;const a=Math.floor(l/60);return a<24?`${a}h`:`${Math.floor(a/24)}d`}function I(s){return s>=90?"bg-red-500":s>=70?"bg-amber-500":"bg-emerald-500"}function o({label:s,pct:e,reset:i}){const l=Math.max(0,Math.min(100,Number(e)||0)),a=Math.round(l),u=l>0&&a===0?Math.max(l,.35):l,x=l>0&&a===0?"<1":String(a);return r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400 w-12 shrink-0",children:s}),r.jsx("div",{className:"flex-1 bg-oai-gray-100 dark:bg-oai-gray-700/50 rounded-full h-1.5 overflow-hidden",children:r.jsx("div",{className:`${I(a)} rounded-full h-full transition-[width] duration-500 ease-out`,style:{width:`${u}%`,minWidth:l>0?"3px":0}})}),r.jsxs("span",{className:"text-[11px] tabular-nums text-oai-gray-500 dark:text-oai-gray-400 w-[30px] text-right shrink-0",children:[x,"%"]}),i?r.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500 w-6 text-right shrink-0",children:i}):null]})}function d({name:s,icon:e,children:i}){const a=e==="/brand-logos/cursor.svg"||e==="/brand-logos/kiro.svg"||e==="/brand-logos/copilot.svg"||e==="/brand-logos/kimi.svg"?"w-[14px] h-[14px] dark:invert":"w-[14px] h-[14px]";return r.jsxs("div",{className:"flex flex-col gap-1.5",children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[e?r.jsx("img",{src:e,alt:"",className:a}):null,r.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-oai-white",children:s})]}),i]})}const A=["claude","codex","cursor","gemini","kimi","kiro","copilot","antigravity"],M={claude:{name:"Claude",icon:"/brand-logos/claude-code.svg"},codex:{name:"Codex",icon:"/brand-logos/codex.svg"},cursor:{name:"Cursor",icon:"/brand-logos/cursor.svg"},gemini:{name:"Gemini",icon:"/brand-logos/gemini.svg"},kimi:{name:"Kimi",icon:"/brand-logos/kimi.svg"},kiro:{name:"Kiro",icon:"/brand-logos/kiro.svg"},copilot:{name:"GitHub Copilot",icon:"/brand-logos/copilot.svg"},antigravity:{name:"Antigravity",icon:"/brand-logos/antigravity.svg"}};function c({children:s,tone:e="neutral"}){const i=e==="error"?"text-red-600 dark:text-red-400":"text-oai-gray-500 dark:text-oai-gray-400";return r.jsx("div",{className:`text-[11px] leading-snug ${i}`,children:s})}function D(s,e){const i=M[s];if(!i)return null;if(!e?.configured)return r.jsx(d,{name:i.name,icon:i.icon,children:r.jsx(c,{children:n("limits.status.not_connected")})},s);if(e.error)return r.jsx(d,{name:i.name,icon:i.icon,children:r.jsx(c,{tone:"error",children:n("shared.error.prefix",{error:e.error})})},s);switch(s){case"claude":return r.jsxs(d,{name:i.name,icon:i.icon,children:[e.five_hour?r.jsx(o,{label:"5h",pct:e.five_hour.utilization,reset:t(e.five_hour.resets_at)}):null,e.seven_day?r.jsx(o,{label:"7d",pct:e.seven_day.utilization,reset:t(e.seven_day.resets_at)}):null,e.seven_day_opus?r.jsx(o,{label:"Opus",pct:e.seven_day_opus.utilization,reset:t(e.seven_day_opus.resets_at)}):null,!e.five_hour&&!e.seven_day&&!e.seven_day_opus?r.jsx(c,{children:n("limits.status.no_data")}):null]},"claude");case"codex":return r.jsxs(d,{name:i.name,icon:i.icon,children:[e.primary_window?r.jsx(o,{label:"5h",pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?r.jsx(o,{label:"7d",pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,!e.primary_window&&!e.secondary_window?r.jsx(c,{children:n("limits.status.no_data")}):null]},"codex");case"cursor":return r.jsxs(d,{name:i.name,icon:i.icon,children:[e.primary_window?r.jsx(o,{label:n("limits.label.cursor_plan"),pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?r.jsx(o,{label:n("limits.label.cursor_auto"),pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,e.tertiary_window?r.jsx(o,{label:n("limits.label.cursor_api"),pct:e.tertiary_window.used_percent,reset:t(e.tertiary_window.reset_at)}):null,!e.primary_window&&!e.secondary_window&&!e.tertiary_window?r.jsx(c,{children:n("limits.status.no_data")}):null]},"cursor");case"gemini":return r.jsxs(d,{name:i.name,icon:i.icon,children:[e.primary_window?r.jsx(o,{label:"Pro",pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?r.jsx(o,{label:"Flash",pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,e.tertiary_window?r.jsx(o,{label:"Lite",pct:e.tertiary_window.used_percent,reset:t(e.tertiary_window.reset_at)}):null,!e.primary_window&&!e.secondary_window&&!e.tertiary_window?r.jsx(c,{children:n("limits.status.no_data")}):null]},"gemini");case"kimi":return r.jsxs(d,{name:i.name,icon:i.icon,children:[e.primary_window?r.jsx(o,{label:n("limits.label.kimi_weekly"),pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?r.jsx(o,{label:n("limits.label.kimi_5h"),pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,e.tertiary_window?r.jsx(o,{label:n("limits.label.kimi_total"),pct:e.tertiary_window.used_percent,reset:t(e.tertiary_window.reset_at)}):null,e.parallel_limit?r.jsx(c,{children:n("limits.label.kimi_parallel",{count:e.parallel_limit})}):null,!e.primary_window&&!e.secondary_window&&!e.tertiary_window?r.jsx(c,{children:n("limits.status.no_data")}):null]},"kimi");case"kiro":return r.jsxs(d,{name:i.name,icon:i.icon,children:[e.primary_window?r.jsx(o,{label:n("limits.label.kiro_month"),pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?r.jsx(o,{label:n("limits.label.kiro_bonus"),pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,!e.primary_window&&!e.secondary_window?r.jsx(c,{children:n("limits.status.no_data")}):null]},"kiro");case"antigravity":return r.jsxs(d,{name:i.name,icon:i.icon,children:[e.primary_window?r.jsx(o,{label:"Claude",pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?r.jsx(o,{label:"G Pro",pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,e.tertiary_window?r.jsx(o,{label:"Flash",pct:e.tertiary_window.used_percent,reset:t(e.tertiary_window.reset_at)}):null,!e.primary_window&&!e.secondary_window&&!e.tertiary_window?r.jsx(c,{children:n("limits.status.no_data")}):null]},"antigravity");case"copilot":return r.jsxs(d,{name:i.name,icon:i.icon,children:[e.primary_window?r.jsx(o,{label:n("limits.label.copilot_premium"),pct:e.primary_window.used_percent,reset:t(e.primary_window.reset_at)}):null,e.secondary_window?r.jsx(o,{label:n("limits.label.copilot_chat"),pct:e.secondary_window.used_percent,reset:t(e.secondary_window.reset_at)}):null,!e.primary_window&&!e.secondary_window?r.jsx(c,{children:n("limits.status.no_data")}):null,e.otel_has_files||e.otel_enabled?null:r.jsx(H,{defaultDir:e.otel_default_dir})]},"copilot");default:return null}}function H({defaultDir:s}){const[e,i]=j.useState(!1),a=["export COPILOT_OTEL_ENABLED=true","export COPILOT_OTEL_EXPORTER_TYPE=file",`export COPILOT_OTEL_FILE_EXPORTER_PATH="${s||"$HOME/.copilot/otel"}/copilot-otel-$(date +%Y%m%d).jsonl"`].join(`
|
|
2
|
-
`),u=async()=>{try{await navigator.clipboard.writeText(a),i(!0),setTimeout(()=>i(!1),1600)}catch{}};return r.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:[r.jsx("div",{className:"font-medium text-oai-gray-700 dark:text-oai-gray-200",children:n("limits.copilot.otelHint.title")}),r.jsx("div",{className:"mt-0.5 leading-snug",children:n("limits.copilot.otelHint.body")}),r.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:a}),r.jsx("button",{type:"button",onClick:u,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:e?n("limits.copilot.otelHint.copied"):n("limits.copilot.otelHint.copy")})]})}function $({claude:s,codex:e,cursor:i,gemini:l,kimi:a,kiro:u,antigravity:x,copilot:b,order:p,visibility:_}){const f={claude:s,codex:e,cursor:i,gemini:l,kimi:a,kiro:u,antigravity:x,copilot:b},y=(Array.isArray(p)&&p.length>0?p:A).filter(w=>!_||_[w]!==!1).map(w=>D(w,f[w])).filter(Boolean);return r.jsx(O,{delay:.15,children:r.jsx(h,{children:r.jsxs("div",{className:"flex flex-col gap-3",children:[r.jsx("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:n("limits.panel.title")}),y.length>0?y:r.jsx(c,{children:n("limits.status.all_hidden")})]})})})}const F=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");function q(){const{data:s,error:e,isLoading:i}=L({initialRefresh:!0}),l=E();return!F&&!v()?r.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:r.jsx(P,{})}):r.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:r.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:r.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[r.jsxs("div",{className:"flex flex-row items-start justify-between gap-4 mb-8",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white mb-3",children:n("nav.limits")}),r.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:n("limits.page.subtitle")})]}),r.jsx(k,{to:"/settings","aria-label":n("limits.page.openSettings"),title:n("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:r.jsx(N,{className:"h-4 w-4","aria-hidden":!0})})]}),i?r.jsx(S,{}):r.jsxs(r.Fragment,{children:[e?r.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400",children:n("shared.error.prefix",{error:e})}):null,r.jsx($,{claude:s?.claude,codex:s?.codex,cursor:s?.cursor,gemini:s?.gemini,kimi:s?.kimi,kiro:s?.kiro,antigravity:s?.antigravity,copilot:s?.copilot,order:l.order,visibility:l.visibility})]})]})})})}export{q as LimitsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{ak as Y,av as Z,Q as ee,r,s,u as e,L as G,N as w}from"./main-DdKVCJWa.js";function te(n){const a=new URLSearchParams(n).get("next");return typeof a!="string"||a.length===0||!a.startsWith("/")||a.startsWith("//")?"/dashboard":a}const Q={google:"Google",github:"GitHub",microsoft:"Microsoft",discord:"Discord",linkedin:"LinkedIn",facebook:"Facebook",instagram:"Instagram",tiktok:"TikTok",apple:"Apple",x:"X",spotify:"Spotify"};function V(n){const a=String(n||"").trim();return Q[a]?Q[a]:a.replace(/-/g," ")}function ie(){const n=Y(),[a,A]=Z(),{enabled:o,loading:g,signedIn:f,refreshUser:C,signInWithPassword:E,signUp:M,signInWithOAuth:I,getPublicAuthConfig:F}=ee(),m=r.useMemo(()=>te(a.toString()),[a]),[l,j]=r.useState("signin"),[x,$]=r.useState(""),[h,H]=r.useState(""),[N,X]=r.useState(""),[k,p]=r.useState(!1),[O,c]=r.useState(null),[U,b]=r.useState(null),[S,B]=r.useState(!0),[_,R]=r.useState([]),[P,T]=r.useState([]),[W,z]=r.useState(8);r.useEffect(()=>{const t=a.get("insforge_status"),i=a.get("insforge_type"),u=a.get("insforge_error");t==="success"&&i==="verify_email"?b(s("login.verify_email_success")):t==="error"&&i==="verify_email"&&u&&b(s("shared.error.prefix",{error:u}))},[a]),r.useEffect(()=>{if(!o){B(!1);return}let t=!0;return(async()=>{const{data:i,error:u}=await F();t&&(u||!i?(R(["google","github"]),T([])):(R(Array.isArray(i.oAuthProviders)?i.oAuthProviders:[]),T(Array.isArray(i.customOAuthProviders)?i.customOAuthProviders:[]),typeof i.passwordMinLength=="number"&&i.passwordMinLength>0&&z(i.passwordMinLength)),B(!1))})(),()=>{t=!1}},[o,F]);const d=r.useMemo(()=>a.get("native")==="1",[a]),y=r.useMemo(()=>a.get("provider")||null,[a]);r.useEffect(()=>{if(!(!o||g)&&f){if(d){window.location.href="/auth/native-callback";return}n(m,{replace:!0})}},[o,g,f,n,m,d]),r.useEffect(()=>{o&&C()},[o,C]);const q=r.useMemo(()=>typeof window>"u"||d?"":`${window.location.origin}/`,[d]),D=r.useMemo(()=>typeof window>"u"?"":`${window.location.origin}/`,[]),J=r.useCallback(async t=>{t.preventDefault(),c(null),p(!0);try{if(l==="signup"){const{data:u,error:L}=await M({email:x.trim(),password:h,name:N.trim()||void 0,redirectTo:D});if(L){c(L.message||String(L));return}if(u?.requireEmailVerification){b(s("login.verify_email_pending")),j("signin");return}n(m,{replace:!0});return}const{error:i}=await E({email:x.trim(),password:h});if(i){c(i.message||String(i));return}n(m,{replace:!0})}finally{p(!1)}},[l,x,h,N,M,E,n,m,D]),v=r.useCallback(async t=>{c(null),p(!0);try{const{error:i}=await I(t,q);i&&c(i.message||String(i))}finally{p(!1)}},[I,q]);r.useEffect(()=>{if(d&&typeof window<"u")try{window.sessionStorage.setItem("tokentracker_native_login","1")}catch{}},[d]),r.useEffect(()=>{if(!o||g||f||S||!d||!y)return;[..._,...P].includes(y)&&v(y)},[o,g,f,S,d,y,_,P,v]);const K=r.useCallback(()=>{A(t=>{const i=new URLSearchParams(t);return i.delete("insforge_status"),i.delete("insforge_type"),i.delete("insforge_error"),i},{replace:!0}),b(null)},[A]);return o?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(G,{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-8",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"text-2xl font-semibold text-white tracking-tight",children:s("login.title")}),e.jsx("p",{className:"mt-2 text-sm text-oai-gray-500",children:s("login.subtitle")})]}),U?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:U}),e.jsx("button",{type:"button",onClick:K,className:"shrink-0 text-oai-gray-500 hover:text-white text-xs",children:s("login.dismiss")})]}):null,O?e.jsx("p",{className:"text-sm text-red-400",role:"alert",children:s("shared.error.prefix",{error:O})}):null,e.jsx("div",{className:"space-y-3",children:S?e.jsx("div",{className:"h-11 rounded-lg bg-oai-gray-900 animate-pulse","aria-hidden":!0}):e.jsxs(e.Fragment,{children:[_.map(t=>e.jsx("button",{type:"button",disabled:k,onClick:()=>v(t),className:w("w-full h-11 rounded-lg border border-oai-gray-700 bg-oai-gray-900 text-sm font-medium text-white","hover:bg-oai-gray-800 transition-colors disabled:opacity-50"),children:s("login.oauth.continue",{provider:V(t)})},t)),P.map(t=>e.jsx("button",{type:"button",disabled:k,onClick:()=>v(t),className:w("w-full h-11 rounded-lg border border-oai-gray-700 bg-oai-gray-900 text-sm font-medium text-white","hover:bg-oai-gray-800 transition-colors disabled:opacity-50"),children:s("login.oauth.continue",{provider:V(t)})},t))]})}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 flex items-center","aria-hidden":!0,children:e.jsx("span",{className:"w-full border-t border-oai-gray-800"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase tracking-wider",children:e.jsx("span",{className:"bg-oai-gray-950 px-3 text-oai-gray-600",children:s("login.divider")})})]}),e.jsxs("div",{className:"flex rounded-lg border border-oai-gray-800 p-0.5 bg-oai-gray-900/50",children:[e.jsx("button",{type:"button",className:w("flex-1 py-2 text-sm font-medium rounded-md transition-colors",l==="signin"?"bg-oai-gray-800 text-white":"text-oai-gray-500 hover:text-oai-gray-300"),onClick:()=>{j("signin"),c(null)},children:s("login.tab.sign_in")}),e.jsx("button",{type:"button",className:w("flex-1 py-2 text-sm font-medium rounded-md transition-colors",l==="signup"?"bg-oai-gray-800 text-white":"text-oai-gray-500 hover:text-oai-gray-300"),onClick:()=>{j("signup"),c(null)},children:s("login.tab.sign_up")})]}),e.jsxs("form",{onSubmit:J,className:"space-y-4",children:[l==="signup"?e.jsxs("div",{children:[e.jsx("label",{htmlFor:"login-name",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:s("login.field.name")}),e.jsx("input",{id:"login-name",type:"text",autoComplete:"name",value:N,onChange:t=>X(t.target.value),className:"w-full h-11 rounded-lg border border-oai-gray-800 bg-oai-gray-900 px-3 text-sm text-white placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500",placeholder:s("login.field.name_placeholder")})]}):null,e.jsxs("div",{children:[e.jsx("label",{htmlFor:"login-email",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:s("login.field.email")}),e.jsx("input",{id:"login-email",type:"email",autoComplete:"email",required:!0,value:x,onChange:t=>$(t.target.value),className:"w-full h-11 rounded-lg border border-oai-gray-800 bg-oai-gray-900 px-3 text-sm text-white placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"login-password",className:"block text-xs font-medium text-oai-gray-500 mb-1",children:s("login.field.password")}),e.jsx("input",{id:"login-password",type:"password",autoComplete:l==="signup"?"new-password":"current-password",required:!0,minLength:l==="signup"?W:void 0,value:h,onChange:t=>H(t.target.value),className:"w-full h-11 rounded-lg border border-oai-gray-800 bg-oai-gray-900 px-3 text-sm text-white placeholder-oai-gray-600 focus:outline-none focus:ring-2 focus:ring-oai-brand-500"}),l==="signup"?e.jsx("p",{className:"mt-1 text-xs text-oai-gray-600",children:s("login.password_hint",{min:String(W)})}):null]}),e.jsx("button",{type:"submit",disabled:k||g,className:"w-full h-11 rounded-lg bg-white text-oai-gray-950 text-sm font-semibold hover:bg-oai-gray-100 transition-colors disabled:opacity-50",children:l==="signup"?s("login.submit.sign_up"):s("login.submit.sign_in")})]})]})})]}):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(G,{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{ie as LoginPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as v,r as l,ag as J,aa as Y,ax as L,u as t,A,N as f,s,Q,am as q,ay as X,an as ee,ao as te,ap as O,az as ne,aA as ae,O as ie,R as se,J as oe,K as re,W as le,aB as ce,aC as ue,aD as de,aE as ge,E as he,aF as pe,aG as be,aH as me,aI as xe,aJ as fe,aK as ye,aL as ve,a8 as ke}from"./main-DdKVCJWa.js";import{L as je,a as G,u as Ne}from"./use-limits-display-prefs-CbobmO9m.js";import{S as k,T as j,a as m,b as Se,u as I}from"./use-native-settings-DtFQtjxR.js";import{C as we}from"./check-DF1-jcTm.js";import{u as Ce}from"./useCurrency-D8PqG8hW.js";import{C as P}from"./chevron-down-p9KAHQhU.js";import{I as Le}from"./info-R9MgHQlV.js";import{D as Ge}from"./download-CvJjPKnF.js";import"./Card-CTEL3aXx.js";const Ee=[["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"}]],Ae=v("activity",Ee);const Oe=[["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"}]],Ie=v("copy",Oe);const Pe=[["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"}]],_e=v("grip-vertical",Pe);const De=[["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"}]],Te=v("languages",De);const Me=[["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"}]],Ue=v("log-out",Me);const Re=[["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"}]],Fe=v("pencil",Re),He=e=>!e.isLayoutDirty&&e.willUpdate(!1);function E(){const e=new Set,n=new WeakMap,i=()=>e.forEach(He);return{add:a=>{e.add(a),n.set(a,a.addEventListener("willUpdate",i))},remove:a=>{e.delete(a);const o=n.get(a);o&&(o(),n.delete(a)),i()},dirty:i}}const $e=l.createContext(null);function Be(){const e=l.useRef(!1);return J(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function ze(){const e=Be(),[n,i]=l.useState(0),a=l.useCallback(()=>{e.current&&i(n+1)},[n]);return[l.useCallback(()=>Y.postRender(a),[a]),n]}const _=e=>e===!0,Ve=e=>_(e===!0)||e==="id",Ke=({children:e,id:n,inherit:i=!0})=>{const a=l.useContext(L),o=l.useContext($e),[r,c]=ze(),u=l.useRef(null),g=a.id||o;u.current===null&&(Ve(i)&&g&&(n=n?g+"-"+n:g),u.current={id:n,group:_(i)&&a.group||E()});const h=l.useMemo(()=>({...u.current,forceRender:r}),[c]);return t.jsx(L.Provider,{value:h,children:e})},We=new Set(["cursor","kiro","copilot","kimi"]);function Ze({checked:e,onChange:n,ariaLabel:i}){return t.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":i,onClick:n,className:f("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:f("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",e?"translate-x-[18px]":"translate-x-[3px]")})})}function Je({prefs:e}){const{order:n,visibility:i,toggle:a,moveToward:o}=e,[r,c]=l.useState(null),[u,g]=l.useState(null),h=d=>p=>{c(d),p.dataTransfer.effectAllowed="move",p.dataTransfer.setData("text/plain",d)},b=d=>p=>{p.preventDefault(),p.dataTransfer.dropEffect="move",r&&r!==d&&u!==d&&(g(d),o(r,d))},x=()=>{c(null),g(null)},y=d=>{d.preventDefault(),c(null),g(null)};return t.jsx(Ke,{children:t.jsx("div",{className:"flex flex-col",children:n.map(d=>{const p=i[d]!==!1,N=r===d;return t.jsxs(A.div,{layout:!0,transition:{duration:.28,ease:[.22,1,.36,1]},draggable:!0,onDragStart:h(d),onDragOver:b(d),onDragEnd:x,onDrop:y,className:f("flex items-center gap-3 py-2 rounded-md","hover:bg-oai-gray-100/60 dark:hover:bg-oai-gray-800/60",N&&"opacity-40"),style:{cursor:N?"grabbing":"grab"},children:[t.jsx(_e,{className:"h-4 w-4 shrink-0 text-oai-gray-400 dark:text-oai-gray-500",strokeWidth:1.75,"aria-hidden":!0}),t.jsx("img",{src:je[d],alt:"",width:18,height:18,className:f("h-[18px] w-[18px] shrink-0 pointer-events-none",We.has(d)&&"dark:invert"),draggable:!1}),t.jsx("span",{className:"flex-1 text-sm text-oai-gray-900 dark:text-oai-gray-200 select-none",children:G[d]}),t.jsx("div",{onMouseDown:S=>S.stopPropagation(),draggable:!1,children:t.jsx(Ze,{checked:p,onChange:()=>a(d),ariaLabel:`${s("limits.settings.toggle_visible")}: ${G[d]}`})})]},d)})})})}function Ye(e){if(!e||typeof e!="object")return"";const n=e.user_metadata&&typeof e.user_metadata=="object"?e.user_metadata:{},i=e.profile&&typeof e.profile=="object"?e.profile:{},a=n.full_name||n.name||i.name||n.user_name||n.preferred_username;return typeof a=="string"&&a.trim()?a.trim():typeof e.email=="string"&&e.email.includes("@")?e.email.split("@")[0].trim()||e.email.trim():typeof e.email=="string"?e.email.trim():""}function Qe(e){return!e||typeof e!="object"?"":typeof e.email=="string"?e.email.trim():""}function qe(e){const n=typeof e=="string"?e.trim():"";if(!n)return null;const i=n.match(/^@?([A-Za-z0-9][A-Za-z0-9-]{0,38})$/),a=n.match(/^https:\/\/github\.com\/([A-Za-z0-9][A-Za-z0-9-]{0,38})\/?$/i),o=i?.[1]||a?.[1];return o?`https://github.com/${o}`:null}function w(e,n){console.warn(`[tokentracker] settings ${e}:`,n)}function Xe(e,n,i){const[a,o]=l.useState(()=>q()),r=n&&i&&X(),c=l.useCallback(async()=>{const u=!a;if(ee(u),o(u),!!u)try{await te(()=>e())}catch(g){w("cloud sync",g)}},[a,e]);return{cloudSyncOn:a,handleCloudSyncToggle:c,showLocalCloudSync:r}}function et(e){const[n,i]=l.useState(!1),[a,o]=l.useState(!1),[r,c]=l.useState(!1),[u,g]=l.useState(!1),[h,b]=l.useState(null),[x,y]=l.useState(!1),[d,p]=l.useState(""),[N,S]=l.useState(!1),[U,C]=l.useState(""),[R,F]=l.useState(""),[H,$]=l.useState(!1),[B,z]=l.useState(null),V=l.useMemo(()=>Ye(e),[e]),K=l.useMemo(()=>Qe(e),[e]),W=l.useMemo(()=>typeof e?.id=="string"?e.id.trim():"",[e]),Z=l.useMemo(()=>({setAnonymousOn:o,setCustomDisplayName:b,setGithubUrl:C,setProfileLoading:c,setPublicProfileOn:i,setShowGithubOn:S}),[]);return{anonymousOn:a,customDisplayName:h,displayName:V,editingGithub:H,editingName:x,email:K,githubError:B,githubInput:R,githubUrl:U,loadSetters:Z,nameInput:d,profileLoading:r,profileSaving:u,publicProfileOn:n,setAnonymousOn:o,setCustomDisplayName:b,setEditingGithub:$,setEditingName:y,setGithubError:z,setGithubInput:F,setGithubUrl:C,setNameInput:p,setProfileLoading:c,setProfileSaving:g,setPublicProfileOn:i,setShowGithubOn:S,showGithubOn:N,userId:W}}function tt(e,n,i){l.useEffect(()=>{if(!n)return;let a=!0;return i.setProfileLoading(!0),(async()=>{try{const o=await O({getAccessToken:e});if(!a||!o)return;const r=await ne({accessToken:o});if(!a)return;i.setPublicProfileOn(!!r?.enabled),i.setAnonymousOn(!!r?.anonymous),r?.display_name&&i.setCustomDisplayName(r.display_name),i.setShowGithubOn(!!r?.show_github_url),i.setGithubUrl(r?.github_url||"")}catch(o){w("load public profile",o)}finally{a&&i.setProfileLoading(!1)}})(),()=>{a=!1}},[e,n,i])}function nt(e,n){return l.useCallback(async(i,{label:a,onError:o,onSuccess:r}={})=>{if(n.profileSaving)return!1;n.setProfileSaving(!0);try{const c=await O({getAccessToken:e});if(!c)return!1;const u=await ae({accessToken:c,...i});return r?.(u),!0}catch(c){return o?o(c):w(a||"mutate profile",c),!1}finally{n.setProfileSaving(!1)}},[e,n])}function at(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 it(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 i=l.useCallback(async()=>{const o=!e.publicProfileOn;await n({enabled:o},{label:"toggle public profile",onSuccess:()=>e.setPublicProfileOn(o)})},[n,e]);return{handleAnonymousToggle:l.useCallback(async()=>{const o=!e.anonymousOn;await n({anonymous:o},{label:"toggle anonymous",onSuccess:()=>e.setAnonymousOn(o)})},[n,e]),handlePublicProfileToggle:i}}function ot(e,n){const i=l.useCallback(async()=>{const o=e.nameInput.trim().slice(0,50);o&&await n({display_name:o},{label:"save display name",onSuccess:()=>{e.setCustomDisplayName(o),e.setEditingName(!1)}})},[n,e]),a=l.useCallback(()=>{e.setNameInput(e.customDisplayName||e.displayName),e.setEditingName(!0)},[e]);return{handleSaveName:i,startEditingName:a}}function rt(e,n){const i=l.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]),a=l.useCallback(async()=>{const r=qe(e.githubInput);if(e.githubInput.trim()&&!r){e.setGithubError(s("settings.account.githubUrlInvalid"));return}e.setGithubError(null),await n({github_url:r,show_github_url:!!r},{label:"save GitHub profile",onError:c=>e.setGithubError(c?.message||s("settings.account.githubUrlInvalid")),onSuccess:c=>{e.setGithubUrl(c?.github_url||r||""),e.setShowGithubOn(!!r),e.setEditingGithub(!1)}})},[n,e]),o=l.useCallback(()=>{e.setGithubInput(e.githubUrl),e.setGithubError(null),e.setEditingGithub(!0)},[e]);return{handleSaveGithub:a,handleShowGithubToggle:i,startEditingGithub:o}}function lt(){const e=Q(),n=et(e.user),i=Xe(e.getAccessToken,e.enabled,e.signedIn);tt(e.getAccessToken,e.signedIn,n.loadSetters);const a=nt(e.getAccessToken,n),o=st(n,a),r=ot(n,a),c=rt(n,a);return{...e,...i,email:n.email,handlePublicProfileToggle:o.handlePublicProfileToggle,userId:n.userId,name:at(n,{...o,...r}),github:it(n,c),profileLoading:n.profileLoading,profileSaving:n.profileSaving,publicProfileOn:n.publicProfileOn}}function D({disabled:e,onCancel:n,onSave:i,saveLabel:a=s("settings.account.save")}){return t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",onClick:i,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:a}),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:s("settings.account.cancel")})]})}function ct({nameInput:e,setEditingName:n,setNameInput:i,profileSaving:a,handleSaveName:o}){return t.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[t.jsx("input",{type:"text",value:e,onChange:r=>i(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:s("settings.account.displayName")}),t.jsx(D,{disabled:a||!e.trim(),onCancel:()=>n(!1),onSave:o,saveLabel:a?s("settings.account.saving"):void 0})]})}function ut({githubError:e,githubInput:n,handleSaveGithub:i,profileSaving:a,setEditingGithub:o,setGithubError:r,setGithubInput:c}){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:u=>{c(u.target.value),e&&r(null)},onKeyDown:u=>{u.key==="Enter"&&i(),u.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:s("settings.account.githubUrlPlaceholder")}),t.jsx(D,{disabled:a,onCancel:()=>{o(!1),r(null)},onSave:i,saveLabel:a?s("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 T({disabled:e=!1,label:n,onClick:i,title:a}){return t.jsxs("button",{type:"button",onClick:i,disabled:e,title:a,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(Fe,{className:"h-3.5 w-3.5","aria-hidden":!0}),n]})}function M({actions:e,editing:n,editor:i,hint:a,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?i:t.jsx("div",{className:"mt-0.5 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:a})]}),n?null:e]})})}function dt({name:e}){const n=e.anonymousOn?s("settings.account.displayNameDisabledWhileAnon"):void 0;return t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsx(T,{disabled:e.anonymousOn,label:s("settings.account.edit"),onClick:e.startEditingName,title:n}),t.jsx(j,{checked:!e.anonymousOn,onChange:e.handleAnonymousToggle,disabled:e.profileLoading||e.profileSaving,ariaLabel:s("settings.account.displayName")})]})}function gt({name:e}){const{anonymousOn:n,customDisplayName:i,displayName:a,editingName:o,handleAnonymousToggle:r,handleSaveName:c,nameInput:u,profileLoading:g,profileSaving:h,setEditingName:b,setNameInput:x,startEditingName:y}=e,d=n?s("settings.account.displayNameAnonymousHint"):i||a;return t.jsx(M,{label:s("settings.account.displayName"),editing:o,hint:d,editor:t.jsx(ct,{nameInput:u,setEditingName:b,setNameInput:x,profileSaving:h,handleSaveName:c}),actions:t.jsx(dt,{name:e})})}function ht({github:e}){const{editingGithub:n,githubError:i,githubInput:a,githubUrl:o,handleSaveGithub:r,handleShowGithubToggle:c,profileLoading:u,profileSaving:g,setEditingGithub:h,setGithubError:b,setGithubInput:x,showGithubOn:y,startEditingGithub:d}=e;return t.jsx(M,{label:s("settings.account.githubUrl"),editing:n,hint:o||s("settings.account.githubUrlHint"),editor:t.jsx(ut,{githubError:i,githubInput:a,handleSaveGithub:r,profileSaving:g,setEditingGithub:h,setGithubError:b,setGithubInput:x}),actions:t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsx(T,{label:s("settings.account.edit"),onClick:d}),t.jsx(j,{checked:y,onChange:c,disabled:u||g,ariaLabel:s("settings.account.githubUrl")})]})})}function pt(){const{openLoginModal:e}=ie();return t.jsx(k,{title:s("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:s("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:s("settings.account.signIn")})]})})}function bt({name:e,github:n}){return t.jsxs(t.Fragment,{children:[t.jsx(gt,{name:e}),t.jsx(ht,{github:n})]})}function mt(){const e=lt();return e.enabled?e.signedIn?t.jsxs(k,{title:s("settings.section.account"),subtitle:e.email||e.name.customDisplayName||e.name.displayName,action:t.jsx(ft,{onSignOut:e.signOut}),children:[t.jsx(xt,{userId:e.userId}),t.jsx(yt,{settings:e}),t.jsx(vt,{checked:e.publicProfileOn,disabled:e.profileLoading||e.profileSaving,onChange:e.handlePublicProfileToggle}),t.jsx(kt,{visible:e.publicProfileOn,name:e.name,github:e.github})]}):t.jsx(pt,{}):null}function xt({userId:e}){const[n,i]=se.useState(!1);if(!e)return null;const a=async()=>{try{if(typeof navigator>"u"||!navigator.clipboard?.writeText)return;await navigator.clipboard.writeText(e),i(!0),globalThis.setTimeout(()=>i(!1),1200)}catch{i(!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:s("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:a,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":s("settings.account.copyUserId"),children:[n?t.jsx(we,{className:"h-3.5 w-3.5","aria-hidden":!0}):t.jsx(Ie,{className:"h-3.5 w-3.5","aria-hidden":!0}),n?s("settings.account.copied"):s("settings.account.copy")]})]})}function ft({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(Ue,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.account.signOut")]})}function yt({settings:e}){return e.showLocalCloudSync?t.jsx(m,{label:s("settings.account.cloudSync"),hint:s("settings.account.cloudSyncHint"),control:t.jsx(j,{checked:e.cloudSyncOn,onChange:e.handleCloudSyncToggle,ariaLabel:s("settings.account.cloudSync")})}):null}function vt({checked:e,disabled:n,onChange:i}){return t.jsx(m,{label:s("settings.account.publicProfile"),hint:s("settings.account.publicProfileHint"),control:t.jsx(j,{checked:e,onChange:i,disabled:n,ariaLabel:s("settings.account.publicProfile")})})}function kt({visible:e,name:n,github:i}){return t.jsx(oe,{initial:!1,children:e?t.jsx(A.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(bt,{name:n,github:i})},"public-profile-fields"):null})}function jt(){return[{value:"light",label:s("settings.appearance.theme.light"),Icon:ce},{value:"dark",label:s("settings.appearance.theme.dark"),Icon:ue},{value:"system",label:s("settings.appearance.theme.system"),Icon:de}]}function Nt(){return[{value:pe,label:s("settings.appearance.language.system")},{value:be,label:s("settings.appearance.language.english")},{value:me,label:s("settings.appearance.language.chinese")},{value:xe,label:s("settings.appearance.language.traditional_chinese")},{value:fe,label:s("settings.appearance.language.japanese")},{value:ye,label:s("settings.appearance.language.korean")}]}function St(e){if(!e)return null;try{const n=new Date(e);return Number.isNaN(n.getTime())?null:n.toLocaleString()}catch{return null}}function wt(e,n){const i=s(`settings.appearance.currency.rate_source.${e}`),a=St(n),o=a?s("settings.appearance.currency.rate_updated",{when:a}):s("settings.appearance.currency.rate_never");return`${i} · ${o}`}function Ct({locale:e,setLocale:n}){const i=Nt();return t.jsxs("div",{className:"relative inline-flex",children:[t.jsx(Te,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0}),t.jsx("select",{value:e,onChange:a=>n(a.target.value),"aria-label":s("settings.appearance.language.label"),className:f("appearance-none rounded-lg border border-oai-gray-200 bg-white py-1.5 pl-8 pr-8 text-xs font-medium text-oai-black","transition-colors hover:bg-oai-gray-50 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:bg-oai-gray-800"),children:i.map(a=>t.jsx("option",{value:a.value,children:a.label},a.value))}),t.jsx(P,{className:"pointer-events-none absolute right-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})]})}function Lt({currency:e,setCurrency:n}){const i=ge();return t.jsxs("div",{className:"relative inline-flex",children:[t.jsx("select",{value:e,onChange:a=>n(a.target.value),"aria-label":s("settings.appearance.currency.label"),className:f("appearance-none rounded-lg border border-oai-gray-200 bg-white py-1.5 pl-3 pr-8 text-xs font-medium text-oai-black","transition-colors hover:bg-oai-gray-50 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:bg-oai-gray-800"),children:i.map(a=>t.jsx("option",{value:a.code,children:s(a.labelKey)},a.code))}),t.jsx(P,{className:"pointer-events-none absolute right-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})]})}function Gt({currency:e,rate:n,rateSource:i,rateFetchedAt:a}){if(e===he)return t.jsx(t.Fragment,{children:s("settings.appearance.currency.hint")});const o=wt(i,a);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(Le,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})}function Et(){const{theme:e,setTheme:n}=re(),{locale:i,setLocale:a}=le(),{currency:o,rate:r,rateSource:c,rateFetchedAt:u,setCurrency:g}=Ce();return t.jsxs(k,{title:s("settings.section.appearance"),children:[t.jsx(m,{label:s("settings.appearance.theme.label"),hint:s("settings.appearance.theme.hint"),control:t.jsx(Se,{options:jt(),value:e,onChange:n})}),t.jsx(m,{label:s("settings.appearance.language.label"),hint:s("settings.appearance.language.hint"),control:t.jsx(Ct,{locale:i,setLocale:a})}),t.jsx(m,{label:s("settings.appearance.currency.label"),hint:t.jsx(Gt,{currency:o,rate:r,rateSource:c,rateFetchedAt:u}),control:t.jsx(Lt,{currency:o,setCurrency:g})})]})}function At(){const{available:e,settings:n,setSetting:i,runAction:a}=I();if(!e)return null;const o=!!n?.launchAtLogin,r=n?.launchAtLoginSupported!==!1,c=n?.updateStatus||null,u=!!n?.updateBusy,g=!!n?.isSyncing;return t.jsxs(k,{title:s("settings.section.menubar"),children:[r?t.jsx(m,{label:s("settings.menubar.launchAtLogin"),hint:s("settings.menubar.launchAtLoginHint"),control:t.jsx(j,{checked:o,onChange:()=>i("launchAtLogin",!o),ariaLabel:s("settings.menubar.launchAtLogin")})}):null,t.jsx(m,{label:s("settings.menubar.syncNow"),hint:s("settings.menubar.syncNowHint"),control:t.jsxs("button",{type:"button",onClick:()=>a("syncNow"),disabled:g,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(ve,{className:f("h-3.5 w-3.5",g&&"animate-spin"),"aria-hidden":!0}),g?s("settings.menubar.syncing"):s("settings.menubar.syncNow")]})}),t.jsx(m,{label:s("settings.menubar.updates"),hint:c||void 0,control:t.jsxs("button",{type:"button",onClick:()=>a("checkForUpdates"),disabled:u,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(Ge,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.menubar.checkUpdates")]})})]})}function Ot(){const{available:e,settings:n,runAction:i}=I(),a=e&&n?.version;return t.jsxs("div",{className:"mt-6 flex flex-wrap items-center justify-center gap-2 text-xs text-oai-gray-500 dark:text-oai-gray-500",children:[a?t.jsxs(t.Fragment,{children:[t.jsxs("span",{children:["TokenTrackerBar v",n.version]}),t.jsx("span",{"aria-hidden":!0,children:"·"}),t.jsx("button",{type:"button",onClick:()=>i("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:"·"})]}):null,t.jsxs("a",{href:ke,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(Ae,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.footer.statusPage")]})]})}function Ht(){const e=Ne();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 max-w-3xl px-4 sm:px-6",children:[t.jsxs("div",{className:"mb-8",children:[t.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:s("settings.page.title")}),t.jsx("p",{className:"mt-2 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("settings.page.subtitle")})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsx(Et,{}),t.jsx(At,{}),t.jsx(mt,{}),t.jsx(k,{title:s("settings.section.limits"),children:t.jsx(Je,{prefs:e})})]}),t.jsx(Ot,{})]})})})}export{Ht as SettingsPage};
|