tokentracker-cli 1.5.0 → 1.5.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/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/dashboard/dist/.well-known/submitby-ai/6e2fa70e-9eb2-4c97-a9a9-fed567a3d4a9.txt +1 -0
- package/dashboard/dist/assets/AchievementBadge-mB7HZSGE.js +1 -0
- package/dashboard/dist/assets/{AchievementsPage-9_MxdI7O.js → AchievementsPage-DLzeq_eo.js} +2 -2
- package/dashboard/dist/assets/{AchievementsSection-CKDQGcJh.js → AchievementsSection-DrXQyDns.js} +1 -1
- package/dashboard/dist/assets/{BadgeDetailModal-DdrXPVRL.js → BadgeDetailModal-WrgKRybi.js} +1 -1
- package/dashboard/dist/assets/{BotAnimated-DsJDdDid.js → BotAnimated-DFRaixVK.js} +1 -1
- package/dashboard/dist/assets/{Card-Bz-sWY1C.js → Card-bFq2tlO8.js} +1 -1
- package/dashboard/dist/assets/{CloudCheckoutPage-DRjZcE0W.js → CloudCheckoutPage-gwhGxavy.js} +1 -1
- package/dashboard/dist/assets/{CloudPage-BNDyyX9r.js → CloudPage-BD4iBYeZ.js} +2 -2
- package/dashboard/dist/assets/{CommandPalette-LbE6Icc0.js → CommandPalette-C_KlPl0U.js} +1 -1
- package/dashboard/dist/assets/{CommunityStatsModal-DuEcAOB9.js → CommunityStatsModal-Cl1Bgv8M.js} +1 -1
- package/dashboard/dist/assets/{ConfirmModal-B5V7ONKv.js → ConfirmModal-NWoYevYC.js} +1 -1
- package/dashboard/dist/assets/{Controls-ZfN0QwwD.js → Controls-D2-D2cfA.js} +1 -1
- package/dashboard/dist/assets/{DashboardPage-DqZPFmlv.js → DashboardPage-vITMnPXx.js} +1 -1
- package/dashboard/dist/assets/{DateRangePopover-CbkBeaEI.js → DateRangePopover-8EMVXuH6.js} +1 -1
- package/dashboard/dist/assets/{DevicePage-DrHjmpPH.js → DevicePage-DbP8d6bM.js} +1 -1
- package/dashboard/dist/assets/{DialogClose-DHaAwV1u.js → DialogClose-CEstgLa1.js} +1 -1
- package/dashboard/dist/assets/DialogDescription-0wcygxtH.js +1 -0
- package/dashboard/dist/assets/{DialogTitle-CBhd4oLc.js → DialogTitle-DP5TLLbz.js} +1 -1
- package/dashboard/dist/assets/{ElectricLogo-CSWd3b2H.js → ElectricLogo-Uvi3yMum.js} +1 -1
- package/dashboard/dist/assets/{FadeIn-D5p6nDla.js → FadeIn-Dpzihg6f.js} +1 -1
- package/dashboard/dist/assets/{HeaderGithubStar-BKVSzY27.js → HeaderGithubStar-DllqemKr.js} +1 -1
- package/dashboard/dist/assets/{HoverTooltip-CvkAyCDm.js → HoverTooltip-Dc-TAH6l.js} +1 -1
- package/dashboard/dist/assets/{IpCheckPage-BEMJGKtl.js → IpCheckPage-jd1D5ZKX.js} +1 -1
- package/dashboard/dist/assets/{LandingPage-iRp33enQ.js → LandingPage-CB1ZVw-a.js} +2 -2
- package/dashboard/dist/assets/{LeaderboardPage-DVMPrN4z.js → LeaderboardPage-Bt2cRRmE.js} +2 -2
- package/dashboard/dist/assets/{LeaderboardProBadge-DwnaJoje.js → LeaderboardProBadge-BVlyVOFf.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardProfileModal-DnzVweLM.js → LeaderboardProfileModal-CwQFRJg_.js} +3 -3
- package/dashboard/dist/assets/{LeaderboardProfilePage-BHNuPuW7.js → LeaderboardProfilePage-CeqcTbUG.js} +1 -1
- package/dashboard/dist/assets/{LimitsPage-9LitacBf.js → LimitsPage-Bp4ZORmR.js} +6 -6
- package/dashboard/dist/assets/{LocalOnlyNotice-DStlbPET.js → LocalOnlyNotice-B2_HoCVD.js} +1 -1
- package/dashboard/dist/assets/{LoginCard-I47ukXU5.js → LoginCard-nw9JOc2d.js} +1 -1
- package/dashboard/dist/assets/{LoginModal-C4iotNjY.js → LoginModal-BHNLTK1D.js} +1 -1
- package/dashboard/dist/assets/{LoginPage-46QSEnG0.js → LoginPage-LI2GZKhM.js} +1 -1
- package/dashboard/dist/assets/{PetPage-SvgDUR8o.js → PetPage-CK6sPeI0.js} +2 -2
- package/dashboard/dist/assets/{PopoverPopup-k2ejLK1I.js → PopoverPopup-BsXchEVa.js} +1 -1
- package/dashboard/dist/assets/{ProviderIcon-Bx1XKzin.js → ProviderIcon-vgCEy0dh.js} +1 -1
- package/dashboard/dist/assets/{ResetPasswordPage-CcKIDknp.js → ResetPasswordPage-B4CPj2vX.js} +1 -1
- package/dashboard/dist/assets/{Select-D0hLQyU8.js → Select-BkAy6P2r.js} +1 -1
- package/dashboard/dist/assets/{SelectItemText-DJGBJhDK.js → SelectItemText-C0RNqDrD.js} +1 -1
- package/dashboard/dist/assets/{SelfHostPage-CeIFGRep.js → SelfHostPage-B-_w-Z-a.js} +1 -1
- package/dashboard/dist/assets/{ServiceStatusPage-DMtw0YDh.js → ServiceStatusPage-5YevsGGD.js} +1 -1
- package/dashboard/dist/assets/{SessionsPage-D6h5vSZn.js → SessionsPage-CmWXBqD2.js} +1 -1
- package/dashboard/dist/assets/{SettingsPage-BZgpB5SB.js → SettingsPage-CA70zP-t.js} +3 -3
- package/dashboard/dist/assets/{SkillsPage-CtFuZ1ob.js → SkillsPage-CNamhfzU.js} +1 -1
- package/dashboard/dist/assets/{TokenGalaxy-DC-no047.js → TokenGalaxy-CXrVBSk6.js} +1 -1
- package/dashboard/dist/assets/{TooltipPopup-ZM0Ie2_C.js → TooltipPopup-CR4MqElX.js} +1 -1
- package/dashboard/dist/assets/{TrendMonitor-fpLaqJ-o.js → TrendMonitor-DQfcrEve.js} +1 -1
- package/dashboard/dist/assets/{WidgetsPage-DIoHY6ZJ.js → WidgetsPage-BBXxtZbP.js} +1 -1
- package/dashboard/dist/assets/{WrappedPage-D1-7o8Z1.js → WrappedPage-C8i2KlMF.js} +1 -1
- package/dashboard/dist/assets/{__vite-browser-external-DZF5L1pt.js → __vite-browser-external-BEEzY7mq.js} +2 -2
- package/dashboard/dist/assets/{agent-logos-YBC1iAbE.js → agent-logos-CxQb8vir.js} +1 -1
- package/dashboard/dist/assets/{arrow-left-BIe3z7iW.js → arrow-left-D6zkcLVt.js} +1 -1
- package/dashboard/dist/assets/{arrow-right-CJmRcvYZ.js → arrow-right-BGb-XVn_.js} +1 -1
- package/dashboard/dist/assets/{arrow-up-right-IgkBHoCl.js → arrow-up-right-XTStagDJ.js} +1 -1
- package/dashboard/dist/assets/{calendar-days-DTuIv3ts.js → calendar-days-Cz3NGZiS.js} +1 -1
- package/dashboard/dist/assets/{check-DrXhhj46.js → check-1z_vmHPD.js} +1 -1
- package/dashboard/dist/assets/{chevron-down-DHaFKHMK.js → chevron-down-CkSBY3bE.js} +1 -1
- package/dashboard/dist/assets/{cloud-checkout-BffVMyzI.js → cloud-checkout-pD5C4r_S.js} +1 -1
- package/dashboard/dist/assets/{composite-M_CP_KSx.js → composite-BtDzx3a2.js} +1 -1
- package/dashboard/dist/assets/{copy-D5xoS-Q8.js → copy-Ctv_wxuD.js} +1 -1
- package/dashboard/dist/assets/{download-CqomMv4-.js → download-DKbKMGSR.js} +1 -1
- package/dashboard/dist/assets/{external-link--q3pCw6b.js → external-link-g9cU017t.js} +1 -1
- package/dashboard/dist/assets/{flame-CUGlDV__.js → flame-DZq3kXUt.js} +1 -1
- package/dashboard/dist/assets/{format-tokens-BZ6TX9Km.js → format-tokens-CXQfx0PC.js} +1 -1
- package/dashboard/dist/assets/{gift-BBgOeC20.js → gift-CKlKjGP6.js} +1 -1
- package/dashboard/dist/assets/{icons-BELeB4ms.js → icons-xPGMnBjl.js} +1 -1
- package/dashboard/dist/assets/{index-CsdgnKGf.js → index-BwOjMtB2.js} +1 -1
- package/dashboard/dist/assets/{index-CoRqgJ71.js → index-CDBOKcDh.js} +1 -1
- package/dashboard/dist/assets/{index-DkBvk4Qg.js → index-Dl0oFLNr.js} +33 -33
- package/dashboard/dist/assets/{index-B1B6oAbl.js → index-fVbP5wOv.js} +1 -1
- package/dashboard/dist/assets/{info-BG1vQZ1r.js → info-D9xNIuGh.js} +1 -1
- package/dashboard/dist/assets/{link-2-oi5TrXqi.js → link-2-Bk5wYt2n.js} +1 -1
- package/dashboard/dist/assets/{loader-circle-BQQ_Xbby.js → loader-circle-CcN3pHWb.js} +1 -1
- package/dashboard/dist/assets/{local-usage-transfer-Dwz-clJ-.js → local-usage-transfer-CYcy1ici.js} +1 -1
- package/dashboard/dist/assets/{modifiers.esm-C7a817l7.js → modifiers.esm-DbpEzkJe.js} +1 -1
- package/dashboard/dist/assets/module-ZyVsxBG_.js +3 -0
- package/dashboard/dist/assets/{monitor-smartphone-Bnbo7uRg.js → monitor-smartphone-WkWv1qIS.js} +1 -1
- package/dashboard/dist/assets/{play-C_xI_JM_.js → play-2yZGWMes.js} +1 -1
- package/dashboard/dist/assets/{plus-xF6PK5As.js → plus-mOF8tG1F.js} +1 -1
- package/dashboard/dist/assets/{provider-display-DxquW3js.js → provider-display-7gaOvgMp.js} +1 -1
- package/dashboard/dist/assets/{react-CGK0_x3G.js → react-CdPiPDhk.js} +1 -1
- package/dashboard/dist/assets/{safePolygon-CCoDMR4f.js → safePolygon-C7FJLAlh.js} +1 -1
- package/dashboard/dist/assets/{search-EZAGpmfJ.js → search-C63nCrjo.js} +1 -1
- package/dashboard/dist/assets/{server-2qbrx2G0.js → server-BaG1rnuv.js} +1 -1
- package/dashboard/dist/assets/{shield-check-D8kUejpE.js → shield-check-D_4-Cm6L.js} +1 -1
- package/dashboard/dist/assets/{skills-api-DYPf1Vxh.js → skills-api-DfbzwpDv.js} +1 -1
- package/dashboard/dist/assets/{sortable.esm-D9gC08dQ.js → sortable.esm-D-v8FRX5.js} +1 -1
- package/dashboard/dist/assets/{store-BWUCbK6Y.js → store-Dv_FYrXK.js} +1 -1
- package/dashboard/dist/assets/{terminal-B16b7r6H.js → terminal-FQi6MaYt.js} +1 -1
- package/dashboard/dist/assets/{trash-BIEoE13C.js → trash-TbK96dEz.js} +1 -1
- package/dashboard/dist/assets/use-community-stats-DGoWVZuk.js +1 -0
- package/dashboard/dist/assets/{use-latest-request-guard-CYKu-VOB.js → use-latest-request-guard-Dg6uSaYt.js} +1 -1
- package/dashboard/dist/assets/{use-limits-display-prefs-CEAjVxFr.js → use-limits-display-prefs-Djbdp7fi.js} +1 -1
- package/dashboard/dist/assets/{use-native-settings-vTg4j5Ln.js → use-native-settings-DIk0AF3b.js} +1 -1
- package/dashboard/dist/assets/{use-ordered-list-CtXedlqH.js → use-ordered-list-CUqV3Zgl.js} +1 -1
- package/dashboard/dist/assets/use-reduced-motion-DMCok-vZ.js +1 -0
- package/dashboard/dist/assets/{use-transform-CdeW5xhz.js → use-transform-D_-w22c8.js} +1 -1
- package/dashboard/dist/assets/{use-usage-limits-DmDa5Py8.js → use-usage-limits-h7aGsIQr.js} +1 -1
- package/dashboard/dist/assets/{useCurrency-bqycM681.js → useCurrency-B_AuLCsL.js} +1 -1
- package/dashboard/dist/assets/{usePositioner-DEXS10fY.js → usePositioner-DfxvIif8.js} +1 -1
- package/dashboard/dist/assets/{useTokenFormat-YF6hY8_m.js → useTokenFormat-bbO13V4s.js} +1 -1
- package/dashboard/dist/assets/{zap-Dg-ij-lq.js → zap-k07-EXTK.js} +1 -1
- package/dashboard/dist/index.html +20 -1
- package/dashboard/dist/indexnow-key.txt +1 -0
- package/dashboard/dist/ip-check.html +1 -1
- package/dashboard/dist/leaderboard.html +1 -1
- package/dashboard/dist/share.html +1 -1
- package/dashboard/dist/tt6a1c9e2f4b8d.txt +1 -0
- package/package.json +3 -3
- package/src/lib/pricing/seed-snapshot.json +1 -1
- package/src/lib/qoder-limits.js +178 -38
- package/dashboard/dist/assets/AchievementBadge-Dn39pyx9.js +0 -1
- package/dashboard/dist/assets/DialogDescription-CEY6jbs9.js +0 -1
- package/dashboard/dist/assets/module-C2SOSUuR.js +0 -3
- package/dashboard/dist/assets/use-community-stats-DWS7YKbM.js +0 -1
- package/dashboard/dist/assets/use-reduced-motion-DVLsAhSA.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{bJ as Cn,r as o,cy as st,b0 as $e,b9 as qt,c3 as Kt,K as Ue,N as me,cv as Tn,aZ as _e,b2 as K,b3 as En,cz as zt,cw as wn,b1 as $,dm as Lt,dn as ht,dp as Vt,c1 as xt,b4 as Be,bc as ye,dq as Dt,br as kt,dr as vn,bM as Yt,b$ as $t,ds as ct,dt as ut,du as Xt,dv as Et,cH as Mn,dw as On,dx as yt,cN as Pn,bH as Xe,aX as re,j as ge,c5 as It,ca as An,cc as Fn,cd as Ln,bZ as it,bI as Vn,cB as Dn,bO as kn,bt as rt,ct as Hn,M as Gt,J as We,dy as Nn,bU as Un,dz as _n,bX as Bn,bY as Jt,b7 as Wn,dA as jn,c9 as Zt,dB as St}from"./__vite-browser-external-DZF5L1pt.js";import{i as Rt,E as Qt,b as en,F as qn,P as Kn,c as Fe,a as zn,G as Yn,H as Te,J as tn,B as $n,u as Xn,K as Gn,n as Jn,y as Zn,d as Qn,r as er,I as tr,x as nr,p as rr,C as or,D as sr}from"./composite-M_CP_KSx.js";import{u as ir,a as lr,b as cr,p as ur,r as ar,g as fr}from"./usePositioner-DEXS10fY.js";function ze(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}function dr(e,t={}){const{enabled:n=!0,event:r="click",toggle:s=!0,ignoreMouse:i=!1,stickIfOpen:l=!0,touchOpenDelay:d=0,reason:u=Cn}=t,C=e.context.dataRef,h=o.useRef(void 0),p=st(),T=$e(),g=o.useMemo(()=>{function P(c,v,U,E){const a=me(u,v,U);c&&E==="touch"&&d>0?T.start(d,()=>{e.setOpen(!0,a)}):e.setOpen(c,a)}function F(c,v,U){const E=C.current.openEvent,a=e.select("domReferenceElement")!==v;return c&&a||!c||!s?!0:E&&(typeof l=="function"?l():l)?!U(E.type):!1}return{onPointerDown(c){h.current=Rt(c.pointerType,!0)&&Qt(c.nativeEvent)?"virtual":c.pointerType},onMouseDown(c){const v=h.current,U=c.nativeEvent,E=e.select("open");if(c.button!==0||r==="click"||Rt(v,!0)&&i)return;const a=F(E,c.currentTarget,A=>A==="click"||A==="mousedown"),R=qt(U),w=Kt(R);if(w||v==="virtual"){P(a,U,w?R:c.currentTarget,v);return}const I=c.currentTarget;p.request(()=>{P(a,U,I,v)})},onClick(c){if(r==="mousedown-only")return;const v=h.current;if(r==="mousedown"&&v){h.current=void 0;return}if(Rt(v,!0)&&i)return;const U=e.select("open"),E=F(U,c.currentTarget,a=>a==="click"||a==="mousedown"||a==="keydown"||a==="keyup");P(E,c.nativeEvent,c.currentTarget,v)},onKeyDown(){h.current=void 0}}},[C,r,i,u,e,l,s,p,T,d]);return o.useMemo(()=>n?{reference:g}:Ue,[n,g])}function pr(e){const{open:t=!1,onOpenChange:n,elements:r={}}=e,s=Tn(),i=en()!=null,l=_e(()=>new qn({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new Kn,floatingId:s,syncOnly:!1,nested:i})).current;return K(()=>{const d={open:t,floatingId:s};r.reference!==void 0&&(d.referenceElement=r.reference,d.domReferenceElement=En(r.reference)?r.reference:null),r.floating!==void 0&&(d.floatingElement=r.floating),l.update(d)},[t,s,r.reference,r.floating,l]),l.context.onOpenChange=n,l.context.nested=i,l}function Ht(e){return $t&&e.movementX===0&&e.movementY===0}function at(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Ze(e,t){return at(t,e===Xt||e===Et,e===ct||e===ut)}function bt(e,t,n){return at(t,e===Et,n?e===ct:e===ut)||e==="Enter"||e===" "||e===""}function gr(e,t,n){return at(t,n?e===ct:e===ut,e===Et)}function mr(e,t,n,r){const s=n?e===ut:e===ct,i=e===Xt;return t==="both"||t==="horizontal"&&r?e==="Escape":at(t,s,i)}function hr(e,t){const{listRef:n,activeIndex:r,onNavigate:s=()=>{},enabled:i=!0,selectedIndex:l=null,allowEscape:d=!1,loopFocus:u=!1,nested:C=!1,rtl:h=!1,virtual:p=!1,focusItemOnOpen:T="auto",focusItemOnHover:g=!0,openOnArrowKeyDown:P=!0,disabledIndices:F=void 0,orientation:c="vertical",triggerOrientation:v=c,parentOrientation:U,id:E,resetOnPointerLeave:a=!0,externalTree:R,nestedReturnFocusRef:w,grid:I}=t,A=I!=null,O=e.useState("open"),H=e.useState("floatingElement"),z=e.useState("domReferenceElement"),X=e.context.dataRef,y=zt(H),k=wn(z),B=Fe(y),ie=en(),G=zn(R),J=o.useRef(T),x=o.useRef(l??-1),f=o.useRef(null),D=o.useRef(!0),b=$(m=>{s(x.current===-1?null:x.current,m)}),M=o.useRef(!!H),W=o.useRef(O),q=o.useRef(!1),te=o.useRef(!1),ee=o.useRef(null),fe=Fe(F),ue=Fe(O),Z=Fe(l),ae=Fe(a),j=st(),Y=st(),oe=$(()=>{j.cancel();function m(V){p||(ee.current=Yn(V,{sync:q.current,preventScroll:!0}))}const L=n.current[x.current],Q=te.current;L&&m(L),(q.current?V=>V():V=>j.request(V))(()=>{const V=n.current[x.current]||L;if(!V)return;L||m(V),xe&&(Q||!D.current)&&V.scrollIntoView?.({block:"nearest",inline:"nearest"})})});K(()=>{X.current.orientation=c},[X,c]),K(()=>{O||(f.current=null),(!O||T!=="auto")&&(J.current=T)},[O,T]),K(()=>{i&&(O&&H?(x.current=l??-1,J.current&&l!=null&&(te.current=!0,b())):M.current&&(x.current=-1,b()))},[i,O,H,l,b]),K(()=>{if(i){if(!O){q.current=!1;return}if(H)if(r==null){if(q.current=!1,Z.current!=null)return;if(M.current&&(x.current=-1,oe()),(!W.current||!M.current)&&J.current&&(f.current!=null||J.current===!0&&f.current==null)){let m=0;const L=()=>{n.current[0]==null?(m<2&&(m?S=>Y.request(S):queueMicrotask)(L),m+=1):(x.current=f.current==null||bt(f.current,v,h)||C?ht(n):Vt(n),f.current=null,b())};L()}}else Lt(n.current,r)||(x.current=r,oe(),te.current=!1)}},[i,O,H,r,Z,C,n,v,h,b,oe,Y]),K(()=>{if(!i||H||!G||p||!M.current)return;const m=G.nodesRef.current,L=m.find(V=>V.id===ie)?.context?.elements.floating,Q=xt(Be(z??L??null)),S=m.some(V=>V.context&&ye(V.context.elements.floating,Q));L&&!S&&D.current&&L.focus({preventScroll:!0})},[i,H,z,G,ie,p]),K(()=>{W.current=O,M.current=!!H});const ne=r!=null,Se=$(m=>{if(!ue.current)return;const L=n.current.indexOf(m.currentTarget);L!==-1&&(x.current!==L||r!==L)&&(x.current=L,b(m))}),he=$(()=>U??G?.nodesRef.current.find(m=>m.id===ie)?.context?.dataRef?.current.orientation),Re=$(()=>ht(n,fe.current)),se=$(m=>{if(D.current=!1,q.current=!0,m.which===229||!ue.current&&m.currentTarget===B.current)return;if(C&&mr(m.key,c,h,A)){Ze(m.key,he())||Te(m),e.setOpen(!1,me(Dt,m.nativeEvent));const V=w?.current??z;kt(V)&&V.focus();return}r!=null&&r!==x.current&&!Lt(n.current,r)&&(x.current=r);const L=x.current,Q=ht(n,F),S=Vt(n,F);if(k||(m.key==="Home"&&(Te(m),x.current=Q,b(m)),m.key==="End"&&(Te(m),x.current=S,b(m))),I!=null){const V=I(m,x.current,n,c,u,h,F,Q,S);if(V!=null&&V!==x.current&&(x.current=V,b(m)),c==="both")return}if(Ze(m.key,c)){Te(m);const V=xt(m.currentTarget.ownerDocument);if(O&&!p&&ye(m.currentTarget,V)&&!n.current.some(de=>de!=null&&ye(de,V))){x.current=bt(m.key,c,h)?Q:S,b(m),r===x.current&&oe();return}const{index:Ce,wrapped:be}=vn(n.current,L,{decrement:!bt(m.key,c,h),loopFocus:u,allowEscape:d,disabledIndices:F,minIndex:Q,maxIndex:S});be&&(q.current=!1),x.current=Ce,b(m)}}),xe=o.useMemo(()=>({onFocus(L){q.current=!0,Se(L)},onClick({currentTarget:L}){p||L.focus({preventScroll:!0})},onMouseMove(L){Ht(L)||(q.current=!0,te.current=!1,g&&Se(L))},onPointerLeave(L){if(!ue.current||!D.current||L.pointerType==="touch")return;q.current=!0;const Q=L.relatedTarget;if(!(!g||n.current.includes(Q))&&ae.current&&(ee.current?.(),ee.current=null,x.current=-1,b(L),!p)){const S=B.current,V=xt(Be(S));S&&ye(S,V)&&S.focus({preventScroll:!0})}}}),[Se,ue,B,g,n,b,ae,p]),N=o.useMemo(()=>p&&O&&ne&&{"aria-activedescendant":`${E}-${r}`},[p,O,ne,E,r]),ce=o.useMemo(()=>({...k?{}:N,onKeyDown(m){if(m.key==="Tab"&&m.shiftKey&&O&&!p){const L=qt(m.nativeEvent);if(L&&!ye(B.current,L))return;Te(m);const Q=me(Yt,m.nativeEvent);e.setOpen(!1,Q);const S=w?.current??z;!Q.isCanceled&&kt(S)&&S.focus();return}se(m)},onPointerMove(m){Ht(m)||(D.current=!0)}}),[N,se,B,k,e,O,p,z,w]),Ie=o.useMemo(()=>{function m(S){e.setOpen(!0,me(Dt,S.nativeEvent,S.currentTarget))}function L(S){T==="auto"&&tn(S.nativeEvent)&&(J.current=!p)}function Q(S){J.current=T,T==="auto"&&Qt(S.nativeEvent)&&(J.current=!0)}return{onKeyDown(S){const V=e.select("open");D.current=!1;const Ce=S.key.startsWith("Arrow"),be=gr(S.key,he(),h),de=Ze(S.key,V?c:v),De=(C?be:de)||S.key==="Enter"||S.key.trim()==="";if(p&&V&&(!C||Kt(S.currentTarget)))return se(S);if(!(!V&&!P&&Ce)){if(De){const ve=Ze(S.key,he());f.current=C&&ve?null:S.key}if(C){be&&(Te(S),V?(x.current=Re(),b(S),p&&B.current?.focus()):m(S));return}de&&(Z.current!=null&&(x.current=Z.current),Te(S),!V&&P?m(S):se(S),V&&b(S))}},onFocus(S){S.target===S.currentTarget&&e.select("open")&&!p&&(x.current=-1,b(S))},onPointerDown:Q,onPointerEnter:Q,onMouseDown:L,onClick:L}},[se,T,Re,C,b,e,P,c,v,he,h,Z,p,B]),we=o.useMemo(()=>({...N,...Ie}),[N,Ie]);return o.useMemo(()=>i?{reference:we,floating:ce,item:xe,trigger:Ie}:{},[i,we,ce,Ie,xe])}function xr(e,t){const{listRef:n,elementsRef:r,activeIndex:s,onMatch:i,disabledIndices:l,onTyping:d,enabled:u=!0,resetMs:C=750,selectedIndex:h=null}=t,p=$(d),T=e.useState("open"),g=$e(),P=o.useRef(""),F=o.useRef(h??s??-1),c=o.useRef(null),v=$(a=>{function R(k){return r?.current[k]}function w(k){const B=R(k);return B&&!Mn(B)||B?.matches(":disabled")?!1:l==null||!On(yt,k,l)}function I(k,B,ie=0){if(k.length===0)return-1;const G=(ie%k.length+k.length)%k.length,J=B.toLowerCase();for(let x=0;x<k.length;x+=1){const f=(G+x)%k.length;if(!(!k[f]?.toLowerCase().startsWith(J)||!w(f)))return f}return-1}const A=n.current;if(P.current.length>0&&a.key===" "&&(Te(a),p?.(!0)),P.current.length>0&&P.current[0]!==" "&&I(A,P.current)===-1&&a.key!==" "&&p?.(!1),A==null||a.key.length!==1||a.ctrlKey||a.metaKey||a.altKey)return;T&&a.key!==" "&&(Te(a),p?.(!0));const O=P.current==="";O&&(F.current=h??s??-1),A.every((k,B)=>k&&w(B)?k[0]?.toLowerCase()!==k[1]?.toLowerCase():!0)&&P.current===a.key&&(P.current="",F.current=c.current),P.current+=a.key,g.start(C,()=>{P.current="",F.current=c.current,p?.(!1)});const X=((O?h??s??-1:F.current)??0)+1,y=I(A,P.current,X);y!==-1?(i?.(y,a),c.current=y):a.key!==" "&&(P.current="",p?.(!1))}),U=$(a=>{const R=a.relatedTarget,w=e.select("domReferenceElement"),I=e.select("floatingElement");ye(w,R)||ye(I,R)||(g.clear(),P.current="",F.current=c.current,p?.(!1))});K(()=>{!T&&h!==null||(g.clear(),c.current=null,P.current!==""&&(P.current="",p?.(!1)))},[T,h,g,p]);const E=o.useMemo(()=>({onKeyDown:v,onBlur:U}),[v,U]);return o.useMemo(()=>u?{reference:E,floating:E}:{},[u,E])}function Sr(e){const t=o.useRef(""),n=o.useCallback(s=>{s.defaultPrevented||(t.current=s.pointerType,e(s,s.pointerType))},[e]);return{onClick:o.useCallback(s=>{if(s.detail===0){e(s,"keyboard");return}"pointerType"in s?e(s,s.pointerType):e(s,t.current),t.current=""},[e]),onPointerDown:n}}function nn(e,t){const n=o.useRef(e),r=$(t);K(()=>{n.current!==e&&r(n.current),n.current=e},[e,r])}function Rr(e,t){const n=$((i,l)=>{(typeof e=="function"?e():e)||t(l||(Pn?"touch":""))}),{onClick:r,onPointerDown:s}=Sr(n);return o.useMemo(()=>({onClick:r,onPointerDown:s}),[r,s])}function br(e){const[t,n]=o.useState(null),r=Rr(e,n);return nn(e,s=>{s&&!e&&n(null)}),o.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}const yr=20;function Ir(e,t,n,r){const[s,i]=o.useState(!1);K(()=>{if(!e||!t||n==null){i(!1);return}const l=Be(n).documentElement.clientWidth,d=n.offsetWidth;i(l>0&&d>0&&d>=l-yr)},[e,t,n]),$n(e&&(!t||s),r)}const Cr=o.createContext(void 0);function Tr(e){return o.useContext(Cr)}function Er(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 wr(e){const t=o.useRef(!0);t.current&&(t.current=!1,e())}function vr(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}function Nt({controlled:e,default:t,name:n,state:r="value"}){const{current:s}=o.useRef(e!==void 0),[i,l]=o.useState(()=>t),d=s&&e!==void 0?e:i,u=o.useCallback(C=>{s||l(C)},[]);return[d,u]}const rn=o.createContext(void 0),on=o.createContext(void 0);function Ve(){const e=o.useContext(rn);if(e===void 0)throw new Error(Xe(60));return e}function sn(){const e=o.useContext(on);if(e===void 0)throw new Error(Xe(61));return e}const Mr="data-valid",Or="data-invalid",Pr={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Ar={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},Fr={disabled:!1,...Ar},Lr={valid(e){return e===null?null:e?{[Mr]:""}:{[Or]:""}}},Vr={invalid:void 0,name:void 0,validityData:{state:Pr,errors:[],error:"",value:"",initialValue:null},setValidityData:re,disabled:void 0,setTouched:re,setDirty:re,setFilled:re,setFocused:re,focusOwnerRef:{current:void 0},validationMode:"onSubmit",shouldValidateOnChange:()=>!1,state:Fr,registerFieldControl:re,validation:{getValidationProps:(e,t=Ue)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:re,getInputControl:()=>null,commit:async()=>{},change:re}},Dr=o.createContext(Vr);function ft(e=!0){const t=o.useContext(Dr);if(t.setValidityData===re&&!e)throw new Error(Xe(28));return t}function kr(e,t,n,r,s=!0,i){const{registerFieldControl:l}=ft(),d=_e(()=>Symbol());K(()=>{const u=d.current;if(!s){l(u,void 0);return}l(u,{controlRef:e,getValue:r,id:t,name:i,value:n})},[e,s,r,t,i,l,d,n]),K(()=>{const u=d.current;return()=>{l(u,void 0)}},[l,d])}const Hr=o.createContext({controlId:void 0,registerControlId:re,resetControlId:re,labelId:void 0,setLabelId:re,messageIds:[],setMessageIds:re,getDescriptionProps:e=>e});function ln(){return o.useContext(Hr)}function cn(e={}){const{id:t,enabled:n=!0}=e,{controlId:r,registerControlId:s,resetControlId:i}=ln(),l=Xn(),d=_e(()=>Symbol()),u=o.useRef(!1),C=o.useRef(!1),h=$(()=>{!u.current||s===re||(u.current=!1,s(d.current,void 0))});return K(()=>{if(!n||s===re){h();return}let p;if(t!==void 0)C.current=!0,p=t;else if(C.current)p=l;else{i();return}if(p===void 0){h();return}u.current=!0,s(d.current,p)},[t,n,s,i,l,d,h]),K(()=>h,[h]),(n?r:void 0)??t??l}function Nr(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 un=(e,t)=>Object.is(e,t);function Le(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Ur(e,t,n){return Array.isArray(e)&&Array.isArray(t)?!Nr(e,t,(r,s)=>Le(r,s,n)):e!==t}function Ct(e,t,n){return e?e.some(r=>r===void 0?!1:Le(t,r,n)):!1}function ot(e,t,n){return e?e.findIndex(r=>r===void 0?!1:Le(r,t,n)):-1}function _r(e,t){if(t!==un)return r=>Ct(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 an(e,t,n,r){const s=r&&Array.isArray(t)?e.findIndex(_r(t,n)):ot(e,t,n);return s===-1?null:s}function Br(e,t,n,r,s,i){return Ct(r,t,s)?i!=null&&e>i&&Ct(r,n[i],s)?i:e:e===i?an(n,r,s,!0):i}function Wr(e,t,n){return e.filter(r=>!Le(t,r,n))}function Tt(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function jr(e){return typeof e=="object"&&e!=null&&Array.isArray(e.items)}function fn(e){return jr(e?.[0])}function qr(e){return fn(e)?e.flatMap(t=>t.items):e}function Kr(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(fn(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 dn(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 Tt(e)}function Ne(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?Tt(e.value):Tt(e)}function pn(e,t,n){function r(){return dn(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=qr(t);if(e==null||typeof e!="object"){const l=i.find(d=>d.value===e);return l&&l.label!=null?l.label:r()}if("value"in e){const l=i.find(d=>d&&d.value===e.value);if(l&&l.label!=null)return l.label}}return r()}function zr(e,t,n){return e.reduce((r,s,i)=>(i>0&&r.push(", "),r.push(ge.jsx(o.Fragment,{children:pn(s,t,n)},i)),r),[])}const Yr={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,multiple:e=>e.multiple,disabled:e=>e.disabled,readOnly:e=>e.readOnly,required:e=>e.required,highlightItemOnHover:e=>e.highlightItemOnHover,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:Ne(t,r)!==""},hasNullItemLabel:(e,t)=>t?Kr(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=>Le(t,s,n)):Le(t,r,n)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,itemRoot:e=>e.itemRoot,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},$r=o.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:re,validationMode:"onSubmit",submitCountRef:{current:0}});function Xr(){return o.useContext($r)}const Ee=1;function gn(e,t){return Math.max(0,e-t)}function Gr(e,t){if(t<=0)return 0;const n=ze(e,0,t),r=n,s=t-n,i=r<=Ee,l=s<=Ee;return i&&l?r<=s?0:t:i?0:l?t:n}function wo(e){const{id:t,value:n,defaultValue:r=null,onValueChange:s,open:i,defaultOpen:l=!1,onOpenChange:d,name:u,form:C,autoComplete:h,disabled:p=!1,readOnly:T=!1,required:g=!1,modal:P=!0,actionsRef:F,inputRef:c,onOpenChangeComplete:v,items:U,multiple:E=!1,itemToStringLabel:a,itemToStringValue:R,isItemEqualToValue:w=un,highlightItemOnHover:I=!0,children:A}=e,{clearErrors:O}=Xr(),{setDirty:H,setTouched:z,setFocused:X,validityData:y,setFilled:k,name:B,disabled:ie,validation:G,validationMode:J}=ft(),x=cn({id:t}),f=ie||p,D=B??u,[b,M]=Nt({controlled:n,default:E?r??yt:r,name:"Select",state:"value"}),[W,q]=Nt({controlled:i,default:l,name:"Select",state:"open"}),te=o.useRef([]),ee=o.useRef([]),fe=o.useRef(null),ue=o.useRef(null),Z=o.useRef(0),ae=o.useRef(null),j=o.useRef([]),Y=o.useRef(!1),oe=o.useRef(null),ne=o.useRef(null),Se=o.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),he=o.useRef(!1),Re=o.useRef(b),{openMethod:se,triggerProps:xe}=br(W),N=_e(()=>new Vn({id:x,labelId:void 0,modal:P,multiple:E,disabled:f,readOnly:T,required:g,highlightItemOnHover:I,itemToStringLabel:a,itemToStringValue:R,isItemEqualToValue:w,value:b,open:W,mounted:W,transitionStatus:void 0,items:U,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:Ue,triggerProps:Ue,itemRoot:{props:Ue,multiple:E,disabled:f,readOnly:T,isItemEqualToValue:w},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1},{setValue:re,setOpen:re,handleScrollArrowVisibility:re,onOpenChangeComplete:re,listRef:te,popupRef:fe,scrollHandlerRef:ue,scrollArrowsMountedCountRef:Z,valueRef:ae,valuesRef:j,labelsRef:ee,typingRef:Y,selectionRef:Se,firstItemTextRef:oe,selectedItemTextRef:ne,alignItemWithTriggerActiveRef:he,initialValueRef:Re},Yr)).current,[ce,Ie]=o.useState(!1),{mounted:we,transitionStatus:m,forceUnmount:L}=Gn({open:W,ref:fe,preventUnmountOnClose:ce,setPreventUnmountOnClose:Ie,onUnmount(){N.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),v?.(!1)}}),Q=N.useState("activeIndex"),S=N.useState("selectedIndex"),V=N.useState("triggerElement"),Ce=N.useState("positionerElement"),be=Er(se),de=se??be,De=o.useMemo(()=>E?"":Ne(b,R),[E,b,R]),ve=o.useMemo(()=>E&&Array.isArray(b)?b.map(_=>Ne(_,R)):Ne(b,R),[E,b,R]),dt=Fe(V),Ge=$(()=>ve);kr(dt,x,b,Ge,!f,u);const ke=E?Array.isArray(b)&&b.length>0:b!=null&&De!=="";K(()=>{k(ke)},[ke,k]),K(function(){const le=an(j.current,b,w,E);le===null&&(ne.current=null),!W&&N.set("selectedIndex",le)},[E,W,b,w,N]),nn(b,()=>{O(D),H(Ur(b,y.initialValue,w)),G.change(b)});const He=$((_,le)=>{const Ae=le,qe=Qn(Ae);d?.(_,Ae),!le.isCanceled&&(_||Ie(qe()),q(_),!_&&(le.reason===Yt||le.reason===Dn)&&(z(!0),X(!1),J==="onBlur"&&G.commit(b)))});o.useImperativeHandle(F,()=>({unmount:L,close:()=>{N.state.open&&He(!1,me(kn))}}),[L,He,N]);const je=$((_,le)=>{s?.(_,le),!le.isCanceled&&M(_)}),pt=$(_=>{const le=gn(_.scrollHeight,_.clientHeight),Ae=Gr(_.scrollTop,le),qe=Ae>0,Ke=Ae<le;N.set("scrollUpArrowVisible",qe),N.set("scrollDownArrowVisible",Ke)}),pe=pr({open:W,onOpenChange:He,elements:{reference:V,floating:Ce}}),Me=dr(pe,{enabled:!f,event:"mousedown"}),Oe=Jn(pe),Pe=hr(pe,{enabled:!f,listRef:te,activeIndex:Q,selectedIndex:S,disabledIndices:yt,onNavigate(_){_===null&&!W||N.set("activeIndex",_)},focusItemOnHover:I}),Je=xr(pe,{enabled:!f&&(W||!T&&!E),listRef:ee,activeIndex:Q,selectedIndex:S,disabledIndices:_=>vr(te.current[_]),onMatch(_){W?N.set("activeIndex",_):je(j.current[_],me(it))},onTyping(_){Y.current=_}}),wt=o.useMemo(()=>It(Je.reference,Pe.reference,Oe.reference,Me.reference,xe),[Me.reference,Je.reference,Pe.reference,Oe.reference,xe]),vt=o.useMemo(()=>It(Zn,Je.floating,Pe.floating,Oe.floating),[Je.floating,Pe.floating,Oe.floating]),Mt=Pe.item??Ue,Ot=o.useMemo(()=>({props:Mt,multiple:E,disabled:f,readOnly:T,isItemEqualToValue:w}),[Mt,E,f,T,w]);N.useContextCallback("setValue",je),N.useContextCallback("setOpen",He),N.useContextCallback("handleScrollArrowVisibility",pt),N.useContextCallback("onOpenChangeComplete",v),wr(()=>{N.update({popupProps:vt,triggerProps:wt,itemRoot:Ot})}),N.useSyncedValues({id:x,modal:P,multiple:E,disabled:f,readOnly:T,required:g,highlightItemOnHover:I,value:b,open:W,mounted:we,transitionStatus:m,popupProps:vt,triggerProps:wt,itemRoot:Ot,items:U,itemToStringLabel:a,itemToStringValue:R,isItemEqualToValue:w,openMethod:de});const bn=An(c,G.inputRef),Pt=E?void 0:D,yn=o.useMemo(()=>!E||!Array.isArray(b)||!D?null:b.map(_=>{const le=Ne(_,R);return ge.jsx("input",{type:"hidden",form:C,name:D,value:le,disabled:f},le)}),[E,b,C,D,R,f]);return ge.jsxs(rn.Provider,{value:N,children:[ge.jsx(on.Provider,{value:pe,children:A}),ge.jsx("input",{...G.getValidationProps(f,{onFocus(){N.state.triggerElement?.focus({focusVisible:!0})},onChange(_){if(_.nativeEvent.defaultPrevented||f||T)return;const le=_.currentTarget.value,Ae=me(it,_.nativeEvent);function qe(){if(E)return;const Ke=le.toLowerCase();let gt=j.current.findIndex(mt=>Ne(mt,R).toLowerCase()===Ke||dn(mt,a).toLowerCase()===Ke);gt===-1&&(gt=j.current.findIndex((mt,In)=>{const Ft=ee.current[In];return Ft!=null&&Ft.toLowerCase()===Ke}));const At=j.current[gt];At!=null&&je(At,Ae)}N.set("forceMount",!0),queueMicrotask(qe)}}),id:x&&Pt==null?`${x}-hidden-input`:void 0,form:C,name:Pt,autoComplete:h,value:De,disabled:f,required:g&&!(E&&ke),readOnly:T,ref:bn,style:D?Fn:Ln,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),yn]})}function Jr(e,t){return e??t}function Zr(e,t,n){const{setFocused:r,focusOwnerRef:s}=ft(),i=$(l=>{(l?!e:s.current===i)&&(s.current=l&&i,r(l))});return K(()=>{const l=t.current;return l?.getRootNode()?.activeElement===l&&i(!0),()=>i(!1)},[e,t,i]),i}const Qe=5;function Qr(e,t){const n=eo(t);return e.clientX>=n.left-Qe&&e.clientX<=n.right+Qe&&e.clientY>=n.top-Qe&&e.clientY<=n.bottom+Qe}function eo(e){const t=e.getBoundingClientRect(),n=rt(e);if(Hn)return t;const r=n.getComputedStyle(e,"::before"),s=n.getComputedStyle(e,"::after");if(!(r.content!=="none"||s.content!=="none"))return t;const l=parseFloat(r.width)||0,d=parseFloat(r.height)||0,u=parseFloat(s.width)||0,C=parseFloat(s.height)||0,h=Math.max(t.width,l,u),p=Math.max(t.height,d,C),T=h-t.width,g=p-t.height;return{left:t.left-T/2,right:t.right+T/2,top:t.top-g/2,bottom:t.bottom+g/2}}const to="data-popup-side",no=400,ro={...er,...Lr,popupSide:e=>e?{[to]:e}:null,value:()=>null},vo=o.forwardRef(function(t,n){const{render:r,className:s,id:i,disabled:l=!1,nativeButton:d=!0,style:u,...C}=t,{setTouched:h,validationMode:p,validation:T,state:g,disabled:P}=ft(),{labelId:F}=ln(),c=Ve(),v=c.useState("readOnly"),U=c.useState("required"),E=c.useState("disabled"),a=P||E||l,R=c.useState("open"),w=c.useState("mounted"),I=c.useState("value"),A=c.useState("triggerProps"),O=c.useState("positionerElement"),H=c.useState("listElement"),z=c.useState("popupSide"),X=c.useState("id"),y=c.useState("labelId"),k=c.useState("hasSelectedValue"),B=w&&O?z:null,ie=i??X,G=Jr(F,y);cn({id:i});const J=Fe(O),x=o.useRef(null),f=Zr(a,x),{getButtonProps:D,buttonRef:b}=Gt({disabled:a,native:d}),M=c.useStateSetter("triggerElement"),W=$e(),q=$e(),te=$e();o.useEffect(()=>{if(R)return te.start(no,()=>{c.context.selectionRef.current.allowUnselectedMouseUp=!0,c.context.selectionRef.current.allowSelectedMouseUp=!0}),()=>{te.clear()};c.context.selectionRef.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},q.clear()},[R,c,q,te]);const ee=It(A,{id:ie,role:"combobox","aria-expanded":R,"aria-haspopup":"listbox","aria-controls":R?H?.id??zt(O)?.id:void 0,"aria-labelledby":G,"aria-readonly":v||void 0,"aria-required":U||void 0,tabIndex:a?-1:0,onFocus(Z){f(!0),R&&c.context.alignItemWithTriggerActiveRef.current&&c.context.setOpen(!1,me(it,Z.nativeEvent)),W.start(0,()=>{c.set("forceMount",!0)})},onBlur(Z){ye(O,Z.relatedTarget)||(h(!0),f(!1),p==="onBlur"&&T.commit(I))},onMouseDown(Z){if(R)return;const ae=Be(Z.currentTarget);function j(Y){if(!x.current)return;const oe=Y.target;ye(x.current,oe)||ye(J.current,oe)||Qr(Y,x.current)||c.context.setOpen(!1,me(Nn,Y))}q.start(0,()=>{ae.addEventListener("mouseup",j,{once:!0})})}},C,D),fe=T.getValidationProps(a,ee);fe.role="combobox";const ue={...g,open:R,disabled:a,value:I,readOnly:v,popupSide:B,placeholder:!k};return We("button",t,{ref:[n,x,b,M],state:ue,stateAttributesMapping:ro,props:fe})}),oo={value:()=>null},Mo=o.forwardRef(function(t,n){const{className:r,render:s,children:i,placeholder:l,style:d,...u}=t,C=Ve(),h=C.useState("value"),p=C.useState("items"),T=C.useState("itemToStringLabel"),g=C.useState("hasSelectedValue"),P=!g&&l!=null&&i==null,F=C.useState("hasNullItemLabel",P),c={value:h,placeholder:!g};let v=null;return typeof i=="function"?v=i(h):i!=null?v=i:P&&!F?v=l:Array.isArray(h)?v=zr(h,p,T):v=pn(h,p,T),We("span",t,{state:c,ref:[n,C.context.valueRef],props:[{children:v},u],stateAttributesMapping:oo})}),Oo=o.forwardRef(function(t,n){const r=Ve(),s=r.useState("mounted"),i=r.useState("forceMount");return s||i?ge.jsx(Un,{ref:n,...t}):null}),mn=o.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function so(){return o.useContext(mn)}function io(e){const{children:t,elementsRef:n,labelsRef:r,onMapChange:s}=e,i=$(s),[,l]=o.useState(0),d=_e(co).current,u=_e(lo).current,C=o.useRef(0),h=o.useRef(!0),p=o.useRef(null),T=o.useRef(null),g=$(()=>{h.current||(h.current=!0,l(R=>R+1))}),P=$((R,w)=>{u.set(R,w),g()}),F=$(R=>{u.delete(R),g()}),c=$(R=>{const w=new Map;return n.current.length=0,r&&(r.current.length=0),R.forEach(I=>{w.set(I.element,{...I.registration.metadata??{},index:I.index}),n.current[I.index]=I.element,r&&(r.current[I.index]=I.registration.label!==void 0?I.registration.label:I.registration.textRef?.current?.textContent??I.element.textContent)}),C.current=n.current.length,w});function v(R){if(T.current?.disconnect(),T.current=null,typeof MutationObserver!="function"||R.length<2)return;const w=new MutationObserver(A=>{if(!fo(A))return;let O=null;for(const H of R)if(H.isConnected){if(O&&hn(O,H)>0){w.disconnect(),g();return}O=H}});T.current=w;const I=new Set;for(let A=1;A<R.length;A+=1){const O=ao(R[A-1],R[A]);O&&I.add(O)}I.forEach(A=>w.observe(A,{childList:!0}))}const U=$(()=>{const[R,w]=uo(u),I=c(R),A=p.current,O=!A||A.length!==R.length||R.some((H,z)=>{const X=A[z];return H.index!==X.index||H.element!==X.element||H.registration.index!==X.registration.index||H.registration.metadata!==X.registration.metadata});v(w),p.current=R,h.current=!1,O&&(d.forEach(H=>H(I)),i(I))});K(()=>(!h.current&&p.current&&c(p.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,c]),K(()=>{h.current&&U()}),K(()=>()=>{T.current?.disconnect(),h.current=!0},[]);const E=$(R=>(d.add(R),()=>{d.delete(R)})),a=o.useMemo(()=>({register:P,unregister:F,subscribeMapChange:E,nextIndexRef:C}),[P,F,E,C]);return ge.jsx(mn.Provider,{value:a,children:t})}function lo(){return new Map}function co(){return new Set}function uo(e){const t=new Set,n=[],r=[];e.forEach((i,l)=>{if(!l.isConnected)return;const d=i.index,u={index:d??-1,element:l,registration:i};d===null?r.push(u):d>=0&&(t.add(d),n.push(u))});let s=0;return r.sort((i,l)=>hn(i.element,l.element)),r.forEach(i=>{for(;t.has(s);)s+=1;i.index=s,n.push(i),s+=1}),t.size>0&&n.sort((i,l)=>i.index-l.index),[n,r.map(i=>i.element)]}function ao(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function fo(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 hn(e,t){return e.nextElementSibling===t?-1:t.nextElementSibling===e?1:e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}const xn=o.createContext(void 0);function po(){const e=o.useContext(xn);if(!e)throw new Error(Xe(59));return e}function lt(e,t){e&&Object.assign(e.style,t)}const go={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},mo={position:"fixed"},Po=o.forwardRef(function(t,n){const{anchor:r,className:s,render:i,positionMethod:l,side:d,align:u,sideOffset:C,alignOffset:h,collisionBoundary:p="clipping-ancestors",collisionPadding:T,arrowPadding:g,sticky:P,disableAnchorTracking:F,alignItemWithTrigger:c=!0,collisionAvoidance:v=_n,style:U,...E}=t,a=Ve(),R=sn(),w=a.useState("open"),I=a.useState("mounted"),A=a.useState("modal"),O=a.useState("value"),H=a.useState("openMethod"),z=a.useState("positionerElement"),X=a.useState("triggerElement"),y=a.useState("isItemEqualToValue"),k=a.useState("transitionStatus"),B=o.useRef(null),ie=o.useRef(null),[G,J]=o.useState(c),x=I&&G&&H!=="touch";!I&&G!==c&&J(c),o.useImperativeHandle(a.context.alignItemWithTriggerActiveRef,()=>x),Ir((x||A)&&w,H==="touch",z,X);const f=ir({anchor:r,floatingRootContext:R,positionMethod:l,mounted:I,side:d,sideOffset:C,align:u,alignOffset:h,arrowPadding:g,collisionBoundary:p,collisionPadding:T,sticky:P,disableAnchorTracking:F??x,collisionAvoidance:v,keepMounted:!0}),D=x?"none":f.side,b=x?mo:f.positionerStyles,M={open:w,side:D,align:f.align,anchorHidden:f.anchorHidden};K(()=>{a.set("popupSide",f.side)},[a,f.side]);const W=a.useStateSetter("positionerElement"),q=lr(t,M,{styles:b,transitionStatus:k,props:E,refs:[n,W],hidden:!I,inert:!w}),te=o.useRef(0),ee=$(ue=>{if(a.context.valuesRef.current.length===0)return;const Z=te.current;te.current=ue.size;const ae=me(it);if(Z!==0&&!a.state.multiple&&O!==null&&ot(a.context.valuesRef.current,O,y)===-1){const Y=a.context.initialValueRef.current,ne=Y!=null&&ot(a.context.valuesRef.current,Y,y)!==-1?Y:null;a.context.setValue(ne,ae),ne===null&&(a.set("selectedIndex",null),a.context.selectedItemTextRef.current=null)}if(Z!==0&&a.state.multiple&&Array.isArray(O)){const j=O.filter(Y=>ot(a.context.valuesRef.current,Y,y)!==-1);j.length!==O.length&&(a.context.setValue(j,ae),j.length===0&&(a.set("selectedIndex",null),a.context.selectedItemTextRef.current=null))}if(w&&x){a.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const j={height:""};lt(z,j),lt(a.context.popupRef.current,j)}}),fe=o.useMemo(()=>({...f,side:D,alignItemWithTriggerActive:x,setControlledAlignItemWithTrigger:J,scrollUpArrowRef:B,scrollDownArrowRef:ie}),[f,D,x,J]);return ge.jsx(io,{elementsRef:a.context.listRef,labelsRef:a.context.labelsRef,onMapChange:ee,children:ge.jsxs(xn.Provider,{value:fe,children:[I&&A&&ge.jsx(tr,{inert:Bn(!w),cutout:X}),q]})})}),et="base-ui-disable-scrollbar",Ut={className:et,getElement(e){return ge.jsx("style",{nonce:e,href:et,precedence:"base-ui:low",children:`.${et}{scrollbar-width:none}.${et}::-webkit-scrollbar{display:none}`})}},ho=o.createContext(void 0),xo={disableStyleElements:!1};function So(){return o.useContext(ho)??xo}const _t="--transform-origin",Ro={...rr,...Zt},Ao=o.forwardRef(function(t,n){const{render:r,className:s,style:i,finalFocus:l,...d}=t,u=Ve(),C=u.useState("multiple"),h=u.useState("readOnly"),p=u.useState("highlightItemOnHover"),T=sn(),{side:g,align:P,alignItemWithTriggerActive:F,isPositioned:c,setControlledAlignItemWithTrigger:v}=po(),U=Tr()!=null,E=cr(),{nonce:a,disableStyleElements:R}=So(),w=u.useState("id"),I=u.useState("open"),A=u.useState("openMethod"),O=u.useState("mounted"),H=u.useState("popupProps"),z=u.useState("transitionStatus"),X=u.useState("triggerElement"),y=u.useState("positionerElement"),k=u.useState("listElement"),B=o.useRef(!1),ie=o.useRef(!1),G=o.useRef({}),J=st(),x=$(M=>{if(!y||!u.context.popupRef.current||!ie.current)return;const W=y.style.top==="0px",q=y.style.bottom==="0px";if(B.current||!F||!W&&!q){u.context.handleScrollArrowVisibility(M);return}const te=Wt(y),ee=Ye(y.getBoundingClientRect().height,"y",te),fe=Be(y),ue=rt(y),Z=ue.getComputedStyle(y),ae=parseFloat(Z.marginTop),j=parseFloat(Z.marginBottom),Y=Bt(ue.getComputedStyle(u.context.popupRef.current)),oe=Math.min(fe.documentElement.clientHeight-ae-j,Y),ne=M.scrollTop,Se=tt(M);let he=null;const Re=ce=>{y.style.height=`${ce}px`},se=W?Se-ne:ne,xe=Math.min(ee+se,oe);if(se<=Ee){const ce=ze(se,0,oe-ee);ce>0&&Re(ee+ce),M.scrollTop=W?Se:0,oe-(ee+ce)<=Ee&&(B.current=!0),u.context.handleScrollArrowVisibility(M);return}if(oe-xe>Ee)he=W?1/0:0;else if(q&&ne<Se){const ce=ee+se-oe;he=ne-(se-ce)}const N=Math.ceil(xe);if(N!==0&&Re(N),he!=null){const ce=ze(he,0,tt(M));Math.abs(M.scrollTop-ce)>Ee&&(M.scrollTop=ce)}N>=oe-Ee&&(B.current=!0),u.context.handleScrollArrowVisibility(M)});o.useImperativeHandle(u.context.scrollHandlerRef,()=>x,[x]),Jt({open:I,ref:u.context.popupRef,onComplete(){I&&u.context.onOpenChangeComplete(!0)}});const f={open:I,transitionStatus:z,side:g,align:P};K(()=>{!y||!u.context.popupRef.current||Object.keys(G.current).length||(G.current={top:y.style.top||"0",left:y.style.left||"0",right:y.style.right,height:y.style.height,bottom:y.style.bottom,minHeight:y.style.minHeight,maxHeight:y.style.maxHeight,marginTop:y.style.marginTop,marginBottom:y.style.marginBottom})},[u,y]),K(()=>{I||F||(ie.current=!1,B.current=!1,lt(y,G.current))},[I,F,y]),K(()=>{const M=u.context.popupRef.current;if(!I||!X||!y||!M||F&&!c||u.state.transitionStatus==="ending")return;if(ie.current=!0,M.style.removeProperty(_t),!F){J.request(()=>u.context.handleScrollArrowVisibility(k||M));return}const W=bo(M);try{let q=u.context.selectedItemTextRef.current;q?.isConnected||(q=!u.select("hasSelectedValue")&&u.context.firstItemTextRef.current?.isConnected?u.context.firstItemTextRef.current:null);const te=u.context.valueRef.current,ee=rt(y),fe=ee.getComputedStyle(y),ue=ee.getComputedStyle(M),Z=Be(X),ae=Wt(X),j=nt(X.getBoundingClientRect(),ae),Y=nt(y.getBoundingClientRect(),ae),oe=j.height,ne=k||M,Se=ne.scrollHeight,he=parseFloat(ue.borderBottomWidth),Re=parseFloat(fe.marginTop)||10,se=parseFloat(fe.marginBottom)||10,xe=parseFloat(fe.minHeight)||100,N=Bt(ue),ce=5,Ie=5,we=20,m=Z.documentElement.clientHeight-Re-se,L=Z.documentElement.clientWidth,Q=m-j.bottom+oe;let S,V=E==="rtl"?j.right-Y.width:j.left,Ce=0;if(q&&te){const pe=nt(te.getBoundingClientRect(),ae);S=nt(q.getBoundingClientRect(),ae),V=Y.left+(E==="rtl"?pe.right-S.right:pe.left-S.left);const Me=pe.top-j.top+pe.height/2;Ce=S.top-Y.top+S.height/2-Me}const be=Q+Ce+se+he;let de=Math.min(m,be);const De=m-Re-se,ve=be-de,dt=L-Ie;y.style.left=`${ze(V,ce,dt-Y.width)}px`,y.style.height=`${de}px`,y.style.maxHeight="none",y.style.marginTop=`${Re}px`,y.style.marginBottom=`${se}px`,M.style.height="100%";const Ge=tt(ne),ke=ve>=Ge-Ee;ke&&(de=Math.min(m,Y.height)-(ve-Ge));const He=j.top<we||j.bottom>m-we||Math.ceil(de)+Ee<Math.min(Se,xe),je=(ee.visualViewport?.scale??1)!==1&&$t;if(He||je){lt(y,G.current),v(!1);return}const pt=Math.max(xe,de);if(ke){const pe=Math.max(0,m-be);y.style.top=Y.height>=De?"0":`${pe}px`,y.style.height=`${de}px`,ne.scrollTop=tt(ne)}else y.style.bottom="0",ne.scrollTop=ve;if(S){const pe=Y.top,Me=Y.height,Oe=S.top+S.height/2,Pe=ze(Me>0?(Oe-pe)/Me*100:50,0,100);M.style.setProperty(_t,`50% ${Pe}%`)}(pt===m||de>=N)&&(B.current=!0),u.context.handleScrollArrowVisibility(ne),p&&u.state.selectedIndex===null&&u.state.activeIndex===null&&u.context.listRef.current[0]!=null&&u.set("activeIndex",0)}finally{W()}},[u,I,y,X,F,v,J,k,p,E,c]),o.useEffect(()=>{if(!F||!y||!I)return;const M=rt(y);function W(q){u.context.setOpen(!1,me(jn,q))}return Wn(M,"resize",W)},[u,F,y,I]);const D={...k?{role:"presentation"}:{role:"listbox","aria-multiselectable":C||void 0,"aria-readonly":h||void 0,id:`${w}-list`},onKeyDown(M){U&&or.has(M.key)&&M.stopPropagation()},onScroll(M){k||x(M.currentTarget)},...F&&{style:k?{height:"100%"}:go},className:!k&&F?Ut.className:void 0},b=We("div",t,{ref:[n,u.context.popupRef],state:f,stateAttributesMapping:Ro,props:[H,D,fr(z),d]});return ge.jsxs(o.Fragment,{children:[!R&&Ut.getElement(a),ge.jsx(nr,{context:T,modal:!1,disabled:!O,openInteractionType:A,returnFocus:l,restoreFocus:!0,children:b})]})});function Bt(e){const t=e.maxHeight;return t.endsWith("px")&&parseFloat(t)||1/0}function tt(e){return gn(e.scrollHeight,e.clientHeight)}function Wt(e){return ur.getScale(e)}function Ye(e,t,n){return e/n[t]}function nt(e,t){return ar({x:Ye(e.x,"x",t),y:Ye(e.y,"y",t),width:Ye(e.width,"x",t),height:Ye(e.height,"y",t)})}const jt=[["transform","none"],["scale","1"],["translate","0 0"]];function bo(e){const{style:t}=e,n={};for(const[r,s]of jt)n[r]=t.getPropertyValue(r),t.setProperty(r,s,"important");return()=>{for(const[r]of jt){const s=n[r];s?t.setProperty(r,s):t.removeProperty(r)}}}function yo(e={}){const{guess:t,label:n,metadata:r,textRef:s,index:i}=e,{register:l,unregister:d,subscribeMapChange:u,nextIndexRef:C}=so(),h=o.useRef(-1),[p,T]=o.useState(i==null&&t?()=>{if(h.current===-1){const c=C.current;C.current+=1,h.current=c}return h.current}:-1),g=i??p,P=o.useRef(null),F=o.useCallback(c=>{const v=P.current;v&&d(v),P.current=c,c&&l(c,{metadata:r??null,index:i??null,label:n,textRef:s})},[i,l,d,r,n,s]);return K(()=>{if(i==null)return u(c=>{const v=P.current?c.get(P.current)?.index:null;v!=null&&T(v)})},[i,u]),{ref:F,index:g}}const Sn=o.createContext(void 0);function Rn(){const e=o.useContext(Sn);if(!e)throw new Error(Xe(57));return e}const Fo=o.memo(o.forwardRef(function(t,n){const{render:r,className:s,style:i,value:l=null,label:d,disabled:u=!1,nativeButton:C=!1,...h}=t,p=o.useRef(null),T=yo({guess:!0,label:d,textRef:p}),g=Ve(),{props:P,multiple:F,disabled:c,readOnly:v,isItemEqualToValue:U}=g.useState("itemRoot"),E=c||u,a=g.useState("isActive",T.index),R=g.useState("open"),w=g.useState("isSelected",l),I=g.useState("isSelectedByFocus",T.index),A=T.index,O=o.useRef(null);K(()=>{const f=g.context.valuesRef.current;return f[A]=l,()=>{delete f[A]}},[A,l,g]),K(()=>{const f=g.state.value,D=g.state.selectedIndex;let b=D,M;F&&Array.isArray(f)?(b=Br(A,l,g.context.valuesRef.current,f,U,D),M=b===A,A===D&&!M&&(g.context.selectedItemTextRef.current=null)):(M=f!==void 0&&Le(l,f,U),M&&(b=A)),g.set("selectedIndex",b),M&&p.current&&(g.context.selectedItemTextRef.current=p.current)},[A,F,U,g,l]);const H=o.useRef("mouse"),z=o.useRef(!1),{getButtonProps:X,buttonRef:y}=Gt({disabled:E,focusableWhenDisabled:!0,native:C,composite:!0}),k={disabled:E,selected:w,highlighted:a};function B(f){if(c||v)return;const D=g.state.value;if(F){const b=Array.isArray(D)?D:[],M=w?Wr(b,l,U):[...b,l];g.context.setValue(M,me(St,f))}else g.context.setValue(l,me(St,f)),g.context.setOpen(!1,me(St,f))}function ie(){g.context.selectionRef.current.dragY=0}const G={role:"option","aria-selected":w,tabIndex:R&&a?0:-1,onKeyDown(f){g.set("activeIndex",A),f.key===" "&&g.context.typingRef.current&&f.preventDefault()},onClick(f){const D=H.current!=="touch",b=f.nativeEvent.pointerType,M=D&&tn(f.nativeEvent)&&(b!==void 0||a),W=D&&!M&&!z.current;z.current=!1,!(E||W)&&B(f.nativeEvent)},onPointerEnter(f){H.current=f.pointerType},onPointerMove(f){if(f.pointerType==="mouse"&&f.buttons===1){const D=g.context.selectionRef.current;D.dragY+=f.movementY,D.dragY**2>=64&&(D.allowUnselectedMouseUp=!0)}},onPointerDown(f){H.current=f.pointerType,z.current=!0,ie()},onMouseUp(){if(ie(),E||H.current==="touch"||z.current)return;const f=!g.context.selectionRef.current.allowSelectedMouseUp&&w,D=!g.context.selectionRef.current.allowUnselectedMouseUp&&!w;f||D||(z.current=!0,O.current?.click(),z.current=!1)}},J=We("div",t,{ref:[y,n,T.ref,O],state:k,props:[P,G,h,X]}),x=o.useMemo(()=>({selected:w,index:A,textRef:p,selectedByFocus:I}),[w,A,p,I]);return ge.jsx(Sn.Provider,{value:x,children:J})})),Io=o.memo(o.forwardRef(function(t,n){const{render:r,className:s,style:i,keepMounted:l,selected:d,...u}=t,C=o.useRef(null),{transitionStatus:h,setMounted:p}=sr(d),g=We("span",t,{ref:[n,C],state:{selected:d,transitionStatus:h},props:[{"aria-hidden":!0,children:"✔️"},u],stateAttributesMapping:Zt});return Jt({batch:!0,enabled:!d,open:d,ref:C,onComplete(){d||p(!1)}}),g})),Lo=o.forwardRef(function(t,n){const{selected:r}=Rn();return t.keepMounted||r?ge.jsx(Io,{...t,selected:r,ref:n}):null}),Vo=o.memo(o.forwardRef(function(t,n){const{index:r,textRef:s,selectedByFocus:i}=Rn(),l=Ve(),{render:d,className:u,style:C,...h}=t,p=o.useCallback(g=>{g&&(r===0&&(l.context.firstItemTextRef.current=g),i&&(l.context.selectedItemTextRef.current=g))},[l,r,i]);return We("div",t,{ref:[p,n,s],props:h})}));export{go as L,wo as S,po as a,vo as b,Mo as c,Oo as d,Po as e,Ao as f,Fo as g,Lo as h,Vo as i,dr as j,Rr as k,Ir as l,Tr as m,Lr as n,Xr as o,ft as p,ln as q,cn as r,Ut as s,Zr as t,Ve as u,Nt as v,kr as w,nn as x};
|
|
1
|
+
import{bJ as Cn,r as o,cy as st,b0 as $e,b9 as qt,c3 as Kt,K as Ue,N as me,cv as Tn,aZ as _e,b2 as K,b3 as En,cz as zt,cw as wn,b1 as $,dm as Lt,dn as ht,dp as Vt,c1 as xt,b4 as Be,bc as ye,dq as Dt,br as kt,dr as vn,bM as Yt,b$ as $t,ds as ct,dt as ut,du as Xt,dv as Et,cH as Mn,dw as On,dx as yt,cN as Pn,bH as Xe,aX as re,j as ge,c5 as It,ca as An,cc as Fn,cd as Ln,bZ as it,bI as Vn,cB as Dn,bO as kn,bt as rt,ct as Hn,M as Gt,J as We,dy as Nn,bU as Un,dz as _n,bX as Bn,bY as Jt,b7 as Wn,dA as jn,c9 as Zt,dB as St}from"./__vite-browser-external-BEEzY7mq.js";import{i as Rt,E as Qt,b as en,F as qn,P as Kn,c as Fe,a as zn,G as Yn,H as Te,J as tn,B as $n,u as Xn,K as Gn,n as Jn,y as Zn,d as Qn,r as er,I as tr,x as nr,p as rr,C as or,D as sr}from"./composite-BtDzx3a2.js";import{u as ir,a as lr,b as cr,p as ur,r as ar,g as fr}from"./usePositioner-DfxvIif8.js";function ze(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}function dr(e,t={}){const{enabled:n=!0,event:r="click",toggle:s=!0,ignoreMouse:i=!1,stickIfOpen:l=!0,touchOpenDelay:d=0,reason:u=Cn}=t,C=e.context.dataRef,h=o.useRef(void 0),p=st(),T=$e(),g=o.useMemo(()=>{function P(c,v,U,E){const a=me(u,v,U);c&&E==="touch"&&d>0?T.start(d,()=>{e.setOpen(!0,a)}):e.setOpen(c,a)}function F(c,v,U){const E=C.current.openEvent,a=e.select("domReferenceElement")!==v;return c&&a||!c||!s?!0:E&&(typeof l=="function"?l():l)?!U(E.type):!1}return{onPointerDown(c){h.current=Rt(c.pointerType,!0)&&Qt(c.nativeEvent)?"virtual":c.pointerType},onMouseDown(c){const v=h.current,U=c.nativeEvent,E=e.select("open");if(c.button!==0||r==="click"||Rt(v,!0)&&i)return;const a=F(E,c.currentTarget,A=>A==="click"||A==="mousedown"),R=qt(U),w=Kt(R);if(w||v==="virtual"){P(a,U,w?R:c.currentTarget,v);return}const I=c.currentTarget;p.request(()=>{P(a,U,I,v)})},onClick(c){if(r==="mousedown-only")return;const v=h.current;if(r==="mousedown"&&v){h.current=void 0;return}if(Rt(v,!0)&&i)return;const U=e.select("open"),E=F(U,c.currentTarget,a=>a==="click"||a==="mousedown"||a==="keydown"||a==="keyup");P(E,c.nativeEvent,c.currentTarget,v)},onKeyDown(){h.current=void 0}}},[C,r,i,u,e,l,s,p,T,d]);return o.useMemo(()=>n?{reference:g}:Ue,[n,g])}function pr(e){const{open:t=!1,onOpenChange:n,elements:r={}}=e,s=Tn(),i=en()!=null,l=_e(()=>new qn({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new Kn,floatingId:s,syncOnly:!1,nested:i})).current;return K(()=>{const d={open:t,floatingId:s};r.reference!==void 0&&(d.referenceElement=r.reference,d.domReferenceElement=En(r.reference)?r.reference:null),r.floating!==void 0&&(d.floatingElement=r.floating),l.update(d)},[t,s,r.reference,r.floating,l]),l.context.onOpenChange=n,l.context.nested=i,l}function Ht(e){return $t&&e.movementX===0&&e.movementY===0}function at(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Ze(e,t){return at(t,e===Xt||e===Et,e===ct||e===ut)}function bt(e,t,n){return at(t,e===Et,n?e===ct:e===ut)||e==="Enter"||e===" "||e===""}function gr(e,t,n){return at(t,n?e===ct:e===ut,e===Et)}function mr(e,t,n,r){const s=n?e===ut:e===ct,i=e===Xt;return t==="both"||t==="horizontal"&&r?e==="Escape":at(t,s,i)}function hr(e,t){const{listRef:n,activeIndex:r,onNavigate:s=()=>{},enabled:i=!0,selectedIndex:l=null,allowEscape:d=!1,loopFocus:u=!1,nested:C=!1,rtl:h=!1,virtual:p=!1,focusItemOnOpen:T="auto",focusItemOnHover:g=!0,openOnArrowKeyDown:P=!0,disabledIndices:F=void 0,orientation:c="vertical",triggerOrientation:v=c,parentOrientation:U,id:E,resetOnPointerLeave:a=!0,externalTree:R,nestedReturnFocusRef:w,grid:I}=t,A=I!=null,O=e.useState("open"),H=e.useState("floatingElement"),z=e.useState("domReferenceElement"),X=e.context.dataRef,y=zt(H),k=wn(z),B=Fe(y),ie=en(),G=zn(R),J=o.useRef(T),x=o.useRef(l??-1),f=o.useRef(null),D=o.useRef(!0),b=$(m=>{s(x.current===-1?null:x.current,m)}),M=o.useRef(!!H),W=o.useRef(O),q=o.useRef(!1),te=o.useRef(!1),ee=o.useRef(null),fe=Fe(F),ue=Fe(O),Z=Fe(l),ae=Fe(a),j=st(),Y=st(),oe=$(()=>{j.cancel();function m(V){p||(ee.current=Yn(V,{sync:q.current,preventScroll:!0}))}const L=n.current[x.current],Q=te.current;L&&m(L),(q.current?V=>V():V=>j.request(V))(()=>{const V=n.current[x.current]||L;if(!V)return;L||m(V),xe&&(Q||!D.current)&&V.scrollIntoView?.({block:"nearest",inline:"nearest"})})});K(()=>{X.current.orientation=c},[X,c]),K(()=>{O||(f.current=null),(!O||T!=="auto")&&(J.current=T)},[O,T]),K(()=>{i&&(O&&H?(x.current=l??-1,J.current&&l!=null&&(te.current=!0,b())):M.current&&(x.current=-1,b()))},[i,O,H,l,b]),K(()=>{if(i){if(!O){q.current=!1;return}if(H)if(r==null){if(q.current=!1,Z.current!=null)return;if(M.current&&(x.current=-1,oe()),(!W.current||!M.current)&&J.current&&(f.current!=null||J.current===!0&&f.current==null)){let m=0;const L=()=>{n.current[0]==null?(m<2&&(m?S=>Y.request(S):queueMicrotask)(L),m+=1):(x.current=f.current==null||bt(f.current,v,h)||C?ht(n):Vt(n),f.current=null,b())};L()}}else Lt(n.current,r)||(x.current=r,oe(),te.current=!1)}},[i,O,H,r,Z,C,n,v,h,b,oe,Y]),K(()=>{if(!i||H||!G||p||!M.current)return;const m=G.nodesRef.current,L=m.find(V=>V.id===ie)?.context?.elements.floating,Q=xt(Be(z??L??null)),S=m.some(V=>V.context&&ye(V.context.elements.floating,Q));L&&!S&&D.current&&L.focus({preventScroll:!0})},[i,H,z,G,ie,p]),K(()=>{W.current=O,M.current=!!H});const ne=r!=null,Se=$(m=>{if(!ue.current)return;const L=n.current.indexOf(m.currentTarget);L!==-1&&(x.current!==L||r!==L)&&(x.current=L,b(m))}),he=$(()=>U??G?.nodesRef.current.find(m=>m.id===ie)?.context?.dataRef?.current.orientation),Re=$(()=>ht(n,fe.current)),se=$(m=>{if(D.current=!1,q.current=!0,m.which===229||!ue.current&&m.currentTarget===B.current)return;if(C&&mr(m.key,c,h,A)){Ze(m.key,he())||Te(m),e.setOpen(!1,me(Dt,m.nativeEvent));const V=w?.current??z;kt(V)&&V.focus();return}r!=null&&r!==x.current&&!Lt(n.current,r)&&(x.current=r);const L=x.current,Q=ht(n,F),S=Vt(n,F);if(k||(m.key==="Home"&&(Te(m),x.current=Q,b(m)),m.key==="End"&&(Te(m),x.current=S,b(m))),I!=null){const V=I(m,x.current,n,c,u,h,F,Q,S);if(V!=null&&V!==x.current&&(x.current=V,b(m)),c==="both")return}if(Ze(m.key,c)){Te(m);const V=xt(m.currentTarget.ownerDocument);if(O&&!p&&ye(m.currentTarget,V)&&!n.current.some(de=>de!=null&&ye(de,V))){x.current=bt(m.key,c,h)?Q:S,b(m),r===x.current&&oe();return}const{index:Ce,wrapped:be}=vn(n.current,L,{decrement:!bt(m.key,c,h),loopFocus:u,allowEscape:d,disabledIndices:F,minIndex:Q,maxIndex:S});be&&(q.current=!1),x.current=Ce,b(m)}}),xe=o.useMemo(()=>({onFocus(L){q.current=!0,Se(L)},onClick({currentTarget:L}){p||L.focus({preventScroll:!0})},onMouseMove(L){Ht(L)||(q.current=!0,te.current=!1,g&&Se(L))},onPointerLeave(L){if(!ue.current||!D.current||L.pointerType==="touch")return;q.current=!0;const Q=L.relatedTarget;if(!(!g||n.current.includes(Q))&&ae.current&&(ee.current?.(),ee.current=null,x.current=-1,b(L),!p)){const S=B.current,V=xt(Be(S));S&&ye(S,V)&&S.focus({preventScroll:!0})}}}),[Se,ue,B,g,n,b,ae,p]),N=o.useMemo(()=>p&&O&&ne&&{"aria-activedescendant":`${E}-${r}`},[p,O,ne,E,r]),ce=o.useMemo(()=>({...k?{}:N,onKeyDown(m){if(m.key==="Tab"&&m.shiftKey&&O&&!p){const L=qt(m.nativeEvent);if(L&&!ye(B.current,L))return;Te(m);const Q=me(Yt,m.nativeEvent);e.setOpen(!1,Q);const S=w?.current??z;!Q.isCanceled&&kt(S)&&S.focus();return}se(m)},onPointerMove(m){Ht(m)||(D.current=!0)}}),[N,se,B,k,e,O,p,z,w]),Ie=o.useMemo(()=>{function m(S){e.setOpen(!0,me(Dt,S.nativeEvent,S.currentTarget))}function L(S){T==="auto"&&tn(S.nativeEvent)&&(J.current=!p)}function Q(S){J.current=T,T==="auto"&&Qt(S.nativeEvent)&&(J.current=!0)}return{onKeyDown(S){const V=e.select("open");D.current=!1;const Ce=S.key.startsWith("Arrow"),be=gr(S.key,he(),h),de=Ze(S.key,V?c:v),De=(C?be:de)||S.key==="Enter"||S.key.trim()==="";if(p&&V&&(!C||Kt(S.currentTarget)))return se(S);if(!(!V&&!P&&Ce)){if(De){const ve=Ze(S.key,he());f.current=C&&ve?null:S.key}if(C){be&&(Te(S),V?(x.current=Re(),b(S),p&&B.current?.focus()):m(S));return}de&&(Z.current!=null&&(x.current=Z.current),Te(S),!V&&P?m(S):se(S),V&&b(S))}},onFocus(S){S.target===S.currentTarget&&e.select("open")&&!p&&(x.current=-1,b(S))},onPointerDown:Q,onPointerEnter:Q,onMouseDown:L,onClick:L}},[se,T,Re,C,b,e,P,c,v,he,h,Z,p,B]),we=o.useMemo(()=>({...N,...Ie}),[N,Ie]);return o.useMemo(()=>i?{reference:we,floating:ce,item:xe,trigger:Ie}:{},[i,we,ce,Ie,xe])}function xr(e,t){const{listRef:n,elementsRef:r,activeIndex:s,onMatch:i,disabledIndices:l,onTyping:d,enabled:u=!0,resetMs:C=750,selectedIndex:h=null}=t,p=$(d),T=e.useState("open"),g=$e(),P=o.useRef(""),F=o.useRef(h??s??-1),c=o.useRef(null),v=$(a=>{function R(k){return r?.current[k]}function w(k){const B=R(k);return B&&!Mn(B)||B?.matches(":disabled")?!1:l==null||!On(yt,k,l)}function I(k,B,ie=0){if(k.length===0)return-1;const G=(ie%k.length+k.length)%k.length,J=B.toLowerCase();for(let x=0;x<k.length;x+=1){const f=(G+x)%k.length;if(!(!k[f]?.toLowerCase().startsWith(J)||!w(f)))return f}return-1}const A=n.current;if(P.current.length>0&&a.key===" "&&(Te(a),p?.(!0)),P.current.length>0&&P.current[0]!==" "&&I(A,P.current)===-1&&a.key!==" "&&p?.(!1),A==null||a.key.length!==1||a.ctrlKey||a.metaKey||a.altKey)return;T&&a.key!==" "&&(Te(a),p?.(!0));const O=P.current==="";O&&(F.current=h??s??-1),A.every((k,B)=>k&&w(B)?k[0]?.toLowerCase()!==k[1]?.toLowerCase():!0)&&P.current===a.key&&(P.current="",F.current=c.current),P.current+=a.key,g.start(C,()=>{P.current="",F.current=c.current,p?.(!1)});const X=((O?h??s??-1:F.current)??0)+1,y=I(A,P.current,X);y!==-1?(i?.(y,a),c.current=y):a.key!==" "&&(P.current="",p?.(!1))}),U=$(a=>{const R=a.relatedTarget,w=e.select("domReferenceElement"),I=e.select("floatingElement");ye(w,R)||ye(I,R)||(g.clear(),P.current="",F.current=c.current,p?.(!1))});K(()=>{!T&&h!==null||(g.clear(),c.current=null,P.current!==""&&(P.current="",p?.(!1)))},[T,h,g,p]);const E=o.useMemo(()=>({onKeyDown:v,onBlur:U}),[v,U]);return o.useMemo(()=>u?{reference:E,floating:E}:{},[u,E])}function Sr(e){const t=o.useRef(""),n=o.useCallback(s=>{s.defaultPrevented||(t.current=s.pointerType,e(s,s.pointerType))},[e]);return{onClick:o.useCallback(s=>{if(s.detail===0){e(s,"keyboard");return}"pointerType"in s?e(s,s.pointerType):e(s,t.current),t.current=""},[e]),onPointerDown:n}}function nn(e,t){const n=o.useRef(e),r=$(t);K(()=>{n.current!==e&&r(n.current),n.current=e},[e,r])}function Rr(e,t){const n=$((i,l)=>{(typeof e=="function"?e():e)||t(l||(Pn?"touch":""))}),{onClick:r,onPointerDown:s}=Sr(n);return o.useMemo(()=>({onClick:r,onPointerDown:s}),[r,s])}function br(e){const[t,n]=o.useState(null),r=Rr(e,n);return nn(e,s=>{s&&!e&&n(null)}),o.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}const yr=20;function Ir(e,t,n,r){const[s,i]=o.useState(!1);K(()=>{if(!e||!t||n==null){i(!1);return}const l=Be(n).documentElement.clientWidth,d=n.offsetWidth;i(l>0&&d>0&&d>=l-yr)},[e,t,n]),$n(e&&(!t||s),r)}const Cr=o.createContext(void 0);function Tr(e){return o.useContext(Cr)}function Er(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 wr(e){const t=o.useRef(!0);t.current&&(t.current=!1,e())}function vr(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}function Nt({controlled:e,default:t,name:n,state:r="value"}){const{current:s}=o.useRef(e!==void 0),[i,l]=o.useState(()=>t),d=s&&e!==void 0?e:i,u=o.useCallback(C=>{s||l(C)},[]);return[d,u]}const rn=o.createContext(void 0),on=o.createContext(void 0);function Ve(){const e=o.useContext(rn);if(e===void 0)throw new Error(Xe(60));return e}function sn(){const e=o.useContext(on);if(e===void 0)throw new Error(Xe(61));return e}const Mr="data-valid",Or="data-invalid",Pr={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Ar={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},Fr={disabled:!1,...Ar},Lr={valid(e){return e===null?null:e?{[Mr]:""}:{[Or]:""}}},Vr={invalid:void 0,name:void 0,validityData:{state:Pr,errors:[],error:"",value:"",initialValue:null},setValidityData:re,disabled:void 0,setTouched:re,setDirty:re,setFilled:re,setFocused:re,focusOwnerRef:{current:void 0},validationMode:"onSubmit",shouldValidateOnChange:()=>!1,state:Fr,registerFieldControl:re,validation:{getValidationProps:(e,t=Ue)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:re,getInputControl:()=>null,commit:async()=>{},change:re}},Dr=o.createContext(Vr);function ft(e=!0){const t=o.useContext(Dr);if(t.setValidityData===re&&!e)throw new Error(Xe(28));return t}function kr(e,t,n,r,s=!0,i){const{registerFieldControl:l}=ft(),d=_e(()=>Symbol());K(()=>{const u=d.current;if(!s){l(u,void 0);return}l(u,{controlRef:e,getValue:r,id:t,name:i,value:n})},[e,s,r,t,i,l,d,n]),K(()=>{const u=d.current;return()=>{l(u,void 0)}},[l,d])}const Hr=o.createContext({controlId:void 0,registerControlId:re,resetControlId:re,labelId:void 0,setLabelId:re,messageIds:[],setMessageIds:re,getDescriptionProps:e=>e});function ln(){return o.useContext(Hr)}function cn(e={}){const{id:t,enabled:n=!0}=e,{controlId:r,registerControlId:s,resetControlId:i}=ln(),l=Xn(),d=_e(()=>Symbol()),u=o.useRef(!1),C=o.useRef(!1),h=$(()=>{!u.current||s===re||(u.current=!1,s(d.current,void 0))});return K(()=>{if(!n||s===re){h();return}let p;if(t!==void 0)C.current=!0,p=t;else if(C.current)p=l;else{i();return}if(p===void 0){h();return}u.current=!0,s(d.current,p)},[t,n,s,i,l,d,h]),K(()=>h,[h]),(n?r:void 0)??t??l}function Nr(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 un=(e,t)=>Object.is(e,t);function Le(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Ur(e,t,n){return Array.isArray(e)&&Array.isArray(t)?!Nr(e,t,(r,s)=>Le(r,s,n)):e!==t}function Ct(e,t,n){return e?e.some(r=>r===void 0?!1:Le(t,r,n)):!1}function ot(e,t,n){return e?e.findIndex(r=>r===void 0?!1:Le(r,t,n)):-1}function _r(e,t){if(t!==un)return r=>Ct(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 an(e,t,n,r){const s=r&&Array.isArray(t)?e.findIndex(_r(t,n)):ot(e,t,n);return s===-1?null:s}function Br(e,t,n,r,s,i){return Ct(r,t,s)?i!=null&&e>i&&Ct(r,n[i],s)?i:e:e===i?an(n,r,s,!0):i}function Wr(e,t,n){return e.filter(r=>!Le(t,r,n))}function Tt(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function jr(e){return typeof e=="object"&&e!=null&&Array.isArray(e.items)}function fn(e){return jr(e?.[0])}function qr(e){return fn(e)?e.flatMap(t=>t.items):e}function Kr(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(fn(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 dn(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 Tt(e)}function Ne(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?Tt(e.value):Tt(e)}function pn(e,t,n){function r(){return dn(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=qr(t);if(e==null||typeof e!="object"){const l=i.find(d=>d.value===e);return l&&l.label!=null?l.label:r()}if("value"in e){const l=i.find(d=>d&&d.value===e.value);if(l&&l.label!=null)return l.label}}return r()}function zr(e,t,n){return e.reduce((r,s,i)=>(i>0&&r.push(", "),r.push(ge.jsx(o.Fragment,{children:pn(s,t,n)},i)),r),[])}const Yr={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,multiple:e=>e.multiple,disabled:e=>e.disabled,readOnly:e=>e.readOnly,required:e=>e.required,highlightItemOnHover:e=>e.highlightItemOnHover,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:Ne(t,r)!==""},hasNullItemLabel:(e,t)=>t?Kr(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=>Le(t,s,n)):Le(t,r,n)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,itemRoot:e=>e.itemRoot,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},$r=o.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:re,validationMode:"onSubmit",submitCountRef:{current:0}});function Xr(){return o.useContext($r)}const Ee=1;function gn(e,t){return Math.max(0,e-t)}function Gr(e,t){if(t<=0)return 0;const n=ze(e,0,t),r=n,s=t-n,i=r<=Ee,l=s<=Ee;return i&&l?r<=s?0:t:i?0:l?t:n}function wo(e){const{id:t,value:n,defaultValue:r=null,onValueChange:s,open:i,defaultOpen:l=!1,onOpenChange:d,name:u,form:C,autoComplete:h,disabled:p=!1,readOnly:T=!1,required:g=!1,modal:P=!0,actionsRef:F,inputRef:c,onOpenChangeComplete:v,items:U,multiple:E=!1,itemToStringLabel:a,itemToStringValue:R,isItemEqualToValue:w=un,highlightItemOnHover:I=!0,children:A}=e,{clearErrors:O}=Xr(),{setDirty:H,setTouched:z,setFocused:X,validityData:y,setFilled:k,name:B,disabled:ie,validation:G,validationMode:J}=ft(),x=cn({id:t}),f=ie||p,D=B??u,[b,M]=Nt({controlled:n,default:E?r??yt:r,name:"Select",state:"value"}),[W,q]=Nt({controlled:i,default:l,name:"Select",state:"open"}),te=o.useRef([]),ee=o.useRef([]),fe=o.useRef(null),ue=o.useRef(null),Z=o.useRef(0),ae=o.useRef(null),j=o.useRef([]),Y=o.useRef(!1),oe=o.useRef(null),ne=o.useRef(null),Se=o.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),he=o.useRef(!1),Re=o.useRef(b),{openMethod:se,triggerProps:xe}=br(W),N=_e(()=>new Vn({id:x,labelId:void 0,modal:P,multiple:E,disabled:f,readOnly:T,required:g,highlightItemOnHover:I,itemToStringLabel:a,itemToStringValue:R,isItemEqualToValue:w,value:b,open:W,mounted:W,transitionStatus:void 0,items:U,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:Ue,triggerProps:Ue,itemRoot:{props:Ue,multiple:E,disabled:f,readOnly:T,isItemEqualToValue:w},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1},{setValue:re,setOpen:re,handleScrollArrowVisibility:re,onOpenChangeComplete:re,listRef:te,popupRef:fe,scrollHandlerRef:ue,scrollArrowsMountedCountRef:Z,valueRef:ae,valuesRef:j,labelsRef:ee,typingRef:Y,selectionRef:Se,firstItemTextRef:oe,selectedItemTextRef:ne,alignItemWithTriggerActiveRef:he,initialValueRef:Re},Yr)).current,[ce,Ie]=o.useState(!1),{mounted:we,transitionStatus:m,forceUnmount:L}=Gn({open:W,ref:fe,preventUnmountOnClose:ce,setPreventUnmountOnClose:Ie,onUnmount(){N.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),v?.(!1)}}),Q=N.useState("activeIndex"),S=N.useState("selectedIndex"),V=N.useState("triggerElement"),Ce=N.useState("positionerElement"),be=Er(se),de=se??be,De=o.useMemo(()=>E?"":Ne(b,R),[E,b,R]),ve=o.useMemo(()=>E&&Array.isArray(b)?b.map(_=>Ne(_,R)):Ne(b,R),[E,b,R]),dt=Fe(V),Ge=$(()=>ve);kr(dt,x,b,Ge,!f,u);const ke=E?Array.isArray(b)&&b.length>0:b!=null&&De!=="";K(()=>{k(ke)},[ke,k]),K(function(){const le=an(j.current,b,w,E);le===null&&(ne.current=null),!W&&N.set("selectedIndex",le)},[E,W,b,w,N]),nn(b,()=>{O(D),H(Ur(b,y.initialValue,w)),G.change(b)});const He=$((_,le)=>{const Ae=le,qe=Qn(Ae);d?.(_,Ae),!le.isCanceled&&(_||Ie(qe()),q(_),!_&&(le.reason===Yt||le.reason===Dn)&&(z(!0),X(!1),J==="onBlur"&&G.commit(b)))});o.useImperativeHandle(F,()=>({unmount:L,close:()=>{N.state.open&&He(!1,me(kn))}}),[L,He,N]);const je=$((_,le)=>{s?.(_,le),!le.isCanceled&&M(_)}),pt=$(_=>{const le=gn(_.scrollHeight,_.clientHeight),Ae=Gr(_.scrollTop,le),qe=Ae>0,Ke=Ae<le;N.set("scrollUpArrowVisible",qe),N.set("scrollDownArrowVisible",Ke)}),pe=pr({open:W,onOpenChange:He,elements:{reference:V,floating:Ce}}),Me=dr(pe,{enabled:!f,event:"mousedown"}),Oe=Jn(pe),Pe=hr(pe,{enabled:!f,listRef:te,activeIndex:Q,selectedIndex:S,disabledIndices:yt,onNavigate(_){_===null&&!W||N.set("activeIndex",_)},focusItemOnHover:I}),Je=xr(pe,{enabled:!f&&(W||!T&&!E),listRef:ee,activeIndex:Q,selectedIndex:S,disabledIndices:_=>vr(te.current[_]),onMatch(_){W?N.set("activeIndex",_):je(j.current[_],me(it))},onTyping(_){Y.current=_}}),wt=o.useMemo(()=>It(Je.reference,Pe.reference,Oe.reference,Me.reference,xe),[Me.reference,Je.reference,Pe.reference,Oe.reference,xe]),vt=o.useMemo(()=>It(Zn,Je.floating,Pe.floating,Oe.floating),[Je.floating,Pe.floating,Oe.floating]),Mt=Pe.item??Ue,Ot=o.useMemo(()=>({props:Mt,multiple:E,disabled:f,readOnly:T,isItemEqualToValue:w}),[Mt,E,f,T,w]);N.useContextCallback("setValue",je),N.useContextCallback("setOpen",He),N.useContextCallback("handleScrollArrowVisibility",pt),N.useContextCallback("onOpenChangeComplete",v),wr(()=>{N.update({popupProps:vt,triggerProps:wt,itemRoot:Ot})}),N.useSyncedValues({id:x,modal:P,multiple:E,disabled:f,readOnly:T,required:g,highlightItemOnHover:I,value:b,open:W,mounted:we,transitionStatus:m,popupProps:vt,triggerProps:wt,itemRoot:Ot,items:U,itemToStringLabel:a,itemToStringValue:R,isItemEqualToValue:w,openMethod:de});const bn=An(c,G.inputRef),Pt=E?void 0:D,yn=o.useMemo(()=>!E||!Array.isArray(b)||!D?null:b.map(_=>{const le=Ne(_,R);return ge.jsx("input",{type:"hidden",form:C,name:D,value:le,disabled:f},le)}),[E,b,C,D,R,f]);return ge.jsxs(rn.Provider,{value:N,children:[ge.jsx(on.Provider,{value:pe,children:A}),ge.jsx("input",{...G.getValidationProps(f,{onFocus(){N.state.triggerElement?.focus({focusVisible:!0})},onChange(_){if(_.nativeEvent.defaultPrevented||f||T)return;const le=_.currentTarget.value,Ae=me(it,_.nativeEvent);function qe(){if(E)return;const Ke=le.toLowerCase();let gt=j.current.findIndex(mt=>Ne(mt,R).toLowerCase()===Ke||dn(mt,a).toLowerCase()===Ke);gt===-1&&(gt=j.current.findIndex((mt,In)=>{const Ft=ee.current[In];return Ft!=null&&Ft.toLowerCase()===Ke}));const At=j.current[gt];At!=null&&je(At,Ae)}N.set("forceMount",!0),queueMicrotask(qe)}}),id:x&&Pt==null?`${x}-hidden-input`:void 0,form:C,name:Pt,autoComplete:h,value:De,disabled:f,required:g&&!(E&&ke),readOnly:T,ref:bn,style:D?Fn:Ln,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),yn]})}function Jr(e,t){return e??t}function Zr(e,t,n){const{setFocused:r,focusOwnerRef:s}=ft(),i=$(l=>{(l?!e:s.current===i)&&(s.current=l&&i,r(l))});return K(()=>{const l=t.current;return l?.getRootNode()?.activeElement===l&&i(!0),()=>i(!1)},[e,t,i]),i}const Qe=5;function Qr(e,t){const n=eo(t);return e.clientX>=n.left-Qe&&e.clientX<=n.right+Qe&&e.clientY>=n.top-Qe&&e.clientY<=n.bottom+Qe}function eo(e){const t=e.getBoundingClientRect(),n=rt(e);if(Hn)return t;const r=n.getComputedStyle(e,"::before"),s=n.getComputedStyle(e,"::after");if(!(r.content!=="none"||s.content!=="none"))return t;const l=parseFloat(r.width)||0,d=parseFloat(r.height)||0,u=parseFloat(s.width)||0,C=parseFloat(s.height)||0,h=Math.max(t.width,l,u),p=Math.max(t.height,d,C),T=h-t.width,g=p-t.height;return{left:t.left-T/2,right:t.right+T/2,top:t.top-g/2,bottom:t.bottom+g/2}}const to="data-popup-side",no=400,ro={...er,...Lr,popupSide:e=>e?{[to]:e}:null,value:()=>null},vo=o.forwardRef(function(t,n){const{render:r,className:s,id:i,disabled:l=!1,nativeButton:d=!0,style:u,...C}=t,{setTouched:h,validationMode:p,validation:T,state:g,disabled:P}=ft(),{labelId:F}=ln(),c=Ve(),v=c.useState("readOnly"),U=c.useState("required"),E=c.useState("disabled"),a=P||E||l,R=c.useState("open"),w=c.useState("mounted"),I=c.useState("value"),A=c.useState("triggerProps"),O=c.useState("positionerElement"),H=c.useState("listElement"),z=c.useState("popupSide"),X=c.useState("id"),y=c.useState("labelId"),k=c.useState("hasSelectedValue"),B=w&&O?z:null,ie=i??X,G=Jr(F,y);cn({id:i});const J=Fe(O),x=o.useRef(null),f=Zr(a,x),{getButtonProps:D,buttonRef:b}=Gt({disabled:a,native:d}),M=c.useStateSetter("triggerElement"),W=$e(),q=$e(),te=$e();o.useEffect(()=>{if(R)return te.start(no,()=>{c.context.selectionRef.current.allowUnselectedMouseUp=!0,c.context.selectionRef.current.allowSelectedMouseUp=!0}),()=>{te.clear()};c.context.selectionRef.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},q.clear()},[R,c,q,te]);const ee=It(A,{id:ie,role:"combobox","aria-expanded":R,"aria-haspopup":"listbox","aria-controls":R?H?.id??zt(O)?.id:void 0,"aria-labelledby":G,"aria-readonly":v||void 0,"aria-required":U||void 0,tabIndex:a?-1:0,onFocus(Z){f(!0),R&&c.context.alignItemWithTriggerActiveRef.current&&c.context.setOpen(!1,me(it,Z.nativeEvent)),W.start(0,()=>{c.set("forceMount",!0)})},onBlur(Z){ye(O,Z.relatedTarget)||(h(!0),f(!1),p==="onBlur"&&T.commit(I))},onMouseDown(Z){if(R)return;const ae=Be(Z.currentTarget);function j(Y){if(!x.current)return;const oe=Y.target;ye(x.current,oe)||ye(J.current,oe)||Qr(Y,x.current)||c.context.setOpen(!1,me(Nn,Y))}q.start(0,()=>{ae.addEventListener("mouseup",j,{once:!0})})}},C,D),fe=T.getValidationProps(a,ee);fe.role="combobox";const ue={...g,open:R,disabled:a,value:I,readOnly:v,popupSide:B,placeholder:!k};return We("button",t,{ref:[n,x,b,M],state:ue,stateAttributesMapping:ro,props:fe})}),oo={value:()=>null},Mo=o.forwardRef(function(t,n){const{className:r,render:s,children:i,placeholder:l,style:d,...u}=t,C=Ve(),h=C.useState("value"),p=C.useState("items"),T=C.useState("itemToStringLabel"),g=C.useState("hasSelectedValue"),P=!g&&l!=null&&i==null,F=C.useState("hasNullItemLabel",P),c={value:h,placeholder:!g};let v=null;return typeof i=="function"?v=i(h):i!=null?v=i:P&&!F?v=l:Array.isArray(h)?v=zr(h,p,T):v=pn(h,p,T),We("span",t,{state:c,ref:[n,C.context.valueRef],props:[{children:v},u],stateAttributesMapping:oo})}),Oo=o.forwardRef(function(t,n){const r=Ve(),s=r.useState("mounted"),i=r.useState("forceMount");return s||i?ge.jsx(Un,{ref:n,...t}):null}),mn=o.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function so(){return o.useContext(mn)}function io(e){const{children:t,elementsRef:n,labelsRef:r,onMapChange:s}=e,i=$(s),[,l]=o.useState(0),d=_e(co).current,u=_e(lo).current,C=o.useRef(0),h=o.useRef(!0),p=o.useRef(null),T=o.useRef(null),g=$(()=>{h.current||(h.current=!0,l(R=>R+1))}),P=$((R,w)=>{u.set(R,w),g()}),F=$(R=>{u.delete(R),g()}),c=$(R=>{const w=new Map;return n.current.length=0,r&&(r.current.length=0),R.forEach(I=>{w.set(I.element,{...I.registration.metadata??{},index:I.index}),n.current[I.index]=I.element,r&&(r.current[I.index]=I.registration.label!==void 0?I.registration.label:I.registration.textRef?.current?.textContent??I.element.textContent)}),C.current=n.current.length,w});function v(R){if(T.current?.disconnect(),T.current=null,typeof MutationObserver!="function"||R.length<2)return;const w=new MutationObserver(A=>{if(!fo(A))return;let O=null;for(const H of R)if(H.isConnected){if(O&&hn(O,H)>0){w.disconnect(),g();return}O=H}});T.current=w;const I=new Set;for(let A=1;A<R.length;A+=1){const O=ao(R[A-1],R[A]);O&&I.add(O)}I.forEach(A=>w.observe(A,{childList:!0}))}const U=$(()=>{const[R,w]=uo(u),I=c(R),A=p.current,O=!A||A.length!==R.length||R.some((H,z)=>{const X=A[z];return H.index!==X.index||H.element!==X.element||H.registration.index!==X.registration.index||H.registration.metadata!==X.registration.metadata});v(w),p.current=R,h.current=!1,O&&(d.forEach(H=>H(I)),i(I))});K(()=>(!h.current&&p.current&&c(p.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,c]),K(()=>{h.current&&U()}),K(()=>()=>{T.current?.disconnect(),h.current=!0},[]);const E=$(R=>(d.add(R),()=>{d.delete(R)})),a=o.useMemo(()=>({register:P,unregister:F,subscribeMapChange:E,nextIndexRef:C}),[P,F,E,C]);return ge.jsx(mn.Provider,{value:a,children:t})}function lo(){return new Map}function co(){return new Set}function uo(e){const t=new Set,n=[],r=[];e.forEach((i,l)=>{if(!l.isConnected)return;const d=i.index,u={index:d??-1,element:l,registration:i};d===null?r.push(u):d>=0&&(t.add(d),n.push(u))});let s=0;return r.sort((i,l)=>hn(i.element,l.element)),r.forEach(i=>{for(;t.has(s);)s+=1;i.index=s,n.push(i),s+=1}),t.size>0&&n.sort((i,l)=>i.index-l.index),[n,r.map(i=>i.element)]}function ao(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function fo(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 hn(e,t){return e.nextElementSibling===t?-1:t.nextElementSibling===e?1:e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}const xn=o.createContext(void 0);function po(){const e=o.useContext(xn);if(!e)throw new Error(Xe(59));return e}function lt(e,t){e&&Object.assign(e.style,t)}const go={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},mo={position:"fixed"},Po=o.forwardRef(function(t,n){const{anchor:r,className:s,render:i,positionMethod:l,side:d,align:u,sideOffset:C,alignOffset:h,collisionBoundary:p="clipping-ancestors",collisionPadding:T,arrowPadding:g,sticky:P,disableAnchorTracking:F,alignItemWithTrigger:c=!0,collisionAvoidance:v=_n,style:U,...E}=t,a=Ve(),R=sn(),w=a.useState("open"),I=a.useState("mounted"),A=a.useState("modal"),O=a.useState("value"),H=a.useState("openMethod"),z=a.useState("positionerElement"),X=a.useState("triggerElement"),y=a.useState("isItemEqualToValue"),k=a.useState("transitionStatus"),B=o.useRef(null),ie=o.useRef(null),[G,J]=o.useState(c),x=I&&G&&H!=="touch";!I&&G!==c&&J(c),o.useImperativeHandle(a.context.alignItemWithTriggerActiveRef,()=>x),Ir((x||A)&&w,H==="touch",z,X);const f=ir({anchor:r,floatingRootContext:R,positionMethod:l,mounted:I,side:d,sideOffset:C,align:u,alignOffset:h,arrowPadding:g,collisionBoundary:p,collisionPadding:T,sticky:P,disableAnchorTracking:F??x,collisionAvoidance:v,keepMounted:!0}),D=x?"none":f.side,b=x?mo:f.positionerStyles,M={open:w,side:D,align:f.align,anchorHidden:f.anchorHidden};K(()=>{a.set("popupSide",f.side)},[a,f.side]);const W=a.useStateSetter("positionerElement"),q=lr(t,M,{styles:b,transitionStatus:k,props:E,refs:[n,W],hidden:!I,inert:!w}),te=o.useRef(0),ee=$(ue=>{if(a.context.valuesRef.current.length===0)return;const Z=te.current;te.current=ue.size;const ae=me(it);if(Z!==0&&!a.state.multiple&&O!==null&&ot(a.context.valuesRef.current,O,y)===-1){const Y=a.context.initialValueRef.current,ne=Y!=null&&ot(a.context.valuesRef.current,Y,y)!==-1?Y:null;a.context.setValue(ne,ae),ne===null&&(a.set("selectedIndex",null),a.context.selectedItemTextRef.current=null)}if(Z!==0&&a.state.multiple&&Array.isArray(O)){const j=O.filter(Y=>ot(a.context.valuesRef.current,Y,y)!==-1);j.length!==O.length&&(a.context.setValue(j,ae),j.length===0&&(a.set("selectedIndex",null),a.context.selectedItemTextRef.current=null))}if(w&&x){a.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const j={height:""};lt(z,j),lt(a.context.popupRef.current,j)}}),fe=o.useMemo(()=>({...f,side:D,alignItemWithTriggerActive:x,setControlledAlignItemWithTrigger:J,scrollUpArrowRef:B,scrollDownArrowRef:ie}),[f,D,x,J]);return ge.jsx(io,{elementsRef:a.context.listRef,labelsRef:a.context.labelsRef,onMapChange:ee,children:ge.jsxs(xn.Provider,{value:fe,children:[I&&A&&ge.jsx(tr,{inert:Bn(!w),cutout:X}),q]})})}),et="base-ui-disable-scrollbar",Ut={className:et,getElement(e){return ge.jsx("style",{nonce:e,href:et,precedence:"base-ui:low",children:`.${et}{scrollbar-width:none}.${et}::-webkit-scrollbar{display:none}`})}},ho=o.createContext(void 0),xo={disableStyleElements:!1};function So(){return o.useContext(ho)??xo}const _t="--transform-origin",Ro={...rr,...Zt},Ao=o.forwardRef(function(t,n){const{render:r,className:s,style:i,finalFocus:l,...d}=t,u=Ve(),C=u.useState("multiple"),h=u.useState("readOnly"),p=u.useState("highlightItemOnHover"),T=sn(),{side:g,align:P,alignItemWithTriggerActive:F,isPositioned:c,setControlledAlignItemWithTrigger:v}=po(),U=Tr()!=null,E=cr(),{nonce:a,disableStyleElements:R}=So(),w=u.useState("id"),I=u.useState("open"),A=u.useState("openMethod"),O=u.useState("mounted"),H=u.useState("popupProps"),z=u.useState("transitionStatus"),X=u.useState("triggerElement"),y=u.useState("positionerElement"),k=u.useState("listElement"),B=o.useRef(!1),ie=o.useRef(!1),G=o.useRef({}),J=st(),x=$(M=>{if(!y||!u.context.popupRef.current||!ie.current)return;const W=y.style.top==="0px",q=y.style.bottom==="0px";if(B.current||!F||!W&&!q){u.context.handleScrollArrowVisibility(M);return}const te=Wt(y),ee=Ye(y.getBoundingClientRect().height,"y",te),fe=Be(y),ue=rt(y),Z=ue.getComputedStyle(y),ae=parseFloat(Z.marginTop),j=parseFloat(Z.marginBottom),Y=Bt(ue.getComputedStyle(u.context.popupRef.current)),oe=Math.min(fe.documentElement.clientHeight-ae-j,Y),ne=M.scrollTop,Se=tt(M);let he=null;const Re=ce=>{y.style.height=`${ce}px`},se=W?Se-ne:ne,xe=Math.min(ee+se,oe);if(se<=Ee){const ce=ze(se,0,oe-ee);ce>0&&Re(ee+ce),M.scrollTop=W?Se:0,oe-(ee+ce)<=Ee&&(B.current=!0),u.context.handleScrollArrowVisibility(M);return}if(oe-xe>Ee)he=W?1/0:0;else if(q&&ne<Se){const ce=ee+se-oe;he=ne-(se-ce)}const N=Math.ceil(xe);if(N!==0&&Re(N),he!=null){const ce=ze(he,0,tt(M));Math.abs(M.scrollTop-ce)>Ee&&(M.scrollTop=ce)}N>=oe-Ee&&(B.current=!0),u.context.handleScrollArrowVisibility(M)});o.useImperativeHandle(u.context.scrollHandlerRef,()=>x,[x]),Jt({open:I,ref:u.context.popupRef,onComplete(){I&&u.context.onOpenChangeComplete(!0)}});const f={open:I,transitionStatus:z,side:g,align:P};K(()=>{!y||!u.context.popupRef.current||Object.keys(G.current).length||(G.current={top:y.style.top||"0",left:y.style.left||"0",right:y.style.right,height:y.style.height,bottom:y.style.bottom,minHeight:y.style.minHeight,maxHeight:y.style.maxHeight,marginTop:y.style.marginTop,marginBottom:y.style.marginBottom})},[u,y]),K(()=>{I||F||(ie.current=!1,B.current=!1,lt(y,G.current))},[I,F,y]),K(()=>{const M=u.context.popupRef.current;if(!I||!X||!y||!M||F&&!c||u.state.transitionStatus==="ending")return;if(ie.current=!0,M.style.removeProperty(_t),!F){J.request(()=>u.context.handleScrollArrowVisibility(k||M));return}const W=bo(M);try{let q=u.context.selectedItemTextRef.current;q?.isConnected||(q=!u.select("hasSelectedValue")&&u.context.firstItemTextRef.current?.isConnected?u.context.firstItemTextRef.current:null);const te=u.context.valueRef.current,ee=rt(y),fe=ee.getComputedStyle(y),ue=ee.getComputedStyle(M),Z=Be(X),ae=Wt(X),j=nt(X.getBoundingClientRect(),ae),Y=nt(y.getBoundingClientRect(),ae),oe=j.height,ne=k||M,Se=ne.scrollHeight,he=parseFloat(ue.borderBottomWidth),Re=parseFloat(fe.marginTop)||10,se=parseFloat(fe.marginBottom)||10,xe=parseFloat(fe.minHeight)||100,N=Bt(ue),ce=5,Ie=5,we=20,m=Z.documentElement.clientHeight-Re-se,L=Z.documentElement.clientWidth,Q=m-j.bottom+oe;let S,V=E==="rtl"?j.right-Y.width:j.left,Ce=0;if(q&&te){const pe=nt(te.getBoundingClientRect(),ae);S=nt(q.getBoundingClientRect(),ae),V=Y.left+(E==="rtl"?pe.right-S.right:pe.left-S.left);const Me=pe.top-j.top+pe.height/2;Ce=S.top-Y.top+S.height/2-Me}const be=Q+Ce+se+he;let de=Math.min(m,be);const De=m-Re-se,ve=be-de,dt=L-Ie;y.style.left=`${ze(V,ce,dt-Y.width)}px`,y.style.height=`${de}px`,y.style.maxHeight="none",y.style.marginTop=`${Re}px`,y.style.marginBottom=`${se}px`,M.style.height="100%";const Ge=tt(ne),ke=ve>=Ge-Ee;ke&&(de=Math.min(m,Y.height)-(ve-Ge));const He=j.top<we||j.bottom>m-we||Math.ceil(de)+Ee<Math.min(Se,xe),je=(ee.visualViewport?.scale??1)!==1&&$t;if(He||je){lt(y,G.current),v(!1);return}const pt=Math.max(xe,de);if(ke){const pe=Math.max(0,m-be);y.style.top=Y.height>=De?"0":`${pe}px`,y.style.height=`${de}px`,ne.scrollTop=tt(ne)}else y.style.bottom="0",ne.scrollTop=ve;if(S){const pe=Y.top,Me=Y.height,Oe=S.top+S.height/2,Pe=ze(Me>0?(Oe-pe)/Me*100:50,0,100);M.style.setProperty(_t,`50% ${Pe}%`)}(pt===m||de>=N)&&(B.current=!0),u.context.handleScrollArrowVisibility(ne),p&&u.state.selectedIndex===null&&u.state.activeIndex===null&&u.context.listRef.current[0]!=null&&u.set("activeIndex",0)}finally{W()}},[u,I,y,X,F,v,J,k,p,E,c]),o.useEffect(()=>{if(!F||!y||!I)return;const M=rt(y);function W(q){u.context.setOpen(!1,me(jn,q))}return Wn(M,"resize",W)},[u,F,y,I]);const D={...k?{role:"presentation"}:{role:"listbox","aria-multiselectable":C||void 0,"aria-readonly":h||void 0,id:`${w}-list`},onKeyDown(M){U&&or.has(M.key)&&M.stopPropagation()},onScroll(M){k||x(M.currentTarget)},...F&&{style:k?{height:"100%"}:go},className:!k&&F?Ut.className:void 0},b=We("div",t,{ref:[n,u.context.popupRef],state:f,stateAttributesMapping:Ro,props:[H,D,fr(z),d]});return ge.jsxs(o.Fragment,{children:[!R&&Ut.getElement(a),ge.jsx(nr,{context:T,modal:!1,disabled:!O,openInteractionType:A,returnFocus:l,restoreFocus:!0,children:b})]})});function Bt(e){const t=e.maxHeight;return t.endsWith("px")&&parseFloat(t)||1/0}function tt(e){return gn(e.scrollHeight,e.clientHeight)}function Wt(e){return ur.getScale(e)}function Ye(e,t,n){return e/n[t]}function nt(e,t){return ar({x:Ye(e.x,"x",t),y:Ye(e.y,"y",t),width:Ye(e.width,"x",t),height:Ye(e.height,"y",t)})}const jt=[["transform","none"],["scale","1"],["translate","0 0"]];function bo(e){const{style:t}=e,n={};for(const[r,s]of jt)n[r]=t.getPropertyValue(r),t.setProperty(r,s,"important");return()=>{for(const[r]of jt){const s=n[r];s?t.setProperty(r,s):t.removeProperty(r)}}}function yo(e={}){const{guess:t,label:n,metadata:r,textRef:s,index:i}=e,{register:l,unregister:d,subscribeMapChange:u,nextIndexRef:C}=so(),h=o.useRef(-1),[p,T]=o.useState(i==null&&t?()=>{if(h.current===-1){const c=C.current;C.current+=1,h.current=c}return h.current}:-1),g=i??p,P=o.useRef(null),F=o.useCallback(c=>{const v=P.current;v&&d(v),P.current=c,c&&l(c,{metadata:r??null,index:i??null,label:n,textRef:s})},[i,l,d,r,n,s]);return K(()=>{if(i==null)return u(c=>{const v=P.current?c.get(P.current)?.index:null;v!=null&&T(v)})},[i,u]),{ref:F,index:g}}const Sn=o.createContext(void 0);function Rn(){const e=o.useContext(Sn);if(!e)throw new Error(Xe(57));return e}const Fo=o.memo(o.forwardRef(function(t,n){const{render:r,className:s,style:i,value:l=null,label:d,disabled:u=!1,nativeButton:C=!1,...h}=t,p=o.useRef(null),T=yo({guess:!0,label:d,textRef:p}),g=Ve(),{props:P,multiple:F,disabled:c,readOnly:v,isItemEqualToValue:U}=g.useState("itemRoot"),E=c||u,a=g.useState("isActive",T.index),R=g.useState("open"),w=g.useState("isSelected",l),I=g.useState("isSelectedByFocus",T.index),A=T.index,O=o.useRef(null);K(()=>{const f=g.context.valuesRef.current;return f[A]=l,()=>{delete f[A]}},[A,l,g]),K(()=>{const f=g.state.value,D=g.state.selectedIndex;let b=D,M;F&&Array.isArray(f)?(b=Br(A,l,g.context.valuesRef.current,f,U,D),M=b===A,A===D&&!M&&(g.context.selectedItemTextRef.current=null)):(M=f!==void 0&&Le(l,f,U),M&&(b=A)),g.set("selectedIndex",b),M&&p.current&&(g.context.selectedItemTextRef.current=p.current)},[A,F,U,g,l]);const H=o.useRef("mouse"),z=o.useRef(!1),{getButtonProps:X,buttonRef:y}=Gt({disabled:E,focusableWhenDisabled:!0,native:C,composite:!0}),k={disabled:E,selected:w,highlighted:a};function B(f){if(c||v)return;const D=g.state.value;if(F){const b=Array.isArray(D)?D:[],M=w?Wr(b,l,U):[...b,l];g.context.setValue(M,me(St,f))}else g.context.setValue(l,me(St,f)),g.context.setOpen(!1,me(St,f))}function ie(){g.context.selectionRef.current.dragY=0}const G={role:"option","aria-selected":w,tabIndex:R&&a?0:-1,onKeyDown(f){g.set("activeIndex",A),f.key===" "&&g.context.typingRef.current&&f.preventDefault()},onClick(f){const D=H.current!=="touch",b=f.nativeEvent.pointerType,M=D&&tn(f.nativeEvent)&&(b!==void 0||a),W=D&&!M&&!z.current;z.current=!1,!(E||W)&&B(f.nativeEvent)},onPointerEnter(f){H.current=f.pointerType},onPointerMove(f){if(f.pointerType==="mouse"&&f.buttons===1){const D=g.context.selectionRef.current;D.dragY+=f.movementY,D.dragY**2>=64&&(D.allowUnselectedMouseUp=!0)}},onPointerDown(f){H.current=f.pointerType,z.current=!0,ie()},onMouseUp(){if(ie(),E||H.current==="touch"||z.current)return;const f=!g.context.selectionRef.current.allowSelectedMouseUp&&w,D=!g.context.selectionRef.current.allowUnselectedMouseUp&&!w;f||D||(z.current=!0,O.current?.click(),z.current=!1)}},J=We("div",t,{ref:[y,n,T.ref,O],state:k,props:[P,G,h,X]}),x=o.useMemo(()=>({selected:w,index:A,textRef:p,selectedByFocus:I}),[w,A,p,I]);return ge.jsx(Sn.Provider,{value:x,children:J})})),Io=o.memo(o.forwardRef(function(t,n){const{render:r,className:s,style:i,keepMounted:l,selected:d,...u}=t,C=o.useRef(null),{transitionStatus:h,setMounted:p}=sr(d),g=We("span",t,{ref:[n,C],state:{selected:d,transitionStatus:h},props:[{"aria-hidden":!0,children:"✔️"},u],stateAttributesMapping:Zt});return Jt({batch:!0,enabled:!d,open:d,ref:C,onComplete(){d||p(!1)}}),g})),Lo=o.forwardRef(function(t,n){const{selected:r}=Rn();return t.keepMounted||r?ge.jsx(Io,{...t,selected:r,ref:n}):null}),Vo=o.memo(o.forwardRef(function(t,n){const{index:r,textRef:s,selectedByFocus:i}=Rn(),l=Ve(),{render:d,className:u,style:C,...h}=t,p=o.useCallback(g=>{g&&(r===0&&(l.context.firstItemTextRef.current=g),i&&(l.context.selectedItemTextRef.current=g))},[l,r,i]);return We("div",t,{ref:[p,n,s],props:h})}));export{go as L,wo as S,po as a,vo as b,Mo as c,Oo as d,Po as e,Ao as f,Fo as g,Lo as h,Vo as i,dr as j,Rr as k,Ir as l,Tr as m,Lr as n,Xr as o,ft as p,ln as q,cn as r,Ut as s,Zr as t,Ve as u,Nt as v,kr as w,nn as x};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as l,c as s,j as e,L as i,B as a}from"./__vite-browser-external-
|
|
1
|
+
import{r as l,c as s,j as e,L as i,B as a}from"./__vite-browser-external-BEEzY7mq.js";import{A as c}from"./arrow-left-D6zkcLVt.js";import{S as m}from"./server-BaG1rnuv.js";import{E as o}from"./external-link-g9cU017t.js";function g(){const r=l.useRef(null);l.useLayoutEffect(()=>{const t=r.current?.parentElement;t&&(t.scrollTop=0)},[]);const n=[[s("self_host.step.backend_title"),s("self_host.step.backend_body")],[s("self_host.step.schema_title"),s("self_host.step.schema_body")],[s("self_host.step.client_title"),s("self_host.step.client_body")]];return e.jsx("div",{ref:r,className:"tt-cloud-theme flex flex-1 flex-col font-oai text-oai-black dark:text-oai-white",children:e.jsxs("main",{className:"mx-auto w-full max-w-3xl px-4 py-8 sm:px-6 sm:py-12",children:[e.jsxs(i,{to:"/cloud",className:"mb-7 inline-flex min-h-10 items-center gap-2 text-sm text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx(c,{size:16,"aria-hidden":!0}),s("self_host.back")]}),e.jsxs("div",{className:"mb-3 flex items-center gap-2 text-sm text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx(m,{size:18,"aria-hidden":!0}),e.jsx("span",{children:s("self_host.status")})]}),e.jsx("h1",{className:"text-balance text-3xl font-semibold tracking-tight sm:text-4xl",children:s("self_host.title")}),e.jsx("p",{className:"mt-4 max-w-2xl text-base leading-7 text-oai-gray-600 dark:text-oai-gray-300",children:s("self_host.subtitle")}),e.jsxs("div",{className:"mt-7 rounded-lg border border-oai-gray-300 p-5 dark:border-oai-gray-700",children:[e.jsx("h2",{className:"text-sm font-semibold",children:s("self_host.preview_title")}),e.jsx("p",{className:"mt-2 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:s("self_host.preview_body")})]}),e.jsxs("section",{className:"mt-10",children:[e.jsx("h2",{className:"text-lg font-semibold",children:s("self_host.steps_title")}),e.jsx("ol",{className:"mt-5 list-decimal space-y-6 pl-5 marker:text-oai-gray-500",children:n.map(([t,d])=>e.jsxs("li",{className:"pl-2",children:[e.jsx("h3",{className:"text-sm font-medium",children:t}),e.jsx("p",{className:"mt-2 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:d})]},t))})]}),e.jsxs("section",{className:"mt-9 border-t border-oai-gray-200 pt-7 dark:border-oai-gray-800",children:[e.jsx("h2",{className:"text-lg font-semibold",children:s("self_host.responsibility_title")}),e.jsx("p",{className:"mt-3 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:s("self_host.responsibility_body")}),e.jsx("p",{className:"mt-3 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:s("self_host.community")}),e.jsxs("div",{className:"mt-5 flex flex-wrap gap-3",children:[e.jsxs(a,{as:"a",href:"https://github.com/InsForge/InsForge#self-hosted-docker-compose",target:"_blank",rel:"noopener noreferrer",variant:"secondary",className:"no-underline",children:[s("self_host.link.insforge"),e.jsx(o,{size:14,className:"ml-2","aria-hidden":!0})]}),e.jsxs(a,{as:"a",href:"https://github.com/xiufengsun/TokenTracker/tree/main/dashboard/edge-patches",target:"_blank",rel:"noopener noreferrer",variant:"secondary",className:"no-underline",children:[s("self_host.link.source"),e.jsx(o,{size:14,className:"ml-2","aria-hidden":!0})]})]})]}),e.jsxs("section",{className:"mt-9 border-t border-oai-gray-200 pt-7 dark:border-oai-gray-800",children:[e.jsx("h2",{className:"text-base font-semibold",children:s("self_host.managed_title")}),e.jsx("p",{className:"mt-2 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:s("self_host.managed_body")}),e.jsx(a,{as:i,to:"/cloud",className:"mt-4 no-underline",children:s("self_host.link.cloud")})]})]})})}export{g as SelfHostPage};
|
package/dashboard/dist/assets/{ServiceStatusPage-DMtw0YDh.js → ServiceStatusPage-5YevsGGD.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as d,c as n,j as t,R as h}from"./__vite-browser-external-
|
|
1
|
+
import{r as d,c as n,j as t,R as h}from"./__vite-browser-external-BEEzY7mq.js";import{P as f}from"./ProviderIcon-vgCEy0dh.js";import{E as b}from"./external-link-g9cU017t.js";const x=[{id:"claude",name:"Claude",icon:"CLAUDE",apiUrl:"https://status.claude.com/api/v2/status.json",pageUrl:"https://status.claude.com"},{id:"openai",name:"OpenAI / Codex",icon:"CODEX",apiUrl:"https://status.openai.com/api/v2/status.json",pageUrl:"https://status.openai.com"},{id:"cursor",name:"Cursor",icon:"CURSOR",apiUrl:"https://status.cursor.com/api/v2/status.json",pageUrl:"https://status.cursor.com"},{id:"github",name:"GitHub / Copilot",icon:"GITHUB",apiUrl:"https://www.githubstatus.com/api/v2/status.json",pageUrl:"https://www.githubstatus.com"},{id:"gemini",name:"Gemini",icon:"GEMINI",kind:"google",serviceName:"Gemini",apiUrl:"https://www.google.com/appsstatus/dashboard/incidents.json",pageUrl:"https://www.google.com/appsstatus/dashboard"},{id:"kimi",name:"Kimi / Moonshot",icon:"KIMI",apiUrl:"https://status.moonshot.cn/api/v2/status.json",pageUrl:"https://status.moonshot.cn"},{id:"minimax",name:"MiniMax",icon:"MINIMAX",apiUrl:"https://status.minimaxi.com/api/v2/status.json",pageUrl:"https://status.minimaxi.com"},{id:"zed",name:"Zed",icon:"ZED",kind:"instatus",apiUrl:"https://status.zed.dev/summary.json",pageUrl:"https://status.zed.dev"}],w=6e4,y=8e3,j=new Set(["none","minor","major","critical"]),g={none:{dot:"bg-emerald-500",text:"text-emerald-600 dark:text-emerald-400"},minor:{dot:"bg-yellow-500",text:"text-yellow-600 dark:text-yellow-400"},major:{dot:"bg-orange-500",text:"text-orange-600 dark:text-orange-400"},critical:{dot:"bg-red-500",text:"text-red-600 dark:text-red-400"},unknown:{dot:"bg-oai-gray-400",text:"text-oai-gray-500 dark:text-oai-gray-400"}};function k(e){switch(e){case"none":return n("status.state.none");case"minor":return n("status.state.minor");case"major":return n("status.state.major");case"critical":return n("status.state.critical");default:return n("status.state.unknown")}}const v={low:"minor",medium:"major",high:"critical"},N={MAJOROUTAGE:"critical",PARTIALOUTAGE:"major",DEGRADEDPERFORMANCE:"minor"};function A(e){const a=e?.page?.status;if(typeof a!="string")throw new Error("Unexpected payload");if(a==="UP")return{indicator:"none",description:"",updatedAt:null};const s=Array.isArray(e?.activeIncidents)?e.activeIncidents:[],r={critical:3,major:2,minor:1};let o=null;for(const i of s){const c=N[i?.impact]||"minor";(!o||r[c]>r[o.indicator])&&(o={indicator:c,description:i?.name||"",updatedAt:i?.updated||null})}return o||{indicator:"minor",description:"",updatedAt:null}}function I(e,a){if(!Array.isArray(e))throw new Error("Unexpected payload");const s=e.filter(i=>i&&!i.end&&(i.service_name===a||Array.isArray(i.affected_products)&&i.affected_products.some(c=>c?.title===a)));if(s.length===0)return{indicator:"none",description:"",updatedAt:null};const r={critical:3,major:2,minor:1};let o=null;for(const i of s){const c=v[i.severity]||"minor";(!o||r[c]>r[o.indicator])&&(o={indicator:c,description:i.external_desc||"",updatedAt:i.modified||null})}return o}async function E(e){try{const a=await fetch(e.apiUrl,{cache:"no-store",signal:AbortSignal.timeout(y)});if(!a.ok)throw new Error(`HTTP ${a.status}`);const s=await a.json();if(e.kind==="google")return I(s,e.serviceName);if(e.kind==="instatus")return A(s);const r=s?.status?.indicator;if(!j.has(r))throw new Error("Unexpected payload");return{indicator:r,description:typeof s?.status?.description=="string"?s.status.description:"",updatedAt:typeof s?.page?.updated_at=="string"?s.page.updated_at:null}}catch{return{indicator:"unknown",description:"",updatedAt:null}}}function U({provider:e,result:a}){const s=g[a?.indicator]||g.unknown,r=a==null;return t.jsxs("a",{href:e.pageUrl,target:"_blank",rel:"noreferrer","aria-label":n("status.open_page",{provider:e.name}),title:n("status.open_page",{provider:e.name}),className:"group block no-underline text-inherit rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-4 sm:p-5 transition-colors hover:border-oai-gray-300 dark:hover:border-oai-gray-700 hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",children:[t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[t.jsx(f,{provider:e.icon,size:20}),t.jsx("span",{className:"font-medium text-sm sm:text-base truncate",children:e.name})]}),t.jsx("span",{"aria-hidden":!0,className:"shrink-0 inline-flex h-8 w-8 items-center justify-center rounded-lg text-oai-gray-400 transition-colors group-hover:text-oai-black dark:group-hover:text-white",children:t.jsx(b,{className:"h-4 w-4"})})]}),t.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[r?t.jsx("span",{className:"h-2 w-2 rounded-full bg-oai-gray-300 dark:bg-oai-gray-700 animate-pulse","aria-hidden":!0}):t.jsxs("span",{className:"relative flex h-2 w-2","aria-hidden":!0,children:[a.indicator!=="none"&&a.indicator!=="unknown"?t.jsx("span",{className:`absolute inline-flex h-full w-full animate-ping rounded-full opacity-75 ${s.dot}`}):null,t.jsx("span",{className:`relative inline-flex h-2 w-2 rounded-full ${s.dot}`})]}),t.jsx("span",{className:`text-sm font-medium ${r?"text-oai-gray-400":s.text}`,children:r?n("status.state.checking"):k(a.indicator)})]}),!r&&a.description&&a.indicator!=="none"?t.jsx("p",{className:"mt-2 text-xs text-oai-gray-500 dark:text-oai-gray-400 break-words",children:a.description}):null]})}function T(){const[e,a]=d.useState({}),[s,r]=d.useState(null),[o,i]=d.useState(!1),c=d.useRef(!0),u=d.useCallback(async()=>{i(!0);const l=await Promise.all(x.map(async p=>[p.id,await E(p)]));c.current&&(a(Object.fromEntries(l)),r(new Date),i(!1))},[]);d.useEffect(()=>{c.current=!0,u();const l=setInterval(()=>{u()},w);return()=>{c.current=!1,clearInterval(l)}},[u]);const m=d.useMemo(()=>s?n("status.last_checked",{time:s.toLocaleTimeString()}):null,[s]);return t.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:t.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:t.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[t.jsxs("div",{className:"flex flex-row items-start justify-between gap-4 mb-8",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white mb-3",children:n("nav.service_status")}),t.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:n("status.page.subtitle")})]}),t.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[m?t.jsx("span",{className:"hidden sm:inline text-xs text-oai-gray-400 dark:text-oai-gray-500",children:m}):null,t.jsx("button",{type:"button",onClick:()=>{u()},disabled:o,"aria-label":n("status.refresh"),title:n("status.refresh"),className:"inline-flex h-9 w-9 items-center justify-center rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 disabled:opacity-50",children:t.jsx(h,{className:`h-4 w-4 ${o?"animate-spin":""}`,"aria-hidden":!0})})]})]}),t.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:x.map(l=>t.jsx(U,{provider:l,result:e[l.id]??null},l.id))}),t.jsx("p",{className:"mt-6 text-xs text-oai-gray-400 dark:text-oai-gray-500",children:n("status.page.source_note")})]})})})}export{x as STATUS_PROVIDERS,T as ServiceStatusPage,T as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{o as Oe,r as i,j as e,y as P,c as t,Z as Ee,X as $e,i as N,aA as je,W as Ne,R as cs,V as _e,aN as ds,bl as J}from"./__vite-browser-external-DZF5L1pt.js";import{L as us,I as ms}from"./LocalOnlyNotice-DStlbPET.js";import{S as le}from"./Select-D0hLQyU8.js";import{C as xs}from"./chevron-down-DHaFKHMK.js";import{S as Pe}from"./search-EZAGpmfJ.js";import{C as hs}from"./check-DrXhhj46.js";import{P as gs,a as ps,b as fs,c as bs,d as ys}from"./PopoverPopup-k2ejLK1I.js";import{P as Ae}from"./ProviderIcon-Bx1XKzin.js";import{H as _s}from"./HoverTooltip-CvkAyCDm.js";import{u as we}from"./useCurrency-bqycM681.js";import{i as ks}from"./host-mode-Bc_iTzHk.js";import{I as js}from"./info-BG1vQZ1r.js";import{C as ws}from"./copy-D5xoS-Q8.js";import{a as vs,b as Ns,c as Ss,d as Cs,e as Ts}from"./TooltipPopup-ZM0Ie2_C.js";import"./arrow-up-right-IgkBHoCl.js";import"./download-CqomMv4-.js";import"./SelectItemText-DJGBJhDK.js";import"./composite-M_CP_KSx.js";import"./usePositioner-DEXS10fY.js";import"./store-BWUCbK6Y.js";import"./safePolygon-CCoDMR4f.js";const qe={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"}]]};qe.node;const Ds=Oe(qe);const ze={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"}]]};ze.node;const Ms=Oe(ze),Ls="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 Se({options:a,value:s,onChange:r,allValue:o="all",allLabel:u,searchPlaceholder:m,emptyLabel:n,ariaLabel:f,disabled:k=!1,className:j=""}){const[w,v]=i.useState(!1),[h,g]=i.useState(""),[b,y]=i.useState(-1),F=i.useRef(null),S=`${i.useId()}-listbox`,q=s===o?u:a.find(p=>p.value===s)?.label??s,T=h.trim().toLowerCase(),M=i.useMemo(()=>T?a.filter(p=>p.label.toLowerCase().includes(T)):a,[a,T]),C=i.useMemo(()=>[{value:o,label:u},...M],[o,u,M]),O=b>=0&&b<C.length?C[b]:null,z=p=>{r(p),v(!1),g(""),y(-1)};i.useEffect(()=>{w&&F.current?.querySelector('[data-active="true"]')?.scrollIntoView?.({block:"nearest"})},[w,b]);const ee=p=>{if(p.key==="ArrowDown"||p.key==="ArrowUp"){p.preventDefault();const D=p.key==="ArrowDown";y(R=>{const c=C.length;return c?D?R>=c-1?0:R+1:R<=0?c-1:R-1:-1});return}if(p.key==="Enter"){const D=O||(T&&M.length?M[0]:null);if(!D)return;p.preventDefault(),z(D.value)}};return e.jsxs(gs,{open:w,onOpenChange:p=>{v(p),y(-1),p||g("")},children:[e.jsxs(ps,{disabled:k,"aria-label":f,className:P("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",s!==o?"text-oai-black dark:text-white":"text-oai-gray-700 dark:text-oai-gray-200",j),children:[e.jsx(Ms,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-400","aria-hidden":!0}),e.jsx("span",{className:"truncate",children:q}),e.jsx(xs,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-400","aria-hidden":!0})]}),e.jsx(fs,{children:e.jsx(bs,{sideOffset:4,side:"bottom",align:"start",className:"z-[60]",children:e.jsxs(ys,{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(Pe,{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":S,"aria-activedescendant":O?`${S}-${b}`:void 0,value:h,onChange:p=>{g(p.target.value),y(-1)},onKeyDown:ee,placeholder:m,className:"h-8 w-full rounded border border-oai-gray-200 bg-transparent pl-8 pr-2 text-xs text-oai-black outline-none placeholder:text-oai-gray-400 focus:border-oai-gray-400 dark:border-oai-gray-800 dark:text-white dark:focus:border-oai-gray-500"})]}),e.jsxs("div",{ref:F,id:S,role:"listbox","aria-label":f,className:"max-h-64 overflow-y-auto",children:[C.map((p,D)=>e.jsxs("button",{id:`${S}-${D}`,type:"button",role:"option","aria-selected":s===p.value,"data-active":D===b?"true":void 0,onMouseEnter:()=>y(D),onClick:()=>z(p.value),className:P(Ls,s===p.value&&"bg-oai-gray-100 dark:bg-oai-gray-800",D===b&&"ring-1 ring-inset ring-oai-gray-300 dark:ring-oai-gray-600"),children:[e.jsx("span",{className:"flex-1 truncate",children:p.label}),s===p.value?e.jsx(hs,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}):null]},p.value)),M.length===0?e.jsx("div",{className:"px-2 py-3 text-center text-xs text-oai-gray-400 dark:text-oai-gray-500",children:n}):null]})]})})})]})}const Fs="tokentracker-sessions";async function Is(a={}){const s=new URL(`/functions/${Fs}`,window.location.origin);a.from&&s.searchParams.set("from",a.from),a.to&&s.searchParams.set("to",a.to),a.limit&&s.searchParams.set("limit",String(a.limit)),a.refresh&&s.searchParams.set("refresh","1");const r=await fetch(s.toString(),{headers:{Accept:"application/json"},cache:"no-store"}),o=await r.json().catch(()=>null);if(!r.ok){const u=r.status===404?t("sessions.error.outdated_app"):`Request failed with HTTP ${r.status}`,m=new Error(o?.error||u);throw m.status=r.status,m}return o}function Ge(a,s,{timeOnly:r=!1}={}){if(!a)return"—";const o=Date.parse(a);if(!Number.isFinite(o))return"—";const u=r?{hour:"2-digit",minute:"2-digit"}:{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"};try{return new Date(o).toLocaleString(s||void 0,u)}catch{const m=new Date(o).toISOString();return r?m.slice(11,16):m.slice(0,16).replace("T"," ")}}function Ke(a){const s=Number(a);if(!Number.isFinite(s)||s<=0)return null;const r=Math.round(s/6e4);if(r<60)return t("sessions.duration.minutes",{minutes:r});const o=Math.floor(r/60),u=r%60;return t("sessions.duration.hours",{hours:o,minutes:u})}function V(a){return $(a?.own_total_tokens??a?.total_tokens)}function Rs(a,s=0,r=1/0){if(!s&&r===1/0)return a;const o=a.map(n=>{if(!Array.isArray(n.usage_buckets))return{...n};const f=n.usage_buckets.filter(h=>{const g=Date.parse(h.timestamp);return g>=s&&g<=r}),k=new Map,j=Object.fromEntries([...de,...be].map(h=>[h,0]));let w=0,v=0;for(const h of f){w+=$(h.total_tokens),v+=$(h.cost_usd);const g=k.get(h.model)||{...(n.model_usage||[]).find(b=>b.model===h.model),model:h.model,...Object.fromEntries([...de,...be].map(b=>[b,0])),cost_usd:0,selected_models:[],reroute_reasons:[],model_attribution:"selected"};for(const b of[...de,...be]){const y=$(h[b]);j[b]+=y,g[b]+=y}g.cost_usd+=$(h.cost_usd);for(const b of["selected_models","reroute_reasons"])Array.isArray(h[b])&&(g[b]=[...new Set([...g[b],...h[b]])]);h.model_attribution==="effective"&&(g.model_attribution="effective"),k.set(h.model,g)}return{...n,...j,total_tokens:w,own_total_tokens:w,cost_usd:v,own_cost_usd:v,model_usage:[...k.values()]}}).filter(n=>!Array.isArray(n.usage_buckets)||V(n)>0),u=new Map;for(const n of o){if(!n.parent_session_hash)continue;const f=u.get(n.parent_session_hash)||[];f.push(n),u.set(n.parent_session_hash,f)}const m=(n,f=new Set)=>{if(f.has(n.session_hash))return{tokens:0,cost:0};const k=new Set(f).add(n.session_hash);let j=V(n),w=X(n);for(const v of u.get(n.session_hash)||[]){const h=m(v,k);j+=h.tokens,w+=h.cost}return{tokens:j,cost:w}};for(const n of o){const f=m(n);n.combined_total_tokens=f.tokens,n.combined_cost_usd=f.cost,n.subagent_total_tokens=f.tokens-V(n),n.subagent_cost_usd=f.cost-X(n)}return o}function X(a){return $(a?.own_cost_usd??a?.cost_usd)}function $(a){const s=Number(a);return Number.isFinite(s)&&s>=0?s:0}const de=["input_tokens","output_tokens","cached_input_tokens","cache_creation_input_tokens","reasoning_output_tokens","total_tokens"],be=["long_context_","priority_","priority_long_context_","ultrafast_","ultrafast_long_context_"].flatMap(a=>de.filter(s=>s!=="total_tokens").map(s=>a+s));function Z(a){const s=Array.isArray(a?.model_usage)?a.model_usage.filter(r=>r&&typeof r.model=="string"&&r.model):[];return s.length?s:[{model:a?.model||"",total_tokens:V(a),cost_usd:X(a),performance:a?.performance}]}function Os(a){const s={estimated_output_tokens:0,estimated_duration_ms:0,estimated_request_count:0,estimated_tokens_per_second:null,first_response_total_ms:0,first_response_sample_count:0,first_response_ms:null};for(const r of a){const o=r?.performance;if(!o)continue;const u=$(o.estimated_duration_ms),m=$(o.estimated_output_tokens),n=$(o.estimated_request_count);u>0&&m>0&&n>0&&(s.estimated_output_tokens+=m,s.estimated_duration_ms+=u,s.estimated_request_count+=n);const f=$(o.first_response_sample_count),k=$(o.first_response_total_ms);f>0&&k>0&&(s.first_response_total_ms+=k,s.first_response_sample_count+=f)}return s.estimated_duration_ms>0&&(s.estimated_tokens_per_second=s.estimated_output_tokens*1e3/s.estimated_duration_ms),s.first_response_sample_count>0&&(s.first_response_ms=s.first_response_total_ms/s.first_response_sample_count),s}function Ue(a){const s=new Set,r=a.filter(o=>s.has(o.session_hash)?!1:(s.add(o.session_hash),!0));return{count:r.length,tokens:r.reduce((o,u)=>o+V(u),0),cost:r.reduce((o,u)=>o+X(u),0),costIsPartial:r.some(o=>o.cost_is_partial),performance:Os(r)}}function ke(a){const s=Date.parse(a?.ended_at||a?.started_at||"");return Number.isFinite(s)?s:0}function Es(a,s){return[...a].sort((r,o)=>(s==="cost"?X(o)-X(r):s==="tokens"?V(o)-V(r):0)||ke(o)-ke(r))}function ue(a){const s=ke(a);if(!s)return"";const r=new Date(s);return`${r.getFullYear()}-${String(r.getMonth()+1).padStart(2,"0")}-${String(r.getDate()).padStart(2,"0")}`}function $s(a,s){const r=new Map;for(const o of a){const u=s==="project"?o.project_key||"":ue(o),m=r.get(u)||{key:u,sessions:[]};m.sessions.push(o),r.set(u,m)}return[...r.values()]}function Ps(a){const s=new URLSearchParams(a),r=s.get("source"),o=n=>{const f=s.get(n)||"";if(!/^\d{4}-\d{2}-\d{2}$/.test(f))return"";const k=new Date(`${f}T00:00:00`);return Number.isFinite(k.getTime())&&ue({ended_at:k.toISOString()})===f?f:""},u=o("from"),m=o("to");return{source:["claude","codex","grok","zcode","opencode","kimi","omp","dsh"].includes(r)?r:"all",model:s.get("model")||"all",from:u,to:m}}function As(a,s,r){let o=s?new Date(`${s}T00:00:00`).getTime():0,u=r?new Date(`${r}T23:59:59.999`).getTime():1/0;o>u&&(o=new Date(`${r}T00:00:00`).getTime(),u=new Date(`${s}T23:59:59.999`).getTime());const m=Date.parse(a.ended_at||a.started_at||""),n=Date.parse(a.started_at||a.ended_at||"");return(!Number.isFinite(m)||m>=o)&&(!Number.isFinite(n)||n<=u)}function re({performance:a,className:s=""}){const r=Number(a?.estimated_tokens_per_second),o=Number(a?.estimated_request_count||0);return!Number.isFinite(r)||r<=0||o<=0?null:e.jsx("span",{className:s,title:`${t("sessions.performance.samples",{count:o})}
|
|
1
|
+
import{o as Oe,r as i,j as e,y as P,c as t,Z as Ee,X as $e,i as N,aA as je,W as Ne,R as cs,V as _e,aN as ds,bl as J}from"./__vite-browser-external-BEEzY7mq.js";import{L as us,I as ms}from"./LocalOnlyNotice-B2_HoCVD.js";import{S as le}from"./Select-BkAy6P2r.js";import{C as xs}from"./chevron-down-CkSBY3bE.js";import{S as Pe}from"./search-C63nCrjo.js";import{C as hs}from"./check-1z_vmHPD.js";import{P as gs,a as ps,b as fs,c as bs,d as ys}from"./PopoverPopup-BsXchEVa.js";import{P as Ae}from"./ProviderIcon-vgCEy0dh.js";import{H as _s}from"./HoverTooltip-Dc-TAH6l.js";import{u as we}from"./useCurrency-B_AuLCsL.js";import{i as ks}from"./host-mode-Bc_iTzHk.js";import{I as js}from"./info-D9xNIuGh.js";import{C as ws}from"./copy-Ctv_wxuD.js";import{a as vs,b as Ns,c as Ss,d as Cs,e as Ts}from"./TooltipPopup-CR4MqElX.js";import"./arrow-up-right-XTStagDJ.js";import"./download-DKbKMGSR.js";import"./SelectItemText-C0RNqDrD.js";import"./composite-BtDzx3a2.js";import"./usePositioner-DfxvIif8.js";import"./store-Dv_FYrXK.js";import"./safePolygon-C7FJLAlh.js";const qe={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"}]]};qe.node;const Ds=Oe(qe);const ze={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"}]]};ze.node;const Ms=Oe(ze),Ls="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 Se({options:a,value:s,onChange:r,allValue:o="all",allLabel:u,searchPlaceholder:m,emptyLabel:n,ariaLabel:f,disabled:k=!1,className:j=""}){const[w,v]=i.useState(!1),[h,g]=i.useState(""),[b,y]=i.useState(-1),F=i.useRef(null),S=`${i.useId()}-listbox`,q=s===o?u:a.find(p=>p.value===s)?.label??s,T=h.trim().toLowerCase(),M=i.useMemo(()=>T?a.filter(p=>p.label.toLowerCase().includes(T)):a,[a,T]),C=i.useMemo(()=>[{value:o,label:u},...M],[o,u,M]),O=b>=0&&b<C.length?C[b]:null,z=p=>{r(p),v(!1),g(""),y(-1)};i.useEffect(()=>{w&&F.current?.querySelector('[data-active="true"]')?.scrollIntoView?.({block:"nearest"})},[w,b]);const ee=p=>{if(p.key==="ArrowDown"||p.key==="ArrowUp"){p.preventDefault();const D=p.key==="ArrowDown";y(R=>{const c=C.length;return c?D?R>=c-1?0:R+1:R<=0?c-1:R-1:-1});return}if(p.key==="Enter"){const D=O||(T&&M.length?M[0]:null);if(!D)return;p.preventDefault(),z(D.value)}};return e.jsxs(gs,{open:w,onOpenChange:p=>{v(p),y(-1),p||g("")},children:[e.jsxs(ps,{disabled:k,"aria-label":f,className:P("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",s!==o?"text-oai-black dark:text-white":"text-oai-gray-700 dark:text-oai-gray-200",j),children:[e.jsx(Ms,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-400","aria-hidden":!0}),e.jsx("span",{className:"truncate",children:q}),e.jsx(xs,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-400","aria-hidden":!0})]}),e.jsx(fs,{children:e.jsx(bs,{sideOffset:4,side:"bottom",align:"start",className:"z-[60]",children:e.jsxs(ys,{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(Pe,{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":S,"aria-activedescendant":O?`${S}-${b}`:void 0,value:h,onChange:p=>{g(p.target.value),y(-1)},onKeyDown:ee,placeholder:m,className:"h-8 w-full rounded border border-oai-gray-200 bg-transparent pl-8 pr-2 text-xs text-oai-black outline-none placeholder:text-oai-gray-400 focus:border-oai-gray-400 dark:border-oai-gray-800 dark:text-white dark:focus:border-oai-gray-500"})]}),e.jsxs("div",{ref:F,id:S,role:"listbox","aria-label":f,className:"max-h-64 overflow-y-auto",children:[C.map((p,D)=>e.jsxs("button",{id:`${S}-${D}`,type:"button",role:"option","aria-selected":s===p.value,"data-active":D===b?"true":void 0,onMouseEnter:()=>y(D),onClick:()=>z(p.value),className:P(Ls,s===p.value&&"bg-oai-gray-100 dark:bg-oai-gray-800",D===b&&"ring-1 ring-inset ring-oai-gray-300 dark:ring-oai-gray-600"),children:[e.jsx("span",{className:"flex-1 truncate",children:p.label}),s===p.value?e.jsx(hs,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}):null]},p.value)),M.length===0?e.jsx("div",{className:"px-2 py-3 text-center text-xs text-oai-gray-400 dark:text-oai-gray-500",children:n}):null]})]})})})]})}const Fs="tokentracker-sessions";async function Is(a={}){const s=new URL(`/functions/${Fs}`,window.location.origin);a.from&&s.searchParams.set("from",a.from),a.to&&s.searchParams.set("to",a.to),a.limit&&s.searchParams.set("limit",String(a.limit)),a.refresh&&s.searchParams.set("refresh","1");const r=await fetch(s.toString(),{headers:{Accept:"application/json"},cache:"no-store"}),o=await r.json().catch(()=>null);if(!r.ok){const u=r.status===404?t("sessions.error.outdated_app"):`Request failed with HTTP ${r.status}`,m=new Error(o?.error||u);throw m.status=r.status,m}return o}function Ge(a,s,{timeOnly:r=!1}={}){if(!a)return"—";const o=Date.parse(a);if(!Number.isFinite(o))return"—";const u=r?{hour:"2-digit",minute:"2-digit"}:{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"};try{return new Date(o).toLocaleString(s||void 0,u)}catch{const m=new Date(o).toISOString();return r?m.slice(11,16):m.slice(0,16).replace("T"," ")}}function Ke(a){const s=Number(a);if(!Number.isFinite(s)||s<=0)return null;const r=Math.round(s/6e4);if(r<60)return t("sessions.duration.minutes",{minutes:r});const o=Math.floor(r/60),u=r%60;return t("sessions.duration.hours",{hours:o,minutes:u})}function V(a){return $(a?.own_total_tokens??a?.total_tokens)}function Rs(a,s=0,r=1/0){if(!s&&r===1/0)return a;const o=a.map(n=>{if(!Array.isArray(n.usage_buckets))return{...n};const f=n.usage_buckets.filter(h=>{const g=Date.parse(h.timestamp);return g>=s&&g<=r}),k=new Map,j=Object.fromEntries([...de,...be].map(h=>[h,0]));let w=0,v=0;for(const h of f){w+=$(h.total_tokens),v+=$(h.cost_usd);const g=k.get(h.model)||{...(n.model_usage||[]).find(b=>b.model===h.model),model:h.model,...Object.fromEntries([...de,...be].map(b=>[b,0])),cost_usd:0,selected_models:[],reroute_reasons:[],model_attribution:"selected"};for(const b of[...de,...be]){const y=$(h[b]);j[b]+=y,g[b]+=y}g.cost_usd+=$(h.cost_usd);for(const b of["selected_models","reroute_reasons"])Array.isArray(h[b])&&(g[b]=[...new Set([...g[b],...h[b]])]);h.model_attribution==="effective"&&(g.model_attribution="effective"),k.set(h.model,g)}return{...n,...j,total_tokens:w,own_total_tokens:w,cost_usd:v,own_cost_usd:v,model_usage:[...k.values()]}}).filter(n=>!Array.isArray(n.usage_buckets)||V(n)>0),u=new Map;for(const n of o){if(!n.parent_session_hash)continue;const f=u.get(n.parent_session_hash)||[];f.push(n),u.set(n.parent_session_hash,f)}const m=(n,f=new Set)=>{if(f.has(n.session_hash))return{tokens:0,cost:0};const k=new Set(f).add(n.session_hash);let j=V(n),w=X(n);for(const v of u.get(n.session_hash)||[]){const h=m(v,k);j+=h.tokens,w+=h.cost}return{tokens:j,cost:w}};for(const n of o){const f=m(n);n.combined_total_tokens=f.tokens,n.combined_cost_usd=f.cost,n.subagent_total_tokens=f.tokens-V(n),n.subagent_cost_usd=f.cost-X(n)}return o}function X(a){return $(a?.own_cost_usd??a?.cost_usd)}function $(a){const s=Number(a);return Number.isFinite(s)&&s>=0?s:0}const de=["input_tokens","output_tokens","cached_input_tokens","cache_creation_input_tokens","reasoning_output_tokens","total_tokens"],be=["long_context_","priority_","priority_long_context_","ultrafast_","ultrafast_long_context_"].flatMap(a=>de.filter(s=>s!=="total_tokens").map(s=>a+s));function Z(a){const s=Array.isArray(a?.model_usage)?a.model_usage.filter(r=>r&&typeof r.model=="string"&&r.model):[];return s.length?s:[{model:a?.model||"",total_tokens:V(a),cost_usd:X(a),performance:a?.performance}]}function Os(a){const s={estimated_output_tokens:0,estimated_duration_ms:0,estimated_request_count:0,estimated_tokens_per_second:null,first_response_total_ms:0,first_response_sample_count:0,first_response_ms:null};for(const r of a){const o=r?.performance;if(!o)continue;const u=$(o.estimated_duration_ms),m=$(o.estimated_output_tokens),n=$(o.estimated_request_count);u>0&&m>0&&n>0&&(s.estimated_output_tokens+=m,s.estimated_duration_ms+=u,s.estimated_request_count+=n);const f=$(o.first_response_sample_count),k=$(o.first_response_total_ms);f>0&&k>0&&(s.first_response_total_ms+=k,s.first_response_sample_count+=f)}return s.estimated_duration_ms>0&&(s.estimated_tokens_per_second=s.estimated_output_tokens*1e3/s.estimated_duration_ms),s.first_response_sample_count>0&&(s.first_response_ms=s.first_response_total_ms/s.first_response_sample_count),s}function Ue(a){const s=new Set,r=a.filter(o=>s.has(o.session_hash)?!1:(s.add(o.session_hash),!0));return{count:r.length,tokens:r.reduce((o,u)=>o+V(u),0),cost:r.reduce((o,u)=>o+X(u),0),costIsPartial:r.some(o=>o.cost_is_partial),performance:Os(r)}}function ke(a){const s=Date.parse(a?.ended_at||a?.started_at||"");return Number.isFinite(s)?s:0}function Es(a,s){return[...a].sort((r,o)=>(s==="cost"?X(o)-X(r):s==="tokens"?V(o)-V(r):0)||ke(o)-ke(r))}function ue(a){const s=ke(a);if(!s)return"";const r=new Date(s);return`${r.getFullYear()}-${String(r.getMonth()+1).padStart(2,"0")}-${String(r.getDate()).padStart(2,"0")}`}function $s(a,s){const r=new Map;for(const o of a){const u=s==="project"?o.project_key||"":ue(o),m=r.get(u)||{key:u,sessions:[]};m.sessions.push(o),r.set(u,m)}return[...r.values()]}function Ps(a){const s=new URLSearchParams(a),r=s.get("source"),o=n=>{const f=s.get(n)||"";if(!/^\d{4}-\d{2}-\d{2}$/.test(f))return"";const k=new Date(`${f}T00:00:00`);return Number.isFinite(k.getTime())&&ue({ended_at:k.toISOString()})===f?f:""},u=o("from"),m=o("to");return{source:["claude","codex","grok","zcode","opencode","kimi","omp","dsh"].includes(r)?r:"all",model:s.get("model")||"all",from:u,to:m}}function As(a,s,r){let o=s?new Date(`${s}T00:00:00`).getTime():0,u=r?new Date(`${r}T23:59:59.999`).getTime():1/0;o>u&&(o=new Date(`${r}T00:00:00`).getTime(),u=new Date(`${s}T23:59:59.999`).getTime());const m=Date.parse(a.ended_at||a.started_at||""),n=Date.parse(a.started_at||a.ended_at||"");return(!Number.isFinite(m)||m>=o)&&(!Number.isFinite(n)||n<=u)}function re({performance:a,className:s=""}){const r=Number(a?.estimated_tokens_per_second),o=Number(a?.estimated_request_count||0);return!Number.isFinite(r)||r<=0||o<=0?null:e.jsx("span",{className:s,title:`${t("sessions.performance.samples",{count:o})}
|
|
2
2
|
${t("sessions.performance.method")}`,children:t("sessions.performance.speed",{speed:Number(r.toFixed(1))})})}const qs=[{key:"input_tokens",label:()=>t("dashboard.projects.detail.comp_input")},{key:"cached_input_tokens",label:()=>t("dashboard.projects.detail.comp_cached")},{key:"cache_creation_input_tokens",label:()=>t("dashboard.projects.detail.comp_cache_write")},{key:"output_tokens",label:()=>t("dashboard.projects.detail.comp_output")},{key:"reasoning_output_tokens",label:()=>t("dashboard.projects.detail.comp_reasoning")}],zs=[{key:"turns",label:()=>t("sessions.col.turns")},{key:"edit_turns",label:()=>t("sessions.col.edits")},{key:"retry_turns",label:()=>t("sessions.detail.retries")},{key:"subagent_calls",label:()=>t("sessions.card.subagents")},{key:"tool_calls",grokOnly:!0,label:()=>t("sessions.detail.tools")},{key:"tool_failures",grokOnly:!0,label:()=>t("sessions.detail.tool_failures")},{key:"error_count",grokOnly:!0,label:()=>t("sessions.detail.errors")},{key:"model_calls",grokOnly:!0,label:()=>t("sessions.detail.model_calls")},{key:"compaction_count",grokOnly:!0,label:()=>t("sessions.detail.compactions")}];function Gs(a){return a==="provider_reported"?t("sessions.detail.cost_reported"):a==="model_pricing"?t("sessions.detail.cost_estimated"):a==="mixed"?t("sessions.detail.cost_mixed"):t("sessions.detail.cost_unknown")}function Ce(a){return String(a||"").startsWith("litellm")?t("sessions.detail.pricing_litellm"):String(a||"").startsWith("curated")?t("sessions.detail.pricing_curated"):null}function Ks(a,s){return s||Number(a)>0}function Te({label:a,children:s}){return e.jsxs("div",{className:"flex min-w-0 items-baseline justify-between gap-4",children:[e.jsx("dt",{className:"text-sm text-oai-gray-600 dark:text-oai-gray-300",children:a}),e.jsx("dd",{className:"min-w-0 break-words text-right text-sm tabular-nums text-oai-black dark:text-white",children:s})]})}function ce({label:a,title:s,className:r="",children:o}){return e.jsxs("div",{className:`min-w-0 border-oai-gray-200 px-3 py-2.5 dark:border-oai-gray-800 ${r}`,title:s,children:[e.jsx("dt",{className:"truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:a}),e.jsx("dd",{className:"mt-0.5 truncate text-base font-medium tabular-nums text-oai-black dark:text-white",children:o})]})}function Us({session:a,subagents:s=[],onClose:r}){const o=i.useRef(null),u=i.useRef(null),{currency:m,rate:n}=we(),{resolvedLocale:f}=Ee(),k=c=>je(c,{currency:m,rate:n}),j=Z(a),w=i.useMemo(()=>Ue(s),[s]),v=V(a),h=X(a),g=Number(a.subagent_total_tokens??w.tokens),b=Number(a.subagent_cost_usd??w.cost),y=a.performance,F=Number(y?.estimated_tokens_per_second)>0&&Number(y?.estimated_request_count)>0,S=Number(y?.first_response_sample_count)>0&&y?.first_response_ms!=null&&Number.isFinite(Number(y.first_response_ms)),q=S?{seconds:(Number(y.first_response_ms)/1e3).toFixed(2),count:y.first_response_sample_count}:null,T=Number(a.reasoning_output_tokens)>0,M=a.source==="grok",C=M&&Number(a.context_window_tokens)>0;i.useEffect(()=>{const c=document.activeElement,E=document.body.style.overflow;document.body.style.overflow="hidden",o.current?.focus();const A=I=>{if(I.key==="Escape"&&(I.preventDefault(),r()),I.key!=="Tab")return;const K=Array.from(u.current?.querySelectorAll('button:not([disabled]), a[href], input:not([disabled]), summary, [tabindex="0"]')||[]),se=K[0],te=K[K.length-1];se?I.shiftKey&&(document.activeElement===se||!u.current?.contains(document.activeElement))?(I.preventDefault(),te.focus()):!I.shiftKey&&(document.activeElement===te||!u.current?.contains(document.activeElement))&&(I.preventDefault(),se.focus()):(I.preventDefault(),u.current?.focus())};return window.addEventListener("keydown",A),()=>{window.removeEventListener("keydown",A),document.body.style.overflow=E,c instanceof HTMLElement&&c.isConnected&&c.focus()}},[r]);const O=g>0||b>0,z=a.cost_is_partial||O&&w.costIsPartial,ee=[{label:t("sessions.detail.own"),tokens:v,cost:h,partial:a.cost_is_partial},{label:t("sessions.detail.subagents"),tokens:g,cost:b,partial:w.costIsPartial}],p=a.agent_nickname||a.title||a.project_key||t("sessions.project.unknown"),D=Ke(a.duration_ms),R=[a.project_key&&a.project_key!==p?a.project_key:null,Ge(a.started_at,f),D].filter(Boolean);return e.jsx("div",{className:"fixed inset-0 z-50 flex justify-end bg-black/20 dark:bg-black/40",onClick:c=>{c.target===c.currentTarget&&r()},children:e.jsxs("div",{ref:u,role:"dialog","aria-modal":"true","aria-label":t("sessions.detail.title"),tabIndex:-1,className:"flex h-full w-full max-w-[36rem] flex-col border-l border-oai-gray-200 bg-white dark:border-oai-gray-800 dark:bg-oai-gray-950",children:[e.jsxs("div",{className:"flex shrink-0 items-start gap-3 border-b border-oai-gray-200 px-5 py-4 dark:border-oai-gray-800",children:[e.jsx("span",{className:"shrink-0 pt-0.5 text-oai-gray-600 dark:text-oai-gray-300",children:e.jsx(Ae,{provider:String(a.source||"").toUpperCase(),size:20})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h2",{className:"break-words text-base font-semibold leading-6 text-oai-black dark:text-white",children:p}),e.jsx("p",{className:"mt-0.5 break-words text-xs tabular-nums text-oai-gray-500 dark:text-oai-gray-400",children:R.join(" · ")})]}),e.jsx("button",{ref:o,type:"button",onClick:r,"aria-label":t("sessions.detail.close"),className:"-mr-2 -mt-1 flex h-11 w-11 shrink-0 items-center justify-center rounded-md text-oai-gray-500 hover:bg-oai-gray-100 hover:text-oai-black focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:text-oai-gray-400 dark:hover:bg-oai-gray-800 dark:hover:text-white sm:h-9 sm:w-9",children:e.jsx($e,{size:18,"aria-hidden":!0})})]}),e.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain px-5 py-5",children:[e.jsxs("section",{"aria-label":t("sessions.detail.consumption"),children:[e.jsxs("dl",{className:"grid grid-cols-2 overflow-hidden rounded-lg border border-oai-gray-200 dark:border-oai-gray-800",children:[e.jsx(ce,{label:t("sessions.col.tokens"),children:N(v+g)}),e.jsxs(ce,{label:t("sessions.col.cost"),className:"border-l",children:[z?"≥":"",k(h+b)]}),e.jsx(ce,{label:t("sessions.summary.speed"),className:"border-t",title:F?t("sessions.performance.samples",{count:y.estimated_request_count}):t("sessions.detail.no_speed"),children:F?e.jsx(re,{performance:y}):"—"}),e.jsx(ce,{label:t("sessions.performance.first_response"),className:"border-l border-t",title:t("sessions.performance.first_response_method"),children:S?Number(y.first_response_sample_count)===1?t("sessions.performance.first_response_value_single",q):t("sessions.performance.first_response_value",q):"—"})]}),O?e.jsx("dl",{className:"mt-3 space-y-1.5",children:ee.map(c=>e.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_80px_88px] items-baseline gap-3 text-sm",children:[e.jsx("dt",{className:"text-oai-gray-600 dark:text-oai-gray-300",children:c.label}),e.jsx("dd",{className:"text-right tabular-nums",children:N(c.tokens)}),e.jsxs("dd",{className:"text-right tabular-nums",children:[c.partial?"≥":"",k(c.cost)]})]},c.label))}):null,e.jsxs("p",{className:"mt-3 text-xs leading-5 text-oai-gray-500 dark:text-oai-gray-400",children:[t("sessions.detail.cost_source")," · ",Gs(a.cost_source),a.cost_is_partial?e.jsxs("span",{className:"text-amber-700 dark:text-amber-300",children:[" · ",t("sessions.cost.partial_title")]}):null,a.usage_is_incomplete?e.jsxs("span",{className:"text-amber-700 dark:text-amber-300",children:[" · ",t("sessions.badge.partial_usage")]}):null]})]}),e.jsxs("section",{className:"mt-6",children:[e.jsx("h3",{className:"text-sm font-medium text-oai-black dark:text-white",children:t("sessions.detail.tokens")}),e.jsx("dl",{className:"mt-2 grid grid-cols-1 gap-x-8 gap-y-1.5 sm:grid-cols-2",children:qs.map(({key:c,label:E})=>e.jsx(Te,{label:E(),children:a[c]==null?"—":N(a[c])},c))})]}),e.jsxs("section",{className:"mt-6",children:[e.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_80px_88px] items-baseline gap-3",children:[e.jsx("h3",{className:"text-sm font-medium text-oai-black dark:text-white",children:t("sessions.detail.models")}),e.jsx("span",{className:"text-right text-xs text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0,children:t("sessions.col.tokens")}),e.jsx("span",{className:"text-right text-xs text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0,children:t("sessions.col.cost")})]}),e.jsx("ul",{className:"mt-1 divide-y divide-oai-gray-100 dark:divide-oai-gray-800/70",children:j.map(c=>{const E=c.pricing?.status==="unpriced",A=a.cost_source==="provider_reported"&&j.length===1,I=A?h:c.cost_usd,K=Ks(I,A);return e.jsxs("li",{className:"py-2.5",children:[e.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_80px_88px] items-baseline gap-3 text-sm",children:[e.jsx("span",{className:"min-w-0 break-words text-oai-black dark:text-white",children:c.model||t("sessions.model.unknown")}),e.jsx("span",{className:"text-right tabular-nums",children:N(c.total_tokens)}),e.jsx("span",{className:"text-right tabular-nums",children:E&&!K?"—":k(I)})]}),c.pricing?e.jsxs("details",{className:"group text-xs text-oai-gray-500 dark:text-oai-gray-400",children:[e.jsxs("summary",{className:"flex min-h-10 cursor-pointer list-none items-center gap-2 rounded focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 sm:min-h-0 sm:pt-1 [&::-webkit-details-marker]:hidden",children:[e.jsx(re,{performance:c.performance,className:"tabular-nums"}),e.jsx("span",{className:"underline decoration-dotted underline-offset-4 group-open:no-underline",children:t("sessions.detail.pricing_details")})]}),e.jsxs("div",{className:"space-y-1 pt-1.5 leading-5",children:[E?e.jsx("p",{children:t("sessions.detail.pricing_unpriced")}):null,c.pricing.status==="free"?e.jsx("p",{children:t("sessions.detail.pricing_free")}):null,c.pricing.status==="priced"?e.jsx("p",{children:t("sessions.detail.pricing_rates",{input:c.pricing.input,output:c.pricing.output,cacheRead:c.pricing.cache_read,cacheWrite:c.pricing.cache_write})}):null,Ce(c.pricing.source)?e.jsx("p",{children:Ce(c.pricing.source)}):null]})]}):e.jsx(re,{performance:c.performance,className:"block pt-1 text-xs tabular-nums text-oai-gray-500 dark:text-oai-gray-400"})]},c.model)})})]}),e.jsxs("details",{className:"mt-5 border-t border-oai-gray-200 dark:border-oai-gray-800",children:[e.jsx("summary",{className:"flex min-h-11 cursor-pointer items-center rounded text-sm font-medium text-oai-black focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:text-white",children:t("sessions.detail.signals")}),e.jsx("dl",{className:"grid grid-cols-1 gap-x-8 gap-y-1.5 pb-4 sm:grid-cols-2",children:zs.map(({key:c,label:E,grokOnly:A})=>e.jsx(Te,{label:E(),children:typeof a[c]=="number"&&(!A||M)?N(a[c]):t("sessions.detail.not_recorded")},c))}),M&&a.usage_precision?e.jsx("p",{className:"pb-3 text-xs leading-5 text-oai-gray-500 dark:text-oai-gray-400",children:t("sessions.grok.runtime_breakdown",{calls:N(a.model_calls),seconds:(Number(a.api_duration_ms||0)/1e3).toFixed(1),tools:N(a.tool_calls),errors:N(a.error_count)})}):null,C?e.jsx("p",{className:"pb-3 text-xs leading-5 text-oai-gray-500 dark:text-oai-gray-400",children:t("sessions.grok.context_breakdown",{used:N(a.context_tokens_used),window:N(a.context_window_tokens),percent:Number(a.context_usage_percent||0).toFixed(0)})}):null]}),e.jsxs("details",{className:"border-t border-oai-gray-200 dark:border-oai-gray-800",children:[e.jsx("summary",{className:"flex min-h-11 cursor-pointer items-center rounded text-sm font-medium text-oai-black focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:text-white",children:t("sessions.detail.identifiers")}),e.jsxs("dl",{className:"space-y-3 pb-4",children:[e.jsxs("div",{children:[e.jsx("dt",{className:"text-xs text-oai-gray-600 dark:text-oai-gray-300",children:t("sessions.detail.session_id")}),e.jsx("dd",{className:"mt-1 break-all font-mono text-xs leading-5",children:a.session_id||a.session_hash})]}),a.project_ref?e.jsxs("div",{children:[e.jsx("dt",{className:"text-xs text-oai-gray-600 dark:text-oai-gray-300",children:t("sessions.detail.local_path")}),e.jsx("dd",{className:"mt-1 break-all font-mono text-xs leading-5",children:a.project_ref})]}):null,a.resume_command?e.jsxs("div",{children:[e.jsx("dt",{className:"text-xs text-oai-gray-600 dark:text-oai-gray-300",children:t("sessions.detail.resume_command")}),e.jsx("dd",{className:"mt-1 break-all font-mono text-xs leading-5",children:a.resume_command})]}):null]})]}),e.jsxs("div",{className:"mt-2 space-y-1.5 border-t border-oai-gray-200 pt-4 text-xs leading-5 text-oai-gray-500 dark:border-oai-gray-800 dark:text-oai-gray-400",children:[F?e.jsx("p",{children:t("sessions.performance.method")}):null,T?e.jsx("p",{children:t("sessions.detail.reasoning_note")}):null,e.jsx("p",{children:t("sessions.privacy")})]})]})]})})}const De=ks(),Me=[],ye=100,Ws=[{id:"all",label:()=>t("usage.filter.source_all")},{id:"claude",label:()=>"Claude Code"},{id:"codex",label:()=>"Codex"},{id:"opencode",label:()=>"OpenCode"},{id:"grok",label:()=>"Grok"},{id:"zcode",label:()=>"ZCode"},{id:"kimi",label:()=>t("leaderboard.column.kimi")},{id:"omp",label:()=>"oh-my-pi"},{id:"dsh",label:()=>t("provider.display.deepseek_harness")}],We=[{id:"all",days:0,label:()=>t("sessions.filter.range_label_all")},{id:"7d",days:7,label:()=>t("sessions.filter.range_7d")},{id:"30d",days:30,label:()=>t("sessions.filter.range_30d")},{id:"90d",days:90,label:()=>t("sessions.filter.range_90d")}];function Le(a){const s=We.find(o=>o.id===a)?.days||0;if(!s)return 0;const r=new Date;return r.setDate(r.getDate()-(s-1)),r.setHours(0,0,0,0),r.getTime()}function Hs(a,s){if(!s)return!0;const r=Date.parse(a.ended_at||a.started_at||"");return Number.isFinite(r)?r>=s:!0}function Vs(a){const s=Date.parse(a.started_at||"");return!Number.isFinite(s)||ue({started_at:a.started_at})===ue(a)}function Fe(a){const s=Z(a);return s.length===1?s[0].model||t("sessions.model.unknown"):s.map(r=>`${r.model} ${N(Number(r.total_tokens||0))}`).join(" · ")}async function Ie(a){if(navigator?.clipboard?.writeText)return await navigator.clipboard.writeText(a),!0;const s=document.createElement("textarea");s.value=a,s.style.position="fixed",s.style.opacity="0",document.body.appendChild(s),s.select();const r=document.execCommand("copy");return document.body.removeChild(s),r}function Bs(){const[a,s]=i.useState(!1),r=i.useId();return e.jsxs(vs,{open:a,onOpenChange:s,children:[e.jsx(Ns,{delay:150,closeDelay:100,closeOnClick:!1,onClick:()=>s(!0),"aria-label":t("sessions.summary.scope_help"),"aria-describedby":a?r:void 0,className:"sessions-summary-help relative inline-flex h-4 w-4 shrink-0 items-center justify-center rounded text-oai-gray-500 hover:text-oai-black dark:text-oai-gray-400 dark:hover:text-white before:absolute before:-inset-2 before:content-['']",children:e.jsx(js,{className:"h-3.5 w-3.5","aria-hidden":!0})}),e.jsx(Ss,{children:e.jsx(Cs,{side:"bottom",align:"end",sideOffset:12,className:"z-[60]",children:e.jsx(Ts,{id:r,role:"tooltip",className:"max-w-xs rounded-lg border border-oai-gray-200 bg-white p-4 text-sm leading-6 text-oai-gray-700 outline-none dark:border-oai-gray-700 dark:bg-oai-gray-900 dark:text-oai-gray-200",children:t("sessions.summary.scope")})})})]})}function L({className:a}){return e.jsx("span",{className:P("block rounded bg-oai-gray-200/70 animate-pulse dark:bg-oai-gray-800/70",a),"aria-hidden":"true"})}function Qs({index:a}){const s=["w-44","w-32","w-52","w-36","w-48","w-40"],r=["w-24","w-32","w-20"];return e.jsxs("li",{className:"sessions-row sessions-row-grid py-3","aria-hidden":"true",children:[e.jsxs("div",{className:"sessions-row-identity min-w-0",children:[e.jsx(L,{className:"h-4 w-4 rounded-full"}),e.jsxs("div",{className:"min-w-0 space-y-2",children:[e.jsx(L,{className:P("h-4",s[a%s.length])}),e.jsx("div",{className:"flex min-w-0 flex-wrap gap-2",children:r.map((o,u)=>e.jsx(L,{className:P("h-3",o)},u))})]})]}),e.jsxs("dl",{className:"sessions-row-metrics",children:[e.jsx("div",{className:"sessions-row-value",children:e.jsx(L,{className:"ml-auto h-4 w-14"})}),e.jsx("div",{className:"sessions-row-value",children:e.jsx(L,{className:"ml-auto h-4 w-12"})}),e.jsx("div",{className:"sessions-row-value",children:e.jsx(L,{className:"ml-auto h-4 w-16"})})]}),e.jsx(L,{className:"sessions-row-action h-8 w-8 rounded-md"})]})}function Zs({rows:a=6}){return e.jsxs("div",{"data-testid":"sessions-skeleton",role:"status","aria-busy":"true","aria-live":"polite",children:[e.jsx("span",{className:"sr-only",children:t("sessions.loading")}),e.jsx("section",{className:"mb-6 flex items-start gap-3 rounded-lg border border-oai-gray-200 px-4 py-3 dark:border-oai-gray-800","aria-hidden":"true",children:e.jsx("dl",{className:"sessions-kpis grid min-w-0 flex-1 grid-cols-2 gap-y-3 sm:grid-cols-4",children:Array.from({length:4},(s,r)=>e.jsxs("div",{children:[e.jsx(L,{className:"h-3 w-16"}),e.jsx(L,{className:P("mt-2 h-6",r===2?"w-20":"w-14")})]},r))})}),e.jsxs("div",{className:"sessions-row-grid sessions-list-header border-b border-oai-gray-200 py-2 dark:border-oai-gray-800","aria-hidden":"true",children:[e.jsx(L,{className:"h-3 w-16"}),e.jsx(L,{className:"ml-auto h-3 w-10"}),e.jsx(L,{className:"ml-auto h-3 w-9"}),e.jsx(L,{className:"ml-auto h-3 w-10"}),e.jsx("span",{})]}),e.jsxs("ul",{className:"divide-y divide-oai-gray-200 dark:divide-oai-gray-800","aria-hidden":"true",children:[e.jsx("li",{className:"pb-2 pt-5",children:e.jsx(L,{className:"h-3 w-24"})}),Array.from({length:a},(s,r)=>e.jsx(Qs,{index:r},r))]})]})}const Re=_e.memo(function({session:s,locale:r,nested:o=!1,timeOnly:u=!1,childCount:m=0,expanded:n=!1,onToggle:f,onDetail:k}){const{currency:j,rate:w}=we(),v=String(s.source||"").toUpperCase(),h=Ke(s.duration_ms),g=s.resume_command,b=s.project_key||t("sessions.project.unknown"),y=o||s.thread_kind==="subagent",F=y?s.agent_nickname||s.agent_role||s.title||b:s.title||b,S=s.usage_is_incomplete?t("sessions.badge.partial_usage"):s.cost_is_partial?t("sessions.badge.partial_cost"):null,q=s.project_ref?`${s.project_ref}
|
|
3
3
|
${t("sessions.project.copy_hint")}`:void 0,T=async()=>{if(s.project_ref)try{await Ie(s.project_ref)?J({title:t("sessions.project.copied")}):J({title:t("sessions.project.copy_failed")})}catch{J({title:t("sessions.project.copy_failed")})}},M=O=>e.jsxs("span",{className:"group relative inline-flex min-w-0 max-w-full",children:[e.jsx(_s,{text:q,placement:"bottom"}),e.jsx("button",{type:"button",onClick:T,"aria-label":t("sessions.project.copy_aria",{project:b}),className:P("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",O),children:b})]}),C=async()=>{if(g)try{await Ie(g)?J({title:t("sessions.resume.copied")}):J({title:t("sessions.resume.copy_failed")})}catch{J({title:t("sessions.resume.copy_failed")})}};return e.jsxs("li",{className:P("sessions-row sessions-row-grid py-3",o&&"sessions-row-nested"),children:[e.jsxs("div",{className:"sessions-row-identity min-w-0",children:[e.jsx("span",{className:"sessions-row-provider inline-flex items-center justify-center text-oai-gray-600 dark:text-oai-gray-300","aria-hidden":"true",children:e.jsx(Ae,{provider:v,size:o?16:18})}),e.jsxs("div",{className:"contents",children:[e.jsx("button",{type:"button",onClick:()=>k(s),"aria-label":t("sessions.detail.open_aria",{title:F}),title:F,className:"sessions-row-title block min-h-9 min-w-0 max-w-full truncate rounded text-left text-sm font-medium text-oai-black underline-offset-4 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:text-white md:min-h-5",children:F}),e.jsxs("div",{className:"sessions-row-meta flex min-w-0 flex-wrap items-center gap-y-1 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:[e.jsx("span",{className:"sessions-meta-item min-w-0 max-w-full",children:s.project_ref?M("min-h-6 inline-flex items-center md:min-h-0"):e.jsx("span",{className:"truncate",children:b})}),e.jsx("span",{className:"sessions-meta-item min-w-0 max-w-full truncate",title:Fe(s),children:Fe(s)}),e.jsx("span",{className:"sessions-meta-item tabular-nums",children:Ge(s.started_at,r,{timeOnly:u&&Vs(s)})}),h?e.jsx("span",{className:"sessions-meta-item tabular-nums",children:h}):null,Number.isFinite(s.session_store_bytes)?e.jsx("span",{className:"sessions-meta-item tabular-nums",title:t("sessions.storage.tooltip",{metric:t(s.session_store_metric==="allocated"?"sessions.storage.allocated":"sessions.storage.logical"),ratio:Math.round(s.bytes_per_1k_tokens||0).toLocaleString(r)}),children:t("sessions.storage.label",{size:t("sessions.storage.size",{value:(s.session_store_bytes/1024/1024).toLocaleString(r,{maximumFractionDigits:2})})})}):null,y?e.jsxs("span",{className:"sessions-meta-item",children:[t("sessions.badge.subagent"),s.agent_role?` · ${s.agent_role}`:""]}):null,s.first_pass?e.jsx("span",{className:"sessions-meta-item text-emerald-700 dark:text-emerald-300",children:t("sessions.badge.first_pass")}):null,S?e.jsx("span",{className:"sessions-meta-item text-amber-700 dark:text-amber-300",children:S}):null,s.cost_source==="provider_reported"?e.jsx("span",{className:"sessions-meta-item",children:t("sessions.badge.reported_cost")}):null,m?e.jsxs("button",{type:"button",onClick:()=>f(s.session_hash),"aria-expanded":n,className:"-mx-1.5 inline-flex min-h-8 items-center md:-my-1 md:ml-2 md:mr-0 gap-0.5 rounded px-1.5 font-medium text-oai-gray-700 hover:bg-oai-gray-100 hover:text-oai-black focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:text-oai-gray-200 dark:hover:bg-oai-gray-800 dark:hover:text-white md:min-h-6",children:[e.jsx(ds,{className:P("h-3.5 w-3.5 transition-transform",n&&"rotate-90"),"aria-hidden":!0}),n?t("sessions.thread.collapse",{count:m}):t("sessions.thread.expand",{count:m})]}):null]})]})]}),e.jsxs("dl",{className:"sessions-row-metrics",children:[e.jsxs("div",{className:"sessions-row-value",children:[e.jsx("dt",{className:"text-xs text-oai-gray-600 dark:text-oai-gray-300 md:sr-only",children:t("sessions.col.tokens")}),e.jsxs("dd",{title:Number(s.subagent_total_tokens)?t("sessions.thread.tokens_summary",{own:N(s.own_total_tokens),subagents:N(s.subagent_total_tokens),combined:N(s.combined_total_tokens)}):void 0,className:"mt-1 text-sm tabular-nums text-oai-black dark:text-white md:mt-0",children:[N(s.total_tokens),Number(s.subagent_total_tokens)?e.jsxs("span",{className:"mt-0.5 block text-xs text-oai-gray-500 dark:text-oai-gray-400",children:["Σ ",N(s.combined_total_tokens)]}):null]})]}),e.jsxs("div",{className:"sessions-row-value",children:[e.jsx("dt",{className:"text-xs text-oai-gray-600 dark:text-oai-gray-300 md:sr-only",children:t("sessions.col.cost")}),e.jsxs("dd",{className:"mt-1 text-sm tabular-nums text-oai-black dark:text-white md:mt-0",title:s.cost_is_partial?t("sessions.cost.partial_title"):void 0,children:[s.cost_is_partial?"≥":"",je(s.cost_usd,{currency:j,rate:w})]})]}),e.jsxs("div",{className:"sessions-row-value",children:[e.jsx("dt",{className:"text-xs text-oai-gray-600 dark:text-oai-gray-300 md:sr-only",children:t("sessions.col.speed")}),e.jsx("dd",{className:"mt-1 min-h-5 text-sm tabular-nums text-oai-gray-600 dark:text-oai-gray-300 md:mt-0",children:e.jsx(re,{performance:s.performance})})]})]}),e.jsx("button",{type:"button",onClick:C,disabled:!g,title:g||t("sessions.resume.unavailable"),"aria-label":g?t("sessions.resume.copy_aria",{command:g}):t("sessions.resume.unavailable"),className:"sessions-row-action inline-flex h-11 w-11 shrink-0 items-center justify-center rounded-md text-oai-gray-500 transition hover:bg-oai-gray-100 hover:text-oai-black focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 disabled:cursor-not-allowed dark:text-oai-gray-400 dark:hover:bg-oai-gray-800 dark:hover:text-white md:h-8 md:w-8",children:e.jsx(ws,{className:"h-4 w-4","aria-hidden":!0})})]})});function Xs({sessions:a,selectedModel:s,onSelect:r}){const{groups:o,totalTokens:u}=i.useMemo(()=>{const n=new Map;let f=0;for(const k of a)for(const j of Z(k)){const w=j.model||t("sessions.model.unknown"),v=Number(j.total_tokens||0),h=n.get(w)||{model:w,count:0,tokens:0};h.count+=1,h.tokens+=v,f+=v,n.set(w,h)}return{groups:[...n.values()].sort((k,j)=>j.tokens-k.tokens),totalTokens:f}},[a]);function m(n){return P("min-h-10 rounded-md border px-2.5 text-xs tabular-nums transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 md:min-h-7",n?"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:"sessions-thread-models py-2.5",children:e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.jsx("span",{className:"mr-1 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:t("sessions.thread.model_usage")}),e.jsx("button",{type:"button","aria-pressed":s==="all",onClick:()=>r("all"),className:m(s==="all"),children:t("sessions.thread.model_all",{count:a.length,tokens:N(u)})}),o.map(n=>e.jsx("button",{type:"button","aria-pressed":s===n.model,onClick:()=>r(n.model),className:m(s===n.model),children:t("sessions.thread.model_item",{model:n.model,count:n.count,tokens:N(n.tokens)})},n.model))]})})}function yt(){const[a]=i.useState(()=>Ps(window.location.search)),[s,r]=i.useState(null),[o,u]=i.useState(null),[m,n]=i.useState(!0),[f,k]=i.useState(!1),[j,w]=i.useState(a.source),[v,h]=i.useState(a.model),[g,b]=i.useState(a.from||a.to?"custom":"all"),[y,F]=i.useState(a.from),[S,q]=i.useState(a.to),[T,M]=i.useState("all"),[C,O]=i.useState("time"),[z,ee]=i.useState("recent"),[p,D]=i.useState(null),[R,c]=i.useState(""),[E,A]=i.useState(ye),[I,K]=i.useState(()=>new Set),[se,te]=i.useState(()=>new Map),oe=i.useRef(0),{resolvedLocale:B}=Ee(),{currency:He,rate:Ve}=we(),ne=i.useCallback(async(l=!1)=>{const x=++oe.current;l?k(!0):n(!0),u(null);try{const d=await Is({refresh:l});x===oe.current&&r(d)}catch(d){x===oe.current&&u(d?.message||String(d))}finally{x===oe.current&&(n(!1),k(!1))}},[]);i.useEffect(()=>{De||Ne()?ne(!1):n(!1)},[ne]);const U=s?.sessions||Me,Be=i.useMemo(()=>{const l=new Set,x=[];for(const d of U){const _=d.project_key;!_||l.has(_)||(l.add(_),x.push({value:_,label:_}))}return x.sort((d,_)=>d.label.localeCompare(_.label))},[U]),Qe=i.useMemo(()=>{const l=new Set;for(const x of U)for(const d of Z(x))d.model&&l.add(d.model);return[...l].sort().map(x=>({value:x,label:x}))},[U]),me=i.useDeferredValue(R),ie=i.useMemo(()=>{let x=Le(g),d=1/0;return g==="custom"&&(x=y?new Date(`${y}T00:00:00`).getTime():0,d=S?new Date(`${S}T23:59:59.999`).getTime():1/0,x>d&&(x=new Date(`${S}T00:00:00`).getTime(),d=new Date(`${y}T23:59:59.999`).getTime())),Rs(U,x,d)},[U,g,y,S]),W=i.useMemo(()=>{const l=me.trim().toLowerCase(),x=Le(g);return ie.filter(d=>{if(j!=="all"&&d.source!==j||T!=="all"&&d.project_key!==T||v!=="all"&&!Z(d).some(H=>H.model===v))return!1;if(g==="custom"){if(!As(d,y,S))return!1}else if(!Hs(d,x))return!1;if(!l)return!0;const _=Z(d).map(H=>H.model).join(" ");return`${d.title||""} ${d.project_key||""} ${_} ${d.agent_nickname||""} ${d.agent_role||""} ${d.project_ref||""} ${d.session_id||""}`.toLowerCase().includes(l)})},[ie,j,T,v,g,y,S,me]),Y=i.useMemo(()=>Ue(W),[W]),Q=i.useMemo(()=>{const l=new Set(W.map(_=>_.session_hash)),x=new Map,d=[];for(const _ of Es(W,z)){const G=_.root_session_hash||_.parent_session_hash;if(_.parent_session_hash&&G&&l.has(G)){const H=x.get(G)||[];H.push(_),x.set(G,H)}else d.push(_)}return{roots:d,childrenByRoot:x,foldedCount:W.length-d.length}},[W,z]),xe=j!=="all"||v!=="all"||g!=="all"||T!=="all"||R.trim()!=="";i.useEffect(()=>{A(ye),K(new Set),te(new Map)},[j,T,v,g,y,S,me,z,C,U]);const he=i.useMemo(()=>Q.roots.slice(0,E),[Q.roots,E]),Ze=i.useMemo(()=>$s(he,C),[he,C]),Xe=i.useMemo(()=>p?ie.filter(l=>l.session_hash!==p.session_hash&&(l.root_session_hash===p.session_hash||l.parent_session_hash===p.session_hash)):Me,[ie,p]),Ye=i.useCallback(()=>D(null),[]),ge=i.useCallback(l=>{b(l),l!=="custom"&&(F(""),q(""))},[]),Je=i.useCallback(()=>{w("all"),h("all"),M("all"),c(""),ge("all")},[ge]),pe=Q.roots.length>he.length,fe=i.useCallback(()=>A(l=>l+ye),[]),es=i.useCallback(l=>{K(x=>{const d=new Set(x);return d.has(l)?d.delete(l):d.add(l),d})},[]),ss=i.useCallback((l,x)=>{te(d=>{const _=new Map(d);return x==="all"?_.delete(l):_.set(l,x),_})},[]),ve=i.useRef(null);i.useEffect(()=>{if(!pe||typeof IntersectionObserver>"u")return;const l=ve.current;if(!l)return;const x=new IntersectionObserver(d=>{d.some(_=>_.isIntersecting)&&fe()},{rootMargin:"400px"});return x.observe(l),()=>x.disconnect()},[pe,fe]);const ts=i.useMemo(()=>Ws.map(l=>({value:l.id,label:l.label()})),[B]),as=i.useMemo(()=>[...We.map(l=>({value:l.id,label:l.label()})),{value:"custom",label:t("sessions.filter.range_custom")}],[B]),rs=i.useMemo(()=>[{value:"time",label:t("sessions.group.time")},{value:"project",label:t("sessions.group.project")}],[B]),os=i.useMemo(()=>[{value:"recent",label:t("sessions.sort.recent")},{value:"cost",label:t("sessions.sort.cost")},{value:"tokens",label:t("sessions.sort.tokens")}],[B]),ns=Number(s?.session_count)>Number(s?.returned_count);return!De&&!Ne()?e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx(us,{})}):e.jsxs("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:[e.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:e.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[e.jsxs("div",{className:"mb-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:t("nav.sessions")}),e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400 sm:text-base",children:t("sessions.page.summary")})]}),e.jsx("button",{type:"button",onClick:()=>{ne(!0)},disabled:f||m,"aria-label":t("sessions.page.refresh"),title:t("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(cs,{className:P("h-4 w-4",f&&"animate-spin"),"aria-hidden":!0})})]}),e.jsxs("div",{className:"mb-6 space-y-3",children:[e.jsxs("div",{className:"sessions-toolbar",children:[e.jsxs("div",{className:"sessions-toolbar-search relative",children:[e.jsx(Pe,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0}),e.jsx(ms,{type:"search",value:R,onChange:l=>c(l.target.value),onKeyDown:l=>{l.key==="Escape"&&R&&(l.preventDefault(),c(""))},"aria-label":t("sessions.action.search_aria"),placeholder:t("sessions.search.placeholder"),className:"h-11 pl-10 pr-12 text-sm !bg-white dark:!bg-oai-gray-900 !border-oai-gray-200 placeholder:!text-oai-gray-500 dark:!border-oai-gray-800 dark:placeholder:!text-oai-gray-400 sm:h-9 [&::-webkit-search-cancel-button]:appearance-none"}),R?e.jsx("button",{type:"button",onMouseDown:l=>l.preventDefault(),onClick:()=>c(""),"aria-label":t("sessions.action.search_clear"),className:"absolute right-0 top-0 flex h-11 w-11 items-center justify-center rounded-md text-oai-gray-600 hover:bg-oai-gray-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800 sm:h-9 sm:w-9",children:e.jsx($e,{className:"h-4 w-4","aria-hidden":!0})}):null]}),e.jsx(le,{ariaLabel:t("sessions.filter.source_aria"),options:ts,value:j,onValueChange:w,className:"sessions-filter-trigger h-11 min-w-0 px-3 text-sm sm:h-9",matchTriggerWidth:!0}),e.jsx(le,{ariaLabel:t("sessions.filter.range_aria"),options:as,value:g,onValueChange:ge,leadingIcon:e.jsx(Ds,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0}),className:"sessions-filter-trigger h-11 min-w-0 px-3 text-sm sm:h-9",matchTriggerWidth:!0}),e.jsx(Se,{options:Be,value:T,onChange:M,allLabel:t("sessions.filter.project_all"),searchPlaceholder:t("sessions.filter.project_search"),emptyLabel:t("sessions.filter.project_empty"),ariaLabel:t("sessions.filter.project_aria"),className:"sessions-filter-trigger !h-11 !w-full !max-w-none !px-3 !text-sm !font-normal sm:!h-9 !bg-white !text-oai-black dark:!bg-oai-gray-900 dark:!text-white [&>svg]:!text-oai-gray-500 dark:[&>svg]:!text-oai-gray-400"}),e.jsx(Se,{options:Qe,value:v,onChange:h,allLabel:t("sessions.filter.model_all"),searchPlaceholder:t("sessions.filter.model_search"),emptyLabel:t("sessions.filter.model_empty"),ariaLabel:t("sessions.filter.model_aria"),className:"sessions-filter-trigger sessions-model-filter !h-11 !w-full !max-w-none !px-3 !text-sm !font-normal sm:!h-9 !bg-white !text-oai-black dark:!bg-oai-gray-900 dark:!text-white [&>svg]:!text-oai-gray-500 dark:[&>svg]:!text-oai-gray-400"})]}),g==="custom"?e.jsxs("div",{className:"grid max-w-lg grid-cols-2 gap-3",children:[e.jsxs("label",{className:"min-w-0 text-xs text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx("span",{className:"mb-1 block",children:t("sessions.filter.from")}),e.jsx("input",{type:"date","aria-label":t("sessions.filter.from"),value:y,onChange:l=>F(l.target.value),className:"h-11 w-full min-w-0 rounded-md border border-oai-gray-200 bg-white px-3 text-sm outline-none focus:ring-2 focus:ring-oai-brand-500 dark:border-oai-gray-800 dark:bg-oai-gray-900 sm:h-10"})]}),e.jsxs("label",{className:"min-w-0 text-xs text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx("span",{className:"mb-1 block",children:t("sessions.filter.to")}),e.jsx("input",{type:"date","aria-label":t("sessions.filter.to"),value:S,onChange:l=>q(l.target.value),className:"h-11 w-full min-w-0 rounded-md border border-oai-gray-200 bg-white px-3 text-sm outline-none focus:ring-2 focus:ring-oai-brand-500 dark:border-oai-gray-800 dark:bg-oai-gray-900 sm:h-10"})]})]}):null]}),!m&&s?e.jsx("section",{className:"mb-6 flex items-start gap-3 rounded-lg border border-oai-gray-200 px-4 py-3 dark:border-oai-gray-800",children:e.jsxs("dl",{className:"sessions-kpis grid min-w-0 flex-1 grid-cols-2 gap-y-3 sm:grid-cols-4",children:[e.jsxs("div",{children:[e.jsx("dt",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400",children:t("sessions.summary.count")}),e.jsx("dd",{className:"mt-1 text-lg font-medium tabular-nums",children:N(Y.count)})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400",children:t("sessions.col.tokens")}),e.jsx("dd",{className:"mt-1 text-lg font-medium tabular-nums",children:N(Y.tokens)})]}),e.jsxs("div",{children:[e.jsx("dt",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400",children:t("sessions.col.cost")}),e.jsxs("dd",{className:"mt-1 text-lg font-medium tabular-nums",children:[Y.costIsPartial?"≥":"",je(Y.cost,{currency:He,rate:Ve})]})]}),e.jsxs("div",{children:[e.jsxs("dt",{className:"flex items-center gap-1.5 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:[e.jsx("span",{children:t("sessions.summary.speed")}),e.jsx(Bs,{})]}),e.jsxs("dd",{className:"mt-1 text-lg font-medium tabular-nums",children:[e.jsx(re,{performance:Y.performance}),Y.performance.estimated_tokens_per_second==null?"—":null]})]})]})}):null,!m&&s?e.jsxs("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-x-3 gap-y-2",children:[e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-3 text-xs tabular-nums text-oai-gray-500 dark:text-oai-gray-400",children:[e.jsx("span",{children:Q.foldedCount>0?t("sessions.thread.result_count",{roots:Q.roots.length,subagents:Q.foldedCount}):t("sessions.filter.result_count",{filtered:W.length,total:U.length})}),xe?e.jsx("button",{type:"button",onClick:Je,className:"inline-flex min-h-10 items-center rounded text-oai-gray-700 underline decoration-oai-gray-300 underline-offset-4 hover:text-oai-black focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:text-oai-gray-200 dark:decoration-oai-gray-600 dark:hover:text-white sm:min-h-0",children:t("sessions.filter.clear")}):null]}),e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(le,{ariaLabel:t("sessions.group.aria"),options:rs,value:C,onValueChange:O,className:"sessions-filter-trigger h-11 min-w-0 max-w-40 px-2.5 text-xs sm:h-8"}),e.jsx(le,{ariaLabel:t("sessions.sort.aria"),options:os,value:z,onValueChange:ee,className:"sessions-filter-trigger h-11 min-w-0 max-w-44 px-2.5 text-xs sm:h-8",align:"end"})]})]}):null,!m&&ns?e.jsx("p",{className:"mb-4 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:t("sessions.truncated",{shown:s.returned_count,total:s.session_count})}):null,o&&!s?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:t("sessions.error.title")}),e.jsx("p",{className:"mt-1 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:o}),e.jsx("button",{type:"button",onClick:()=>{ne(!1)},className:"mt-4 inline-flex h-11 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:t("sessions.error.retry")})]}):m?e.jsx(Zs,{}):W.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:xe?t("sessions.empty.filtered_title"):t("sessions.empty.title")}),e.jsx("p",{className:"mt-1 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:xe?t("sessions.empty.filtered_body"):t("sessions.empty.body")})]}):e.jsxs(e.Fragment,{children:[o?e.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400",children:t("shared.error.prefix",{error:o})}):null,e.jsxs("div",{className:"sessions-row-grid sessions-list-header border-b border-oai-gray-200 py-2 text-xs text-oai-gray-500 dark:border-oai-gray-800 dark:text-oai-gray-400","aria-hidden":!0,children:[e.jsx("span",{children:t("sessions.col.session")}),e.jsx("span",{className:"text-right",children:t("sessions.col.tokens")}),e.jsx("span",{className:"text-right",children:t("sessions.col.cost")}),e.jsx("span",{className:"text-right",children:t("sessions.col.speed")}),e.jsx("span",{className:"sr-only",children:t("sessions.col.actions")})]}),e.jsx("ul",{className:"divide-y divide-oai-gray-200 dark:divide-oai-gray-800",children:Ze.map(l=>e.jsxs(_e.Fragment,{children:[e.jsx("li",{className:"pb-2 pt-5",children:e.jsx("h2",{className:"break-words text-xs font-medium text-oai-gray-900 dark:text-oai-gray-100",children:C==="project"?l.key||t("sessions.project.unknown"):l.key?new Date(`${l.key}T12:00:00`).toLocaleDateString(B||void 0,{year:"numeric",month:"short",day:"numeric"}):t("sessions.group.unknown_date")})}),l.sessions.map(x=>{const d=Q.childrenByRoot.get(x.session_hash)||[],_=I.has(x.session_hash),G=se.get(x.session_hash)||"all",H=G==="all"?d:d.filter(function(is){return Z(is).some(ls=>ls.model===G)});return e.jsxs(_e.Fragment,{children:[e.jsx(Re,{session:x,locale:B,timeOnly:C==="time",childCount:d.length,expanded:_,onToggle:es,onDetail:D}),_&&d.length?e.jsx(Xs,{sessions:d,selectedModel:G,onSelect:ae=>ss(x.session_hash,ae)}):null,_?H.map(ae=>e.jsx(Re,{session:ae,locale:B,nested:!0,timeOnly:C==="time",onDetail:D},ae.session_hash)):null]},x.session_hash)})]},l.key))}),pe?e.jsx("div",{ref:ve,className:"flex justify-center pt-6",children:e.jsx("button",{type:"button",onClick:fe,className:"inline-flex h-11 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:t("sessions.action.load_more")})}):null]}),m?null:e.jsx("p",{className:"mt-8 max-w-3xl text-xs leading-5 text-oai-gray-600 dark:text-oai-gray-300",children:t("sessions.privacy")})]})}),p?e.jsx(Us,{session:p,subagents:Xe,onClose:Ye}):null]})}export{yt as SessionsPage};
|