tokentracker-cli 1.1.13 → 1.2.1
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-DHCKPAgO.js → AchievementBadge-DPlXNqoK.js} +1 -1
- package/dashboard/dist/assets/{AchievementsPage-BqlGMD7S.js → AchievementsPage-B49wjdK_.js} +2 -2
- package/dashboard/dist/assets/{AchievementsSection-CTTTR9CN.js → AchievementsSection-DoYMz2Rr.js} +1 -1
- package/dashboard/dist/assets/{BadgeDetailModal-e0Iz8ct4.js → BadgeDetailModal-DUCS6K1n.js} +1 -1
- package/dashboard/dist/assets/{BotAnimated-BLYZyT1O.js → BotAnimated-C21PdYSf.js} +1 -1
- package/dashboard/dist/assets/{Card-EHkn9ktD.js → Card-BU2CqxfU.js} +1 -1
- package/dashboard/dist/assets/{CommandPalette-CuSVstX9.js → CommandPalette-O3pOLyJo.js} +1 -1
- package/dashboard/dist/assets/CommunityStatsModal-Bt82neQ7.js +1 -0
- package/dashboard/dist/assets/{ConfirmModal-pIUQJ7QM.js → ConfirmModal-zUljpLNe.js} +1 -1
- package/dashboard/dist/assets/{Controls-CX4Di57j.js → Controls-D56v-YJw.js} +1 -1
- package/dashboard/dist/assets/DashboardPage-CKEuFzuc.js +1 -0
- package/dashboard/dist/assets/DevicePage-CCIyAYH3.js +1 -0
- package/dashboard/dist/assets/{DialogClose-Dn-nxOSp.js → DialogClose-C-QK97qp.js} +1 -1
- package/dashboard/dist/assets/DialogDescription-COXweCuc.js +1 -0
- package/dashboard/dist/assets/{DialogTitle-DuAY9sfZ.js → DialogTitle-6q0jyME6.js} +1 -1
- package/dashboard/dist/assets/{FadeIn-25jNO9JV.js → FadeIn-BUm1z22V.js} +1 -1
- package/dashboard/dist/assets/{HeaderGithubStar-0-ne32-S.js → HeaderGithubStar-CxdmloMy.js} +1 -1
- package/dashboard/dist/assets/{HoverTooltip-C2Qop8B3.js → HoverTooltip-CrMdGYZj.js} +1 -1
- package/dashboard/dist/assets/{IpCheckPage-Q9lwiFdt.js → IpCheckPage-w6UUK_1K.js} +1 -1
- package/dashboard/dist/assets/LandingPage-DLDE7wdR.js +2 -0
- package/dashboard/dist/assets/{LeaderboardAvatar-CiQrgneF.js → LeaderboardAvatar-BqD4dEvQ.js} +1 -1
- package/dashboard/dist/assets/LeaderboardPage-kgHSryiT.js +2 -0
- package/dashboard/dist/assets/{LeaderboardProfileModal-CF-MI8rL.js → LeaderboardProfileModal-zLdeOiA3.js} +4 -4
- package/dashboard/dist/assets/{LeaderboardProfilePage-DRbLb-fO.js → LeaderboardProfilePage-Fljho5RP.js} +2 -2
- package/dashboard/dist/assets/{LimitsPage-lvYidBkz.js → LimitsPage-Do_uJqdQ.js} +2 -2
- package/dashboard/dist/assets/{LocalOnlyNotice-CAQTnlaI.js → LocalOnlyNotice-RIj2XT_X.js} +1 -1
- package/dashboard/dist/assets/{LoginCard-Ci2Rrsfl.js → LoginCard-Dx6MmGjU.js} +1 -1
- package/dashboard/dist/assets/{LoginModal-DhyQPl-V.js → LoginModal-BWaZVRnT.js} +1 -1
- package/dashboard/dist/assets/{LoginPage-B6q8P6hE.js → LoginPage-BNkU-riS.js} +1 -1
- package/dashboard/dist/assets/{PetPage-82Cldgg6.js → PetPage-CyEgU2Vm.js} +1 -1
- package/dashboard/dist/assets/PopoverPopup-CmUIY8lF.js +1 -0
- package/dashboard/dist/assets/{ProviderIcon-aLwclDsD.js → ProviderIcon-BSI-1Cy8.js} +1 -1
- package/dashboard/dist/assets/{ResetPasswordPage-BlRl_aJr.js → ResetPasswordPage-CUXKkLb4.js} +1 -1
- package/dashboard/dist/assets/Select-B6CM0ico.js +1 -0
- package/dashboard/dist/assets/SelectItemText-CZ7puxuB.js +1 -0
- package/dashboard/dist/assets/{ServiceStatusPage-Pd6dgJua.js → ServiceStatusPage-B4lIs2fc.js} +1 -1
- package/dashboard/dist/assets/SessionsPage-BngTWN7Q.css +1 -0
- package/dashboard/dist/assets/SessionsPage-D99UfBgy.js +3 -0
- package/dashboard/dist/assets/SettingsPage-DT3rld91.js +2 -0
- package/dashboard/dist/assets/SkillsPage-Dv47kVCB.js +1 -0
- package/dashboard/dist/assets/{TokenGalaxy-BN71jQQ8.js → TokenGalaxy-Bk3kGSGi.js} +2 -2
- package/dashboard/dist/assets/TrendMonitor-mB1x3c_o.js +19 -0
- package/dashboard/dist/assets/WidgetsPage-BhUArowe.js +1 -0
- package/dashboard/dist/assets/{WrappedPage-Cq8DrzLm.js → WrappedPage-DHRmP4Ey.js} +1 -1
- package/dashboard/dist/assets/__vite-browser-external-BW1rxvYq.js +45 -0
- package/dashboard/dist/assets/__vite-browser-external-gKkiQad5.css +1 -0
- package/dashboard/dist/assets/{agent-logos-X7FQq7rz.js → agent-logos-D7f7AMF-.js} +1 -1
- package/dashboard/dist/assets/{arrow-up-right-CPxuidzy.js → arrow-up-right-c39fdiDQ.js} +1 -1
- package/dashboard/dist/assets/{check-D2K19ObI.js → check-8LQ7IvkH.js} +1 -1
- package/dashboard/dist/assets/{composite-BN1UKLj0.js → composite-BgLSXWKA.js} +1 -1
- package/dashboard/dist/assets/{download-CpW-TB2h.js → download-x3Gmv-wu.js} +1 -1
- package/dashboard/dist/assets/{external-link-ChBchK6G.js → external-link-daw-XTjZ.js} +1 -1
- package/dashboard/dist/assets/{flame-f7119ZMd.js → flame-B9o0_EF8.js} +1 -1
- package/dashboard/dist/assets/{format-tokens-COrRnk53.js → format-tokens-o9atQGtV.js} +1 -1
- package/dashboard/dist/assets/host-mode-GPY2DxE4.js +1 -0
- package/dashboard/dist/assets/{icons-Dn9vA9Qu.js → icons-CmM2z-Jt.js} +1 -1
- package/dashboard/dist/assets/{index-BCNOKYSO.js → index-Bfgblk6o.js} +1 -1
- package/dashboard/dist/assets/{index-CA-94DFW.js → index-CPcJP0uH.js} +1 -1
- package/dashboard/dist/assets/{index-CElyhNzh.js → index-CtQOew7C.js} +1 -1
- package/dashboard/dist/assets/{info-BHsPBczD.js → info-BaK8Hoi2.js} +1 -1
- package/dashboard/dist/assets/{link-2-BHfEWv22.js → link-2-CV3uvMH3.js} +1 -1
- package/dashboard/dist/assets/{loader-circle-DTIT1Uk1.js → loader-circle-DYpa-xTZ.js} +1 -1
- package/dashboard/dist/assets/{modifiers.esm-CPBla3OK.js → modifiers.esm-Ds4Uh7JO.js} +1 -1
- package/dashboard/dist/assets/{monitor-smartphone-CbsYB-S2.js → monitor-smartphone-BbeYHvY-.js} +1 -1
- package/dashboard/dist/assets/{plus-CZiNoMsy.js → plus-C9qGVLFv.js} +1 -1
- package/dashboard/dist/assets/provider-display-BWYNyitK.js +42 -0
- package/dashboard/dist/assets/{react-CZdcuJ28.js → react-CO1HovF5.js} +1 -1
- package/dashboard/dist/assets/{search-q2ARMGca.js → search-DBnhkzG_.js} +1 -1
- package/dashboard/dist/assets/{skills-api-CIyqyk-w.js → skills-api-BSkbxC8-.js} +1 -1
- package/dashboard/dist/assets/{sortable.esm-BztIEZTk.js → sortable.esm-SVl6OixH.js} +1 -1
- package/dashboard/dist/assets/{store-DvdXwk-7.js → store-DrEEdO_u.js} +1 -1
- package/dashboard/dist/assets/terminal-kUMdPZhq.js +1 -0
- package/dashboard/dist/assets/{trash-D0ptaWPk.js → trash-Dd_vbrYo.js} +1 -1
- package/dashboard/dist/assets/{use-community-stats-DYibzhAl.js → use-community-stats-Bmlmv4H-.js} +1 -1
- package/dashboard/dist/assets/{use-latest-request-guard-viIhH7H5.js → use-latest-request-guard-CqZwzrCW.js} +1 -1
- package/dashboard/dist/assets/{use-limits-display-prefs-CbXApWU1.js → use-limits-display-prefs-CDC0MZRY.js} +1 -1
- package/dashboard/dist/assets/{use-ordered-list-BBP8hr8y.js → use-ordered-list-DvBI7mUU.js} +1 -1
- package/dashboard/dist/assets/{use-pet-settings-CIrPZ9pB.js → use-pet-settings-C_FrqySO.js} +2 -2
- package/dashboard/dist/assets/use-reduced-motion-BEOENqBa.js +1 -0
- package/dashboard/dist/assets/{use-session-efficiency-pref-2Vb3tJrw.js → use-session-efficiency-pref-D8cAb4A9.js} +1 -1
- package/dashboard/dist/assets/{use-transform-CECRFELz.js → use-transform-uSKYTYaW.js} +1 -1
- package/dashboard/dist/assets/{use-usage-limits-DEnbjOVG.js → use-usage-limits-DFgOKTtv.js} +1 -1
- package/dashboard/dist/assets/{useCurrency-Dh9pUzDO.js → useCurrency-t1iy_pC3.js} +1 -1
- package/dashboard/dist/assets/useTokenFormat-0bPjtaaM.js +1 -0
- package/dashboard/dist/assets/{zap-BdeAxq64.js → zap-DFM6AsYo.js} +1 -1
- package/dashboard/dist/index.html +2 -2
- package/dashboard/dist/ip-check.html +2 -2
- package/dashboard/dist/leaderboard.html +2 -2
- package/dashboard/dist/legal.css +1 -0
- package/dashboard/dist/pricing.html +35 -0
- package/dashboard/dist/privacy.html +278 -0
- package/dashboard/dist/share.html +2 -2
- package/dashboard/dist/terms.html +41 -0
- package/package.json +1 -1
- package/src/lib/codex-rollout-parser.js +5 -0
- package/src/lib/local-api.js +5 -1
- package/src/lib/pricing/index.js +45 -0
- package/src/lib/pricing/seed-snapshot.json +1 -1
- package/src/lib/rollout.js +1 -0
- package/src/lib/session-analytics.js +74 -18
- package/src/lib/session-performance.js +214 -0
- package/dashboard/dist/assets/CommunityStatsModal-Cb1vefLE.js +0 -1
- package/dashboard/dist/assets/DashboardPage-D1Ox1y3E.js +0 -1
- package/dashboard/dist/assets/DevicePage-Q57gBE8A.js +0 -1
- package/dashboard/dist/assets/DialogDescription-GXslTq2z.js +0 -1
- package/dashboard/dist/assets/LandingPage-iX6E8Flr.js +0 -2
- package/dashboard/dist/assets/LeaderboardPage-BIhIA28A.js +0 -2
- package/dashboard/dist/assets/PopoverPopup-Btcu7vU0.js +0 -1
- package/dashboard/dist/assets/SegmentedControl-2O_XVL8u.js +0 -1
- package/dashboard/dist/assets/Select-D5uuRQwh.js +0 -1
- package/dashboard/dist/assets/SelectItemText-Bq_ZdWU0.js +0 -1
- package/dashboard/dist/assets/SessionsPage-DjHudcn6.js +0 -2
- package/dashboard/dist/assets/SettingsPage-DOLhZiBE.js +0 -2
- package/dashboard/dist/assets/SkillsPage-D9-ZorB5.js +0 -1
- package/dashboard/dist/assets/ToolbarRootContext-B0cqyD1i.js +0 -1
- package/dashboard/dist/assets/TrendMonitor-DWxtbzyQ.js +0 -19
- package/dashboard/dist/assets/WidgetsPage-BwmJ2Z9d.js +0 -1
- package/dashboard/dist/assets/__vite-browser-external-CPMSmJgP.js +0 -45
- package/dashboard/dist/assets/__vite-browser-external-DrXtuPP9.css +0 -1
- package/dashboard/dist/assets/copy-CSN17qFv.js +0 -1
- package/dashboard/dist/assets/host-mode-Bc_iTzHk.js +0 -1
- package/dashboard/dist/assets/maximize-2-BmtIBzLu.js +0 -1
- package/dashboard/dist/assets/provider-display-CXKRt9q1.js +0 -42
- package/dashboard/dist/assets/terminal-CFQOW2Ey.js +0 -1
- package/dashboard/dist/assets/use-reduced-motion-Dpq-cKyM.js +0 -1
- package/dashboard/dist/assets/useTokenFormat-CoGcVhPP.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as S,bf as Ye,bg as Xe,bh as Ue,bi as Ve,bj as ce,bk as Ke,bl as ne,aD as pe,bm as Z,bn as ge,bo as me,bp as te,x as J,bq as Q,aT as Ce,br as We,bs as Fe,aU as z,a6 as le,aE as de,aV as qe,bt as he,bu as ze,y as Qe,bv as $e,bw as Ee,j as X,aX as Je,aW as Ze,bx as et,by as tt,bz as nt,bA as ot,bB as st,v as rt,w as ke,bC as it,bD as Ie,aR as at,bE as ct,bF as lt,aS as ut,aM as ft,bG as dt}from"./__vite-browser-external-CPMSmJgP.js";import{p as pt,c as gt}from"./store-DvdXwk-7.js";import{o as Te,q as we,r as mt,s as Pe,v as oe,w as ht,i as Et,P as Tt,x as Pt,k as vt,l as Ct,m as St,n as bt,j as Rt,f as Ot,h as It,u as Mt,y as yt,z as xt,t as Ft,A as kt,I as wt,B as Ht,c as At,d as Lt,e as Dt,C as Bt,p as Nt}from"./composite-BN1UKLj0.js";import{a as jt,b as _t,c as Gt,d as Yt,e as Xt,f as Ut,g as Vt}from"./ToolbarRootContext-B0cqyD1i.js";function Kt(e,n){return n!=null&&!Te(n)?0:typeof e=="function"?e():e}function ve(e,n,t){const a=Kt(e,t);return typeof a=="number"?a:a?.[n]}function Me(e){return typeof e=="function"?e():e}function He(e,n){return n||e==="click"||e==="mousedown"}function Wt(e){return e?.includes("mouse")&&e!=="mousedown"}function qt(e){const n=S.useCallback(a=>e===void 0?Ye:e.subscribeStore(a),[e]),t=S.useCallback(()=>e===void 0?void 0:e.store,[e]);return Xe.useSyncExternalStore(n,t,()=>e?.serverStore)}class Se{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new ce,this.restTimeout=new ce,this.handleCloseOptions=void 0}static create(){return new Se}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}const ue=new WeakMap;function fe(e){if(!e.performedPointerEventsMutation)return;const n=e.pointerEventsScopeElement;n&&ue.get(n)===e&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),ue.delete(n)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function Ae(e,n){const{scopeElement:t,referenceElement:a,floatingElement:r}=n,s=ue.get(t);s&&s!==e&&fe(s),fe(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=t,e.pointerEventsReferenceElement=a,e.pointerEventsFloatingElement=r,ue.set(t,e),t.style.pointerEvents="none",a.style.pointerEvents="auto",r.style.pointerEvents="auto"}function Le(e){const n=e.context.dataRef.current,t=Ue(()=>n.hoverInteractionState??Se.create()).current;return n.hoverInteractionState||(n.hoverInteractionState=t),Ve(n.hoverInteractionState.disposeEffect),n.hoverInteractionState}function zt(e,n={}){const{enabled:t=!0,closeDelay:a=0,nodeId:r}=n,s="rootStore"in e?e.rootStore:e,T=s.useState("open"),g=s.useState("floatingElement"),R=s.useState("domReferenceElement"),{dataRef:c}=s.context,u=we(),f=mt(),d=Le(s),N=Ke(),B=ne(()=>He(c.current.openEvent?.type,d.interactedInside)),l=ne(()=>Wt(c.current.openEvent?.type)),L=ne(()=>{fe(d)});pe(()=>{T||(d.pointerType=void 0,d.restTimeoutPending=!1,d.interactedInside=!1,L())},[T,d,L]),S.useEffect(()=>L,[L]),pe(()=>{if(t&&T&&d.handleCloseOptions?.blockPointerEvents&&l()&&Z(R)&&g){const P=R,x=g,o=ge(g),k=u?.nodesRef.current.find(C=>C.id===f)?.context?.elements.floating;k&&(k.style.pointerEvents="");const A=d.pointerEventsScopeElement!==x?d.pointerEventsScopeElement:null,b=k!==x?k:null,m=d.handleCloseOptions?.getScope?.()??A??b??P.closest("[data-rootownerid]")??o.body;return Ae(d,{scopeElement:m,referenceElement:P,floatingElement:x}),()=>{L()}}},[t,T,R,g,d,l,u,f,L]),S.useEffect(()=>{if(!t)return;function P(){return!!(u&&f&&Pe(u.nodesRef.current,f).length>0)}function x(C){const F=ve(a,"close",d.pointerType),j=()=>{s.setOpen(!1,J(Q,C)),u?.events.emit("floating.closed",C)};F?d.openChangeTimeout.start(F,j):(d.openChangeTimeout.clear(),j())}function o(C){const F=Ce(C);if(!We(F)){d.interactedInside=!1;return}d.interactedInside=F?.closest("[aria-haspopup]")!=null}function k(){d.openChangeTimeout.clear(),N.clear(),u?.events.off("floating.closed",b),L()}function A(C){if(P()&&u){u.events.on("floating.closed",b);return}if(Fe(C.relatedTarget,s.context.triggerElements))return;const F=c.current.floatingContext?.nodeId??r,j=C.relatedTarget;if(!(u&&F&&Z(j)&&Pe(u.nodesRef.current,F,!1).some(_=>z(_.context?.elements.floating,j)))){if(d.handler){d.handler(C);return}L(),l()&&!B()&&x(C)}}function b(C){!u||!f||P()||N.start(0,()=>{u.events.off("floating.closed",b),s.setOpen(!1,J(Q,C)),u.events.emit("floating.closed",C)})}const m=g;return me(m&&te(m,"mouseenter",k),m&&te(m,"mouseleave",A),m&&te(m,"pointerdown",o,!0),()=>{u?.events.off("floating.closed",b)})},[t,g,s,c,a,r,l,B,L,d,u,f,N])}const Qt={current:null};function $t(e,n={}){const{enabled:t=!0,delay:a=0,handleClose:r=null,mouseOnly:s=!1,restMs:T=0,move:g=!0,triggerElementRef:R=Qt,externalTree:c,isActiveTrigger:u=!0,getHandleCloseContext:f,isClosing:d,shouldOpen:N,guardStaleOpen:B=!1}=n,l="rootStore"in e?e.rootStore:e,{dataRef:L,events:P}=l.context,x=we(c),o=Le(l),k=S.useRef(!1),A=oe(r),b=oe(a),m=oe(T),C=oe(t),F=oe(N),j=oe(d),W=ne(()=>He(L.current.openEvent?.type,o.interactedInside)),_=ne(()=>F.current?.()!==!1),G=ne((I,h,M)=>{const E=l.context.triggerElements;if(E.hasElement(h))return!I||!z(I,h);if(!Z(M))return!1;const q=M;return E.hasMatchingElement(U=>z(U,q))&&(!I||!z(I,q))}),O=ne(()=>{if(!o.handler)return;ge(l.select("domReferenceElement")).removeEventListener("mousemove",o.handler),o.handler=void 0}),i=ne(()=>{fe(o)});return u&&(o.handleCloseOptions=r?.__options),S.useEffect(()=>O,[O]),S.useEffect(()=>{if(!t)return;function I(h){h.open?k.current=!1:(k.current=h.reason===Q,O(),o.openChangeTimeout.clear(),o.restTimeout.clear(),o.blockMouseMove=!0,o.restTimeoutPending=!1)}return P.on("openchange",I),()=>{P.off("openchange",I)}},[t,P,o,O]),S.useEffect(()=>{if(!t)return;function I(v,V=!0){const D=ve(b.current,"close",o.pointerType);D?o.openChangeTimeout.start(D,()=>{l.setOpen(!1,J(Q,v)),x?.events.emit("floating.closed",v)}):V&&(o.openChangeTimeout.clear(),l.setOpen(!1,J(Q,v)),x?.events.emit("floating.closed",v))}const h=R.current??(u?l.select("domReferenceElement"):null);if(!Z(h))return;function M(v){if(o.openChangeTimeout.clear(),o.blockMouseMove=!1,s&&!Te(o.pointerType))return;const V=Me(m.current),D=ve(b.current,"open",o.pointerType),w=Ce(v),p=v.currentTarget??null,H=l.select("domReferenceElement");let Y=p;if(Z(w)&&!l.context.triggerElements.hasElement(w)){for(const Oe of l.context.triggerElements.elements())if(z(Oe,w)){Y=Oe;break}}Z(p)&&Z(H)&&!l.context.triggerElements.hasElement(p)&&z(p,H)&&(Y=H);const K=Y==null?!1:G(H,Y,w),$=l.select("open"),ee=j.current?.()??l.select("transitionStatus")==="ending",be=!$&&ee&&k.current,je=!K&&Z(Y)&&Z(H)&&z(H,Y)&&be,_e=V>0&&!D,Ge=K&&($||be)||je,Re=!$||K;if(Ge){_()&&l.setOpen(!0,J(Q,v,Y));return}_e||(D?o.openChangeTimeout.start(D,()=>{Re&&_()&&l.setOpen(!0,J(Q,v,Y))}):Re&&_()&&l.setOpen(!0,J(Q,v,Y)))}function E(v){if(W()){i();return}O();const V=l.select("domReferenceElement"),D=ge(V);o.restTimeout.clear(),o.restTimeoutPending=!1;const w=L.current.floatingContext??f?.();if(Fe(v.relatedTarget,l.context.triggerElements))return;if(A.current&&w){l.select("open")||o.openChangeTimeout.clear();const H=R.current;o.handler=A.current({...w,tree:x,x:v.clientX,y:v.clientY,onClose(){i(),O(),C.current&&!W()&&H===l.select("domReferenceElement")&&I(v,!0)}}),D.addEventListener("mousemove",o.handler),o.handler(v);return}(o.pointerType!=="touch"||!z(l.select("floatingElement"),v.relatedTarget))&&I(v)}function q(v){z(h,v.relatedTarget)||(o.openChangeTimeout.clear(),o.restTimeout.clear(),o.restTimeoutPending=!1)}const U=B?te(h,"mouseout",q):void 0;return g?me(te(h,"mousemove",M,{once:!0}),te(h,"mouseenter",M),te(h,"mouseleave",E),U):me(te(h,"mouseenter",M),te(h,"mouseleave",E),U)},[O,i,L,b,l,t,A,o,u,G,W,s,g,m,R,x,C,f,j,_,B]),S.useMemo(()=>{if(!t)return;function I(h){o.pointerType=h.pointerType}return{onPointerDown:I,onPointerEnter:I,onMouseMove(h){const{nativeEvent:M}=h,E=h.currentTarget,q=l.select("domReferenceElement"),U=l.select("open"),v=G(q,E,h.target);if(s&&!Te(o.pointerType))return;if(U&&v&&o.handleCloseOptions?.blockPointerEvents){const w=l.select("floatingElement");if(w){const p=o.handleCloseOptions?.getScope?.()??E.ownerDocument.body;Ae(o,{scopeElement:p,referenceElement:E,floatingElement:w})}}const V=Me(m.current);if(U&&!v||V===0||!v&&o.restTimeoutPending&&h.movementX**2+h.movementY**2<2)return;o.restTimeout.clear();function D(){if(o.restTimeoutPending=!1,W())return;const w=l.select("open");!o.blockMouseMove&&(!w||v)&&_()&&l.setOpen(!0,J(Q,M,E))}o.pointerType==="touch"?le.flushSync(()=>{D()}):v&&U?D():(o.restTimeoutPending=!0,o.restTimeout.start(V,D))}}},[t,o,W,G,s,l,m,_])}const ye=.1,Jt=ye*ye,y=.5;function re(e,n,t,a,r,s){return a>=n!=s>=n&&e<=(r-t)*(n-a)/(s-a)+t}function ie(e,n,t,a,r,s,T,g,R,c){let u=!1;return re(e,n,t,a,r,s)&&(u=!u),re(e,n,r,s,T,g)&&(u=!u),re(e,n,T,g,R,c)&&(u=!u),re(e,n,R,c,t,a)&&(u=!u),u}function Zt(e,n,t){return e>=t.x&&e<=t.x+t.width&&n>=t.y&&n<=t.y+t.height}function ae(e,n,t,a,r,s){const T=Math.min(t,r),g=Math.max(t,r),R=Math.min(a,s),c=Math.max(a,s);return e>=T&&e<=g&&n>=R&&n<=c}function en(e={}){const{blockPointerEvents:n=!1}=e,t=new ce,a=({x:r,y:s,placement:T,elements:g,onClose:R,nodeId:c,tree:u})=>{const f=T?.split("-")[0];let d=!1,N=null,B=null,l=typeof performance<"u"?performance.now():0;function L(x,o){const k=performance.now(),A=k-l;if(N===null||B===null||A===0)return N=x,B=o,l=k,!1;const b=x-N,m=o-B,C=b*b+m*m,F=A*A*Jt;return N=x,B=o,l=k,C<F}function P(){t.clear(),R()}return function(o){t.clear();const k=g.domReference,A=g.floating;if(!k||!A||f==null||r==null||s==null)return;const{clientX:b,clientY:m}=o,C=Ce(o),F=o.type==="mouseleave",j=z(A,C),W=z(k,C);if(j&&(d=!0,!F))return;if(W&&(d=!1,!F)){d=!0;return}if(F&&Z(o.relatedTarget)&&z(A,o.relatedTarget))return;function _(){return!!(u&&Pe(u.nodesRef.current,c).length>0)}function G(){_()||P()}if(_())return;const O=k.getBoundingClientRect(),i=A.getBoundingClientRect(),I=r>i.right-i.width/2,h=s>i.bottom-i.height/2,M=i.width>O.width,E=i.height>O.height,q=(M?O:i).left,U=(M?O:i).right,v=(E?O:i).top,V=(E?O:i).bottom;if(f==="top"&&s>=O.bottom-1||f==="bottom"&&s<=O.top+1||f==="left"&&r>=O.right-1||f==="right"&&r<=O.left+1){G();return}let D=!1;switch(f){case"top":D=ae(b,m,q,O.top+1,U,i.bottom-1);break;case"bottom":D=ae(b,m,q,i.top+1,U,O.bottom-1);break;case"left":D=ae(b,m,i.right-1,V,O.left+1,v);break;case"right":D=ae(b,m,O.right-1,V,i.left+1,v);break}if(D)return;if(d&&!Zt(b,m,O)){G();return}if(!F&&L(b,m)){G();return}let w=!1;switch(f){case"top":{const p=M?y/2:y*4,H=M||I?r+p:r-p,Y=M?r-p:I?r+p:r-p,K=s+y+1,$=I||M?i.bottom-y:i.top,ee=I?M?i.bottom-y:i.top:i.bottom-y;w=ie(b,m,H,K,Y,K,i.left,$,i.right,ee);break}case"bottom":{const p=M?y/2:y*4,H=M||I?r+p:r-p,Y=M?r-p:I?r+p:r-p,K=s-y,$=I||M?i.top+y:i.bottom,ee=I?M?i.top+y:i.bottom:i.top+y;w=ie(b,m,H,K,Y,K,i.left,$,i.right,ee);break}case"left":{const p=E?y/2:y*4,H=E||h?s+p:s-p,Y=E?s-p:h?s+p:s-p,K=r+y+1,$=h||E?i.right-y:i.left,ee=h?E?i.right-y:i.left:i.right-y;w=ie(b,m,$,i.top,ee,i.bottom,K,H,K,Y);break}case"right":{const p=E?y/2:y*4,H=E||h?s+p:s-p,Y=E?s-p:h?s+p:s-p,K=r-y,$=h||E?i.left+y:i.right,ee=h?E?i.left+y:i.right:i.left+y;w=ie(b,m,K,H,K,Y,$,i.top,ee,i.bottom);break}}w?d||t.start(40,G):G()}};return a.__options={...e,blockPointerEvents:n},a}const De=S.createContext(void 0);function se(e){const n=S.useContext(De);if(n===void 0&&!e)throw new Error(de(47));return n}const tn={...pt,disabled:e=>e.disabled,instantType:e=>e.instantType,openMethod:e=>e.openMethod,openChangeReason:e=>e.openChangeReason,modal:e=>e.modal,focusManagerModal:e=>e.focusManagerModal,stickIfOpen:e=>e.stickIfOpen,titleElementId:e=>e.titleElementId,descriptionElementId:e=>e.descriptionElementId,openOnHover:e=>e.openOnHover,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin};class nn extends qe{constructor(n,t,a){const r=new Tt;super(on(n,r,t,a),sn(r),tn)}setOpen=(n,t)=>{const a=t.reason===Q,r=t.reason===he&&t.event.detail===0,s=!n&&(t.reason===ze||t.reason==null),T=ht(t),g=this.select("activeTriggerId");if(!n&&t.reason===Qe&&t.trigger==null&&g!=null&&(t.trigger=this.context.triggerElements.getById(g)??this.select("activeTriggerElement")??void 0),this.context.onOpenChange?.(n,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(n,t);const R=()=>{const u=Et(this.state,n,t.trigger,T());u.openChangeReason=t.reason,this.update(u)};a?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start($e,()=>{this.set("stickIfOpen",!1)}),le.flushSync(R)):R();let c;r?c="click":s?c="dismiss":t.reason===Ee&&(c="focus"),this.set("instantType",c)}}function on(e,n,t,a=!1){const r={...gt(n,t,a),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,openOnHover:!1,closeDelay:0,adaptiveOrigin:void 0,...e};return r.open&&e?.mounted===void 0&&(r.mounted=!0),r}function sn(e){return{popupRef:S.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:S.createRef(),beforeContentFocusGuardRef:S.createRef(),stickIfOpenTimeout:new ce,triggerElements:e}}const xe=Je(function({props:n}){const{children:t,open:a,defaultOpen:r=!1,onOpenChange:s,onOpenChangeComplete:T,modal:g=!1,handle:R,triggerId:c,defaultTriggerId:u=null}=n,f=rn(R,{modal:g,open:r,openProp:a,activeTriggerId:u,triggerIdProp:c});f.useControlledProp("openProp",a),f.useControlledProp("triggerIdProp",c);const d=f.useState("open"),N=f.useState("mounted"),B=f.useState("payload");f.useContextCallback("onOpenChange",s),f.useContextCallback("onOpenChangeComplete",T),vt(f,d),Ct(f);const{forceUnmount:l}=St(d,f,()=>{f.update({stickIfOpen:!0,openChangeReason:null})});f.useSyncedValues({modal:g}),S.useEffect(()=>{d||f.context.stickIfOpenTimeout.clear()},[f,d]),S.useImperativeHandle(n.actionsRef,()=>({unmount:l,close:()=>f.setOpen(!1,J(Ze))}),[l,f]);const L=d||N;return X.jsxs(De.Provider,{value:f,children:[R&&X.jsx(bt,{handle:R,store:f}),L&&X.jsx(an,{store:f,modal:g}),typeof t=="function"?t({payload:B}):t]})});function Tn(e){return se(!0)?X.jsx(xe,{props:e}):X.jsx(Pt,{children:X.jsx(xe,{props:e})})}function rn(e,n){const t=Rt((a,r)=>new nn(n,a,r));return S.useEffect(()=>t.context.stickIfOpenTimeout.disposeEffect(),[t]),t}function an({store:e,modal:n}){const t=e.useState("floatingRootContext"),a=Ot(t,{outsidePressEvent:{mouse:n==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),r=a.reference,s=a.floating;return It(e,{activeTriggerProps:r,inactiveTriggerProps:r,popupProps:s}),null}const cn=300;function ln(e,n){const t=S.useRef(null);function a(s){le.flushSync(()=>{e.setOpen(!1,J(Ee,s.nativeEvent,s.currentTarget))}),ot(t.current)?.focus()}function r(s){const T=e.select("positionerElement");if(T&&et(s,T))e.context.beforeContentFocusGuardRef.current?.focus();else{le.flushSync(()=>{e.setOpen(!1,J(Ee,s.nativeEvent,s.currentTarget))});let g=tt(e.context.triggerFocusTargetRef.current||n.current);for(;g!==null&&z(T,g);){const R=g;if(g=nt(g),g===R)break}g?.focus()}}return{preFocusGuardRef:t,handlePreFocusGuardFocus:a,handleFocusTargetFocus:r}}const Pn=st(function(n,t){const{render:a,className:r,style:s,disabled:T=!1,nativeButton:g=!0,handle:R,payload:c,openOnHover:u=!1,delay:f=cn,closeDelay:d=0,id:N,...B}=n,l=se(!0),P=qt(R)??l;if(!P)throw new Error(de(74));const x=Mt(N),o=P.useState("isTriggerActive",x),k=P.useState("floatingRootContext"),A=P.useState("isOpenedByTrigger",x),b=P.useState("triggerPopupId",x),m=S.useRef(null),{registerTrigger:C,isMountedByThisTrigger:F}=yt(x,m,P,{payload:c,disabled:T,openOnHover:u,closeDelay:d}),j=P.useState("openChangeReason"),W=P.useState("stickIfOpen"),_=P.useState("openMethod"),G=P.useState("focusManagerModal"),O=$t(k,{enabled:!T&&u&&(_!=="touch"||j!==he),mouseOnly:!0,move:!1,handleClose:en(),restMs:f,delay:{close:d},triggerElementRef:m,isActiveTrigger:o,isClosing:()=>P.select("transitionStatus")==="ending"}),i=jt(k,{stickIfOpen:W}),I=_t(()=>P.select("open"),H=>{P.set("openMethod",H)}),h=P.useState("triggerProps",F),{getButtonProps:M,buttonRef:E}=rt({disabled:T,native:g}),q={open(H){return H&&j===he?xt.open(H):Ft.open(H)}},{preFocusGuardRef:U,handlePreFocusGuardFocus:v,handleFocusTargetFocus:V}=ln(P,m),w=ke("button",n,{state:{disabled:T,open:A},ref:[E,t,C,m],props:[i.reference,O,h,I,{[it]:"",id:x,"aria-haspopup":"dialog","aria-expanded":A,"aria-controls":b},B,M],stateAttributesMapping:q}),p=X.jsx(S.Fragment,{children:w},x);return F&&!G?X.jsxs(S.Fragment,{children:[X.jsx(Ie,{ref:U,onFocus:v}),p,X.jsx(Ie,{ref:P.context.triggerFocusTargetRef,onFocus:V})]}):p}),Be=S.createContext(void 0);function un(){const e=S.useContext(Be);if(e===void 0)throw new Error(de(45));return e}const vn=S.forwardRef(function(n,t){const{keepMounted:a=!1,...r}=n;return se().useState("mounted")||a?X.jsx(Be.Provider,{value:a,children:X.jsx(at,{ref:t,...r})}):null}),Ne=S.createContext(void 0);function fn(){const e=S.useContext(Ne);if(!e)throw new Error(de(46));return e}const Cn=S.forwardRef(function(n,t){const{render:a,className:r,style:s,anchor:T,positionMethod:g,side:R,align:c,sideOffset:u,alignOffset:f,collisionBoundary:d="clipping-ancestors",collisionPadding:N,arrowPadding:B,sticky:l,disableAnchorTracking:L=!1,collisionAvoidance:P=ct,...x}=n,o=se(),k=un(),A=kt(),b=o.useState("floatingRootContext"),m=o.useState("mounted"),C=o.useState("open"),F=o.useState("openChangeReason"),j=o.useState("activeTriggerElement"),W=o.useState("modal"),_=o.useState("openMethod"),G=o.useState("positionerElement"),O=o.useState("instantType"),i=o.useState("transitionStatus"),I=o.useState("adaptiveOrigin"),h=S.useRef(null),M=lt(G),E=Gt({anchor:T,floatingRootContext:b,positionMethod:g,mounted:m,side:R,sideOffset:u,align:c,alignOffset:f,arrowPadding:B,collisionBoundary:d,collisionPadding:N,sticky:l,disableAnchorTracking:L,keepMounted:k,nodeId:A,collisionAvoidance:P,adaptiveOrigin:I}),q=b.useState("domReferenceElement");pe(()=>{const w=q,p=h.current;if(w&&(h.current=w),p&&w&&w!==p){o.set("instantType",void 0);const H=new AbortController;return M(()=>{o.set("instantType","trigger-change")},H.signal),()=>{H.abort()}}},[q,M,o]);const U=W===!0&&F!==Q;Yt(C&&U,_==="touch",G,j);const v=o.useStateSetter("positionerElement"),V={open:C,side:E.side,align:E.align,anchorHidden:E.anchorHidden,instant:O},D=Xt(n,V,{styles:E.positionerStyles,transitionStatus:i,props:x,refs:[t,v],hidden:!m,inert:!C});return X.jsxs(Ne.Provider,{value:E,children:[m&&U&&X.jsx(wt,{inert:ut(!C),cutout:j}),X.jsx(Ht,{id:A,children:D})]})}),dn=S.createContext(void 0);function pn(){const[e,n]=S.useState(0),t=ne(()=>(n(r=>r+1),()=>{n(r=>Math.max(0,r-1))}));return{context:S.useMemo(()=>({register:t}),[t]),hasClosePart:e>0}}const Sn=S.forwardRef(function(n,t){const{render:a,className:r,style:s,initialFocus:T,finalFocus:g,...R}=n,c=se(),u=fn(),f=Ut()!=null,{context:d,hasClosePart:N}=pn(),B=c.useState("open"),l=c.useState("openMethod"),L=c.useState("instantType"),P=c.useState("transitionStatus"),x=c.useState("popupProps"),o=c.useState("titleElementId"),k=c.useState("descriptionElementId"),A=c.useState("modal"),b=c.useState("mounted"),m=c.useState("openChangeReason"),C=c.useState("activeTriggerElement"),F=c.useState("floatingRootContext"),j=F.useState("floatingId"),W=c.useState("disabled"),_=c.useState("openOnHover"),G=c.useState("closeDelay");ft({open:B,ref:c.context.popupRef,onComplete(){B&&c.context.onOpenChangeComplete?.(!0)}}),zt(F,{enabled:_&&!W,closeDelay:G});const O=T===void 0?At(c.context.popupRef):T,i=A!==!1&&N;c.useSyncedValue("focusManagerModal",i);const I=c.useStateSetter("popupElement"),h={open:B,side:u.side,align:u.align,instant:L,transitionStatus:P},M=ke("div",n,{state:h,ref:[t,c.context.popupRef,I],props:[x,{id:j,role:"dialog",...Dt,"aria-labelledby":o,"aria-describedby":k,onKeyDown(E){f&&Bt.has(E.key)&&E.stopPropagation()}},Vt(P),R],stateAttributesMapping:Nt});return X.jsx(Lt,{context:F,openInteractionType:l,modal:i,disabled:!b||m===Q,initialFocus:O,returnFocus:g,restoreFocus:"popup",previousFocusableElement:dt(C)?C:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:X.jsx(dn.Provider,{value:d,children:M})})});export{Tn as P,Pn as a,vn as b,Cn as c,Sn as d};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as o,j as u,e as x}from"./__vite-browser-external-CPMSmJgP.js";function R({options:d,value:l,onChange:h,leading:g=null,disabled:b=!1,ariaLabel:m,className:y=""}){const f=o.useRef(null),n=o.useRef(new Map),[a,w]=o.useState(null),k=(t,i)=>{const e=d.filter(c=>!b&&!c.disabled),s=e.findIndex(c=>c.id===i);if(s<0)return;let r=null;t.key==="ArrowRight"||t.key==="ArrowDown"?r=e[(s+1)%e.length]:t.key==="ArrowLeft"||t.key==="ArrowUp"?r=e[(s-1+e.length)%e.length]:t.key==="Home"?r=e[0]:t.key==="End"&&(r=e[e.length-1]),!(!r||r.id===i)&&(t.preventDefault(),h(r.id),n.current.get(r.id)?.focus())};return o.useLayoutEffect(()=>{const t=()=>{const e=n.current.get(l);if(!e||e.offsetWidth===0)return;const s={left:e.offsetLeft,top:e.offsetTop,width:e.offsetWidth,height:e.offsetHeight};w(r=>r&&r.left===s.left&&r.top===s.top&&r.width===s.width&&r.height===s.height?r:s)};if(t(),typeof ResizeObserver>"u"||!f.current)return;const i=new ResizeObserver(t);i.observe(f.current);for(const e of n.current.values())i.observe(e);return()=>i.disconnect()},[l,d]),u.jsxs("div",{ref:f,role:"tablist","aria-label":m,className:x("relative inline-flex h-8 items-center gap-1 rounded-md border border-oai-gray-200 bg-oai-gray-100 p-[3px] dark:border-oai-gray-700 dark:bg-oai-gray-800",y),children:[g,a?u.jsx("span",{"aria-hidden":!0,className:"pointer-events-none absolute left-0 top-0 rounded-sm bg-white shadow-sm transition-[transform,width] duration-200 ease-out motion-reduce:transition-none dark:bg-oai-gray-700",style:{transform:`translate(${a.left}px, ${a.top}px)`,width:`${a.width}px`,height:`${a.height}px`}}):null,d.map(t=>{const i=t.id===l;return u.jsxs("button",{ref:e=>{e?n.current.set(t.id,e):n.current.delete(t.id)},type:"button",role:"tab","aria-selected":i,tabIndex:i?0:-1,disabled:b||t.disabled,onClick:()=>h(t.id),onKeyDown:e=>k(e,t.id),className:x("relative z-10 inline-flex h-6 items-center gap-1.5 rounded px-2.5 text-xs font-medium transition-colors disabled:opacity-50",i?"text-oai-black dark:text-white":"text-oai-gray-500 hover:text-oai-black dark:text-oai-gray-400 dark:hover:text-white"),children:[t.icon,t.label]},t.id)})]})}export{R as S};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as p,w as S,j as e,e as h}from"./__vite-browser-external-CPMSmJgP.js";import{C as v}from"./ToolbarRootContext-B0cqyD1i.js";import{C as w}from"./check-D2K19ObI.js";import{u as k,a as j,b as N,L as C,s as R,S as E,c as I,d as T,e as L,f as P,g as A,h as O,i as _,j as D}from"./SelectItemText-Bq_ZdWU0.js";const G=p.forwardRef(function(t,s){const{render:i,className:x,style:o,...l}=t,r=k(),{multiple:n,readOnly:c}=j(),{alignItemWithTriggerActive:d}=N(),g=r.useState("hasScrollArrows"),a=r.useState("openMethod"),u={id:`${r.useState("id")}-list`,role:"listbox","aria-multiselectable":n||void 0,"aria-readonly":c||void 0,onScroll(f){r.context.scrollHandlerRef.current?.(f.currentTarget)},...d&&{style:C},className:g&&a!=="touch"?R.className:void 0},y=r.useStateSetter("listElement");return S("div",t,{ref:[s,y],props:[u,l]})}),M="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 H({value:m,onValueChange:t,options:s=[],ariaLabel:i,id:x,disabled:o=!1,leadingIcon:l=null,className:r="",popupClassName:n="",align:c="start",matchTriggerWidth:d=!1}){const g=s.map(a=>({value:a.value,label:a.label}));return e.jsxs(E,{value:m,items:g,disabled:o,onValueChange:a=>{!o&&a!=null&&t?.(a)},children:[e.jsxs(I,{id:x,"aria-label":i,className:h(M,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:[l,e.jsx(T,{className:"truncate"})]}),e.jsx(v,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})]}),e.jsx(L,{children:e.jsx(P,{align:c,side:"bottom",sideOffset:4,className:"z-50",children:e.jsx(A,{className:h("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",d&&"min-w-[var(--anchor-width)]",n),children:e.jsx(G,{role:"listbox","aria-label":i,children:s.map(a=>e.jsxs(O,{value:a.value,disabled:a.disabled,className:({selected:b,disabled:u})=>h("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",b?"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",u&&"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(_,{children:e.jsx(w,{className:"h-3 w-3","aria-hidden":!0})})}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:e.jsx(D,{children:a.label})})]},String(a.value)))})})})})]})}export{H as S};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c0 as yn,bh as He,aD as q,bm as In,c3 as qt,c1 as Cn,r as o,bl as Y,bH as St,co as Lt,cp as gt,cq as Dt,c6 as mt,bn as Ye,aU as ve,x as he,cr as Ht,bG as Nt,cs as Ge,aT as En,bw as Kt,c8 as Yt,ct as lt,cu as ct,cv as $t,cw as Ct,bk as tt,cd as vn,cx as wn,cy as Rt,aE as Ne,bf as te,E as nt,j as ae,aM as Et,aG as bt,aF as Tn,aJ as Mn,aK as Pn,aL as st,aV as An,c7 as On,aI as rt,b_ as Vn,v as Gt,w as ke,cz as Fn,aR as Ln,cA as Dn,aS as Hn,bp as Nn,cB as kn,aN as Xt,cC as ht}from"./__vite-browser-external-CPMSmJgP.js";import{r as Jt,F as Un,P as Bn,v as Ae,q as _n,E as jn,G as Ie,H as Qt,D as Wn,u as zn,a as Zt,f as qn,e as Kn,z as Yn,I as $n,d as Gn,b as Xn,C as Jn}from"./composite-BN1UKLj0.js";import{h as Qn,u as Zn,a as er,d as tr,c as nr,e as rr,f as or,i as sr,p as ir,r as lr,g as cr}from"./ToolbarRootContext-B0cqyD1i.js";function qe(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}function ur(e){const{open:t=!1,onOpenChange:n,elements:r={}}=e,s=yn(),i=Jt()!=null,c=He(()=>new Un({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new Bn,floatingId:s,syncOnly:!1,nested:i})).current;return q(()=>{const f={open:t,floatingId:s};r.reference!==void 0&&(f.referenceElement=r.reference,f.domReferenceElement=In(r.reference)?r.reference:null),r.floating!==void 0&&(f.floatingElement=r.floating),c.update(f)},[t,s,r.reference,r.floating,c]),c.context.onOpenChange=n,c.context.nested=i,c}const ar="Escape";function kt(e){return Yt&&e.movementX===0&&e.movementY===0}function ut(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Xe(e,t){return ut(t,e===$t||e===Ct,e===lt||e===ct)}function xt(e,t,n){return ut(t,e===Ct,n?e===lt:e===ct)||e==="Enter"||e===" "||e===""}function fr(e,t,n){return ut(t,n?e===lt:e===ct,e===Ct)}function dr(e,t,n,r){const s=n?e===ct:e===lt,i=e===$t;return t==="both"||t==="horizontal"&&r?e===ar:ut(t,s,i)}function pr(e,t){const{listRef:n,activeIndex:r,onNavigate:s=()=>{},enabled:i=!0,selectedIndex:c=null,allowEscape:f=!1,loopFocus:l=!1,nested:C=!1,rtl:R=!1,virtual:x=!1,focusItemOnOpen:T="auto",focusItemOnHover:d=!0,openOnArrowKeyDown:V=!0,disabledIndices:A=void 0,orientation:E="vertical",parentOrientation:y,id:$,resetOnPointerLeave:F=!0,externalTree:g,grid:m}=t,O=m!=null,p="rootStore"in e?e.rootStore:e,S=p.useState("open"),k=p.useState("floatingElement"),D=p.useState("domReferenceElement"),G=p.context.dataRef,K=qt(k),h=Cn(D),L=Ae(K),z=Jt(),J=_n(g),W=o.useRef(T),v=o.useRef(c??-1),U=o.useRef(null),a=o.useRef(!0),I=Y(u=>{s(v.current===-1?null:v.current,u)}),M=o.useRef(!!k),P=o.useRef(S),H=o.useRef(!1),X=o.useRef(!1),ne=o.useRef(null),re=Ae(A),se=Ae(S),le=Ae(c),oe=Ae(F),fe=St(),B=St(),j=Y(()=>{function u(N){x?J?.events.emit("virtualfocus",N):ne.current=jn(N,{sync:H.current,preventScroll:!0})}const b=n.current[v.current],Z=X.current;b&&u(b),(H.current?N=>N():N=>fe.request(N))(()=>{const N=n.current[v.current]||b;if(!N)return;b||u(N),ue&&(Z||!a.current)&&N.scrollIntoView?.({block:"nearest",inline:"nearest"})})});q(()=>{G.current.orientation=E},[G,E]),q(()=>{i&&(S&&k?(v.current=c??-1,W.current&&c!=null&&(X.current=!0,I())):M.current&&(v.current=-1,I()))},[i,S,k,c,I]),q(()=>{if(i){if(!S){H.current=!1;return}if(k)if(r==null){if(H.current=!1,le.current!=null)return;if(M.current&&(v.current=-1,j()),(!P.current||!M.current)&&W.current&&(U.current!=null||W.current===!0&&U.current==null)){let u=0;const b=()=>{n.current[0]==null?(u<2&&(u?w=>B.request(w):queueMicrotask)(b),u+=1):(v.current=U.current==null||xt(U.current,E,R)||C?gt(n):Dt(n),U.current=null,I())};b()}}else Lt(n.current,r)||(v.current=r,j(),X.current=!1)}},[i,S,k,r,le,C,n,E,R,I,j,B]),q(()=>{if(!i||k||!J||x||!M.current)return;const u=J.nodesRef.current,b=u.find(N=>N.id===z)?.context?.elements.floating,Z=mt(Ye(D??b??null)),w=u.some(N=>N.context&&ve(N.context.elements.floating,Z));b&&!w&&a.current&&b.focus({preventScroll:!0})},[i,k,D,J,z,x]),q(()=>{P.current=S,M.current=!!k}),q(()=>{S||(U.current=null,W.current=T)},[S,T]);const ce=r!=null,Q=Y(u=>{if(!se.current)return;const b=n.current.indexOf(u.currentTarget);b!==-1&&(v.current!==b||r!==b)&&(v.current=b,I(u))}),pe=Y(()=>y??J?.nodesRef.current.find(u=>u.id===z)?.context?.dataRef?.current.orientation),xe=Y(()=>gt(n,re.current)),de=Y(u=>{if(a.current=!1,H.current=!0,u.which===229||!se.current&&u.currentTarget===L.current)return;if(C&&dr(u.key,E,R,O)){Xe(u.key,pe())||Ie(u),p.setOpen(!1,he(Ht,u.nativeEvent)),Nt(D)&&(x?J?.events.emit("virtualfocus",D):D.focus());return}const b=v.current,Z=gt(n,A),w=Dt(n,A);if(h||(u.key==="Home"&&(Ie(u),v.current=Z,I(u)),u.key==="End"&&(Ie(u),v.current=w,I(u))),m!=null){const N=m(u,v.current,n,E,l,R,A,Z,w);if(N!=null&&(v.current=N,I(u)),E==="both")return}if(Xe(u.key,E)){if(Ie(u),S&&!x&&mt(u.currentTarget.ownerDocument)===u.currentTarget){v.current=xt(u.key,E,R)?Z:w,I(u);return}xt(u.key,E,R)?l?b>=w?f&&b!==n.current.length?v.current=-1:(H.current=!1,v.current=Z):v.current=Ge(n.current,{startingIndex:b,disabledIndices:A}):v.current=Math.min(w,Ge(n.current,{startingIndex:b,disabledIndices:A})):l?b<=Z?f&&b!==-1?v.current=n.current.length:(H.current=!1,v.current=w):v.current=Ge(n.current,{startingIndex:b,decrement:!0,disabledIndices:A}):v.current=Math.max(Z,Ge(n.current,{startingIndex:b,decrement:!0,disabledIndices:A})),Lt(n.current,v.current)&&(v.current=-1),I(u)}}),ue=o.useMemo(()=>({onFocus(b){H.current=!0,Q(b)},onClick:({currentTarget:b})=>b.focus({preventScroll:!0}),onMouseMove(b){kt(b)||(H.current=!0,X.current=!1,d&&Q(b))},onPointerLeave(b){if(!se.current||!a.current||b.pointerType==="touch")return;H.current=!0;const Z=b.relatedTarget;if(!(!d||n.current.includes(Z))&&oe.current&&(ne.current?.(),ne.current=null,v.current=-1,I(b),!x)){const w=L.current,N=mt(Ye(w));w&&ve(w,N)&&w.focus({preventScroll:!0})}}}),[Q,se,L,d,n,I,oe,x]),ge=o.useMemo(()=>x&&S&&ce&&{"aria-activedescendant":`${$}-${r}`},[x,S,ce,$,r]),Se=o.useMemo(()=>({...h?{}:ge,onKeyDown(u){if(u.key==="Tab"&&u.shiftKey&&S&&!x){const b=En(u.nativeEvent);if(b&&!ve(L.current,b))return;Ie(u),p.setOpen(!1,he(Kt,u.nativeEvent)),Nt(D)&&D.focus();return}de(u)},onPointerMove(u){kt(u)||(a.current=!0)}}),[ge,de,L,h,p,S,x,D]),ee=o.useMemo(()=>{function u(w){p.setOpen(!0,he(Ht,w.nativeEvent,w.currentTarget))}function b(w){T==="auto"&&Qt(w.nativeEvent)&&(W.current=!x)}function Z(w){W.current=T,T==="auto"&&Wn(w.nativeEvent)&&(W.current=!0)}return{onKeyDown(w){const N=p.select("open");a.current=!1;const Te=w.key.startsWith("Arrow"),Me=fr(w.key,pe(),R),be=Xe(w.key,E),Re=(C?Me:be)||w.key==="Enter"||w.key.trim()==="";if(x&&N)return de(w);if(!(!N&&!V&&Te)){if(Re){const Ue=Xe(w.key,pe());U.current=C&&Ue?null:w.key}if(C){Me&&(Ie(w),N?(v.current=xe(),I(w)):u(w));return}be&&(le.current!=null&&(v.current=le.current),Ie(w),!N&&V?u(w):de(w),N&&I(w))}},onFocus(w){p.select("open")&&!x&&(v.current=-1,I(w))},onPointerDown:Z,onPointerEnter:Z,onMouseDown:b,onClick:b}},[de,T,xe,C,I,p,V,E,pe,R,le,x]),we=o.useMemo(()=>({...ge,...ee}),[ge,ee]);return o.useMemo(()=>i?{reference:we,floating:Se,item:ue,trigger:ee}:{},[i,we,Se,ee,ue])}function gr(e,t){const{listRef:n,elementsRef:r,activeIndex:s,onMatch:i,disabledIndices:c,onTyping:f,enabled:l=!0,resetMs:C=750,selectedIndex:R=null}=t,x="rootStore"in e?e.rootStore:e,T=x.useState("open"),d=tt(),V=o.useRef(""),A=o.useRef(R??s??-1),E=o.useRef(null),y=Y(g=>{function m(L){return r?.current[L]}function O(L){const z=m(L);return z&&!vn(z)||z?.matches(":disabled")?!1:c==null||!wn(Rt,L,c)}function p(L,z,J=0){if(L.length===0)return-1;const W=(J%L.length+L.length)%L.length,v=z.toLowerCase();for(let U=0;U<L.length;U+=1){const a=(W+U)%L.length;if(!(!L[a]?.toLowerCase().startsWith(v)||!O(a)))return a}return-1}const S=n.current;if(V.current.length>0&&g.key===" "&&(Ie(g),f?.(!0)),V.current.length>0&&V.current[0]!==" "&&p(S,V.current)===-1&&g.key!==" "&&f?.(!1),S==null||g.key.length!==1||g.ctrlKey||g.metaKey||g.altKey)return;T&&g.key!==" "&&(Ie(g),f?.(!0));const k=V.current==="";k&&(A.current=R??s??-1),S.every((L,z)=>L&&O(z)?L[0]?.toLowerCase()!==L[1]?.toLowerCase():!0)&&V.current===g.key&&(V.current="",A.current=E.current),V.current+=g.key,d.start(C,()=>{V.current="",A.current=E.current,f?.(!1)});const K=((k?R??s??-1:A.current)??0)+1,h=p(S,V.current,K);h!==-1?(i?.(h),E.current=h):g.key!==" "&&(V.current="",f?.(!1))}),$=Y(g=>{const m=g.relatedTarget,O=x.select("domReferenceElement"),p=x.select("floatingElement");ve(O,m)||ve(p,m)||(d.clear(),V.current="",A.current=E.current,f?.(!1))});q(()=>{!T&&R!==null||(d.clear(),E.current=null,V.current!==""&&(V.current=""))},[T,R,d]);const F=o.useMemo(()=>({onKeyDown:y,onBlur:$}),[y,$]);return o.useMemo(()=>l?{reference:F,floating:F}:{},[l,F])}function mr(e){const[t,n]=o.useState({current:e,previous:null});return Object.is(e,t.current)||n({current:e,previous:t.current}),t.previous}function hr(e){const t=o.useRef(!0);t.current&&(t.current=!1,e())}function xr(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}function Ut({controlled:e,default:t,name:n,state:r="value"}){const{current:s}=o.useRef(e!==void 0),[i,c]=o.useState(t),f=s&&e!==void 0?e:i,l=o.useCallback(C=>{s||c(C)},[]);return[f,l]}const en=o.createContext(void 0),tn=o.createContext(void 0),nn=o.createContext(void 0);function Ve(){const e=o.useContext(en);if(e===void 0)throw new Error(Ne(60));return e}function vt(){const e=o.useContext(tn);if(e===void 0)throw new Error(Ne(101));return e}function rn(){const e=o.useContext(nn);if(e===void 0)throw new Error(Ne(61));return e}const Sr="data-valid",Rr="data-invalid",br={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},yr={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},Ir={disabled:!1,...yr},Cr={valid(e){return e===null?null:e?{[Sr]:""}:{[Rr]:""}}},Er={invalid:void 0,name:void 0,validityData:{state:br,errors:[],error:"",value:"",initialValue:null},setValidityData:te,disabled:void 0,setTouched:te,setDirty:te,setFilled:te,setFocused:te,validationMode:"onSubmit",shouldValidateOnChange:()=>!1,state:Ir,registerFieldControl:te,validation:{getValidationProps:(e,t=nt)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:te,getInputControl:()=>null,commit:async()=>{},change:te}},vr=o.createContext(Er);function wt(e=!0){const t=o.useContext(vr);if(t.setValidityData===te&&!e)throw new Error(Ne(28));return t}function wr(e,t,n,r,s=!0,i){const{registerFieldControl:c}=wt(),f=He(()=>Symbol());q(()=>{const l=f.current;if(!s){c(l,void 0);return}c(l,{controlRef:e,getValue:r,id:t,name:i,value:n})},[e,s,r,t,i,c,f,n]),q(()=>{const l=f.current;return()=>{c(l,void 0)}},[c,f])}const Tr=o.createContext({controlId:void 0,registerControlId:te,resetControlId:te,labelId:void 0,setLabelId:te,messageIds:[],setMessageIds:te,getDescriptionProps:e=>e});function on(){return o.useContext(Tr)}function sn(e={}){const{id:t,enabled:n=!0}=e,{controlId:r,registerControlId:s,resetControlId:i}=on(),c=zn(),f=He(()=>Symbol()),l=o.useRef(!1),C=o.useRef(!1),R=Y(()=>{!l.current||s===te||(l.current=!1,s(f.current,void 0))});return q(()=>{if(!n||s===te){R();return}let x;if(t!==void 0)C.current=!0,x=t;else if(C.current)x=c;else{i();return}if(x===void 0){R();return}l.current=!0,s(f.current,x)},[t,n,s,i,c,f,R]),q(()=>R,[R]),(n?r:void 0)??t??c}function Mr(e,t,n=Object.is){const{length:r}=e;if(r!==t.length)return!1;for(let s=0;s<r;s+=1)if(!n(e[s],t[s]))return!1;return!0}const ln=(e,t)=>Object.is(e,t);function Oe(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Pr(e,t,n){return Array.isArray(e)&&Array.isArray(t)?!Mr(e,t,(r,s)=>Oe(r,s,n)):e!==t}function yt(e,t,n){return e?e.some(r=>r===void 0?!1:Oe(t,r,n)):!1}function ot(e,t,n){return e?e.findIndex(r=>r===void 0?!1:Oe(r,t,n)):-1}function Ar(e,t){if(t!==ln)return r=>yt(e,r,t);const n=new Set(e);return n.delete(void 0),r=>n.has(r)&&(r!==0||e.some(s=>Object.is(r,s)))}function cn(e,t,n,r){const s=r&&Array.isArray(t)?e.findIndex(Ar(t,n)):ot(e,t,n);return s===-1?null:s}function Or(e,t,n,r,s,i){return yt(r,t,s)?i!=null&&e>i&&yt(r,n[i],s)?i:e:e===i?cn(n,r,s,!0):i}function Vr(e,t,n){return e.filter(r=>!Oe(t,r,n))}function It(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function Fr(e){return typeof e=="object"&&e!=null&&Array.isArray(e.items)}function un(e){return Fr(e?.[0])}function Lr(e){return un(e)?e.flatMap(t=>t.items):e}function Dr(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(un(t)){for(const n of t)for(const r of n.items)if(r&&r.value==null&&r.label!=null)return!0;return!1}for(const n of t)if(n&&n.value==null&&n.label!=null)return!0;return!1}function an(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 It(e)}function De(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?It(e.value):It(e)}function fn(e,t,n){function r(){return an(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(Object.hasOwn(t,e)?t[e]:void 0)??r();if(Array.isArray(t)){const i=Lr(t);if(e==null||typeof e!="object"){const c=i.find(f=>f.value===e);return c&&c.label!=null?c.label:r()}if("value"in e){const c=i.find(f=>f&&f.value===e.value);if(c&&c.label!=null)return c.label}}return r()}function Hr(e,t,n){return e.reduce((r,s,i)=>(i>0&&r.push(", "),r.push(ae.jsx(o.Fragment,{children:fn(s,t,n)},i)),r),[])}const Nr={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{const{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:De(t,r)!==""},hasNullItemLabel:(e,t)=>t?Dr(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{const n=e.isItemEqualToValue,r=e.value;return e.multiple?Array.isArray(r)&&r.some(s=>Oe(t,s,n)):Oe(t,r,n)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows},kr=o.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:te,validationMode:"onSubmit",submitCountRef:{current:0}});function Ur(){return o.useContext(kr)}const Ce=1;function dn(e,t){return Math.max(0,e-t)}function Br(e,t){if(t<=0)return 0;const n=qe(e,0,t),r=n,s=t-n,i=r<=Ce,c=s<=Ce;return i&&c?r<=s?0:t:i?0:c?t:n}function mo(e){const{id:t,value:n,defaultValue:r=null,onValueChange:s,open:i,defaultOpen:c=!1,onOpenChange:f,name:l,form:C,autoComplete:R,disabled:x=!1,readOnly:T=!1,required:d=!1,modal:V=!0,actionsRef:A,inputRef:E,onOpenChangeComplete:y,items:$,multiple:F=!1,itemToStringLabel:g,itemToStringValue:m,isItemEqualToValue:O=ln,highlightItemOnHover:p=!0,children:S}=e,{clearErrors:k}=Ur(),{setDirty:D,setTouched:G,setFocused:K,validityData:h,setFilled:L,name:z,disabled:J,validation:W,validationMode:v}=wt(),U=sn({id:t}),a=J||x,I=z??l,[M,P]=Ut({controlled:n,default:F?r??Rt:r,name:"Select",state:"value"}),[H,X]=Ut({controlled:i,default:c,name:"Select",state:"open"}),ne=o.useRef([]),re=o.useRef([]),se=o.useRef(null),le=o.useRef(null),oe=o.useRef(0),fe=o.useRef(null),B=o.useRef([]),j=o.useRef(!1),ce=o.useRef(null),Q=o.useRef(null),pe=o.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),xe=o.useRef(!1),de=o.useRef(M),{mounted:ue,setMounted:ge,transitionStatus:Se}=Zt(H),{openMethod:ee,triggerProps:we}=Qn(H),u=He(()=>new An({id:U,labelId:void 0,modal:V,multiple:F,itemToStringLabel:g,itemToStringValue:m,isItemEqualToValue:O,value:M,open:H,mounted:ue,transitionStatus:Se,items:$,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:nt,triggerProps:nt,triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1},{setValue:te,setOpen:te,handleScrollArrowVisibility:te,onOpenChangeComplete:te,listRef:ne,popupRef:se,scrollHandlerRef:le,scrollArrowsMountedCountRef:oe,valueRef:fe,valuesRef:B,labelsRef:re,typingRef:j,selectionRef:pe,firstItemTextRef:ce,selectedItemTextRef:Q,alignItemWithTriggerActiveRef:xe,initialValueRef:de},Nr)).current,b=u.useState("activeIndex"),Z=u.useState("selectedIndex"),w=u.useState("triggerElement"),N=u.useState("positionerElement"),Te=mr(ee),Me=ee??Te,be=o.useMemo(()=>F?"":De(M,m),[F,M,m]),Re=o.useMemo(()=>F&&Array.isArray(M)?M.map(_=>De(_,m)):De(M,m),[F,M,m]),Ue=Ae(w),Be=Y(()=>Re);wr(Ue,U,M,Be,!a,l);const _e=F?Array.isArray(M)&&M.length>0:M!=null&&be!=="";q(()=>{L(_e)},[_e,L]),q(function(){const ie=cn(B.current,M,O,F);ie===null&&(Q.current=null),!H&&u.set("selectedIndex",ie)},[F,H,M,O,u]),Zn(M,()=>{k(I),D(Pr(M,h.initialValue,O)),W.change(M)});const je=Y((_,ie)=>{f?.(_,ie),!ie.isCanceled&&(X(_),!_&&(ie.reason===Kt||ie.reason===On)&&(G(!0),K(!1),v==="onBlur"&&W.commit(M)))}),Fe=Y(()=>{ge(!1),u.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),y?.(!1)});Et({enabled:!A,open:H,ref:se,onComplete(){H||Fe()}}),o.useImperativeHandle(A,()=>({unmount:Fe}),[Fe]);const We=Y((_,ie)=>{s?.(_,ie),!ie.isCanceled&&P(_)}),at=Y(_=>{const ie=dn(_.scrollHeight,_.clientHeight),$e=Br(_.scrollTop,ie),ft=$e>0,ze=$e<ie;u.set("scrollUpArrowVisible",ft),u.set("scrollDownArrowVisible",ze)}),Pe=ur({open:H,onOpenChange:je,elements:{reference:w,floating:N}}),me=er(Pe,{enabled:!a,event:"mousedown"}),ye=qn(Pe),Ee=pr(Pe,{enabled:!a,listRef:ne,activeIndex:b,selectedIndex:Z,disabledIndices:Rt,onNavigate(_){_===null&&!H||u.set("activeIndex",_)},focusItemOnHover:p}),Le=gr(Pe,{enabled:!a&&(H||!T&&!F),listRef:re,activeIndex:b,selectedIndex:Z,disabledIndices:_=>xr(ne.current[_]),onMatch(_){H?u.set("activeIndex",_):We(B.current[_],he(st))},onTyping(_){j.current=_}}),Mt=o.useMemo(()=>bt(Le.reference,Ee.reference,ye.reference,me.reference,we),[me.reference,Le.reference,Ee.reference,ye.reference,we]),Pt=o.useMemo(()=>bt(Kn,Le.floating,Ee.floating,ye.floating),[Le.floating,Ee.floating,ye.floating]),At=Ee.item??nt;u.useContextCallback("setValue",We),u.useContextCallback("setOpen",je),u.useContextCallback("handleScrollArrowVisibility",at),u.useContextCallback("onOpenChangeComplete",y),hr(()=>{u.update({popupProps:Pt,triggerProps:Mt})}),u.useSyncedValues({id:U,modal:V,multiple:F,value:M,open:H,mounted:ue,transitionStatus:Se,popupProps:Pt,triggerProps:Mt,items:$,itemToStringLabel:g,itemToStringValue:m,isItemEqualToValue:O,openMethod:Me});const xn=o.useMemo(()=>({disabled:a,readOnly:T,required:d,multiple:F,highlightItemOnHover:p,itemProps:At}),[a,T,d,F,p,At]),Sn=Tn(E,W.inputRef),Ot=F?void 0:I,Rn=o.useMemo(()=>!F||!Array.isArray(M)||!I?null:M.map(_=>{const ie=De(_,m);return ae.jsx("input",{type:"hidden",form:C,name:I,value:ie,disabled:a},ie)}),[F,M,C,I,m,a]);return ae.jsxs(en.Provider,{value:u,children:[ae.jsx(tn.Provider,{value:xn,children:ae.jsx(nn.Provider,{value:Pe,children:S})}),ae.jsx("input",{...W.getValidationProps(a,{onFocus(){u.state.triggerElement?.focus({focusVisible:!0})},onChange(_){if(_.nativeEvent.defaultPrevented||a||T)return;const ie=_.currentTarget.value,$e=he(st,_.nativeEvent);function ft(){if(F)return;const ze=ie.toLowerCase();let dt=B.current.findIndex(pt=>De(pt,m).toLowerCase()===ze||an(pt,g).toLowerCase()===ze);dt===-1&&(dt=B.current.findIndex((pt,bn)=>{const Ft=re.current[bn];return Ft!=null&&Ft.toLowerCase()===ze}));const Vt=B.current[dt];Vt!=null&&We(Vt,$e)}u.set("forceMount",!0),queueMicrotask(ft)}}),id:U&&Ot==null?`${U}-hidden-input`:void 0,form:C,name:Ot,autoComplete:R,value:be,disabled:a,required:d&&!(F&&_e),readOnly:T,ref:Sn,style:I?Mn:Pn,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Rn]})}function _r(e,t){return e??t}const Je=5;function jr(e,t){const n=Wr(t);return e.clientX>=n.left-Je&&e.clientX<=n.right+Je&&e.clientY>=n.top-Je&&e.clientY<=n.bottom+Je}function Wr(e){const t=e.getBoundingClientRect(),n=rt(e);if(Vn)return t;const r=n.getComputedStyle(e,"::before"),s=n.getComputedStyle(e,"::after");if(!(r.content!=="none"||s.content!=="none"))return t;const c=parseFloat(r.width)||0,f=parseFloat(r.height)||0,l=parseFloat(s.width)||0,C=parseFloat(s.height)||0,R=Math.max(t.width,c,l),x=Math.max(t.height,f,C),T=R-t.width,d=x-t.height;return{left:t.left-T/2,right:t.right+T/2,top:t.top-d/2,bottom:t.bottom+d/2}}const zr="data-popup-side",qr=400,Kr={...Yn,...Cr,popupSide:e=>e?{[zr]:e}:null,value:()=>null},ho=o.forwardRef(function(t,n){const{render:r,className:s,id:i,disabled:c=!1,nativeButton:f=!0,style:l,...C}=t,{setTouched:R,setFocused:x,validationMode:T,validation:d,state:V,disabled:A}=wt(),{labelId:E}=on(),y=Ve(),{readOnly:$,required:F,disabled:g}=vt(),m=A||g||c,O=y.useState("open"),p=y.useState("mounted"),S=y.useState("value"),k=y.useState("triggerProps"),D=y.useState("positionerElement"),G=y.useState("listElement"),K=y.useState("popupSide"),h=y.useState("id"),L=y.useState("labelId"),z=y.useState("hasSelectedValue"),J=p&&D?K:null,W=i??h,v=_r(E,L);sn({id:i});const U=Ae(D),a=o.useRef(null),{getButtonProps:I,buttonRef:M}=Gt({disabled:m,native:f}),P=y.useStateSetter("triggerElement"),H=tt(),X=tt(),ne=tt();o.useEffect(()=>{if(O)return ne.start(qr,()=>{y.context.selectionRef.current.allowUnselectedMouseUp=!0,y.context.selectionRef.current.allowSelectedMouseUp=!0}),()=>{ne.clear()};y.context.selectionRef.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},X.clear()},[O,y,X,ne]);const re=bt(k,{id:W,role:"combobox","aria-expanded":O,"aria-haspopup":"listbox","aria-controls":O?G?.id??qt(D)?.id:void 0,"aria-labelledby":v,"aria-readonly":$||void 0,"aria-required":F||void 0,tabIndex:m?-1:0,onFocus(oe){x(!0),O&&y.context.alignItemWithTriggerActiveRef.current&&y.context.setOpen(!1,he(st,oe.nativeEvent)),H.start(0,()=>{y.set("forceMount",!0)})},onBlur(oe){ve(D,oe.relatedTarget)||(R(!0),x(!1),T==="onBlur"&&d.commit(S))},onMouseDown(oe){if(O)return;const fe=Ye(oe.currentTarget);function B(j){if(!a.current)return;const ce=j.target;ve(a.current,ce)||ve(U.current,ce)||jr(j,a.current)||y.context.setOpen(!1,he(Fn,j))}X.start(0,()=>{fe.addEventListener("mouseup",B,{once:!0})})}},C,I),se=d.getValidationProps(m,re);se.role="combobox";const le={...V,open:O,disabled:m,value:S,readOnly:$,popupSide:J,placeholder:!z};return ke("button",t,{ref:[n,a,M,P],state:le,stateAttributesMapping:Kr,props:se})}),Yr={value:()=>null},xo=o.forwardRef(function(t,n){const{className:r,render:s,children:i,placeholder:c,style:f,...l}=t,C=Ve(),R=C.useState("value"),x=C.useState("items"),T=C.useState("itemToStringLabel"),d=C.useState("hasSelectedValue"),V=!d&&c!=null&&i==null,A=C.useState("hasNullItemLabel",V),E={value:R,placeholder:!d};let y=null;return typeof i=="function"?y=i(R):i!=null?y=i:V&&!A?y=c:Array.isArray(R)?y=Hr(R,x,T):y=fn(R,x,T),ke("span",t,{state:E,ref:[n,C.context.valueRef],props:[{children:y},l],stateAttributesMapping:Yr})}),So=o.forwardRef(function(t,n){const r=Ve(),s=r.useState("mounted"),i=r.useState("forceMount");return s||i?ae.jsx(Ln,{ref:n,...t}):null}),pn=o.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function $r(){return o.useContext(pn)}function Gr(e){const{children:t,elementsRef:n,labelsRef:r,onMapChange:s}=e,i=Y(s),[,c]=o.useState(!1),f=He(Jr).current,l=He(Xr).current,C=o.useRef(0),R=o.useRef(!0),x=o.useRef(null),T=o.useRef(null),d=Y(()=>{R.current||(R.current=!0,c(m=>!m))}),V=Y((m,O)=>{l.set(m,O),d()}),A=Y(m=>{l.delete(m),d()}),E=Y(m=>{const O=new Map;return n.current.length=0,r&&(r.current.length=0),m.forEach(p=>{O.set(p.element,{...p.registration.metadata??{},index:p.index}),n.current[p.index]=p.element,r&&(r.current[p.index]=p.registration.label!==void 0?p.registration.label:p.registration.textRef?.current?.textContent??p.element.textContent)}),C.current=n.current.length,O});function y(m){if(T.current?.disconnect(),T.current=null,typeof MutationObserver!="function"||m.length<2)return;const O=new MutationObserver(S=>{if(!eo(S))return;let k=null;for(const D of m)if(D.isConnected){if(k&&gn(k,D)>0){O.disconnect(),d();return}k=D}});T.current=O;const p=new Set;for(let S=1;S<m.length;S+=1){const k=Zr(m[S-1],m[S]);k&&p.add(k)}p.forEach(S=>O.observe(S,{childList:!0}))}const $=Y(()=>{const[m,O]=Qr(l),p=E(m),S=x.current,k=!S||S.length!==m.length||m.some((D,G)=>{const K=S[G];return D.index!==K.index||D.element!==K.element||D.registration.index!==K.registration.index||D.registration.metadata!==K.registration.metadata});y(O),x.current=m,R.current=!1,k&&(f.forEach(D=>D(p)),i(p))});q(()=>(!R.current&&x.current&&E(x.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,E]),q(()=>{R.current&&$()}),q(()=>()=>{T.current?.disconnect(),R.current=!0},[]);const F=Y(m=>(f.add(m),()=>{f.delete(m)})),g=o.useMemo(()=>({register:V,unregister:A,subscribeMapChange:F,nextIndexRef:C}),[V,A,F,C]);return ae.jsx(pn.Provider,{value:g,children:t})}function Xr(){return new Map}function Jr(){return new Set}function Qr(e){const t=new Set,n=[],r=[];e.forEach((i,c)=>{if(!c.isConnected)return;const f=i.index,l={index:f??-1,element:c,registration:i};f===null?r.push(l):f>=0&&(t.add(f),n.push(l))});let s=0;return r.sort((i,c)=>gn(i.element,c.element)),r.forEach(i=>{for(;t.has(s);)s+=1;i.index=s,n.push(i),s+=1}),t.size>0&&n.sort((i,c)=>i.index-c.index),[n,r.map(i=>i.element)]}function Zr(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function eo(e){for(const t of e)for(let n=0;n<t.removedNodes.length;n+=1)if(t.removedNodes[n].isConnected)return!0;return!1}function gn(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}const mn=o.createContext(void 0);function to(){const e=o.useContext(mn);if(!e)throw new Error(Ne(59));return e}function it(e,t){e&&Object.assign(e.style,t)}const no={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},ro={position:"fixed"},Ro=o.forwardRef(function(t,n){const{anchor:r,className:s,render:i,positionMethod:c,side:f,align:l,sideOffset:C,alignOffset:R,collisionBoundary:x="clipping-ancestors",collisionPadding:T,arrowPadding:d,sticky:V,disableAnchorTracking:A,alignItemWithTrigger:E=!0,collisionAvoidance:y=Dn,style:$,...F}=t,g=Ve(),m=rn(),O=g.useState("open"),p=g.useState("mounted"),S=g.useState("modal"),k=g.useState("value"),D=g.useState("openMethod"),G=g.useState("positionerElement"),K=g.useState("triggerElement"),h=g.useState("isItemEqualToValue"),L=g.useState("transitionStatus"),z=o.useRef(null),J=o.useRef(null),[W,v]=o.useState(E),U=p&&W&&D!=="touch";!p&&W!==E&&v(E),o.useImperativeHandle(g.context.alignItemWithTriggerActiveRef,()=>U),tr((U||S)&&O,D==="touch",G,K);const a=nr({anchor:r,floatingRootContext:m,positionMethod:c,mounted:p,side:f,sideOffset:C,align:l,alignOffset:R,arrowPadding:d,collisionBoundary:x,collisionPadding:T,sticky:V,disableAnchorTracking:A??U,collisionAvoidance:y,keepMounted:!0}),I=U?"none":a.side,M=U?ro:a.positionerStyles,P={open:O,side:I,align:a.align,anchorHidden:a.anchorHidden};q(()=>{g.set("popupSide",a.side)},[g,a.side]);const H=g.useStateSetter("positionerElement"),X=rr(t,P,{styles:M,transitionStatus:L,props:F,refs:[n,H],hidden:!p,inert:!O}),ne=o.useRef(0),re=Y(le=>{if(g.context.valuesRef.current.length===0)return;const oe=ne.current;ne.current=le.size;const fe=he(st);if(oe!==0&&!g.state.multiple&&k!==null&&ot(g.context.valuesRef.current,k,h)===-1){const j=g.context.initialValueRef.current,Q=j!=null&&ot(g.context.valuesRef.current,j,h)!==-1?j:null;g.context.setValue(Q,fe),Q===null&&(g.set("selectedIndex",null),g.context.selectedItemTextRef.current=null)}if(oe!==0&&g.state.multiple&&Array.isArray(k)){const B=k.filter(j=>ot(g.context.valuesRef.current,j,h)!==-1);B.length!==k.length&&(g.context.setValue(B,fe),B.length===0&&(g.set("selectedIndex",null),g.context.selectedItemTextRef.current=null))}if(O&&U){g.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const B={height:""};it(G,B),it(g.context.popupRef.current,B)}}),se=o.useMemo(()=>({...a,side:I,alignItemWithTriggerActive:U,setControlledAlignItemWithTrigger:v,scrollUpArrowRef:z,scrollDownArrowRef:J}),[a,I,U,v]);return ae.jsx(Gr,{elementsRef:g.context.listRef,labelsRef:g.context.labelsRef,onMapChange:re,children:ae.jsxs(mn.Provider,{value:se,children:[p&&S&&ae.jsx($n,{inert:Hn(!O),cutout:K}),X]})})}),Qe="base-ui-disable-scrollbar",Bt={className:Qe,getElement(e){return ae.jsx("style",{nonce:e,href:Qe,precedence:"base-ui:low",children:`.${Qe}{scrollbar-width:none}.${Qe}::-webkit-scrollbar{display:none}`})}},oo=o.createContext(void 0),so={disableStyleElements:!1};function io(){return o.useContext(oo)??so}const _t="--transform-origin",lo={...Xn,...Xt},bo=o.forwardRef(function(t,n){const{render:r,className:s,style:i,finalFocus:c,...f}=t,l=Ve(),{multiple:C,readOnly:R,highlightItemOnHover:x}=vt(),T=rn(),{side:d,align:V,alignItemWithTriggerActive:A,isPositioned:E,setControlledAlignItemWithTrigger:y}=to(),$=or()!=null,F=sr(),{nonce:g,disableStyleElements:m}=io(),O=l.useState("id"),p=l.useState("open"),S=l.useState("openMethod"),k=l.useState("mounted"),D=l.useState("popupProps"),G=l.useState("transitionStatus"),K=l.useState("triggerElement"),h=l.useState("positionerElement"),L=l.useState("listElement"),z=o.useRef(!1),J=o.useRef(!1),W=o.useRef({}),v=St(),U=Y(P=>{if(!h||!l.context.popupRef.current||!J.current)return;const H=h.style.top==="0px",X=h.style.bottom==="0px";if(z.current||!A||!H&&!X){l.context.handleScrollArrowVisibility(P);return}const ne=Wt(h),re=Ke(h.getBoundingClientRect().height,"y",ne),se=Ye(h),le=rt(h),oe=le.getComputedStyle(h),fe=parseFloat(oe.marginTop),B=parseFloat(oe.marginBottom),j=jt(le.getComputedStyle(l.context.popupRef.current)),ce=Math.min(se.documentElement.clientHeight-fe-B,j),Q=P.scrollTop,pe=Ze(P);let xe=null;const de=ee=>{h.style.height=`${ee}px`},ue=H?pe-Q:Q,ge=Math.min(re+ue,ce);if(ue<=Ce){const ee=qe(ue,0,ce-re);ee>0&&de(re+ee),P.scrollTop=H?pe:0,ce-(re+ee)<=Ce&&(z.current=!0),l.context.handleScrollArrowVisibility(P);return}if(ce-ge>Ce)xe=H?1/0:0;else if(X&&Q<pe){const ee=re+ue-ce;xe=Q-(ue-ee)}const Se=Math.ceil(ge);if(Se!==0&&de(Se),xe!=null){const ee=qe(xe,0,Ze(P));Math.abs(P.scrollTop-ee)>Ce&&(P.scrollTop=ee)}Se>=ce-Ce&&(z.current=!0),l.context.handleScrollArrowVisibility(P)});o.useImperativeHandle(l.context.scrollHandlerRef,()=>U,[U]),Et({open:p,ref:l.context.popupRef,onComplete(){p&&l.context.onOpenChangeComplete(!0)}});const a={open:p,transitionStatus:G,side:d,align:V};q(()=>{!h||!l.context.popupRef.current||Object.keys(W.current).length||(W.current={top:h.style.top||"0",left:h.style.left||"0",right:h.style.right,height:h.style.height,bottom:h.style.bottom,minHeight:h.style.minHeight,maxHeight:h.style.maxHeight,marginTop:h.style.marginTop,marginBottom:h.style.marginBottom})},[l,h]),q(()=>{p||A||(J.current=!1,z.current=!1,it(h,W.current))},[p,A,h]),q(()=>{const P=l.context.popupRef.current;if(!p||!K||!h||!P||A&&!E||l.state.transitionStatus==="ending")return;if(J.current=!0,P.style.removeProperty(_t),!A){v.request(()=>l.context.handleScrollArrowVisibility(L||P));return}const H=co(P);try{let X=l.context.selectedItemTextRef.current;X?.isConnected||(X=!l.select("hasSelectedValue")&&l.context.firstItemTextRef.current?.isConnected?l.context.firstItemTextRef.current:null);const ne=l.context.valueRef.current,re=rt(h),se=re.getComputedStyle(h),le=re.getComputedStyle(P),oe=Ye(K),fe=Wt(K),B=et(K.getBoundingClientRect(),fe),j=et(h.getBoundingClientRect(),fe),ce=B.height,Q=L||P,pe=Q.scrollHeight,xe=parseFloat(le.borderBottomWidth),de=parseFloat(se.marginTop)||10,ue=parseFloat(se.marginBottom)||10,ge=parseFloat(se.minHeight)||100,Se=jt(le),ee=5,we=5,u=20,b=oe.documentElement.clientHeight-de-ue,Z=oe.documentElement.clientWidth,w=b-B.bottom+ce;let N,Te=F==="rtl"?B.right-j.width:B.left,Me=0;if(X&&ne){const me=et(ne.getBoundingClientRect(),fe);N=et(X.getBoundingClientRect(),fe),Te=j.left+(F==="rtl"?me.right-N.right:me.left-N.left);const ye=me.top-B.top+me.height/2;Me=N.top-j.top+N.height/2-ye}const be=w+Me+ue+xe;let Re=Math.min(b,be);const Ue=b-de-ue,Be=be-Re,_e=Z-we;h.style.left=`${qe(Te,ee,_e-j.width)}px`,h.style.height=`${Re}px`,h.style.maxHeight="none",h.style.marginTop=`${de}px`,h.style.marginBottom=`${ue}px`,P.style.height="100%";const je=Ze(Q),Fe=Be>=je-Ce;Fe&&(Re=Math.min(b,j.height)-(Be-je));const We=B.top<u||B.bottom>b-u||Math.ceil(Re)+Ce<Math.min(pe,ge),at=(re.visualViewport?.scale??1)!==1&&Yt;if(We||at){it(h,W.current),y(!1);return}const Pe=Math.max(ge,Re);if(Fe){const me=Math.max(0,b-be);h.style.top=j.height>=Ue?"0":`${me}px`,h.style.height=`${Re}px`,Q.scrollTop=Ze(Q)}else h.style.bottom="0",Q.scrollTop=Be;if(N){const me=j.top,ye=j.height,Ee=N.top+N.height/2,Le=qe(ye>0?(Ee-me)/ye*100:50,0,100);P.style.setProperty(_t,`50% ${Le}%`)}(Pe===b||Re>=Se)&&(z.current=!0),l.context.handleScrollArrowVisibility(Q),x&&l.state.selectedIndex===null&&l.state.activeIndex===null&&l.context.listRef.current[0]!=null&&l.set("activeIndex",0)}finally{H()}},[l,p,h,K,A,y,v,L,x,F,E]),o.useEffect(()=>{if(!A||!h||!p)return;const P=rt(h);function H(X){l.context.setOpen(!1,he(kn,X))}return Nn(P,"resize",H)},[l,A,h,p]);const I={...L?{role:"presentation"}:{role:"listbox","aria-multiselectable":C||void 0,"aria-readonly":R||void 0,id:`${O}-list`},onKeyDown(P){$&&Jn.has(P.key)&&P.stopPropagation()},onScroll(P){L||U(P.currentTarget)},...A&&{style:L?{height:"100%"}:no},className:!L&&A?Bt.className:void 0},M=ke("div",t,{ref:[n,l.context.popupRef],state:a,stateAttributesMapping:lo,props:[D,I,cr(G),f]});return ae.jsxs(o.Fragment,{children:[!m&&Bt.getElement(g),ae.jsx(Gn,{context:T,modal:!1,disabled:!k,openInteractionType:S,returnFocus:c,restoreFocus:!0,children:M})]})});function jt(e){const t=e.maxHeight;return t.endsWith("px")&&parseFloat(t)||1/0}function Ze(e){return dn(e.scrollHeight,e.clientHeight)}function Wt(e){return ir.getScale(e)}function Ke(e,t,n){return e/n[t]}function et(e,t){return lr({x:Ke(e.x,"x",t),y:Ke(e.y,"y",t),width:Ke(e.width,"x",t),height:Ke(e.height,"y",t)})}const zt=[["transform","none"],["scale","1"],["translate","0 0"]];function co(e){const{style:t}=e,n={};for(const[r,s]of zt)n[r]=t.getPropertyValue(r),t.setProperty(r,s,"important");return()=>{for(const[r]of zt){const s=n[r];s?t.setProperty(r,s):t.removeProperty(r)}}}function uo(e={}){const{guess:t,label:n,metadata:r,textRef:s,index:i}=e,{register:c,unregister:f,subscribeMapChange:l,nextIndexRef:C}=$r(),R=o.useRef(-1),[x,T]=o.useState(i==null&&t?()=>{if(R.current===-1){const E=C.current;C.current+=1,R.current=E}return R.current}:-1),d=i??x,V=o.useRef(null),A=o.useCallback(E=>{const y=V.current;y&&f(y),V.current=E,E&&c(E,{metadata:r??null,index:i??null,label:n,textRef:s})},[i,c,f,r,n,s]);return q(()=>{if(i==null)return l(E=>{const y=V.current?E.get(V.current)?.index:null;y!=null&&T(y)})},[i,l]),{ref:A,index:d}}const hn=o.createContext(void 0);function Tt(){const e=o.useContext(hn);if(!e)throw new Error(Ne(57));return e}const yo=o.memo(o.forwardRef(function(t,n){const{render:r,className:s,style:i,value:c=null,label:f,disabled:l=!1,nativeButton:C=!1,...R}=t,x=o.useRef(null),T=uo({guess:!0,label:f,textRef:x}),d=Ve(),{itemProps:V,multiple:A,disabled:E,readOnly:y}=vt(),$=E||l,F=d.useState("isActive",T.index),g=d.useState("open"),m=d.useState("isSelected",c),O=d.useState("isSelectedByFocus",T.index),p=d.useState("isItemEqualToValue"),S=T.index,k=o.useRef(null);q(()=>{const a=d.context.valuesRef.current;return a[S]=c,()=>{delete a[S]}},[S,c,d]),q(()=>{const a=d.state.value,I=d.state.selectedIndex;let M=I,P;A&&Array.isArray(a)?(M=Or(S,c,d.context.valuesRef.current,a,p,I),P=M===S,S===I&&!P&&(d.context.selectedItemTextRef.current=null)):(P=a!==void 0&&Oe(c,a,p),P&&(M=S)),d.set("selectedIndex",M),P&&x.current&&(d.context.selectedItemTextRef.current=x.current)},[S,A,p,d,c]);const D=o.useRef("mouse"),G=o.useRef(!1),{getButtonProps:K,buttonRef:h}=Gt({disabled:$,focusableWhenDisabled:!0,native:C,composite:!0}),L={disabled:$,selected:m,highlighted:F};function z(a){if(E||y)return;const I=d.state.value;if(A){const M=Array.isArray(I)?I:[],P=m?Vr(M,c,p):[...M,c];d.context.setValue(P,he(ht,a))}else d.context.setValue(c,he(ht,a)),d.context.setOpen(!1,he(ht,a))}function J(){d.context.selectionRef.current.dragY=0}const W={role:"option","aria-selected":m,tabIndex:g&&F?0:-1,onKeyDown(a){d.set("activeIndex",S),a.key===" "&&d.context.typingRef.current&&a.preventDefault()},onClick(a){const I=D.current!=="touch",M=a.nativeEvent.pointerType,P=I&&Qt(a.nativeEvent)&&(M!==void 0||F),H=I&&!P&&!G.current;G.current=!1,!($||H)&&z(a.nativeEvent)},onPointerEnter(a){D.current=a.pointerType},onPointerMove(a){if(a.pointerType==="mouse"&&a.buttons===1){const I=d.context.selectionRef.current;I.dragY+=a.movementY,I.dragY**2>=64&&(I.allowUnselectedMouseUp=!0)}},onPointerDown(a){D.current=a.pointerType,G.current=!0,J()},onMouseUp(){if(J(),$||D.current==="touch"||G.current)return;const a=!d.context.selectionRef.current.allowSelectedMouseUp&&m,I=!d.context.selectionRef.current.allowUnselectedMouseUp&&!m;a||I||(G.current=!0,k.current?.click(),G.current=!1)}},v=ke("div",t,{ref:[h,n,T.ref,k],state:L,props:[V,W,R,K]}),U=o.useMemo(()=>({selected:m,index:S,textRef:x,selectedByFocus:O}),[m,S,x,O]);return ae.jsx(hn.Provider,{value:U,children:v})})),Io=o.forwardRef(function(t,n){const{selected:r}=Tt();return t.keepMounted||r?ae.jsx(ao,{...t,ref:n}):null}),ao=o.memo(o.forwardRef((e,t)=>{const{render:n,className:r,style:s,keepMounted:i,...c}=e,{selected:f}=Tt(),l=o.useRef(null),{transitionStatus:C,setMounted:R}=Zt(f),T=ke("span",e,{ref:[t,l],state:{selected:f,transitionStatus:C},props:[{"aria-hidden":!0,children:"✔️"},c],stateAttributesMapping:Xt});return Et({batch:!0,enabled:!f,open:f,ref:l,onComplete(){f||R(!1)}}),T})),Co=o.memo(o.forwardRef(function(t,n){const{index:r,textRef:s,selectedByFocus:i}=Tt(),c=Ve(),{render:f,className:l,style:C,...R}=t,x=o.useCallback(d=>{d&&(r===0&&(c.context.firstItemTextRef.current=d),i&&(c.context.selectedItemTextRef.current=d))},[c,r,i]);return ke("div",t,{ref:[x,n,s],props:R})}));export{no as L,mo as S,vt as a,to as b,ho as c,xo as d,So as e,Ro as f,bo as g,yo as h,Io as i,Co as j,Cr as k,Ur as l,wt as m,on as n,sn as o,Ut as p,wr as q,Bt as s,Ve as u};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{m as ee,r as i,j as e,e as F,c as a,J as me,H as Z,R as he,X as ge,d as te,l as x,a7 as pe,a8 as q}from"./__vite-browser-external-CPMSmJgP.js";import{L as fe,I as be}from"./LocalOnlyNotice-CAQTnlaI.js";import{S as J}from"./SegmentedControl-2O_XVL8u.js";import{C as ye}from"./ToolbarRootContext-B0cqyD1i.js";import{S as ae}from"./search-q2ARMGca.js";import{C as ke}from"./check-D2K19ObI.js";import{P as _e,a as ve,b as je,c as we,d as Ne}from"./PopoverPopup-Btcu7vU0.js";import{P as Ce}from"./ProviderIcon-aLwclDsD.js";import{H as Se}from"./HoverTooltip-C2Qop8B3.js";import{u as Me}from"./useCurrency-Dh9pUzDO.js";import{i as Le}from"./host-mode-Bc_iTzHk.js";import{L as Re}from"./loader-circle-DTIT1Uk1.js";import{T as Te}from"./terminal-CFQOW2Ey.js";import"./arrow-up-right-CPxuidzy.js";import"./download-CpW-TB2h.js";import"./composite-BN1UKLj0.js";import"./store-DvdXwk-7.js";const re={name:"calendar",size:24,node:[["path",{d:"M8 2v3",key:"1ioesn"}],["path",{d:"M16 2v3",key:"otl347"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}],["path",{d:"M3 9h18",key:"1pudct"}]]};re.node;const De=ee(re);const se={name:"folder",size:24,node:[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]};se.node;const Ie=ee(se),Ee="flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-sm text-oai-black outline-none hover:bg-oai-gray-100 dark:text-white dark:hover:bg-oai-gray-800";function Pe({options:r,value:t,onChange:s,allValue:m="all",allLabel:p,searchPlaceholder:y,emptyLabel:u,ariaLabel:j,disabled:k=!1,className:w=""}){const[f,b]=i.useState(!1),[h,D]=i.useState(""),[g,_]=i.useState(-1),N=i.useRef(null),C=`${i.useId()}-listbox`,U=t===m?p:r.find(l=>l.value===t)?.label??t,S=h.trim().toLowerCase(),I=i.useMemo(()=>S?r.filter(l=>l.label.toLowerCase().includes(S)):r,[r,S]),E=i.useMemo(()=>[{value:m,label:p},...I],[m,p,I]),M=g>=0&&g<E.length?E[g]:null,P=l=>{s(l),b(!1),D(""),_(-1)};i.useEffect(()=>{f&&N.current?.querySelector('[data-active="true"]')?.scrollIntoView?.({block:"nearest"})},[f,g]);const L=l=>{if(l.key==="ArrowDown"||l.key==="ArrowUp"){l.preventDefault();const v=l.key==="ArrowDown";_($=>{const R=E.length;return R?v?$>=R-1?0:$+1:$<=0?R-1:$-1:-1});return}if(l.key==="Enter"){const v=M||(S&&I.length?I[0]:null);if(!v)return;l.preventDefault(),P(v.value)}};return e.jsxs(_e,{open:f,onOpenChange:l=>{b(l),_(-1),l||D("")},children:[e.jsxs(ve,{disabled:k,"aria-label":j,className:F("inline-flex h-8 max-w-[12rem] shrink-0 items-center gap-1.5 rounded-md border border-oai-gray-200 bg-oai-white px-2.5 text-xs font-medium transition hover:border-oai-gray-300 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 disabled:opacity-60 data-[popup-open]:border-oai-gray-300 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:hover:border-oai-gray-700",t!==m?"text-oai-black dark:text-white":"text-oai-gray-700 dark:text-oai-gray-200",w),children:[e.jsx(Ie,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-400","aria-hidden":!0}),e.jsx("span",{className:"truncate",children:U}),e.jsx(ye,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-400","aria-hidden":!0})]}),e.jsx(je,{children:e.jsx(we,{sideOffset:4,side:"bottom",align:"start",className:"z-[60]",children:e.jsxs(Ne,{className:"w-56 overflow-hidden rounded-md border border-oai-gray-200 bg-white p-1 shadow-[0_12px_32px_-12px_rgba(0,0,0,0.18)] outline-none dark:border-oai-gray-800 dark:bg-oai-gray-950 dark:shadow-[0_12px_32px_-12px_rgba(0,0,0,0.6)]",children:[e.jsxs("div",{className:"relative mb-1",children:[e.jsx(ae,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-oai-gray-400","aria-hidden":!0}),e.jsx("input",{type:"text",role:"combobox","aria-expanded":!0,"aria-controls":C,"aria-activedescendant":M?`${C}-${g}`:void 0,value:h,onChange:l=>{D(l.target.value),_(-1)},onKeyDown:L,placeholder:y,className:"h-8 w-full rounded border border-oai-gray-200 bg-transparent pl-8 pr-2 text-xs text-oai-black outline-none placeholder:text-oai-gray-400 focus:border-oai-gray-400 dark:border-oai-gray-800 dark:text-white dark:focus:border-oai-gray-500"})]}),e.jsxs("div",{ref:N,id:C,role:"listbox","aria-label":j,className:"max-h-64 overflow-y-auto",children:[E.map((l,v)=>e.jsxs("button",{id:`${C}-${v}`,type:"button",role:"option","aria-selected":t===l.value,"data-active":v===g?"true":void 0,onMouseEnter:()=>_(v),onClick:()=>P(l.value),className:F(Ee,t===l.value&&"bg-oai-gray-100 dark:bg-oai-gray-800",v===g&&"ring-1 ring-inset ring-oai-gray-300 dark:ring-oai-gray-600"),children:[e.jsx("span",{className:"flex-1 truncate",children:l.label}),t===l.value?e.jsx(ke,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}):null]},l.value)),I.length===0?e.jsx("div",{className:"px-2 py-3 text-center text-xs text-oai-gray-400 dark:text-oai-gray-500",children:u}):null]})]})})})]})}const Fe="tokentracker-sessions";async function $e(r={}){const t=new URL(`/functions/${Fe}`,window.location.origin);r.from&&t.searchParams.set("from",r.from),r.to&&t.searchParams.set("to",r.to),r.limit&&t.searchParams.set("limit",String(r.limit)),r.refresh&&t.searchParams.set("refresh","1");const s=await fetch(t.toString(),{headers:{Accept:"application/json"},cache:"no-store"}),m=await s.json().catch(()=>null);if(!s.ok){const p=s.status===404?a("sessions.error.outdated_app"):`Request failed with HTTP ${s.status}`,y=new Error(m?.error||p);throw y.status=s.status,y}return m}const V=Le(),Oe=[],z=100,Ae=[{id:"all",label:()=>a("sessions.filter.source_all")},{id:"claude",label:()=>"Claude Code"},{id:"codex",label:()=>"Codex"},{id:"grok",label:()=>"Grok"}],oe=[{id:"all",days:0,label:()=>a("sessions.filter.range_all")},{id:"7d",days:7,label:()=>a("sessions.filter.range_7d")},{id:"30d",days:30,label:()=>a("sessions.filter.range_30d")},{id:"90d",days:90,label:()=>a("sessions.filter.range_90d")}];function Ue(r){const t=oe.find(m=>m.id===r)?.days||0;if(!t)return 0;const s=new Date;return s.setDate(s.getDate()-(t-1)),s.setHours(0,0,0,0),s.getTime()}function qe(r,t){if(!t)return!0;const s=Date.parse(r.ended_at||r.started_at||"");return Number.isFinite(s)?s>=t:!0}function H(r){const t=Array.isArray(r?.model_usage)?r.model_usage.filter(s=>s&&typeof s.model=="string"&&s.model):[];return t.length?t:[{model:r?.model||a("sessions.model.unknown"),total_tokens:Number(r?.own_total_tokens||r?.total_tokens||0)}]}function He(r){const t=H(r);return t.length===1?t[0].model:t.map(s=>`${s.model} ${x(Number(s.total_tokens||0))}`).join(" · ")}function Be(r,t){if(!r)return"—";const s=Date.parse(r);if(!Number.isFinite(s))return"—";try{return new Date(s).toLocaleString(t||void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return new Date(s).toISOString().slice(0,16).replace("T"," ")}}function Ge(r){const t=Number(r);if(!Number.isFinite(t)||t<=0)return null;const s=Math.round(t/6e4);if(s<60)return a("sessions.duration.minutes",{minutes:s});const m=Math.floor(s/60),p=s%60;return a("sessions.duration.hours",{hours:m,minutes:p})}async function X(r){if(navigator?.clipboard?.writeText)return await navigator.clipboard.writeText(r),!0;const t=document.createElement("textarea");t.value=r,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();const s=document.execCommand("copy");return document.body.removeChild(t),s}const Y=te.memo(function({session:t,locale:s,nested:m=!1,childCount:p=0,expanded:y=!1,onToggle:u}){const{currency:j,rate:k}=Me(),w=String(t.source||"").toUpperCase(),f=Ge(t.duration_ms),b=t.resume_command,h=t.project_key||a("sessions.project.unknown"),D=m||t.thread_kind==="subagent",g=D?t.agent_nickname||t.agent_role||t.title||h:t.title||h,_=!!(t.title&&t.project_key),N=String(t.source||"").toLowerCase()==="grok",C=N&&t.usage_precision?a("sessions.grok.token_breakdown",{input:x(t.input_tokens),cacheRead:x(t.cached_input_tokens),cacheWrite:x(t.cache_creation_input_tokens),output:x(t.output_tokens),reasoning:x(t.reasoning_output_tokens)}):null,U=N&&t.usage_precision?a("sessions.grok.runtime_breakdown",{calls:x(t.model_calls),seconds:(Number(t.api_duration_ms||0)/1e3).toFixed(1),tools:x(t.tool_calls),errors:x(t.error_count)}):null,S=N&&Number(t.context_window_tokens)>0?a("sessions.grok.context_breakdown",{used:x(t.context_tokens_used),window:x(t.context_window_tokens),percent:Number(t.context_usage_percent||0).toFixed(0)}):null,I=t.project_ref?`${t.project_ref}
|
|
2
|
-
${a("sessions.project.copy_hint")}`:void 0,E=async()=>{if(t.project_ref)try{await X(t.project_ref)?q({title:a("sessions.project.copied")}):q({title:a("sessions.project.copy_failed")})}catch{q({title:a("sessions.project.copy_failed")})}},M=L=>e.jsxs("span",{className:"group relative inline-flex min-w-0 max-w-full",children:[e.jsx(Se,{text:I,placement:"bottom"}),e.jsx("button",{type:"button",onClick:E,"aria-label":a("sessions.project.copy_aria",{project:h}),className:F("max-w-full truncate rounded text-left underline decoration-dotted decoration-oai-gray-300 underline-offset-4 hover:decoration-oai-gray-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:decoration-oai-gray-600 dark:hover:decoration-oai-gray-400",L),children:h})]}),P=async()=>{if(b)try{await X(b)?q({title:a("sessions.resume.copied")}):q({title:a("sessions.resume.copy_failed")})}catch{q({title:a("sessions.resume.copy_failed")})}};return e.jsxs("li",{className:F("flex flex-col gap-3 py-4 sm:flex-row sm:items-start",m&&"ml-6 border-l-2 border-oai-gray-200 pl-4 dark:border-oai-gray-800"),children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-start gap-2.5",children:[e.jsx("span",{className:"mt-0.5 shrink-0 text-oai-gray-400 dark:text-oai-gray-500",children:e.jsx(Ce,{provider:w,size:20})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[!D&&!t.title&&t.project_ref?M("font-medium text-oai-black dark:text-white"):e.jsx("span",{className:"truncate font-medium text-oai-black dark:text-white",children:g}),D?e.jsxs("span",{className:"inline-flex items-center rounded-full bg-sky-50 px-2 py-0.5 text-[11px] font-medium text-sky-700 dark:bg-sky-500/10 dark:text-sky-300",children:[a("sessions.badge.subagent"),t.agent_role?` · ${t.agent_role}`:""]}):null,t.first_pass?e.jsx("span",{className:"inline-flex items-center rounded-full bg-emerald-50 px-2 py-0.5 text-[11px] font-medium text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-300",children:a("sessions.badge.first_pass")}):null,N&&t.usage_precision||t.cost_is_partial?e.jsx("span",{className:F("inline-flex items-center rounded-full px-2 py-0.5 text-[11px] font-medium",t.usage_is_incomplete||t.cost_is_partial?"bg-amber-50 text-amber-700 dark:bg-amber-500/10 dark:text-amber-300":"bg-sky-50 text-sky-700 dark:bg-sky-500/10 dark:text-sky-300"),children:t.usage_is_incomplete?a("sessions.badge.partial_usage"):t.cost_is_partial?a("sessions.badge.partial_cost"):t.cost_source==="provider_reported"?a("sessions.badge.reported_cost"):a("sessions.badge.reported_usage")}):null,p?e.jsx("button",{type:"button",onClick:u,"aria-expanded":y,className:"inline-flex items-center rounded-full border border-oai-gray-200 px-2 py-0.5 text-[11px] font-medium text-oai-gray-600 transition-colors hover:bg-oai-gray-100 hover:text-oai-black focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800 dark:hover:text-white",children:y?a("sessions.thread.collapse",{count:p}):a("sessions.thread.expand",{count:p})}):null]}),e.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:[_?e.jsxs(e.Fragment,{children:[t.project_ref?M("hover:text-oai-black dark:hover:text-white"):e.jsx("span",{className:"truncate",children:h}),e.jsx("span",{"aria-hidden":!0,children:"·"})]}):null,e.jsx("span",{className:"truncate",children:He(t)}),e.jsx("span",{"aria-hidden":!0,children:"·"}),e.jsx("span",{className:"tabular-nums",children:Be(t.started_at,s)}),f?e.jsxs(e.Fragment,{children:[e.jsx("span",{"aria-hidden":!0,children:"·"}),e.jsx("span",{className:"tabular-nums",children:f})]}):null]}),C?e.jsx("div",{className:"mt-1 text-[11px] tabular-nums text-oai-gray-500 dark:text-oai-gray-400",children:C}):null,U?e.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-x-2 text-[11px] tabular-nums text-oai-gray-400 dark:text-oai-gray-500",children:[e.jsx("span",{children:U}),S?e.jsxs(e.Fragment,{children:[e.jsx("span",{"aria-hidden":!0,children:"·"}),e.jsx("span",{children:S})]}):null]}):null]})]}),e.jsxs("div",{className:"flex items-start gap-5 pl-[30px] sm:pl-0",children:[e.jsxs("dl",{className:"flex items-start gap-6 text-right",children:[e.jsxs("div",{className:"flex w-16 flex-col-reverse",children:[e.jsx("dt",{className:"text-[11px] text-oai-gray-400 dark:text-oai-gray-500",children:a("sessions.col.tokens")}),e.jsxs("dd",{title:Number(t.subagent_total_tokens)?a("sessions.thread.tokens_summary",{own:x(t.own_total_tokens),subagents:x(t.subagent_total_tokens),combined:x(t.combined_total_tokens)}):void 0,className:"tabular-nums text-sm font-medium text-oai-black dark:text-white",children:[x(t.total_tokens),Number(t.subagent_total_tokens)?e.jsxs("span",{className:"block text-[9px] font-normal text-oai-gray-400 dark:text-oai-gray-500",children:["Σ ",x(t.combined_total_tokens)]}):null]})]}),e.jsxs("div",{className:"flex w-16 flex-col-reverse",children:[e.jsx("dt",{className:"text-[11px] text-oai-gray-400 dark:text-oai-gray-500",children:a("sessions.col.cost")}),e.jsxs("dd",{className:"tabular-nums text-sm font-medium text-oai-black dark:text-white",title:t.cost_is_partial?a("sessions.cost.partial_title"):void 0,children:[t.cost_is_partial?"≥":"",pe(t.cost_usd,{currency:j,rate:k})]})]}),e.jsxs("div",{className:"hidden w-10 flex-col-reverse sm:flex",children:[e.jsx("dt",{className:"text-[11px] text-oai-gray-400 dark:text-oai-gray-500",children:a("sessions.col.turns")}),e.jsx("dd",{className:"tabular-nums text-sm font-medium text-oai-black dark:text-white",children:x(t.turns)})]}),e.jsxs("div",{className:"hidden w-10 flex-col-reverse sm:flex",children:[e.jsx("dt",{className:"text-[11px] text-oai-gray-400 dark:text-oai-gray-500",children:a("sessions.col.edits")}),e.jsx("dd",{className:"tabular-nums text-sm font-medium text-oai-black dark:text-white",children:x(t.edit_turns)})]})]}),e.jsxs("button",{type:"button",onClick:P,disabled:!b,title:b||a("sessions.resume.unavailable"),"aria-label":b?a("sessions.resume.copy_aria",{command:b}):a("sessions.resume.unavailable"),className:F("-mt-0.5 inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",b?"text-oai-gray-500 hover:bg-oai-gray-100 hover:text-oai-black dark:text-oai-gray-400 dark:hover:bg-oai-gray-800 dark:hover:text-white":"cursor-not-allowed text-oai-gray-300 dark:text-oai-gray-600"),children:[e.jsx(Te,{className:"h-3.5 w-3.5","aria-hidden":!0}),e.jsx("span",{className:"hidden sm:inline",children:a("sessions.resume.copy")})]})]})]})});function ze({sessions:r,selectedModel:t,onSelect:s}){const{groups:m,totalTokens:p}=i.useMemo(()=>{const u=new Map;let j=0;for(const k of r)for(const w of H(k)){const f=w.model||a("sessions.model.unknown"),b=Number(w.total_tokens||0),h=u.get(f)||{model:f,count:0,tokens:0};h.count+=1,h.tokens+=b,j+=b,u.set(f,h)}return{groups:[...u.values()].sort((k,w)=>w.tokens-k.tokens),totalTokens:j}},[r]);function y(u){return F("rounded-full border px-2.5 py-1 text-xs tabular-nums transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",u?"border-oai-brand-500 bg-oai-brand-50 text-oai-brand-700 dark:bg-oai-brand-500/10 dark:text-oai-brand-300":"border-oai-gray-200 text-oai-gray-600 hover:bg-oai-gray-100 dark:border-oai-gray-700 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800")}return e.jsx("li",{className:"ml-6 border-l-2 border-oai-gray-200 py-3 pl-4 dark:border-oai-gray-800",children:e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"mr-1 text-xs font-medium text-oai-gray-500 dark:text-oai-gray-400",children:a("sessions.thread.model_usage")}),e.jsx("button",{type:"button","aria-pressed":t==="all",onClick:()=>s("all"),className:y(t==="all"),children:a("sessions.thread.model_all",{count:r.length,tokens:x(p)})}),m.map(u=>e.jsx("button",{type:"button","aria-pressed":t===u.model,onClick:()=>s(u.model),className:y(t===u.model),children:a("sessions.thread.model_item",{model:u.model,count:u.count,tokens:x(u.tokens)})},u.model))]})})}function ct(){const[r,t]=i.useState(null),[s,m]=i.useState(null),[p,y]=i.useState(!0),[u,j]=i.useState(!1),[k,w]=i.useState("all"),[f,b]=i.useState("all"),[h,D]=i.useState("all"),[g,_]=i.useState(""),[N,C]=i.useState(z),[U,S]=i.useState(()=>new Set),[I,E]=i.useState(()=>new Map),M=i.useRef(0),{resolvedLocale:P}=me(),L=i.useCallback(async(o=!1)=>{const d=++M.current;o?j(!0):y(!0),m(null);try{const n=await $e({refresh:o});d===M.current&&t(n)}catch(n){d===M.current&&m(n?.message||String(n))}finally{d===M.current&&(y(!1),j(!1))}},[]);i.useEffect(()=>{V||Z()?L(!1):y(!1)},[L]);const l=r?.sessions||Oe,v=i.useMemo(()=>{const o=new Set,d=[];for(const n of l){const c=n.project_key;!c||o.has(c)||(o.add(c),d.push({value:c,label:c}))}return d.sort((n,c)=>n.label.localeCompare(c.label))},[l]),$=i.useDeferredValue(g),R=i.useMemo(()=>{const o=$.trim().toLowerCase(),d=Ue(f);return l.filter(n=>{if(k!=="all"&&n.source!==k||h!=="all"&&n.project_key!==h||!qe(n,d))return!1;if(!o)return!0;const c=H(n).map(T=>T.model).join(" ");return`${n.title||""} ${n.project_key||""} ${c} ${n.agent_nickname||""} ${n.agent_role||""} ${n.project_ref||""} ${n.session_id||""}`.toLowerCase().includes(o)})},[l,k,h,f,$]),O=i.useMemo(()=>{const o=new Set(R.map(c=>c.session_hash)),d=new Map,n=[];for(const c of R){const A=c.root_session_hash||c.parent_session_hash;if(c.parent_session_hash&&A&&o.has(A)){const T=d.get(A)||[];T.push(c),d.set(A,T)}else n.push(c)}return{roots:n,childrenByRoot:d,foldedCount:R.length-n.length}},[R]),Q=k!=="all"||f!=="all"||h!=="all"||g.trim()!=="";i.useEffect(()=>{C(z),S(new Set),E(new Map)},[k,h,f,$,l]);const K=i.useMemo(()=>O.roots.slice(0,N),[O.roots,N]),B=O.roots.length>K.length,G=i.useCallback(()=>C(o=>o+z),[]),ne=i.useCallback(o=>{S(d=>{const n=new Set(d);return n.has(o)?n.delete(o):n.add(o),n})},[]),ie=i.useCallback((o,d)=>{E(n=>{const c=new Map(n);return d==="all"?c.delete(o):c.set(o,d),c})},[]),W=i.useRef(null);i.useEffect(()=>{if(!B||typeof IntersectionObserver>"u")return;const o=W.current;if(!o)return;const d=new IntersectionObserver(n=>{n.some(c=>c.isIntersecting)&&G()},{rootMargin:"400px"});return d.observe(o),()=>d.disconnect()},[B,G]);const le=i.useMemo(()=>Ae.map(o=>({id:o.id,label:o.label()})),[P]),ce=i.useMemo(()=>oe.map(o=>({id:o.id,label:o.label()})),[P]),de=Number(r?.session_count)>Number(r?.returned_count);return!V&&!Z()?e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx(fe,{})}):e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:e.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[e.jsxs("div",{className:"mb-8 flex flex-row items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"mb-3 text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:a("nav.sessions")}),e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400 sm:text-base",children:a("sessions.page.subtitle")})]}),e.jsx("button",{type:"button",onClick:()=>{L(!0)},disabled:u||p,"aria-label":a("sessions.page.refresh"),title:a("sessions.page.refresh"),className:"inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-oai-gray-200 text-oai-gray-600 transition-colors hover:bg-oai-gray-100 hover:text-oai-black focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-400 dark:hover:bg-oai-gray-800 dark:hover:text-white",children:e.jsx(he,{className:F("h-4 w-4",u&&"animate-spin"),"aria-hidden":!0})})]}),e.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2 pt-1 text-xs text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx(J,{ariaLabel:a("sessions.filter.source_aria"),options:le,value:k,onChange:w}),e.jsx(J,{className:"pl-2",ariaLabel:a("sessions.filter.range_aria"),leading:e.jsx(De,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-400","aria-hidden":!0}),options:ce,value:f,onChange:b}),e.jsx(Pe,{options:v,value:h,onChange:D,allLabel:a("sessions.filter.project_all"),searchPlaceholder:a("sessions.filter.project_search"),emptyLabel:a("sessions.filter.project_empty"),ariaLabel:a("sessions.filter.project_aria")}),e.jsxs("div",{className:"relative w-72 max-w-full",children:[e.jsx(ae,{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(be,{type:"search",value:g,onChange:o=>_(o.target.value),onKeyDown:o=>{o.key==="Escape"&&g&&(o.preventDefault(),_(""))},"aria-label":a("sessions.action.search_aria"),placeholder:a("sessions.search.placeholder"),className:"h-8 pl-9 pr-8 !border-oai-gray-200 dark:!border-oai-gray-800 focus:!border-oai-gray-400 focus:!ring-oai-gray-400/20 dark:focus:!border-oai-gray-500 dark:focus:!ring-oai-gray-500/20 [&::-webkit-search-cancel-button]:appearance-none"}),e.jsx("button",{type:"button",onMouseDown:o=>o.preventDefault(),onClick:()=>_(""),"aria-label":a("sessions.action.search_clear"),"aria-hidden":!g,tabIndex:g?0:-1,className:F("absolute right-2 top-1/2 flex h-6 w-6 -translate-y-1/2 items-center justify-center rounded-full text-oai-gray-400 transition duration-150 ease-out hover:bg-oai-gray-100 hover:text-oai-gray-600 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-gray-400/40 dark:hover:bg-oai-gray-800 dark:hover:text-oai-gray-200",g?"scale-100 opacity-100":"pointer-events-none scale-90 opacity-0"),children:e.jsx(ge,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),e.jsx("span",{className:"ml-auto shrink-0 tabular-nums text-oai-gray-500 dark:text-oai-gray-400",children:O.foldedCount>0?a("sessions.thread.result_count",{roots:O.roots.length,subagents:O.foldedCount}):a("sessions.filter.result_count",{filtered:R.length,total:l.length})})]}),de?e.jsx("p",{className:"mb-4 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:a("sessions.truncated",{shown:r.returned_count,total:r.session_count})}):null,s&&!r?e.jsxs("div",{className:"rounded-xl border border-dashed border-red-300 py-16 text-center dark:border-red-500/40",children:[e.jsx("p",{className:"text-sm font-medium text-oai-black dark:text-white",children:a("sessions.error.title")}),e.jsx("p",{className:"mt-1 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s}),e.jsx("button",{type:"button",onClick:()=>{L(!1)},className:"mt-4 inline-flex h-8 items-center rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 hover:text-oai-black focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:border-oai-gray-800 dark:text-oai-gray-200 dark:hover:bg-oai-gray-800 dark:hover:text-white",children:a("sessions.error.retry")})]}):p?e.jsxs("div",{className:"flex items-center gap-2 py-16 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:[e.jsx(Re,{className:"h-4 w-4 animate-spin","aria-hidden":!0}),a("sessions.loading")]}):R.length===0?e.jsxs("div",{className:"rounded-xl border border-dashed border-oai-gray-200 py-16 text-center dark:border-oai-gray-800",children:[e.jsx("p",{className:"text-sm font-medium text-oai-black dark:text-white",children:Q?a("sessions.empty.filtered_title"):a("sessions.empty.title")}),e.jsx("p",{className:"mt-1 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:Q?a("sessions.empty.filtered_body"):a("sessions.empty.body")})]}):e.jsxs(e.Fragment,{children:[s?e.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400",children:a("shared.error.prefix",{error:s})}):null,e.jsx("ul",{className:"divide-y divide-oai-gray-200/70 dark:divide-oai-gray-800/70",children:K.map(o=>{const d=O.childrenByRoot.get(o.session_hash)||[],n=U.has(o.session_hash),c=I.get(o.session_hash)||"all",A=c==="all"?d:d.filter(function(ue){return H(ue).some(xe=>xe.model===c)});return e.jsxs(te.Fragment,{children:[e.jsx(Y,{session:o,locale:P,childCount:d.length,expanded:n,onToggle:()=>ne(o.session_hash)}),n&&d.length?e.jsx(ze,{sessions:d,selectedModel:c,onSelect:T=>ie(o.session_hash,T)}):null,n?A.map(T=>e.jsx(Y,{session:T,locale:P,nested:!0},T.session_hash)):null]},o.session_hash)})}),B?e.jsx("div",{ref:W,className:"flex justify-center pt-6",children:e.jsx("button",{type:"button",onClick:G,className:"inline-flex h-8 items-center rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-600 transition-colors hover:bg-oai-gray-100 hover:text-oai-black focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800 dark:hover:text-white",children:a("sessions.action.load_more")})}):null]}),e.jsx("p",{className:"mt-6 text-xs text-oai-gray-400 dark:text-oai-gray-500",children:a("sessions.privacy")})]})})})}export{ct as SessionsPage};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/__vite-browser-external-CPMSmJgP.js","assets/__vite-browser-external-DrXtuPP9.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{m as I,j as t,e as _,c as n,a as ye,r as d,at as ve,az as ke,aA as je,ab as X,aY as Se,aZ as we,a_ as Ne,u as Ce,d as H,a2 as Ee,J as ee,o as U,a$ as V,n as B,b0 as Ae,b1 as Pe,Z as te,b2 as Oe,t as Le,b3 as _e,b4 as Te,b5 as Ie,b6 as Ge,b7 as Re,b8 as De,b9 as Ue,ba as ne,L as Me,R as He,bb as Fe,bc as $e,a8 as z,_ as Ve,h as Be,f as ze,bd as Ke,be as qe,aC as We}from"./__vite-browser-external-CPMSmJgP.js";import{a as Ze,b as K,s as Ye,K as Je,P as Qe,D as Xe,c as et,S as tt,v as nt,u as at,C as st}from"./sortable.esm-BztIEZTk.js";import{a as it}from"./modifiers.esm-CPBla3OK.js";import{d as q,l as W,u as ot,b as Z}from"./use-limits-display-prefs-CbXApWU1.js";import{P as rt}from"./ProviderIcon-aLwclDsD.js";import{m as ae}from"./react-CZdcuJ28.js";import{a as O,T as j,b,S as T,u as R}from"./Controls-CX4Di57j.js";import{P as lt,u as ct,a as ut}from"./use-session-efficiency-pref-2Vb3tJrw.js";import{C as dt}from"./check-D2K19ObI.js";import{C as gt}from"./copy-CSN17qFv.js";import{A as se}from"./index-CA-94DFW.js";import{u as pt}from"./useCurrency-Dh9pUzDO.js";import{u as ht}from"./useTokenFormat-CoGcVhPP.js";import{S as F}from"./Select-D5uuRQwh.js";import{I as mt}from"./info-BHsPBczD.js";import{C as bt}from"./ConfirmModal-pIUQJ7QM.js";import{A as ft}from"./arrow-up-right-CPxuidzy.js";import{D as xt}from"./download-CpW-TB2h.js";import{i as yt}from"./host-mode-Bc_iTzHk.js";import"./Card-EHkn9ktD.js";import"./ToolbarRootContext-B0cqyD1i.js";import"./composite-BN1UKLj0.js";import"./SelectItemText-Bq_ZdWU0.js";import"./DialogTitle-DuAY9sfZ.js";import"./store-DvdXwk-7.js";import"./DialogDescription-GXslTq2z.js";const ie={name:"flask-conical",size:24,node:[["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"}]]};ie.node;const vt=I(ie);const oe={name:"grip-vertical",size:24,node:[["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"}]]};oe.node;const kt=I(oe);const re={name:"languages",size:24,node:[["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"}]]};re.node;const jt=I(re);const le={name:"log-out",size:24,node:[["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"}]]};le.node;const St=I(le);const ce={name:"palette",size:24,node:[["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"}]]};ce.node;const wt=I(ce);const ue={name:"user-round",size:24,node:[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],aliases:["user-2"]};ue.node;const Nt=I(ue),Ct="shrink-0 text-oai-gray-900 dark:text-oai-gray-200";function Et({checked:e,onChange:a,ariaLabel:s}){return t.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":s,onClick:a,className:_("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:_("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",e?"translate-x-[18px]":"translate-x-[3px]")})})}function At({id:e,visible:a,onToggle:s}){const{attributes:i,listeners:o,setNodeRef:r,transform:l,transition:c,isDragging:u}=at({id:e}),h={transform:st.Transform.toString(l)||void 0,transition:c,zIndex:u?20:void 0};return t.jsxs("div",{ref:r,style:h,className:_("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"),...i,...o,children:[t.jsx(kt,{className:"h-4 w-4 shrink-0 text-oai-gray-400 dark:text-oai-gray-500",strokeWidth:1.75,"aria-hidden":!0}),q(e)?t.jsx(rt,{provider:q(e),size:18,className:_("pointer-events-none",Ct)}):null,t.jsx("span",{className:"flex-1 text-sm text-oai-gray-900 dark:text-oai-gray-200",children:W(e)}),t.jsx("div",{onPointerDown:p=>p.stopPropagation(),children:t.jsx(Et,{checked:a,onChange:s,ariaLabel:`${n("limits.settings.toggle_visible")}: ${W(e)}`})})]})}function Pt({prefs:e}){const{order:a,visibility:s,toggle:i,moveToward:o}=e,r=Ze(K(Qe,{activationConstraint:{distance:6}}),K(Je,{coordinateGetter:Ye})),l=({active:c,over:u})=>{u&&c.id!==u.id&&o(c.id,u.id)};return t.jsx(Xe,{sensors:r,collisionDetection:et,modifiers:[it],onDragEnd:l,children:t.jsx(tt,{items:a,strategy:nt,children:t.jsx("div",{className:"flex flex-col",children:a.map(c=>t.jsx(At,{id:c,visible:s[c]!==!1,onToggle:()=>i(c)},c))})})})}function Ot(e){if(!e||typeof e!="object")return"";const a=e.user_metadata&&typeof e.user_metadata=="object"?e.user_metadata:{},s=e.profile&&typeof e.profile=="object"?e.profile:{},i=a.full_name||a.name||s.name||a.user_name||a.preferred_username;return typeof i=="string"&&i.trim()?i.trim():typeof e.email=="string"&&e.email.includes("@")?e.email.split("@")[0].trim()||e.email.trim():typeof e.email=="string"?e.email.trim():""}function Lt(e){return!e||typeof e!="object"?"":typeof e.email=="string"?e.email.trim():""}function _t(e){const a=typeof e=="string"?e.trim():"";if(!a)return null;const s=a.match(/^@?([A-Za-z0-9][A-Za-z0-9-]{0,38})$/),i=a.match(/^https:\/\/github\.com\/([A-Za-z0-9][A-Za-z0-9-]{0,38})\/?$/i),o=s?.[1]||i?.[1];return o?`https://github.com/${o}`:null}function $(e,a){console.warn(`[tokentracker] settings ${e}:`,a)}function Tt(e,a,s){const[i,o]=d.useState(()=>ve()),r=a&&s&&Ne(),l=d.useCallback(async()=>{const c=!i;if(ke(c),o(c),!!c)try{await je(()=>e())}catch(u){$("cloud sync",u)}},[i,e]);return{cloudSyncOn:i,handleCloudSyncToggle:l,showLocalCloudSync:r}}function It(e){const[a,s]=d.useState(!1),[i,o]=d.useState(!1),[r,l]=d.useState(!1),[c,u]=d.useState(!1),[h,p]=d.useState(null),[g,m]=d.useState(!1),[v,k]=d.useState(""),[P,y]=d.useState(!1),[w,N]=d.useState(""),[f,S]=d.useState(""),[L,x]=d.useState(!1),[E,D]=d.useState(null),G=d.useMemo(()=>Ot(e),[e]),be=d.useMemo(()=>Lt(e),[e]),fe=d.useMemo(()=>typeof e?.id=="string"?e.id.trim():"",[e]),xe=d.useMemo(()=>({setAnonymousOn:o,setCustomDisplayName:p,setGithubUrl:N,setProfileLoading:l,setPublicProfileOn:s,setShowGithubOn:y}),[]);return{anonymousOn:i,customDisplayName:h,displayName:G,editingGithub:L,editingName:g,email:be,githubError:E,githubInput:f,githubUrl:w,loadSetters:xe,nameInput:v,profileLoading:r,profileSaving:c,publicProfileOn:a,setAnonymousOn:o,setCustomDisplayName:p,setEditingGithub:x,setEditingName:m,setGithubError:D,setGithubInput:S,setGithubUrl:N,setNameInput:k,setProfileLoading:l,setProfileSaving:u,setPublicProfileOn:s,setShowGithubOn:y,showGithubOn:P,userId:fe}}function Gt(e,a,s){d.useEffect(()=>{if(!a)return;let i=!0;return s.setProfileLoading(!0),(async()=>{try{const o=await X({getAccessToken:e});if(!i||!o)return;const r=await Se({accessToken:o});if(!i)return;s.setPublicProfileOn(!!r?.enabled),s.setAnonymousOn(!!r?.anonymous),r?.display_name&&s.setCustomDisplayName(r.display_name),s.setShowGithubOn(!!r?.show_github_url),s.setGithubUrl(r?.github_url||"")}catch(o){$("load public profile",o)}finally{i&&s.setProfileLoading(!1)}})(),()=>{i=!1}},[e,a,s])}function Rt(e,a){return d.useCallback(async(s,{label:i,onError:o,onSuccess:r}={})=>{if(a.profileSaving)return!1;a.setProfileSaving(!0);try{const l=await X({getAccessToken:e});if(!l)return!1;const c=await we({accessToken:l,...s});return r?.(c),!0}catch(l){return o?o(l):$(i||"mutate profile",l),!1}finally{a.setProfileSaving(!1)}},[e,a])}function Dt(e,a){return{anonymousOn:e.anonymousOn,customDisplayName:e.customDisplayName,displayName:e.displayName,editingName:e.editingName,handleAnonymousToggle:a.handleAnonymousToggle,handleSaveName:a.handleSaveName,nameInput:e.nameInput,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingName:e.setEditingName,setNameInput:e.setNameInput,startEditingName:a.startEditingName}}function Ut(e,a){return{editingGithub:e.editingGithub,githubError:e.githubError,githubInput:e.githubInput,githubUrl:e.githubUrl,handleSaveGithub:a.handleSaveGithub,handleShowGithubToggle:a.handleShowGithubToggle,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingGithub:e.setEditingGithub,setGithubError:e.setGithubError,setGithubInput:e.setGithubInput,showGithubOn:e.showGithubOn,startEditingGithub:a.startEditingGithub}}function Mt(e,a){const s=d.useCallback(async()=>{const o=!e.publicProfileOn;await a({enabled:o},{label:"toggle public profile",onSuccess:()=>e.setPublicProfileOn(o)})},[a,e]);return{handleAnonymousToggle:d.useCallback(async()=>{const o=!e.anonymousOn;await a({anonymous:o},{label:"toggle anonymous",onSuccess:()=>e.setAnonymousOn(o)})},[a,e]),handlePublicProfileToggle:s}}function Ht(e,a,s){const i=d.useCallback(async()=>{const r=e.nameInput.trim().slice(0,50);r&&await a({display_name:r},{label:"save display name",onSuccess:()=>{e.setCustomDisplayName(r),e.setEditingName(!1),s?.()}})},[a,e,s]),o=d.useCallback(()=>{e.setNameInput(e.customDisplayName||e.displayName),e.setEditingName(!0)},[e]);return{handleSaveName:i,startEditingName:o}}function Ft(e,a){const s=d.useCallback(async()=>{if(!e.showGithubOn&&!e.githubUrl){e.setEditingGithub(!0),e.setGithubInput(""),e.setGithubError(null);return}const r=!e.showGithubOn;await a({show_github_url:r},{label:"toggle GitHub profile",onSuccess:()=>e.setShowGithubOn(r)})},[a,e]),i=d.useCallback(async()=>{const r=_t(e.githubInput);if(e.githubInput.trim()&&!r){e.setGithubError(n("settings.account.githubUrlInvalid"));return}e.setGithubError(null),await a({github_url:r,show_github_url:!!r},{label:"save GitHub profile",onError:l=>e.setGithubError(l?.message||n("settings.account.githubUrlInvalid")),onSuccess:l=>{e.setGithubUrl(l?.github_url||r||""),e.setShowGithubOn(!!r),e.setEditingGithub(!1)}})},[a,e]),o=d.useCallback(()=>{e.setGithubInput(e.githubUrl),e.setGithubError(null),e.setEditingGithub(!0)},[e]);return{handleSaveGithub:i,handleShowGithubToggle:s,startEditingGithub:o}}function $t(){const e=ye(),a=It(e.user),s=Tt(e.getAccessToken,e.enabled,e.signedIn);Gt(e.getAccessToken,e.signedIn,a.loadSetters);const i=Rt(e.getAccessToken,a),o=Mt(a,i),r=Ht(a,i,e.refreshDisplayName),l=Ft(a,i);return{...e,...s,email:a.email,handlePublicProfileToggle:o.handlePublicProfileToggle,userId:a.userId,name:Dt(a,{...o,...r}),github:Ut(a,l),profileLoading:a.profileLoading,profileSaving:a.profileSaving,publicProfileOn:a.publicProfileOn}}function de({disabled:e,onCancel:a,onSave:s,saveLabel:i=n("settings.account.save")}){return t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",onClick:s,disabled:e,className:"rounded-md bg-oai-brand-500 px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-oai-brand-600 disabled:opacity-50",children:i}),t.jsx("button",{type:"button",onClick:a,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:n("settings.account.cancel")})]})}function Vt({nameInput:e,setEditingName:a,setNameInput:s,profileSaving:i,handleSaveName:o}){return t.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[t.jsx("input",{type:"text",value:e,onChange:r=>s(r.target.value),onKeyDown:r=>{r.key==="Enter"&&o(),r.key==="Escape"&&a(!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:n("settings.account.displayName")}),t.jsx(de,{disabled:i||!e.trim(),onCancel:()=>a(!1),onSave:o,saveLabel:i?n("settings.account.saving"):void 0})]})}function Bt({githubError:e,githubInput:a,handleSaveGithub:s,profileSaving:i,setEditingGithub:o,setGithubError:r,setGithubInput:l}){return t.jsxs("div",{className:"mt-2",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("input",{type:"text",value:a,onChange:c=>{l(c.target.value),e&&r(null)},onKeyDown:c=>{c.key==="Enter"&&s(),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:n("settings.account.githubUrlPlaceholder")}),t.jsx(de,{disabled:i,onCancel:()=>{o(!1),r(null)},onSave:s,saveLabel:i?n("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 ge({disabled:e=!1,label:a,onClick:s,title:i}){return t.jsxs("button",{type:"button",onClick:s,disabled:e,title:i,className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-40 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[t.jsx(lt,{className:"h-3.5 w-3.5","aria-hidden":!0}),a]})}function pe({actions:e,editing:a,editor:s,hint:i,label:o}){return t.jsx("div",{className:"py-3",children:t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:o}),a?s:t.jsx("div",{className:"mt-0.5 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:i})]}),a?null:e]})})}function zt({name:e}){const a=e.anonymousOn?n("settings.account.displayNameDisabledWhileAnon"):void 0;return t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsx(ge,{disabled:e.anonymousOn,label:n("settings.account.edit"),onClick:e.startEditingName,title:a}),t.jsx(j,{checked:!e.anonymousOn,onChange:e.handleAnonymousToggle,disabled:e.profileLoading||e.profileSaving,ariaLabel:n("settings.account.displayName")})]})}function Kt({name:e}){const{anonymousOn:a,customDisplayName:s,displayName:i,editingName:o,handleAnonymousToggle:r,handleSaveName:l,nameInput:c,profileLoading:u,profileSaving:h,setEditingName:p,setNameInput:g,startEditingName:m}=e,v=a?n("settings.account.displayNameAnonymousHint"):s||i;return t.jsx(pe,{label:n("settings.account.displayName"),editing:o,hint:v,editor:t.jsx(Vt,{nameInput:c,setEditingName:p,setNameInput:g,profileSaving:h,handleSaveName:l}),actions:t.jsx(zt,{name:e})})}function qt({github:e}){const{editingGithub:a,githubError:s,githubInput:i,githubUrl:o,handleSaveGithub:r,handleShowGithubToggle:l,profileLoading:c,profileSaving:u,setEditingGithub:h,setGithubError:p,setGithubInput:g,showGithubOn:m,startEditingGithub:v}=e;return t.jsx(t.Fragment,{children:t.jsx(pe,{label:n("settings.account.githubUrl"),editing:a,hint:o||n("settings.account.githubUrlHint"),editor:t.jsx(Bt,{githubError:s,githubInput:i,handleSaveGithub:r,profileSaving:u,setEditingGithub:h,setGithubError:p,setGithubInput:g}),actions:t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsx(ge,{label:n("settings.account.edit"),onClick:v}),t.jsx(j,{checked:m,onChange:l,disabled:c||u,ariaLabel:n("settings.account.githubUrl")})]})})})}function Wt(){const{openLoginModal:e}=Ce();return t.jsx(O,{title:n("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:n("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:n("settings.account.signIn")})]})})}function Zt({name:e,github:a}){return t.jsxs(t.Fragment,{children:[t.jsx(Kt,{name:e}),t.jsx(qt,{github:a})]})}function Yt(){const e=$t();return e.enabled?e.signedIn?t.jsxs(O,{title:n("settings.section.account"),subtitle:e.email||e.name.customDisplayName||e.name.displayName,action:t.jsx(Qt,{onSignOut:e.signOut}),children:[t.jsx(Jt,{userId:e.userId}),t.jsx(Xt,{settings:e}),t.jsx(en,{checked:e.publicProfileOn,disabled:e.profileLoading||e.profileSaving,onChange:e.handlePublicProfileToggle}),t.jsx(tn,{visible:e.publicProfileOn,name:e.name,github:e.github})]}):t.jsx(Wt,{}):null}function Jt({userId:e}){const[a,s]=H.useState(!1);if(!e)return null;const i=async()=>{try{if(typeof navigator>"u"||!navigator.clipboard?.writeText)return;await navigator.clipboard.writeText(e),s(!0),globalThis.setTimeout(()=>s(!1),1200)}catch{s(!1)}};return t.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:n("settings.account.userId")}),t.jsx("div",{className:"mt-0.5 truncate font-mono text-xs text-oai-gray-500 dark:text-oai-gray-400",children:e})]}),t.jsxs("button",{type:"button",onClick:i,className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800","aria-label":n("settings.account.copyUserId"),children:[a?t.jsx(dt,{className:"h-3.5 w-3.5","aria-hidden":!0}):t.jsx(gt,{className:"h-3.5 w-3.5","aria-hidden":!0}),a?n("settings.account.copied"):n("settings.account.copy")]})]})}function Qt({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(St,{className:"h-3.5 w-3.5","aria-hidden":!0}),n("settings.account.signOut")]})}function Xt({settings:e}){return e.showLocalCloudSync?t.jsx(b,{label:n("settings.account.cloudSync"),hint:n("settings.account.cloudSyncHint"),control:t.jsx(j,{checked:e.cloudSyncOn,onChange:e.handleCloudSyncToggle,ariaLabel:n("settings.account.cloudSync")})}):null}function en({checked:e,disabled:a,onChange:s}){return t.jsx(b,{label:n("settings.account.publicProfile"),hint:n("settings.account.publicProfileHint"),control:t.jsx(j,{checked:e,onChange:s,disabled:a,ariaLabel:n("settings.account.publicProfile")})})}function tn({visible:e,name:a,github:s}){return t.jsx(se,{initial:!1,children:e?t.jsx(ae.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(Zt,{name:a,github:s})},"public-profile-fields"):null})}function nn(){return[{value:"light",label:n("settings.appearance.theme.light"),Icon:Ae},{value:"dark",label:n("settings.appearance.theme.dark"),Icon:Pe},{value:"system",label:n("settings.appearance.theme.system"),Icon:te}]}function an(){return[{value:_e,label:n("settings.appearance.language.system")},{value:Te,label:n("settings.appearance.language.english")},{value:Ie,label:n("settings.appearance.language.chinese")},{value:Ge,label:n("settings.appearance.language.traditional_chinese")},{value:Re,label:n("settings.appearance.language.japanese")},{value:De,label:n("settings.appearance.language.korean")},{value:Ue,label:n("settings.appearance.language.german")}]}function sn(e){if(!e)return null;try{const a=new Date(e);return Number.isNaN(a.getTime())?null:a.toLocaleString()}catch{return null}}function on(e,a){const s=n(`settings.appearance.currency.rate_source.${e}`),i=sn(a),o=i?n("settings.appearance.currency.rate_updated",{when:i}):n("settings.appearance.currency.rate_never");return`${s} · ${o}`}function rn({locale:e,setLocale:a}){const s=an();return t.jsx(F,{value:e,onValueChange:a,options:s,ariaLabel:n("settings.appearance.language.label"),className:"px-2.5 py-1.5 text-xs font-medium",leadingIcon:t.jsx(jt,{className:"h-3.5 w-3.5 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})})}function ln({currency:e,setCurrency:a}){const s=Oe().map(i=>({value:i.code,label:n(i.labelKey)}));return t.jsx(F,{value:e,onValueChange:a,options:s,ariaLabel:n("settings.appearance.currency.label"),className:"px-3 py-1.5 text-xs font-medium"})}function cn({currency:e,rate:a,rateSource:s,rateFetchedAt:i}){if(e===Le)return t.jsx(t.Fragment,{children:n("settings.appearance.currency.hint")});const o=on(s,i);return t.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[t.jsx("span",{children:`1 USD = ${a.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(mt,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})}function un(){const{theme:e,setTheme:a}=Ee(),{locale:s,setLocale:i}=ee(),{currency:o,rate:r,rateSource:l,rateFetchedAt:c,setCurrency:u}=pt(),{mode:h,setMode:p,unitSystem:g,setUnitSystem:m,grouping:v,setGrouping:k}=ht();return t.jsxs(O,{title:n("settings.section.appearance"),children:[t.jsx(b,{label:n("settings.appearance.theme.label"),hint:n("settings.appearance.theme.hint"),control:t.jsx(T,{options:nn(),value:e,onChange:a})}),t.jsx(b,{label:n("settings.appearance.language.label"),hint:n("settings.appearance.language.hint"),control:t.jsx(rn,{locale:s,setLocale:i})}),t.jsx(b,{label:n("settings.appearance.currency.label"),hint:t.jsx(cn,{currency:o,rate:r,rateSource:l,rateFetchedAt:c}),control:t.jsx(ln,{currency:o,setCurrency:u})}),t.jsx(b,{label:n("settings.appearance.token_format.label"),hint:n("settings.appearance.token_format.hint"),control:t.jsx(T,{options:[{value:U.COMPACT,label:n("settings.appearance.token_format.compact")},{value:U.FULL,label:n("settings.appearance.token_format.full")}],value:h,onChange:p})}),t.jsx(b,{label:n("settings.appearance.token_unit.label"),hint:n("settings.appearance.token_unit.hint"),control:t.jsx(T,{disabled:h!==U.COMPACT,options:[{value:V.ENGLISH,label:n("settings.appearance.token_unit.english")},{value:V.CHINESE,label:n("settings.appearance.token_unit.chinese")}],value:g,onChange:m})}),t.jsx(b,{label:n("settings.appearance.token_grouping.label"),hint:n("settings.appearance.token_grouping.hint"),control:t.jsx(T,{options:[{value:B.THOUSAND,label:n("settings.appearance.token_grouping.thousand")},{value:B.WAN,label:n("settings.appearance.token_grouping.wan")}],value:v,onChange:k})})]})}function M({labelKey:e}){return t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("span",{children:n(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:n("qpd.card.badge")})]})}function dn(){const{enabled:e,toggle:a}=ct(),{enabled:s,toggle:i}=ut(),{available:o,settings:r,setSetting:l}=R(),c=o&&!!r?.dynamicIslandSupported,u=!!r?.dynamicIslandEnabled;return t.jsxs(O,{title:n("settings.section.labs"),children:[c&&t.jsxs(t.Fragment,{children:[t.jsx(b,{label:t.jsx(M,{labelKey:"settings.labs.island.label"}),hint:n("settings.labs.island.hint"),control:t.jsx(j,{checked:u,onChange:()=>l("dynamicIslandEnabled",!u),ariaLabel:n("settings.labs.island.aria")})}),u&&t.jsx(b,{label:n("settings.labs.island_hide_menubar.label"),hint:n("settings.labs.island_hide_menubar.hint"),control:t.jsx(j,{checked:!!r?.hideMenuBarIcon,onChange:()=>l("hideMenuBarIcon",!r?.hideMenuBarIcon),ariaLabel:n("settings.labs.island_hide_menubar.aria")})})]}),t.jsx(b,{label:t.jsx(M,{labelKey:"settings.labs.qpd.label"}),hint:n("settings.labs.qpd.hint"),control:t.jsx(j,{checked:e,onChange:a,ariaLabel:n("settings.labs.qpd.aria")})}),t.jsx(b,{label:t.jsx(M,{labelKey:"settings.labs.sessions.label"}),hint:n("settings.labs.sessions.hint"),control:t.jsx(j,{checked:s,onChange:i,ariaLabel:n("settings.labs.sessions.aria")})})]})}function gn(){const{available:e,settings:a,setSetting:s,runAction:i}=R();if(!e)return null;const o=ne(),r=!!a?.launchAtLogin,l=a?.toastOnReset!==!1,c=a?.confettiOnReset!==!1,u=a?.launchAtLoginSupported!==!1,h=a?.autoUpdateEnabled!==!1,p=a?.updateStatus||null,g=!!a?.updateBusy,m=!!a?.isSyncing;return t.jsxs(O,{title:n("settings.section.menubar"),children:[o?null:t.jsxs(t.Fragment,{children:[t.jsx(b,{label:n("settings.menubar.appearance"),hint:n("settings.menubar.appearanceHint"),control:t.jsxs(Me,{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:[n("settings.menubar.appearanceLink"),t.jsx(ft,{className:"h-3.5 w-3.5","aria-hidden":!0})]})}),t.jsx(b,{label:n("settings.menubar.toastOnReset"),hint:n("settings.menubar.toastOnResetHint"),control:t.jsx(j,{checked:l,onChange:()=>s("toastOnReset",!l),ariaLabel:n("settings.menubar.toastOnReset")})}),t.jsx(b,{label:n("settings.menubar.confettiOnReset"),hint:n("settings.menubar.confettiOnResetHint"),control:t.jsx(j,{checked:c,onChange:()=>s("confettiOnReset",!c),ariaLabel:n("settings.menubar.confettiOnReset")})})]}),u?t.jsx(b,{label:n("settings.menubar.launchAtLogin"),hint:n("settings.menubar.launchAtLoginHint"),control:t.jsx(j,{checked:r,onChange:()=>s("launchAtLogin",!r),ariaLabel:n("settings.menubar.launchAtLogin")})}):null,t.jsx(b,{label:n("settings.menubar.syncNow"),hint:n("settings.menubar.syncNowHint"),control:t.jsxs("button",{type:"button",onClick:()=>i("syncNow"),disabled:m,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[t.jsx(He,{className:_("h-3.5 w-3.5",m&&"animate-spin"),"aria-hidden":!0}),m?n("settings.menubar.syncing"):n("settings.menubar.syncNow")]})}),t.jsx(b,{label:n("settings.menubar.autoUpdate"),hint:n("settings.menubar.autoUpdateHint"),control:t.jsx(j,{checked:h,onChange:()=>s("autoUpdateEnabled",!h),ariaLabel:n("settings.menubar.autoUpdate")})}),t.jsx(b,{label:n("settings.menubar.updates"),hint:p||void 0,control:t.jsxs("button",{type:"button",onClick:()=>i("checkForUpdates"),disabled:g,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[t.jsx(xt,{className:"h-3.5 w-3.5","aria-hidden":!0}),n("settings.menubar.checkUpdates")]})})]})}function pn(e,a){function s(r){return r.replace(/^v/,"").split(".").map(Number)}const i=s(e),o=s(a);for(let r=0;r<Math.max(i.length,o.length);r++){const l=i[r]||0,c=o[r]||0;if(l<c)return!0;if(l>c)return!1}return!1}function hn(){const{available:e,settings:a,runAction:s}=R(),i=e&&a?.version,o=a?.platform||"macos",[r,l]=H.useState(!1),[c,u]=H.useState({open:!1,latestVersion:"",htmlUrl:""}),{resolvedLocale:h}=ee(),p="1.1.13",g=async()=>{l(!0);try{const y=await fetch("https://api.github.com/repos/xiufengsun/TokenTracker/releases/latest");if(!y.ok)throw new Error("Failed to fetch");const w=await y.json(),N=w.tag_name;pn(p,N)?u({open:!0,latestVersion:N,htmlUrl:w.html_url}):z({title:n("settings.menubar.updates.upToDate")})}catch(y){console.error("Check updates failed:",y),z({title:n("settings.menubar.updates.failed")})}finally{l(!1)}},m=n("settings.menubar.updates.modalTitle"),v=n("settings.menubar.updates.modalDescription",{version:c.latestVersion}),k=n("settings.menubar.updates.modalConfirm"),P=n("settings.menubar.updates.modalCancel");return t.jsxs("div",{className:"mt-6 flex flex-col items-center justify-center gap-4 text-xs text-oai-gray-500 dark:text-oai-gray-500",children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[i?t.jsxs(t.Fragment,{children:[t.jsx("span",{children:o==="windows"?n("settings.menubar.updates.footerCore",{version:a.version}):n("settings.menubar.updates.footerCombined",{barVersion:a.version,coreVersion:p})}),t.jsx("span",{"aria-hidden":!0,children:"·"}),t.jsx("button",{type:"button",onClick:()=>s("openAbout"),className:"underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300",children:"GitHub"}),t.jsx("span",{"aria-hidden":!0,children:"·"})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{children:n("settings.menubar.updates.footerCore",{version:p})}),t.jsx("span",{"aria-hidden":!0,children:"·"}),t.jsx("button",{type:"button",onClick:g,disabled:r,className:"underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300 disabled:opacity-50",children:r?n("settings.menubar.updates.checking"):n("settings.menubar.checkUpdates")}),t.jsx("span",{"aria-hidden":!0,children:"·"})]}),t.jsxs("a",{href:Fe,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($e,{className:"h-3.5 w-3.5","aria-hidden":!0}),n("settings.footer.statusPage")]})]}),t.jsx(bt,{open:c.open,title:m,description:v,confirmLabel:k,cancelLabel:P,onConfirm:()=>{window.open(c.htmlUrl,"_blank"),u(y=>({...y,open:!1}))},onCancel:()=>u(y=>({...y,open:!1}))})]})}const mn=()=>[{value:"system",label:n("settings.network.mode.system")},{value:"manual",label:n("settings.network.mode.manual")},{value:"off",label:n("settings.network.mode.off")}],bn=()=>[{value:"http",label:n("settings.network.protocol.http")},{value:"https",label:n("settings.network.protocol.https")},{value:"socks5",label:n("settings.network.protocol.socks5")}],Y="w-full 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";function J(e){const a={},s=String(e.host||"").trim();(!s||/:\/\//.test(s)||s.includes("/"))&&(a.host=n("settings.network.error.host"));const i=String(e.port??"").trim(),o=Number(i);return(!i||!/^\d+$/.test(i)||!Number.isInteger(o)||o<1||o>65535)&&(a.port=n("settings.network.error.port")),a}function fn({proxySettings:e}){const{config:a,save:s,testConnection:i}=e,[o,r]=d.useState(()=>({mode:a.mode,protocol:a.protocol||"http",host:a.host||"",port:a.port||""})),[l,c]=d.useState({}),[u,h]=d.useState(!1),[p,g]=d.useState(""),[m,v]=d.useState(null),[k,P]=d.useState(!1),[y,w]=d.useState(null);d.useEffect(()=>{r({mode:a.mode,protocol:a.protocol||"http",host:a.host||"",port:a.port||""})},[a.mode,a.protocol,a.host,a.port]);const N=d.useMemo(()=>a.effective==="manual"?n("settings.network.effective.manual"):a.effective==="env"?n("settings.network.effective.env"):a.effective==="system"?n("settings.network.effective.system"):a.effective==="blocked"?n("settings.network.effective.blocked"):n("settings.network.effective.none"),[a.effective]),f=x=>{r(E=>({...E,...x})),c({}),g(""),v(null),w(null)},S=async()=>{if(o.mode==="manual"){const x=J(o);if(Object.keys(x).length){c(x);return}}h(!0),g(""),v(null);try{await s(o),g("saved")}catch(x){g("error"),v(x)}finally{h(!1)}},L=async()=>{const x=J(o);if(Object.keys(x).length){c(x);return}P(!0),w(null);try{const E=await i(o);w(E)}catch(E){w({ok:!1,error:E?.message||String(E)})}finally{P(!1)}};return t.jsxs(O,{title:n("settings.section.network"),subtitle:N,children:[a.applyError?t.jsx("p",{role:"alert",className:"mb-3 text-xs text-red-600 dark:text-red-400",children:n("settings.network.apply_error",{error:a.applyError})}):null,t.jsx(b,{label:n("settings.network.mode.label"),hint:n("settings.network.mode.hint"),control:t.jsx(T,{options:mn(),value:o.mode,onChange:x=>f({mode:x})})}),t.jsx(se,{initial:!1,children:o.mode==="manual"?t.jsxs(ae.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(b,{label:n("settings.network.protocol.label"),control:t.jsx(F,{value:o.protocol,onValueChange:x=>f({protocol:x}),options:bn(),ariaLabel:n("settings.network.protocol.label"),className:"px-2.5 py-1.5 text-xs font-medium"})}),t.jsx(b,{label:n("settings.network.host.label"),hint:l.host,control:t.jsx("input",{type:"text",value:o.host,onChange:x=>f({host:x.target.value}),placeholder:n("settings.network.host.placeholder"),autoComplete:"off",spellCheck:!1,"aria-invalid":l.host?!0:void 0,"aria-label":n("settings.network.host.label"),className:Y})}),t.jsx(b,{label:n("settings.network.port.label"),hint:l.port,control:t.jsx("input",{type:"text",inputMode:"numeric",value:o.port,onChange:x=>f({port:x.target.value}),placeholder:n("settings.network.port.placeholder"),autoComplete:"off",spellCheck:!1,"aria-invalid":l.port?!0:void 0,"aria-label":n("settings.network.port.label"),className:Y})}),t.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2 py-3",children:[t.jsx("button",{type:"button",onClick:L,disabled:k||u,className:"rounded-md border border-oai-gray-200 px-3 py-1.5 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:k?n("settings.network.test.testing"):n("settings.network.test")}),t.jsx("button",{type:"button",onClick:S,disabled:u||k,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:u?n("settings.network.saving"):n("settings.network.save")})]}),y?t.jsx("p",{className:"py-2 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:y.ok?n("settings.network.test.ok",{status:String(y.status??"")}):n("settings.network.test.fail",{error:y.error||""})}):null]},"manual-proxy-fields"):t.jsx("div",{className:"flex justify-end py-3",children:t.jsx("button",{type:"button",onClick:S,disabled:u,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:u?n("settings.network.saving"):n("settings.network.save")})},"non-manual-save")}),p==="saved"?t.jsx("p",{className:"py-2 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:n("settings.network.saved")}):null,p==="error"?t.jsx("p",{role:"alert",className:"py-2 text-xs text-red-600 dark:text-red-400",children:m?.unprotected?n("settings.network.save_error_unprotected",{error:m?.message||String(m||"")}):n("settings.network.save_error",{error:m?.message||String(m||"")})}):null]})}const he="/functions/tokentracker-proxy-config",xn="/functions/tokentracker-proxy-test",yn={mode:"system",protocol:"http",host:"",port:"",effective:"none",applyError:null};function me(e){return!e||typeof e.mode!="string"?null:{mode:e.mode,protocol:typeof e.protocol=="string"?e.protocol:"http",host:typeof e.host=="string"?e.host:"",port:e.port==null||e.port===0?"":String(e.port),effective:typeof e.effective=="string"?e.effective:"none",applyError:typeof e.applyError=="string"&&e.applyError.trim()?e.applyError:null}}async function vn(){const e=await fetch(he,{method:"GET",headers:{Accept:"application/json"},cache:"no-store"});if(!e.ok)return null;const a=await e.json().catch(()=>null);return me(a)}async function Q(){const{getLocalApiAuthHeaders:e}=await Ve(async()=>{const{getLocalApiAuthHeaders:a}=await import("./__vite-browser-external-CPMSmJgP.js").then(s=>s.dg);return{getLocalApiAuthHeaders:a}},__vite__mapDeps([0,1]));return e()}function kn(){const[e,a]=d.useState(!1),[s,i]=d.useState(!0),[o,r]=d.useState(yn);d.useEffect(()=>{if(!yt()){a(!1),i(!1);return}let u=!1;return(async()=>{try{const h=await vn();if(u)return;if(!h){a(!1),i(!1);return}r(h),a(!0),i(!1)}catch{u||(a(!1),i(!1))}})(),()=>{u=!0}},[]);const l=d.useCallback(async u=>{const h=await Q(),p=await fetch(he,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json",...h},cache:"no-store",body:JSON.stringify({mode:u.mode,protocol:u.protocol,host:u.host,port:u.port===""?0:Number(u.port)})}),g=await p.json().catch(()=>null);if(!p.ok){const v=g&&typeof g.error=="string"?g.error:`HTTP ${p.status}`;throw new Error(v)}const m=me(g);if(m&&r(m),g&&g.ok===!1){const v=g&&typeof g.applyError=="string"&&g.applyError||g&&typeof g.error=="string"&&g.error||`HTTP ${p.status}`,k=new Error(v);throw g.unprotected===!0&&(k.unprotected=!0),k}return m||g},[]),c=d.useCallback(async u=>{const h=await Q(),p=await fetch(xn,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json",...h},cache:"no-store",body:JSON.stringify({protocol:u.protocol,host:u.host,port:u.port===""?0:Number(u.port)})}),g=await p.json().catch(()=>null);if(!g||typeof g.ok!="boolean")throw new Error(g&&typeof g.error=="string"?g.error:`HTTP ${p.status}`);return g},[]);return{available:e,loading:s,config:o,save:l,testConnection:c}}const C={APPEARANCE:"appearance",NATIVE_APP:"native-app",NETWORK:"network",ACCOUNT:"account",LIMITS:"limits",LABS:"labs"},A={PERSONAL:"personal",APP:"app",DEVELOPER:"developer"};function jn({prefs:e}){return t.jsx(T,{options:[{value:Z.USED,label:n("limits.settings.display_mode_used")},{value:Z.REMAINING,label:n("limits.settings.display_mode_remaining")}],value:e.displayMode,onChange:e.setDisplayMode})}function Zn(){const e=ot(),{available:a,settings:s,setSetting:i}=R(),o=kn(),{available:r}=o,l=s?.toastOnReset!==!1,c=s?.confettiOnReset!==!1,u=ne()||s?.platform==="windows",[h,p]=Be(),g=ze(),m=h.get("section"),k=Object.values(C).includes(m)&&(m!==C.NATIVE_APP||a)&&(m!==C.NETWORK||r)?m:C.APPEARANCE,P=f=>{const S=new URLSearchParams(h);f===C.APPEARANCE?S.delete("section"):S.set("section",f),p(S,{replace:!0})},y=[{id:C.APPEARANCE,label:n("settings.section.appearance"),description:n("settings.section.appearance.description"),group:A.PERSONAL,Icon:wt,content:t.jsx(un,{})},...a?[{id:C.NATIVE_APP,label:n("settings.section.menubar"),description:n("settings.section.menubar.description"),group:A.APP,Icon:te,content:t.jsx(gn,{})}]:[],...r?[{id:C.NETWORK,label:n("settings.section.network"),description:n("settings.section.network.description"),group:A.APP,Icon:Ke,content:t.jsx(fn,{proxySettings:o})}]:[],{id:C.ACCOUNT,label:n("settings.section.account"),description:n("settings.section.account.description"),group:A.PERSONAL,Icon:Nt,content:t.jsx(Yt,{})},{id:C.LIMITS,label:n("settings.section.limits"),description:n("settings.section.limits.description"),group:A.APP,Icon:qe,content:t.jsxs("div",{className:"space-y-4",children:[t.jsxs(O,{title:n("settings.section.limits"),children:[t.jsx(b,{label:n("limits.settings.display_mode_label"),control:t.jsx(jn,{prefs:e})}),u?null:t.jsxs(t.Fragment,{children:[t.jsx(b,{label:n("settings.menubar.toastOnReset"),hint:n("settings.menubar.toastOnResetHint"),control:t.jsx(j,{checked:l,disabled:!a,onChange:()=>i("toastOnReset",!l),ariaLabel:n("settings.menubar.toastOnReset")})}),t.jsx(b,{label:n("settings.menubar.confettiOnReset"),hint:n("settings.menubar.confettiOnResetHint"),control:t.jsx(j,{checked:c,disabled:!a,onChange:()=>i("confettiOnReset",!c),ariaLabel:n("settings.menubar.confettiOnReset")})})]}),t.jsx(b,{label:n("settings.limits.showSubscriptions"),hint:n("settings.limits.showSubscriptionsHint"),control:t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("button",{type:"button",onClick:()=>g("/limits?openSubscriptions=1"),"aria-label":n("limits.page.openSubscriptions"),title:n("limits.page.openSubscriptions"),className:"inline-flex h-7 w-7 items-center justify-center rounded-md border border-oai-gray-200 dark:border-oai-gray-700 bg-white dark:bg-oai-gray-900 text-oai-gray-500 dark:text-oai-gray-400 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",children:t.jsx(We,{size:14,"aria-hidden":!0})}),t.jsx(j,{checked:e.showSubscriptions!==!1,onChange:()=>e.setShowSubscriptions(!e.showSubscriptions),ariaLabel:n("settings.limits.showSubscriptions")})]})})]}),t.jsx(O,{title:n("settings.limits.providers"),children:t.jsx(Pt,{prefs:e})})]})},{id:C.LABS,label:n("settings.section.labs"),description:n("settings.section.labs.description"),group:A.DEVELOPER,Icon:vt,content:t.jsx(dn,{})}],w=[{id:A.PERSONAL,label:n("settings.nav.group.personal")},{id:A.APP,label:n("settings.nav.group.app")},{id:A.DEVELOPER,label:n("settings.nav.group.developer")}].map(f=>({...f,sections:y.filter(S=>S.group===f.id)})).filter(f=>f.sections.length>0);let N=y[0];for(const f of y)if(f.id===k){N=f;break}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.jsxs("div",{className:"mb-7 max-w-2xl",children:[t.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:n("settings.page.title")}),t.jsx("p",{className:"mt-2 text-sm leading-6 text-oai-gray-500 dark:text-oai-gray-400 sm:text-base",children:n("settings.page.subtitle")})]}),t.jsxs("div",{className:"grid min-w-0 gap-6 md:grid-cols-[14rem_minmax(0,1fr)] md:gap-8 lg:grid-cols-[15rem_minmax(0,1fr)]",children:[t.jsx("aside",{className:"min-w-0 rounded-xl border border-oai-gray-200 bg-oai-gray-50/70 p-2 dark:border-oai-gray-800 dark:bg-oai-gray-900/60 md:border-0 md:bg-transparent md:p-0 md:dark:bg-transparent",children:t.jsx("nav",{"aria-label":n("settings.page.title"),className:"flex gap-1 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden md:sticky md:top-6 md:flex-col md:gap-4 md:overflow-visible",children:w.map(({id:f,label:S,sections:L})=>t.jsxs("div",{className:"flex shrink-0 gap-1 md:block",children:[t.jsx("div",{className:"hidden px-3 pb-1 text-[10px] font-semibold uppercase tracking-[0.16em] text-oai-gray-400 dark:text-oai-gray-500 md:block",children:S}),t.jsx("div",{className:"flex gap-1 md:flex-col",children:L.map(({id:x,label:E,Icon:D})=>{const G=k===x;return t.jsxs("button",{id:`settings-nav-${x}`,type:"button","aria-current":G?"page":void 0,"aria-controls":`settings-panel-${x}`,onClick:()=>P(x),className:_("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",G?"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(D,{className:_("h-4 w-4 shrink-0",G?"text-oai-black dark:text-white":"text-oai-gray-400 dark:text-oai-gray-500"),"aria-hidden":!0}),t.jsx("span",{className:"truncate",children:E})]},x)})})]},f))})}),t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"mb-4 border-b border-oai-gray-200 pb-4 dark:border-oai-gray-800",children:[t.jsx("h2",{className:"text-xl font-semibold tracking-tight text-oai-black dark:text-white",children:N.label}),t.jsx("p",{className:"mt-1 text-sm leading-5 text-oai-gray-500 dark:text-oai-gray-400",children:N.description})]}),y.map(({id:f,label:S,content:L})=>t.jsx("section",{id:`settings-panel-${f}`,"aria-labelledby":`settings-nav-${f}`,"aria-label":S,"data-settings-panel":f,hidden:k!==f,children:L},f)),t.jsx(hn,{})]})]})]})})})}export{Zn as SettingsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{m as yt,r as i,w as xa,j as e,X as Le,c as r,e as se,aD as ua,aE as bt,v as kt,aF as wt,aG as vt,E as jt,aH as Nt,aI as Ct,aJ as St,aK as _t,x as It,aL as Lt,aM as Rt,aN as Pt,aO as Bt,a7 as Dt,a as Et,aP as Tt,at as At,H as Ot,B as X,R as $t,d as Mt,aQ as Ut,a8 as G}from"./__vite-browser-external-CPMSmJgP.js";import{L as Ft,I as ha}from"./LocalOnlyNotice-CAQTnlaI.js";import{C as zt}from"./Card-EHkn9ktD.js";import{C as da}from"./ConfirmModal-pIUQJ7QM.js";import{S as Vt}from"./SegmentedControl-2O_XVL8u.js";import{I as Ra}from"./info-BHsPBczD.js";import{P as ve}from"./ProviderIcon-aLwclDsD.js";import{m as wa}from"./react-CZdcuJ28.js";import{u as Kt}from"./useCurrency-Dh9pUzDO.js";import{E as ma}from"./external-link-ChBchK6G.js";import{L as Y}from"./loader-circle-DTIT1Uk1.js";import{M as Pa}from"./monitor-smartphone-CbsYB-S2.js";import{C as Re}from"./check-D2K19ObI.js";import{T as pa}from"./trash-D0ptaWPk.js";import{A as Ht}from"./index-CA-94DFW.js";import{u as qt}from"./use-reduced-motion-Dpq-cKyM.js";import{u as Wt,k as Gt,l as Qt,m as Xt,n as Jt,o as Yt,p as Zt,q as er,S as Ba,c as Da,d as Ea,e as Ta,f as Aa,g as Oa,h as ta,j as ra,i as sa}from"./SelectItemText-Bq_ZdWU0.js";import{t as ar,u as $a,a as tr}from"./composite-BN1UKLj0.js";import{u as rr,C as fa}from"./ToolbarRootContext-B0cqyD1i.js";import{g as sr,a as nr,p as ir,m as or,b as lr,d as dr,c as cr,e as ur,f as mr,s as gr,i as xr,u as va,h as ja,r as hr,j as Na,k as Ca,l as Sa,n as pr,o as fr}from"./skills-api-CIyqyk-w.js";import{F as yr}from"./flame-f7119ZMd.js";import{S as ga}from"./search-q2ARMGca.js";import{P as Ma}from"./plus-CZiNoMsy.js";import{D as Ua}from"./download-CpW-TB2h.js";import{P as Fa,a as za,b as Va,c as Ka,d as Ha}from"./PopoverPopup-Btcu7vU0.js";import"./arrow-up-right-CPxuidzy.js";import"./DialogTitle-DuAY9sfZ.js";import"./store-DvdXwk-7.js";import"./DialogDescription-GXslTq2z.js";const qa={name:"circle-arrow-up",size:24,node:[["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"}]],aliases:["arrow-up-circle"]};qa.node;const ya=yt(qa),Wa=i.forwardRef(function(s,d){const{render:l,className:p,style:g,...x}=s,v={open:Wt().useState("open")};return xa("span",s,{state:v,ref:d,props:[{"aria-hidden":!0,children:"▼"},x],stateAttributesMapping:ar})}),br="tt:hint:dismissed:";function Ga(a){return br+a}function kr(a){if(typeof window>"u")return!1;try{return window.localStorage.getItem(Ga(a))==="1"}catch{return!1}}function wr({id:a,children:s,className:d,ariaLabel:l}){const[p,g]=i.useState(()=>kr(a)),x=i.useCallback(()=>{if(typeof window<"u")try{window.localStorage.setItem(Ga(a),"1")}catch{}g(!0)},[a]);return p?null:e.jsxs("div",{role:"note","aria-label":l||r("hint.dismissible_aria"),className:se("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:x,"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(Le,{className:"h-4 w-4","aria-hidden":"true"})}),e.jsxs("div",{className:"flex items-start gap-2 pr-8",children:[e.jsx(Ra,{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 vr(a){if(!a)return null;for(const s of a.elements){const d=s.tagName;if(d==="BUTTON"||d==="INPUT"){const l=s;if(l.type==="submit")return l}}return null}const jr="data-checked",Nr="data-unchecked";function Qa(a){return{checked(s){return a.indeterminate?{}:s?{[jr]:""}:{[Nr]:""}},...Gt}}const Cr=i.createContext({disabled:!1});function Sr(){return i.useContext(Cr)}function _r(a,s,d,l=!0,p){const[g,x]=i.useState(),c=$a(p?`${p}-label`:void 0),y=a??s??g;return ua(()=>{const v=a||s||!l?void 0:Ir(d.current,c);g!==v&&x(v)}),y}function Ir(a,s){const d=Lr(a);if(d)return!d.id&&s&&(d.id=s),d.id||void 0}function Lr(a){if(!a)return;const s=a.parentElement;if(s&&s.tagName==="LABEL")return s;const d=a.id;if(d){const p=a.nextElementSibling;if(p&&p.htmlFor===d)return p}const l=a.labels;return l&&l[0]}const Rr=i.createContext(void 0);function Pr(){return i.useContext(Rr)}const Xa=i.createContext(void 0);function Br(){const a=i.useContext(Xa);if(a===void 0)throw new Error(bt(14));return a}const Dr="data-parent",Er=i.forwardRef(function(s,d){const{checked:l,className:p,defaultChecked:g=!1,"aria-labelledby":x,disabled:c=!1,form:y,id:v,indeterminate:f=!1,inputRef:N,name:I,onCheckedChange:u,parent:j=!1,readOnly:m=!1,render:C,required:P=!1,uncheckedValue:$,value:M,nativeButton:K=!1,style:de,...pe}=s,{clearErrors:ne}=Qt(),{disabled:B,name:fe,setDirty:_,setFilled:U,setFocused:H,setTouched:E,state:Z,validationMode:J,validityData:je,validation:ce}=Xt(),Pe=Sr(),{labelId:qe,registerControlId:Be,getDescriptionProps:De}=Jt(),S=Pr(),L=S?.allValues===void 0?void 0:S.parent,q=L!==void 0,D=B||Pe.disabled||S?.disabled||c,ee=fe??I,R=M??ee,Ne=$a(),Ee=S?.registerControlId!==Be,ie=Yt({id:v||void 0,enabled:Ee}),Te=K?ie:Ne;let ue={};q&&(j?ue=L.getParentProps():R!==void 0&&(ue=L.getChildProps(R)));const{checked:Ae=l,indeterminate:Oe=f,onCheckedChange:We,...Ce}=ue,$e=S?.value,me=i.useRef(null),{getButtonProps:Ge,buttonRef:Me}=kt({disabled:D,native:K}),ae=S?.validation??ce,[T,Se]=Zt({controlled:R!==void 0&&$e!==void 0&&!j?$e.includes(R):Ae,default:g,name:"Checkbox",state:"checked"}),ge=q?!!Ae:T,W=q&&Oe||f;er(me,Ne,T,void 0,!S&&!D,I);const xe=L?.registerChildId,A=i.useRef(null),Ue=ae.registerInput,ye=S?R:void 0,_e=i.useCallback(k=>Ue(k,{controlRef:me,value:ye}),[Ue,ye]),ia=wt(N,A,j?void 0:_e),Qe=_r(x,qe,A,!K,ie);ua(()=>{A.current&&(A.current.indeterminate=W),S||U(T)},[T,W,S,U]),rr(T,()=>{S||(ne(ee),_(T!==je.initialValue),ae.change(T))});const Xe=vt({checked:T,disabled:D,form:y,name:j?void 0:ee,id:K?void 0:ie,required:P,ref:ia,style:ee?St:_t,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(k){if(k.nativeEvent.defaultPrevented)return;if(m){k.preventDefault();return}const z=k.currentTarget.checked,oe=It(Lt,k.nativeEvent);if(u?.(z,oe),!oe.isCanceled&&(We?.(z,oe),!oe.isCanceled&&(Se(z),R!==void 0&&S!==void 0&&!j&&!q))){const te=z?[...S.value,R]:S.value.filter(Ie=>Ie!==R);S.setValue(te,oe)}},onClick(k){k.stopPropagation()},onFocus(){me.current?.focus()}},M!==void 0?{value:(S?T&&M:M)||""}:jt,De,k=>ae.getValidationProps(D,k));i.useEffect(()=>{if(!L||R===void 0)return;const k=L.disabledStatesRef.current;return k.set(R,D),()=>{k.delete(R)}},[L,D,R]);const F=i.useMemo(()=>({...Z,checked:ge,disabled:D,readOnly:m,required:P,indeterminate:W}),[Z,ge,D,m,P,W]),oa=Qa(F),Je=xa("span",s,{state:F,ref:[Me,me,d],props:[{id:Te,role:"checkbox","aria-checked":W?"mixed":ge,"aria-readonly":m||void 0,"aria-required":P||void 0,"aria-labelledby":Qe,[Dr]:j?"":void 0,onFocus(){D||H(!0)},onBlur(){const k=A.current;k&&(E(!0),H(!1),J==="onBlur"&&ae.commit(S?$e:k.checked))},onKeyDown(k){if(k.key!=="Enter"||(k.preventBaseUIHandler(),k.defaultPrevented))return;const z=A.current?.form??null,oe=k.currentTarget,te=k.nativeEvent,Ie=k.preventDefault,ze=te.preventDefault;let Ve=!1;k.preventDefault=()=>{Ve=!0,Ie.call(k)},te.preventDefault=()=>{Ve=!0,ze.call(te)},ze.call(te),Ct(oe).queueMicrotask(()=>{k.preventDefault=Ie,te.preventDefault=ze,Ve||vr(z)?.click()})},onClick(k){if(m||D)return;k.preventDefault();const z=A.current;z&&Nt(z,k)}},pe,Ce,Ge,De,k=>ae.getValidationProps(D,k)],stateAttributesMapping:oa}),Fe=Je.props.id;return ua(()=>{if(!(!xe||j||R===void 0||Fe===void 0))return xe(R,Fe)},[xe,j,R,Fe]),e.jsxs(Xa.Provider,{value:F,children:[Je,!T&&!S&&ee&&!j&&$!==void 0&&e.jsx("input",{type:"hidden",form:y,name:ee,value:$,disabled:D}),e.jsx("input",{...Xe,suppressHydrationWarning:!0})]})}),Tr=i.forwardRef(function(s,d){const{render:l,className:p,style:g,keepMounted:x=!1,...c}=s,y=Br(),v=y.checked||y.indeterminate,{mounted:f,transitionStatus:N,setMounted:I}=tr(v),u=i.useRef(null),j={...y,transitionStatus:N};Rt({batch:!0,enabled:!v,open:v,ref:u,onComplete(){v||I(!1)}});const C={...Qa(y),...Pt},P=x||f,$=xa("span",s,{ref:[d,u],state:j,stateAttributesMapping:C,props:c});return P?$:null});function Ar(a,s){return`target:${a}:${s}`}function Or(a){return`remove:${a.id||a.directory}`}function Ja(a){if(!a)return null;const s=new Date(a).getTime();return Number.isFinite(s)?Math.floor((Date.now()-s)/864e5):null}function $r(a){const s=Ja(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 Mr(a){const s=Ja(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 ca({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 Ur({skill:a,targets:s,busyKey:d,usage:l,hasUpdate:p,updating:g,onUpdate:x,onClose:c,onToggleTarget:y,onRemove:v}){return e.jsx(Ht,{children:a?e.jsx(Fr,{skill:a,targets:s,busyKey:d,usage:l,hasUpdate:p,updating:g,onUpdate:x,onClose:c,onToggleTarget:y,onRemove:v},a.id||a.directory):null})}function Fr({skill:a,targets:s,busyKey:d,usage:l,hasUpdate:p,updating:g,onUpdate:x,onClose:c,onToggleTarget:y,onRemove:v}){const f=qt(),{currency:N,rate:I}=Kt(),u=i.useRef(null);i.useEffect(()=>{const _=H=>{H.key==="Escape"&&(H.stopPropagation(),c?.())},U=H=>{const E=H.target;E instanceof Element&&(u.current?.contains(E)||E.closest('[data-skill-row="1"]')||c?.())};return document.addEventListener("keydown",_),document.addEventListener("pointerdown",U),()=>{document.removeEventListener("keydown",_),document.removeEventListener("pointerdown",U)}},[c]);const j=a.name||a.directory,m=!!(a.repoOwner&&a.repoName),C=m?`https://github.com/${a.repoOwner}/${a.repoName}`:null,P=new Set(a.targets||[]),$=!!(a.readOnly||a.remote),M=!!a.remote,K=Array.isArray(a.deviceSources)?a.deviceSources:[],de=!M&&(!$||P.has("claude")),pe=d===Or(a),ne=$r(l?.lastUsedAt),B=!!(l&&l.invocations>0),fe=f?{duration:0}:{type:"spring",stiffness:320,damping:30,mass:.7};return e.jsxs(e.Fragment,{children:[e.jsx(wa.div,{className:"fixed inset-0 z-20 bg-oai-black/30 backdrop-blur-[2px] lg:hidden",initial:f?!1:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:f?0:.15},onClick:c,"aria-hidden":!0}),e.jsxs(wa.aside,{ref:u,role:"complementary","aria-label":j,initial:f?!1:{opacity:0,x:24,scale:.98},animate:{opacity:1,x:0,scale:1},exit:f?{opacity:0}:{opacity:0,x:24,scale:.98},transition:fe,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:j,children:j}),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(ma,{className:"h-3 w-3 shrink-0","aria-hidden":!0})]}):a.directory&&a.directory!==j?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(Le,{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:[p?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(ya,{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:()=>x?.(a),disabled:g||!!d,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:[g?e.jsx(Y,{className:"h-3 w-3 animate-spin","aria-hidden":!0}):null,r("skills.update.action")]})]}):null,a.description?e.jsx("p",{className:"text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:a.description}):null,$?e.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(M?"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,K.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:K.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(Pa,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),e.jsx("span",{className:"max-w-52 truncate",children:_.name})]},_.id))})]}):null,de?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(ca,{label:r("skills.usage.invocations"),children:Bt(l?.invocations||0)}),e.jsx(ca,{label:r("skills.usage.last_used"),children:e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx("span",{className:se("h-1.5 w-1.5 rounded-full",Mr(l?.lastUsedAt)),"aria-hidden":!0}),B?ne||r("skills.usage.unknown"):r("skills.usage.never")]})}),e.jsx(ca,{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(Ra,{className:"h-3 w-3","aria-label":r("skills.usage.disclaimer")})})]}),children:Dt(l?.cost||0,{currency:N,rate:I})})]}),B?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,$?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 U=P.has(_.id),H=d===Ar(a.id||a.directory,_.id),E=`skill-detail-sync-${a.id||a.directory}-${_.id}`;return e.jsxs("label",{htmlFor:E,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(Er,{id:E,checked:U,disabled:!!d,onCheckedChange:Z=>y?.(a,_.id,!!Z),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(Tr,{className:"flex items-center justify-center text-white dark:text-oai-black",children:e.jsx(Re,{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(ve,{provider:_.id,size:16})}),e.jsx("span",{className:"flex-1",children:_.label}),H?e.jsx(Y,{className:"h-3.5 w-3.5 animate-spin text-oai-gray-400","aria-hidden":!0}):null]},_.id)})})]})]}),$?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:()=>v?.(a),disabled:!!d,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:[pe?e.jsx(Y,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):e.jsx(pa,{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 zr=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),_a=["claude","codex"],Q="popular",Vr={claude:"text-orange-500 dark:text-orange-300",codex:"text-emerald-600 dark:text-emerald-300",grok:"text-zinc-700 dark:text-zinc-200",antigravity:"text-violet-600 dark:text-violet-300",gemini:"text-sky-600 dark:text-sky-300",opencode:"text-amber-600 dark:text-amber-300",hermes:"text-indigo-500 dark:text-indigo-300"},he="all",V="skillssh";function na(a){return`${a.repoOwner||"local"}/${a.repoName||"local"}:${a.directory}`}function Ya(a){return String(a||"").replace(/\\/g,"/").trim().toLowerCase()}function Kr(a){return Ya(a).split("/").filter(Boolean).pop()||""}function Hr(a){if(a.repoOwner||a.repoName)return"";const s=Ya(a.directory);return!s||s.includes("/")?"":`dir:${s}`}function Ia(a){const s=Kr(a.directory);return s?`dir:${s}`:""}function Za(a){const s=new Set([na(a).toLowerCase()]);a.repoOwner&&a.repoName&&s.add(`${a.repoOwner}/${a.repoName}:${a.sourceDirectory||a.directory}`.toLowerCase());const d=Hr(a);return d&&s.add(d),s}function qr(a){return!a?.remote&&!a?.inventoryOnly&&!a?.readOnly}function Wr(a){const s=new Set;for(const d of Array.isArray(a)?a:[])if(qr(d))for(const l of Za(d))s.add(l);return s}function aa(a){return`install:${na(a)}`}function La(a){return`remove:${a.id||a.directory}`}function et(a,s){return`target:${a}:${s}`}function we(a){return a.id||a.directory}function ba(a){return a.manageable!==!1}function Gr({target:a,state:s,busy:d,disabled:l,disabledLabel:p,onToggle:g}){const x=s==="synced",c=s==="orphan",y=c?r("skills.dot.orphan_aria",{agent:a.label}):x?r("skills.dot.synced_aria",{agent:a.label}):r("skills.dot.off_aria",{agent:a.label}),v=l&&p?`${y} — ${p}`:y;return e.jsxs("button",{type:"button",title:v,"aria-label":v,"aria-pressed":x,disabled:d||l,onClick:f=>{f.stopPropagation(),g?.(a.id,!x)},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(Y,{className:"h-4 w-4 animate-spin text-oai-gray-400","aria-hidden":!0}):e.jsx("span",{className:se("flex h-[18px] w-[18px] items-center justify-center transition",x&&Vr[a.id],!x&&!c&&"opacity-35 grayscale"),"aria-hidden":!0,children:e.jsx(ve,{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 Qr({skill:a,targets:s,onToggleTarget:d,busyKey:l}){const p=new Set(a.targets||[]),g=!!(a.readOnly||a.remote),x=[];for(const c of s)(g?p.has(c.id):ba(c))&&x.push(c);return e.jsx("div",{className:"flex items-center gap-1",onClick:c=>c.stopPropagation(),children:x.map(c=>e.jsx(Gr,{target:c,state:a.targetStates?.[c.id]||"off",busy:l===et(we(a),c.id),disabled:g||c.manageable===!1,disabledLabel:r(a.remote?"skills.inventory.read_only_remote":"skills.inventory.read_only_managed"),onToggle:(y,v)=>d?.(a,y,v)},c.id))})}function Xr({skill:a,targets:s,selected:d,onSelect:l,selectable:p,checked:g,onToggleSelect:x,onToggleTarget:c,hasUpdate:y,busyKey:v}){const f=a.repoOwner&&a.repoName?`${a.repoOwner}/${a.repoName}`:null,N=[a.directory,f,a.sourceName].filter(Boolean).join(" · "),I=Array.isArray(a.deviceSources)?a.deviceSources:[],u=[a.remote?r("skills.inventory.remote"):null,a.scope==="plugin"?r("skills.inventory.plugin"):null].filter(Boolean),j=m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),l?.(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:()=>l?.(a),onKeyDown:j,className:se("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":g?"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:[p?e.jsx("label",{className:"flex shrink-0 items-center",onClick:m=>m.stopPropagation(),children:e.jsx("input",{type:"checkbox",checked:g,onChange:m=>x?.(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:N,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(ya,{className:"h-2.5 w-2.5","aria-hidden":!0}),r("skills.update.badge")]}):null,e.jsx(Qr,{skill:a,targets:s,onToggleTarget:c,busyKey:v}),e.jsx(Ut,{className:se("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:se("mt-1 line-clamp-2 text-xs text-oai-gray-500 dark:text-oai-gray-400",p&&"pl-7"),children:a.description}):null,a.sourceName||I.length?e.jsxs("div",{className:se("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",p&&"pl-7"),children:[a.sourceName?e.jsx("span",{className:"truncate",children:a.sourceName}):null,I.length?e.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1",title:I.map(m=>m.name).join(", "),children:[e.jsx(Pa,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),e.jsx("span",{className:"truncate",children:r("skills.inventory.on_devices",{devices:I.map(m=>m.name).join(", ")})})]}):null]}):null]})}function Jr({agentFilter:a,agentOptions:s,onAgentFilter:d,filteredCount:l,totalCount:p,anyFilter:g,onClearFilters:x,searchQuery:c,onSearchQuery:y,searchPlaceholder:v}){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(Ba,{value:a,onValueChange:d,children:[e.jsxs(Da,{"aria-label":r("skills.filter.agent_label"),className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 bg-oai-white px-2.5 text-xs font-medium text-oai-gray-700 transition hover:border-oai-gray-300 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 data-[popup-open]:border-oai-gray-300 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-oai-gray-200 dark:hover:border-oai-gray-700",children:[e.jsxs("span",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:[r("skills.filter.agent_label"),":"]}),e.jsx(Ea,{children:f=>f==="all"?r("skills.filter.agent_all"):s.find(N=>N.id===f)?.label||f}),e.jsx(Wa,{className:"text-oai-gray-400",children:e.jsx(fa,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),e.jsx(Ta,{children:e.jsx(Aa,{sideOffset:4,alignItemWithTrigger:!1,className:"z-[60]",children:e.jsxs(Oa,{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(ta,{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(ra,{children:r("skills.filter.agent_all")}),e.jsx(sa,{children:e.jsx(Re,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),s.map(f=>e.jsxs(ta,{value:f.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(ve,{provider:f.id,size:14}),e.jsx(ra,{children:f.label})]}),e.jsx(sa,{children:e.jsx(Re,{className:"h-3.5 w-3.5","aria-hidden":!0})})]},f.id))]})})})]}),e.jsxs("div",{className:"relative w-56 max-w-full",children:[e.jsx(ga,{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(ha,{type:"search",value:c,onChange:f=>y(f.target.value),onKeyDown:f=>{f.key==="Escape"&&c&&(f.preventDefault(),y(""))},"aria-label":r("skills.action.search_aria"),placeholder:v,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:f=>f.preventDefault(),onClick:()=>y(""),"aria-label":r("skills.action.search_clear"),"aria-hidden":!c,tabIndex:c?0:-1,className:se("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(Le,{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:l,total:p})}),g?e.jsxs("button",{type:"button",onClick:x,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(Le,{className:"h-3 w-3","aria-hidden":!0}),r("skills.filter.clear")]}):null]})}function Yr({count:a,targets:s,busy:d,onBulkSync:l,onBulkRemove:p,onClear:g}){const x=s.filter(ba);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(fa,{className:"h-3 w-3","aria-hidden":!0})]}),e.jsx(Va,{children:e.jsx(Ka,{sideOffset:6,side:"bottom",align:"end",className:"!z-[80]",children:e.jsxs(Ha,{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")}),x.map(c=>e.jsxs("button",{type:"button",onClick:()=>l(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(ve,{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:p,children:[e.jsx(pa,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),r("skills.select.bulk_remove")]}),e.jsxs("button",{type:"button",onClick:g,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(Le,{className:"h-3 w-3","aria-hidden":!0}),r("skills.select.clear")]})]})]})}function Zr({items:a,totalCount:s,targets:d,agentOptions:l,agentFilter:p,onAgentFilter:g,anyFilter:x,onClearFilters:c,searchQuery:y,onSearchQuery:v,searchPlaceholder:f,selectedId:N,onSelect:I,onToggleTarget:u,busyKey:j,updates:m,selectedIds:C,onToggleSelect:P,onClearSelection:$,onBulkSync:M,onBulkRemove:K,updateCount:de,onUpdateAll:pe}){const ne=C.size;return e.jsxs("div",{children:[ne>0?e.jsx(Yr,{count:ne,targets:d,busy:j==="batch",onBulkSync:M,onBulkRemove:K,onClear:$}):e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-2",children:[e.jsx(Jr,{agentFilter:p,agentOptions:l,onAgentFilter:g,filteredCount:a.length,totalCount:s,anyFilter:x,onClearFilters:c,searchQuery:y,onSearchQuery:v,searchPlaceholder:f}),de?e.jsxs(X,{type:"button",variant:"secondary",size:"sm",className:"mb-2 shrink-0",disabled:!!j,onClick:pe,children:[j==="update-all"?e.jsx(Y,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):e.jsx(ya,{className:"h-3.5 w-3.5","aria-hidden":!0}),r("skills.update.all_action",{count:de})]}):null]}),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(B=>e.jsx(Xr,{skill:B,targets:d,selected:N===(B.id||B.directory),onSelect:I,selectable:!B.readOnly&&!B.remote,checked:C.has(we(B)),onToggleSelect:P,onToggleTarget:u,hasUpdate:!!(B.id&&m?.[B.id]),busyKey:j},we(B)))})]})}const es={contentVisibility:"auto",containIntrinsicSize:"0 240px"},as=Mt.memo(function({skill:s,installed:d,installing:l,allTargets:p,defaultTargets:g,onInstall:x,onManage:c}){const[y,v]=i.useState(()=>(g||[]).filter(m=>p.some(C=>C.id===m))),f=m=>{v(C=>C.includes(m)?C.filter(P=>P!==m):[...C,m])},N=s.repoOwner&&s.repoName?`${s.repoOwner}/${s.repoName}`:null,I=N?`https://github.com/${s.repoOwner}/${s.repoName}`:null,u=s.installs!=null?r("skills.card.installs",{count:Number(s.installs||0).toLocaleString()}):null,j=y.length?y.map(m=>p.find(C=>C.id===m)?.label||m).join(", "):r("skills.action.choose_targets");return e.jsxs(zt,{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(ma,{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}),N||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:[I?e.jsxs("a",{href:I,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:I,children:[e.jsx("span",{className:"truncate",children:N}),e.jsx(ma,{className:"h-2.5 w-2.5 shrink-0","aria-hidden":!0})]}):null,N&&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(Re,{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?j:r("skills.target.none")}),e.jsxs(Fa,{children:[e.jsx(za,{disabled:l,"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(Va,{children:e.jsx(Ka,{sideOffset:6,side:"bottom",align:"end",className:"!z-[80]",children:e.jsxs(Ha,{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")}),p.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:()=>f(m.id)}),e.jsx(ve,{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:()=>x(s,y),disabled:l||y.length===0,className:"w-full",children:[l?e.jsx(Y,{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 ts({repos:a,repoInput:s,onRepoInput:d,busyKey:l,onAdd:p,onRemove:g}){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(ha,{value:s,onChange:x=>d(x.target.value),placeholder:r("skills.repo.placeholder"),className:"min-w-0 flex-1"}),e.jsxs(X,{type:"button",variant:"secondary",size:"md",onClick:p,disabled:l==="repo:add",className:"shrink-0 whitespace-nowrap",children:[l==="repo:add"?e.jsx(Y,{className:"mr-1.5 h-4 w-4 animate-spin","aria-hidden":!0}):e.jsx(Ma,{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(x=>{const c=l===`repo:${x.owner}/${x.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:[x.owner,"/",x.name]}),e.jsx("div",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400",children:x.branch})]}),e.jsxs(X,{type:"button",variant:"ghost",size:"sm",disabled:c,onClick:()=>g(x),className:"shrink-0",children:[c?e.jsx(Y,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):e.jsx(pa,{className:"h-3.5 w-3.5","aria-hidden":!0}),e.jsx("span",{className:"sr-only",children:r("skills.repo.remove")})]})]},`${x.owner}/${x.name}`)})}):null]})}function rs(){return typeof window>"u"?"my":new URLSearchParams(window.location.search).get("tab")==="browse"?"browse":"my"}function Ds(){const a=Et()||{},s=!!a.signedIn,d=a.getAccessToken,[l,p]=i.useState(rs),[g,x]=i.useState({skills:[],targets:[]}),[c,y]=i.useState([]),[v,f]=i.useState([]),[N,I]=i.useState([]),[u,j]=i.useState(he),[m,C]=i.useState(""),[P,$]=i.useState(""),[M,K]=i.useState(""),[de,pe]=i.useState(""),[ne,B]=i.useState(""),[fe,_]=i.useState(!1),[U,H]=i.useState("all"),[E,Z]=i.useState(null),[J,je]=i.useState(""),ce=i.useRef(!1),[Pe,qe]=i.useState(!0),[Be,De]=i.useState(!1),[S,L]=i.useState(""),[q,D]=i.useState(null),[ee,R]=i.useState(null),[Ne,Ee]=i.useState(null),[ie,Te]=i.useState(()=>new Set),[ue,Ae]=i.useState({}),[Oe,We]=i.useState({}),[Ce,$e]=i.useState([]),[me,Ge]=i.useState(!1),Me=i.useRef(!1),ae=i.useRef(0),T=i.useMemo(()=>Wr(g.skills),[g.skills]),Se=i.useCallback(async()=>{const t=++ae.current,n=await sr();if(ae.current!==t)return;const o={skills:n.skills||[],targets:n.targets||[]};x(o);const h=Tt();!s||!At()||!h||typeof d!="function"||(async()=>{try{const b=await d();if(!b||ae.current!==t)return;const[w]=await Promise.allSettled([nr(b),ir({accessToken:b,deviceId:h,skills:o.skills})]);if(w.status!=="fulfilled")return;const ke=w.value;if(ae.current!==t)return;x({targets:o.targets,skills:or(o.skills,ke,h)})}catch{}})()},[d,s]),ge=i.useCallback(async()=>{const t=await lr();I(t.repos||[])},[]),W=i.useCallback(async({force:t=!1}={})=>{De(!0);try{const n=await dr({force:t});y(n.skills||[])}finally{De(!1)}},[]),xe=i.useCallback(async({force:t=!1}={})=>{Ge(!0);try{const n=await cr({force:t});$e(n.skills||[])}finally{Ge(!1)}},[]),A=i.useCallback(async()=>{try{const t=await ur();Ae(t?.updates||{})}catch{}},[]),Ue=i.useCallback(t=>{const n=new Set((t||[]).filter(Boolean));n.size&&Ae(o=>{if(!Object.keys(o).some(b=>n.has(b)))return o;const h={};for(const[b,w]of Object.entries(o))n.has(b)||(h[b]=w);return h})},[]),ye=i.useCallback(async()=>{try{const t=await mr(),n={};for(const o of t?.skills||[])o.installed&&(o.directory&&(n[String(o.directory).toLowerCase()]=o),n[String(o.skill).toLowerCase()]=o);We(n)}catch{We({})}},[]),_e=i.useCallback(async()=>{qe(!0),L("");try{await Promise.all([Se(),ge()])}catch(t){L(t?.message||r("skills.error.generic"))}finally{qe(!1)}},[Se,ge]),ia=i.useCallback(async()=>{await _e();const t=n=>L(n?.message||r("skills.error.generic"));l==="my"?(A(),ye()):u===Q?xe({force:!0}).catch(t):u!==V&&W({force:!0}).catch(t)},[W,_e,xe,A,ye,u,l]);i.useEffect(()=>{_e()},[_e]),i.useEffect(()=>{if(Me.current||typeof window>"u")return;const t=new URLSearchParams(window.location.search),n=t.get("skill");if(!n){Me.current=!0;return}const o=g.skills||[];if(!o.length)return;const h=o.find(w=>w.directory===n||w.id===n);h&&(p("my"),Z(h.id||h.directory)),Me.current=!0,t.delete("skill");const b=t.toString();window.history.replaceState({},"",`${window.location.pathname}${b?`?${b}`:""}${window.location.hash}`)},[g.skills]),i.useEffect(()=>{l==="browse"&&(u===V||u===Q||c.length===0&&W().catch(t=>L(t?.message||r("skills.error.generic"))))},[c.length,W,u,l]),i.useEffect(()=>{l!=="browse"||u!==Q||Ce.length===0&&xe().catch(t=>L(t?.message||r("skills.error.generic")))},[xe,Ce.length,u,l]);const Qe=Object.keys(ue).length>0,Xe=Object.keys(Oe).length>0;if(i.useEffect(()=>{l==="my"&&(Qe||A(),Xe||ye())},[l,Qe,Xe,A,ye]),i.useEffect(()=>{const t=setTimeout(()=>$(m),200);return()=>clearTimeout(t)},[m]),i.useEffect(()=>{const t=setTimeout(()=>pe(M),120);return()=>clearTimeout(t)},[M]),i.useEffect(()=>{if(typeof window>"u")return;const t=new URLSearchParams(window.location.search),n=t.get("tab");if(l==="my"){if(!n)return;t.delete("tab")}else{if(n===l)return;t.set("tab",l)}const o=t.toString(),h=`${window.location.pathname}${o?`?${o}`:""}${window.location.hash}`;window.history.replaceState({},"",h)},[l]),!zr&&!Ot())return e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx(Ft,{})});const F=async(t,n)=>{if(!ce.current){ce.current=!0,je(t),L("");try{await n(),await Se()}catch(o){L(o?.message||r("skills.error.generic"))}finally{ce.current=!1,je("")}}},oa=(t,n)=>{const o=(n&&n.length?n:_a).filter(h=>(g.targets||[]).some(b=>b.id===h));F(aa(t),async()=>{await xr(t,o);const h=o.map(b=>(g.targets||[]).find(w=>w.id===b)?.label||b).join(", ");G({title:r("skills.toast.installed",{name:t.name||t.directory,targets:h||r("skills.target.none")}),timeout:4e3})})},Je=t=>{t?.readOnly||t?.remote||D(t)},Fe=()=>{const t=q;t&&(D(null),F(La(t),async()=>{let n=null;t.managed?n=await va(t.id):await ja(t.directory,t.targets||[]),Ue([t.id]);const o=!!(n?.trashed&&t.managed&&t.id);G({title:r("skills.toast.removed",{name:t.name||t.directory}),timeout:6e3,data:o?{onUndo:async()=>{try{await hr(t.id),await Se()}catch(h){L(h?.message||r("skills.error.generic"))}}}:void 0})}))},k=(t,n,o)=>t?.readOnly||t?.remote?Promise.resolve():F(et(we(t),n),async()=>{const h=new Set(t.targets||[]);o?h.add(n):h.delete(n),t.managed?await Na(t.id,Array.from(h)):await Ca(t.directory,Array.from(h));const b={name:t.name||t.directory,agent:te(n)};G({title:o?r("skills.toast.synced_one",b):r("skills.toast.unsynced_one",b),timeout:3e3})}),z=i.useCallback(()=>Te(new Set),[]),oe=i.useCallback((t,n)=>{if(t?.readOnly||t?.remote)return;const o=we(t);Te(h=>{const b=new Set(h);return n?b.add(o):b.delete(o),b})},[]),te=t=>(g.targets||[]).find(n=>n.id===t)?.label||t,Ie=t=>{const n=(g.skills||[]).filter(o=>ie.has(we(o))&&!o.readOnly&&!o.remote);n.length&&F("batch",async()=>{for(const o of n){const h=new Set(o.targets||[]);h.add(t),o.managed?await Na(o.id,Array.from(h)):await Ca(o.directory,Array.from(h))}z(),G({title:r("skills.toast.bulk_synced",{count:n.length,agent:te(t)}),timeout:4e3})})},ze=()=>{const t=(g.skills||[]).filter(n=>ie.has(we(n))&&!n.readOnly&&!n.remote);t.length&&R(t)},Ve=()=>{const t=ee;t&&(R(null),F("batch",async()=>{for(const n of t)n.managed?await va(n.id):await ja(n.directory,n.targets||[]);Ue(t.map(n=>n.id)),z(),G({title:r("skills.toast.bulk_removed",{count:t.length}),timeout:4e3})}))},at=t=>{!t?.id||!t?.repoOwner||!t?.repoName||F(aa(t),async()=>{const n=await Sa([t.id]);await A();const{results:o=[],rateLimited:h=null,updated:b=0}=n||{};if(h){G({title:r("skills.update.rate_limited",{count:b}),timeout:6e3});return}const w=o[0];if(!w||!w.ok)throw new Error(w?.error||r("skills.error.generic"));G({title:r("skills.toast.updated",{name:t.name||t.directory}),timeout:4e3})})},tt=new Set((g.skills||[]).map(t=>t.id).filter(Boolean)),la=Object.entries(ue).filter(([t,n])=>n&&tt.has(t)).map(([t])=>t),rt=la.length,st=()=>{la.length&&Ee(la)},nt=()=>{const t=Ne;Ee(null),!(!t||!t.length)&&F("update-all",async()=>{const n=await Sa(t);await A();const{updated:o=0,failed:h=0,rateLimited:b=null,results:w=[]}=n||{},ke=w.length;if(b)G({title:r("skills.update.rate_limited",{count:o}),timeout:6e3});else if(h>0)G({title:r("skills.toast.updated_partial",{count:o,total:ke,failed:h}),timeout:6e3});else if(o===0)G({title:r("skills.toast.updated_none"),timeout:4e3});else if(o===1){const O=w.find(ea=>ea.ok&&!ea.skipped);G({title:r("skills.toast.updated",{name:O?.name||""}),timeout:4e3})}else G({title:r("skills.toast.updated_many",{count:o}),timeout:4e3})})},ka=async()=>{const t=m.trim();if(!(t.length<2||ce.current)){ce.current=!0,je("search"),L("");try{const n=await gr(t);f(n.skills||[])}catch(n){L(n?.message||r("skills.error.generic"))}finally{ce.current=!1,je("")}}},it=async()=>{const t=ne.trim().replace(/^https:\/\/github\.com\//,"").replace(/\.git$/,""),[n,o]=t.split("/");if(!n||!o){L(r("skills.repo.invalid"));return}await F("repo:add",async()=>{await fr({owner:n,name:o,branch:"main",enabled:!0}),B(""),await ge(),await W()})},ot=async t=>{await F(`repo:${t.owner}/${t.name}`,async()=>{await pr(t.owner,t.name),await ge(),await W()})},le=g.targets||[],lt=le.filter(ba),be=g.skills||[],dt=i.useMemo(()=>{const t=U==="all"?be:be.filter(o=>(o.targets||[]).includes(U)),n=de.trim().toLowerCase();return n?t.filter(o=>(o.name||"").toLowerCase().includes(n)||(o.directory||"").toLowerCase().includes(n)||(o.description||"").toLowerCase().includes(n)):t},[be,U,de]),ct=U!=="all",re=i.useMemo(()=>E&&be.find(t=>(t.id||t.directory)===E)||null,[be,E]),ut=i.useCallback(()=>{H("all"),K("")},[]),mt=i.useCallback(t=>{Z(n=>{const o=t?.id||t?.directory||null;return n===o?null:o})},[]),gt=i.useCallback(()=>Z(null),[]),xt=i.useCallback(t=>{const n=na(t).toLowerCase(),o=Ia(t),h=(g.skills||[]).find(b=>{const w=Za(b);return w.has(n)||o&&w.has(o)});h&&Z(h.id||h.directory)},[g.skills]);i.useEffect(()=>{l!=="my"&&ie.size&&Te(new Set)},[l,ie.size]),i.useEffect(()=>{E&&!re&&Z(null)},[re,E]);const Ke=i.useMemo(()=>{const t=u===V?v:u===Q?Ce:c,o=u===V||u===Q||u===he?t:t.filter(w=>`${w.repoOwner}/${w.repoName}`===u),h=P.trim().toLowerCase();return(u===V||!h?o:o.filter(w=>(w.name||"").toLowerCase().includes(h)||(w.directory||"").toLowerCase().includes(h)||(w.description||"").toLowerCase().includes(h))).map(w=>{const ke=na(w).toLowerCase(),O=Ia(w);return{...w,installed:T.has(ke)||O&&T.has(O)}})},[P,c,T,Ce,v,u]),ht=e.jsx("div",{className:"flex h-64 items-center justify-center",children:e.jsx(Y,{className:"h-8 w-8 animate-spin text-oai-gray-400","aria-hidden":!0})}),pt=e.jsxs("div",{className:"flex h-64 flex-col items-center justify-center gap-3 px-6 text-center",children:[e.jsx(Y,{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")})]}),Ye=(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 Ze;if(Pe)Ze=ht;else if(l==="my")Ze=be.length?e.jsx(Zr,{items:dt,totalCount:be.length,targets:le,agentOptions:le,agentFilter:U,onAgentFilter:H,anyFilter:ct,onClearFilters:ut,searchQuery:M,onSearchQuery:K,searchPlaceholder:r("skills.my.placeholder"),selectedId:E,onSelect:mt,onToggleTarget:k,busyKey:J,updates:ue,selectedIds:ie,onToggleSelect:oe,onClearSelection:z,onBulkSync:Ie,onBulkRemove:ze,updateCount:rt,onUpdateAll:st}):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:[le.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:[...le,...le].map((t,n)=>e.jsx("span",{className:"shrink-0 px-3",children:e.jsx(ve,{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:[...le,...le].map((t,n)=>e.jsx("span",{className:"shrink-0 px-3",children:e.jsx(ve,{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:()=>p("browse"),children:r("skills.empty.my_cta")})]});else{const t=u===V,n=u===Q,o=N.length===0&&!t&&!n,h=Be&&!t&&!n||n&&me,b=!t&&!n&&(P.trim()!==""||u!==he),w=()=>{C(""),j(he)},ke=!o&&!h&&(Ke.length>0||b)?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:Ke.length})}),b?e.jsxs("button",{type:"button",onClick:w,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(Le,{className:"h-3 w-3","aria-hidden":!0}),r("skills.filter.clear")]}):null]}):null;let O;o?O=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")})}):h?O=pt:t&&m.trim().length<2?O=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")}):Ke.length?O=e.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:Ke.map(He=>e.jsx("div",{style:es,children:e.jsx(as,{skill:He,installed:!!He.installed,installing:J===aa(He),allTargets:lt,defaultTargets:_a,onInstall:oa,onManage:xt})},He.id||He.key))}):b?O=Ye("skills.empty.no_match",e.jsx(X,{type:"button",variant:"secondary",size:"sm",onClick:w,children:r("skills.filter.clear")})):t?O=Ye("skills.empty.search"):n?O=Ye("skills.empty.popular"):O=Ye("skills.empty.browse");const ea=o||fe?e.jsx("div",{className:"mb-5",children:e.jsx(ts,{repos:N,repoInput:ne,onRepoInput:B,busyKey:J,onAdd:it,onRemove:ot})}):null,ft=!fe&&!t&&!n&&N.length<=1&&Ke.length>0?e.jsx(wr,{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;Ze=e.jsxs(e.Fragment,{children:[ea,ke,O,ft]})}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:ia,disabled:Pe||Be||me,children:[e.jsx($t,{className:se("mr-1.5 h-3.5 w-3.5",(Pe||Be||me)&&"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":l===t,onClick:()=>p(t),className:se("-mb-px border-b-2 pb-2 text-sm font-medium transition-colors",l===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))}),S?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:S}):null,l==="browse"?e.jsxs("div",{className:"mb-5 flex flex-col gap-3 sm:flex-row sm:items-center",children:[e.jsx(Vt,{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(yr,{className:"h-3.5 w-3.5","aria-hidden":!0})},{id:"skillssh",label:r("skills.mode.skillssh")}],value:u===V?"skillssh":u===Q?"popular":"repo",onChange:t=>{t==="skillssh"?j(V):t==="popular"?j(Q):(u===V||u===Q)&&j(he)}}),u!==V&&u!==Q?e.jsxs(Ba,{value:u,onValueChange:j,children:[e.jsxs(Da,{"aria-label":r("skills.source.label"),className:"inline-flex h-8 w-44 shrink-0 items-center justify-between gap-2 rounded-md border border-oai-gray-200 bg-oai-white px-2.5 text-xs text-oai-black focus:outline-none data-[popup-open]:border-oai-gray-300 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-white dark:data-[popup-open]:border-oai-gray-700",children:[e.jsx(Ea,{children:t=>t===he?r("skills.source.all"):t}),e.jsx(Wa,{className:"text-oai-gray-400",children:e.jsx(fa,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),e.jsx(Ta,{children:e.jsx(Aa,{sideOffset:4,alignItemWithTrigger:!1,className:"z-[60]",children:e.jsxs(Oa,{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(ta,{value:he,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(ra,{children:r("skills.source.all")}),e.jsx(sa,{children:e.jsx(Re,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),N.map(t=>{const n=`${t.owner}/${t.name}`;return e.jsxs(ta,{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(ra,{children:n}),e.jsx(sa,{children:e.jsx(Re,{className:"h-3.5 w-3.5","aria-hidden":!0})})]},n)})]})})})]}):null,e.jsxs("div",{className:"relative flex-1",children:[e.jsx(ga,{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(ha,{type:"search",value:m,onChange:t=>C(t.target.value),onKeyDown:t=>{t.key==="Enter"&&u===V&&ka()},"aria-label":r("skills.action.search_aria"),placeholder:u===V?r("skills.browse.placeholder_skillssh"):u===Q?r("skills.browse.placeholder_popular"):u===he?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===V?e.jsxs(X,{type:"button",size:"sm",onClick:ka,disabled:m.trim().length<2||J==="search",className:"focus:!ring-oai-gray-400/30",children:[J==="search"?e.jsx(Y,{className:"mr-1.5 h-4 w-4 animate-spin","aria-hidden":!0}):e.jsx(ga,{className:"mr-1.5 h-4 w-4","aria-hidden":!0}),r("skills.action.search")]}):u===Q?null:e.jsxs(X,{type:"button",variant:"secondary",size:"sm",onClick:()=>_(t=>!t),"aria-expanded":fe,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(Ma,{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:N.length})]})]}):null,Ze,e.jsx(Ur,{skill:re,targets:le,busyKey:J,usage:re&&(Oe[String(re.directory||"").toLowerCase()]||Oe[String(re.name||"").toLowerCase()])||null,hasUpdate:!!(re?.id&&ue?.[re.id]),updating:re?J===aa(re):!1,onUpdate:at,onClose:gt,onToggleTarget:k,onRemove:Je})]})}),e.jsx(da,{open:!!q,title:r("skills.confirm.remove_title",{name:q?.name||q?.directory||""}),description:q?q.managed?r("skills.confirm.remove_managed"):r("skills.confirm.remove_local"):"",confirmLabel:r("skills.action.remove"),cancelLabel:r("shared.action.cancel"),destructive:!0,busy:J===La(q||{}),onCancel:()=>D(null),onConfirm:Fe}),e.jsx(da,{open:!!ee,title:r("skills.confirm.bulk_remove_title",{count:ee?.length||0}),description:r("skills.confirm.bulk_remove_desc"),confirmLabel:r("skills.action.remove"),cancelLabel:r("shared.action.cancel"),destructive:!0,busy:J==="batch",onCancel:()=>R(null),onConfirm:Ve}),e.jsx(da,{open:!!Ne,title:r("skills.confirm.update_all_title",{count:Ne?.length||0}),description:r("skills.confirm.update_all_desc"),confirmLabel:r("skills.update.action"),cancelLabel:r("shared.action.cancel"),onCancel:()=>Ee(null),onConfirm:nt})]})}export{Ds as SkillsPage,Wr as buildLocallyInstalledKeys};
|