tokentracker-cli 0.88.5 → 0.88.7
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/{AchievementBadge-BwA7jTi0.js → AchievementBadge-m7oaBLpH.js} +1 -1
- package/dashboard/dist/assets/{AchievementsPage-DXxsvwVX.js → AchievementsPage-BHHh4VjM.js} +2 -2
- package/dashboard/dist/assets/{AchievementsSection-BjtoMD0l.js → AchievementsSection-CGLNe_1p.js} +1 -1
- package/dashboard/dist/assets/{BadgeDetailModal-DLQ0vQsp.js → BadgeDetailModal-v1DGF6EM.js} +1 -1
- package/dashboard/dist/assets/{Card-DyzEgcah.js → Card-C16SqIR8.js} +1 -1
- package/dashboard/dist/assets/{ClawdAnimated-CFqKYrQD.js → ClawdAnimated-Bj3ptLJv.js} +1 -1
- package/dashboard/dist/assets/{CommandPalette-C0hnaAiC.js → CommandPalette-BaegDLAM.js} +1 -1
- package/dashboard/dist/assets/{CommunityStatsModal-CkT8e5A_.js → CommunityStatsModal-CThxVFG0.js} +1 -1
- package/dashboard/dist/assets/{ConfirmModal-CNgB03kI.js → ConfirmModal-C0sP3Ktk.js} +1 -1
- package/dashboard/dist/assets/{Controls-DbUsLnx1.js → Controls-C8usK6RW.js} +1 -1
- package/dashboard/dist/assets/DashboardPage-DbzbT_cY.js +1 -0
- package/dashboard/dist/assets/{DevicePage-DutY0nCU.js → DevicePage-Cu4qqRcB.js} +1 -1
- package/dashboard/dist/assets/DialogClose-DVo3jJb6.js +1 -0
- package/dashboard/dist/assets/DialogDescription-zf3KGPP3.js +1 -0
- package/dashboard/dist/assets/DialogTitle-C1UOMgTZ.js +1 -0
- package/dashboard/dist/assets/{FadeIn-Drk10vEk.js → FadeIn-CuQlQrvO.js} +1 -1
- package/dashboard/dist/assets/{HeaderGithubStar-6MBhnUjH.js → HeaderGithubStar-BTt2612H.js} +1 -1
- package/dashboard/dist/assets/{HoverTooltip-scdepNr_.js → HoverTooltip-CHdLolcf.js} +1 -1
- package/dashboard/dist/assets/{IpCheckPage-BpseXtk3.js → IpCheckPage-BFz8hr_3.js} +1 -1
- package/dashboard/dist/assets/{LandingPage-CoYVfYbz.js → LandingPage-CTyNSAYl.js} +2 -2
- package/dashboard/dist/assets/{LeaderboardAvatar-EuvTK23U.js → LeaderboardAvatar-CBdOXZWk.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardPage-BhiuafFm.js → LeaderboardPage-DStx51Bj.js} +2 -2
- package/dashboard/dist/assets/{LeaderboardProfileModal-DXFyF8kH.js → LeaderboardProfileModal-CtxgJR07.js} +4 -4
- package/dashboard/dist/assets/{LeaderboardProfilePage-BYNNp2uv.js → LeaderboardProfilePage-DrpsHTdZ.js} +3 -3
- package/dashboard/dist/assets/{LimitsPage-cZWHDYE8.js → LimitsPage-m_itA-7d.js} +1 -1
- package/dashboard/dist/assets/{LocalOnlyNotice-BWpGvI0H.js → LocalOnlyNotice-A62wFwYT.js} +1 -1
- package/dashboard/dist/assets/{LoginCard-DgY-avZX.js → LoginCard-DFJugNa-.js} +1 -1
- package/dashboard/dist/assets/{LoginModal-CvCGCwNR.js → LoginModal-DF4BOwS6.js} +1 -1
- package/dashboard/dist/assets/{LoginPage-iniAaych.js → LoginPage-BxFhfitr.js} +1 -1
- package/dashboard/dist/assets/{PetPage-vGfqy28a.js → PetPage-l4fkRsf1.js} +1 -1
- package/dashboard/dist/assets/PopoverPopup-y-OAHy4v.js +1 -0
- package/dashboard/dist/assets/{ProviderIcon-BWkcPxs4.js → ProviderIcon-DwoPHz27.js} +1 -1
- package/dashboard/dist/assets/{ResetPasswordPage-N9l0zdxc.js → ResetPasswordPage-CCDj94rl.js} +1 -1
- package/dashboard/dist/assets/{SegmentedControl-DrEbXe7M.js → SegmentedControl-lEKPzZlV.js} +1 -1
- package/dashboard/dist/assets/Select-DoyUBoxn.js +1 -0
- package/dashboard/dist/assets/SelectItemText-K8Vzn1Dd.js +1 -0
- package/dashboard/dist/assets/{ServiceStatusPage-Yfs-MN1n.js → ServiceStatusPage-Cqyo7OtW.js} +1 -1
- package/dashboard/dist/assets/{SessionsPage-CFLLOabH.js → SessionsPage-BELC-8aJ.js} +1 -1
- package/dashboard/dist/assets/SettingsPage-C6Og4tMS.js +1 -0
- package/dashboard/dist/assets/SkillsPage-BKKgpXc_.js +1 -0
- package/dashboard/dist/assets/{TokenGalaxy-De4JZnzi.js → TokenGalaxy-DoSCQSpY.js} +1 -1
- package/dashboard/dist/assets/ToolbarRootContext-GoQP9LXi.js +1 -0
- package/dashboard/dist/assets/{TrendMonitor-DpSvoA86.js → TrendMonitor-BHE1KkJ7.js} +1 -1
- package/dashboard/dist/assets/{WidgetsPage-D33E-kD4.js → WidgetsPage-CHBzNb19.js} +1 -1
- package/dashboard/dist/assets/{WrappedPage-CjqchIRC.js → WrappedPage-CW_kqVoY.js} +1 -1
- package/dashboard/dist/assets/{__vite-browser-external-CJKqcpDH.js → __vite-browser-external-BgeLzJ0q.js} +18 -18
- package/dashboard/dist/assets/{agent-logos-CEuH8m2p.js → agent-logos-BWeWRlms.js} +1 -1
- package/dashboard/dist/assets/{arrow-up-right-UeW7i2I9.js → arrow-up-right-5GGSSEKW.js} +1 -1
- package/dashboard/dist/assets/{check-BEWd6UpN.js → check-g6Fq4TSB.js} +1 -1
- package/dashboard/dist/assets/{chevron-right-WF-BGKcD.js → chevron-right-DjPuavEP.js} +1 -1
- package/dashboard/dist/assets/{copy-BIsDzDWe.js → copy-BAMl60zT.js} +1 -1
- package/dashboard/dist/assets/{download-D5IMcY87.js → download-BQPhL4h5.js} +1 -1
- package/dashboard/dist/assets/{external-link-DlymDAT1.js → external-link-CU3XKMbZ.js} +1 -1
- package/dashboard/dist/assets/{flame-Coo1IlXx.js → flame-B85YY_rB.js} +1 -1
- package/dashboard/dist/assets/{format-tokens-71YneamJ.js → format-tokens-DDxlnhNV.js} +1 -1
- package/dashboard/dist/assets/{icons-C-KFwLuS.js → icons-D1e1TWTe.js} +1 -1
- package/dashboard/dist/assets/{index-Os1o_T4l.js → index-BZ2hkHKk.js} +1 -1
- package/dashboard/dist/assets/{index-OwlsZ-D0.js → index-CWMkVmon.js} +1 -1
- package/dashboard/dist/assets/{index-lKnLA6Pd.js → index-hKOAzfwu.js} +1 -1
- package/dashboard/dist/assets/{index-DZLIheW-.js → index-sQl-P7u5.js} +1 -1
- package/dashboard/dist/assets/{info-JYfDozdx.js → info-DlSYpCFm.js} +1 -1
- package/dashboard/dist/assets/{limits-providers-CRgPyf-x.js → limits-providers-DS5EIbJK.js} +1 -1
- package/dashboard/dist/assets/{link-2-CdJhL0K2.js → link-2-DbEVoNk-.js} +1 -1
- package/dashboard/dist/assets/{loader-circle-cVisHw3G.js → loader-circle-CqmzGIX-.js} +1 -1
- package/dashboard/dist/assets/{maximize-2-GoRVXObs.js → maximize-2-Ce8X8kHQ.js} +1 -1
- package/dashboard/dist/assets/{modifiers.esm-ojj_Qc0M.js → modifiers.esm-BQNRpVcA.js} +1 -1
- package/dashboard/dist/assets/module-BRJxSJmz.js +3 -0
- package/dashboard/dist/assets/{monitor-smartphone-3_sFTPdn.js → monitor-smartphone-8drugZmh.js} +1 -1
- package/dashboard/dist/assets/provider-display-BayTojFu.js +42 -0
- package/dashboard/dist/assets/{react-BHsz7M69.js → react-BfgySeLu.js} +1 -1
- package/dashboard/dist/assets/{search-DMRWVfdt.js → search-BkGUxlXI.js} +1 -1
- package/dashboard/dist/assets/{skills-api-DXQbySbF.js → skills-api-D80JxFc1.js} +1 -1
- package/dashboard/dist/assets/{sortable.esm-D0uuKRuC.js → sortable.esm-SjRQ4Ehw.js} +1 -1
- package/dashboard/dist/assets/store-B3WkWBgn.js +1 -0
- package/dashboard/dist/assets/{terminal-7OYQbwhF.js → terminal-CIvEvMau.js} +1 -1
- package/dashboard/dist/assets/{trash-2-C4iKjhsk.js → trash-2-BZclE0mU.js} +1 -1
- package/dashboard/dist/assets/{use-community-stats-furP_fZV.js → use-community-stats-ChaFzJoW.js} +1 -1
- package/dashboard/dist/assets/{use-limits-display-prefs-BYFhDgc5.js → use-limits-display-prefs-2LALdqvT.js} +1 -1
- package/dashboard/dist/assets/{use-ordered-list-DX5hOerp.js → use-ordered-list-10Nmxw1I.js} +1 -1
- package/dashboard/dist/assets/use-reduced-motion-J12KnTgP.js +1 -0
- package/dashboard/dist/assets/{use-session-efficiency-pref-DfZjbzAF.js → use-session-efficiency-pref-CqPK4jX1.js} +1 -1
- package/dashboard/dist/assets/{use-transform-BRDsFC1X.js → use-transform-s6og1tg9.js} +1 -1
- package/dashboard/dist/assets/{use-usage-limits-CVWHqcA_.js → use-usage-limits-jyRJ_kl9.js} +1 -1
- package/dashboard/dist/assets/{useCurrency-BPhEg_fN.js → useCurrency-hZfdhfqK.js} +1 -1
- package/dashboard/dist/assets/useScrollLock-DFF4vpw2.js +1 -0
- package/dashboard/dist/assets/{useTokenFormat-DufvECQn.js → useTokenFormat-DaVdoRvh.js} +1 -1
- package/dashboard/dist/assets/{zap-CZpfMecN.js → zap-B1XMdyCV.js} +1 -1
- package/dashboard/dist/index.html +1 -1
- package/dashboard/dist/ip-check.html +1 -1
- package/dashboard/dist/leaderboard.html +1 -1
- package/dashboard/dist/share.html +1 -1
- package/package.json +2 -2
- package/src/lib/opencode-go-limits.js +122 -13
- package/src/lib/pricing/seed-snapshot.json +1 -1
- package/dashboard/dist/assets/DashboardPage-CHk4QUs0.js +0 -1
- package/dashboard/dist/assets/DialogClose-CSLpyzHr.js +0 -1
- package/dashboard/dist/assets/DialogDescription-DZliagFg.js +0 -1
- package/dashboard/dist/assets/DialogTitle-CU0DrIQb.js +0 -1
- package/dashboard/dist/assets/PopoverPopup-8x9t9gD4.js +0 -1
- package/dashboard/dist/assets/Select-8nxnFfns.js +0 -1
- package/dashboard/dist/assets/SelectItemText-D-pVcs50.js +0 -1
- package/dashboard/dist/assets/SettingsPage-CHSgqFdF.js +0 -1
- package/dashboard/dist/assets/SkillsPage-BD5RT5eb.js +0 -1
- package/dashboard/dist/assets/ToolbarRootContext-DM-WFqY6.js +0 -1
- package/dashboard/dist/assets/module-CzlIpkuW.js +0 -2
- package/dashboard/dist/assets/provider-display-DTwJBj-L.js +0 -42
- package/dashboard/dist/assets/store-peMgm1Ye.js +0 -1
- package/dashboard/dist/assets/use-reduced-motion-TCgQmfAJ.js +0 -1
- package/dashboard/dist/assets/useScrollLock-DXsFDMbK.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a_ as Xe,b8 as Ue,b9 as le,ba as Ke,V as ne,aZ as ge,r as m,bb as J,bc as me,bd as he,be as oe,aG as be,bf as We,bg as we,aH as $,A as Q,bh as W,a5 as ue,aA as pe,aI as qe,bi as Ee,bj as $e,E as ze,bk as Qe,bl as Te,$ as q,j as V,aF as Je,a0 as Me,b1 as Ze,bm as et,bn as tt,bo as nt,bp as ot,y as st,z as Ae,bq as rt,br as ye,aD as it,bs as at,bt as ct,aE as lt,aC as ut,bu as ft,aB as dt}from"./__vite-browser-external-CJKqcpDH.js";import{n as Pe,o as Le,q as He,r as Ce,v as se,P as pt,w as gt,k as mt,s as ht,x as Et,y as Tt,e as Pt,f as Ct,g as vt,h as bt,a as Be,j as Rt,u as St,z as Ot,A as It,t as Mt,B as yt,I as xt,D as Ft,c as kt,d as wt,b as At,p as Lt}from"./useScrollLock-DXsFDMbK.js";import{c as Ht,p as Bt,a as Dt}from"./store-peMgm1Ye.js";import{a as jt,b as _t,c as Nt,d as Vt,e as Yt,f as Gt,g as Xt,h as Ut}from"./ToolbarRootContext-DM-WFqY6.js";function Kt(e,n){return n!=null&&!Pe(n)?0:typeof e=="function"?e():e}function ve(e,n,t){const l=Kt(e,t);return typeof l=="number"?l:l?.[n]}function xe(e){return typeof e=="function"?e():e}function De(e,n){return n||e==="click"||e==="mousedown"}function Wt(e){return e?.includes("mouse")&&e!=="mousedown"}class Re{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new le,this.restTimeout=new le,this.handleCloseOptions=void 0}static create(){return new Re}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}const fe=new WeakMap;function de(e){if(!e.performedPointerEventsMutation)return;const n=e.pointerEventsScopeElement;n&&fe.get(n)===e&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),fe.delete(n)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function je(e,n){const{scopeElement:t,referenceElement:l,floatingElement:i}=n,o=fe.get(t);o&&o!==e&&de(o),de(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=t,e.pointerEventsReferenceElement=l,e.pointerEventsFloatingElement=i,fe.set(t,e),t.style.pointerEvents="none",l.style.pointerEvents="auto",i.style.pointerEvents="auto"}function _e(e){const n=e.context.dataRef.current,t=Xe(()=>n.hoverInteractionState??Re.create()).current;return n.hoverInteractionState||(n.hoverInteractionState=t),Ue(n.hoverInteractionState.disposeEffect),n.hoverInteractionState}function qt(e,n={}){const{enabled:t=!0,closeDelay:l=0,nodeId:i}=n,o="rootStore"in e?e.rootStore:e,p=o.useState("open"),E=o.useState("floatingElement"),S=o.useState("domReferenceElement"),{dataRef:c}=o.context,r=Le(),O=He(),h=_e(o),N=Ke(),u=ne(()=>De(c.current.openEvent?.type,h.interactedInside)),B=ne(()=>Wt(c.current.openEvent?.type)),g=ne(()=>{de(h)});ge(()=>{p||(h.pointerType=void 0,h.restTimeoutPending=!1,h.interactedInside=!1,g())},[p,h,g]),m.useEffect(()=>g,[g]),ge(()=>{if(t&&p&&h.handleCloseOptions?.blockPointerEvents&&B()&&J(S)&&E){const x=S,a=E,d=me(E),F=r?.nodesRef.current.find(b=>b.id===O)?.context?.elements.floating;F&&(F.style.pointerEvents="");const H=h.pointerEventsScopeElement!==a?h.pointerEventsScopeElement:null,P=F!==a?F:null,v=h.handleCloseOptions?.getScope?.()??H??P??x.closest("[data-rootownerid]")??d.body;return je(h,{scopeElement:v,referenceElement:x,floatingElement:a}),()=>{g()}}},[t,p,S,E,h,B,r,O,g]),m.useEffect(()=>{if(!t)return;function x(){return!!(r&&O&&Ce(r.nodesRef.current,O).length>0)}function a(b){const M=ve(l,"close",h.pointerType),j=()=>{o.setOpen(!1,Q(W,b)),r?.events.emit("floating.closed",b)};M?h.openChangeTimeout.start(M,j):(h.openChangeTimeout.clear(),j())}function d(b){const M=be(b);if(!We(M)){h.interactedInside=!1;return}h.interactedInside=M?.closest("[aria-haspopup]")!=null}function F(){h.openChangeTimeout.clear(),N.clear(),r?.events.off("floating.closed",P),g()}function H(b){if(x()&&r){r.events.on("floating.closed",P);return}if(we(b.relatedTarget,o.context.triggerElements))return;const M=c.current.floatingContext?.nodeId??i,j=b.relatedTarget;if(!(r&&M&&J(j)&&Ce(r.nodesRef.current,M,!1).some(X=>$(X.context?.elements.floating,j)))){if(h.handler){h.handler(b);return}g(),B()&&!u()&&a(b)}}function P(b){!r||!O||x()||N.start(0,()=>{r.events.off("floating.closed",P),o.setOpen(!1,Q(W,b)),r.events.emit("floating.closed",b)})}const v=E;return he(v&&oe(v,"mouseenter",F),v&&oe(v,"mouseleave",H),v&&oe(v,"pointerdown",d,!0),()=>{r?.events.off("floating.closed",P)})},[t,E,o,c,l,i,B,u,g,h,r,O,N])}const $t={current:null};function zt(e,n={}){const{enabled:t=!0,delay:l=0,handleClose:i=null,mouseOnly:o=!1,restMs:p=0,move:E=!0,triggerElementRef:S=$t,externalTree:c,isActiveTrigger:r=!0,getHandleCloseContext:O,isClosing:h,shouldOpen:N}=n,u="rootStore"in e?e.rootStore:e,{dataRef:B,events:g}=u.context,x=Le(c),a=_e(u),d=m.useRef(!1),F=se(i),H=se(l),P=se(p),v=se(t),b=se(N),M=se(h),j=ne(()=>De(B.current.openEvent?.type,a.interactedInside)),G=ne(()=>b.current?.()!==!1),X=ne((s,T,A)=>{const R=u.context.triggerElements;if(R.hasElement(T))return!s||!$(s,T);if(!J(A))return!1;const f=A;return R.hasMatchingElement(L=>$(L,f))&&(!s||!$(s,f))}),_=ne(()=>{if(!a.handler)return;me(u.select("domReferenceElement")).removeEventListener("mousemove",a.handler),a.handler=void 0}),w=ne(()=>{de(a)});return r&&(a.handleCloseOptions=F.current?.__options),m.useEffect(()=>_,[_]),m.useEffect(()=>{if(!t)return;function s(T){T.open?d.current=!1:(d.current=T.reason===W,_(),a.openChangeTimeout.clear(),a.restTimeout.clear(),a.blockMouseMove=!0,a.restTimeoutPending=!1)}return g.on("openchange",s),()=>{g.off("openchange",s)}},[t,g,a,_]),m.useEffect(()=>{if(!t)return;function s(f,L=!0){const D=ve(H.current,"close",a.pointerType);D?a.openChangeTimeout.start(D,()=>{u.setOpen(!1,Q(W,f)),x?.events.emit("floating.closed",f)}):L&&(a.openChangeTimeout.clear(),u.setOpen(!1,Q(W,f)),x?.events.emit("floating.closed",f))}const T=S.current??(r?u.select("domReferenceElement"):null);if(!J(T))return;function A(f){if(a.openChangeTimeout.clear(),a.blockMouseMove=!1,o&&!Pe(a.pointerType))return;const L=xe(P.current),D=ve(H.current,"open",a.pointerType),Y=be(f),U=f.currentTarget??null,I=u.select("domReferenceElement");let k=U;if(J(Y)&&!u.context.triggerElements.hasElement(Y)){for(const Ie of u.context.triggerElements.elements())if($(Ie,Y)){k=Ie;break}}J(U)&&J(I)&&!u.context.triggerElements.hasElement(U)&&$(U,I)&&(k=I);const C=k==null?!1:X(I,k,Y),z=u.select("open"),Z=M.current?.()??u.select("transitionStatus")==="ending",K=!z&&Z&&d.current,ee=!C&&J(k)&&J(I)&&$(I,k)&&K,te=L>0&&!D,Ge=C&&(z||K)||ee,Oe=!z||C;if(Ge){G()&&u.setOpen(!0,Q(W,f,k));return}te||(D?a.openChangeTimeout.start(D,()=>{Oe&&G()&&u.setOpen(!0,Q(W,f,k))}):Oe&&G()&&u.setOpen(!0,Q(W,f,k)))}function R(f){if(j()){w();return}_();const L=u.select("domReferenceElement"),D=me(L);a.restTimeout.clear(),a.restTimeoutPending=!1;const Y=B.current.floatingContext??O?.();if(we(f.relatedTarget,u.context.triggerElements))return;if(F.current&&Y){u.select("open")||a.openChangeTimeout.clear();const I=S.current;a.handler=F.current({...Y,tree:x,x:f.clientX,y:f.clientY,onClose(){w(),_(),v.current&&!j()&&I===u.select("domReferenceElement")&&s(f,!0)}}),D.addEventListener("mousemove",a.handler),a.handler(f);return}(a.pointerType!=="touch"||!$(u.select("floatingElement"),f.relatedTarget))&&s(f)}return E?he(oe(T,"mousemove",A,{once:!0}),oe(T,"mouseenter",A),oe(T,"mouseleave",R)):he(oe(T,"mouseenter",A),oe(T,"mouseleave",R))},[_,w,B,H,u,t,F,a,r,X,j,o,E,P,S,x,v,O,M,G]),m.useMemo(()=>{if(!t)return;function s(T){a.pointerType=T.pointerType}return{onPointerDown:s,onPointerEnter:s,onMouseMove(T){const{nativeEvent:A}=T,R=T.currentTarget,f=u.select("domReferenceElement"),L=u.select("open"),D=X(f,R,T.target);if(o&&!Pe(a.pointerType))return;if(L&&D&&a.handleCloseOptions?.blockPointerEvents){const I=u.select("floatingElement");if(I){const k=a.handleCloseOptions?.getScope?.()??R.ownerDocument.body;je(a,{scopeElement:k,referenceElement:R,floatingElement:I})}}const Y=xe(P.current);if(L&&!D||Y===0||!D&&a.restTimeoutPending&&T.movementX**2+T.movementY**2<2)return;a.restTimeout.clear();function U(){if(a.restTimeoutPending=!1,j())return;const I=u.select("open");!a.blockMouseMove&&(!I||D)&&G()&&u.setOpen(!0,Q(W,A,R))}a.pointerType==="touch"?ue.flushSync(()=>{U()}):D&&L?U():(a.restTimeoutPending=!0,a.restTimeout.start(Y,U))}}},[t,a,j,X,o,u,P,G])}const Fe=.1,Qt=Fe*Fe,y=.5;function ie(e,n,t,l,i,o){return l>=n!=o>=n&&e<=(i-t)*(n-l)/(o-l)+t}function ae(e,n,t,l,i,o,p,E,S,c){let r=!1;return ie(e,n,t,l,i,o)&&(r=!r),ie(e,n,i,o,p,E)&&(r=!r),ie(e,n,p,E,S,c)&&(r=!r),ie(e,n,S,c,t,l)&&(r=!r),r}function Jt(e,n,t){return e>=t.x&&e<=t.x+t.width&&n>=t.y&&n<=t.y+t.height}function ce(e,n,t,l,i,o){const p=Math.min(t,i),E=Math.max(t,i),S=Math.min(l,o),c=Math.max(l,o);return e>=p&&e<=E&&n>=S&&n<=c}function Zt(e={}){const{blockPointerEvents:n=!1}=e,t=new le,l=({x:i,y:o,placement:p,elements:E,onClose:S,nodeId:c,tree:r})=>{const O=p?.split("-")[0];let h=!1,N=null,u=null,B=typeof performance<"u"?performance.now():0;function g(a,d){const F=performance.now(),H=F-B;if(N===null||u===null||H===0)return N=a,u=d,B=F,!1;const P=a-N,v=d-u,b=P*P+v*v,M=H*H*Qt;return N=a,u=d,B=F,b<M}function x(){t.clear(),S()}return function(d){t.clear();const F=E.domReference,H=E.floating;if(!F||!H||O==null||i==null||o==null)return;const{clientX:P,clientY:v}=d,b=be(d),M=d.type==="mouseleave",j=$(H,b),G=$(F,b);if(j&&(h=!0,!M))return;if(G&&(h=!1,!M)){h=!0;return}if(M&&J(d.relatedTarget)&&$(H,d.relatedTarget))return;function X(){return!!(r&&Ce(r.nodesRef.current,c).length>0)}function _(){X()||x()}if(X())return;const w=F.getBoundingClientRect(),s=H.getBoundingClientRect(),T=i>s.right-s.width/2,A=o>s.bottom-s.height/2,R=s.width>w.width,f=s.height>w.height,L=(R?w:s).left,D=(R?w:s).right,Y=(f?w:s).top,U=(f?w:s).bottom;if(O==="top"&&o>=w.bottom-1||O==="bottom"&&o<=w.top+1||O==="left"&&i>=w.right-1||O==="right"&&i<=w.left+1){_();return}let I=!1;switch(O){case"top":I=ce(P,v,L,w.top+1,D,s.bottom-1);break;case"bottom":I=ce(P,v,L,s.top+1,D,w.bottom-1);break;case"left":I=ce(P,v,s.right-1,U,w.left+1,Y);break;case"right":I=ce(P,v,w.right-1,U,s.left+1,Y);break}if(I)return;if(h&&!Jt(P,v,w)){_();return}if(!M&&g(P,v)){_();return}let k=!1;switch(O){case"top":{const C=R?y/2:y*4,z=R||T?i+C:i-C,Z=R?i-C:T?i+C:i-C,K=o+y+1,ee=T||R?s.bottom-y:s.top,te=T?R?s.bottom-y:s.top:s.bottom-y;k=ae(P,v,z,K,Z,K,s.left,ee,s.right,te);break}case"bottom":{const C=R?y/2:y*4,z=R||T?i+C:i-C,Z=R?i-C:T?i+C:i-C,K=o-y,ee=T||R?s.top+y:s.bottom,te=T?R?s.top+y:s.bottom:s.top+y;k=ae(P,v,z,K,Z,K,s.left,ee,s.right,te);break}case"left":{const C=f?y/2:y*4,z=f||A?o+C:o-C,Z=f?o-C:A?o+C:o-C,K=i+y+1,ee=A||f?s.right-y:s.left,te=A?f?s.right-y:s.left:s.right-y;k=ae(P,v,ee,s.top,te,s.bottom,K,z,K,Z);break}case"right":{const C=f?y/2:y*4,z=f||A?o+C:o-C,Z=f?o-C:A?o+C:o-C,K=i-y,ee=A||f?s.left+y:s.right,te=A?f?s.left+y:s.right:s.left+y;k=ae(P,v,K,z,K,Z,ee,s.top,te,s.bottom);break}}k?h||t.start(40,_):_()}};return l.__options={...e,blockPointerEvents:n},l}const Ne=m.createContext(void 0);function re(e){const n=m.useContext(Ne);if(n===void 0&&!e)throw new Error(pe(47));return n}function en(){return{...Dt(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}const tn={...Bt,disabled:q(e=>e.disabled),instantType:q(e=>e.instantType),openMethod:q(e=>e.openMethod),openChangeReason:q(e=>e.openChangeReason),modal:q(e=>e.modal),focusManagerModal:q(e=>e.focusManagerModal),stickIfOpen:q(e=>e.stickIfOpen),titleElementId:q(e=>e.titleElementId),descriptionElementId:q(e=>e.descriptionElementId),openOnHover:q(e=>e.openOnHover),closeDelay:q(e=>e.closeDelay),hasViewport:q(e=>e.hasViewport)};class Se extends qe{constructor(n,t,l=!1){const i={...en(),...n},o=new pt;i.open&&n?.mounted===void 0&&(i.mounted=!0),i.floatingRootContext=Ht(o,t,l),super(i,{popupRef:m.createRef(),backdropRef:m.createRef(),internalBackdropRef:m.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:m.createRef(),beforeContentFocusGuardRef:m.createRef(),stickIfOpenTimeout:new le,triggerElements:o},tn)}setOpen=(n,t)=>{const l=t.reason===W,i=t.reason===Ee&&t.event.detail===0,o=!n&&(t.reason===$e||t.reason==null),p=gt(t),E=this.select("activeTriggerId");if(!n&&t.reason===ze&&t.trigger==null&&E!=null&&(t.trigger=this.context.triggerElements.getById(E)??this.select("activeTriggerElement")??void 0),this.context.onOpenChange?.(n,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(n,t);const S=()=>{const c={open:n,openChangeReason:t.reason};ht(c,n,t.trigger,p()),this.update(c)};l?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(Qe,()=>{this.set("stickIfOpen",!1)}),ue.flushSync(S)):S(),i||o?this.set("instantType",i?"click":"dismiss"):t.reason===Te?this.set("instantType","focus"):this.set("instantType",void 0)};static useStore(n,t){const{store:l,internalStore:i}=mt(n,(o,p)=>new Se(t,o,p));return m.useEffect(()=>i?.disposeEffect(),[i]),l}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()}function ke({props:e}){const{children:n,open:t,defaultOpen:l=!1,onOpenChange:i,onOpenChangeComplete:o,modal:p=!1,handle:E,triggerId:S,defaultTriggerId:c=null}=e,r=Se.useStore(E?.store,{modal:p,open:l,openProp:t,activeTriggerId:c,triggerIdProp:S});Tt(r,t,l,c),r.useControlledProp("openProp",t),r.useControlledProp("triggerIdProp",S);const O=r.useState("open"),h=r.useState("mounted"),N=r.useState("payload"),u=He()!=null;r.useContextCallback("onOpenChange",i),r.useContextCallback("onOpenChangeComplete",o),Pt(r,O),Ct(r);const{forceUnmount:B}=vt(O,r,()=>{r.update({stickIfOpen:!0,openChangeReason:null})});r.useSyncedValues({modal:p,nested:u}),m.useEffect(()=>{O||r.context.stickIfOpenTimeout.clear()},[r,O]);const g=m.useCallback(()=>{r.setOpen(!1,Q(Je))},[r]);m.useImperativeHandle(e.actionsRef,()=>({unmount:B,close:g}),[B,g]);const x=O||h,a=m.useMemo(()=>({store:r}),[r]);return V.jsxs(Ne.Provider,{value:a,children:[x&&V.jsx(nn,{store:r,modal:p}),typeof n=="function"?n({payload:N}):n]})}function hn(e){return re(!0)?V.jsx(ke,{props:e}):V.jsx(Et,{children:V.jsx(ke,{props:e})})}function nn({store:e,modal:n}){const t=e.useState("floatingRootContext"),l=bt(t,{outsidePressEvent:{mouse:n==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),i=l.reference??Me,o=l.trigger??Me,p=m.useMemo(()=>Ze(Be,l.floating),[l.floating]);return Rt(e,{activeTriggerProps:i,inactiveTriggerProps:o,popupProps:p}),null}const on=300;function sn(e,n){const t=m.useRef(null);function l(o){ue.flushSync(()=>{e.setOpen(!1,Q(Te,o.nativeEvent,o.currentTarget))}),ot(t.current)?.focus()}function i(o){const p=e.select("positionerElement");if(p&&et(o,p))e.context.beforeContentFocusGuardRef.current?.focus();else{ue.flushSync(()=>{e.setOpen(!1,Q(Te,o.nativeEvent,o.currentTarget))});let E=tt(e.context.triggerFocusTargetRef.current||n.current);for(;E!==null&&$(p,E);){const S=E;if(E=nt(E),E===S)break}E?.focus()}}return{preFocusGuardRef:t,handlePreFocusGuardFocus:l,handleFocusTargetFocus:i}}const En=m.forwardRef(function(n,t){const{render:l,className:i,style:o,disabled:p=!1,nativeButton:E=!0,handle:S,payload:c,openOnHover:r=!1,delay:O=on,closeDelay:h=0,id:N,...u}=n,B=re(!0),g=S?.store??B?.store;if(!g)throw new Error(pe(74));const x=St(N),a=g.useState("isTriggerActive",x),d=g.useState("floatingRootContext"),F=g.useState("isOpenedByTrigger",x),H=g.useState("triggerPopupId",x),P=m.useRef(null),{registerTrigger:v,isMountedByThisTrigger:b}=Ot(x,P,g,{payload:c,disabled:p,openOnHover:r,closeDelay:h}),M=g.useState("openChangeReason"),j=g.useState("stickIfOpen"),G=g.useState("openMethod"),X=g.useState("focusManagerModal"),_=zt(d,{enabled:!p&&d!=null&&r&&(G!=="touch"||M!==Ee),mouseOnly:!0,move:!1,handleClose:Zt(),restMs:O,delay:{close:h},triggerElementRef:P,isActiveTrigger:a,isClosing:()=>g.select("transitionStatus")==="ending"}),w=jt(d,{enabled:d!=null,stickIfOpen:j}),s=_t(()=>g.select("open"),k=>{g.set("openMethod",k)}),T=g.useState("triggerProps",b),{getButtonProps:A,buttonRef:R}=st({disabled:p,native:E}),f={open(k){return k&&M===Ee?It.open(k):Mt.open(k)}},{preFocusGuardRef:L,handlePreFocusGuardFocus:D,handleFocusTargetFocus:Y}=sn(g,P),I=Ae("button",n,{state:{disabled:p,open:F},ref:[R,t,v,P],props:[w.reference,_,T,s,{[rt]:"",id:x,"aria-haspopup":"dialog","aria-expanded":F,"aria-controls":H},u,A],stateAttributesMapping:f});return b&&!X?V.jsxs(m.Fragment,{children:[V.jsx(ye,{ref:L,onFocus:D}),V.jsx(m.Fragment,{children:I},x),V.jsx(ye,{ref:g.context.triggerFocusTargetRef,onFocus:Y})]}):V.jsx(m.Fragment,{children:I},x)}),Ve=m.createContext(void 0);function rn(){const e=m.useContext(Ve);if(e===void 0)throw new Error(pe(45));return e}const Tn=m.forwardRef(function(n,t){const{keepMounted:l=!1,...i}=n,{store:o}=re();return o.useState("mounted")||l?V.jsx(Ve.Provider,{value:l,children:V.jsx(it,{ref:t,...i})}):null}),Ye=m.createContext(void 0);function an(){const e=m.useContext(Ye);if(!e)throw new Error(pe(46));return e}const Pn=m.forwardRef(function(n,t){const{render:l,className:i,style:o,anchor:p,positionMethod:E="absolute",side:S="bottom",align:c="center",sideOffset:r=0,alignOffset:O=0,collisionBoundary:h="clipping-ancestors",collisionPadding:N=5,arrowPadding:u=5,sticky:B=!1,disableAnchorTracking:g=!1,collisionAvoidance:x=at,...a}=n,{store:d}=re(),F=rn(),H=yt(),P=d.useState("floatingRootContext"),v=d.useState("mounted"),b=d.useState("open"),M=d.useState("openChangeReason"),j=d.useState("activeTriggerElement"),G=d.useState("modal"),X=d.useState("openMethod"),_=d.useState("positionerElement"),w=d.useState("instantType"),s=d.useState("transitionStatus"),T=d.useState("hasViewport"),A=m.useRef(null),R=ct(_,!1,!1),f=Nt({anchor:p,floatingRootContext:P,positionMethod:E,mounted:v,side:S,sideOffset:r,align:c,alignOffset:O,arrowPadding:u,collisionBoundary:h,collisionPadding:N,sticky:B,disableAnchorTracking:g,keepMounted:F,nodeId:H,collisionAvoidance:x,adaptiveOrigin:T?Gt:void 0}),L=P.useState("domReferenceElement");ge(()=>{const I=L,k=A.current;if(I&&(A.current=I),k&&I&&I!==k){d.set("instantType",void 0);const C=new AbortController;return R(()=>{d.set("instantType","trigger-change")},C.signal),()=>{C.abort()}}},[L,R,d]),Vt(b&&G===!0&&M!==W,X==="touch",_,j);const D=m.useCallback(I=>{d.set("positionerElement",I)},[d]),Y={open:b,side:f.side,align:f.align,anchorHidden:f.anchorHidden,instant:w},U=Yt(n,Y,{styles:f.positionerStyles,transitionStatus:s,props:a,refs:[t,D],hidden:!v,inert:!b});return V.jsxs(Ye.Provider,{value:f,children:[v&&G===!0&&M!==W&&V.jsx(xt,{ref:d.context.internalBackdropRef,inert:lt(!b),cutout:j}),V.jsx(Ft,{id:H,children:U})]})}),cn=m.createContext(void 0);function ln(){const[e,n]=m.useState(0),t=ne(()=>(n(i=>i+1),()=>{n(i=>Math.max(0,i-1))}));return{context:m.useMemo(()=>({register:t}),[t]),hasClosePart:e>0}}function un(e){const{value:n,children:t}=e;return V.jsx(cn.Provider,{value:n,children:t})}const fn={...Lt,...dt},Cn=m.forwardRef(function(n,t){const{render:l,className:i,style:o,initialFocus:p,finalFocus:E,...S}=n,{store:c}=re(),r=an(),O=Xt()!=null,{context:h,hasClosePart:N}=ln(),u=c.useState("open"),B=c.useState("openMethod"),g=c.useState("instantType"),x=c.useState("transitionStatus"),a=c.useState("popupProps"),d=c.useState("titleElementId"),F=c.useState("descriptionElementId"),H=c.useState("modal"),P=c.useState("mounted"),v=c.useState("openChangeReason"),b=c.useState("activeTriggerElement"),M=c.useState("floatingRootContext"),j=M.useState("floatingId"),G=c.useState("disabled"),X=c.useState("openOnHover"),_=c.useState("closeDelay"),w=S.id??j;ut({open:u,ref:c.context.popupRef,onComplete(){u&&c.context.onOpenChangeComplete?.(!0)}}),qt(M,{enabled:X&&!G,closeDelay:_});const s=p===void 0?kt(c.context.popupRef):p,T=H!==!1&&N;c.useSyncedValue("focusManagerModal",T);const A=m.useCallback(L=>{c.set("popupElement",L)},[c]),R={open:u,side:r.side,align:r.align,instant:g,transitionStatus:x},f=Ae("div",n,{state:R,ref:[t,c.context.popupRef,A],props:[a,{id:w,role:"dialog",...Be,"aria-labelledby":d,"aria-describedby":F,onKeyDown(L){O&&At.has(L.key)&&L.stopPropagation()}},Ut(x),S],stateAttributesMapping:fn});return V.jsx(wt,{context:M,openInteractionType:B,modal:T,disabled:!P||v===W,initialFocus:s,returnFocus:E,restoreFocus:"popup",previousFocusableElement:ft(b)?b:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:V.jsx(un,{value:h,children:f})})});export{hn as P,En as a,Tn as b,Pn as c,Cn as d};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as v,U as i,V as w,z as k,j as e,e as b}from"./__vite-browser-external-CJKqcpDH.js";import{C as j}from"./ToolbarRootContext-DM-WFqY6.js";import{C as N}from"./check-BEWd6UpN.js";import{u as C,a as E,s as l,L as I,b as R,S as T,c as L,d as A,e as P,f as V,g as _,h as z,i as D,j as G}from"./SelectItemText-D-pVcs50.js";const M=v.forwardRef(function(t,s){const{render:n,className:f,style:o,...c}=t,{store:r,scrollHandlerRef:d}=C(),{alignItemWithTriggerActive:g}=E(),u=i(r,l.hasScrollArrows),h=i(r,l.openMethod),a=i(r,l.multiple),m={id:`${i(r,l.id)}-list`,role:"listbox","aria-multiselectable":a||void 0,onScroll(x){d.current?.(x.currentTarget)},...g&&{style:I},className:u&&h!=="touch"?R.className:void 0},S=w(x=>{r.set("listElement",x)});return k("div",t,{ref:[s,S],props:[m,c]})}),O="relative inline-flex items-center justify-between gap-2 rounded-lg border border-oai-gray-200 bg-white text-oai-black transition-colors hover:border-oai-gray-300 focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-white dark:hover:border-oai-gray-700";function W({value:y,onValueChange:t,options:s=[],ariaLabel:n,id:f,disabled:o=!1,leadingIcon:c=null,className:r="",popupClassName:d="",align:g="start",matchTriggerWidth:u=!1}){const h=s.map(a=>({value:a.value,label:a.label}));return e.jsxs(T,{value:y,items:h,disabled:o,onValueChange:a=>{!o&&a!=null&&t?.(a)},children:[e.jsxs(L,{id:f,"aria-label":n,className:b(O,o&&"cursor-not-allowed opacity-50 hover:border-oai-gray-200 dark:hover:border-oai-gray-800",r),children:[e.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[c,e.jsx(A,{className:"truncate"})]}),e.jsx(j,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})]}),e.jsx(P,{children:e.jsx(V,{align:g,side:"bottom",sideOffset:4,className:"z-50",children:e.jsx(_,{className:b("max-h-[min(18rem,var(--available-height))] origin-[var(--transform-origin)] overflow-y-auto","rounded-xl border border-oai-gray-200 bg-white p-1 shadow-lg ring-1 ring-black/[0.04]","dark:border-oai-gray-700 dark:bg-oai-gray-900 dark:ring-white/[0.05]","transition-[opacity,transform] duration-150 ease-out","data-[starting-style]:scale-95 data-[starting-style]:opacity-0","data-[ending-style]:scale-95 data-[ending-style]:opacity-0",u&&"min-w-[var(--anchor-width)]",d),children:e.jsx(M,{role:"listbox","aria-label":n,children:s.map(a=>e.jsxs(z,{value:a.value,disabled:a.disabled,className:({selected:p,disabled:m})=>b("flex w-full cursor-pointer items-center gap-1.5 whitespace-nowrap rounded-lg py-1.5 pl-1.5 pr-6","text-left text-xs outline-none transition-colors",p?"bg-oai-gray-100 text-oai-black dark:bg-oai-gray-800/70 dark:text-white":"text-oai-gray-600 hover:bg-oai-gray-50 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800/60",m&&"cursor-not-allowed opacity-50 hover:bg-transparent dark:hover:bg-transparent"),children:[e.jsx("span",{className:"flex w-3.5 shrink-0 items-center justify-center text-oai-gray-500 dark:text-oai-gray-300",children:e.jsx(D,{children:e.jsx(N,{className:"h-3 w-3","aria-hidden":!0})})}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:e.jsx(G,{children:a.label})})]},String(a.value)))})})})})]})}export{W as S};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{bU as Xt,bS as xn,r,V as le,bw as Pt,aZ as G,ce as _t,cf as Mt,cg as Bt,bY as Ct,bc as st,aH as He,A as Me,ch as zt,bu as jt,ci as at,aG as Rn,bl as Jt,cj as Rt,ck as St,cl as Zt,cm as Lt,ba as ht,cn as Sn,c0 as In,co as At,aA as it,a$ as Re,a0 as Qt,a_ as yt,bb as En,j as be,$ as q,U as w,aC as Ft,b1 as Ot,b0 as Tn,b3 as Mn,b4 as Cn,b5 as Dt,cp as vn,bZ as wn,b2 as bt,bQ as Pn,y as en,z as Ze,cq as An,aD as On,cr as Vn,aE as Ln,b_ as Fn,be as Dn,cs as Nn,aB as tn,ct as vt}from"./__vite-browser-external-CJKqcpDH.js";import{v as We,q as kn,o as Un,E as Hn,G as Le,H as nn,J as _n,u as Bn,m as rn,h as zn,a as jn,l as Wn,A as Yn,I as qn,d as Kn,p as $n,b as Gn}from"./useScrollLock-DXsFDMbK.js";import{i as Xn,u as Jn,j as Zn,a as Qn,d as er,c as tr,e as nr,g as rr,k as or,p as sr,r as ir,h as lr}from"./ToolbarRootContext-DM-WFqY6.js";function tt(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}const cr="Escape";function It(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function ft(e,t){return It(t,e===Zt||e===Lt,e===Rt||e===St)}function wt(e,t,n){return It(t,e===Lt,n?e===Rt:e===St)||e==="Enter"||e===" "||e===""}function ur(e,t,n){return It(t,n?e===Rt:e===St,e===Lt)}function ar(e,t,n,o){const l=n?e===St:e===Rt,c=e===Zt;return t==="both"||t==="horizontal"&&o?e===cr:It(t,l,c)}function fr(e,t){const{listRef:n,activeIndex:o,onNavigate:l=()=>{},enabled:c=!0,selectedIndex:i=null,allowEscape:x=!1,loopFocus:u=!1,nested:m=!1,rtl:v=!1,virtual:a=!1,focusItemOnOpen:p="auto",focusItemOnHover:R=!0,openOnArrowKeyDown:b=!0,disabledIndices:O=void 0,orientation:g="vertical",parentOrientation:S,id:V,resetOnPointerLeave:E=!0,externalTree:d,grid:L}=t,j=L!=null,K="rootStore"in e?e.rootStore:e,D=K.useState("open"),W=K.useState("floatingElement"),J=K.useState("domReferenceElement"),me=K.context.dataRef,he=Xt(W),$=xn(J),P=We(he),H=kn(),oe=Un(d),z=r.useRef(p),T=r.useRef(i??-1),Y=r.useRef(null),k=r.useRef(!0),s=le(f=>{l(T.current===-1?null:T.current,f)}),M=r.useRef(!!W),ae=r.useRef(D),U=r.useRef(!1),pe=r.useRef(!1),ge=r.useRef(null),h=We(O),F=We(D),se=We(i),Se=We(E),B=Pt(),ne=Pt(),Z=le(()=>{function f(_){a?oe?.events.emit("virtualfocus",_):ge.current=Hn(_,{sync:U.current,preventScroll:!0})}const y=n.current[T.current],X=pe.current;y&&f(y),(U.current?_=>_():_=>B.request(_))(()=>{const _=n.current[T.current]||y;if(!_)return;y||f(_),xe&&(X||!k.current)&&_.scrollIntoView?.({block:"nearest",inline:"nearest"})})});G(()=>{me.current.orientation=g},[me,g]),G(()=>{c&&(D&&W?(T.current=i??-1,z.current&&i!=null&&(pe.current=!0,s())):M.current&&(T.current=-1,s()))},[c,D,W,i,s]),G(()=>{if(c){if(!D){U.current=!1;return}if(W)if(o==null){if(U.current=!1,se.current!=null)return;if(M.current&&(T.current=-1,Z()),(!ae.current||!M.current)&&z.current&&(Y.current!=null||z.current===!0&&Y.current==null)){let f=0;const y=()=>{n.current[0]==null?(f<2&&(f?I=>ne.request(I):queueMicrotask)(y),f+=1):(T.current=Y.current==null||wt(Y.current,g,v)||m?Mt(n):Bt(n),Y.current=null,s())};y()}}else _t(n.current,o)||(T.current=o,Z(),pe.current=!1)}},[c,D,W,o,se,m,n,g,v,s,Z,ne]),G(()=>{if(!c||W||!oe||a||!M.current)return;const f=oe.nodesRef.current,y=f.find(_=>_.id===H)?.context?.elements.floating,X=Ct(st(J??y??null)),I=f.some(_=>_.context&&He(_.context.elements.floating,X));y&&!I&&k.current&&y.focus({preventScroll:!0})},[c,W,J,oe,H,a]),G(()=>{ae.current=D,M.current=!!W}),G(()=>{D||(Y.current=null,z.current=p)},[D,p]);const ye=o!=null,ce=le(f=>{if(!F.current)return;const y=n.current.indexOf(f.currentTarget);y!==-1&&(T.current!==y||o!==y)&&(T.current=y,s(f))}),ue=le(()=>S??oe?.nodesRef.current.find(f=>f.id===H)?.context?.dataRef?.current.orientation),de=le(()=>Mt(n,h.current)),ee=le(f=>{if(k.current=!1,U.current=!0,f.which===229||!F.current&&f.currentTarget===P.current)return;if(m&&ar(f.key,g,v,j)){ft(f.key,ue())||Le(f),K.setOpen(!1,Me(zt,f.nativeEvent)),jt(J)&&(a?oe?.events.emit("virtualfocus",J):J.focus());return}const y=T.current,X=Mt(n,O),I=Bt(n,O);if($||(f.key==="Home"&&(Le(f),T.current=X,s(f)),f.key==="End"&&(Le(f),T.current=I,s(f))),L!=null){const _=L(f,T.current,n,g,u,v,O,X,I);if(_!=null&&(T.current=_,s(f)),g==="both")return}if(ft(f.key,g)){if(Le(f),D&&!a&&Ct(f.currentTarget.ownerDocument)===f.currentTarget){T.current=wt(f.key,g,v)?X:I,s(f);return}wt(f.key,g,v)?u?y>=I?x&&y!==n.current.length?T.current=-1:(U.current=!1,T.current=X):T.current=at(n.current,{startingIndex:y,disabledIndices:O}):T.current=Math.min(I,at(n.current,{startingIndex:y,disabledIndices:O})):u?y<=X?x&&y!==-1?T.current=n.current.length:(U.current=!1,T.current=I):T.current=at(n.current,{startingIndex:y,decrement:!0,disabledIndices:O}):T.current=Math.max(X,at(n.current,{startingIndex:y,decrement:!0,disabledIndices:O})),_t(n.current,T.current)&&(T.current=-1),s(f)}}),xe=r.useMemo(()=>({onFocus(y){U.current=!0,ce(y)},onClick:({currentTarget:y})=>y.focus({preventScroll:!0}),onMouseMove(y){U.current=!0,pe.current=!1,R&&ce(y)},onPointerLeave(y){if(!F.current||!k.current||y.pointerType==="touch")return;U.current=!0;const X=y.relatedTarget;if(!(!R||n.current.includes(X))&&Se.current&&(ge.current?.(),ge.current=null,T.current=-1,s(y),!a)){const I=P.current,_=Ct(st(I));I&&He(I,_)&&I.focus({preventScroll:!0})}}}),[ce,F,P,R,n,s,Se,a]),te=r.useMemo(()=>a&&D&&ye&&{"aria-activedescendant":`${V}-${o}`},[a,D,ye,V,o]),Q=r.useMemo(()=>({"aria-orientation":g==="both"?void 0:g,...$?{}:te,onKeyDown(f){if(f.key==="Tab"&&f.shiftKey&&D&&!a){const y=Rn(f.nativeEvent);if(y&&!He(P.current,y))return;Le(f),K.setOpen(!1,Me(Jt,f.nativeEvent)),jt(J)&&J.focus();return}ee(f)},onPointerMove(){k.current=!0}}),[te,ee,P,g,$,K,D,a,J]),re=r.useMemo(()=>{function f(I){K.setOpen(!0,Me(zt,I.nativeEvent,I.currentTarget))}function y(I){p==="auto"&&nn(I.nativeEvent)&&(z.current=!a)}function X(I){z.current=p,p==="auto"&&_n(I.nativeEvent)&&(z.current=!0)}return{onKeyDown(I){const _=K.select("open");k.current=!1;const ve=I.key.startsWith("Arrow"),De=ur(I.key,ue(),v),Ee=ft(I.key,g),Ae=(m?De:Ee)||I.key==="Enter"||I.key.trim()==="";if(a&&_)return ee(I);if(!(!_&&!b&&ve)){if(Ae){const fe=ft(I.key,ue());Y.current=m&&fe?null:I.key}if(m){De&&(Le(I),_?(T.current=de(),s(I)):f(I));return}Ee&&(se.current!=null&&(T.current=se.current),Le(I),!_&&b?f(I):ee(I),_&&s(I))}},onFocus(I){K.select("open")&&!a&&(T.current=-1,s(I))},onPointerDown:X,onPointerEnter:X,onMouseDown:y,onClick:y}},[ee,p,de,m,s,K,b,g,ue,v,se,a]),A=r.useMemo(()=>({...te,...re}),[te,re]);return r.useMemo(()=>c?{reference:A,floating:Q,item:xe,trigger:re}:{},[c,A,Q,re,xe])}function dr(e,t){const{listRef:n,elementsRef:o,activeIndex:l,onMatch:c,disabledIndices:i,onTyping:x,enabled:u=!0,resetMs:m=750,selectedIndex:v=null}=t,a="rootStore"in e?e.rootStore:e,p=a.useState("open"),R=ht(),b=r.useRef(""),O=r.useRef(v??l??-1),g=r.useRef(null),S=le(d=>{function L(P){const H=o?.current[P];return!H||In(H)}function j(P){return L(P)?i==null||!Sn(At,P,i):!1}function K(P,H,oe=0){if(P.length===0)return-1;const z=(oe%P.length+P.length)%P.length,T=H.toLowerCase();for(let Y=0;Y<P.length;Y+=1){const k=(z+Y)%P.length;if(!(!P[k]?.toLowerCase().startsWith(T)||!j(k)))return k}return-1}const D=n.current;if(b.current.length>0&&d.key===" "&&(Le(d),x?.(!0)),b.current.length>0&&b.current[0]!==" "&&K(D,b.current)===-1&&d.key!==" "&&x?.(!1),D==null||d.key.length!==1||d.ctrlKey||d.metaKey||d.altKey)return;p&&d.key!==" "&&(Le(d),x?.(!0));const W=b.current==="";W&&(O.current=v??l??-1),D.every((P,H)=>P&&j(H)?P[0]?.toLowerCase()!==P[1]?.toLowerCase():!0)&&b.current===d.key&&(b.current="",O.current=g.current),b.current+=d.key,R.start(m,()=>{b.current="",O.current=g.current,x?.(!1)});const he=((W?v??l??-1:O.current)??0)+1,$=K(D,b.current,he);$!==-1?(c?.($),g.current=$):d.key!==" "&&(b.current="",x?.(!1))}),V=le(d=>{const L=d.relatedTarget,j=a.select("domReferenceElement"),K=a.select("floatingElement");He(j,L)||He(K,L)||(R.clear(),b.current="",O.current=g.current,x?.(!1))});G(()=>{!p&&v!==null||(R.clear(),g.current=null,b.current!==""&&(b.current=""))},[p,v,R]),G(()=>{p&&b.current===""&&(O.current=v??l??-1)},[p,v,l]);const E=r.useMemo(()=>({onKeyDown:S,onBlur:V}),[S,V]);return r.useMemo(()=>u?{reference:E,floating:E}:{},[u,E])}function pr(e){const[t,n]=r.useState({current:e,previous:null});return e!==t.current&&n({current:e,previous:t.current}),t.previous}function gr(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}function Wt({controlled:e,default:t,name:n,state:o="value"}){const{current:l}=r.useRef(e!==void 0),[c,i]=r.useState(t),x=l?e:c,u=r.useCallback(m=>{l||i(m)},[]);return[x,u]}const on=r.createContext(null),sn=r.createContext(null);function qe(){const e=r.useContext(on);if(e===null)throw new Error(it(60));return e}function ln(){const e=r.useContext(sn);if(e===null)throw new Error(it(61));return e}let Yt=(function(e){return e.disabled="data-disabled",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const mr={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},nt={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},hr={disabled:!1,...nt},br={valid(e){return e===null?null:e?{[Yt.valid]:""}:{[Yt.invalid]:""}}},yr={invalid:void 0,name:void 0,validityData:{state:mr,errors:[],error:"",value:"",initialValue:null},setValidityData:Re,disabled:void 0,touched:nt.touched,setTouched:Re,dirty:nt.dirty,setDirty:Re,filled:nt.filled,setFilled:Re,focused:nt.focused,setFocused:Re,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:hr,markedDirtyRef:{current:!1},registerFieldControl:Re,validation:{getValidationProps:(e,t=Qt)=>t,inputRef:{current:null},registerInput:Re,commit:async()=>{},change:Re}},xr=r.createContext(yr);function Nt(e=!0){const t=r.useContext(xr);if(t.setValidityData===Re&&!e)throw new Error(it(28));return t}function Rr(e,t,n,o,l=!0,c){const{registerFieldControl:i}=Nt(),x=r.useRef(null);x.current||(x.current=Symbol()),G(()=>{const u=x.current;return!u||!l?void 0:(i(u,{controlRef:e,getValue:o,id:t,name:c,value:n}),()=>{i(u,void 0)})},[e,l,o,t,c,i,n])}const Sr=r.createContext({controlId:void 0,registerControlId:Re,labelId:void 0,setLabelId:Re,messageIds:[],setMessageIds:Re,getDescriptionProps:e=>e});function cn(){return r.useContext(Sr)}function un(e={}){const{id:t,implicit:n=!1,controlRef:o}=e,{controlId:l,registerControlId:c}=cn(),i=Bn(t),x=n?l:void 0,u=yt(()=>Symbol("labelable-control")),m=r.useRef(!1),v=r.useRef(t!=null),a=le(()=>{!m.current||c===Re||(m.current=!1,c(u.current,void 0))});return G(()=>{if(c===Re)return;let p;if(n){const R=o?.current;En(R)&&R.closest("label")!=null?p=t??null:p=x??i}else if(t!=null)v.current=!0,p=t;else if(v.current)p=i;else{a();return}if(p===void 0){a();return}m.current=!0,c(u.current,p)},[t,o,x,c,n,i,u,a]),r.useEffect(()=>a,[a]),l??i}const Ir=(e,t)=>Object.is(e,t);function Ye(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Er(e,t,n){return!e||e.length===0?!1:e.some(o=>o===void 0?!1:Ye(t,o,n))}function ot(e,t,n){return!e||e.length===0?-1:e.findIndex(o=>o===void 0?!1:Ye(o,t,n))}function Tr(e,t,n){return e.filter(o=>!Ye(t,o,n))}function Vt(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function an(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function Mr(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(an(t)){for(const n of t)for(const o of n.items)if(o&&o.value==null&&o.label!=null)return!0;return!1}for(const n of t)if(n&&n.value==null&&n.label!=null)return!0;return!1}function fn(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return Vt(e)}function je(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?Vt(e.value):Vt(e)}function dn(e,t,n){function o(){return fn(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??o();if(Array.isArray(t)){const l=t,c=an(l)?l.flatMap(i=>i.items):l;if(e==null||typeof e!="object"){const i=c.find(x=>x.value===e);return i&&i.label!=null?i.label:o()}if("value"in e){const i=c.find(x=>x&&x.value===e.value);if(i&&i.label!=null)return i.label}}return o()}function Cr(e,t,n){return e.reduce((o,l,c)=>(c>0&&o.push(", "),o.push(be.jsx(r.Fragment,{children:dn(l,t,n)},c)),o),[])}const C={id:q(e=>e.id),labelId:q(e=>e.labelId),modal:q(e=>e.modal),multiple:q(e=>e.multiple),items:q(e=>e.items),itemToStringLabel:q(e=>e.itemToStringLabel),itemToStringValue:q(e=>e.itemToStringValue),isItemEqualToValue:q(e=>e.isItemEqualToValue),value:q(e=>e.value),hasSelectedValue:q(e=>{const{value:t,multiple:n,itemToStringValue:o}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:je(t,o)!==""}),hasNullItemLabel:q((e,t)=>t?Mr(e.items):!1),open:q(e=>e.open),mounted:q(e=>e.mounted),forceMount:q(e=>e.forceMount),transitionStatus:q(e=>e.transitionStatus),openMethod:q(e=>e.openMethod),activeIndex:q(e=>e.activeIndex),selectedIndex:q(e=>e.selectedIndex),isActive:q((e,t)=>e.activeIndex===t),isSelected:q((e,t)=>{const n=e.isItemEqualToValue,o=e.value;return e.multiple?Array.isArray(o)&&o.some(l=>Ye(t,l,n)):Ye(t,o,n)}),isSelectedByFocus:q((e,t)=>e.selectedIndex===t),popupProps:q(e=>e.popupProps),triggerProps:q(e=>e.triggerProps),triggerElement:q(e=>e.triggerElement),positionerElement:q(e=>e.positionerElement),listElement:q(e=>e.listElement),popupSide:q(e=>e.popupSide),scrollUpArrowVisible:q(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:q(e=>e.scrollDownArrowVisible),hasScrollArrows:q(e=>e.hasScrollArrows)},vr=r.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Re,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function wr(){return r.useContext(vr)}function Pr(e,t,n=(o,l)=>o===l){return e.length===t.length&&e.every((o,l)=>n(o,t[l]))}const Fe=1;function pn(e,t){return Math.max(0,e-t)}function Ar(e,t){if(t<=0)return 0;const n=tt(e,0,t),o=n,l=t-n,c=o<=Fe,i=l<=Fe;return c&&i?o<=l?0:t:c?0:i?t:n}function to(e){const{id:t,value:n,defaultValue:o=null,onValueChange:l,open:c,defaultOpen:i=!1,onOpenChange:x,name:u,form:m,autoComplete:v,disabled:a=!1,readOnly:p=!1,required:R=!1,modal:b=!0,actionsRef:O,inputRef:g,onOpenChangeComplete:S,items:V,multiple:E=!1,itemToStringLabel:d,itemToStringValue:L,isItemEqualToValue:j=Ir,highlightItemOnHover:K=!0,children:D}=e,{clearErrors:W}=wr(),{setDirty:J,setTouched:me,setFocused:he,validityData:$,setFilled:P,name:H,disabled:oe,validation:z,validationMode:T}=Nt(),Y=un({id:t}),k=oe||a,s=H??u,[M,ae]=Wt({controlled:n,default:E?o??At:o,name:"Select",state:"value"}),[U,pe]=Wt({controlled:c,default:i,name:"Select",state:"open"}),ge=r.useRef([]),h=r.useRef([]),F=r.useRef(null),se=r.useRef(null),Se=r.useRef(0),B=r.useRef(null),ne=r.useRef([]),Z=r.useRef(!1),ye=r.useRef(null),ce=r.useRef(null),ue=r.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),de=r.useRef(!1),{mounted:ee,setMounted:xe,transitionStatus:te}=rn(U),{openMethod:Q,triggerProps:re}=Xn(U),A=yt(()=>new vn({id:Y,labelId:void 0,modal:b,multiple:E,itemToStringLabel:d,itemToStringValue:L,isItemEqualToValue:j,value:M,open:U,mounted:ee,transitionStatus:te,items:V,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,f=w(A,C.activeIndex),y=w(A,C.selectedIndex),X=w(A,C.triggerElement),I=w(A,C.positionerElement),_=pr(Q),ve=Q??_??null,De=r.useMemo(()=>E?"":je(M,L),[E,M,L]),Ee=r.useMemo(()=>E&&Array.isArray(M)?M.map(N=>je(N,L)):je(M,L),[E,M,L]),Ae=We(A.state.triggerElement),fe=le(()=>Ee);Rr(Ae,Y,M,fe,!k,u);const Oe=r.useRef(M),Ve=E?Array.isArray(M)&&M.length>0:M!=null&&je(M,L)!=="";G(()=>{M!==Oe.current&&A.set("forceMount",!0)},[A,M]),G(()=>{P(Ve)},[Ve,P]),G(function(){const ie=ne.current;let Te;if(E){const Ie=Array.isArray(M)?M:[];if(Ie.length===0)Te=null;else{const Ue=Ie[Ie.length-1],ze=ot(ie,Ue,j);Te=ze===-1?null:ze}}else{const Ie=ot(ie,M,j);Te=Ie===-1?null:Ie}Te===null&&(ce.current=null),!U&&A.set("selectedIndex",Te)},[Ve,E,U,M,ne,j,A,ce]);function we(N){const ie=$.initialValue;return Array.isArray(N)&&Array.isArray(ie)?!Pr(N,ie,(Te,Ie)=>Ye(Te,Ie,j)):N!==ie}Jn(M,()=>{W(s),J(we(M)),z.change(M)});const Ke=le((N,ie)=>{x?.(N,ie),!ie.isCanceled&&(pe(N),!N&&(ie.reason===Jt||ie.reason===wn)&&(me(!0),he(!1),T==="onBlur"&&z.commit(M)))}),$e=le(()=>{xe(!1),A.update({activeIndex:null,openMethod:null}),S?.(!1)});Ft({enabled:!O,open:U,ref:F,onComplete(){U||$e()}}),r.useImperativeHandle(O,()=>({unmount:$e}),[$e]);const Ne=le((N,ie)=>{l?.(N,ie),!ie.isCanceled&&ae(N)}),Pe=le(()=>{const N=A.state.listElement||F.current;if(!N)return;const ie=pn(N.scrollHeight,N.clientHeight),Te=Ar(N.scrollTop,ie),Ie=Te>0,Ue=Te<ie;A.state.scrollUpArrowVisible!==Ie&&A.set("scrollUpArrowVisible",Ie),A.state.scrollDownArrowVisible!==Ue&&A.set("scrollDownArrowVisible",Ue)}),_e=Zn({open:U,onOpenChange:Ke,elements:{reference:X,floating:I}}),Ge=Qn(_e,{enabled:!p&&!k,event:"mousedown"}),Xe=zn(_e),ke=fr(_e,{enabled:!p&&!k,listRef:ge,activeIndex:f,selectedIndex:y,disabledIndices:At,onNavigate(N){N===null&&!U||A.set("activeIndex",N)},focusItemOnHover:K}),Be=dr(_e,{enabled:!p&&!k&&(U||!E),listRef:h,activeIndex:f,selectedIndex:y,disabledIndices:N=>gr(ge.current[N]),onMatch(N){U?A.set("activeIndex",N):Ne(ne.current[N],Me("none"))},onTyping(N){Z.current=N}}),Qe=r.useMemo(()=>{const N=Ot(Be.reference,ke.reference,Xe.reference,Ge.reference,re);return Y&&(N.id=Y),N},[Ge.reference,Be.reference,ke.reference,Xe.reference,re,Y]),et=r.useMemo(()=>Ot(jn,Be.floating,ke.floating,Xe.floating),[Be.floating,ke.floating,Xe.floating]),lt=ke.item??Qt;Wn(()=>{A.update({popupProps:et,triggerProps:Qe})}),G(()=>{A.update({id:Y,modal:b,multiple:E,value:M,open:U,mounted:ee,transitionStatus:te,popupProps:et,triggerProps:Qe,items:V,itemToStringLabel:d,itemToStringValue:L,isItemEqualToValue:j,openMethod:ve})},[A,Y,b,E,M,U,ee,te,et,Qe,V,d,L,j,ve]);const Ce=r.useMemo(()=>({store:A,name:s,required:R,disabled:k,readOnly:p,multiple:E,highlightItemOnHover:K,setValue:Ne,setOpen:Ke,listRef:ge,popupRef:F,scrollHandlerRef:se,handleScrollArrowVisibility:Pe,scrollArrowsMountedCountRef:Se,itemProps:lt,valueRef:B,valuesRef:ne,labelsRef:h,typingRef:Z,selectionRef:ue,firstItemTextRef:ye,selectedItemTextRef:ce,validation:z,onOpenChangeComplete:S,alignItemWithTriggerActiveRef:de,initialValueRef:Oe}),[A,s,R,k,p,E,K,Ne,Ke,lt,z,S,Pe]),Je=Tn(g,z.inputRef),ct=E&&Array.isArray(M)&&M.length>0,ut=E?void 0:s,Et=r.useMemo(()=>!E||!Array.isArray(M)||!s?null:M.map(N=>{const ie=je(N,L);return be.jsx("input",{type:"hidden",form:m,name:s,value:ie,disabled:k},ie)}),[E,M,m,s,L,k]);return be.jsx(on.Provider,{value:Ce,children:be.jsxs(sn.Provider,{value:_e,children:[D,be.jsx("input",{...z.getValidationProps(k,{onFocus(){A.state.triggerElement?.focus({focusVisible:!0})},onChange(N){if(N.nativeEvent.defaultPrevented||k||p)return;const ie=N.currentTarget.value,Te=Me(Dt,N.nativeEvent);function Ie(){if(E)return;const Ue=ie.toLowerCase();let ze=ne.current.findIndex(Tt=>je(Tt,L).toLowerCase()===Ue||fn(Tt,d).toLowerCase()===Ue);ze===-1&&(ze=ne.current.findIndex((Tt,yn)=>{const Ht=h.current[yn];return Ht!=null&&Ht.toLowerCase()===Ue}));const Ut=ze===-1?void 0:ne.current[ze];Ut!=null&&Ne(Ut,Te)}A.set("forceMount",!0),queueMicrotask(Ie)}}),id:Y&&ut==null?`${Y}-hidden-input`:void 0,form:m,name:ut,autoComplete:v,value:De,disabled:k,required:R&&!ct,readOnly:p,ref:Je,style:s?Mn:Cn,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Et]})})}function Or(e,t){return e??t}function Vr(e){const t=e.getBoundingClientRect(),n=bt(e);if(Pn)return t;const o=n.getComputedStyle(e,"::before"),l=n.getComputedStyle(e,"::after");if(!(o.content!=="none"||l.content!=="none"))return t;const i=parseFloat(o.width)||0,x=parseFloat(o.height)||0,u=parseFloat(l.width)||0,m=parseFloat(l.height)||0,v=Math.max(t.width,i,u),a=Math.max(t.height,x,m),p=v-t.width,R=a-t.height;return{left:t.left-p/2,right:t.right+p/2,top:t.top-R/2,bottom:t.bottom+R/2}}const dt=2,Lr=400,Fr={...Yn,...br,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},no=r.forwardRef(function(t,n){const{render:o,className:l,id:c,disabled:i=!1,nativeButton:x=!0,style:u,...m}=t,{setTouched:v,setFocused:a,validationMode:p,state:R,disabled:b}=Nt(),{labelId:O}=cn(),{store:g,setOpen:S,selectionRef:V,validation:E,readOnly:d,required:L,alignItemWithTriggerActiveRef:j,disabled:K}=qe(),D=b||K||i,W=w(g,C.open),J=w(g,C.mounted),me=w(g,C.value),he=w(g,C.triggerProps),$=w(g,C.positionerElement),P=w(g,C.listElement),H=w(g,C.popupSide),oe=w(g,C.id),z=w(g,C.labelId),T=w(g,C.hasSelectedValue),Y=J&&$?H:null,k=c??oe,s=Or(O,z);un({id:k});const M=We($),ae=r.useRef(null),{getButtonProps:U,buttonRef:pe}=en({disabled:D,native:x}),ge=le(Z=>{g.set("triggerElement",Z)}),h=ht(),F=ht(),se=ht();r.useEffect(()=>{if(W)return se.start(Lr,()=>{V.current.allowUnselectedMouseUp=!0,V.current.allowSelectedMouseUp=!0}),()=>{se.clear()};V.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},F.clear()},[W,V,F,se]);const Se=Ot(he,{id:k,role:"combobox","aria-expanded":W?"true":"false","aria-haspopup":"listbox","aria-controls":W?P?.id??Xt($)?.id:void 0,"aria-labelledby":s,"aria-readonly":d||void 0,"aria-required":L||void 0,tabIndex:D?-1:0,onFocus(Z){a(!0),W&&j.current&&S(!1,Me(Dt,Z.nativeEvent)),h.start(0,()=>{g.set("forceMount",!0)})},onBlur(Z){He($,Z.relatedTarget)||(v(!0),a(!1),p==="onBlur"&&E.commit(me))},onMouseDown(Z){if(W)return;const ye=st(Z.currentTarget);function ce(ue){if(!ae.current)return;const de=ue.target;if(He(ae.current,de)||He(M.current,de))return;const ee=Vr(ae.current);ue.clientX>=ee.left-dt&&ue.clientX<=ee.right+dt&&ue.clientY>=ee.top-dt&&ue.clientY<=ee.bottom+dt||S(!1,Me(An,ue))}F.start(0,()=>{ye.addEventListener("mouseup",ce,{once:!0})})}},m,U),B=E.getValidationProps(D,Se);B.role="combobox";const ne={...R,open:W,disabled:D,value:me,readOnly:d,popupSide:Y,placeholder:!T};return Ze("button",t,{ref:[n,ae,pe,ge],state:ne,stateAttributesMapping:Fr,props:B})}),Dr={value:()=>null},ro=r.forwardRef(function(t,n){const{className:o,render:l,children:c,placeholder:i,style:x,...u}=t,{store:m,valueRef:v}=qe(),a=w(m,C.value),p=w(m,C.items),R=w(m,C.itemToStringLabel),b=w(m,C.hasSelectedValue),O=!b&&i!=null&&c==null,g=w(m,C.hasNullItemLabel,O),S={value:a,placeholder:!b};let V=null;return typeof c=="function"?V=c(a):c!=null?V=c:!b&&i!=null&&!g?V=i:Array.isArray(a)?V=Cr(a,p,R):V=dn(a,p,R),Ze("span",t,{state:S,ref:[n,v],props:[{children:V},u],stateAttributesMapping:Dr})}),Nr=r.createContext(void 0),oo=r.forwardRef(function(t,n){const{store:o}=qe(),l=w(o,C.mounted),c=w(o,C.forceMount);return l||c?be.jsx(Nr.Provider,{value:!0,children:be.jsx(On,{ref:n,...t})}):null}),gn=r.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function kr(){return r.useContext(gn)}function Ur(e){const{children:t,elementsRef:n,labelsRef:o,onMapChange:l}=e,c=le(l),i=r.useRef(0),x=yt(_r).current,u=yt(Hr).current,[m,v]=r.useState(0),a=r.useRef(m),p=le((S,V)=>{u.set(S,V??null),a.current+=1,v(a.current)}),R=le(S=>{u.delete(S),a.current+=1,v(a.current)}),b=r.useMemo(()=>{const S=new Map;return Array.from(u.keys()).filter(E=>E.isConnected).sort(Br).forEach((E,d)=>{const L=u.get(E)??{};S.set(E,{...L,index:d})}),S},[u,m]);G(()=>{if(typeof MutationObserver!="function"||b.size===0)return;const S=new MutationObserver(V=>{const E=new Set,d=L=>E.has(L)?E.delete(L):E.add(L);V.forEach(L=>{L.removedNodes.forEach(d),L.addedNodes.forEach(d)}),E.size===0&&(a.current+=1,v(a.current))});return b.forEach((V,E)=>{E.parentElement&&S.observe(E.parentElement,{childList:!0})}),()=>{S.disconnect()}},[b]),G(()=>{a.current===m&&(n.current.length!==b.size&&(n.current.length=b.size),o&&o.current.length!==b.size&&(o.current.length=b.size),i.current=b.size),c(b)},[c,b,n,o,m]),G(()=>()=>{n.current=[]},[n]),G(()=>()=>{o&&(o.current=[])},[o]);const O=le(S=>(x.add(S),()=>{x.delete(S)}));G(()=>{x.forEach(S=>S(b))},[x,b]);const g=r.useMemo(()=>({register:p,unregister:R,subscribeMapChange:O,elementsRef:n,labelsRef:o,nextIndexRef:i}),[p,R,O,n,o,i]);return be.jsx(gn.Provider,{value:g,children:t})}function Hr(){return new Map}function _r(){return new Set}function Br(e,t){const n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}const mn=r.createContext(void 0);function zr(){const e=r.useContext(mn);if(!e)throw new Error(it(59));return e}function xt(e,t){e&&Object.assign(e.style,t)}const jr={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},Wr={position:"fixed"},so=r.forwardRef(function(t,n){const{anchor:o,positionMethod:l="absolute",className:c,render:i,side:x="bottom",align:u="center",sideOffset:m=0,alignOffset:v=0,collisionBoundary:a="clipping-ancestors",collisionPadding:p,arrowPadding:R=5,sticky:b=!1,disableAnchorTracking:O,alignItemWithTrigger:g=!0,collisionAvoidance:S=Vn,style:V,...E}=t,{store:d,listRef:L,labelsRef:j,alignItemWithTriggerActiveRef:K,selectedItemTextRef:D,valuesRef:W,initialValueRef:J,popupRef:me,setValue:he}=qe(),$=ln(),P=w(d,C.open),H=w(d,C.mounted),oe=w(d,C.modal),z=w(d,C.value),T=w(d,C.openMethod),Y=w(d,C.positionerElement),k=w(d,C.triggerElement),s=w(d,C.isItemEqualToValue),M=w(d,C.transitionStatus),ae=r.useRef(null),U=r.useRef(null),[pe,ge]=r.useState(g),h=H&&pe&&T!=="touch";!H&&pe!==g&&ge(g),G(()=>{H||(C.scrollUpArrowVisible(d.state)&&d.set("scrollUpArrowVisible",!1),C.scrollDownArrowVisible(d.state)&&d.set("scrollDownArrowVisible",!1))},[d,H]),r.useImperativeHandle(K,()=>h),er((h||oe)&&P,T==="touch",Y,k);const F=tr({anchor:o,floatingRootContext:$,positionMethod:l,mounted:H,side:x,sideOffset:m,align:u,alignOffset:v,arrowPadding:R,collisionBoundary:a,collisionPadding:p,sticky:b,disableAnchorTracking:O??h,collisionAvoidance:S,keepMounted:!0}),se=h?"none":F.side,Se=h?Wr:F.positionerStyles,B={open:P,side:se,align:F.align,anchorHidden:F.anchorHidden};G(()=>{d.set("popupSide",F.side)},[d,F.side]);const ne=le(de=>{d.set("positionerElement",de)}),Z=nr(t,B,{styles:Se,transitionStatus:M,props:E,refs:[n,ne],hidden:!H,inert:!P}),ye=r.useRef(0),ce=le(de=>{if(de.size===0&&ye.current===0||W.current.length===0)return;const ee=ye.current;if(ye.current=de.size,de.size===ee)return;const xe=Me(Dt);if(ee!==0&&!d.state.multiple&&z!==null&&ot(W.current,z,s)===-1){const Q=J.current,A=Q!=null&&ot(W.current,Q,s)!==-1?Q:null;he(A,xe),A===null&&(d.set("selectedIndex",null),D.current=null)}if(ee!==0&&d.state.multiple&&Array.isArray(z)){const te=re=>ot(W.current,re,s)!==-1,Q=z.filter(re=>te(re));(Q.length!==z.length||Q.some(re=>!Er(z,re,s)))&&(he(Q,xe),Q.length===0&&(d.set("selectedIndex",null),D.current=null))}if(P&&h){d.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const te={height:""};xt(Y,te),xt(me.current,te)}}),ue=r.useMemo(()=>({...F,side:se,alignItemWithTriggerActive:h,setControlledAlignItemWithTrigger:ge,scrollUpArrowRef:ae,scrollDownArrowRef:U}),[F,se,h,ge]);return be.jsx(Ur,{elementsRef:L,labelsRef:j,onMapChange:ce,children:be.jsxs(mn.Provider,{value:ue,children:[H&&oe&&be.jsx(qn,{inert:Ln(!P),cutout:k}),Z]})})}),pt="base-ui-disable-scrollbar",qt={className:pt,getElement(e){return be.jsx("style",{nonce:e,href:pt,precedence:"base-ui:low",children:`.${pt}{scrollbar-width:none}.${pt}::-webkit-scrollbar{display:none}`})}},Yr=r.createContext(void 0),qr={disableStyleElements:!1};function Kr(){return r.useContext(Yr)??qr}const $r={...$n,...tn},io=r.forwardRef(function(t,n){const{render:o,className:l,style:c,finalFocus:i,...x}=t,{store:u,popupRef:m,onOpenChangeComplete:v,setOpen:a,valueRef:p,firstItemTextRef:R,selectedItemTextRef:b,multiple:O,handleScrollArrowVisibility:g,scrollHandlerRef:S,listRef:V,highlightItemOnHover:E}=qe(),{side:d,align:L,alignItemWithTriggerActive:j,isPositioned:K,setControlledAlignItemWithTrigger:D}=zr(),W=rr()!=null,J=ln(),me=or(),{nonce:he,disableStyleElements:$}=Kr(),P=w(u,C.id),H=w(u,C.open),oe=w(u,C.openMethod),z=w(u,C.mounted),T=w(u,C.popupProps),Y=w(u,C.transitionStatus),k=w(u,C.triggerElement),s=w(u,C.positionerElement),M=w(u,C.listElement),ae=r.useRef(!1),U=r.useRef(!1),pe=r.useRef({}),ge=Pt(),h=le(B=>{if(!s||!m.current||!U.current)return;if(ae.current||!j){g();return}const ne=s.style.top==="0px",Z=s.style.bottom==="0px";if(!ne&&!Z){g();return}const ye=$t(s),ce=rt(s.getBoundingClientRect().height,"y",ye),ue=st(s),de=bt(s),ee=de.getComputedStyle(s),xe=parseFloat(ee.marginTop),te=parseFloat(ee.marginBottom),Q=Kt(de.getComputedStyle(m.current)),re=Math.min(ue.documentElement.clientHeight-xe-te,Q),A=B.scrollTop,f=gt(B);let y=0,X=null,I=!1,_=!1;const ve=fe=>{s.style.height=`${fe}px`},De=(fe,Oe)=>{const Ve=tt(fe,0,re-ce);Ve>0&&ve(ce+Ve),B.scrollTop=Oe,re-(ce+Ve)<=Fe&&(ae.current=!0),g()},Ee=ne?f-A:A,Ae=Math.min(ce+Ee,re);if(y=Ae,Ee<=Fe){De(Ee,ne?f:0);return}if(re-Ae>Fe)ne?_=!0:X=0;else if(I=!0,Z&&A<f){const fe=ce+Ee-re;X=A-(Ee-fe)}if(y=Math.ceil(y),y!==0&&ve(y),_||X!=null){const fe=gt(B),Oe=_?fe:tt(X,0,fe);Math.abs(B.scrollTop-Oe)>Fe&&(B.scrollTop=Oe)}(I||y>=re-Fe)&&(ae.current=!0),g()});r.useImperativeHandle(S,()=>h,[h]),Ft({open:H,ref:m,onComplete(){H&&v?.(!0)}});const F={open:H,transitionStatus:Y,side:d,align:L};G(()=>{!s||!m.current||Object.keys(pe.current).length||(pe.current={top:s.style.top||"0",left:s.style.left||"0",right:s.style.right,height:s.style.height,bottom:s.style.bottom,minHeight:s.style.minHeight,maxHeight:s.style.maxHeight,marginTop:s.style.marginTop,marginBottom:s.style.marginBottom})},[m,s]),G(()=>{H||j||(U.current=!1,ae.current=!1,xt(s,pe.current))},[H,j,s,m]),G(()=>{const B=m.current;if(!H||!k||!s||!B||j&&!K||u.state.transitionStatus==="ending")return;if(!j){U.current=!0,ge.request(g),B.style.removeProperty("--transform-origin");return}const ne=Gr(B);B.style.removeProperty("--transform-origin");try{let Z=b.current;Z?.isConnected||(Z=!C.hasSelectedValue(u.state)&&R.current?.isConnected?R.current:null);const ye=p.current,ce=bt(s),ue=ce.getComputedStyle(s),de=ce.getComputedStyle(B),ee=st(k),xe=$t(k),te=mt(k.getBoundingClientRect(),xe),Q=mt(s.getBoundingClientRect(),xe),re=te.height,A=M||B,f=A.scrollHeight,y=parseFloat(de.borderBottomWidth),X=parseFloat(ue.marginTop)||10,I=parseFloat(ue.marginBottom)||10,_=parseFloat(ue.minHeight)||100,ve=Kt(de),De=5,Ee=5,Ae=20,fe=ee.documentElement.clientHeight-X-I,Oe=ee.documentElement.clientWidth,Ve=fe-te.bottom+re;let we,Ke=me==="rtl"?te.right-Q.width:te.left,$e=0;if(Z&&ye){const Ce=mt(ye.getBoundingClientRect(),xe);we=mt(Z.getBoundingClientRect(),xe),Ke=Q.left+(me==="rtl"?Ce.right-we.right:Ce.left-we.left);const Je=Ce.top-te.top+Ce.height/2;$e=we.top-Q.top+we.height/2-Je}const Ne=Ve+$e+I+y;let Pe=Math.min(fe,Ne);const _e=fe-X-I,Ge=Ne-Pe,Xe=Oe-Ee;s.style.left=`${tt(Ke,De,Xe-Q.width)}px`,s.style.height=`${Pe}px`,s.style.maxHeight="none",s.style.marginTop=`${X}px`,s.style.marginBottom=`${I}px`,B.style.height="100%";const ke=gt(A),Be=Ge>=ke-Fe;Be&&(Pe=Math.min(fe,Q.height)-(Ge-ke));const Qe=te.top<Ae||te.bottom>fe-Ae||Math.ceil(Pe)+Fe<Math.min(f,_),et=(ce.visualViewport?.scale??1)!==1&&Fn;if(Qe||et){U.current=!0,xt(s,pe.current),D(!1);return}const lt=Math.max(_,Pe);if(Be){const Ce=Math.max(0,fe-Ne);s.style.top=Q.height>=_e?"0":`${Ce}px`,s.style.height=`${Pe}px`,A.scrollTop=gt(A)}else s.style.bottom="0",A.scrollTop=Ge;if(we){const Ce=Q.top,Je=Q.height,ct=we.top+we.height/2,ut=Je>0?(ct-Ce)/Je*100:50,Et=tt(ut,0,100);B.style.setProperty("--transform-origin",`50% ${Et}%`)}(lt===fe||Pe>=ve)&&(ae.current=!0),g(),E&&u.state.selectedIndex===null&&u.state.activeIndex===null&&V.current[0]!=null&&u.set("activeIndex",0),U.current=!0}finally{ne()}},[u,H,s,k,p,R,b,m,g,j,D,ge,M,V,E,me,K]),r.useEffect(()=>{if(!j||!s||!H)return;const B=bt(s);function ne(Z){a(!1,Me(Nn,Z))}return Dn(B,"resize",ne)},[a,j,s,H]);const se={...M?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":O||void 0,id:`${P}-list`},onKeyDown(B){W&&Gn.has(B.key)&&B.stopPropagation()},onScroll(B){M||h(B.currentTarget)},...j&&{style:M?{height:"100%"}:jr}},Se=Ze("div",t,{ref:[n,m],state:F,stateAttributesMapping:$r,props:[T,se,lr(Y),{className:!M&&j?qt.className:void 0},x]});return be.jsxs(r.Fragment,{children:[!$&&qt.getElement(he),be.jsx(Kn,{context:J,modal:!1,disabled:!z,openInteractionType:oe,returnFocus:i,restoreFocus:!0,children:Se})]})});function Kt(e){const t=e.maxHeight||"";return t.endsWith("px")&&parseFloat(t)||1/0}function gt(e){return pn(e.scrollHeight,e.clientHeight)}function $t(e){return sr.getScale(e)}function rt(e,t,n){return e/n[t]}function mt(e,t){return ir({x:rt(e.x,"x",t),y:rt(e.y,"y",t),width:rt(e.width,"x",t),height:rt(e.height,"y",t)})}const Gt=[["transform","none"],["scale","1"],["translate","0 0"]];function Gr(e){const{style:t}=e,n={};for(const[o,l]of Gt)n[o]=t.getPropertyValue(o),t.setProperty(o,l,"important");return()=>{for(const[o]of Gt){const l=n[o];l?t.setProperty(o,l):t.removeProperty(o)}}}let hn=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function Xr(e={}){const{label:t,metadata:n,textRef:o,indexGuessBehavior:l,index:c}=e,{register:i,unregister:x,subscribeMapChange:u,elementsRef:m,labelsRef:v,nextIndexRef:a}=kr(),p=r.useRef(-1),[R,b]=r.useState(c??(l===hn.GuessFromOrder?()=>{if(p.current===-1){const S=a.current;a.current+=1,p.current=S}return p.current}:-1)),O=r.useRef(null),g=r.useCallback(S=>{if(O.current=S,R!==-1&&S!==null&&(m.current[R]=S,v)){const V=t!==void 0;v.current[R]=V?t:o?.current?.textContent??S.textContent}},[R,m,v,t,o]);return G(()=>{if(c!=null)return;const S=O.current;if(S)return i(S,n),()=>{x(S)}},[c,i,x,n]),G(()=>{if(c==null)return u(S=>{const V=O.current?S.get(O.current)?.index:null;V!=null&&b(V)})},[c,u,b]),{ref:g,index:R}}const bn=r.createContext(void 0);function kt(){const e=r.useContext(bn);if(!e)throw new Error(it(57));return e}const lo=r.memo(r.forwardRef(function(t,n){const{render:o,className:l,style:c,value:i=null,label:x,disabled:u=!1,nativeButton:m=!1,...v}=t,a=r.useRef(null),p=Xr({label:x,textRef:a,indexGuessBehavior:hn.GuessFromOrder}),{store:R,itemProps:b,setOpen:O,setValue:g,selectionRef:S,typingRef:V,valuesRef:E,multiple:d,selectedItemTextRef:L,disabled:j,readOnly:K}=qe(),D=w(R,C.isActive,p.index),W=w(R,C.open),J=w(R,C.isSelected,i),me=w(R,C.isSelectedByFocus,p.index),he=w(R,C.isItemEqualToValue),$=p.index,P=$!==-1,H=r.useRef(null);G(()=>{if(!P)return;const h=E.current;return h[$]=i,()=>{delete h[$]}},[P,$,i,E]),G(()=>{if(!P)return;const h=R.state.value;let F=h;d&&Array.isArray(h)&&(F=h.length>0?h[h.length-1]:void 0),F!==void 0&&Ye(i,F,he)&&(R.set("selectedIndex",$),a.current&&(L.current=a.current))},[P,$,d,he,R,i,L]);const oe=r.useRef(null),z=r.useRef("mouse"),T=r.useRef(!1),{getButtonProps:Y,buttonRef:k}=en({disabled:u,focusableWhenDisabled:!0,native:m,composite:!0}),s={disabled:u,selected:J,highlighted:D};function M(h){if(j||K)return;const F=R.state.value;if(d){const se=Array.isArray(F)?F:[],Se=J?Tr(se,i,he):[...se,i];g(Se,Me(vt,h))}else g(i,Me(vt,h)),O(!1,Me(vt,h))}function ae(){S.current.dragY=0}const U={role:"option","aria-selected":J,tabIndex:W&&D?0:-1,onKeyDown(h){oe.current=h.key,R.set("activeIndex",$),h.key===" "&&V.current&&h.preventDefault()},onClick(h){const F=h.type==="click"&&z.current!=="touch",se=h.nativeEvent.pointerType,Se=F&&nn(h.nativeEvent)&&(se!==void 0||D),B=F&&!Se&&!T.current;T.current=!1,!(h.type==="keydown"&&oe.current===null)&&(u||h.type==="keydown"&&oe.current===" "&&V.current||B||(oe.current=null,M(h.nativeEvent)))},onPointerEnter(h){z.current=h.pointerType},onPointerMove(h){if(h.pointerType==="mouse"&&h.buttons===1){const F=S.current;F.dragY+=h.movementY,F.dragY**2>=64&&(F.allowUnselectedMouseUp=!0)}},onPointerDown(h){z.current=h.pointerType,T.current=!0,ae()},onMouseUp(){if(ae(),u||z.current==="touch"||T.current)return;const h=!S.current.allowSelectedMouseUp&&J,F=!S.current.allowUnselectedMouseUp&&!J;h||F||(T.current=!0,H.current?.click(),T.current=!1)}},pe=Ze("div",t,{ref:[k,n,p.ref,H],state:s,props:[b,U,v,Y]}),ge=r.useMemo(()=>({selected:J,index:$,textRef:a,selectedByFocus:me,hasRegistered:P}),[J,$,a,me,P]);return be.jsx(bn.Provider,{value:ge,children:pe})})),co=r.forwardRef(function(t,n){const o=t.keepMounted??!1,{selected:l}=kt();return o||l?be.jsx(Jr,{...t,ref:n}):null}),Jr=r.memo(r.forwardRef((e,t)=>{const{render:n,className:o,style:l,keepMounted:c,...i}=e,{selected:x}=kt(),u=r.useRef(null),{transitionStatus:m,setMounted:v}=rn(x),p=Ze("span",e,{ref:[t,u],state:{selected:x,transitionStatus:m},props:[{"aria-hidden":!0,children:"✔️"},i],stateAttributesMapping:tn});return Ft({open:x,ref:u,onComplete(){x||v(!1)}}),p})),uo=r.memo(r.forwardRef(function(t,n){const{index:o,textRef:l,selectedByFocus:c,hasRegistered:i}=kt(),{firstItemTextRef:x,selectedItemTextRef:u}=qe(),{render:m,className:v,style:a,...p}=t,R=r.useCallback(O=>{O&&(i&&o===0&&(x.current=O),i&&c&&(u.current=O))},[x,u,o,c,i]);return Ze("div",t,{ref:[R,n,l],props:p})}));export{jr as L,to as S,zr as a,qt as b,no as c,ro as d,oo as e,so as f,io as g,lo as h,co as i,uo as j,br as k,wr as l,Nt as m,cn as n,Wt as o,Rr as p,C as s,qe as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{m as C,j as t,e as N,c as a,a as ne,r as d,as as ae,aJ as ie,ay as se,az as oe,aa as U,aK as re,aL as le,u as ce,d as P,a1 as ue,a4 as F,n as I,aM as de,aN as ge,S as B,aO as me,x as he,aP as be,aQ as pe,aR as xe,aS as fe,aT as ye,aU as ve,aV as je,L as ke,R as Ne,aW as Se,aX as Ce,a7 as T,h as we,aY as Le}from"./__vite-browser-external-CJKqcpDH.js";import{a as Ae,b as G,s as Pe,K as Oe,P as Ee,D as _e,c as Ie,S as Te,v as Ge,u as Re,C as Me}from"./sortable.esm-D0uuKRuC.js";import{a as De}from"./modifiers.esm-ojj_Qc0M.js";import{u as Ue,L as R}from"./use-limits-display-prefs-BYFhDgc5.js";import{P as Fe}from"./ProviderIcon-BWkcPxs4.js";import{a as M,l as D}from"./limits-providers-CRgPyf-x.js";import{m as Be}from"./react-BHsz7M69.js";import{a as S,T as x,b as h,S as O,u as L}from"./Controls-DbUsLnx1.js";import{P as He,u as $e,a as Ve}from"./use-session-efficiency-pref-DfZjbzAF.js";import{C as ze}from"./check-BEWd6UpN.js";import{C as Ke}from"./copy-BIsDzDWe.js";import{A as qe}from"./index-DZLIheW-.js";import{u as Ze}from"./useCurrency-BPhEg_fN.js";import{u as We}from"./useTokenFormat-DufvECQn.js";import{S as H}from"./Select-8nxnFfns.js";import{I as Ye}from"./info-JYfDozdx.js";import{C as Qe}from"./ConfirmModal-CNgB03kI.js";import{A as Je}from"./arrow-up-right-UeW7i2I9.js";import{D as Xe}from"./download-D5IMcY87.js";import"./Card-DyzEgcah.js";import"./ToolbarRootContext-DM-WFqY6.js";import"./useScrollLock-DXsFDMbK.js";import"./SelectItemText-D-pVcs50.js";import"./DialogTitle-CU0DrIQb.js";import"./store-peMgm1Ye.js";import"./DialogDescription-DZliagFg.js";const et=[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]],tt=C("flask-conical",et);const nt=[["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"}]],at=C("grip-vertical",nt);const it=[["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"}]],st=C("languages",it);const ot=[["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"}]],rt=C("log-out",ot);const lt=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],ct=C("palette",lt);const ut=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],dt=C("user-round",ut),gt="shrink-0 text-oai-gray-900 dark:text-oai-gray-200";function mt({checked:e,onChange:n,ariaLabel:i}){return t.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":i,onClick:n,className:N("relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",e?"bg-oai-brand-500":"bg-oai-gray-300 dark:bg-oai-gray-700"),children:t.jsx("span",{className:N("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",e?"translate-x-[18px]":"translate-x-[3px]")})})}function ht({id:e,visible:n,onToggle:i}){const{attributes:s,listeners:o,setNodeRef:r,transform:l,transition:c,isDragging:u}=Re({id:e}),b={transform:Me.Transform.toString(l)||void 0,transition:c,zIndex:u?20:void 0};return t.jsxs("div",{ref:r,style:b,className:N("flex items-center gap-3 py-2 rounded-md select-none touch-none","cursor-grab active:cursor-grabbing","hover:bg-oai-gray-100/60 dark:hover:bg-oai-gray-800/60","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",u&&"relative bg-oai-gray-100 dark:bg-oai-gray-800"),...s,...o,children:[t.jsx(at,{className:"h-4 w-4 shrink-0 text-oai-gray-400 dark:text-oai-gray-500",strokeWidth:1.75,"aria-hidden":!0}),M(e)?t.jsx(Fe,{provider:M(e),size:18,className:N("pointer-events-none",gt)}):null,t.jsx("span",{className:"flex-1 text-sm text-oai-gray-900 dark:text-oai-gray-200",children:D(e)}),t.jsx("div",{onPointerDown:m=>m.stopPropagation(),children:t.jsx(mt,{checked:n,onChange:i,ariaLabel:`${a("limits.settings.toggle_visible")}: ${D(e)}`})})]})}function bt({prefs:e}){const{order:n,visibility:i,toggle:s,moveToward:o}=e,r=Ae(G(Ee,{activationConstraint:{distance:6}}),G(Oe,{coordinateGetter:Pe})),l=({active:c,over:u})=>{u&&c.id!==u.id&&o(c.id,u.id)};return t.jsx(_e,{sensors:r,collisionDetection:Ie,modifiers:[De],onDragEnd:l,children:t.jsx(Te,{items:n,strategy:Ge,children:t.jsx("div",{className:"flex flex-col",children:n.map(c=>t.jsx(ht,{id:c,visible:i[c]!==!1,onToggle:()=>s(c)},c))})})})}function pt(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:{},s=n.full_name||n.name||i.name||n.user_name||n.preferred_username;return typeof s=="string"&&s.trim()?s.trim():typeof e.email=="string"&&e.email.includes("@")?e.email.split("@")[0].trim()||e.email.trim():typeof e.email=="string"?e.email.trim():""}function xt(e){return!e||typeof e!="object"?"":typeof e.email=="string"?e.email.trim():""}function ft(e){const n=typeof e=="string"?e.trim():"";if(!n)return null;const i=n.match(/^@?([A-Za-z0-9][A-Za-z0-9-]{0,38})$/),s=n.match(/^https:\/\/github\.com\/([A-Za-z0-9][A-Za-z0-9-]{0,38})\/?$/i),o=i?.[1]||s?.[1];return o?`https://github.com/${o}`:null}function E(e,n){console.warn(`[tokentracker] settings ${e}:`,n)}function yt(e,n,i){const[s,o]=d.useState(()=>ae()),r=n&&i&&ie(),l=d.useCallback(async()=>{const c=!s;if(se(c),o(c),!!c)try{await oe(()=>e())}catch(u){E("cloud sync",u)}},[s,e]);return{cloudSyncOn:s,handleCloudSyncToggle:l,showLocalCloudSync:r}}function vt(e){const[n,i]=d.useState(!1),[s,o]=d.useState(!1),[r,l]=d.useState(!1),[c,u]=d.useState(!1),[b,m]=d.useState(null),[y,v]=d.useState(!1),[g,f]=d.useState(""),[p,j]=d.useState(!1),[w,_]=d.useState(""),[K,q]=d.useState(""),[Z,W]=d.useState(!1),[Y,Q]=d.useState(null),J=d.useMemo(()=>pt(e),[e]),X=d.useMemo(()=>xt(e),[e]),ee=d.useMemo(()=>typeof e?.id=="string"?e.id.trim():"",[e]),te=d.useMemo(()=>({setAnonymousOn:o,setCustomDisplayName:m,setGithubUrl:_,setProfileLoading:l,setPublicProfileOn:i,setShowGithubOn:j}),[]);return{anonymousOn:s,customDisplayName:b,displayName:J,editingGithub:Z,editingName:y,email:X,githubError:Y,githubInput:K,githubUrl:w,loadSetters:te,nameInput:g,profileLoading:r,profileSaving:c,publicProfileOn:n,setAnonymousOn:o,setCustomDisplayName:m,setEditingGithub:W,setEditingName:v,setGithubError:Q,setGithubInput:q,setGithubUrl:_,setNameInput:f,setProfileLoading:l,setProfileSaving:u,setPublicProfileOn:i,setShowGithubOn:j,showGithubOn:p,userId:ee}}function jt(e,n,i){d.useEffect(()=>{if(!n)return;let s=!0;return i.setProfileLoading(!0),(async()=>{try{const o=await U({getAccessToken:e});if(!s||!o)return;const r=await re({accessToken:o});if(!s)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){E("load public profile",o)}finally{s&&i.setProfileLoading(!1)}})(),()=>{s=!1}},[e,n,i])}function kt(e,n){return d.useCallback(async(i,{label:s,onError:o,onSuccess:r}={})=>{if(n.profileSaving)return!1;n.setProfileSaving(!0);try{const l=await U({getAccessToken:e});if(!l)return!1;const c=await le({accessToken:l,...i});return r?.(c),!0}catch(l){return o?o(l):E(s||"mutate profile",l),!1}finally{n.setProfileSaving(!1)}},[e,n])}function Nt(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 St(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 Ct(e,n){const i=d.useCallback(async()=>{const o=!e.publicProfileOn;await n({enabled:o},{label:"toggle public profile",onSuccess:()=>e.setPublicProfileOn(o)})},[n,e]);return{handleAnonymousToggle:d.useCallback(async()=>{const o=!e.anonymousOn;await n({anonymous:o},{label:"toggle anonymous",onSuccess:()=>e.setAnonymousOn(o)})},[n,e]),handlePublicProfileToggle:i}}function wt(e,n,i){const s=d.useCallback(async()=>{const r=e.nameInput.trim().slice(0,50);r&&await n({display_name:r},{label:"save display name",onSuccess:()=>{e.setCustomDisplayName(r),e.setEditingName(!1),i?.()}})},[n,e,i]),o=d.useCallback(()=>{e.setNameInput(e.customDisplayName||e.displayName),e.setEditingName(!0)},[e]);return{handleSaveName:s,startEditingName:o}}function Lt(e,n){const i=d.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]),s=d.useCallback(async()=>{const r=ft(e.githubInput);if(e.githubInput.trim()&&!r){e.setGithubError(a("settings.account.githubUrlInvalid"));return}e.setGithubError(null),await n({github_url:r,show_github_url:!!r},{label:"save GitHub profile",onError:l=>e.setGithubError(l?.message||a("settings.account.githubUrlInvalid")),onSuccess:l=>{e.setGithubUrl(l?.github_url||r||""),e.setShowGithubOn(!!r),e.setEditingGithub(!1)}})},[n,e]),o=d.useCallback(()=>{e.setGithubInput(e.githubUrl),e.setGithubError(null),e.setEditingGithub(!0)},[e]);return{handleSaveGithub:s,handleShowGithubToggle:i,startEditingGithub:o}}function At(){const e=ne(),n=vt(e.user),i=yt(e.getAccessToken,e.enabled,e.signedIn);jt(e.getAccessToken,e.signedIn,n.loadSetters);const s=kt(e.getAccessToken,n),o=Ct(n,s),r=wt(n,s,e.refreshDisplayName),l=Lt(n,s);return{...e,...i,email:n.email,handlePublicProfileToggle:o.handlePublicProfileToggle,userId:n.userId,name:Nt(n,{...o,...r}),github:St(n,l),profileLoading:n.profileLoading,profileSaving:n.profileSaving,publicProfileOn:n.publicProfileOn}}function $({disabled:e,onCancel:n,onSave:i,saveLabel:s=a("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:s}),t.jsx("button",{type:"button",onClick:n,className:"rounded-md px-2 py-1.5 text-xs text-oai-gray-500 transition-colors hover:text-oai-gray-700 dark:hover:text-oai-gray-300",children:a("settings.account.cancel")})]})}function Pt({nameInput:e,setEditingName:n,setNameInput:i,profileSaving:s,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:a("settings.account.displayName")}),t.jsx($,{disabled:s||!e.trim(),onCancel:()=>n(!1),onSave:o,saveLabel:s?a("settings.account.saving"):void 0})]})}function Ot({githubError:e,githubInput:n,handleSaveGithub:i,profileSaving:s,setEditingGithub:o,setGithubError:r,setGithubInput:l}){return t.jsxs("div",{className:"mt-2",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("input",{type:"text",value:n,onChange:c=>{l(c.target.value),e&&r(null)},onKeyDown:c=>{c.key==="Enter"&&i(),c.key==="Escape"&&(o(!1),r(null))},maxLength:100,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white",placeholder:a("settings.account.githubUrlPlaceholder")}),t.jsx($,{disabled:s,onCancel:()=>{o(!1),r(null)},onSave:i,saveLabel:s?a("settings.account.saving"):void 0})]}),e?t.jsx("div",{className:"mt-1.5 text-xs text-red-600 dark:text-red-400",children:e}):null]})}function V({disabled:e=!1,label:n,onClick:i,title:s}){return t.jsxs("button",{type:"button",onClick:i,disabled:e,title:s,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(He,{className:"h-3.5 w-3.5","aria-hidden":!0}),n]})}function z({actions:e,editing:n,editor:i,hint:s,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:s})]}),n?null:e]})})}function Et({name:e}){const n=e.anonymousOn?a("settings.account.displayNameDisabledWhileAnon"):void 0;return t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsx(V,{disabled:e.anonymousOn,label:a("settings.account.edit"),onClick:e.startEditingName,title:n}),t.jsx(x,{checked:!e.anonymousOn,onChange:e.handleAnonymousToggle,disabled:e.profileLoading||e.profileSaving,ariaLabel:a("settings.account.displayName")})]})}function _t({name:e}){const{anonymousOn:n,customDisplayName:i,displayName:s,editingName:o,handleAnonymousToggle:r,handleSaveName:l,nameInput:c,profileLoading:u,profileSaving:b,setEditingName:m,setNameInput:y,startEditingName:v}=e,g=n?a("settings.account.displayNameAnonymousHint"):i||s;return t.jsx(z,{label:a("settings.account.displayName"),editing:o,hint:g,editor:t.jsx(Pt,{nameInput:c,setEditingName:m,setNameInput:y,profileSaving:b,handleSaveName:l}),actions:t.jsx(Et,{name:e})})}function It({github:e}){const{editingGithub:n,githubError:i,githubInput:s,githubUrl:o,handleSaveGithub:r,handleShowGithubToggle:l,profileLoading:c,profileSaving:u,setEditingGithub:b,setGithubError:m,setGithubInput:y,showGithubOn:v,startEditingGithub:g}=e;return t.jsx(t.Fragment,{children:t.jsx(z,{label:a("settings.account.githubUrl"),editing:n,hint:o||a("settings.account.githubUrlHint"),editor:t.jsx(Ot,{githubError:i,githubInput:s,handleSaveGithub:r,profileSaving:u,setEditingGithub:b,setGithubError:m,setGithubInput:y}),actions:t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsx(V,{label:a("settings.account.edit"),onClick:g}),t.jsx(x,{checked:v,onChange:l,disabled:c||u,ariaLabel:a("settings.account.githubUrl")})]})})})}function Tt(){const{openLoginModal:e}=ce();return t.jsx(S,{title:a("settings.section.account"),children:t.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[t.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:a("settings.account.signedOutHint")}),t.jsx("button",{type:"button",onClick:e,className:"inline-flex h-8 shrink-0 items-center justify-center rounded-md bg-oai-gray-900 px-4 text-xs font-medium text-white transition-colors hover:bg-oai-gray-800 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100",children:a("settings.account.signIn")})]})})}function Gt({name:e,github:n}){return t.jsxs(t.Fragment,{children:[t.jsx(_t,{name:e}),t.jsx(It,{github:n})]})}function Rt(){const e=At();return e.enabled?e.signedIn?t.jsxs(S,{title:a("settings.section.account"),subtitle:e.email||e.name.customDisplayName||e.name.displayName,action:t.jsx(Dt,{onSignOut:e.signOut}),children:[t.jsx(Mt,{userId:e.userId}),t.jsx(Ut,{settings:e}),t.jsx(Ft,{checked:e.publicProfileOn,disabled:e.profileLoading||e.profileSaving,onChange:e.handlePublicProfileToggle}),t.jsx(Bt,{visible:e.publicProfileOn,name:e.name,github:e.github})]}):t.jsx(Tt,{}):null}function Mt({userId:e}){const[n,i]=P.useState(!1);if(!e)return null;const s=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:a("settings.account.userId")}),t.jsx("div",{className:"mt-0.5 truncate font-mono text-xs text-oai-gray-500 dark:text-oai-gray-400",children:e})]}),t.jsxs("button",{type:"button",onClick:s,className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800","aria-label":a("settings.account.copyUserId"),children:[n?t.jsx(ze,{className:"h-3.5 w-3.5","aria-hidden":!0}):t.jsx(Ke,{className:"h-3.5 w-3.5","aria-hidden":!0}),n?a("settings.account.copied"):a("settings.account.copy")]})]})}function Dt({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(rt,{className:"h-3.5 w-3.5","aria-hidden":!0}),a("settings.account.signOut")]})}function Ut({settings:e}){return e.showLocalCloudSync?t.jsx(h,{label:a("settings.account.cloudSync"),hint:a("settings.account.cloudSyncHint"),control:t.jsx(x,{checked:e.cloudSyncOn,onChange:e.handleCloudSyncToggle,ariaLabel:a("settings.account.cloudSync")})}):null}function Ft({checked:e,disabled:n,onChange:i}){return t.jsx(h,{label:a("settings.account.publicProfile"),hint:a("settings.account.publicProfileHint"),control:t.jsx(x,{checked:e,onChange:i,disabled:n,ariaLabel:a("settings.account.publicProfile")})})}function Bt({visible:e,name:n,github:i}){return t.jsx(qe,{initial:!1,children:e?t.jsx(Be.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{height:{duration:.28,ease:[.22,1,.36,1]},opacity:{duration:.2,ease:[.22,1,.36,1]}},style:{overflow:"hidden"},className:"divide-y divide-oai-gray-200/60 dark:divide-oai-gray-800/60",children:t.jsx(Gt,{name:n,github:i})},"public-profile-fields"):null})}function Ht(){return[{value:"light",label:a("settings.appearance.theme.light"),Icon:de},{value:"dark",label:a("settings.appearance.theme.dark"),Icon:ge},{value:"system",label:a("settings.appearance.theme.system"),Icon:B}]}function $t(){return[{value:be,label:a("settings.appearance.language.system")},{value:pe,label:a("settings.appearance.language.english")},{value:xe,label:a("settings.appearance.language.chinese")},{value:fe,label:a("settings.appearance.language.traditional_chinese")},{value:ye,label:a("settings.appearance.language.japanese")},{value:ve,label:a("settings.appearance.language.korean")},{value:je,label:a("settings.appearance.language.german")}]}function Vt(e){if(!e)return null;try{const n=new Date(e);return Number.isNaN(n.getTime())?null:n.toLocaleString()}catch{return null}}function zt(e,n){const i=a(`settings.appearance.currency.rate_source.${e}`),s=Vt(n),o=s?a("settings.appearance.currency.rate_updated",{when:s}):a("settings.appearance.currency.rate_never");return`${i} · ${o}`}function Kt({locale:e,setLocale:n}){const i=$t();return t.jsx(H,{value:e,onValueChange:n,options:i,ariaLabel:a("settings.appearance.language.label"),className:"px-2.5 py-1.5 text-xs font-medium",leadingIcon:t.jsx(st,{className:"h-3.5 w-3.5 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})})}function qt({currency:e,setCurrency:n}){const i=me().map(s=>({value:s.code,label:a(s.labelKey)}));return t.jsx(H,{value:e,onValueChange:n,options:i,ariaLabel:a("settings.appearance.currency.label"),className:"px-3 py-1.5 text-xs font-medium"})}function Zt({currency:e,rate:n,rateSource:i,rateFetchedAt:s}){if(e===he)return t.jsx(t.Fragment,{children:a("settings.appearance.currency.hint")});const o=zt(i,s);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(Ye,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})}function Wt(){const{theme:e,setTheme:n}=ue(),{locale:i,setLocale:s}=F(),{currency:o,rate:r,rateSource:l,rateFetchedAt:c,setCurrency:u}=Ze(),{mode:b,setMode:m}=We();return t.jsxs(S,{title:a("settings.section.appearance"),children:[t.jsx(h,{label:a("settings.appearance.theme.label"),hint:a("settings.appearance.theme.hint"),control:t.jsx(O,{options:Ht(),value:e,onChange:n})}),t.jsx(h,{label:a("settings.appearance.language.label"),hint:a("settings.appearance.language.hint"),control:t.jsx(Kt,{locale:i,setLocale:s})}),t.jsx(h,{label:a("settings.appearance.currency.label"),hint:t.jsx(Zt,{currency:o,rate:r,rateSource:l,rateFetchedAt:c}),control:t.jsx(qt,{currency:o,setCurrency:u})}),t.jsx(h,{label:a("settings.appearance.token_format.label"),hint:a("settings.appearance.token_format.hint"),control:t.jsx(O,{options:[{value:I.COMPACT,label:a("settings.appearance.token_format.compact")},{value:I.FULL,label:a("settings.appearance.token_format.full")}],value:b,onChange:m})})]})}function A({labelKey:e}){return t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("span",{children:a(e)}),t.jsx("span",{className:"px-1.5 py-0.5 text-[8px] font-semibold tracking-wider text-oai-gray-500 bg-oai-gray-100 dark:text-oai-gray-400 dark:bg-oai-gray-800/80 rounded uppercase scale-90 origin-left",children:a("qpd.card.badge")})]})}function Yt(){const{enabled:e,toggle:n}=$e(),{enabled:i,toggle:s}=Ve(),{available:o,settings:r,setSetting:l}=L(),c=o&&!!r?.dynamicIslandSupported,u=!!r?.dynamicIslandEnabled;return t.jsxs(S,{title:a("settings.section.labs"),children:[c&&t.jsxs(t.Fragment,{children:[t.jsx(h,{label:t.jsx(A,{labelKey:"settings.labs.island.label"}),hint:a("settings.labs.island.hint"),control:t.jsx(x,{checked:u,onChange:()=>l("dynamicIslandEnabled",!u),ariaLabel:a("settings.labs.island.aria")})}),u&&t.jsx(h,{label:a("settings.labs.island_hide_menubar.label"),hint:a("settings.labs.island_hide_menubar.hint"),control:t.jsx(x,{checked:!!r?.hideMenuBarIcon,onChange:()=>l("hideMenuBarIcon",!r?.hideMenuBarIcon),ariaLabel:a("settings.labs.island_hide_menubar.aria")})})]}),t.jsx(h,{label:t.jsx(A,{labelKey:"settings.labs.qpd.label"}),hint:a("settings.labs.qpd.hint"),control:t.jsx(x,{checked:e,onChange:n,ariaLabel:a("settings.labs.qpd.aria")})}),t.jsx(h,{label:t.jsx(A,{labelKey:"settings.labs.sessions.label"}),hint:a("settings.labs.sessions.hint"),control:t.jsx(x,{checked:i,onChange:s,ariaLabel:a("settings.labs.sessions.aria")})})]})}function Qt(){const{available:e,settings:n,setSetting:i,runAction:s}=L();if(!e)return null;const o=!!n?.launchAtLogin,r=n?.toastOnReset!==!1,l=n?.confettiOnReset!==!1,c=n?.launchAtLoginSupported!==!1,u=n?.updateStatus||null,b=!!n?.updateBusy,m=!!n?.isSyncing;return t.jsxs(S,{title:a("settings.section.menubar"),children:[t.jsx(h,{label:a("settings.menubar.appearance"),hint:a("settings.menubar.appearanceHint"),control:t.jsxs(ke,{to:"/widgets",className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 no-underline transition-colors hover:bg-oai-gray-100 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[a("settings.menubar.appearanceLink"),t.jsx(Je,{className:"h-3.5 w-3.5","aria-hidden":!0})]})}),t.jsx(h,{label:a("settings.menubar.toastOnReset"),hint:a("settings.menubar.toastOnResetHint"),control:t.jsx(x,{checked:r,onChange:()=>i("toastOnReset",!r),ariaLabel:a("settings.menubar.toastOnReset")})}),t.jsx(h,{label:a("settings.menubar.confettiOnReset"),hint:a("settings.menubar.confettiOnResetHint"),control:t.jsx(x,{checked:l,onChange:()=>i("confettiOnReset",!l),ariaLabel:a("settings.menubar.confettiOnReset")})}),c?t.jsx(h,{label:a("settings.menubar.launchAtLogin"),hint:a("settings.menubar.launchAtLoginHint"),control:t.jsx(x,{checked:o,onChange:()=>i("launchAtLogin",!o),ariaLabel:a("settings.menubar.launchAtLogin")})}):null,t.jsx(h,{label:a("settings.menubar.syncNow"),hint:a("settings.menubar.syncNowHint"),control:t.jsxs("button",{type:"button",onClick:()=>s("syncNow"),disabled:m,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[t.jsx(Ne,{className:N("h-3.5 w-3.5",m&&"animate-spin"),"aria-hidden":!0}),m?a("settings.menubar.syncing"):a("settings.menubar.syncNow")]})}),t.jsx(h,{label:a("settings.menubar.updates"),hint:u||void 0,control:t.jsxs("button",{type:"button",onClick:()=>s("checkForUpdates"),disabled:b,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(Xe,{className:"h-3.5 w-3.5","aria-hidden":!0}),a("settings.menubar.checkUpdates")]})})]})}function Jt(e,n){function i(r){return r.replace(/^v/,"").split(".").map(Number)}const s=i(e),o=i(n);for(let r=0;r<Math.max(s.length,o.length);r++){const l=s[r]||0,c=o[r]||0;if(l<c)return!0;if(l>c)return!1}return!1}function Xt(){const{available:e,settings:n,runAction:i}=L(),s=e&&n?.version,[o,r]=P.useState(!1),[l,c]=P.useState({open:!1,latestVersion:"",htmlUrl:""}),{resolvedLocale:u}=F(),b="0.88.5",m=async()=>{r(!0);try{const p=await fetch("https://api.github.com/repos/xiufengsun/TokenTracker/releases/latest");if(!p.ok)throw new Error("Failed to fetch");const j=await p.json(),w=j.tag_name;Jt(b,w)?c({open:!0,latestVersion:w,htmlUrl:j.html_url}):T({title:a("settings.menubar.updates.upToDate")})}catch(p){console.error("Check updates failed:",p),T({title:a("settings.menubar.updates.failed")})}finally{r(!1)}},y=a("settings.menubar.updates.modalTitle"),v=a("settings.menubar.updates.modalDescription",{version:l.latestVersion}),g=a("settings.menubar.updates.modalConfirm"),f=a("settings.menubar.updates.modalCancel");return t.jsxs("div",{className:"mt-6 flex flex-col items-center justify-center gap-4 text-xs text-oai-gray-500 dark:text-oai-gray-500",children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[s?t.jsxs(t.Fragment,{children:[t.jsx("span",{children:a("settings.menubar.updates.footerCombined",{barVersion:n.version,coreVersion:b})}),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:"·"})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{children:a("settings.menubar.updates.footerCore",{version:b})}),t.jsx("span",{"aria-hidden":!0,children:"·"}),t.jsx("button",{type:"button",onClick:m,disabled:o,className:"underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300 disabled:opacity-50",children:o?a("settings.menubar.updates.checking"):a("settings.menubar.checkUpdates")}),t.jsx("span",{"aria-hidden":!0,children:"·"})]}),t.jsxs("a",{href:Se,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(Ce,{className:"h-3.5 w-3.5","aria-hidden":!0}),a("settings.footer.statusPage")]})]}),t.jsx(Qe,{open:l.open,title:y,description:v,confirmLabel:g,cancelLabel:f,onConfirm:()=>{window.open(l.htmlUrl,"_blank"),c(p=>({...p,open:!1}))},onCancel:()=>c(p=>({...p,open:!1}))})]})}const k={APPEARANCE:"appearance",NATIVE_APP:"native-app",ACCOUNT:"account",LIMITS:"limits",LABS:"labs"};function en({prefs:e}){return t.jsx(O,{options:[{value:R.USED,label:a("limits.settings.display_mode_used")},{value:R.REMAINING,label:a("limits.settings.display_mode_remaining")}],value:e.displayMode,onChange:e.setDisplayMode})}function An(){const e=Ue(),{available:n,settings:i,setSetting:s}=L(),o=i?.toastOnReset!==!1,r=i?.confettiOnReset!==!1,[l,c]=we(),u=l.get("section"),m=Object.values(k).includes(u)&&(u!==k.NATIVE_APP||n)?u:k.APPEARANCE,y=g=>{const f=new URLSearchParams(l);g===k.APPEARANCE?f.delete("section"):f.set("section",g),c(f,{replace:!0})},v=[{id:k.APPEARANCE,label:a("settings.section.appearance"),Icon:ct,content:t.jsx(Wt,{})},...n?[{id:k.NATIVE_APP,label:a("settings.section.menubar"),Icon:B,content:t.jsx(Qt,{})}]:[],{id:k.ACCOUNT,label:a("settings.section.account"),Icon:dt,content:t.jsx(Rt,{})},{id:k.LIMITS,label:a("settings.section.limits"),Icon:Le,content:t.jsxs("div",{className:"space-y-4",children:[t.jsxs(S,{title:a("settings.section.limits"),children:[t.jsx(h,{label:a("limits.settings.display_mode_label"),control:t.jsx(en,{prefs:e})}),t.jsx(h,{label:a("settings.menubar.toastOnReset"),hint:a("settings.menubar.toastOnResetHint"),control:t.jsx(x,{checked:o,disabled:!n,onChange:()=>s("toastOnReset",!o),ariaLabel:a("settings.menubar.toastOnReset")})}),t.jsx(h,{label:a("settings.menubar.confettiOnReset"),hint:a("settings.menubar.confettiOnResetHint"),control:t.jsx(x,{checked:r,disabled:!n,onChange:()=>s("confettiOnReset",!r),ariaLabel:a("settings.menubar.confettiOnReset")})})]}),t.jsx(S,{title:a("settings.limits.providers"),children:t.jsx(bt,{prefs:e})})]})},{id:k.LABS,label:a("settings.section.labs"),Icon:tt,content:t.jsx(Yt,{})}];return t.jsx("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:t.jsx("main",{className:"flex-1 pb-12 pt-8 sm:pb-16 sm:pt-10",children:t.jsxs("div",{className:"mx-auto w-full max-w-5xl px-4 sm:px-6",children:[t.jsx("div",{className:"mb-7",children:t.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:a("settings.page.title")})}),t.jsxs("div",{className:"grid min-w-0 gap-6 md:grid-cols-[12rem_minmax(0,1fr)] md:gap-8 lg:grid-cols-[13.5rem_minmax(0,1fr)]",children:[t.jsx("aside",{className:"min-w-0 border-b border-oai-gray-200 pb-3 dark:border-oai-gray-800 md:border-b-0 md:border-r md:pb-0 md:pr-5",children:t.jsx("nav",{"aria-label":a("settings.page.title"),className:"flex gap-0 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden md:sticky md:top-6 md:flex-col md:gap-1 md:overflow-visible",children:v.map(({id:g,label:f,Icon:p})=>{const j=m===g;return t.jsxs("button",{id:`settings-nav-${g}`,type:"button","aria-current":j?"page":void 0,"aria-controls":`settings-panel-${g}`,onClick:()=>y(g),className:N("inline-flex min-h-10 min-w-max shrink-0 items-center gap-1.5 rounded-md px-2 py-2 text-left text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-oai-brand-500 md:w-full md:min-w-0 md:gap-2 md:px-3",j?"bg-oai-gray-100 text-oai-black dark:bg-oai-gray-800 dark:text-white":"text-oai-gray-500 hover:bg-oai-gray-50 hover:text-oai-gray-900 dark:text-oai-gray-400 dark:hover:bg-oai-gray-900 dark:hover:text-oai-gray-200"),children:[t.jsx(p,{className:N("h-4 w-4 shrink-0",j?"text-oai-black dark:text-white":"text-oai-gray-400 dark:text-oai-gray-500"),"aria-hidden":!0}),t.jsx("span",{className:"truncate",children:f})]},g)})})}),t.jsxs("div",{className:"min-w-0",children:[v.map(({id:g,label:f,content:p})=>t.jsx("section",{id:`settings-panel-${g}`,"aria-labelledby":`settings-nav-${g}`,"aria-label":f,"data-settings-panel":g,hidden:m!==g,children:p},g)),t.jsx(Xt,{})]})]})]})})})}export{An as SettingsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{m as Ra,r as i,U as xt,z as ma,j as e,X as Ee,c as r,e as ae,aZ as la,aA as Pa,a_ as ht,y as pt,a$ as fa,b0 as ft,b1 as yt,a0 as bt,b2 as ya,b3 as kt,b4 as wt,A as vt,b5 as jt,aC as Nt,aB as St,b6 as Ct,a6 as _t,a as Lt,b7 as Rt,as as Pt,J as It,B as X,R as Bt,d as Et,a7 as Be}from"./__vite-browser-external-CJKqcpDH.js";import{L as Tt}from"./LocalOnlyNotice-BWpGvI0H.js";import{C as Ot}from"./Card-DyzEgcah.js";import{C as ba}from"./ConfirmModal-CNgB03kI.js";import{S as $t,I as ga}from"./SegmentedControl-DrEbXe7M.js";import{I as Ia}from"./info-JYfDozdx.js";import{P as we}from"./ProviderIcon-BWkcPxs4.js";import{m as ka}from"./react-BHsz7M69.js";import{u as Dt}from"./useCurrency-BPhEg_fN.js";import{E as da}from"./external-link-DlymDAT1.js";import{L as te}from"./loader-circle-cVisHw3G.js";import{M as Ba}from"./monitor-smartphone-3_sFTPdn.js";import{C as Te}from"./check-BEWd6UpN.js";import{T as xa}from"./trash-2-C4iKjhsk.js";import{A as Mt}from"./index-DZLIheW-.js";import{u as At}from"./use-reduced-motion-TCgQmfAJ.js";import{u as Ut,s as Ft,k as Ea,l as zt,m as Kt,n as Vt,o as qt,p as Gt,S as Ta,c as Oa,d as $a,e as Da,f as Ma,g as Aa,h as Xe,j as Je,i as Ye}from"./SelectItemText-D-pVcs50.js";import{t as Ht,u as ca,m as Wt}from"./useScrollLock-DXsFDMbK.js";import{u as Qt,C as ha}from"./ToolbarRootContext-DM-WFqY6.js";import{g as Xt,a as Jt,p as Yt,m as Zt,b as er,d as ar,c as tr,e as rr,f as sr,s as nr,i as wa,u as va,h as ja,r as ir,j as Na,k as Sa,l as or,n as lr}from"./skills-api-DXQbySbF.js";import{F as dr}from"./flame-Coo1IlXx.js";import{S as ua}from"./search-DMRWVfdt.js";import{D as Ua}from"./download-D5IMcY87.js";import{C as cr}from"./chevron-right-WF-BGKcD.js";import{P as Fa,a as za,b as Ka,c as Va,d as qa}from"./PopoverPopup-8x9t9gD4.js";import"./arrow-up-right-UeW7i2I9.js";import"./DialogTitle-CU0DrIQb.js";import"./store-peMgm1Ye.js";import"./DialogDescription-DZliagFg.js";const ur=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]],Ga=Ra("circle-arrow-up",ur);const mr=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Ha=Ra("plus",mr),Wa=i.forwardRef(function(s,d){const{render:o,className:h,style:x,...g}=s,{store:c}=Ut(),k={open:xt(c,Ft.open)};return ma("span",s,{state:k,ref:d,props:[{"aria-hidden":!0,children:"▼"},g],stateAttributesMapping:Ht})}),gr="tt:hint:dismissed:";function Qa(a){return gr+a}function xr(a){if(typeof window>"u")return!1;try{return window.localStorage.getItem(Qa(a))==="1"}catch{return!1}}function hr({id:a,children:s,className:d,ariaLabel:o}){const[h,x]=i.useState(()=>xr(a)),g=i.useCallback(()=>{if(typeof window<"u")try{window.localStorage.setItem(Qa(a),"1")}catch{}x(!0)},[a]);return h?null:e.jsxs("div",{role:"note","aria-label":o||r("hint.dismissible_aria"),className:ae("relative rounded-lg border border-oai-gray-200 bg-oai-gray-50 px-4 py-3 text-sm text-oai-gray-700","dark:border-oai-gray-800 dark:bg-oai-gray-900/40 dark:text-oai-gray-300",d),children:[e.jsx("button",{type:"button",onClick:g,"aria-label":r("hint.dismiss"),className:"absolute top-2 right-2 inline-flex h-7 w-7 items-center justify-center rounded-md text-oai-gray-500 transition-colors hover:bg-oai-gray-200/70 hover:text-oai-gray-700 focus:outline-none focus:ring-2 focus:ring-oai-blue/30 dark:text-oai-gray-400 dark:hover:bg-oai-gray-800/70 dark:hover:text-oai-gray-200",children:e.jsx(Ee,{className:"h-4 w-4","aria-hidden":"true"})}),e.jsxs("div",{className:"flex items-start gap-2 pr-8",children:[e.jsx(Ia,{className:"mt-0.5 h-4 w-4 shrink-0 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":"true"}),e.jsx("div",{className:"min-w-0 flex-1",children:s})]})]})}function pr(a){if(!a)return null;for(const s of a.elements){const d=s.tagName;if(d==="BUTTON"||d==="INPUT"){const o=s;if(o.type==="submit")return o}}return null}let Ca=(function(a){return a.checked="data-checked",a.unchecked="data-unchecked",a.indeterminate="data-indeterminate",a.disabled="data-disabled",a.readonly="data-readonly",a.required="data-required",a.valid="data-valid",a.invalid="data-invalid",a.touched="data-touched",a.dirty="data-dirty",a.filled="data-filled",a.focused="data-focused",a})({});function Xa(a){return i.useMemo(()=>({checked(s){return a.indeterminate?{}:s?{[Ca.checked]:""}:{[Ca.unchecked]:""}},...Ea}),[a.indeterminate])}const fr=i.createContext({disabled:!1});function yr(){return i.useContext(fr)}function br(a,s,d,o=!0,h){const[x,g]=i.useState(),c=ca(h?`${h}-label`:void 0),y=a??s??x;return la(()=>{const k=a||s||!o?void 0:kr(d.current,c);x!==k&&g(k)}),y}function kr(a,s){const d=wr(a);if(d)return!d.id&&s&&(d.id=s),d.id||void 0}function wr(a){if(!a)return;const s=a.parentElement;if(s&&s.tagName==="LABEL")return s;const d=a.id;if(d){const h=a.nextElementSibling;if(h&&h.htmlFor===d)return h}const o=a.labels;return o&&o[0]}const vr=i.createContext(void 0);function jr(a=!0){const s=i.useContext(vr);if(s===void 0&&!a)throw new Error(Pa(3));return s}const Ja=i.createContext(void 0);function Nr(){const a=i.useContext(Ja);if(a===void 0)throw new Error(Pa(14));return a}const Sr="data-parent",Cr=i.forwardRef(function(s,d){const{checked:o,className:h,defaultChecked:x=!1,"aria-labelledby":g,disabled:c=!1,form:y,id:k,indeterminate:p=!1,inputRef:S,name:L,onCheckedChange:u,parent:w=!1,readOnly:m=!1,render:C,required:P=!1,uncheckedValue:M,value:A,nativeButton:z=!1,style:ce,...I}=s,{clearErrors:ve}=zt(),{disabled:xe,name:he,setDirty:_,setFilled:$,setFocused:U,setTouched:O,state:J,validationMode:H,validityData:je,validation:Oe}=Kt(),Ke=yr(),{labelId:$e,controlId:Ve,registerControlId:re,getDescriptionProps:D}=Vt(),N=jr(),se=N?.parent,ne=se&&N.allValues,B=xe||Ke.disabled||N?.disabled||c,K=he??L,R=A??K,Ne=ca(),qe=ca();let W=Ve;ne?W=w?qe:`${se.id}-${R}`:k&&(W=k);let Se={};ne&&(w?Se=N.parent.getParentProps():R&&(Se=N.parent.getChildProps(R)));const{checked:pe=o,indeterminate:ea=p,onCheckedChange:De,...Ge}=Se,Y=N?.value,fe=N?.setValue,Ce=N?.defaultValue,ue=i.useRef(null),ie=ht(()=>Symbol("checkbox-control")),Z=i.useRef(!1),{getButtonProps:_e,buttonRef:ye}=pt({disabled:B,native:z}),Q=N?.validation??Oe,[E,aa]=qt({controlled:R&&Y&&!w?Y.includes(R):pe,default:R&&Ce&&!w?Ce.includes(R):x,name:"Checkbox",state:"checked"}),Le=ne?!!pe:E,me=ne&&ea||p;la(()=>{re!==fa&&(Z.current=!0,re(ie.current,W))},[W,re,ie]),i.useEffect(()=>{const b=ie.current;return()=>{!Z.current||re===fa||(Z.current=!1,re(b,void 0))}},[re,ie]),Gt(ue,Ne,E,void 0,!N&&!B,L);const T=i.useRef(null),ta=ft(S,T,Q.inputRef,Q.registerInput),ra=br(g,$e,T,!z,W??void 0);la(()=>{T.current&&(T.current.indeterminate=me,E&&$(!0))},[E,me,$]),Qt(E,()=>{N||(ve(K),$(E),_(E!==je.initialValue),Q.change(E))});const sa=yt({checked:E,disabled:B,form:y,name:w?void 0:K,id:z?void 0:W??void 0,required:P,ref:ta,style:K?kt:wt,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(b){if(b.nativeEvent.defaultPrevented)return;if(m){b.preventDefault();return}const V=b.currentTarget.checked,oe=vt(jt,b.nativeEvent);if(u?.(V,oe),!oe.isCanceled&&(De?.(V,oe),!oe.isCanceled&&(aa(V),R&&Y&&fe&&!w&&!ne))){const le=V?[...Y,R]:Y.filter(Pe=>Pe!==R);fe(le,oe)}},onFocus(){ue.current?.focus()}},A!==void 0?{value:(N?E&&A:A)||""}:bt,D,b=>Q.getValidationProps(B,b));i.useEffect(()=>{if(!se||!R)return;const b=se.disabledStatesRef.current;return b.set(R,B),()=>{b.delete(R)}},[se,B,R]);const Re=i.useMemo(()=>({...J,checked:Le,disabled:B,readOnly:m,required:P,indeterminate:me}),[J,Le,B,m,P,me]),Me=Xa(Re),na=ma("span",s,{state:Re,ref:[ye,ue,d,N?.registerControlRef],props:[{id:z?W??void 0:Ne,role:"checkbox","aria-checked":me?"mixed":Le,"aria-readonly":m||void 0,"aria-required":P||void 0,"aria-labelledby":ra,[Sr]:w?"":void 0,onFocus(){B||U(!0)},onBlur(){const b=T.current;b&&(O(!0),U(!1),H==="onBlur"&&Q.commit(N?Y:b.checked))},onKeyDown(b){if(b.key!=="Enter"||(b.preventBaseUIHandler(),b.defaultPrevented))return;const V=T.current?.form??null,oe=b.currentTarget,le=b.nativeEvent,Pe=b.preventDefault,Ie=le.preventDefault;let Ae=!1;b.preventDefault=()=>{Ae=!0,Pe.call(b)},le.preventDefault=()=>{Ae=!0,Ie.call(le)},Ie.call(le),ya(oe).queueMicrotask(()=>{b.preventDefault=Pe,le.preventDefault=Ie,Ae||pr(V)?.click()})},onClick(b){if(m||B)return;b.preventDefault();const V=T.current;V&&V.dispatchEvent(new(ya(V)).PointerEvent("click",{bubbles:!0,shiftKey:b.shiftKey,ctrlKey:b.ctrlKey,altKey:b.altKey,metaKey:b.metaKey}))}},I,Ge,_e,D,b=>Q.getValidationProps(B,b)],stateAttributesMapping:Me});return e.jsxs(Ja.Provider,{value:Re,children:[na,!E&&!N&&K&&!w&&M!==void 0&&e.jsx("input",{type:"hidden",form:y,name:K,value:M,disabled:B}),e.jsx("input",{...sa,suppressHydrationWarning:!0})]})}),_r=i.forwardRef(function(s,d){const{render:o,className:h,style:x,keepMounted:g=!1,...c}=s,y=Nr(),k=y.checked||y.indeterminate,{mounted:p,transitionStatus:S,setMounted:L}=Wt(k),u=i.useRef(null),w={...y,transitionStatus:S};Nt({open:k,ref:u,onComplete(){k||L(!1)}});const C={...Xa(y),...St,...Ea},P=g||p,M=ma("span",s,{ref:[d,u],state:w,stateAttributesMapping:C,props:c});return P?M:null});function Lr(a,s){return`target:${a}:${s}`}function Rr(a){return`remove:${a.id||a.directory}`}function Ya(a){if(!a)return null;const s=new Date(a).getTime();return Number.isFinite(s)?Math.floor((Date.now()-s)/864e5):null}function Pr(a){const s=Ya(a);if(s==null)return null;if(s<=0)return r("skills.usage.today");if(s<30)return r("skills.usage.days_ago",{days:s});const d=Math.max(1,Math.floor(s/30));return r("skills.usage.months_ago",{months:d})}function Ir(a){const s=Ya(a);return s==null?"bg-oai-gray-300 dark:bg-oai-gray-600":s<=7?"bg-emerald-500":s<=30?"bg-amber-500":"bg-oai-gray-300 dark:bg-oai-gray-600"}function ia({label:a,children:s}){return e.jsxs("div",{className:"flex items-center justify-between gap-3 py-2 text-sm",children:[e.jsx("dt",{className:"flex items-center gap-1 text-oai-gray-500 dark:text-oai-gray-400",children:a}),e.jsx("dd",{className:"text-right font-medium tabular-nums text-oai-black dark:text-white",children:s})]})}function Br({skill:a,targets:s,busyKey:d,usage:o,hasUpdate:h,updating:x,onUpdate:g,onClose:c,onToggleTarget:y,onRemove:k}){return e.jsx(Mt,{children:a?e.jsx(Er,{skill:a,targets:s,busyKey:d,usage:o,hasUpdate:h,updating:x,onUpdate:g,onClose:c,onToggleTarget:y,onRemove:k},a.id||a.directory):null})}function Er({skill:a,targets:s,busyKey:d,usage:o,hasUpdate:h,updating:x,onUpdate:g,onClose:c,onToggleTarget:y,onRemove:k}){const p=At(),{currency:S,rate:L}=Dt(),u=i.useRef(null);i.useEffect(()=>{const _=U=>{U.key==="Escape"&&(U.stopPropagation(),c?.())},$=U=>{const O=U.target;O instanceof Element&&(u.current?.contains(O)||O.closest('[data-skill-row="1"]')||c?.())};return document.addEventListener("keydown",_),document.addEventListener("pointerdown",$),()=>{document.removeEventListener("keydown",_),document.removeEventListener("pointerdown",$)}},[c]);const w=a.name||a.directory,m=!!(a.repoOwner&&a.repoName),C=m?`https://github.com/${a.repoOwner}/${a.repoName}`:null,P=new Set(a.targets||[]),M=!!(a.readOnly||a.remote),A=!!a.remote,z=Array.isArray(a.deviceSources)?a.deviceSources:[],ce=!A&&(!M||P.has("claude")),I=d===Rr(a),ve=Pr(o?.lastUsedAt),xe=!!(o&&o.invocations>0),he=p?{duration:0}:{type:"spring",stiffness:320,damping:30,mass:.7};return e.jsxs(e.Fragment,{children:[e.jsx(ka.div,{className:"fixed inset-0 z-20 bg-oai-black/30 backdrop-blur-[2px] lg:hidden",initial:p?!1:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:p?0:.15},onClick:c,"aria-hidden":!0}),e.jsxs(ka.aside,{ref:u,role:"complementary","aria-label":w,initial:p?!1:{opacity:0,x:24,scale:.98},animate:{opacity:1,x:0,scale:1},exit:p?{opacity:0}:{opacity:0,x:24,scale:.98},transition:he,className:"fixed inset-x-3 bottom-3 top-20 z-30 flex flex-col overflow-hidden rounded-2xl border border-white/40 bg-white/75 shadow-[0_24px_60px_-20px_rgba(15,23,42,0.25)] backdrop-blur-xl backdrop-saturate-150 supports-[backdrop-filter]:bg-white/65 dark:border-white/10 dark:bg-oai-gray-950/70 dark:shadow-[0_24px_60px_-20px_rgba(0,0,0,0.7)] dark:supports-[backdrop-filter]:bg-oai-gray-950/55 lg:inset-auto lg:right-6 lg:top-24 lg:bottom-6 lg:w-[22rem] lg:max-h-[calc(100vh-7.5rem)]",children:[e.jsxs("header",{className:"flex items-center gap-3 border-b border-white/40 bg-gradient-to-b from-white/30 to-transparent px-5 pb-4 pt-5 dark:border-white/10 dark:from-white/[0.04]",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h2",{className:"truncate text-base font-semibold text-oai-black dark:text-white",title:w,children:w}),m?e.jsxs("a",{href:C,target:"_blank",rel:"noreferrer noopener",className:"mt-1 inline-flex max-w-full items-center gap-1 truncate text-xs text-oai-gray-500 transition-colors hover:text-oai-black hover:underline dark:text-oai-gray-400 dark:hover:text-white",title:C,children:[e.jsxs("span",{className:"truncate",children:[a.repoOwner,"/",a.repoName]}),e.jsx(da,{className:"h-3 w-3 shrink-0","aria-hidden":!0})]}):a.directory&&a.directory!==w?e.jsx("div",{className:"mt-1 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",title:a.directory,children:a.directory}):null]}),e.jsx("button",{type:"button",onClick:c,"aria-label":r("skills.detail.close"),className:"-mr-1 inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-full text-oai-gray-500 transition hover:bg-oai-gray-100 hover:text-oai-black focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:text-oai-gray-400 dark:hover:bg-oai-gray-800 dark:hover:text-white",children:e.jsx(Ee,{className:"h-4 w-4","aria-hidden":!0})})]}),e.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-5 py-5",children:[h?e.jsxs("div",{className:"mb-4 flex items-center gap-3 rounded-xl bg-sky-50/80 px-3 py-2.5 ring-1 ring-sky-200 dark:bg-sky-950/30 dark:ring-sky-800/60",children:[e.jsx(Ga,{className:"h-4 w-4 shrink-0 text-sky-600 dark:text-sky-300","aria-hidden":!0}),e.jsx("span",{className:"min-w-0 flex-1 text-xs text-sky-800 dark:text-sky-200",children:r("skills.update.available")}),e.jsxs("button",{type:"button",onClick:()=>g?.(a),disabled:x,className:"inline-flex h-7 shrink-0 items-center gap-1 rounded-md bg-sky-600 px-2.5 text-xs font-semibold text-white transition hover:bg-sky-700 focus:outline-none focus:ring-2 focus:ring-sky-400/40 disabled:cursor-not-allowed disabled:opacity-60 dark:bg-sky-500 dark:hover:bg-sky-400",children:[x?e.jsx(te,{className:"h-3 w-3 animate-spin","aria-hidden":!0}):null,r("skills.update.action")]})]}):null,a.description?e.jsx("p",{className:"text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:a.description}):null,M?e.jsx("div",{className:"mt-4 rounded-xl bg-oai-gray-50 px-3 py-2.5 text-xs leading-5 text-oai-gray-600 ring-1 ring-oai-gray-200 dark:bg-oai-gray-900/60 dark:text-oai-gray-300 dark:ring-oai-gray-800",children:r(A?"skills.inventory.read_only_remote":"skills.inventory.read_only_managed")}):null,a.sourceName?e.jsx("div",{className:"mt-3 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.inventory.source",{source:a.sourceName})}):null,z.length?e.jsxs("section",{className:"mt-5",children:[e.jsx("h3",{className:"mb-2 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.inventory.devices_title")}),e.jsx("div",{className:"flex flex-wrap gap-2",children:z.map(_=>e.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1.5 rounded-full bg-oai-gray-100 px-2.5 py-1 text-xs text-oai-gray-700 ring-1 ring-oai-gray-200 dark:bg-oai-gray-800 dark:text-oai-gray-200 dark:ring-oai-gray-700",children:[e.jsx(Ba,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),e.jsx("span",{className:"max-w-52 truncate",children:_.name})]},_.id))})]}):null,ce?e.jsxs("section",{className:"mt-6",children:[e.jsx("h3",{className:"mb-1 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.usage.section_title")}),e.jsxs("dl",{className:"divide-y divide-oai-gray-200/60 dark:divide-white/[0.06]",children:[e.jsx(ia,{label:r("skills.usage.invocations"),children:Ct(o?.invocations||0)}),e.jsx(ia,{label:r("skills.usage.last_used"),children:e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx("span",{className:ae("h-1.5 w-1.5 rounded-full",Ir(o?.lastUsedAt)),"aria-hidden":!0}),xe?ve||r("skills.usage.unknown"):r("skills.usage.never")]})}),e.jsx(ia,{label:e.jsxs(e.Fragment,{children:[r("skills.usage.cost"),e.jsx("span",{title:r("skills.usage.disclaimer"),className:"inline-flex cursor-help text-oai-gray-400 dark:text-oai-gray-500",children:e.jsx(Ia,{className:"h-3 w-3","aria-label":r("skills.usage.disclaimer")})})]}),children:_t(o?.cost||0,{currency:S,rate:L})})]}),xe?null:e.jsx("p",{className:"mt-2 text-[11px] leading-4 text-oai-gray-400 dark:text-oai-gray-500",children:r("skills.usage.unused")})]}):null,M?null:e.jsxs("section",{className:"mt-6",children:[e.jsx("h3",{className:"mb-1 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.detail.sync_section_title")}),e.jsx("div",{children:(s||[]).filter(_=>_.manageable!==!1).map(_=>{const $=P.has(_.id),U=d===Lr(a.id||a.directory,_.id),O=`skill-detail-sync-${a.id||a.directory}-${_.id}`;return e.jsxs("label",{htmlFor:O,className:"-mx-2 flex cursor-pointer items-center gap-3 rounded-md px-2 py-2 text-sm text-oai-black transition-colors hover:bg-oai-gray-100/70 dark:text-white dark:hover:bg-white/[0.05]",children:[e.jsx(Cr,{id:O,checked:$,disabled:U,onCheckedChange:J=>y?.(a,_.id,!!J),className:"peer flex h-4 w-4 shrink-0 items-center justify-center rounded-[4px] border border-oai-gray-300/80 bg-white/80 shadow-sm transition-colors hover:border-oai-gray-400 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-gray-400/40 focus-visible:ring-offset-1 focus-visible:ring-offset-transparent disabled:cursor-not-allowed disabled:opacity-50 data-[checked]:border-oai-black data-[checked]:bg-oai-black dark:border-oai-gray-500/60 dark:bg-oai-gray-900/60 dark:hover:border-oai-gray-400 dark:data-[checked]:border-white dark:data-[checked]:bg-white",children:e.jsx(_r,{className:"flex items-center justify-center text-white dark:text-oai-black",children:e.jsx(Te,{className:"h-3 w-3",strokeWidth:3.5,"aria-hidden":!0})})}),e.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center","aria-hidden":!0,children:e.jsx(we,{provider:_.id,size:16})}),e.jsx("span",{className:"flex-1",children:_.label}),U?e.jsx(te,{className:"h-3.5 w-3.5 animate-spin text-oai-gray-400","aria-hidden":!0}):null]},_.id)})})]})]}),M?null:e.jsxs("footer",{className:"border-t border-white/40 bg-white/30 px-5 py-4 dark:border-white/10 dark:bg-white/[0.02]",children:[e.jsxs("button",{type:"button",onClick:()=>k?.(a),disabled:I,className:"inline-flex w-full items-center justify-center gap-2 rounded-lg border border-red-200/70 bg-white px-3 py-2 text-sm font-medium text-red-600 transition hover:border-red-300 hover:bg-red-50 focus:outline-none focus:ring-2 focus:ring-red-400/30 disabled:cursor-not-allowed disabled:opacity-60 dark:border-red-900/60 dark:bg-oai-gray-950 dark:text-red-300 dark:hover:border-red-800 dark:hover:bg-red-950/30",children:[I?e.jsx(te,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):e.jsx(xa,{className:"h-3.5 w-3.5","aria-hidden":!0}),r("skills.detail.remove_button")]}),e.jsx("p",{className:"mt-2 text-center text-[11px] text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.detail.remove_confirm_hint")})]})]})]})}const Tr=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),oa=["claude","codex"],G="popular",Or={claude:"text-orange-500 dark:text-orange-300",codex:"text-emerald-600 dark:text-emerald-300",grok:"text-zinc-700 dark:text-zinc-200",antigravity:"text-violet-600 dark:text-violet-300",gemini:"text-sky-600 dark:text-sky-300",opencode:"text-amber-600 dark:text-amber-300",hermes:"text-indigo-500 dark:text-indigo-300"},ge="all",F="skillssh";function Ze(a){return`${a.repoOwner||"local"}/${a.repoName||"local"}:${a.directory}`}function Za(a){return String(a||"").replace(/\\/g,"/").trim().toLowerCase()}function $r(a){return Za(a).split("/").filter(Boolean).pop()||""}function Dr(a){if(a.repoOwner||a.repoName)return"";const s=Za(a.directory);return!s||s.includes("/")?"":`dir:${s}`}function _a(a){const s=$r(a.directory);return s?`dir:${s}`:""}function et(a){const s=new Set([Ze(a).toLowerCase()]);a.repoOwner&&a.repoName&&s.add(`${a.repoOwner}/${a.repoName}:${a.sourceDirectory||a.directory}`.toLowerCase());const d=Dr(a);return d&&s.add(d),s}function Mr(a){return!a?.remote&&!a?.inventoryOnly&&!a?.readOnly}function Ar(a){const s=new Set;for(const d of Array.isArray(a)?a:[])if(Mr(d))for(const o of et(d))s.add(o);return s}function Qe(a){return`install:${Ze(a)}`}function La(a){return`remove:${a.id||a.directory}`}function at(a,s){return`target:${a}:${s}`}function ke(a){return a.id||a.directory}function pa(a){return a.manageable!==!1}function Ur({target:a,state:s,busy:d,disabled:o,disabledLabel:h,onToggle:x}){const g=s==="synced",c=s==="orphan",y=c?r("skills.dot.orphan_aria",{agent:a.label}):g?r("skills.dot.synced_aria",{agent:a.label}):r("skills.dot.off_aria",{agent:a.label}),k=o&&h?`${y} — ${h}`:y;return e.jsxs("button",{type:"button",title:k,"aria-label":k,"aria-pressed":g,disabled:d||o,onClick:p=>{p.stopPropagation(),x?.(a.id,!g)},className:"relative flex h-7 w-7 items-center justify-center rounded-md transition-colors hover:bg-oai-gray-100 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/40 disabled:cursor-not-allowed dark:hover:bg-oai-gray-800/60",children:[d?e.jsx(te,{className:"h-4 w-4 animate-spin text-oai-gray-400","aria-hidden":!0}):e.jsx("span",{className:ae("flex h-[18px] w-[18px] items-center justify-center transition",g&&Or[a.id],!g&&!c&&"opacity-35 grayscale"),"aria-hidden":!0,children:e.jsx(we,{provider:a.id,size:18})}),c&&!d?e.jsx("span",{className:"absolute -bottom-px -right-px h-2 w-2 rounded-full bg-amber-500 ring-2 ring-oai-white dark:ring-oai-gray-900","aria-hidden":!0}):null]})}function Fr({skill:a,targets:s,onToggleTarget:d,busyKey:o}){const h=new Set(a.targets||[]),x=!!(a.readOnly||a.remote),g=[];for(const c of s)(x?h.has(c.id):pa(c))&&g.push(c);return e.jsx("div",{className:"flex items-center gap-1",onClick:c=>c.stopPropagation(),children:g.map(c=>e.jsx(Ur,{target:c,state:a.targetStates?.[c.id]||"off",busy:o===at(ke(a),c.id),disabled:x||c.manageable===!1,disabledLabel:r(a.remote?"skills.inventory.read_only_remote":"skills.inventory.read_only_managed"),onToggle:(y,k)=>d?.(a,y,k)},c.id))})}function zr({skill:a,targets:s,selected:d,onSelect:o,selectable:h,checked:x,onToggleSelect:g,onToggleTarget:c,hasUpdate:y,busyKey:k}){const p=a.repoOwner&&a.repoName?`${a.repoOwner}/${a.repoName}`:null,S=[a.directory,p,a.sourceName].filter(Boolean).join(" · "),L=Array.isArray(a.deviceSources)?a.deviceSources:[],u=[a.remote?r("skills.inventory.remote"):null,a.scope==="plugin"?r("skills.inventory.plugin"):null].filter(Boolean),w=m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),o?.(a))};return e.jsxs("div",{"data-skill-row":"1",role:"button",tabIndex:0,"aria-pressed":d,"aria-label":r("skills.row.open_details",{name:a.name||a.directory}),onClick:()=>o?.(a),onKeyDown:w,className:ae("cursor-pointer rounded-md py-3 pr-2 transition focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30",d?"bg-oai-gray-100 ring-1 ring-oai-gray-200 dark:bg-oai-gray-800/60 dark:ring-oai-gray-800":x?"bg-oai-gray-50 dark:bg-oai-gray-900/40":"hover:bg-oai-gray-50 dark:hover:bg-oai-gray-900/40"),children:[e.jsxs("div",{className:"flex items-center gap-3",children:[h?e.jsx("label",{className:"flex shrink-0 items-center",onClick:m=>m.stopPropagation(),children:e.jsx("input",{type:"checkbox",checked:x,onChange:m=>g?.(a,m.target.checked),"aria-label":r("skills.select.row_aria",{name:a.name||a.directory}),className:"h-4 w-4 rounded border-oai-gray-300 text-oai-black focus:ring-oai-gray-400 dark:border-oai-gray-600 dark:bg-oai-gray-900 dark:text-white"})}):null,e.jsx("h2",{className:"min-w-0 flex-1 truncate text-sm font-semibold text-oai-black dark:text-white",title:S,children:a.name||a.directory}),u.map(m=>e.jsx("span",{className:"inline-flex shrink-0 rounded-full bg-oai-gray-100 px-1.5 py-0.5 text-[10px] font-semibold text-oai-gray-600 ring-1 ring-oai-gray-200 dark:bg-oai-gray-800 dark:text-oai-gray-300 dark:ring-oai-gray-700",children:m},m)),y?e.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-full bg-sky-50 px-1.5 py-0.5 text-[10px] font-semibold text-sky-700 ring-1 ring-sky-200 dark:bg-sky-950/40 dark:text-sky-300 dark:ring-sky-800/60",children:[e.jsx(Ga,{className:"h-2.5 w-2.5","aria-hidden":!0}),r("skills.update.badge")]}):null,e.jsx(Fr,{skill:a,targets:s,onToggleTarget:c,busyKey:k}),e.jsx(cr,{className:ae("hidden h-4 w-4 shrink-0 text-oai-gray-300 transition-colors dark:text-oai-gray-600 lg:block",d&&"text-oai-gray-500 dark:text-oai-gray-300"),"aria-hidden":!0})]}),a.description?e.jsx("p",{className:ae("mt-1 line-clamp-2 text-xs text-oai-gray-500 dark:text-oai-gray-400",h&&"pl-7"),children:a.description}):null,a.sourceName||L.length?e.jsxs("div",{className:ae("mt-1 flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1 text-[11px] text-oai-gray-400 dark:text-oai-gray-500",h&&"pl-7"),children:[a.sourceName?e.jsx("span",{className:"truncate",children:a.sourceName}):null,L.length?e.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1",title:L.map(m=>m.name).join(", "),children:[e.jsx(Ba,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),e.jsx("span",{className:"truncate",children:r("skills.inventory.on_devices",{devices:L.map(m=>m.name).join(", ")})})]}):null]}):null]})}function Kr({agentFilter:a,agentOptions:s,onAgentFilter:d,filteredCount:o,totalCount:h,anyFilter:x,onClearFilters:g,searchQuery:c,onSearchQuery:y,searchPlaceholder:k}){return e.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2 pt-1 text-xs text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsxs(Ta,{value:a,onValueChange:d,children:[e.jsxs(Oa,{"aria-label":r("skills.filter.agent_label"),className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 bg-oai-white px-2.5 text-xs font-medium text-oai-gray-700 transition hover:border-oai-gray-300 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 data-[popup-open]:border-oai-gray-300 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-oai-gray-200 dark:hover:border-oai-gray-700",children:[e.jsxs("span",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:[r("skills.filter.agent_label"),":"]}),e.jsx($a,{children:p=>p==="all"?r("skills.filter.agent_all"):s.find(S=>S.id===p)?.label||p}),e.jsx(Wa,{className:"text-oai-gray-400",children:e.jsx(ha,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),e.jsx(Da,{children:e.jsx(Ma,{sideOffset:4,alignItemWithTrigger:!1,className:"z-[60]",children:e.jsxs(Aa,{className:"min-w-[var(--anchor-width)] overflow-hidden rounded-md border border-oai-gray-200 bg-white p-1 shadow-[0_12px_32px_-12px_rgba(0,0,0,0.18)] outline-none dark:border-oai-gray-800 dark:bg-oai-gray-950 dark:shadow-[0_12px_32px_-12px_rgba(0,0,0,0.6)]",children:[e.jsxs(Xe,{value:"all",className:"flex cursor-default select-none items-center justify-between gap-2 rounded px-3 py-1.5 text-sm text-oai-black outline-none data-[highlighted]:bg-oai-gray-100 dark:text-white dark:data-[highlighted]:bg-oai-gray-800",children:[e.jsx(Je,{children:r("skills.filter.agent_all")}),e.jsx(Ye,{children:e.jsx(Te,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),s.map(p=>e.jsxs(Xe,{value:p.id,className:"flex cursor-default select-none items-center justify-between gap-2 rounded px-3 py-1.5 text-sm text-oai-black outline-none data-[highlighted]:bg-oai-gray-100 dark:text-white dark:data-[highlighted]:bg-oai-gray-800",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(we,{provider:p.id,size:14}),e.jsx(Je,{children:p.label})]}),e.jsx(Ye,{children:e.jsx(Te,{className:"h-3.5 w-3.5","aria-hidden":!0})})]},p.id))]})})})]}),e.jsxs("div",{className:"relative w-56 max-w-full",children:[e.jsx(ua,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-oai-gray-400","aria-hidden":!0}),e.jsx(ga,{type:"search",value:c,onChange:p=>y(p.target.value),onKeyDown:p=>{p.key==="Escape"&&c&&(p.preventDefault(),y(""))},"aria-label":r("skills.action.search_aria"),placeholder:k,className:"h-8 pl-9 pr-8 !border-oai-gray-200 dark:!border-oai-gray-800 focus:!border-oai-gray-400 focus:!ring-oai-gray-400/20 dark:focus:!border-oai-gray-500 dark:focus:!ring-oai-gray-500/20 [&::-webkit-search-cancel-button]:appearance-none"}),e.jsx("button",{type:"button",onMouseDown:p=>p.preventDefault(),onClick:()=>y(""),"aria-label":r("skills.action.search_clear"),"aria-hidden":!c,tabIndex:c?0:-1,className:ae("absolute right-2 top-1/2 flex h-6 w-6 -translate-y-1/2 items-center justify-center rounded-full text-oai-gray-400 transition duration-150 ease-out before:absolute before:-inset-1.5 before:content-[''] hover:bg-oai-gray-100 hover:text-oai-gray-600 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-gray-400/40 motion-reduce:transition-none dark:hover:bg-oai-gray-800 dark:hover:text-oai-gray-200",c?"scale-100 opacity-100":"pointer-events-none scale-90 opacity-0"),children:e.jsx(Ee,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),e.jsx("span",{role:"status","aria-live":"polite",className:"ml-auto shrink-0 tabular-nums text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.filter.result_count",{filtered:o,total:h})}),x?e.jsxs("button",{type:"button",onClick:g,className:"shrink-0 inline-flex h-7 items-center gap-1 rounded-full bg-oai-gray-100 px-2.5 text-[11px] font-medium text-oai-gray-700 transition hover:bg-oai-gray-200 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:bg-oai-gray-800/70 dark:text-oai-gray-200 dark:hover:bg-oai-gray-700",children:[e.jsx(Ee,{className:"h-3 w-3","aria-hidden":!0}),r("skills.filter.clear")]}):null]})}function Vr({count:a,targets:s,busy:d,onBulkSync:o,onBulkRemove:h,onClear:x}){const g=s.filter(pa);return e.jsxs("div",{role:"toolbar","aria-label":r("skills.select.toolbar_aria"),className:"mb-2 flex flex-wrap items-center gap-2 rounded-lg border border-oai-gray-200 bg-oai-gray-50 px-3 py-2 dark:border-oai-gray-800 dark:bg-oai-gray-900/50",children:[e.jsx("span",{className:"text-xs font-medium text-oai-gray-700 dark:text-oai-gray-200","aria-live":"polite",children:r("skills.select.count",{count:a})}),e.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[e.jsxs(Fa,{children:[e.jsxs(za,{disabled:d,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 bg-oai-white px-2.5 text-xs font-medium text-oai-gray-700 transition hover:border-oai-gray-300 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 disabled:opacity-60 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-oai-gray-200",children:[e.jsx(Ua,{className:"h-3.5 w-3.5","aria-hidden":!0}),r("skills.select.bulk_sync"),e.jsx(ha,{className:"h-3 w-3","aria-hidden":!0})]}),e.jsx(Ka,{children:e.jsx(Va,{sideOffset:6,side:"bottom",align:"end",className:"!z-[80]",children:e.jsxs(qa,{className:"min-w-[200px] rounded-lg bg-white p-1.5 shadow-lg ring-1 ring-oai-gray-200 dark:bg-oai-gray-950 dark:ring-oai-gray-800",children:[e.jsx("div",{className:"px-2 pb-1 pt-0.5 text-[11px] font-medium uppercase tracking-wide text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.select.bulk_sync_hint")}),g.map(c=>e.jsxs("button",{type:"button",onClick:()=>o(c.id),className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm text-oai-black hover:bg-oai-gray-100 dark:text-white dark:hover:bg-oai-gray-800",children:[e.jsx(we,{provider:c.id,size:16}),e.jsx("span",{className:"flex-1",children:c.label})]},c.id))]})})})]}),e.jsxs(X,{type:"button",variant:"ghost",size:"sm",disabled:d,onClick:h,children:[e.jsx(xa,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),r("skills.select.bulk_remove")]}),e.jsxs("button",{type:"button",onClick:x,className:"inline-flex h-7 items-center gap-1 rounded-full px-2 text-[11px] font-medium text-oai-gray-500 transition hover:text-oai-black focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:text-oai-gray-400 dark:hover:text-white",children:[e.jsx(Ee,{className:"h-3 w-3","aria-hidden":!0}),r("skills.select.clear")]})]})]})}function qr({items:a,totalCount:s,targets:d,agentOptions:o,agentFilter:h,onAgentFilter:x,anyFilter:g,onClearFilters:c,searchQuery:y,onSearchQuery:k,searchPlaceholder:p,selectedId:S,onSelect:L,onToggleTarget:u,busyKey:w,updates:m,selectedIds:C,onToggleSelect:P,onClearSelection:M,onBulkSync:A,onBulkRemove:z}){const ce=C.size;return e.jsxs("div",{children:[ce>0?e.jsx(Vr,{count:ce,targets:d,busy:w==="batch",onBulkSync:A,onBulkRemove:z,onClear:M}):e.jsx(Kr,{agentFilter:h,agentOptions:o,onAgentFilter:x,filteredCount:a.length,totalCount:s,anyFilter:g,onClearFilters:c,searchQuery:y,onSearchQuery:k,searchPlaceholder:p}),a.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-lg border border-dashed border-oai-gray-200 px-4 py-10 text-center text-sm text-oai-gray-500 dark:border-oai-gray-800 dark:text-oai-gray-400",children:[e.jsx("p",{children:r("skills.empty.no_match")}),e.jsx(X,{type:"button",variant:"secondary",size:"sm",onClick:c,children:r("skills.filter.clear")})]}):e.jsx("div",{className:"divide-y divide-oai-gray-200/70 dark:divide-oai-gray-800/70",children:a.map(I=>e.jsx(zr,{skill:I,targets:d,selected:S===(I.id||I.directory),onSelect:L,selectable:!I.readOnly&&!I.remote,checked:C.has(ke(I)),onToggleSelect:P,onToggleTarget:u,hasUpdate:!!(I.id&&m?.[I.id]),busyKey:w},ke(I)))})]})}const Gr={contentVisibility:"auto",containIntrinsicSize:"0 240px"},Hr=Et.memo(function({skill:s,installed:d,installing:o,allTargets:h,defaultTargets:x,onInstall:g,onManage:c}){const[y,k]=i.useState(()=>(x||[]).filter(m=>h.some(C=>C.id===m))),p=m=>{k(C=>C.includes(m)?C.filter(P=>P!==m):[...C,m])},S=s.repoOwner&&s.repoName?`${s.repoOwner}/${s.repoName}`:null,L=S?`https://github.com/${s.repoOwner}/${s.repoName}`:null,u=s.installs!=null?r("skills.card.installs",{count:Number(s.installs||0).toLocaleString()}):null,w=y.length?y.map(m=>h.find(C=>C.id===m)?.label||m).join(", "):r("skills.action.choose_targets");return e.jsxs(Ot,{className:"h-full rounded-lg",bodyClassName:"flex h-full flex-col",children:[e.jsx("div",{className:"flex items-start justify-between gap-3",children:e.jsxs("div",{className:"min-w-0",children:[s.readmeUrl?e.jsxs("a",{href:s.readmeUrl,target:"_blank",rel:"noopener noreferrer",className:"group inline-flex max-w-full items-center gap-1 truncate text-base font-semibold text-oai-black hover:underline dark:text-white",title:s.readmeUrl,children:[e.jsx("span",{className:"truncate",children:s.name||s.directory}),e.jsx(da,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-400 opacity-0 transition-opacity group-hover:opacity-100","aria-hidden":!0})]}):e.jsx("h2",{className:"truncate text-base font-semibold text-oai-black dark:text-white",children:s.name||s.directory}),S||u?e.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-x-1.5 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:[L?e.jsxs("a",{href:L,target:"_blank",rel:"noopener noreferrer",onClick:m=>m.stopPropagation(),className:"inline-flex items-center gap-1 truncate rounded text-oai-gray-500 hover:text-oai-black hover:underline focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:text-oai-gray-400 dark:hover:text-white",title:L,children:[e.jsx("span",{className:"truncate",children:S}),e.jsx(da,{className:"h-2.5 w-2.5 shrink-0","aria-hidden":!0})]}):null,S&&u?e.jsx("span",{"aria-hidden":!0,children:"·"}):null,u?e.jsx("span",{className:"truncate",children:u}):null]}):null]})}),s.description?e.jsx("p",{className:"mt-3 line-clamp-3 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:s.description}):null,e.jsx("div",{className:"mt-auto pt-5",children:d?e.jsxs(X,{type:"button",variant:"secondary",size:"sm",onClick:()=>c?.(s),className:"w-full",children:[e.jsx(Te,{className:"mr-1.5 h-3.5 w-3.5 text-emerald-500 dark:text-emerald-400","aria-hidden":!0}),r("skills.card.manage")]}):e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-1 text-xs text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx("span",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.card.targets_prefix")}),e.jsx("span",{className:"min-w-0 truncate font-medium text-oai-black dark:text-white",children:y.length?w:r("skills.target.none")}),e.jsxs(Fa,{children:[e.jsx(za,{disabled:o,"aria-label":r("skills.action.choose_targets"),className:"rounded text-xs font-medium text-oai-gray-500 underline decoration-oai-gray-300 decoration-dotted underline-offset-2 transition hover:text-oai-black hover:decoration-oai-gray-500 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 disabled:cursor-not-allowed disabled:opacity-60 dark:text-oai-gray-400 dark:decoration-oai-gray-600 dark:hover:text-white dark:hover:decoration-oai-gray-400",children:r("skills.card.targets_change")}),e.jsx(Ka,{children:e.jsx(Va,{sideOffset:6,side:"bottom",align:"end",className:"!z-[80]",children:e.jsxs(qa,{className:"min-w-[220px] rounded-lg bg-white p-1.5 shadow-lg ring-1 ring-oai-gray-200 dark:bg-oai-gray-950 dark:ring-oai-gray-800",children:[e.jsx("div",{className:"px-2 pb-1 pt-0.5 text-[11px] font-medium uppercase tracking-wide text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.target.menu_label")}),h.map(m=>{const C=y.includes(m.id);return e.jsxs("label",{className:"flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-sm text-oai-black hover:bg-oai-gray-100 dark:text-white dark:hover:bg-oai-gray-800",children:[e.jsx("input",{type:"checkbox",className:"h-4 w-4 shrink-0 rounded border-oai-gray-300 text-oai-black focus:ring-oai-gray-400 dark:border-oai-gray-600 dark:bg-oai-gray-900 dark:text-white",checked:C,onChange:()=>p(m.id)}),e.jsx(we,{provider:m.id,size:16}),e.jsx("span",{className:"flex-1 text-left",children:m.label})]},m.id)})]})})})]})]}),e.jsxs(X,{type:"button",size:"sm",onClick:()=>g(s,y),disabled:o||y.length===0,className:"w-full",children:[o?e.jsx(te,{className:"mr-1.5 h-3.5 w-3.5 animate-spin","aria-hidden":!0}):e.jsx(Ua,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),r("skills.action.install")]})]})})]})});function Wr({repos:a,repoInput:s,onRepoInput:d,busyKey:o,onAdd:h,onRemove:x}){return e.jsxs("div",{className:"rounded-lg border border-oai-gray-200 bg-white p-4 dark:border-oai-gray-800 dark:bg-oai-gray-950",children:[e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[e.jsx(ga,{value:s,onChange:g=>d(g.target.value),placeholder:r("skills.repo.placeholder"),className:"min-w-0 flex-1"}),e.jsxs(X,{type:"button",variant:"secondary",size:"md",onClick:h,disabled:o==="repo:add",className:"shrink-0 whitespace-nowrap",children:[o==="repo:add"?e.jsx(te,{className:"mr-1.5 h-4 w-4 animate-spin","aria-hidden":!0}):e.jsx(Ha,{className:"mr-1.5 h-4 w-4","aria-hidden":!0}),r("skills.repo.add")]})]}),a.length?e.jsx("div",{className:"mt-3 divide-y divide-oai-gray-200/70 dark:divide-oai-gray-800/70",children:a.map(g=>{const c=o===`repo:${g.owner}/${g.name}`;return e.jsxs("div",{className:"flex items-center justify-between gap-3 py-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"truncate text-sm font-medium text-oai-black dark:text-white",children:[g.owner,"/",g.name]}),e.jsx("div",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400",children:g.branch})]}),e.jsxs(X,{type:"button",variant:"ghost",size:"sm",disabled:c,onClick:()=>x(g),className:"shrink-0",children:[c?e.jsx(te,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):e.jsx(xa,{className:"h-3.5 w-3.5","aria-hidden":!0}),e.jsx("span",{className:"sr-only",children:r("skills.repo.remove")})]})]},`${g.owner}/${g.name}`)})}):null]})}function Qr(){return typeof window>"u"?"my":new URLSearchParams(window.location.search).get("tab")==="browse"?"browse":"my"}function Ss(){const a=Lt()||{},s=!!a.signedIn,d=a.getAccessToken,[o,h]=i.useState(Qr),[x,g]=i.useState({skills:[],targets:[]}),[c,y]=i.useState([]),[k,p]=i.useState([]),[S,L]=i.useState([]),[u,w]=i.useState(ge),[m,C]=i.useState(""),[P,M]=i.useState(""),[A,z]=i.useState(""),[ce,I]=i.useState(""),[ve,xe]=i.useState(""),[he,_]=i.useState(!1),[$,U]=i.useState("all"),[O,J]=i.useState(null),[H,je]=i.useState(""),[Oe,Ke]=i.useState(!0),[$e,Ve]=i.useState(!1),[re,D]=i.useState(""),[N,se]=i.useState(null),[ne,B]=i.useState(null),[K,R]=i.useState(()=>new Set),[Ne,qe]=i.useState({}),[W,Se]=i.useState({}),[pe,ea]=i.useState([]),[De,Ge]=i.useState(!1),Y=i.useRef(!1),fe=i.useRef(0),Ce=i.useMemo(()=>Ar(x.skills),[x.skills]),ue=i.useCallback(async()=>{const t=++fe.current,n=await Xt();if(fe.current!==t)return;const l={skills:n.skills||[],targets:n.targets||[]};g(l);const f=Rt();!s||!Pt()||!f||typeof d!="function"||(async()=>{try{const v=await d();if(!v||fe.current!==t)return;const[j]=await Promise.allSettled([Jt(v),Yt({accessToken:v,deviceId:f,skills:l.skills})]);if(j.status!=="fulfilled")return;const Fe=j.value;if(fe.current!==t)return;g({targets:l.targets,skills:Zt(l.skills,Fe,f)})}catch{}})()},[d,s]),ie=i.useCallback(async()=>{const t=await er();L(t.repos||[])},[]),Z=i.useCallback(async({force:t=!1}={})=>{Ve(!0);try{const n=await ar({force:t});y(n.skills||[])}finally{Ve(!1)}},[]),_e=i.useCallback(async({force:t=!1}={})=>{Ge(!0);try{const n=await tr({force:t});ea(n.skills||[])}finally{Ge(!1)}},[]),ye=i.useCallback(async()=>{try{const t=await rr();qe(t?.updates||{})}catch{qe({})}},[]),Q=i.useCallback(async()=>{try{const t=await sr(),n={};for(const l of t?.skills||[])l.installed&&(l.directory&&(n[String(l.directory).toLowerCase()]=l),n[String(l.skill).toLowerCase()]=l);Se(n)}catch{Se({})}},[]),E=i.useCallback(async()=>{Ke(!0),D("");try{await Promise.all([ue(),ie()])}catch(t){D(t?.message||r("skills.error.generic"))}finally{Ke(!1)}},[ue,ie]),aa=i.useCallback(async()=>{await E();const t=n=>D(n?.message||r("skills.error.generic"));o==="my"?(ye(),Q()):u===G?_e({force:!0}).catch(t):u!==F&&Z({force:!0}).catch(t)},[Z,E,_e,ye,Q,u,o]);i.useEffect(()=>{E()},[E]),i.useEffect(()=>{if(Y.current||typeof window>"u")return;const t=new URLSearchParams(window.location.search),n=t.get("skill");if(!n){Y.current=!0;return}const l=x.skills||[];if(!l.length)return;const f=l.find(j=>j.directory===n||j.id===n);f&&(h("my"),J(f.id||f.directory)),Y.current=!0,t.delete("skill");const v=t.toString();window.history.replaceState({},"",`${window.location.pathname}${v?`?${v}`:""}${window.location.hash}`)},[x.skills]),i.useEffect(()=>{o==="browse"&&(u===F||u===G||c.length===0&&Z().catch(t=>D(t?.message||r("skills.error.generic"))))},[c.length,Z,u,o]),i.useEffect(()=>{o!=="browse"||u!==G||pe.length===0&&_e().catch(t=>D(t?.message||r("skills.error.generic")))},[_e,pe.length,u,o]);const Le=Object.keys(Ne).length>0,me=Object.keys(W).length>0;if(i.useEffect(()=>{o==="my"&&(Le||ye(),me||Q())},[o,Le,me,ye,Q]),i.useEffect(()=>{const t=setTimeout(()=>M(m),200);return()=>clearTimeout(t)},[m]),i.useEffect(()=>{const t=setTimeout(()=>I(A),120);return()=>clearTimeout(t)},[A]),i.useEffect(()=>{if(typeof window>"u")return;const t=new URLSearchParams(window.location.search),n=t.get("tab");if(o==="my"){if(!n)return;t.delete("tab")}else{if(n===o)return;t.set("tab",o)}const l=t.toString(),f=`${window.location.pathname}${l?`?${l}`:""}${window.location.hash}`;window.history.replaceState({},"",f)},[o]),!Tr&&!It())return e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx(Tt,{})});const T=async(t,n)=>{je(t),D("");try{await n(),await ue()}catch(l){D(l?.message||r("skills.error.generic"))}finally{je("")}},ta=(t,n)=>{const l=(n&&n.length?n:oa).filter(f=>(x.targets||[]).some(v=>v.id===f));T(Qe(t),async()=>{await wa(t,l);const f=l.map(v=>(x.targets||[]).find(j=>j.id===v)?.label||v).join(", ");Be({title:r("skills.toast.installed",{name:t.name||t.directory,targets:f||r("skills.target.none")}),timeout:4e3})})},ra=t=>{t?.readOnly||t?.remote||se(t)},sa=()=>{const t=N;t&&(se(null),T(La(t),async()=>{let n=null;t.managed?n=await va(t.id):await ja(t.directory,t.targets||[]);const l=!!(n?.trashed&&t.managed&&t.id);Be({title:r("skills.toast.removed",{name:t.name||t.directory}),timeout:6e3,data:l?{onUndo:async()=>{try{await ir(t.id),await ue()}catch(f){D(f?.message||r("skills.error.generic"))}}}:void 0})}))},Re=(t,n,l)=>t?.readOnly||t?.remote?Promise.resolve():T(at(ke(t),n),async()=>{const f=new Set(t.targets||[]);l?f.add(n):f.delete(n),t.managed?await Na(t.id,Array.from(f)):await Sa(t.directory,Array.from(f));const v={name:t.name||t.directory,agent:b(n)};Be({title:l?r("skills.toast.synced_one",v):r("skills.toast.unsynced_one",v),timeout:3e3})}),Me=i.useCallback(()=>R(new Set),[]),na=i.useCallback((t,n)=>{if(t?.readOnly||t?.remote)return;const l=ke(t);R(f=>{const v=new Set(f);return n?v.add(l):v.delete(l),v})},[]),b=t=>(x.targets||[]).find(n=>n.id===t)?.label||t,V=t=>{const n=(x.skills||[]).filter(l=>K.has(ke(l))&&!l.readOnly&&!l.remote);n.length&&T("batch",async()=>{for(const l of n){const f=new Set(l.targets||[]);f.add(t),l.managed?await Na(l.id,Array.from(f)):await Sa(l.directory,Array.from(f))}Me(),Be({title:r("skills.toast.bulk_synced",{count:n.length,agent:b(t)}),timeout:4e3})})},oe=()=>{const t=(x.skills||[]).filter(n=>K.has(ke(n))&&!n.readOnly&&!n.remote);t.length&&B(t)},le=()=>{const t=ne;t&&(B(null),T("batch",async()=>{for(const n of t)n.managed?await va(n.id):await ja(n.directory,n.targets||[]);Me(),Be({title:r("skills.toast.bulk_removed",{count:t.length}),timeout:4e3})}))},Pe=t=>{!t?.repoOwner||!t?.repoName||T(Qe(t),async()=>{await wa({key:t.key,name:t.name,description:t.description,directory:t.sourceDirectory||t.directory,repoOwner:t.repoOwner,repoName:t.repoName,repoBranch:t.repoBranch,readmeUrl:t.readmeUrl},t.targets&&t.targets.length?t.targets:oa),await ye(),Be({title:r("skills.toast.updated",{name:t.name||t.directory}),timeout:4e3})})},Ie=async()=>{const t=m.trim();if(!(t.length<2)){je("search"),D("");try{const n=await nr(t);p(n.skills||[])}catch(n){D(n?.message||r("skills.error.generic"))}finally{je("")}}},Ae=async()=>{const t=ve.trim().replace(/^https:\/\/github\.com\//,"").replace(/\.git$/,""),[n,l]=t.split("/");if(!n||!l){D(r("skills.repo.invalid"));return}await T("repo:add",async()=>{await lr({owner:n,name:l,branch:"main",enabled:!0}),xe(""),await ie(),await Z()})},tt=async t=>{await T(`repo:${t.owner}/${t.name}`,async()=>{await or(t.owner,t.name),await ie(),await Z()})},de=x.targets||[],rt=de.filter(pa),be=x.skills||[],st=i.useMemo(()=>{const t=$==="all"?be:be.filter(l=>(l.targets||[]).includes($)),n=ce.trim().toLowerCase();return n?t.filter(l=>(l.name||"").toLowerCase().includes(n)||(l.directory||"").toLowerCase().includes(n)||(l.description||"").toLowerCase().includes(n)):t},[be,$,ce]),nt=$!=="all",ee=i.useMemo(()=>O&&be.find(t=>(t.id||t.directory)===O)||null,[be,O]),it=i.useCallback(()=>{U("all"),z("")},[]),ot=i.useCallback(t=>{J(n=>{const l=t?.id||t?.directory||null;return n===l?null:l})},[]),lt=i.useCallback(()=>J(null),[]),dt=i.useCallback(t=>{const n=Ze(t).toLowerCase(),l=_a(t),f=(x.skills||[]).find(v=>{const j=et(v);return j.has(n)||l&&j.has(l)});f&&J(f.id||f.directory)},[x.skills]);i.useEffect(()=>{o!=="my"&&K.size&&R(new Set)},[o,K.size]),i.useEffect(()=>{O&&!ee&&J(null)},[ee,O]);const Ue=i.useMemo(()=>{const t=u===F?k:u===G?pe:c,l=u===F||u===G||u===ge?t:t.filter(j=>`${j.repoOwner}/${j.repoName}`===u),f=P.trim().toLowerCase();return(u===F||!f?l:l.filter(j=>(j.name||"").toLowerCase().includes(f)||(j.directory||"").toLowerCase().includes(f)||(j.description||"").toLowerCase().includes(f))).map(j=>{const Fe=Ze(j).toLowerCase(),q=_a(j);return{...j,installed:Ce.has(Fe)||q&&Ce.has(q)}})},[P,c,Ce,pe,k,u]),ct=e.jsx("div",{className:"flex h-64 items-center justify-center",children:e.jsx(te,{className:"h-8 w-8 animate-spin text-oai-gray-400","aria-hidden":!0})}),ut=e.jsxs("div",{className:"flex h-64 flex-col items-center justify-center gap-3 px-6 text-center",children:[e.jsx(te,{className:"h-8 w-8 animate-spin text-oai-gray-400","aria-hidden":!0}),e.jsx("p",{className:"max-w-md text-xs text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.browse.loading_hint")})]}),He=(t,n=null)=>e.jsxs("div",{className:"flex flex-col items-center gap-4 rounded-lg border border-dashed border-oai-gray-200 px-4 py-10 text-center text-sm text-oai-gray-500 dark:border-oai-gray-800 dark:text-oai-gray-400",children:[e.jsx("p",{children:r(t)}),n]});let We;if(Oe)We=ct;else if(o==="my")We=be.length?e.jsx(qr,{items:st,totalCount:be.length,targets:de,agentOptions:de,agentFilter:$,onAgentFilter:U,anyFilter:nt,onClearFilters:it,searchQuery:A,onSearchQuery:z,searchPlaceholder:r("skills.my.placeholder"),selectedId:O,onSelect:ot,onToggleTarget:Re,busyKey:H,updates:Ne,selectedIds:K,onToggleSelect:na,onClearSelection:Me,onBulkSync:V,onBulkRemove:oe}):e.jsxs("div",{className:"flex flex-col items-center gap-4 rounded-lg border border-dashed border-oai-gray-200 px-4 py-10 text-center dark:border-oai-gray-800",children:[de.length>0?e.jsxs("div",{className:"relative h-11 w-80 overflow-hidden","aria-hidden":!0,children:[e.jsx("div",{className:"pointer-events-none absolute inset-0",style:{maskImage:"linear-gradient(to right, transparent 8%, black 20%, black 32%, transparent 44%, transparent 56%, black 68%, black 80%, transparent 92%)",WebkitMaskImage:"linear-gradient(to right, transparent 8%, black 20%, black 32%, transparent 44%, transparent 56%, black 68%, black 80%, transparent 92%)"},children:e.jsx("div",{className:"absolute inset-y-0 left-0 flex w-max items-center animate-marquee-x",style:{filter:"blur(2.5px)"},children:[...de,...de].map((t,n)=>e.jsx("span",{className:"shrink-0 px-3",children:e.jsx(we,{provider:t.id,size:30})},`b-${n}`))})}),e.jsx("div",{className:"pointer-events-none absolute inset-0",style:{maskImage:"linear-gradient(to right, transparent 28%, black 42%, black 58%, transparent 72%)",WebkitMaskImage:"linear-gradient(to right, transparent 28%, black 42%, black 58%, transparent 72%)"},children:e.jsx("div",{className:"absolute inset-y-0 left-0 flex w-max items-center animate-marquee-x",children:[...de,...de].map((t,n)=>e.jsx("span",{className:"shrink-0 px-3",children:e.jsx(we,{provider:t.id,size:30})},`c-${n}`))})}),e.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-0 w-20 bg-gradient-to-r from-oai-white to-transparent dark:from-oai-gray-900"}),e.jsx("div",{className:"pointer-events-none absolute inset-y-0 right-0 w-20 bg-gradient-to-l from-oai-white to-transparent dark:from-oai-gray-900"})]}):null,e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.empty.my")}),e.jsx(X,{type:"button",size:"sm",onClick:()=>h("browse"),children:r("skills.empty.my_cta")})]});else{const t=u===F,n=u===G,l=S.length===0&&!t&&!n,f=$e&&!t&&!n||n&&De,v=!t&&!n&&(P.trim()!==""||u!==ge),j=()=>{C(""),w(ge)},Fe=!l&&!f&&(Ue.length>0||v)?e.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2 px-1 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:[e.jsx("span",{children:r("skills.filter.result_count_browse",{count:Ue.length})}),v?e.jsxs("button",{type:"button",onClick:j,className:"ml-auto inline-flex h-7 items-center gap-1 rounded-full bg-oai-gray-100 px-2.5 text-[11px] font-medium text-oai-gray-700 transition hover:bg-oai-gray-200 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:bg-oai-gray-800/70 dark:text-oai-gray-200 dark:hover:bg-oai-gray-700",children:[e.jsx(Ee,{className:"h-3 w-3","aria-hidden":!0}),r("skills.filter.clear")]}):null]}):null;let q;l?q=e.jsx("div",{className:"rounded-lg border border-dashed border-oai-gray-200 p-6 text-center dark:border-oai-gray-800",children:e.jsx("p",{className:"text-sm text-oai-gray-600 dark:text-oai-gray-300",children:r("skills.browse.empty_sources")})}):f?q=ut:t&&m.trim().length<2?q=e.jsx("div",{className:"rounded-lg border border-dashed border-oai-gray-200 px-4 py-6 text-center text-sm text-oai-gray-500 dark:border-oai-gray-800 dark:text-oai-gray-400",children:r("skills.browse.hint_skillssh")}):Ue.length?q=e.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:Ue.map(ze=>e.jsx("div",{style:Gr,children:e.jsx(Hr,{skill:ze,installed:!!ze.installed,installing:H===Qe(ze),allTargets:rt,defaultTargets:oa,onInstall:ta,onManage:dt})},ze.id||ze.key))}):v?q=He("skills.empty.no_match",e.jsx(X,{type:"button",variant:"secondary",size:"sm",onClick:j,children:r("skills.filter.clear")})):t?q=He("skills.empty.search"):n?q=He("skills.empty.popular"):q=He("skills.empty.browse");const mt=l||he?e.jsx("div",{className:"mb-5",children:e.jsx(Wr,{repos:S,repoInput:ve,onRepoInput:xe,busyKey:H,onAdd:Ae,onRemove:tt})}):null,gt=!he&&!t&&!n&&S.length<=1&&Ue.length>0?e.jsx(hr,{id:"skills-browse-intro",className:"mt-6",children:e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[e.jsx("span",{children:r("skills.browse.add_repo_hint")}),e.jsx("button",{type:"button",onClick:()=>_(!0),className:"rounded font-medium text-oai-gray-700 underline decoration-dotted underline-offset-2 transition hover:text-oai-black focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:text-oai-gray-200 dark:hover:text-white",children:r("skills.browse.manage_sources")})]})}):null;We=e.jsxs(e.Fragment,{children:[mt,Fe,q,gt]})}return e.jsxs("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:[e.jsx("main",{className:"flex-1 pb-12 pt-8 sm:pb-16 sm:pt-10",children:e.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[e.jsxs("div",{className:"mb-6 flex items-end justify-between gap-4",children:[e.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:r("skills.page.title")}),e.jsxs(X,{type:"button",variant:"secondary",size:"sm",onClick:aa,disabled:Oe||$e||De,children:[e.jsx(Bt,{className:ae("mr-1.5 h-3.5 w-3.5",(Oe||$e||De)&&"animate-spin"),"aria-hidden":!0}),r("skills.action.refresh")]})]}),e.jsx("div",{className:"mb-5 flex gap-6 border-b border-oai-gray-200 dark:border-oai-gray-800",children:[["my",r("skills.tab.my")],["browse",r("skills.tab.browse")]].map(([t,n])=>e.jsx("button",{type:"button","aria-pressed":o===t,onClick:()=>h(t),className:ae("-mb-px border-b-2 pb-2 text-sm font-medium transition-colors",o===t?"border-oai-black text-oai-black dark:border-white dark:text-white":"border-transparent text-oai-gray-500 hover:text-oai-black dark:text-oai-gray-400 dark:hover:text-white"),children:n},t))}),re?e.jsx("div",{className:"mb-4 rounded-lg border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700 dark:border-red-900/60 dark:bg-red-950/30 dark:text-red-200",children:re}):null,o==="browse"?e.jsxs("div",{className:"mb-5 flex flex-col gap-3 sm:flex-row sm:items-center",children:[e.jsx($t,{className:"shrink-0",ariaLabel:r("skills.source.label"),options:[{id:"repo",label:r("skills.mode.repo")},{id:"popular",label:r("skills.mode.popular"),icon:e.jsx(dr,{className:"h-3.5 w-3.5","aria-hidden":!0})},{id:"skillssh",label:r("skills.mode.skillssh")}],value:u===F?"skillssh":u===G?"popular":"repo",onChange:t=>{t==="skillssh"?w(F):t==="popular"?w(G):(u===F||u===G)&&w(ge)}}),u!==F&&u!==G?e.jsxs(Ta,{value:u,onValueChange:w,children:[e.jsxs(Oa,{"aria-label":r("skills.source.label"),className:"inline-flex h-8 w-44 shrink-0 items-center justify-between gap-2 rounded-md border border-oai-gray-200 bg-oai-white px-2.5 text-xs text-oai-black focus:outline-none data-[popup-open]:border-oai-gray-300 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-white dark:data-[popup-open]:border-oai-gray-700",children:[e.jsx($a,{children:t=>t===ge?r("skills.source.all"):t}),e.jsx(Wa,{className:"text-oai-gray-400",children:e.jsx(ha,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),e.jsx(Da,{children:e.jsx(Ma,{sideOffset:4,alignItemWithTrigger:!1,className:"z-[60]",children:e.jsxs(Aa,{className:"min-w-[var(--anchor-width)] overflow-hidden rounded-md border border-oai-gray-200 bg-white p-1 shadow-[0_12px_32px_-12px_rgba(0,0,0,0.18)] outline-none transition-[opacity,transform] duration-150 ease-out data-[ending-style]:scale-[0.97] data-[ending-style]:opacity-0 data-[starting-style]:scale-[0.97] data-[starting-style]:opacity-0 dark:border-oai-gray-800 dark:bg-oai-gray-950 dark:shadow-[0_12px_32px_-12px_rgba(0,0,0,0.6)]",children:[e.jsxs(Xe,{value:ge,className:"flex cursor-default select-none items-center justify-between gap-2 rounded px-3 py-1.5 text-sm text-oai-black outline-none data-[highlighted]:bg-oai-gray-100 dark:text-white dark:data-[highlighted]:bg-oai-gray-800",children:[e.jsx(Je,{children:r("skills.source.all")}),e.jsx(Ye,{children:e.jsx(Te,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),S.map(t=>{const n=`${t.owner}/${t.name}`;return e.jsxs(Xe,{value:n,className:"flex cursor-default select-none items-center justify-between gap-2 rounded px-3 py-1.5 text-sm text-oai-black outline-none data-[highlighted]:bg-oai-gray-100 dark:text-white dark:data-[highlighted]:bg-oai-gray-800",children:[e.jsx(Je,{children:n}),e.jsx(Ye,{children:e.jsx(Te,{className:"h-3.5 w-3.5","aria-hidden":!0})})]},n)})]})})})]}):null,e.jsxs("div",{className:"relative flex-1",children:[e.jsx(ua,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-oai-gray-400","aria-hidden":!0}),e.jsx(ga,{type:"search",value:m,onChange:t=>C(t.target.value),onKeyDown:t=>{t.key==="Enter"&&u===F&&Ie()},"aria-label":r("skills.action.search_aria"),placeholder:u===F?r("skills.browse.placeholder_skillssh"):u===G?r("skills.browse.placeholder_popular"):u===ge?r("skills.browse.placeholder_all"):r("skills.browse.placeholder_repo",{repo:u}),className:"h-8 pl-9 !border-oai-gray-200 dark:!border-oai-gray-800 focus:!border-oai-gray-400 focus:!ring-oai-gray-400/20 dark:focus:!border-oai-gray-500 dark:focus:!ring-oai-gray-500/20"})]}),u===F?e.jsxs(X,{type:"button",size:"sm",onClick:Ie,disabled:m.trim().length<2||H==="search",className:"focus:!ring-oai-gray-400/30",children:[H==="search"?e.jsx(te,{className:"mr-1.5 h-4 w-4 animate-spin","aria-hidden":!0}):e.jsx(ua,{className:"mr-1.5 h-4 w-4","aria-hidden":!0}),r("skills.action.search")]}):u===G?null:e.jsxs(X,{type:"button",variant:"secondary",size:"sm",onClick:()=>_(t=>!t),"aria-expanded":he,className:"!h-8 shrink-0 whitespace-nowrap !border-oai-gray-200 dark:!border-oai-gray-800 hover:!border-oai-gray-300 dark:hover:!border-oai-gray-700 hover:!text-oai-black dark:hover:!text-white focus:!ring-oai-gray-400/30",children:[e.jsx(Ha,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),r("skills.browse.manage_sources"),e.jsx("span",{className:"ml-1.5 rounded bg-oai-gray-100 px-1.5 py-0.5 text-xs font-medium text-oai-gray-600 dark:bg-oai-gray-800 dark:text-oai-gray-300",children:S.length})]})]}):null,We,e.jsx(Br,{skill:ee,targets:de,busyKey:H,usage:ee&&(W[String(ee.directory||"").toLowerCase()]||W[String(ee.name||"").toLowerCase()])||null,hasUpdate:!!(ee?.id&&Ne?.[ee.id]),updating:ee?H===Qe(ee):!1,onUpdate:Pe,onClose:lt,onToggleTarget:Re,onRemove:ra})]})}),e.jsx(ba,{open:!!N,title:r("skills.confirm.remove_title",{name:N?.name||N?.directory||""}),description:N?N.managed?r("skills.confirm.remove_managed"):r("skills.confirm.remove_local"):"",confirmLabel:r("skills.action.remove"),cancelLabel:r("shared.action.cancel"),destructive:!0,busy:H===La(N||{}),onCancel:()=>se(null),onConfirm:sa}),e.jsx(ba,{open:!!ne,title:r("skills.confirm.bulk_remove_title",{count:ne?.length||0}),description:r("skills.confirm.bulk_remove_desc"),confirmLabel:r("skills.action.remove"),cancelLabel:r("shared.action.cancel"),destructive:!0,busy:H==="batch",onCancel:()=>B(null),onConfirm:le})]})}export{Ss as SkillsPage,Ar as buildLocallyInstalledKeys};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{m as on,bi as sn,r as R,bw as rn,ba as cn,aG as ln,bx as an,a0 as $t,A as fn,bb as B,by as Q,bz as Ne,bu as se,bA as J,b2 as K,bB as je,bC as pe,bD as Se,bE as un,bF as Ht,bG as dn,bH as qe,bI as Ue,bJ as De,bK as vt,bL as It,a5 as gn,bM as mn,a_ as hn,aZ as G,bc as Ce,V as Ke,bN as pn,z as xn,bO as wn}from"./__vite-browser-external-CJKqcpDH.js";import{n as At,q as yn,F as bn,P as Rn,o as vn,v as Re,p as An,i as On}from"./useScrollLock-DXsFDMbK.js";const Sn=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Bo=on("chevron-down",Sn),Cn=["top","right","bottom","left"],de=Math.min,z=Math.max,Ee=Math.round,ve=Math.floor,q=e=>({x:e,y:e}),En={left:"right",right:"left",bottom:"top",top:"bottom"};function Xe(e,t,o){return z(e,de(t,o))}function Z(e,t){return typeof e=="function"?e(t):e}function V(e){return e.split("-")[0]}function te(e){return e.split("-")[1]}function Ge(e){return e==="x"?"y":"x"}function Je(e){return e==="y"?"height":"width"}function X(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Ze(e){return Ge(X(e))}function Pn(e,t,o){o===void 0&&(o=!1);const n=te(e),i=Ze(e),s=Je(i);let r=i==="x"?n===(o?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(r=Pe(r)),[r,Pe(r)]}function Tn(e){const t=Pe(e);return[Ye(e),t,Ye(t)]}function Ye(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Ot=["left","right"],St=["right","left"],Mn=["top","bottom"],Dn=["bottom","top"];function kn(e,t,o){switch(e){case"top":case"bottom":return o?t?St:Ot:t?Ot:St;case"left":case"right":return t?Mn:Dn;default:return[]}}function Ln(e,t,o,n){const i=te(e);let s=kn(V(e),o==="start",n);return i&&(s=s.map(r=>r+"-"+i),t&&(s=s.concat(s.map(Ye)))),s}function Pe(e){const t=V(e);return En[t]+e.slice(t.length)}function Fn(e){return{top:0,right:0,bottom:0,left:0,...e}}function Bt(e){return typeof e!="number"?Fn(e):{top:e,right:e,bottom:e,left:e}}function Te(e){const{x:t,y:o,width:n,height:i}=e;return{width:n,height:i,top:o,left:t,right:t+n,bottom:o+i,x:t,y:o}}function Vo(e,t={}){const{enabled:o=!0,event:n="click",toggle:i=!0,ignoreMouse:s=!1,stickIfOpen:r=!0,touchOpenDelay:c=0,reason:l=sn}=t,u="rootStore"in e?e.rootStore:e,a=u.context.dataRef,f=R.useRef(void 0),g=rn(),d=cn(),h=R.useMemo(()=>{function m(p,w,x,y){const v=fn(l,w,x);p&&y==="touch"&&c>0?d.start(c,()=>{u.setOpen(!0,v)}):u.setOpen(p,v)}function b(p,w,x){const y=a.current.openEvent,v=u.select("domReferenceElement")!==w;return p&&v||!p||!i?!0:y&&r?!x(y.type):!1}return{onPointerDown(p){f.current=p.pointerType},onMouseDown(p){const w=f.current,x=p.nativeEvent,y=u.select("open");if(p.button!==0||n==="click"||At(w,!0)&&s)return;const v=b(y,p.currentTarget,E=>E==="click"||E==="mousedown"),A=ln(x);if(an(A)){m(v,x,A,w);return}const P=p.currentTarget;g.request(()=>{m(v,x,P,w)})},onClick(p){if(n==="mousedown-only")return;const w=f.current;if(n==="mousedown"&&w){f.current=void 0;return}if(At(w,!0)&&s)return;const x=u.select("open"),y=b(x,p.currentTarget,v=>v==="click"||v==="mousedown"||v==="keydown"||v==="keyup");m(y,p.nativeEvent,p.currentTarget,w)},onKeyDown(){f.current=void 0}}},[a,n,s,l,u,r,i,g,d,c]);return R.useMemo(()=>o?{reference:h}:$t,[o,h])}function Ct(e,t,o){let{reference:n,floating:i}=e;const s=X(t),r=Ze(t),c=Je(r),l=V(t),u=s==="y",a=n.x+n.width/2-i.width/2,f=n.y+n.height/2-i.height/2,g=n[c]/2-i[c]/2;let d;switch(l){case"top":d={x:a,y:n.y-i.height};break;case"bottom":d={x:a,y:n.y+n.height};break;case"right":d={x:n.x+n.width,y:f};break;case"left":d={x:n.x-i.width,y:f};break;default:d={x:n.x,y:n.y}}switch(te(t)){case"start":d[r]-=g*(o&&u?-1:1);break;case"end":d[r]+=g*(o&&u?-1:1);break}return d}async function Wn(e,t){var o;t===void 0&&(t={});const{x:n,y:i,platform:s,rects:r,elements:c,strategy:l}=e,{boundary:u="clippingAncestors",rootBoundary:a="viewport",elementContext:f="floating",altBoundary:g=!1,padding:d=0}=Z(t,e),h=Bt(d),b=c[g?f==="floating"?"reference":"floating":f],p=Te(await s.getClippingRect({element:(o=await(s.isElement==null?void 0:s.isElement(b)))==null||o?b:b.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:u,rootBoundary:a,strategy:l})),w=f==="floating"?{x:n,y:i,width:r.floating.width,height:r.floating.height}:r.reference,x=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),y=await(s.isElement==null?void 0:s.isElement(x))?await(s.getScale==null?void 0:s.getScale(x))||{x:1,y:1}:{x:1,y:1},v=Te(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:w,offsetParent:x,strategy:l}):w);return{top:(p.top-v.top+h.top)/y.y,bottom:(v.bottom-p.bottom+h.bottom)/y.y,left:(p.left-v.left+h.left)/y.x,right:(v.right-p.right+h.right)/y.x}}const $n=50,Hn=async(e,t,o)=>{const{placement:n="bottom",strategy:i="absolute",middleware:s=[],platform:r}=o,c=r.detectOverflow?r:{...r,detectOverflow:Wn},l=await(r.isRTL==null?void 0:r.isRTL(t));let u=await r.getElementRects({reference:e,floating:t,strategy:i}),{x:a,y:f}=Ct(u,n,l),g=n,d=0;const h={};for(let m=0;m<s.length;m++){const b=s[m];if(!b)continue;const{name:p,fn:w}=b,{x,y,data:v,reset:A}=await w({x:a,y:f,initialPlacement:n,placement:g,strategy:i,middlewareData:h,rects:u,platform:c,elements:{reference:e,floating:t}});a=x??a,f=y??f,h[p]={...h[p],...v},A&&d<$n&&(d++,typeof A=="object"&&(A.placement&&(g=A.placement),A.rects&&(u=A.rects===!0?await r.getElementRects({reference:e,floating:t,strategy:i}):A.rects),{x:a,y:f}=Ct(u,g,l)),m=-1)}return{x:a,y:f,placement:g,strategy:i,middlewareData:h}},In=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var o,n;const{placement:i,middlewareData:s,rects:r,initialPlacement:c,platform:l,elements:u}=t,{mainAxis:a=!0,crossAxis:f=!0,fallbackPlacements:g,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:m=!0,...b}=Z(e,t);if((o=s.arrow)!=null&&o.alignmentOffset)return{};const p=V(i),w=X(c),x=V(c)===c,y=await(l.isRTL==null?void 0:l.isRTL(u.floating)),v=g||(x||!m?[Pe(c)]:Tn(c)),A=h!=="none";!g&&A&&v.push(...Ln(c,m,h,y));const P=[c,...v],E=await l.detectOverflow(t,b),k=[];let D=((n=s.flip)==null?void 0:n.overflows)||[];if(a&&k.push(E[p]),f){const W=Pn(i,r,y);k.push(E[W[0]],E[W[1]])}if(D=[...D,{placement:i,overflows:k}],!k.every(W=>W<=0)){var F,S;const W=(((F=s.flip)==null?void 0:F.index)||0)+1,H=P[W];if(H&&(!(f==="alignment"?w!==X(H):!1)||D.every(O=>X(O.placement)===w?O.overflows[0]>0:!0)))return{data:{index:W,overflows:D},reset:{placement:H}};let $=(S=D.filter(L=>L.overflows[0]<=0).sort((L,O)=>L.overflows[1]-O.overflows[1])[0])==null?void 0:S.placement;if(!$)switch(d){case"bestFit":{var M;const L=(M=D.filter(O=>{if(A){const I=X(O.placement);return I===w||I==="y"}return!0}).map(O=>[O.placement,O.overflows.filter(I=>I>0).reduce((I,C)=>I+C,0)]).sort((O,I)=>O[1]-I[1])[0])==null?void 0:M[0];L&&($=L);break}case"initialPlacement":$=c;break}if(i!==$)return{reset:{placement:$}}}return{}}}};function Et(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Pt(e){return Cn.some(t=>e[t]>=0)}const Bn=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:o,platform:n}=t,{strategy:i="referenceHidden",...s}=Z(e,t);switch(i){case"referenceHidden":{const r=await n.detectOverflow(t,{...s,elementContext:"reference"}),c=Et(r,o.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:Pt(c)}}}case"escaped":{const r=await n.detectOverflow(t,{...s,altBoundary:!0}),c=Et(r,o.floating);return{data:{escapedOffsets:c,escaped:Pt(c)}}}default:return{}}}}},Vt=new Set(["left","top"]);async function Vn(e,t){const{placement:o,platform:n,elements:i}=e,s=await(n.isRTL==null?void 0:n.isRTL(i.floating)),r=V(o),c=te(o),l=X(o)==="y",u=Vt.has(r)?-1:1,a=s&&l?-1:1,f=Z(t,e);let{mainAxis:g,crossAxis:d,alignmentAxis:h}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&typeof h=="number"&&(d=c==="end"?h*-1:h),l?{x:d*a,y:g*u}:{x:g*u,y:d*a}}const _n=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var o,n;const{x:i,y:s,placement:r,middlewareData:c}=t,l=await Vn(t,e);return r===((o=c.offset)==null?void 0:o.placement)&&(n=c.arrow)!=null&&n.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:r}}}}},zn=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:o,y:n,placement:i,platform:s}=t,{mainAxis:r=!0,crossAxis:c=!1,limiter:l={fn:p=>{let{x:w,y:x}=p;return{x:w,y:x}}},...u}=Z(e,t),a={x:o,y:n},f=await s.detectOverflow(t,u),g=X(V(i)),d=Ge(g);let h=a[d],m=a[g];if(r){const p=d==="y"?"top":"left",w=d==="y"?"bottom":"right",x=h+f[p],y=h-f[w];h=Xe(x,h,y)}if(c){const p=g==="y"?"top":"left",w=g==="y"?"bottom":"right",x=m+f[p],y=m-f[w];m=Xe(x,m,y)}const b=l.fn({...t,[d]:h,[g]:m});return{...b,data:{x:b.x-o,y:b.y-n,enabled:{[d]:r,[g]:c}}}}}},Nn=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:o,y:n,placement:i,rects:s,middlewareData:r}=t,{offset:c=0,mainAxis:l=!0,crossAxis:u=!0}=Z(e,t),a={x:o,y:n},f=X(i),g=Ge(f);let d=a[g],h=a[f];const m=Z(c,t),b=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){const x=g==="y"?"height":"width",y=s.reference[g]-s.floating[x]+b.mainAxis,v=s.reference[g]+s.reference[x]-b.mainAxis;d<y?d=y:d>v&&(d=v)}if(u){var p,w;const x=g==="y"?"width":"height",y=Vt.has(V(i)),v=s.reference[f]-s.floating[x]+(y&&((p=r.offset)==null?void 0:p[f])||0)+(y?0:b.crossAxis),A=s.reference[f]+s.reference[x]+(y?0:((w=r.offset)==null?void 0:w[f])||0)-(y?b.crossAxis:0);h<v?h=v:h>A&&(h=A)}return{[g]:d,[f]:h}}}},Xn=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var o,n;const{placement:i,rects:s,platform:r,elements:c}=t,{apply:l=()=>{},...u}=Z(e,t),a=await r.detectOverflow(t,u),f=V(i),g=te(i),d=X(i)==="y",{width:h,height:m}=s.floating;let b,p;f==="top"||f==="bottom"?(b=f,p=g===(await(r.isRTL==null?void 0:r.isRTL(c.floating))?"start":"end")?"left":"right"):(p=f,b=g==="end"?"top":"bottom");const w=m-a.top-a.bottom,x=h-a.left-a.right,y=de(m-a[b],w),v=de(h-a[p],x),A=!t.middlewareData.shift;let P=y,E=v;if((o=t.middlewareData.shift)!=null&&o.enabled.x&&(E=x),(n=t.middlewareData.shift)!=null&&n.enabled.y&&(P=w),A&&!g){const D=z(a.left,0),F=z(a.right,0),S=z(a.top,0),M=z(a.bottom,0);d?E=h-2*(D!==0||F!==0?D+F:z(a.left,a.right)):P=m-2*(S!==0||M!==0?S+M:z(a.top,a.bottom))}await l({...t,availableWidth:E,availableHeight:P});const k=await r.getDimensions(c.floating);return h!==k.width||m!==k.height?{reset:{rects:!0}}:{}}}};function _t(e){const t=J(e);let o=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const i=se(e),s=i?e.offsetWidth:o,r=i?e.offsetHeight:n,c=Ee(o)!==s||Ee(n)!==r;return c&&(o=s,n=r),{width:o,height:n,$:c}}function Qe(e){return B(e)?e:e.contextElement}function ue(e){const t=Qe(e);if(!se(t))return q(1);const o=t.getBoundingClientRect(),{width:n,height:i,$:s}=_t(t);let r=(s?Ee(o.width):o.width)/n,c=(s?Ee(o.height):o.height)/i;return(!r||!Number.isFinite(r))&&(r=1),(!c||!Number.isFinite(c))&&(c=1),{x:r,y:c}}const Yn=q(0);function zt(e){const t=K(e);return!It()||!t.visualViewport?Yn:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function jn(e,t,o){return t===void 0&&(t=!1),!o||t&&o!==K(e)?!1:t}function ie(e,t,o,n){t===void 0&&(t=!1),o===void 0&&(o=!1);const i=e.getBoundingClientRect(),s=Qe(e);let r=q(1);t&&(n?B(n)&&(r=ue(n)):r=ue(e));const c=jn(s,o,n)?zt(s):q(0);let l=(i.left+c.x)/r.x,u=(i.top+c.y)/r.y,a=i.width/r.x,f=i.height/r.y;if(s){const g=K(s),d=n&&B(n)?K(n):n;let h=g,m=vt(h);for(;m&&n&&d!==h;){const b=ue(m),p=m.getBoundingClientRect(),w=J(m),x=p.left+(m.clientLeft+parseFloat(w.paddingLeft))*b.x,y=p.top+(m.clientTop+parseFloat(w.paddingTop))*b.y;l*=b.x,u*=b.y,a*=b.x,f*=b.y,l+=x,u+=y,h=K(m),m=vt(h)}}return Te({width:a,height:f,x:l,y:u})}function ke(e,t){const o=De(e).scrollLeft;return t?t.left+o:ie(Q(e)).left+o}function Nt(e,t){const o=e.getBoundingClientRect(),n=o.left+t.scrollLeft-ke(e,o),i=o.top+t.scrollTop;return{x:n,y:i}}function qn(e){let{elements:t,rect:o,offsetParent:n,strategy:i}=e;const s=i==="fixed",r=Q(n),c=t?je(t.floating):!1;if(n===r||c&&s)return o;let l={scrollLeft:0,scrollTop:0},u=q(1);const a=q(0),f=se(n);if((f||!f&&!s)&&((qe(n)!=="body"||Ue(r))&&(l=De(n)),f)){const d=ie(n);u=ue(n),a.x=d.x+n.clientLeft,a.y=d.y+n.clientTop}const g=r&&!f&&!s?Nt(r,l):q(0);return{width:o.width*u.x,height:o.height*u.y,x:o.x*u.x-l.scrollLeft*u.x+a.x+g.x,y:o.y*u.y-l.scrollTop*u.y+a.y+g.y}}function Un(e){return Array.from(e.getClientRects())}function Kn(e){const t=Q(e),o=De(e),n=e.ownerDocument.body,i=z(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),s=z(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let r=-o.scrollLeft+ke(e);const c=-o.scrollTop;return J(n).direction==="rtl"&&(r+=z(t.clientWidth,n.clientWidth)-i),{width:i,height:s,x:r,y:c}}const Tt=25;function Gn(e,t){const o=K(e),n=Q(e),i=o.visualViewport;let s=n.clientWidth,r=n.clientHeight,c=0,l=0;if(i){s=i.width,r=i.height;const a=It();(!a||a&&t==="fixed")&&(c=i.offsetLeft,l=i.offsetTop)}const u=ke(n);if(u<=0){const a=n.ownerDocument,f=a.body,g=getComputedStyle(f),d=a.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,h=Math.abs(n.clientWidth-f.clientWidth-d);h<=Tt&&(s-=h)}else u<=Tt&&(s+=u);return{width:s,height:r,x:c,y:l}}function Jn(e,t){const o=ie(e,!0,t==="fixed"),n=o.top+e.clientTop,i=o.left+e.clientLeft,s=se(e)?ue(e):q(1),r=e.clientWidth*s.x,c=e.clientHeight*s.y,l=i*s.x,u=n*s.y;return{width:r,height:c,x:l,y:u}}function Mt(e,t,o){let n;if(t==="viewport")n=Gn(e,o);else if(t==="document")n=Kn(Q(e));else if(B(t))n=Jn(t,o);else{const i=zt(e);n={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return Te(n)}function Xt(e,t){const o=pe(e);return o===t||!B(o)||Se(o)?!1:J(o).position==="fixed"||Xt(o,t)}function Zn(e,t){const o=t.get(e);if(o)return o;let n=Ne(e,[],!1).filter(c=>B(c)&&qe(c)!=="body"),i=null;const s=J(e).position==="fixed";let r=s?pe(e):e;for(;B(r)&&!Se(r);){const c=J(r),l=Ht(r);!l&&c.position==="fixed"&&(i=null),(s?!l&&!i:!l&&c.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||Ue(r)&&!l&&Xt(e,r))?n=n.filter(a=>a!==r):i=c,r=pe(r)}return t.set(e,n),n}function Qn(e){let{element:t,boundary:o,rootBoundary:n,strategy:i}=e;const r=[...o==="clippingAncestors"?je(t)?[]:Zn(t,this._c):[].concat(o),n],c=Mt(t,r[0],i);let l=c.top,u=c.right,a=c.bottom,f=c.left;for(let g=1;g<r.length;g++){const d=Mt(t,r[g],i);l=z(d.top,l),u=de(d.right,u),a=de(d.bottom,a),f=z(d.left,f)}return{width:u-f,height:a-l,x:f,y:l}}function eo(e){const{width:t,height:o}=_t(e);return{width:t,height:o}}function to(e,t,o){const n=se(t),i=Q(t),s=o==="fixed",r=ie(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const l=q(0);function u(){l.x=ke(i)}if(n||!n&&!s)if((qe(t)!=="body"||Ue(i))&&(c=De(t)),n){const d=ie(t,!0,s,t);l.x=d.x+t.clientLeft,l.y=d.y+t.clientTop}else i&&u();s&&!n&&i&&u();const a=i&&!n&&!s?Nt(i,c):q(0),f=r.left+c.scrollLeft-l.x-a.x,g=r.top+c.scrollTop-l.y-a.y;return{x:f,y:g,width:r.width,height:r.height}}function _e(e){return J(e).position==="static"}function Dt(e,t){if(!se(e)||J(e).position==="fixed")return null;if(t)return t(e);let o=e.offsetParent;return Q(e)===o&&(o=o.ownerDocument.body),o}function Yt(e,t){const o=K(e);if(je(e))return o;if(!se(e)){let i=pe(e);for(;i&&!Se(i);){if(B(i)&&!_e(i))return i;i=pe(i)}return o}let n=Dt(e,t);for(;n&&un(n)&&_e(n);)n=Dt(n,t);return n&&Se(n)&&_e(n)&&!Ht(n)?o:n||dn(e)||o}const no=async function(e){const t=this.getOffsetParent||Yt,o=this.getDimensions,n=await o(e.floating);return{reference:to(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function oo(e){return J(e).direction==="rtl"}const io={convertOffsetParentRelativeRectToViewportRelativeRect:qn,getDocumentElement:Q,getClippingRect:Qn,getOffsetParent:Yt,getElementRects:no,getClientRects:Un,getDimensions:eo,getScale:ue,isElement:B,isRTL:oo};function jt(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function so(e,t){let o=null,n;const i=Q(e);function s(){var c;clearTimeout(n),(c=o)==null||c.disconnect(),o=null}function r(c,l){c===void 0&&(c=!1),l===void 0&&(l=1),s();const u=e.getBoundingClientRect(),{left:a,top:f,width:g,height:d}=u;if(c||t(),!g||!d)return;const h=ve(f),m=ve(i.clientWidth-(a+g)),b=ve(i.clientHeight-(f+d)),p=ve(a),x={rootMargin:-h+"px "+-m+"px "+-b+"px "+-p+"px",threshold:z(0,de(1,l))||1};let y=!0;function v(A){const P=A[0].intersectionRatio;if(P!==l){if(!y)return r();P?r(!1,P):n=setTimeout(()=>{r(!1,1e-7)},1e3)}P===1&&!jt(u,e.getBoundingClientRect())&&r(),y=!1}try{o=new IntersectionObserver(v,{...x,root:i.ownerDocument})}catch{o=new IntersectionObserver(v,x)}o.observe(e)}return r(!0),s}function kt(e,t,o,n){n===void 0&&(n={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:r=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:l=!1}=n,u=Qe(e),a=i||s?[...u?Ne(u):[],...t?Ne(t):[]]:[];a.forEach(p=>{i&&p.addEventListener("scroll",o,{passive:!0}),s&&p.addEventListener("resize",o)});const f=u&&c?so(u,o):null;let g=-1,d=null;r&&(d=new ResizeObserver(p=>{let[w]=p;w&&w.target===u&&d&&t&&(d.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var x;(x=d)==null||x.observe(t)})),o()}),u&&!l&&d.observe(u),t&&d.observe(t));let h,m=l?ie(e):null;l&&b();function b(){const p=ie(e);m&&!jt(m,p)&&o(),m=p,h=requestAnimationFrame(b)}return o(),()=>{var p;a.forEach(w=>{i&&w.removeEventListener("scroll",o),s&&w.removeEventListener("resize",o)}),f?.(),(p=d)==null||p.disconnect(),d=null,l&&cancelAnimationFrame(h)}}const ro=_n,co=zn,lo=In,ao=Xn,fo=Bn,uo=Nn,go=(e,t,o)=>{const n=new Map,i={platform:io,...o},s={...i.platform,_c:n};return Hn(e,t,{...i,platform:s})};var mo=typeof document<"u",ho=function(){},Ae=mo?R.useLayoutEffect:ho;function Me(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let o,n,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(o=e.length,o!==t.length)return!1;for(n=o;n--!==0;)if(!Me(e[n],t[n]))return!1;return!0}if(i=Object.keys(e),o=i.length,o!==Object.keys(t).length)return!1;for(n=o;n--!==0;)if(!{}.hasOwnProperty.call(t,i[n]))return!1;for(n=o;n--!==0;){const s=i[n];if(!(s==="_owner"&&e.$$typeof)&&!Me(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function qt(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Lt(e,t){const o=qt(e);return Math.round(t*o)/o}function ze(e){const t=R.useRef(e);return Ae(()=>{t.current=e}),t}function po(e){e===void 0&&(e={});const{placement:t="bottom",strategy:o="absolute",middleware:n=[],platform:i,elements:{reference:s,floating:r}={},transform:c=!0,whileElementsMounted:l,open:u}=e,[a,f]=R.useState({x:0,y:0,strategy:o,placement:t,middlewareData:{},isPositioned:!1}),[g,d]=R.useState(n);Me(g,n)||d(n);const[h,m]=R.useState(null),[b,p]=R.useState(null),w=R.useCallback(O=>{O!==A.current&&(A.current=O,m(O))},[]),x=R.useCallback(O=>{O!==P.current&&(P.current=O,p(O))},[]),y=s||h,v=r||b,A=R.useRef(null),P=R.useRef(null),E=R.useRef(a),k=l!=null,D=ze(l),F=ze(i),S=ze(u),M=R.useCallback(()=>{if(!A.current||!P.current)return;const O={placement:t,strategy:o,middleware:g};F.current&&(O.platform=F.current),go(A.current,P.current,O).then(I=>{const C={...I,isPositioned:S.current!==!1};W.current&&!Me(E.current,C)&&(E.current=C,gn.flushSync(()=>{f(C)}))})},[g,t,o,F,S]);Ae(()=>{u===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,f(O=>({...O,isPositioned:!1})))},[u]);const W=R.useRef(!1);Ae(()=>(W.current=!0,()=>{W.current=!1}),[]),Ae(()=>{if(y&&(A.current=y),v&&(P.current=v),y&&v){if(D.current)return D.current(y,v,M);M()}},[y,v,M,D,k]);const H=R.useMemo(()=>({reference:A,floating:P,setReference:w,setFloating:x}),[w,x]),$=R.useMemo(()=>({reference:y,floating:v}),[y,v]),L=R.useMemo(()=>{const O={position:o,left:0,top:0};if(!$.floating)return O;const I=Lt($.floating,a.x),C=Lt($.floating,a.y);return c?{...O,transform:"translate("+I+"px, "+C+"px)",...qt($.floating)>=1.5&&{willChange:"transform"}}:{position:o,left:I,top:C}},[o,c,$.floating,a.x,a.y]);return R.useMemo(()=>({...a,update:M,refs:H,elements:$,floatingStyles:L}),[a,M,H,$,L])}const xo=(e,t)=>{const o=ro(e);return{name:o.name,fn:o.fn,options:[e,t]}},wo=(e,t)=>{const o=co(e);return{name:o.name,fn:o.fn,options:[e,t]}},yo=(e,t)=>({fn:uo(e).fn,options:[e,t]}),bo=(e,t)=>{const o=lo(e);return{name:o.name,fn:o.fn,options:[e,t]}},Ro=(e,t)=>{const o=ao(e);return{name:o.name,fn:o.fn,options:[e,t]}},vo=(e,t)=>{const o=fo(e);return{name:o.name,fn:o.fn,options:[e,t]}};function Ao(e){const{open:t=!1,onOpenChange:o,elements:n={}}=e,i=mn(),s=yn()!=null,r=hn(()=>new bn({open:t,transitionStatus:void 0,onOpenChange:o,referenceElement:n.reference??null,floatingElement:n.floating??null,triggerElements:new Rn,floatingId:i,syncOnly:!1,nested:s})).current;return G(()=>{const c={open:t,floatingId:i};n.reference!==void 0&&(c.referenceElement=n.reference,c.domReferenceElement=B(n.reference)?n.reference:null),n.floating!==void 0&&(c.floatingElement=n.floating),r.update(c)},[t,i,n.reference,n.floating,r]),r.context.onOpenChange=o,r.context.nested=s,r}function Oo(e={}){const{nodeId:t,externalTree:o}=e,n=Ao(e),i=e.rootContext||n,s=i.useState("referenceElement"),r=i.useState("floatingElement"),c=i.useState("domReferenceElement"),l=i.useState("open"),u=i.useState("floatingId"),[a,f]=R.useState(null),[g,d]=R.useState(void 0),[h,m]=R.useState(void 0),b=R.useRef(null),p=vn(o),w=R.useMemo(()=>({reference:s,floating:r,domReference:c}),[s,r,c]),x=po({...e,elements:{...w,...a&&{reference:a}}}),y=B(g)?g:null,v=h===void 0?i.state.floatingElement:h;i.useSyncedValue("referenceElement",g??null),i.useSyncedValue("domReferenceElement",g===void 0?c:y),i.useSyncedValue("floatingElement",v);const A=R.useCallback(S=>{const M=B(S)?{getBoundingClientRect:()=>S.getBoundingClientRect(),getClientRects:()=>S.getClientRects(),contextElement:S}:S;f(M),x.refs.setReference(M)},[x.refs]),P=R.useCallback(S=>{(B(S)||S===null)&&(b.current=S,d(S)),(B(x.refs.reference.current)||x.refs.reference.current===null||S!==null&&!B(S))&&x.refs.setReference(S)},[x.refs,d]),E=R.useCallback(S=>{m(S),x.refs.setFloating(S)},[x.refs]),k=R.useMemo(()=>({...x.refs,setReference:P,setFloating:E,setPositionReference:A,domReference:b}),[x.refs,P,E,A]),D=R.useMemo(()=>({...x.elements,domReference:c}),[x.elements,c]),F=R.useMemo(()=>({...x,dataRef:i.context.dataRef,open:l,onOpenChange:i.setOpen,events:i.context.events,floatingId:u,refs:k,elements:D,nodeId:t,rootStore:i}),[x,k,D,t,i,l,u]);return G(()=>{c&&(b.current=c)},[c]),G(()=>{i.context.dataRef.current.floatingContext=F;const S=p?.nodesRef.current.find(M=>M.id===t);S&&(S.context=F)}),R.useMemo(()=>({...x,context:F,refs:k,elements:D,rootStore:i}),[x,k,D,F,i])}const So=R.createContext(void 0);function Co(){return R.useContext(So)?.direction??"ltr"}const Eo=e=>({name:"arrow",options:e,async fn(t){const{x:o,y:n,placement:i,rects:s,platform:r,elements:c,middlewareData:l}=t,{element:u,padding:a=0,offsetParent:f="real"}=Z(e,t)||{};if(u==null)return{};const g=Bt(a),d={x:o,y:n},h=Ze(i),m=Je(h),b=await r.getDimensions(u),p=h==="y",w=p?"top":"left",x=p?"bottom":"right",y=p?"clientHeight":"clientWidth",v=s.reference[m]+s.reference[h]-d[h]-s.floating[m],A=d[h]-s.reference[h],P=f==="real"?await r.getOffsetParent?.(u):c.floating;let E=c.floating[y]||s.floating[m];(!E||!await r.isElement?.(P))&&(E=c.floating[y]||s.floating[m]);const k=v/2-A/2,D=E/2-b[m]/2-1,F=Math.min(g[w],D),S=Math.min(g[x],D),M=F,W=E-b[m]-S,H=E/2-b[m]/2+k,$=Xe(M,H,W),L=!l.arrow&&te(i)!=null&&H!==$&&s.reference[m]/2-(H<M?F:S)-b[m]/2<0,O=L?H<M?H-M:H-W:0;return{[h]:d[h]+O,data:{[h]:$,centerOffset:H-$-O,...L&&{alignmentOffset:O}},reset:L}}}),Po=(e,t)=>({...Eo(e),options:[e,t]}),To=vo().fn,Mo={name:"hide",async fn(e){const{width:t,height:o,x:n,y:i}=e.rects.reference,s=t===0&&o===0&&n===0&&i===0;return{data:{referenceHidden:(await To(e)).data?.referenceHidden||s}}}},Oe={sideX:"left",sideY:"top"},_o={name:"adaptiveOrigin",async fn(e){const{x:t,y:o,rects:{floating:n},elements:{floating:i},platform:s,strategy:r,placement:c}=e,l=K(i),u=l.getComputedStyle(i);if(!(u.transitionDuration!=="0s"&&u.transitionDuration!==""))return{x:t,y:o,data:Oe};const f=await s.getOffsetParent?.(i);let g={width:0,height:0};if(r==="fixed"&&l?.visualViewport)g={width:l.visualViewport.width,height:l.visualViewport.height};else if(f===l){const w=Ce(i);g={width:w.documentElement.clientWidth,height:w.documentElement.clientHeight}}else await s.isElement?.(f)&&(g=await s.getDimensions(f));const d=V(c);let h=t,m=o;d==="left"&&(h=g.width-(t+n.width)),d==="top"&&(m=g.height-(o+n.height));const b=d==="left"?"right":Oe.sideX,p=d==="top"?"bottom":Oe.sideY;return{x:h,y:m,data:{sideX:b,sideY:p}}}};function Ut(e,t,o){const n=e==="inline-start"||e==="inline-end";return{top:"top",right:n?o?"inline-start":"inline-end":"right",bottom:"bottom",left:n?o?"inline-end":"inline-start":"left"}[t]}function Ft(e,t,o){const{rects:n,placement:i}=e;return{side:Ut(t,V(i),o),align:te(i)||"center",anchor:{width:n.reference.width,height:n.reference.height},positioner:{width:n.floating.width,height:n.floating.height}}}function zo(e){const{anchor:t,positionMethod:o="absolute",side:n="bottom",sideOffset:i=0,align:s="center",alignOffset:r=0,collisionBoundary:c,collisionPadding:l=5,sticky:u=!1,arrowPadding:a=5,disableAnchorTracking:f=!1,inline:g,keepMounted:d=!1,floatingRootContext:h,mounted:m,collisionAvoidance:b,shiftCrossAxis:p=!1,nodeId:w,adaptiveOrigin:x,lazyFlip:y=!1,externalTree:v}=e,[A,P]=R.useState(null);!m&&A!==null&&P(null);const E=b.side||"flip",k=b.align||"flip",D=b.fallbackAxisSide||"end",F=typeof t=="function"?t:void 0,S=Ke(F),M=F?S:t,W=Re(t),H=Re(m),L=Co()==="rtl",O=A||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":L?"left":"right","inline-start":L?"right":"left"}[n],I=s==="center"?O:`${O}-${s}`;let C=l;const ee=1,et=n==="bottom"?ee:0,tt=n==="top"?ee:0,nt=n==="right"?ee:0,ot=n==="left"?ee:0;typeof C=="number"?C={top:C+et,right:C+ot,bottom:C+tt,left:C+nt}:C&&(C={top:(C.top||0)+et,right:(C.right||0)+ot,bottom:(C.bottom||0)+tt,left:(C.left||0)+nt});const xe={boundary:c==="clipping-ancestors"?"clippingAncestors":c,padding:C},re=R.useRef(null),Le=Re(i),Fe=Re(r),Kt=typeof i!="function"?i:0,Gt=typeof r!="function"?r:0,ce=[];g&&ce.push(g),ce.push(xo(T=>{const _=Ft(T,n,L),j=typeof Le.current=="function"?Le.current(_):Le.current,N=typeof Fe.current=="function"?Fe.current(_):Fe.current;return{mainAxis:j,crossAxis:N,alignmentAxis:N}},[Kt,Gt,L,n]));const it=k==="none"&&E!=="shift",st=!it&&(u||p||E==="shift"),rt=E==="none"?null:bo({...xe,padding:{top:C.top+ee,right:C.right+ee,bottom:C.bottom+ee,left:C.left+ee},mainAxis:!p&&E==="flip",crossAxis:k==="flip"?"alignment":!1,fallbackAxisSideDirection:D}),ct=it?null:wo(T=>{const _=Ce(T.elements.floating).documentElement;return{...xe,rootBoundary:p?{x:0,y:0,width:_.clientWidth,height:_.clientHeight}:void 0,mainAxis:k!=="none",crossAxis:st,limiter:u||p?void 0:yo(j=>{if(!re.current)return{};const{width:N,height:U}=re.current.getBoundingClientRect(),Y=X(V(j.placement)),oe=Y==="y"?N:U,fe=Y==="y"?C.left+C.right:C.top+C.bottom;return{offset:oe/2+fe/2}})}},[xe,u,p,C,k]);E==="shift"||k==="shift"||s==="center"?ce.push(ct,rt):ce.push(rt,ct),ce.push(Ro({...xe,apply({elements:{floating:T},availableWidth:_,availableHeight:j,rects:N}){if(!H.current)return;const U=T.style;U.setProperty("--available-width",`${_}px`),U.setProperty("--available-height",`${j}px`);const Y=K(T).devicePixelRatio||1,{x:oe,y:fe,width:be,height:He}=N.reference,Ie=(Math.round((oe+be)*Y)-Math.round(oe*Y))/Y,Be=(Math.round((fe+He)*Y)-Math.round(fe*Y))/Y;U.setProperty("--anchor-width",`${Ie}px`),U.setProperty("--anchor-height",`${Be}px`)}}),Po(T=>({element:re.current||Ce(T.elements.floating).createElement("div"),padding:a,offsetParent:"floating"}),[a]),{name:"transformOrigin",fn(T){const{elements:_,middlewareData:j,placement:N,rects:U,y:Y}=T,oe=V(N),fe=X(oe),be=re.current,He=j.arrow?.x||0,Ie=j.arrow?.y||0,Be=be?.clientWidth||0,Jt=be?.clientHeight||0,Ve=He+Be/2,Rt=Ie+Jt/2,Zt=Math.abs(j.shift?.y||0),Qt=U.reference.height/2,he=typeof i=="function"?i(Ft(T,n,L)):i,en=Zt>he,tn={top:`${Ve}px calc(100% + ${he}px)`,bottom:`${Ve}px ${-he}px`,left:`calc(100% + ${he}px) ${Rt}px`,right:`${-he}px ${Rt}px`}[oe],nn=`${Ve}px ${U.reference.y+Qt-Y}px`;return _.floating.style.setProperty("--transform-origin",st&&fe==="y"&&en?nn:tn),{}}},Mo,x),G(()=>{!m&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[m,h]);const We=R.useMemo(()=>({elementResize:!f&&typeof ResizeObserver<"u",layoutShift:!f&&typeof IntersectionObserver<"u"}),[f]),{refs:le,elements:ge,x:lt,y:at,middlewareData:ae,update:we,placement:ft,context:ut,isPositioned:ne,floatingStyles:dt}=Oo({rootContext:h,open:d?m:void 0,placement:I,middleware:ce,strategy:o,whileElementsMounted:d?void 0:(...T)=>kt(...T,We),nodeId:w,externalTree:v}),{sideX:gt,sideY:mt}=ae.adaptiveOrigin||Oe,$e=ne?o:"fixed",ht=R.useMemo(()=>{const T=x?{position:$e,[gt]:lt,[mt]:at}:{position:$e,...dt};return ne||(T.opacity=0),T},[x,$e,gt,lt,mt,at,dt,ne]),ye=R.useRef(null);G(()=>{if(!m)return;const T=W.current,_=typeof T=="function"?T():T,N=(Wt(_)?_.current:_)||null||null;N!==ye.current&&(le.setPositionReference(N),ye.current=N)},[m,le,M,W]),R.useEffect(()=>{if(!m)return;const T=W.current;typeof T!="function"&&Wt(T)&&T.current!==ye.current&&(le.setPositionReference(T.current),ye.current=T.current)},[m,le,M,W]),R.useEffect(()=>{if(d&&m&&ge.reference&&ge.floating)return kt(ge.reference,ge.floating,we,We)},[d,m,ge,we,We]);const me=V(ft),pt=Ut(n,me,L),xt=te(ft)||"center",wt=!!ae.hide?.referenceHidden;G(()=>{y&&m&&ne&&P(me)},[y,m,ne,me]);const yt=R.useMemo(()=>({position:"absolute",top:ae.arrow?.y,left:ae.arrow?.x}),[ae.arrow]),bt=ae.arrow?.centerOffset!==0;return R.useMemo(()=>({positionerStyles:ht,arrowStyles:yt,arrowRef:re,arrowUncentered:bt,side:pt,align:xt,physicalSide:me,anchorHidden:wt,refs:le,context:ut,isPositioned:ne,update:we}),[ht,yt,re,bt,pt,xt,me,wt,le,ut,ne,we])}function Wt(e){return e!=null&&"current"in e}function Do(e){return e==="starting"?pn:$t}function No(e,t,{styles:o,transitionStatus:n,props:i,refs:s,hidden:r,inert:c=!1}){const l={...o};return c&&(l.pointerEvents="none"),xn("div",e,{state:t,ref:s,props:[{role:"presentation",hidden:r,style:l},Do(n),i],stateAttributesMapping:An})}function ko(e){const t=R.useRef(""),o=R.useCallback(i=>{i.defaultPrevented||(t.current=i.pointerType,e(i,i.pointerType))},[e]);return{onClick:R.useCallback(i=>{if(i.detail===0){e(i,"keyboard");return}"pointerType"in i?e(i,i.pointerType):e(i,t.current),t.current=""},[e]),onPointerDown:o}}function Lo(e,t){const o=R.useRef(e),n=Ke(t);G(()=>{o.current!==e&&n(o.current)},[e,n]),G(()=>{o.current=e},[e])}function Fo(e,t){const o=Ke((s,r)=>{(typeof e=="function"?e():e)||t(r||(wn?"touch":""))}),{onClick:n,onPointerDown:i}=ko(o);return R.useMemo(()=>({onClick:n,onPointerDown:i}),[n,i])}function Xo(e){const[t,o]=R.useState(null),n=Fo(e,o);return Lo(e,i=>{i&&!e&&o(null)}),R.useMemo(()=>({openMethod:t,triggerProps:n}),[t,n])}const Wo=20;function Yo(e,t,o,n){const[i,s]=R.useState(!1);G(()=>{if(!e||!t||o==null){s(!1);return}const r=Ce(o).documentElement.clientWidth,c=o.offsetWidth;s(r>0&&c>0&&c>=r-Wo)},[e,t,o]),On(e&&(!t||i),n)}const $o=R.createContext(void 0);function jo(e){return R.useContext($o)}export{Bo as C,Vo as a,Fo as b,zo as c,Yo as d,No as e,_o as f,jo as g,Do as h,Xo as i,Ao as j,Co as k,io as p,Te as r,Lo as u};
|