tokentracker-cli 1.0.7 → 1.1.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.de.md +10 -5
- package/README.ja.md +8 -7
- package/README.ko.md +8 -7
- package/README.md +11 -9
- package/README.zh-CN.md +8 -7
- package/dashboard/dist/assets/{AchievementBadge-BI_HiL08.js → AchievementBadge-Dk6u95zc.js} +1 -1
- package/dashboard/dist/assets/{AchievementsPage-CbK_pV0C.js → AchievementsPage-DGzIJJ2h.js} +2 -2
- package/dashboard/dist/assets/{AchievementsSection-DEQycrwd.js → AchievementsSection-DaVrpiJ4.js} +1 -1
- package/dashboard/dist/assets/{BadgeDetailModal-BdaHueq5.js → BadgeDetailModal-BFCscxTM.js} +1 -1
- package/dashboard/dist/assets/{BotAnimated-BATn4r97.js → BotAnimated-CrQkI3wD.js} +1 -1
- package/dashboard/dist/assets/{Card-C3_Fzc5V.js → Card-vaZ1_mSY.js} +1 -1
- package/dashboard/dist/assets/{ClawdAnimated-BidgYaVn.js → ClawdAnimated-CV14fpL_.js} +2 -2
- package/dashboard/dist/assets/{CommandPalette-D86_iwFa.js → CommandPalette-XAR6FIiO.js} +1 -1
- package/dashboard/dist/assets/{CommunityStatsModal-CJuy4O88.js → CommunityStatsModal-DcMf6LXP.js} +1 -1
- package/dashboard/dist/assets/{ConfirmModal-BaAc5rzt.js → ConfirmModal-Cf6rWUl4.js} +1 -1
- package/dashboard/dist/assets/{Controls-Brnf_QJ_.js → Controls-BQLLIIii.js} +1 -1
- package/dashboard/dist/assets/{DashboardPage-BmW622BX.js → DashboardPage-wXkhfR3l.js} +1 -1
- package/dashboard/dist/assets/{DevicePage-DDrrY5AJ.js → DevicePage-DzCAsvYS.js} +1 -1
- package/dashboard/dist/assets/{DialogClose-BNcKZCV5.js → DialogClose-Dh1DXLjH.js} +1 -1
- package/dashboard/dist/assets/DialogDescription-wLKjV-9l.js +1 -0
- package/dashboard/dist/assets/{DialogTitle-DL9AVJvk.js → DialogTitle-BhRP2R4n.js} +1 -1
- package/dashboard/dist/assets/{FadeIn-BYwYqoVv.js → FadeIn-C0rmYYmJ.js} +1 -1
- package/dashboard/dist/assets/{HeaderGithubStar-C71yS5fY.js → HeaderGithubStar-198FQmDH.js} +1 -1
- package/dashboard/dist/assets/{HoverTooltip-nJQ-bK5U.js → HoverTooltip-ClzkNc3q.js} +1 -1
- package/dashboard/dist/assets/{IpCheckPage-CTwXZRZk.js → IpCheckPage-DpN9xGZc.js} +1 -1
- package/dashboard/dist/assets/{LandingPage--GOHgrB4.js → LandingPage-BImwSrmg.js} +2 -2
- package/dashboard/dist/assets/{LeaderboardAvatar-B7SjpjnT.js → LeaderboardAvatar-CU42rgGA.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardPage-BmExdKSM.js → LeaderboardPage-Le_J0I7b.js} +2 -2
- package/dashboard/dist/assets/{LeaderboardProfileModal-C5cQqviO.js → LeaderboardProfileModal-DLyu6a2Y.js} +3 -3
- package/dashboard/dist/assets/{LeaderboardProfilePage-DJ-09rX6.js → LeaderboardProfilePage-Dkfit9_X.js} +1 -1
- package/dashboard/dist/assets/{LimitsPage-CazL_F1h.js → LimitsPage-CNTDR2Yf.js} +1 -1
- package/dashboard/dist/assets/{LocalOnlyNotice-K3aCR52T.js → LocalOnlyNotice-DcjSbtm8.js} +1 -1
- package/dashboard/dist/assets/{LoginCard-_FbeoBO0.js → LoginCard-CgpzXY1G.js} +1 -1
- package/dashboard/dist/assets/{LoginModal-CYXuWlcp.js → LoginModal-BHNs7soq.js} +1 -1
- package/dashboard/dist/assets/{LoginPage-NgvQXPTx.js → LoginPage-DaaWeKvj.js} +1 -1
- package/dashboard/dist/assets/{PetPage-CQ1aHdDU.js → PetPage-DSDJvZy7.js} +1 -1
- package/dashboard/dist/assets/{PopoverPopup-BH948Enq.js → PopoverPopup-BJrL_Eyg.js} +1 -1
- package/dashboard/dist/assets/{ProviderIcon-CTBbzd0x.js → ProviderIcon-De08Y4_I.js} +1 -1
- package/dashboard/dist/assets/{ResetPasswordPage-GCsv0PKq.js → ResetPasswordPage-C4dwdur6.js} +1 -1
- package/dashboard/dist/assets/{SegmentedControl-D-a1T6Ay.js → SegmentedControl-CJRmt3or.js} +1 -1
- package/dashboard/dist/assets/{Select-BuBpeT1X.js → Select-Dojy3Frf.js} +1 -1
- package/dashboard/dist/assets/{SelectItemText-BJl0lY5n.js → SelectItemText-_uysSMQl.js} +1 -1
- package/dashboard/dist/assets/{ServiceStatusPage-Xz-rDYxA.js → ServiceStatusPage-C3ZC1csM.js} +1 -1
- package/dashboard/dist/assets/{SessionsPage-BvJjRxbT.js → SessionsPage-BG-VlDWP.js} +1 -1
- package/dashboard/dist/assets/{SettingsPage-CDrrA4Z_.js → SettingsPage-Dr5gq6qj.js} +2 -2
- package/dashboard/dist/assets/{SkillsPage-C3YDKdBr.js → SkillsPage-Dh6Udkc3.js} +1 -1
- package/dashboard/dist/assets/{TokenGalaxy-CwBN1Nw2.js → TokenGalaxy-MVMMCH06.js} +1 -1
- package/dashboard/dist/assets/{ToolbarRootContext-2RKWzsAn.js → ToolbarRootContext-CPEvPTvc.js} +1 -1
- package/dashboard/dist/assets/{TrendMonitor-CrCYxmL5.js → TrendMonitor-uFX8OtrM.js} +1 -1
- package/dashboard/dist/assets/{WidgetsPage-CdJhuvNK.js → WidgetsPage-BqyLjoN0.js} +1 -1
- package/dashboard/dist/assets/{WrappedPage-xQN9f_Lg.js → WrappedPage-CIHbEOoq.js} +1 -1
- package/dashboard/dist/assets/__vite-browser-external-oFHfLR8i.js +45 -0
- package/dashboard/dist/assets/{agent-logos-fd9xH1K3.js → agent-logos-CAF9WeKO.js} +1 -1
- package/dashboard/dist/assets/{arrow-up-right-DWTEaioI.js → arrow-up-right-y3EAs6Hg.js} +1 -1
- package/dashboard/dist/assets/{check-D7d6q9Tz.js → check-BH5FRF8F.js} +1 -1
- package/dashboard/dist/assets/{composite-xFyWluZ9.js → composite-Bl68G4Qr.js} +1 -1
- package/dashboard/dist/assets/{copy-BlQDmjZB.js → copy-Ce6L4gOk.js} +1 -1
- package/dashboard/dist/assets/{download-CCvNpDTW.js → download-p1XPZSMa.js} +1 -1
- package/dashboard/dist/assets/{external-link-D3CFEoOU.js → external-link-DGnoQUQ1.js} +1 -1
- package/dashboard/dist/assets/{flame-BVD3QAGl.js → flame-CltKUU4A.js} +1 -1
- package/dashboard/dist/assets/{format-tokens-BeU_fDKc.js → format-tokens-BEIqtfnO.js} +1 -1
- package/dashboard/dist/assets/{icons-DT5tCQC8.js → icons-ByLLrgdQ.js} +1 -1
- package/dashboard/dist/assets/{index-7Rxzbfye.js → index-B79BltL7.js} +1 -1
- package/dashboard/dist/assets/{index-CB5EF37x.js → index-CKkbTkf_.js} +1 -1
- package/dashboard/dist/assets/{index-CuRJmltu.js → index-DU7IUcrN.js} +1 -1
- package/dashboard/dist/assets/{info-Ct8mnVg8.js → info-DOCG1uXG.js} +1 -1
- package/dashboard/dist/assets/{link-2-BkEYcjI7.js → link-2-B0HME1R-.js} +1 -1
- package/dashboard/dist/assets/{loader-circle-Cwlqvkcz.js → loader-circle-B6dVl4Im.js} +1 -1
- package/dashboard/dist/assets/{maximize-2-Bfi31lVA.js → maximize-2-P4lRVuFz.js} +1 -1
- package/dashboard/dist/assets/{modifiers.esm-DC5Ku6C4.js → modifiers.esm-C8Hm25xI.js} +1 -1
- package/dashboard/dist/assets/{monitor-smartphone-CjsPxNBN.js → monitor-smartphone-CoKP2dcs.js} +1 -1
- package/dashboard/dist/assets/{plus-CgM_CX0H.js → plus-CaDzdXql.js} +1 -1
- package/dashboard/dist/assets/{provider-display-TEnGljXd.js → provider-display-Cr0tI5r6.js} +1 -1
- package/dashboard/dist/assets/{react-CwlX45ob.js → react-C9Bg9RXS.js} +1 -1
- package/dashboard/dist/assets/{search-CKtoGzmW.js → search-CPdoCrMk.js} +1 -1
- package/dashboard/dist/assets/{skills-api-DuBly_gc.js → skills-api-DVU6coYZ.js} +1 -1
- package/dashboard/dist/assets/{sortable.esm-BNsp-WHM.js → sortable.esm-Cj2-YumT.js} +1 -1
- package/dashboard/dist/assets/{store-BTs6kZtj.js → store-npers9xW.js} +1 -1
- package/dashboard/dist/assets/{terminal-DPMN8gR5.js → terminal-CJyI1G2f.js} +1 -1
- package/dashboard/dist/assets/{trash-BDR38M5I.js → trash-BMmBe_XE.js} +1 -1
- package/dashboard/dist/assets/{use-community-stats-Deg7skO9.js → use-community-stats-DPEyQ7FC.js} +1 -1
- package/dashboard/dist/assets/{use-latest-request-guard-Bs2kD7b1.js → use-latest-request-guard-BIjzEUC7.js} +1 -1
- package/dashboard/dist/assets/{use-limits-display-prefs-BgdguDzu.js → use-limits-display-prefs-Dx9nZB5K.js} +1 -1
- package/dashboard/dist/assets/{use-ordered-list-ezT84-W6.js → use-ordered-list-BVfyhpWi.js} +1 -1
- package/dashboard/dist/assets/use-reduced-motion-D_7LzLSe.js +1 -0
- package/dashboard/dist/assets/{use-session-efficiency-pref-CTxl79WJ.js → use-session-efficiency-pref-DFdlqCsV.js} +1 -1
- package/dashboard/dist/assets/{use-transform-BpIPybsm.js → use-transform-DYM391E0.js} +1 -1
- package/dashboard/dist/assets/use-usage-limits-ucoHKjM6.js +1 -0
- package/dashboard/dist/assets/{useCurrency-e-C23rLv.js → useCurrency-Cp27r6z0.js} +1 -1
- package/dashboard/dist/assets/{useTokenFormat-D_LHEY77.js → useTokenFormat-CXx5hVTJ.js} +1 -1
- package/dashboard/dist/assets/{zap-CjrBTjSn.js → zap-D2E3JNcE.js} +1 -1
- package/dashboard/dist/brand-logos/cline.png +0 -0
- package/dashboard/dist/index.html +13 -11
- package/dashboard/dist/ip-check.html +1 -1
- package/dashboard/dist/leaderboard.html +1 -1
- package/dashboard/dist/llms.txt +3 -2
- package/dashboard/dist/share.html +1 -1
- package/package.json +2 -2
- package/src/commands/init.js +25 -0
- package/src/commands/status.js +31 -0
- package/src/commands/sync.js +39 -0
- package/src/lib/pricing/curated-overrides.json +15 -0
- package/src/lib/pricing/index.js +6 -3
- package/src/lib/pricing/matcher.js +7 -0
- package/src/lib/pricing/seed-snapshot.json +1 -1
- package/src/lib/rollout.js +516 -17
- package/src/lib/zcode-limits.js +147 -16
- package/dashboard/dist/assets/DialogDescription-CSvbgRdI.js +0 -1
- package/dashboard/dist/assets/__vite-browser-external-CMMzxCk7.js +0 -45
- package/dashboard/dist/assets/use-reduced-motion-TNdjFH8O.js +0 -1
- package/dashboard/dist/assets/use-usage-limits-ts6E8fNZ.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{bW as yn,bb as He,ax as z,bg as In,bZ as zt,bX as Cn,r as o,bf as Y,bB as St,ci as Lt,cj as gt,ck as Dt,c0 as mt,bh as Ye,aO as ve,w as he,cl as Ht,bA as Nt,cm as Ge,aN as En,bq as Kt,c2 as Yt,cn as lt,co as ct,cp as $t,cq as Ct,be as tt,c7 as vn,cr as wn,cs as Rt,ay as Ne,b9 as te,E as nt,j as ae,aG as Et,aA as bt,az as Tn,aD as Mn,aE as Pn,aF as st,aP as An,c1 as On,aC as rt,bU as Fn,t as Gt,v as ke,ct as Vn,aL as Ln,cu as Dn,aM as Hn,bj as Nn,cv as kn,aH as Xt,cw as ht}from"./__vite-browser-external-CMMzxCk7.js";import{r as Jt,F as Un,P as Bn,v as Ae,q as _n,E as jn,G as Ie,H as Zt,D as Wn,u as qn,a as Qt,f as zn,e as Kn,z as Yn,I as $n,d as Gn,b as Xn,C as Jn}from"./composite-xFyWluZ9.js";import{h as Zn,u as Qn,a as er,d as tr,c as nr,e as rr,f as or,i as sr,p as ir,r as lr,g as cr}from"./ToolbarRootContext-2RKWzsAn.js";function ze(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}function ur(e){const{open:t=!1,onOpenChange:n,elements:r={}}=e,s=yn(),i=Jt()!=null,c=He(()=>new Un({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new Bn,floatingId:s,syncOnly:!1,nested:i})).current;return z(()=>{const f={open:t,floatingId:s};r.reference!==void 0&&(f.referenceElement=r.reference,f.domReferenceElement=In(r.reference)?r.reference:null),r.floating!==void 0&&(f.floatingElement=r.floating),c.update(f)},[t,s,r.reference,r.floating,c]),c.context.onOpenChange=n,c.context.nested=i,c}const ar="Escape";function kt(e){return Yt&&e.movementX===0&&e.movementY===0}function ut(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Xe(e,t){return ut(t,e===$t||e===Ct,e===lt||e===ct)}function xt(e,t,n){return ut(t,e===Ct,n?e===lt:e===ct)||e==="Enter"||e===" "||e===""}function fr(e,t,n){return ut(t,n?e===lt:e===ct,e===Ct)}function dr(e,t,n,r){const s=n?e===ct:e===lt,i=e===$t;return t==="both"||t==="horizontal"&&r?e===ar:ut(t,s,i)}function pr(e,t){const{listRef:n,activeIndex:r,onNavigate:s=()=>{},enabled:i=!0,selectedIndex:c=null,allowEscape:f=!1,loopFocus:l=!1,nested:C=!1,rtl:R=!1,virtual:x=!1,focusItemOnOpen:T="auto",focusItemOnHover:d=!0,openOnArrowKeyDown:F=!0,disabledIndices:A=void 0,orientation:E="vertical",parentOrientation:y,id:$,resetOnPointerLeave:V=!0,externalTree:g,grid:m}=t,O=m!=null,p="rootStore"in e?e.rootStore:e,S=p.useState("open"),k=p.useState("floatingElement"),D=p.useState("domReferenceElement"),G=p.context.dataRef,K=zt(k),h=Cn(D),L=Ae(K),q=Jt(),J=_n(g),W=o.useRef(T),v=o.useRef(c??-1),U=o.useRef(null),a=o.useRef(!0),I=Y(u=>{s(v.current===-1?null:v.current,u)}),M=o.useRef(!!k),P=o.useRef(S),H=o.useRef(!1),X=o.useRef(!1),ne=o.useRef(null),re=Ae(A),se=Ae(S),le=Ae(c),oe=Ae(V),fe=St(),B=St(),j=Y(()=>{function u(N){x?J?.events.emit("virtualfocus",N):ne.current=jn(N,{sync:H.current,preventScroll:!0})}const b=n.current[v.current],Q=X.current;b&&u(b),(H.current?N=>N():N=>fe.request(N))(()=>{const N=n.current[v.current]||b;if(!N)return;b||u(N),ue&&(Q||!a.current)&&N.scrollIntoView?.({block:"nearest",inline:"nearest"})})});z(()=>{G.current.orientation=E},[G,E]),z(()=>{i&&(S&&k?(v.current=c??-1,W.current&&c!=null&&(X.current=!0,I())):M.current&&(v.current=-1,I()))},[i,S,k,c,I]),z(()=>{if(i){if(!S){H.current=!1;return}if(k)if(r==null){if(H.current=!1,le.current!=null)return;if(M.current&&(v.current=-1,j()),(!P.current||!M.current)&&W.current&&(U.current!=null||W.current===!0&&U.current==null)){let u=0;const b=()=>{n.current[0]==null?(u<2&&(u?w=>B.request(w):queueMicrotask)(b),u+=1):(v.current=U.current==null||xt(U.current,E,R)||C?gt(n):Dt(n),U.current=null,I())};b()}}else Lt(n.current,r)||(v.current=r,j(),X.current=!1)}},[i,S,k,r,le,C,n,E,R,I,j,B]),z(()=>{if(!i||k||!J||x||!M.current)return;const u=J.nodesRef.current,b=u.find(N=>N.id===q)?.context?.elements.floating,Q=mt(Ye(D??b??null)),w=u.some(N=>N.context&&ve(N.context.elements.floating,Q));b&&!w&&a.current&&b.focus({preventScroll:!0})},[i,k,D,J,q,x]),z(()=>{P.current=S,M.current=!!k}),z(()=>{S||(U.current=null,W.current=T)},[S,T]);const ce=r!=null,Z=Y(u=>{if(!se.current)return;const b=n.current.indexOf(u.currentTarget);b!==-1&&(v.current!==b||r!==b)&&(v.current=b,I(u))}),pe=Y(()=>y??J?.nodesRef.current.find(u=>u.id===q)?.context?.dataRef?.current.orientation),xe=Y(()=>gt(n,re.current)),de=Y(u=>{if(a.current=!1,H.current=!0,u.which===229||!se.current&&u.currentTarget===L.current)return;if(C&&dr(u.key,E,R,O)){Xe(u.key,pe())||Ie(u),p.setOpen(!1,he(Ht,u.nativeEvent)),Nt(D)&&(x?J?.events.emit("virtualfocus",D):D.focus());return}const b=v.current,Q=gt(n,A),w=Dt(n,A);if(h||(u.key==="Home"&&(Ie(u),v.current=Q,I(u)),u.key==="End"&&(Ie(u),v.current=w,I(u))),m!=null){const N=m(u,v.current,n,E,l,R,A,Q,w);if(N!=null&&(v.current=N,I(u)),E==="both")return}if(Xe(u.key,E)){if(Ie(u),S&&!x&&mt(u.currentTarget.ownerDocument)===u.currentTarget){v.current=xt(u.key,E,R)?Q:w,I(u);return}xt(u.key,E,R)?l?b>=w?f&&b!==n.current.length?v.current=-1:(H.current=!1,v.current=Q):v.current=Ge(n.current,{startingIndex:b,disabledIndices:A}):v.current=Math.min(w,Ge(n.current,{startingIndex:b,disabledIndices:A})):l?b<=Q?f&&b!==-1?v.current=n.current.length:(H.current=!1,v.current=w):v.current=Ge(n.current,{startingIndex:b,decrement:!0,disabledIndices:A}):v.current=Math.max(Q,Ge(n.current,{startingIndex:b,decrement:!0,disabledIndices:A})),Lt(n.current,v.current)&&(v.current=-1),I(u)}}),ue=o.useMemo(()=>({onFocus(b){H.current=!0,Z(b)},onClick:({currentTarget:b})=>b.focus({preventScroll:!0}),onMouseMove(b){kt(b)||(H.current=!0,X.current=!1,d&&Z(b))},onPointerLeave(b){if(!se.current||!a.current||b.pointerType==="touch")return;H.current=!0;const Q=b.relatedTarget;if(!(!d||n.current.includes(Q))&&oe.current&&(ne.current?.(),ne.current=null,v.current=-1,I(b),!x)){const w=L.current,N=mt(Ye(w));w&&ve(w,N)&&w.focus({preventScroll:!0})}}}),[Z,se,L,d,n,I,oe,x]),ge=o.useMemo(()=>x&&S&&ce&&{"aria-activedescendant":`${$}-${r}`},[x,S,ce,$,r]),Se=o.useMemo(()=>({...h?{}:ge,onKeyDown(u){if(u.key==="Tab"&&u.shiftKey&&S&&!x){const b=En(u.nativeEvent);if(b&&!ve(L.current,b))return;Ie(u),p.setOpen(!1,he(Kt,u.nativeEvent)),Nt(D)&&D.focus();return}de(u)},onPointerMove(u){kt(u)||(a.current=!0)}}),[ge,de,L,h,p,S,x,D]),ee=o.useMemo(()=>{function u(w){p.setOpen(!0,he(Ht,w.nativeEvent,w.currentTarget))}function b(w){T==="auto"&&Zt(w.nativeEvent)&&(W.current=!x)}function Q(w){W.current=T,T==="auto"&&Wn(w.nativeEvent)&&(W.current=!0)}return{onKeyDown(w){const N=p.select("open");a.current=!1;const Te=w.key.startsWith("Arrow"),Me=fr(w.key,pe(),R),be=Xe(w.key,E),Re=(C?Me:be)||w.key==="Enter"||w.key.trim()==="";if(x&&N)return de(w);if(!(!N&&!F&&Te)){if(Re){const Ue=Xe(w.key,pe());U.current=C&&Ue?null:w.key}if(C){Me&&(Ie(w),N?(v.current=xe(),I(w)):u(w));return}be&&(le.current!=null&&(v.current=le.current),Ie(w),!N&&F?u(w):de(w),N&&I(w))}},onFocus(w){p.select("open")&&!x&&(v.current=-1,I(w))},onPointerDown:Q,onPointerEnter:Q,onMouseDown:b,onClick:b}},[de,T,xe,C,I,p,F,E,pe,R,le,x]),we=o.useMemo(()=>({...ge,...ee}),[ge,ee]);return o.useMemo(()=>i?{reference:we,floating:Se,item:ue,trigger:ee}:{},[i,we,Se,ee,ue])}function gr(e,t){const{listRef:n,elementsRef:r,activeIndex:s,onMatch:i,disabledIndices:c,onTyping:f,enabled:l=!0,resetMs:C=750,selectedIndex:R=null}=t,x="rootStore"in e?e.rootStore:e,T=x.useState("open"),d=tt(),F=o.useRef(""),A=o.useRef(R??s??-1),E=o.useRef(null),y=Y(g=>{function m(L){return r?.current[L]}function O(L){const q=m(L);return q&&!vn(q)||q?.matches(":disabled")?!1:c==null||!wn(Rt,L,c)}function p(L,q,J=0){if(L.length===0)return-1;const W=(J%L.length+L.length)%L.length,v=q.toLowerCase();for(let U=0;U<L.length;U+=1){const a=(W+U)%L.length;if(!(!L[a]?.toLowerCase().startsWith(v)||!O(a)))return a}return-1}const S=n.current;if(F.current.length>0&&g.key===" "&&(Ie(g),f?.(!0)),F.current.length>0&&F.current[0]!==" "&&p(S,F.current)===-1&&g.key!==" "&&f?.(!1),S==null||g.key.length!==1||g.ctrlKey||g.metaKey||g.altKey)return;T&&g.key!==" "&&(Ie(g),f?.(!0));const k=F.current==="";k&&(A.current=R??s??-1),S.every((L,q)=>L&&O(q)?L[0]?.toLowerCase()!==L[1]?.toLowerCase():!0)&&F.current===g.key&&(F.current="",A.current=E.current),F.current+=g.key,d.start(C,()=>{F.current="",A.current=E.current,f?.(!1)});const K=((k?R??s??-1:A.current)??0)+1,h=p(S,F.current,K);h!==-1?(i?.(h),E.current=h):g.key!==" "&&(F.current="",f?.(!1))}),$=Y(g=>{const m=g.relatedTarget,O=x.select("domReferenceElement"),p=x.select("floatingElement");ve(O,m)||ve(p,m)||(d.clear(),F.current="",A.current=E.current,f?.(!1))});z(()=>{!T&&R!==null||(d.clear(),E.current=null,F.current!==""&&(F.current=""))},[T,R,d]);const V=o.useMemo(()=>({onKeyDown:y,onBlur:$}),[y,$]);return o.useMemo(()=>l?{reference:V,floating:V}:{},[l,V])}function mr(e){const[t,n]=o.useState({current:e,previous:null});return Object.is(e,t.current)||n({current:e,previous:t.current}),t.previous}function hr(e){const t=o.useRef(!0);t.current&&(t.current=!1,e())}function xr(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}function Ut({controlled:e,default:t,name:n,state:r="value"}){const{current:s}=o.useRef(e!==void 0),[i,c]=o.useState(t),f=s&&e!==void 0?e:i,l=o.useCallback(C=>{s||c(C)},[]);return[f,l]}const en=o.createContext(void 0),tn=o.createContext(void 0),nn=o.createContext(void 0);function Fe(){const e=o.useContext(en);if(e===void 0)throw new Error(Ne(60));return e}function vt(){const e=o.useContext(tn);if(e===void 0)throw new Error(Ne(101));return e}function rn(){const e=o.useContext(nn);if(e===void 0)throw new Error(Ne(61));return e}const Sr="data-valid",Rr="data-invalid",br={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},yr={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},Ir={disabled:!1,...yr},Cr={valid(e){return e===null?null:e?{[Sr]:""}:{[Rr]:""}}},Er={invalid:void 0,name:void 0,validityData:{state:br,errors:[],error:"",value:"",initialValue:null},setValidityData:te,disabled:void 0,setTouched:te,setDirty:te,setFilled:te,setFocused:te,validationMode:"onSubmit",shouldValidateOnChange:()=>!1,state:Ir,registerFieldControl:te,validation:{getValidationProps:(e,t=nt)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:te,getInputControl:()=>null,commit:async()=>{},change:te}},vr=o.createContext(Er);function wt(e=!0){const t=o.useContext(vr);if(t.setValidityData===te&&!e)throw new Error(Ne(28));return t}function wr(e,t,n,r,s=!0,i){const{registerFieldControl:c}=wt(),f=He(()=>Symbol());z(()=>{const l=f.current;if(!s){c(l,void 0);return}c(l,{controlRef:e,getValue:r,id:t,name:i,value:n})},[e,s,r,t,i,c,f,n]),z(()=>{const l=f.current;return()=>{c(l,void 0)}},[c,f])}const Tr=o.createContext({controlId:void 0,registerControlId:te,resetControlId:te,labelId:void 0,setLabelId:te,messageIds:[],setMessageIds:te,getDescriptionProps:e=>e});function on(){return o.useContext(Tr)}function sn(e={}){const{id:t,enabled:n=!0}=e,{controlId:r,registerControlId:s,resetControlId:i}=on(),c=qn(),f=He(()=>Symbol()),l=o.useRef(!1),C=o.useRef(!1),R=Y(()=>{!l.current||s===te||(l.current=!1,s(f.current,void 0))});return z(()=>{if(!n||s===te){R();return}let x;if(t!==void 0)C.current=!0,x=t;else if(C.current)x=c;else{i();return}if(x===void 0){R();return}l.current=!0,s(f.current,x)},[t,n,s,i,c,f,R]),z(()=>R,[R]),(n?r:void 0)??t??c}function Mr(e,t,n=Object.is){const{length:r}=e;if(r!==t.length)return!1;for(let s=0;s<r;s+=1)if(!n(e[s],t[s]))return!1;return!0}const ln=(e,t)=>Object.is(e,t);function Oe(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Pr(e,t,n){return Array.isArray(e)&&Array.isArray(t)?!Mr(e,t,(r,s)=>Oe(r,s,n)):e!==t}function yt(e,t,n){return e?e.some(r=>r===void 0?!1:Oe(t,r,n)):!1}function ot(e,t,n){return e?e.findIndex(r=>r===void 0?!1:Oe(r,t,n)):-1}function Ar(e,t){if(t!==ln)return r=>yt(e,r,t);const n=new Set(e);return n.delete(void 0),r=>n.has(r)&&(r!==0||e.some(s=>Object.is(r,s)))}function cn(e,t,n,r){const s=r&&Array.isArray(t)?e.findIndex(Ar(t,n)):ot(e,t,n);return s===-1?null:s}function Or(e,t,n,r,s,i){return yt(r,t,s)?i!=null&&e>i&&yt(r,n[i],s)?i:e:e===i?cn(n,r,s,!0):i}function Fr(e,t,n){return e.filter(r=>!Oe(t,r,n))}function It(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function Vr(e){return typeof e=="object"&&e!=null&&Array.isArray(e.items)}function un(e){return Vr(e?.[0])}function Lr(e){return un(e)?e.flatMap(t=>t.items):e}function Dr(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(un(t)){for(const n of t)for(const r of n.items)if(r&&r.value==null&&r.label!=null)return!0;return!1}for(const n of t)if(n&&n.value==null&&n.label!=null)return!0;return!1}function an(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return It(e)}function De(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?It(e.value):It(e)}function fn(e,t,n){function r(){return an(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return(Object.hasOwn(t,e)?t[e]:void 0)??r();if(Array.isArray(t)){const i=Lr(t);if(e==null||typeof e!="object"){const c=i.find(f=>f.value===e);return c&&c.label!=null?c.label:r()}if("value"in e){const c=i.find(f=>f&&f.value===e.value);if(c&&c.label!=null)return c.label}}return r()}function Hr(e,t,n){return e.reduce((r,s,i)=>(i>0&&r.push(", "),r.push(ae.jsx(o.Fragment,{children:fn(s,t,n)},i)),r),[])}const Nr={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{const{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:De(t,r)!==""},hasNullItemLabel:(e,t)=>t?Dr(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{const n=e.isItemEqualToValue,r=e.value;return e.multiple?Array.isArray(r)&&r.some(s=>Oe(t,s,n)):Oe(t,r,n)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows},kr=o.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:te,validationMode:"onSubmit",submitCountRef:{current:0}});function Ur(){return o.useContext(kr)}const Ce=1;function dn(e,t){return Math.max(0,e-t)}function Br(e,t){if(t<=0)return 0;const n=ze(e,0,t),r=n,s=t-n,i=r<=Ce,c=s<=Ce;return i&&c?r<=s?0:t:i?0:c?t:n}function mo(e){const{id:t,value:n,defaultValue:r=null,onValueChange:s,open:i,defaultOpen:c=!1,onOpenChange:f,name:l,form:C,autoComplete:R,disabled:x=!1,readOnly:T=!1,required:d=!1,modal:F=!0,actionsRef:A,inputRef:E,onOpenChangeComplete:y,items:$,multiple:V=!1,itemToStringLabel:g,itemToStringValue:m,isItemEqualToValue:O=ln,highlightItemOnHover:p=!0,children:S}=e,{clearErrors:k}=Ur(),{setDirty:D,setTouched:G,setFocused:K,validityData:h,setFilled:L,name:q,disabled:J,validation:W,validationMode:v}=wt(),U=sn({id:t}),a=J||x,I=q??l,[M,P]=Ut({controlled:n,default:V?r??Rt:r,name:"Select",state:"value"}),[H,X]=Ut({controlled:i,default:c,name:"Select",state:"open"}),ne=o.useRef([]),re=o.useRef([]),se=o.useRef(null),le=o.useRef(null),oe=o.useRef(0),fe=o.useRef(null),B=o.useRef([]),j=o.useRef(!1),ce=o.useRef(null),Z=o.useRef(null),pe=o.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),xe=o.useRef(!1),de=o.useRef(M),{mounted:ue,setMounted:ge,transitionStatus:Se}=Qt(H),{openMethod:ee,triggerProps:we}=Zn(H),u=He(()=>new An({id:U,labelId:void 0,modal:F,multiple:V,itemToStringLabel:g,itemToStringValue:m,isItemEqualToValue:O,value:M,open:H,mounted:ue,transitionStatus:Se,items:$,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:nt,triggerProps:nt,triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1},{setValue:te,setOpen:te,handleScrollArrowVisibility:te,onOpenChangeComplete:te,listRef:ne,popupRef:se,scrollHandlerRef:le,scrollArrowsMountedCountRef:oe,valueRef:fe,valuesRef:B,labelsRef:re,typingRef:j,selectionRef:pe,firstItemTextRef:ce,selectedItemTextRef:Z,alignItemWithTriggerActiveRef:xe,initialValueRef:de},Nr)).current,b=u.useState("activeIndex"),Q=u.useState("selectedIndex"),w=u.useState("triggerElement"),N=u.useState("positionerElement"),Te=mr(ee),Me=ee??Te,be=o.useMemo(()=>V?"":De(M,m),[V,M,m]),Re=o.useMemo(()=>V&&Array.isArray(M)?M.map(_=>De(_,m)):De(M,m),[V,M,m]),Ue=Ae(w),Be=Y(()=>Re);wr(Ue,U,M,Be,!a,l);const _e=V?Array.isArray(M)&&M.length>0:M!=null&&be!=="";z(()=>{L(_e)},[_e,L]),z(function(){const ie=cn(B.current,M,O,V);ie===null&&(Z.current=null),!H&&u.set("selectedIndex",ie)},[V,H,M,O,u]),Qn(M,()=>{k(I),D(Pr(M,h.initialValue,O)),W.change(M)});const je=Y((_,ie)=>{f?.(_,ie),!ie.isCanceled&&(X(_),!_&&(ie.reason===Kt||ie.reason===On)&&(G(!0),K(!1),v==="onBlur"&&W.commit(M)))}),Ve=Y(()=>{ge(!1),u.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),y?.(!1)});Et({enabled:!A,open:H,ref:se,onComplete(){H||Ve()}}),o.useImperativeHandle(A,()=>({unmount:Ve}),[Ve]);const We=Y((_,ie)=>{s?.(_,ie),!ie.isCanceled&&P(_)}),at=Y(_=>{const ie=dn(_.scrollHeight,_.clientHeight),$e=Br(_.scrollTop,ie),ft=$e>0,qe=$e<ie;u.set("scrollUpArrowVisible",ft),u.set("scrollDownArrowVisible",qe)}),Pe=ur({open:H,onOpenChange:je,elements:{reference:w,floating:N}}),me=er(Pe,{enabled:!a,event:"mousedown"}),ye=zn(Pe),Ee=pr(Pe,{enabled:!a,listRef:ne,activeIndex:b,selectedIndex:Q,disabledIndices:Rt,onNavigate(_){_===null&&!H||u.set("activeIndex",_)},focusItemOnHover:p}),Le=gr(Pe,{enabled:!a&&(H||!T&&!V),listRef:re,activeIndex:b,selectedIndex:Q,disabledIndices:_=>xr(ne.current[_]),onMatch(_){H?u.set("activeIndex",_):We(B.current[_],he(st))},onTyping(_){j.current=_}}),Mt=o.useMemo(()=>bt(Le.reference,Ee.reference,ye.reference,me.reference,we),[me.reference,Le.reference,Ee.reference,ye.reference,we]),Pt=o.useMemo(()=>bt(Kn,Le.floating,Ee.floating,ye.floating),[Le.floating,Ee.floating,ye.floating]),At=Ee.item??nt;u.useContextCallback("setValue",We),u.useContextCallback("setOpen",je),u.useContextCallback("handleScrollArrowVisibility",at),u.useContextCallback("onOpenChangeComplete",y),hr(()=>{u.update({popupProps:Pt,triggerProps:Mt})}),u.useSyncedValues({id:U,modal:F,multiple:V,value:M,open:H,mounted:ue,transitionStatus:Se,popupProps:Pt,triggerProps:Mt,items:$,itemToStringLabel:g,itemToStringValue:m,isItemEqualToValue:O,openMethod:Me});const xn=o.useMemo(()=>({disabled:a,readOnly:T,required:d,multiple:V,highlightItemOnHover:p,itemProps:At}),[a,T,d,V,p,At]),Sn=Tn(E,W.inputRef),Ot=V?void 0:I,Rn=o.useMemo(()=>!V||!Array.isArray(M)||!I?null:M.map(_=>{const ie=De(_,m);return ae.jsx("input",{type:"hidden",form:C,name:I,value:ie,disabled:a},ie)}),[V,M,C,I,m,a]);return ae.jsxs(en.Provider,{value:u,children:[ae.jsx(tn.Provider,{value:xn,children:ae.jsx(nn.Provider,{value:Pe,children:S})}),ae.jsx("input",{...W.getValidationProps(a,{onFocus(){u.state.triggerElement?.focus({focusVisible:!0})},onChange(_){if(_.nativeEvent.defaultPrevented||a||T)return;const ie=_.currentTarget.value,$e=he(st,_.nativeEvent);function ft(){if(V)return;const qe=ie.toLowerCase();let dt=B.current.findIndex(pt=>De(pt,m).toLowerCase()===qe||an(pt,g).toLowerCase()===qe);dt===-1&&(dt=B.current.findIndex((pt,bn)=>{const Vt=re.current[bn];return Vt!=null&&Vt.toLowerCase()===qe}));const Ft=B.current[dt];Ft!=null&&We(Ft,$e)}u.set("forceMount",!0),queueMicrotask(ft)}}),id:U&&Ot==null?`${U}-hidden-input`:void 0,form:C,name:Ot,autoComplete:R,value:be,disabled:a,required:d&&!(V&&_e),readOnly:T,ref:Sn,style:I?Mn:Pn,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Rn]})}function _r(e,t){return e??t}const Je=5;function jr(e,t){const n=Wr(t);return e.clientX>=n.left-Je&&e.clientX<=n.right+Je&&e.clientY>=n.top-Je&&e.clientY<=n.bottom+Je}function Wr(e){const t=e.getBoundingClientRect(),n=rt(e);if(Fn)return t;const r=n.getComputedStyle(e,"::before"),s=n.getComputedStyle(e,"::after");if(!(r.content!=="none"||s.content!=="none"))return t;const c=parseFloat(r.width)||0,f=parseFloat(r.height)||0,l=parseFloat(s.width)||0,C=parseFloat(s.height)||0,R=Math.max(t.width,c,l),x=Math.max(t.height,f,C),T=R-t.width,d=x-t.height;return{left:t.left-T/2,right:t.right+T/2,top:t.top-d/2,bottom:t.bottom+d/2}}const qr="data-popup-side",zr=400,Kr={...Yn,...Cr,popupSide:e=>e?{[qr]:e}:null,value:()=>null},ho=o.forwardRef(function(t,n){const{render:r,className:s,id:i,disabled:c=!1,nativeButton:f=!0,style:l,...C}=t,{setTouched:R,setFocused:x,validationMode:T,validation:d,state:F,disabled:A}=wt(),{labelId:E}=on(),y=Fe(),{readOnly:$,required:V,disabled:g}=vt(),m=A||g||c,O=y.useState("open"),p=y.useState("mounted"),S=y.useState("value"),k=y.useState("triggerProps"),D=y.useState("positionerElement"),G=y.useState("listElement"),K=y.useState("popupSide"),h=y.useState("id"),L=y.useState("labelId"),q=y.useState("hasSelectedValue"),J=p&&D?K:null,W=i??h,v=_r(E,L);sn({id:i});const U=Ae(D),a=o.useRef(null),{getButtonProps:I,buttonRef:M}=Gt({disabled:m,native:f}),P=y.useStateSetter("triggerElement"),H=tt(),X=tt(),ne=tt();o.useEffect(()=>{if(O)return ne.start(zr,()=>{y.context.selectionRef.current.allowUnselectedMouseUp=!0,y.context.selectionRef.current.allowSelectedMouseUp=!0}),()=>{ne.clear()};y.context.selectionRef.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},X.clear()},[O,y,X,ne]);const re=bt(k,{id:W,role:"combobox","aria-expanded":O,"aria-haspopup":"listbox","aria-controls":O?G?.id??zt(D)?.id:void 0,"aria-labelledby":v,"aria-readonly":$||void 0,"aria-required":V||void 0,tabIndex:m?-1:0,onFocus(oe){x(!0),O&&y.context.alignItemWithTriggerActiveRef.current&&y.context.setOpen(!1,he(st,oe.nativeEvent)),H.start(0,()=>{y.set("forceMount",!0)})},onBlur(oe){ve(D,oe.relatedTarget)||(R(!0),x(!1),T==="onBlur"&&d.commit(S))},onMouseDown(oe){if(O)return;const fe=Ye(oe.currentTarget);function B(j){if(!a.current)return;const ce=j.target;ve(a.current,ce)||ve(U.current,ce)||jr(j,a.current)||y.context.setOpen(!1,he(Vn,j))}X.start(0,()=>{fe.addEventListener("mouseup",B,{once:!0})})}},C,I),se=d.getValidationProps(m,re);se.role="combobox";const le={...F,open:O,disabled:m,value:S,readOnly:$,popupSide:J,placeholder:!q};return ke("button",t,{ref:[n,a,M,P],state:le,stateAttributesMapping:Kr,props:se})}),Yr={value:()=>null},xo=o.forwardRef(function(t,n){const{className:r,render:s,children:i,placeholder:c,style:f,...l}=t,C=Fe(),R=C.useState("value"),x=C.useState("items"),T=C.useState("itemToStringLabel"),d=C.useState("hasSelectedValue"),F=!d&&c!=null&&i==null,A=C.useState("hasNullItemLabel",F),E={value:R,placeholder:!d};let y=null;return typeof i=="function"?y=i(R):i!=null?y=i:F&&!A?y=c:Array.isArray(R)?y=Hr(R,x,T):y=fn(R,x,T),ke("span",t,{state:E,ref:[n,C.context.valueRef],props:[{children:y},l],stateAttributesMapping:Yr})}),So=o.forwardRef(function(t,n){const r=Fe(),s=r.useState("mounted"),i=r.useState("forceMount");return s||i?ae.jsx(Ln,{ref:n,...t}):null}),pn=o.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function $r(){return o.useContext(pn)}function Gr(e){const{children:t,elementsRef:n,labelsRef:r,onMapChange:s}=e,i=Y(s),[,c]=o.useState(!1),f=He(Jr).current,l=He(Xr).current,C=o.useRef(0),R=o.useRef(!0),x=o.useRef(null),T=o.useRef(null),d=Y(()=>{R.current||(R.current=!0,c(m=>!m))}),F=Y((m,O)=>{l.set(m,O),d()}),A=Y(m=>{l.delete(m),d()}),E=Y(m=>{const O=new Map;return n.current.length=0,r&&(r.current.length=0),m.forEach(p=>{O.set(p.element,{...p.registration.metadata??{},index:p.index}),n.current[p.index]=p.element,r&&(r.current[p.index]=p.registration.label!==void 0?p.registration.label:p.registration.textRef?.current?.textContent??p.element.textContent)}),C.current=n.current.length,O});function y(m){if(T.current?.disconnect(),T.current=null,typeof MutationObserver!="function"||m.length<2)return;const O=new MutationObserver(S=>{if(!eo(S))return;let k=null;for(const D of m)if(D.isConnected){if(k&&gn(k,D)>0){O.disconnect(),d();return}k=D}});T.current=O;const p=new Set;for(let S=1;S<m.length;S+=1){const k=Qr(m[S-1],m[S]);k&&p.add(k)}p.forEach(S=>O.observe(S,{childList:!0}))}const $=Y(()=>{const[m,O]=Zr(l),p=E(m),S=x.current,k=!S||S.length!==m.length||m.some((D,G)=>{const K=S[G];return D.index!==K.index||D.element!==K.element||D.registration.index!==K.registration.index||D.registration.metadata!==K.registration.metadata});y(O),x.current=m,R.current=!1,k&&(f.forEach(D=>D(p)),i(p))});z(()=>(!R.current&&x.current&&E(x.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,E]),z(()=>{R.current&&$()}),z(()=>()=>{T.current?.disconnect(),R.current=!0},[]);const V=Y(m=>(f.add(m),()=>{f.delete(m)})),g=o.useMemo(()=>({register:F,unregister:A,subscribeMapChange:V,nextIndexRef:C}),[F,A,V,C]);return ae.jsx(pn.Provider,{value:g,children:t})}function Xr(){return new Map}function Jr(){return new Set}function Zr(e){const t=new Set,n=[],r=[];e.forEach((i,c)=>{if(!c.isConnected)return;const f=i.index,l={index:f??-1,element:c,registration:i};f===null?r.push(l):f>=0&&(t.add(f),n.push(l))});let s=0;return r.sort((i,c)=>gn(i.element,c.element)),r.forEach(i=>{for(;t.has(s);)s+=1;i.index=s,n.push(i),s+=1}),t.size>0&&n.sort((i,c)=>i.index-c.index),[n,r.map(i=>i.element)]}function Qr(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function eo(e){for(const t of e)for(let n=0;n<t.removedNodes.length;n+=1)if(t.removedNodes[n].isConnected)return!0;return!1}function gn(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}const mn=o.createContext(void 0);function to(){const e=o.useContext(mn);if(!e)throw new Error(Ne(59));return e}function it(e,t){e&&Object.assign(e.style,t)}const no={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},ro={position:"fixed"},Ro=o.forwardRef(function(t,n){const{anchor:r,className:s,render:i,positionMethod:c,side:f,align:l,sideOffset:C,alignOffset:R,collisionBoundary:x="clipping-ancestors",collisionPadding:T,arrowPadding:d,sticky:F,disableAnchorTracking:A,alignItemWithTrigger:E=!0,collisionAvoidance:y=Dn,style:$,...V}=t,g=Fe(),m=rn(),O=g.useState("open"),p=g.useState("mounted"),S=g.useState("modal"),k=g.useState("value"),D=g.useState("openMethod"),G=g.useState("positionerElement"),K=g.useState("triggerElement"),h=g.useState("isItemEqualToValue"),L=g.useState("transitionStatus"),q=o.useRef(null),J=o.useRef(null),[W,v]=o.useState(E),U=p&&W&&D!=="touch";!p&&W!==E&&v(E),o.useImperativeHandle(g.context.alignItemWithTriggerActiveRef,()=>U),tr((U||S)&&O,D==="touch",G,K);const a=nr({anchor:r,floatingRootContext:m,positionMethod:c,mounted:p,side:f,sideOffset:C,align:l,alignOffset:R,arrowPadding:d,collisionBoundary:x,collisionPadding:T,sticky:F,disableAnchorTracking:A??U,collisionAvoidance:y,keepMounted:!0}),I=U?"none":a.side,M=U?ro:a.positionerStyles,P={open:O,side:I,align:a.align,anchorHidden:a.anchorHidden};z(()=>{g.set("popupSide",a.side)},[g,a.side]);const H=g.useStateSetter("positionerElement"),X=rr(t,P,{styles:M,transitionStatus:L,props:V,refs:[n,H],hidden:!p,inert:!O}),ne=o.useRef(0),re=Y(le=>{if(g.context.valuesRef.current.length===0)return;const oe=ne.current;ne.current=le.size;const fe=he(st);if(oe!==0&&!g.state.multiple&&k!==null&&ot(g.context.valuesRef.current,k,h)===-1){const j=g.context.initialValueRef.current,Z=j!=null&&ot(g.context.valuesRef.current,j,h)!==-1?j:null;g.context.setValue(Z,fe),Z===null&&(g.set("selectedIndex",null),g.context.selectedItemTextRef.current=null)}if(oe!==0&&g.state.multiple&&Array.isArray(k)){const B=k.filter(j=>ot(g.context.valuesRef.current,j,h)!==-1);B.length!==k.length&&(g.context.setValue(B,fe),B.length===0&&(g.set("selectedIndex",null),g.context.selectedItemTextRef.current=null))}if(O&&U){g.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const B={height:""};it(G,B),it(g.context.popupRef.current,B)}}),se=o.useMemo(()=>({...a,side:I,alignItemWithTriggerActive:U,setControlledAlignItemWithTrigger:v,scrollUpArrowRef:q,scrollDownArrowRef:J}),[a,I,U,v]);return ae.jsx(Gr,{elementsRef:g.context.listRef,labelsRef:g.context.labelsRef,onMapChange:re,children:ae.jsxs(mn.Provider,{value:se,children:[p&&S&&ae.jsx($n,{inert:Hn(!O),cutout:K}),X]})})}),Ze="base-ui-disable-scrollbar",Bt={className:Ze,getElement(e){return ae.jsx("style",{nonce:e,href:Ze,precedence:"base-ui:low",children:`.${Ze}{scrollbar-width:none}.${Ze}::-webkit-scrollbar{display:none}`})}},oo=o.createContext(void 0),so={disableStyleElements:!1};function io(){return o.useContext(oo)??so}const _t="--transform-origin",lo={...Xn,...Xt},bo=o.forwardRef(function(t,n){const{render:r,className:s,style:i,finalFocus:c,...f}=t,l=Fe(),{multiple:C,readOnly:R,highlightItemOnHover:x}=vt(),T=rn(),{side:d,align:F,alignItemWithTriggerActive:A,isPositioned:E,setControlledAlignItemWithTrigger:y}=to(),$=or()!=null,V=sr(),{nonce:g,disableStyleElements:m}=io(),O=l.useState("id"),p=l.useState("open"),S=l.useState("openMethod"),k=l.useState("mounted"),D=l.useState("popupProps"),G=l.useState("transitionStatus"),K=l.useState("triggerElement"),h=l.useState("positionerElement"),L=l.useState("listElement"),q=o.useRef(!1),J=o.useRef(!1),W=o.useRef({}),v=St(),U=Y(P=>{if(!h||!l.context.popupRef.current||!J.current)return;const H=h.style.top==="0px",X=h.style.bottom==="0px";if(q.current||!A||!H&&!X){l.context.handleScrollArrowVisibility(P);return}const ne=Wt(h),re=Ke(h.getBoundingClientRect().height,"y",ne),se=Ye(h),le=rt(h),oe=le.getComputedStyle(h),fe=parseFloat(oe.marginTop),B=parseFloat(oe.marginBottom),j=jt(le.getComputedStyle(l.context.popupRef.current)),ce=Math.min(se.documentElement.clientHeight-fe-B,j),Z=P.scrollTop,pe=Qe(P);let xe=null;const de=ee=>{h.style.height=`${ee}px`},ue=H?pe-Z:Z,ge=Math.min(re+ue,ce);if(ue<=Ce){const ee=ze(ue,0,ce-re);ee>0&&de(re+ee),P.scrollTop=H?pe:0,ce-(re+ee)<=Ce&&(q.current=!0),l.context.handleScrollArrowVisibility(P);return}if(ce-ge>Ce)xe=H?1/0:0;else if(X&&Z<pe){const ee=re+ue-ce;xe=Z-(ue-ee)}const Se=Math.ceil(ge);if(Se!==0&&de(Se),xe!=null){const ee=ze(xe,0,Qe(P));Math.abs(P.scrollTop-ee)>Ce&&(P.scrollTop=ee)}Se>=ce-Ce&&(q.current=!0),l.context.handleScrollArrowVisibility(P)});o.useImperativeHandle(l.context.scrollHandlerRef,()=>U,[U]),Et({open:p,ref:l.context.popupRef,onComplete(){p&&l.context.onOpenChangeComplete(!0)}});const a={open:p,transitionStatus:G,side:d,align:F};z(()=>{!h||!l.context.popupRef.current||Object.keys(W.current).length||(W.current={top:h.style.top||"0",left:h.style.left||"0",right:h.style.right,height:h.style.height,bottom:h.style.bottom,minHeight:h.style.minHeight,maxHeight:h.style.maxHeight,marginTop:h.style.marginTop,marginBottom:h.style.marginBottom})},[l,h]),z(()=>{p||A||(J.current=!1,q.current=!1,it(h,W.current))},[p,A,h]),z(()=>{const P=l.context.popupRef.current;if(!p||!K||!h||!P||A&&!E||l.state.transitionStatus==="ending")return;if(J.current=!0,P.style.removeProperty(_t),!A){v.request(()=>l.context.handleScrollArrowVisibility(L||P));return}const H=co(P);try{let X=l.context.selectedItemTextRef.current;X?.isConnected||(X=!l.select("hasSelectedValue")&&l.context.firstItemTextRef.current?.isConnected?l.context.firstItemTextRef.current:null);const ne=l.context.valueRef.current,re=rt(h),se=re.getComputedStyle(h),le=re.getComputedStyle(P),oe=Ye(K),fe=Wt(K),B=et(K.getBoundingClientRect(),fe),j=et(h.getBoundingClientRect(),fe),ce=B.height,Z=L||P,pe=Z.scrollHeight,xe=parseFloat(le.borderBottomWidth),de=parseFloat(se.marginTop)||10,ue=parseFloat(se.marginBottom)||10,ge=parseFloat(se.minHeight)||100,Se=jt(le),ee=5,we=5,u=20,b=oe.documentElement.clientHeight-de-ue,Q=oe.documentElement.clientWidth,w=b-B.bottom+ce;let N,Te=V==="rtl"?B.right-j.width:B.left,Me=0;if(X&&ne){const me=et(ne.getBoundingClientRect(),fe);N=et(X.getBoundingClientRect(),fe),Te=j.left+(V==="rtl"?me.right-N.right:me.left-N.left);const ye=me.top-B.top+me.height/2;Me=N.top-j.top+N.height/2-ye}const be=w+Me+ue+xe;let Re=Math.min(b,be);const Ue=b-de-ue,Be=be-Re,_e=Q-we;h.style.left=`${ze(Te,ee,_e-j.width)}px`,h.style.height=`${Re}px`,h.style.maxHeight="none",h.style.marginTop=`${de}px`,h.style.marginBottom=`${ue}px`,P.style.height="100%";const je=Qe(Z),Ve=Be>=je-Ce;Ve&&(Re=Math.min(b,j.height)-(Be-je));const We=B.top<u||B.bottom>b-u||Math.ceil(Re)+Ce<Math.min(pe,ge),at=(re.visualViewport?.scale??1)!==1&&Yt;if(We||at){it(h,W.current),y(!1);return}const Pe=Math.max(ge,Re);if(Ve){const me=Math.max(0,b-be);h.style.top=j.height>=Ue?"0":`${me}px`,h.style.height=`${Re}px`,Z.scrollTop=Qe(Z)}else h.style.bottom="0",Z.scrollTop=Be;if(N){const me=j.top,ye=j.height,Ee=N.top+N.height/2,Le=ze(ye>0?(Ee-me)/ye*100:50,0,100);P.style.setProperty(_t,`50% ${Le}%`)}(Pe===b||Re>=Se)&&(q.current=!0),l.context.handleScrollArrowVisibility(Z),x&&l.state.selectedIndex===null&&l.state.activeIndex===null&&l.context.listRef.current[0]!=null&&l.set("activeIndex",0)}finally{H()}},[l,p,h,K,A,y,v,L,x,V,E]),o.useEffect(()=>{if(!A||!h||!p)return;const P=rt(h);function H(X){l.context.setOpen(!1,he(kn,X))}return Nn(P,"resize",H)},[l,A,h,p]);const I={...L?{role:"presentation"}:{role:"listbox","aria-multiselectable":C||void 0,"aria-readonly":R||void 0,id:`${O}-list`},onKeyDown(P){$&&Jn.has(P.key)&&P.stopPropagation()},onScroll(P){L||U(P.currentTarget)},...A&&{style:L?{height:"100%"}:no},className:!L&&A?Bt.className:void 0},M=ke("div",t,{ref:[n,l.context.popupRef],state:a,stateAttributesMapping:lo,props:[D,I,cr(G),f]});return ae.jsxs(o.Fragment,{children:[!m&&Bt.getElement(g),ae.jsx(Gn,{context:T,modal:!1,disabled:!k,openInteractionType:S,returnFocus:c,restoreFocus:!0,children:M})]})});function jt(e){const t=e.maxHeight;return t.endsWith("px")&&parseFloat(t)||1/0}function Qe(e){return dn(e.scrollHeight,e.clientHeight)}function Wt(e){return ir.getScale(e)}function Ke(e,t,n){return e/n[t]}function et(e,t){return lr({x:Ke(e.x,"x",t),y:Ke(e.y,"y",t),width:Ke(e.width,"x",t),height:Ke(e.height,"y",t)})}const qt=[["transform","none"],["scale","1"],["translate","0 0"]];function co(e){const{style:t}=e,n={};for(const[r,s]of qt)n[r]=t.getPropertyValue(r),t.setProperty(r,s,"important");return()=>{for(const[r]of qt){const s=n[r];s?t.setProperty(r,s):t.removeProperty(r)}}}function uo(e={}){const{guess:t,label:n,metadata:r,textRef:s,index:i}=e,{register:c,unregister:f,subscribeMapChange:l,nextIndexRef:C}=$r(),R=o.useRef(-1),[x,T]=o.useState(i==null&&t?()=>{if(R.current===-1){const E=C.current;C.current+=1,R.current=E}return R.current}:-1),d=i??x,F=o.useRef(null),A=o.useCallback(E=>{const y=F.current;y&&f(y),F.current=E,E&&c(E,{metadata:r??null,index:i??null,label:n,textRef:s})},[i,c,f,r,n,s]);return z(()=>{if(i==null)return l(E=>{const y=F.current?E.get(F.current)?.index:null;y!=null&&T(y)})},[i,l]),{ref:A,index:d}}const hn=o.createContext(void 0);function Tt(){const e=o.useContext(hn);if(!e)throw new Error(Ne(57));return e}const yo=o.memo(o.forwardRef(function(t,n){const{render:r,className:s,style:i,value:c=null,label:f,disabled:l=!1,nativeButton:C=!1,...R}=t,x=o.useRef(null),T=uo({guess:!0,label:f,textRef:x}),d=Fe(),{itemProps:F,multiple:A,disabled:E,readOnly:y}=vt(),$=E||l,V=d.useState("isActive",T.index),g=d.useState("open"),m=d.useState("isSelected",c),O=d.useState("isSelectedByFocus",T.index),p=d.useState("isItemEqualToValue"),S=T.index,k=o.useRef(null);z(()=>{const a=d.context.valuesRef.current;return a[S]=c,()=>{delete a[S]}},[S,c,d]),z(()=>{const a=d.state.value,I=d.state.selectedIndex;let M=I,P;A&&Array.isArray(a)?(M=Or(S,c,d.context.valuesRef.current,a,p,I),P=M===S,S===I&&!P&&(d.context.selectedItemTextRef.current=null)):(P=a!==void 0&&Oe(c,a,p),P&&(M=S)),d.set("selectedIndex",M),P&&x.current&&(d.context.selectedItemTextRef.current=x.current)},[S,A,p,d,c]);const D=o.useRef("mouse"),G=o.useRef(!1),{getButtonProps:K,buttonRef:h}=Gt({disabled:$,focusableWhenDisabled:!0,native:C,composite:!0}),L={disabled:$,selected:m,highlighted:V};function q(a){if(E||y)return;const I=d.state.value;if(A){const M=Array.isArray(I)?I:[],P=m?Fr(M,c,p):[...M,c];d.context.setValue(P,he(ht,a))}else d.context.setValue(c,he(ht,a)),d.context.setOpen(!1,he(ht,a))}function J(){d.context.selectionRef.current.dragY=0}const W={role:"option","aria-selected":m,tabIndex:g&&V?0:-1,onKeyDown(a){d.set("activeIndex",S),a.key===" "&&d.context.typingRef.current&&a.preventDefault()},onClick(a){const I=D.current!=="touch",M=a.nativeEvent.pointerType,P=I&&Zt(a.nativeEvent)&&(M!==void 0||V),H=I&&!P&&!G.current;G.current=!1,!($||H)&&q(a.nativeEvent)},onPointerEnter(a){D.current=a.pointerType},onPointerMove(a){if(a.pointerType==="mouse"&&a.buttons===1){const I=d.context.selectionRef.current;I.dragY+=a.movementY,I.dragY**2>=64&&(I.allowUnselectedMouseUp=!0)}},onPointerDown(a){D.current=a.pointerType,G.current=!0,J()},onMouseUp(){if(J(),$||D.current==="touch"||G.current)return;const a=!d.context.selectionRef.current.allowSelectedMouseUp&&m,I=!d.context.selectionRef.current.allowUnselectedMouseUp&&!m;a||I||(G.current=!0,k.current?.click(),G.current=!1)}},v=ke("div",t,{ref:[h,n,T.ref,k],state:L,props:[F,W,R,K]}),U=o.useMemo(()=>({selected:m,index:S,textRef:x,selectedByFocus:O}),[m,S,x,O]);return ae.jsx(hn.Provider,{value:U,children:v})})),Io=o.forwardRef(function(t,n){const{selected:r}=Tt();return t.keepMounted||r?ae.jsx(ao,{...t,ref:n}):null}),ao=o.memo(o.forwardRef((e,t)=>{const{render:n,className:r,style:s,keepMounted:i,...c}=e,{selected:f}=Tt(),l=o.useRef(null),{transitionStatus:C,setMounted:R}=Qt(f),T=ke("span",e,{ref:[t,l],state:{selected:f,transitionStatus:C},props:[{"aria-hidden":!0,children:"✔️"},c],stateAttributesMapping:Xt});return Et({batch:!0,enabled:!f,open:f,ref:l,onComplete(){f||R(!1)}}),T})),Co=o.memo(o.forwardRef(function(t,n){const{index:r,textRef:s,selectedByFocus:i}=Tt(),c=Fe(),{render:f,className:l,style:C,...R}=t,x=o.useCallback(d=>{d&&(r===0&&(c.context.firstItemTextRef.current=d),i&&(c.context.selectedItemTextRef.current=d))},[c,r,i]);return ke("div",t,{ref:[x,n,s],props:R})}));export{no as L,mo as S,vt as a,to as b,ho as c,xo as d,So as e,Ro as f,bo as g,yo as h,Io as i,Co as j,Cr as k,Ur as l,wt as m,on as n,sn as o,Ut as p,wr as q,Bt as s,Fe as u};
|
|
1
|
+
import{bW as yn,bb as He,ax as z,bg as In,bZ as zt,bX as Cn,r as o,bf as Y,bB as St,ci as Lt,cj as gt,ck as Dt,c0 as mt,bh as Ye,aO as ve,w as he,cl as Ht,bA as Nt,cm as Ge,aN as En,bq as Kt,c2 as Yt,cn as lt,co as ct,cp as $t,cq as Ct,be as tt,c7 as vn,cr as wn,cs as Rt,ay as Ne,b9 as te,E as nt,j as ae,aG as Et,aA as bt,az as Tn,aD as Mn,aE as Pn,aF as st,aP as An,c1 as On,aC as rt,bU as Fn,t as Gt,v as ke,ct as Vn,aL as Ln,cu as Dn,aM as Hn,bj as Nn,cv as kn,aH as Xt,cw as ht}from"./__vite-browser-external-oFHfLR8i.js";import{r as Jt,F as Un,P as Bn,v as Ae,q as _n,E as jn,G as Ie,H as Zt,D as Wn,u as qn,a as Qt,f as zn,e as Kn,z as Yn,I as $n,d as Gn,b as Xn,C as Jn}from"./composite-Bl68G4Qr.js";import{h as Zn,u as Qn,a as er,d as tr,c as nr,e as rr,f as or,i as sr,p as ir,r as lr,g as cr}from"./ToolbarRootContext-CPEvPTvc.js";function ze(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}function ur(e){const{open:t=!1,onOpenChange:n,elements:r={}}=e,s=yn(),i=Jt()!=null,c=He(()=>new Un({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new Bn,floatingId:s,syncOnly:!1,nested:i})).current;return z(()=>{const f={open:t,floatingId:s};r.reference!==void 0&&(f.referenceElement=r.reference,f.domReferenceElement=In(r.reference)?r.reference:null),r.floating!==void 0&&(f.floatingElement=r.floating),c.update(f)},[t,s,r.reference,r.floating,c]),c.context.onOpenChange=n,c.context.nested=i,c}const ar="Escape";function kt(e){return Yt&&e.movementX===0&&e.movementY===0}function ut(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Xe(e,t){return ut(t,e===$t||e===Ct,e===lt||e===ct)}function xt(e,t,n){return ut(t,e===Ct,n?e===lt:e===ct)||e==="Enter"||e===" "||e===""}function fr(e,t,n){return ut(t,n?e===lt:e===ct,e===Ct)}function dr(e,t,n,r){const s=n?e===ct:e===lt,i=e===$t;return t==="both"||t==="horizontal"&&r?e===ar:ut(t,s,i)}function pr(e,t){const{listRef:n,activeIndex:r,onNavigate:s=()=>{},enabled:i=!0,selectedIndex:c=null,allowEscape:f=!1,loopFocus:l=!1,nested:C=!1,rtl:R=!1,virtual:x=!1,focusItemOnOpen:T="auto",focusItemOnHover:d=!0,openOnArrowKeyDown:F=!0,disabledIndices:A=void 0,orientation:E="vertical",parentOrientation:y,id:$,resetOnPointerLeave:V=!0,externalTree:g,grid:m}=t,O=m!=null,p="rootStore"in e?e.rootStore:e,S=p.useState("open"),k=p.useState("floatingElement"),D=p.useState("domReferenceElement"),G=p.context.dataRef,K=zt(k),h=Cn(D),L=Ae(K),q=Jt(),J=_n(g),W=o.useRef(T),v=o.useRef(c??-1),U=o.useRef(null),a=o.useRef(!0),I=Y(u=>{s(v.current===-1?null:v.current,u)}),M=o.useRef(!!k),P=o.useRef(S),H=o.useRef(!1),X=o.useRef(!1),ne=o.useRef(null),re=Ae(A),se=Ae(S),le=Ae(c),oe=Ae(V),fe=St(),B=St(),j=Y(()=>{function u(N){x?J?.events.emit("virtualfocus",N):ne.current=jn(N,{sync:H.current,preventScroll:!0})}const b=n.current[v.current],Q=X.current;b&&u(b),(H.current?N=>N():N=>fe.request(N))(()=>{const N=n.current[v.current]||b;if(!N)return;b||u(N),ue&&(Q||!a.current)&&N.scrollIntoView?.({block:"nearest",inline:"nearest"})})});z(()=>{G.current.orientation=E},[G,E]),z(()=>{i&&(S&&k?(v.current=c??-1,W.current&&c!=null&&(X.current=!0,I())):M.current&&(v.current=-1,I()))},[i,S,k,c,I]),z(()=>{if(i){if(!S){H.current=!1;return}if(k)if(r==null){if(H.current=!1,le.current!=null)return;if(M.current&&(v.current=-1,j()),(!P.current||!M.current)&&W.current&&(U.current!=null||W.current===!0&&U.current==null)){let u=0;const b=()=>{n.current[0]==null?(u<2&&(u?w=>B.request(w):queueMicrotask)(b),u+=1):(v.current=U.current==null||xt(U.current,E,R)||C?gt(n):Dt(n),U.current=null,I())};b()}}else Lt(n.current,r)||(v.current=r,j(),X.current=!1)}},[i,S,k,r,le,C,n,E,R,I,j,B]),z(()=>{if(!i||k||!J||x||!M.current)return;const u=J.nodesRef.current,b=u.find(N=>N.id===q)?.context?.elements.floating,Q=mt(Ye(D??b??null)),w=u.some(N=>N.context&&ve(N.context.elements.floating,Q));b&&!w&&a.current&&b.focus({preventScroll:!0})},[i,k,D,J,q,x]),z(()=>{P.current=S,M.current=!!k}),z(()=>{S||(U.current=null,W.current=T)},[S,T]);const ce=r!=null,Z=Y(u=>{if(!se.current)return;const b=n.current.indexOf(u.currentTarget);b!==-1&&(v.current!==b||r!==b)&&(v.current=b,I(u))}),pe=Y(()=>y??J?.nodesRef.current.find(u=>u.id===q)?.context?.dataRef?.current.orientation),xe=Y(()=>gt(n,re.current)),de=Y(u=>{if(a.current=!1,H.current=!0,u.which===229||!se.current&&u.currentTarget===L.current)return;if(C&&dr(u.key,E,R,O)){Xe(u.key,pe())||Ie(u),p.setOpen(!1,he(Ht,u.nativeEvent)),Nt(D)&&(x?J?.events.emit("virtualfocus",D):D.focus());return}const b=v.current,Q=gt(n,A),w=Dt(n,A);if(h||(u.key==="Home"&&(Ie(u),v.current=Q,I(u)),u.key==="End"&&(Ie(u),v.current=w,I(u))),m!=null){const N=m(u,v.current,n,E,l,R,A,Q,w);if(N!=null&&(v.current=N,I(u)),E==="both")return}if(Xe(u.key,E)){if(Ie(u),S&&!x&&mt(u.currentTarget.ownerDocument)===u.currentTarget){v.current=xt(u.key,E,R)?Q:w,I(u);return}xt(u.key,E,R)?l?b>=w?f&&b!==n.current.length?v.current=-1:(H.current=!1,v.current=Q):v.current=Ge(n.current,{startingIndex:b,disabledIndices:A}):v.current=Math.min(w,Ge(n.current,{startingIndex:b,disabledIndices:A})):l?b<=Q?f&&b!==-1?v.current=n.current.length:(H.current=!1,v.current=w):v.current=Ge(n.current,{startingIndex:b,decrement:!0,disabledIndices:A}):v.current=Math.max(Q,Ge(n.current,{startingIndex:b,decrement:!0,disabledIndices:A})),Lt(n.current,v.current)&&(v.current=-1),I(u)}}),ue=o.useMemo(()=>({onFocus(b){H.current=!0,Z(b)},onClick:({currentTarget:b})=>b.focus({preventScroll:!0}),onMouseMove(b){kt(b)||(H.current=!0,X.current=!1,d&&Z(b))},onPointerLeave(b){if(!se.current||!a.current||b.pointerType==="touch")return;H.current=!0;const Q=b.relatedTarget;if(!(!d||n.current.includes(Q))&&oe.current&&(ne.current?.(),ne.current=null,v.current=-1,I(b),!x)){const w=L.current,N=mt(Ye(w));w&&ve(w,N)&&w.focus({preventScroll:!0})}}}),[Z,se,L,d,n,I,oe,x]),ge=o.useMemo(()=>x&&S&&ce&&{"aria-activedescendant":`${$}-${r}`},[x,S,ce,$,r]),Se=o.useMemo(()=>({...h?{}:ge,onKeyDown(u){if(u.key==="Tab"&&u.shiftKey&&S&&!x){const b=En(u.nativeEvent);if(b&&!ve(L.current,b))return;Ie(u),p.setOpen(!1,he(Kt,u.nativeEvent)),Nt(D)&&D.focus();return}de(u)},onPointerMove(u){kt(u)||(a.current=!0)}}),[ge,de,L,h,p,S,x,D]),ee=o.useMemo(()=>{function u(w){p.setOpen(!0,he(Ht,w.nativeEvent,w.currentTarget))}function b(w){T==="auto"&&Zt(w.nativeEvent)&&(W.current=!x)}function Q(w){W.current=T,T==="auto"&&Wn(w.nativeEvent)&&(W.current=!0)}return{onKeyDown(w){const N=p.select("open");a.current=!1;const Te=w.key.startsWith("Arrow"),Me=fr(w.key,pe(),R),be=Xe(w.key,E),Re=(C?Me:be)||w.key==="Enter"||w.key.trim()==="";if(x&&N)return de(w);if(!(!N&&!F&&Te)){if(Re){const Ue=Xe(w.key,pe());U.current=C&&Ue?null:w.key}if(C){Me&&(Ie(w),N?(v.current=xe(),I(w)):u(w));return}be&&(le.current!=null&&(v.current=le.current),Ie(w),!N&&F?u(w):de(w),N&&I(w))}},onFocus(w){p.select("open")&&!x&&(v.current=-1,I(w))},onPointerDown:Q,onPointerEnter:Q,onMouseDown:b,onClick:b}},[de,T,xe,C,I,p,F,E,pe,R,le,x]),we=o.useMemo(()=>({...ge,...ee}),[ge,ee]);return o.useMemo(()=>i?{reference:we,floating:Se,item:ue,trigger:ee}:{},[i,we,Se,ee,ue])}function gr(e,t){const{listRef:n,elementsRef:r,activeIndex:s,onMatch:i,disabledIndices:c,onTyping:f,enabled:l=!0,resetMs:C=750,selectedIndex:R=null}=t,x="rootStore"in e?e.rootStore:e,T=x.useState("open"),d=tt(),F=o.useRef(""),A=o.useRef(R??s??-1),E=o.useRef(null),y=Y(g=>{function m(L){return r?.current[L]}function O(L){const q=m(L);return q&&!vn(q)||q?.matches(":disabled")?!1:c==null||!wn(Rt,L,c)}function p(L,q,J=0){if(L.length===0)return-1;const W=(J%L.length+L.length)%L.length,v=q.toLowerCase();for(let U=0;U<L.length;U+=1){const a=(W+U)%L.length;if(!(!L[a]?.toLowerCase().startsWith(v)||!O(a)))return a}return-1}const S=n.current;if(F.current.length>0&&g.key===" "&&(Ie(g),f?.(!0)),F.current.length>0&&F.current[0]!==" "&&p(S,F.current)===-1&&g.key!==" "&&f?.(!1),S==null||g.key.length!==1||g.ctrlKey||g.metaKey||g.altKey)return;T&&g.key!==" "&&(Ie(g),f?.(!0));const k=F.current==="";k&&(A.current=R??s??-1),S.every((L,q)=>L&&O(q)?L[0]?.toLowerCase()!==L[1]?.toLowerCase():!0)&&F.current===g.key&&(F.current="",A.current=E.current),F.current+=g.key,d.start(C,()=>{F.current="",A.current=E.current,f?.(!1)});const K=((k?R??s??-1:A.current)??0)+1,h=p(S,F.current,K);h!==-1?(i?.(h),E.current=h):g.key!==" "&&(F.current="",f?.(!1))}),$=Y(g=>{const m=g.relatedTarget,O=x.select("domReferenceElement"),p=x.select("floatingElement");ve(O,m)||ve(p,m)||(d.clear(),F.current="",A.current=E.current,f?.(!1))});z(()=>{!T&&R!==null||(d.clear(),E.current=null,F.current!==""&&(F.current=""))},[T,R,d]);const V=o.useMemo(()=>({onKeyDown:y,onBlur:$}),[y,$]);return o.useMemo(()=>l?{reference:V,floating:V}:{},[l,V])}function mr(e){const[t,n]=o.useState({current:e,previous:null});return Object.is(e,t.current)||n({current:e,previous:t.current}),t.previous}function hr(e){const t=o.useRef(!0);t.current&&(t.current=!1,e())}function xr(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}function Ut({controlled:e,default:t,name:n,state:r="value"}){const{current:s}=o.useRef(e!==void 0),[i,c]=o.useState(t),f=s&&e!==void 0?e:i,l=o.useCallback(C=>{s||c(C)},[]);return[f,l]}const en=o.createContext(void 0),tn=o.createContext(void 0),nn=o.createContext(void 0);function Fe(){const e=o.useContext(en);if(e===void 0)throw new Error(Ne(60));return e}function vt(){const e=o.useContext(tn);if(e===void 0)throw new Error(Ne(101));return e}function rn(){const e=o.useContext(nn);if(e===void 0)throw new Error(Ne(61));return e}const Sr="data-valid",Rr="data-invalid",br={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},yr={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},Ir={disabled:!1,...yr},Cr={valid(e){return e===null?null:e?{[Sr]:""}:{[Rr]:""}}},Er={invalid:void 0,name:void 0,validityData:{state:br,errors:[],error:"",value:"",initialValue:null},setValidityData:te,disabled:void 0,setTouched:te,setDirty:te,setFilled:te,setFocused:te,validationMode:"onSubmit",shouldValidateOnChange:()=>!1,state:Ir,registerFieldControl:te,validation:{getValidationProps:(e,t=nt)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:te,getInputControl:()=>null,commit:async()=>{},change:te}},vr=o.createContext(Er);function wt(e=!0){const t=o.useContext(vr);if(t.setValidityData===te&&!e)throw new Error(Ne(28));return t}function wr(e,t,n,r,s=!0,i){const{registerFieldControl:c}=wt(),f=He(()=>Symbol());z(()=>{const l=f.current;if(!s){c(l,void 0);return}c(l,{controlRef:e,getValue:r,id:t,name:i,value:n})},[e,s,r,t,i,c,f,n]),z(()=>{const l=f.current;return()=>{c(l,void 0)}},[c,f])}const Tr=o.createContext({controlId:void 0,registerControlId:te,resetControlId:te,labelId:void 0,setLabelId:te,messageIds:[],setMessageIds:te,getDescriptionProps:e=>e});function on(){return o.useContext(Tr)}function sn(e={}){const{id:t,enabled:n=!0}=e,{controlId:r,registerControlId:s,resetControlId:i}=on(),c=qn(),f=He(()=>Symbol()),l=o.useRef(!1),C=o.useRef(!1),R=Y(()=>{!l.current||s===te||(l.current=!1,s(f.current,void 0))});return z(()=>{if(!n||s===te){R();return}let x;if(t!==void 0)C.current=!0,x=t;else if(C.current)x=c;else{i();return}if(x===void 0){R();return}l.current=!0,s(f.current,x)},[t,n,s,i,c,f,R]),z(()=>R,[R]),(n?r:void 0)??t??c}function Mr(e,t,n=Object.is){const{length:r}=e;if(r!==t.length)return!1;for(let s=0;s<r;s+=1)if(!n(e[s],t[s]))return!1;return!0}const ln=(e,t)=>Object.is(e,t);function Oe(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Pr(e,t,n){return Array.isArray(e)&&Array.isArray(t)?!Mr(e,t,(r,s)=>Oe(r,s,n)):e!==t}function yt(e,t,n){return e?e.some(r=>r===void 0?!1:Oe(t,r,n)):!1}function ot(e,t,n){return e?e.findIndex(r=>r===void 0?!1:Oe(r,t,n)):-1}function Ar(e,t){if(t!==ln)return r=>yt(e,r,t);const n=new Set(e);return n.delete(void 0),r=>n.has(r)&&(r!==0||e.some(s=>Object.is(r,s)))}function cn(e,t,n,r){const s=r&&Array.isArray(t)?e.findIndex(Ar(t,n)):ot(e,t,n);return s===-1?null:s}function Or(e,t,n,r,s,i){return yt(r,t,s)?i!=null&&e>i&&yt(r,n[i],s)?i:e:e===i?cn(n,r,s,!0):i}function Fr(e,t,n){return e.filter(r=>!Oe(t,r,n))}function It(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function Vr(e){return typeof e=="object"&&e!=null&&Array.isArray(e.items)}function un(e){return Vr(e?.[0])}function Lr(e){return un(e)?e.flatMap(t=>t.items):e}function Dr(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(un(t)){for(const n of t)for(const r of n.items)if(r&&r.value==null&&r.label!=null)return!0;return!1}for(const n of t)if(n&&n.value==null&&n.label!=null)return!0;return!1}function an(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return It(e)}function De(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?It(e.value):It(e)}function fn(e,t,n){function r(){return an(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return(Object.hasOwn(t,e)?t[e]:void 0)??r();if(Array.isArray(t)){const i=Lr(t);if(e==null||typeof e!="object"){const c=i.find(f=>f.value===e);return c&&c.label!=null?c.label:r()}if("value"in e){const c=i.find(f=>f&&f.value===e.value);if(c&&c.label!=null)return c.label}}return r()}function Hr(e,t,n){return e.reduce((r,s,i)=>(i>0&&r.push(", "),r.push(ae.jsx(o.Fragment,{children:fn(s,t,n)},i)),r),[])}const Nr={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{const{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:De(t,r)!==""},hasNullItemLabel:(e,t)=>t?Dr(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{const n=e.isItemEqualToValue,r=e.value;return e.multiple?Array.isArray(r)&&r.some(s=>Oe(t,s,n)):Oe(t,r,n)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows},kr=o.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:te,validationMode:"onSubmit",submitCountRef:{current:0}});function Ur(){return o.useContext(kr)}const Ce=1;function dn(e,t){return Math.max(0,e-t)}function Br(e,t){if(t<=0)return 0;const n=ze(e,0,t),r=n,s=t-n,i=r<=Ce,c=s<=Ce;return i&&c?r<=s?0:t:i?0:c?t:n}function mo(e){const{id:t,value:n,defaultValue:r=null,onValueChange:s,open:i,defaultOpen:c=!1,onOpenChange:f,name:l,form:C,autoComplete:R,disabled:x=!1,readOnly:T=!1,required:d=!1,modal:F=!0,actionsRef:A,inputRef:E,onOpenChangeComplete:y,items:$,multiple:V=!1,itemToStringLabel:g,itemToStringValue:m,isItemEqualToValue:O=ln,highlightItemOnHover:p=!0,children:S}=e,{clearErrors:k}=Ur(),{setDirty:D,setTouched:G,setFocused:K,validityData:h,setFilled:L,name:q,disabled:J,validation:W,validationMode:v}=wt(),U=sn({id:t}),a=J||x,I=q??l,[M,P]=Ut({controlled:n,default:V?r??Rt:r,name:"Select",state:"value"}),[H,X]=Ut({controlled:i,default:c,name:"Select",state:"open"}),ne=o.useRef([]),re=o.useRef([]),se=o.useRef(null),le=o.useRef(null),oe=o.useRef(0),fe=o.useRef(null),B=o.useRef([]),j=o.useRef(!1),ce=o.useRef(null),Z=o.useRef(null),pe=o.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),xe=o.useRef(!1),de=o.useRef(M),{mounted:ue,setMounted:ge,transitionStatus:Se}=Qt(H),{openMethod:ee,triggerProps:we}=Zn(H),u=He(()=>new An({id:U,labelId:void 0,modal:F,multiple:V,itemToStringLabel:g,itemToStringValue:m,isItemEqualToValue:O,value:M,open:H,mounted:ue,transitionStatus:Se,items:$,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:nt,triggerProps:nt,triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1},{setValue:te,setOpen:te,handleScrollArrowVisibility:te,onOpenChangeComplete:te,listRef:ne,popupRef:se,scrollHandlerRef:le,scrollArrowsMountedCountRef:oe,valueRef:fe,valuesRef:B,labelsRef:re,typingRef:j,selectionRef:pe,firstItemTextRef:ce,selectedItemTextRef:Z,alignItemWithTriggerActiveRef:xe,initialValueRef:de},Nr)).current,b=u.useState("activeIndex"),Q=u.useState("selectedIndex"),w=u.useState("triggerElement"),N=u.useState("positionerElement"),Te=mr(ee),Me=ee??Te,be=o.useMemo(()=>V?"":De(M,m),[V,M,m]),Re=o.useMemo(()=>V&&Array.isArray(M)?M.map(_=>De(_,m)):De(M,m),[V,M,m]),Ue=Ae(w),Be=Y(()=>Re);wr(Ue,U,M,Be,!a,l);const _e=V?Array.isArray(M)&&M.length>0:M!=null&&be!=="";z(()=>{L(_e)},[_e,L]),z(function(){const ie=cn(B.current,M,O,V);ie===null&&(Z.current=null),!H&&u.set("selectedIndex",ie)},[V,H,M,O,u]),Qn(M,()=>{k(I),D(Pr(M,h.initialValue,O)),W.change(M)});const je=Y((_,ie)=>{f?.(_,ie),!ie.isCanceled&&(X(_),!_&&(ie.reason===Kt||ie.reason===On)&&(G(!0),K(!1),v==="onBlur"&&W.commit(M)))}),Ve=Y(()=>{ge(!1),u.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),y?.(!1)});Et({enabled:!A,open:H,ref:se,onComplete(){H||Ve()}}),o.useImperativeHandle(A,()=>({unmount:Ve}),[Ve]);const We=Y((_,ie)=>{s?.(_,ie),!ie.isCanceled&&P(_)}),at=Y(_=>{const ie=dn(_.scrollHeight,_.clientHeight),$e=Br(_.scrollTop,ie),ft=$e>0,qe=$e<ie;u.set("scrollUpArrowVisible",ft),u.set("scrollDownArrowVisible",qe)}),Pe=ur({open:H,onOpenChange:je,elements:{reference:w,floating:N}}),me=er(Pe,{enabled:!a,event:"mousedown"}),ye=zn(Pe),Ee=pr(Pe,{enabled:!a,listRef:ne,activeIndex:b,selectedIndex:Q,disabledIndices:Rt,onNavigate(_){_===null&&!H||u.set("activeIndex",_)},focusItemOnHover:p}),Le=gr(Pe,{enabled:!a&&(H||!T&&!V),listRef:re,activeIndex:b,selectedIndex:Q,disabledIndices:_=>xr(ne.current[_]),onMatch(_){H?u.set("activeIndex",_):We(B.current[_],he(st))},onTyping(_){j.current=_}}),Mt=o.useMemo(()=>bt(Le.reference,Ee.reference,ye.reference,me.reference,we),[me.reference,Le.reference,Ee.reference,ye.reference,we]),Pt=o.useMemo(()=>bt(Kn,Le.floating,Ee.floating,ye.floating),[Le.floating,Ee.floating,ye.floating]),At=Ee.item??nt;u.useContextCallback("setValue",We),u.useContextCallback("setOpen",je),u.useContextCallback("handleScrollArrowVisibility",at),u.useContextCallback("onOpenChangeComplete",y),hr(()=>{u.update({popupProps:Pt,triggerProps:Mt})}),u.useSyncedValues({id:U,modal:F,multiple:V,value:M,open:H,mounted:ue,transitionStatus:Se,popupProps:Pt,triggerProps:Mt,items:$,itemToStringLabel:g,itemToStringValue:m,isItemEqualToValue:O,openMethod:Me});const xn=o.useMemo(()=>({disabled:a,readOnly:T,required:d,multiple:V,highlightItemOnHover:p,itemProps:At}),[a,T,d,V,p,At]),Sn=Tn(E,W.inputRef),Ot=V?void 0:I,Rn=o.useMemo(()=>!V||!Array.isArray(M)||!I?null:M.map(_=>{const ie=De(_,m);return ae.jsx("input",{type:"hidden",form:C,name:I,value:ie,disabled:a},ie)}),[V,M,C,I,m,a]);return ae.jsxs(en.Provider,{value:u,children:[ae.jsx(tn.Provider,{value:xn,children:ae.jsx(nn.Provider,{value:Pe,children:S})}),ae.jsx("input",{...W.getValidationProps(a,{onFocus(){u.state.triggerElement?.focus({focusVisible:!0})},onChange(_){if(_.nativeEvent.defaultPrevented||a||T)return;const ie=_.currentTarget.value,$e=he(st,_.nativeEvent);function ft(){if(V)return;const qe=ie.toLowerCase();let dt=B.current.findIndex(pt=>De(pt,m).toLowerCase()===qe||an(pt,g).toLowerCase()===qe);dt===-1&&(dt=B.current.findIndex((pt,bn)=>{const Vt=re.current[bn];return Vt!=null&&Vt.toLowerCase()===qe}));const Ft=B.current[dt];Ft!=null&&We(Ft,$e)}u.set("forceMount",!0),queueMicrotask(ft)}}),id:U&&Ot==null?`${U}-hidden-input`:void 0,form:C,name:Ot,autoComplete:R,value:be,disabled:a,required:d&&!(V&&_e),readOnly:T,ref:Sn,style:I?Mn:Pn,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Rn]})}function _r(e,t){return e??t}const Je=5;function jr(e,t){const n=Wr(t);return e.clientX>=n.left-Je&&e.clientX<=n.right+Je&&e.clientY>=n.top-Je&&e.clientY<=n.bottom+Je}function Wr(e){const t=e.getBoundingClientRect(),n=rt(e);if(Fn)return t;const r=n.getComputedStyle(e,"::before"),s=n.getComputedStyle(e,"::after");if(!(r.content!=="none"||s.content!=="none"))return t;const c=parseFloat(r.width)||0,f=parseFloat(r.height)||0,l=parseFloat(s.width)||0,C=parseFloat(s.height)||0,R=Math.max(t.width,c,l),x=Math.max(t.height,f,C),T=R-t.width,d=x-t.height;return{left:t.left-T/2,right:t.right+T/2,top:t.top-d/2,bottom:t.bottom+d/2}}const qr="data-popup-side",zr=400,Kr={...Yn,...Cr,popupSide:e=>e?{[qr]:e}:null,value:()=>null},ho=o.forwardRef(function(t,n){const{render:r,className:s,id:i,disabled:c=!1,nativeButton:f=!0,style:l,...C}=t,{setTouched:R,setFocused:x,validationMode:T,validation:d,state:F,disabled:A}=wt(),{labelId:E}=on(),y=Fe(),{readOnly:$,required:V,disabled:g}=vt(),m=A||g||c,O=y.useState("open"),p=y.useState("mounted"),S=y.useState("value"),k=y.useState("triggerProps"),D=y.useState("positionerElement"),G=y.useState("listElement"),K=y.useState("popupSide"),h=y.useState("id"),L=y.useState("labelId"),q=y.useState("hasSelectedValue"),J=p&&D?K:null,W=i??h,v=_r(E,L);sn({id:i});const U=Ae(D),a=o.useRef(null),{getButtonProps:I,buttonRef:M}=Gt({disabled:m,native:f}),P=y.useStateSetter("triggerElement"),H=tt(),X=tt(),ne=tt();o.useEffect(()=>{if(O)return ne.start(zr,()=>{y.context.selectionRef.current.allowUnselectedMouseUp=!0,y.context.selectionRef.current.allowSelectedMouseUp=!0}),()=>{ne.clear()};y.context.selectionRef.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},X.clear()},[O,y,X,ne]);const re=bt(k,{id:W,role:"combobox","aria-expanded":O,"aria-haspopup":"listbox","aria-controls":O?G?.id??zt(D)?.id:void 0,"aria-labelledby":v,"aria-readonly":$||void 0,"aria-required":V||void 0,tabIndex:m?-1:0,onFocus(oe){x(!0),O&&y.context.alignItemWithTriggerActiveRef.current&&y.context.setOpen(!1,he(st,oe.nativeEvent)),H.start(0,()=>{y.set("forceMount",!0)})},onBlur(oe){ve(D,oe.relatedTarget)||(R(!0),x(!1),T==="onBlur"&&d.commit(S))},onMouseDown(oe){if(O)return;const fe=Ye(oe.currentTarget);function B(j){if(!a.current)return;const ce=j.target;ve(a.current,ce)||ve(U.current,ce)||jr(j,a.current)||y.context.setOpen(!1,he(Vn,j))}X.start(0,()=>{fe.addEventListener("mouseup",B,{once:!0})})}},C,I),se=d.getValidationProps(m,re);se.role="combobox";const le={...F,open:O,disabled:m,value:S,readOnly:$,popupSide:J,placeholder:!q};return ke("button",t,{ref:[n,a,M,P],state:le,stateAttributesMapping:Kr,props:se})}),Yr={value:()=>null},xo=o.forwardRef(function(t,n){const{className:r,render:s,children:i,placeholder:c,style:f,...l}=t,C=Fe(),R=C.useState("value"),x=C.useState("items"),T=C.useState("itemToStringLabel"),d=C.useState("hasSelectedValue"),F=!d&&c!=null&&i==null,A=C.useState("hasNullItemLabel",F),E={value:R,placeholder:!d};let y=null;return typeof i=="function"?y=i(R):i!=null?y=i:F&&!A?y=c:Array.isArray(R)?y=Hr(R,x,T):y=fn(R,x,T),ke("span",t,{state:E,ref:[n,C.context.valueRef],props:[{children:y},l],stateAttributesMapping:Yr})}),So=o.forwardRef(function(t,n){const r=Fe(),s=r.useState("mounted"),i=r.useState("forceMount");return s||i?ae.jsx(Ln,{ref:n,...t}):null}),pn=o.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function $r(){return o.useContext(pn)}function Gr(e){const{children:t,elementsRef:n,labelsRef:r,onMapChange:s}=e,i=Y(s),[,c]=o.useState(!1),f=He(Jr).current,l=He(Xr).current,C=o.useRef(0),R=o.useRef(!0),x=o.useRef(null),T=o.useRef(null),d=Y(()=>{R.current||(R.current=!0,c(m=>!m))}),F=Y((m,O)=>{l.set(m,O),d()}),A=Y(m=>{l.delete(m),d()}),E=Y(m=>{const O=new Map;return n.current.length=0,r&&(r.current.length=0),m.forEach(p=>{O.set(p.element,{...p.registration.metadata??{},index:p.index}),n.current[p.index]=p.element,r&&(r.current[p.index]=p.registration.label!==void 0?p.registration.label:p.registration.textRef?.current?.textContent??p.element.textContent)}),C.current=n.current.length,O});function y(m){if(T.current?.disconnect(),T.current=null,typeof MutationObserver!="function"||m.length<2)return;const O=new MutationObserver(S=>{if(!eo(S))return;let k=null;for(const D of m)if(D.isConnected){if(k&&gn(k,D)>0){O.disconnect(),d();return}k=D}});T.current=O;const p=new Set;for(let S=1;S<m.length;S+=1){const k=Qr(m[S-1],m[S]);k&&p.add(k)}p.forEach(S=>O.observe(S,{childList:!0}))}const $=Y(()=>{const[m,O]=Zr(l),p=E(m),S=x.current,k=!S||S.length!==m.length||m.some((D,G)=>{const K=S[G];return D.index!==K.index||D.element!==K.element||D.registration.index!==K.registration.index||D.registration.metadata!==K.registration.metadata});y(O),x.current=m,R.current=!1,k&&(f.forEach(D=>D(p)),i(p))});z(()=>(!R.current&&x.current&&E(x.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,E]),z(()=>{R.current&&$()}),z(()=>()=>{T.current?.disconnect(),R.current=!0},[]);const V=Y(m=>(f.add(m),()=>{f.delete(m)})),g=o.useMemo(()=>({register:F,unregister:A,subscribeMapChange:V,nextIndexRef:C}),[F,A,V,C]);return ae.jsx(pn.Provider,{value:g,children:t})}function Xr(){return new Map}function Jr(){return new Set}function Zr(e){const t=new Set,n=[],r=[];e.forEach((i,c)=>{if(!c.isConnected)return;const f=i.index,l={index:f??-1,element:c,registration:i};f===null?r.push(l):f>=0&&(t.add(f),n.push(l))});let s=0;return r.sort((i,c)=>gn(i.element,c.element)),r.forEach(i=>{for(;t.has(s);)s+=1;i.index=s,n.push(i),s+=1}),t.size>0&&n.sort((i,c)=>i.index-c.index),[n,r.map(i=>i.element)]}function Qr(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function eo(e){for(const t of e)for(let n=0;n<t.removedNodes.length;n+=1)if(t.removedNodes[n].isConnected)return!0;return!1}function gn(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}const mn=o.createContext(void 0);function to(){const e=o.useContext(mn);if(!e)throw new Error(Ne(59));return e}function it(e,t){e&&Object.assign(e.style,t)}const no={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},ro={position:"fixed"},Ro=o.forwardRef(function(t,n){const{anchor:r,className:s,render:i,positionMethod:c,side:f,align:l,sideOffset:C,alignOffset:R,collisionBoundary:x="clipping-ancestors",collisionPadding:T,arrowPadding:d,sticky:F,disableAnchorTracking:A,alignItemWithTrigger:E=!0,collisionAvoidance:y=Dn,style:$,...V}=t,g=Fe(),m=rn(),O=g.useState("open"),p=g.useState("mounted"),S=g.useState("modal"),k=g.useState("value"),D=g.useState("openMethod"),G=g.useState("positionerElement"),K=g.useState("triggerElement"),h=g.useState("isItemEqualToValue"),L=g.useState("transitionStatus"),q=o.useRef(null),J=o.useRef(null),[W,v]=o.useState(E),U=p&&W&&D!=="touch";!p&&W!==E&&v(E),o.useImperativeHandle(g.context.alignItemWithTriggerActiveRef,()=>U),tr((U||S)&&O,D==="touch",G,K);const a=nr({anchor:r,floatingRootContext:m,positionMethod:c,mounted:p,side:f,sideOffset:C,align:l,alignOffset:R,arrowPadding:d,collisionBoundary:x,collisionPadding:T,sticky:F,disableAnchorTracking:A??U,collisionAvoidance:y,keepMounted:!0}),I=U?"none":a.side,M=U?ro:a.positionerStyles,P={open:O,side:I,align:a.align,anchorHidden:a.anchorHidden};z(()=>{g.set("popupSide",a.side)},[g,a.side]);const H=g.useStateSetter("positionerElement"),X=rr(t,P,{styles:M,transitionStatus:L,props:V,refs:[n,H],hidden:!p,inert:!O}),ne=o.useRef(0),re=Y(le=>{if(g.context.valuesRef.current.length===0)return;const oe=ne.current;ne.current=le.size;const fe=he(st);if(oe!==0&&!g.state.multiple&&k!==null&&ot(g.context.valuesRef.current,k,h)===-1){const j=g.context.initialValueRef.current,Z=j!=null&&ot(g.context.valuesRef.current,j,h)!==-1?j:null;g.context.setValue(Z,fe),Z===null&&(g.set("selectedIndex",null),g.context.selectedItemTextRef.current=null)}if(oe!==0&&g.state.multiple&&Array.isArray(k)){const B=k.filter(j=>ot(g.context.valuesRef.current,j,h)!==-1);B.length!==k.length&&(g.context.setValue(B,fe),B.length===0&&(g.set("selectedIndex",null),g.context.selectedItemTextRef.current=null))}if(O&&U){g.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const B={height:""};it(G,B),it(g.context.popupRef.current,B)}}),se=o.useMemo(()=>({...a,side:I,alignItemWithTriggerActive:U,setControlledAlignItemWithTrigger:v,scrollUpArrowRef:q,scrollDownArrowRef:J}),[a,I,U,v]);return ae.jsx(Gr,{elementsRef:g.context.listRef,labelsRef:g.context.labelsRef,onMapChange:re,children:ae.jsxs(mn.Provider,{value:se,children:[p&&S&&ae.jsx($n,{inert:Hn(!O),cutout:K}),X]})})}),Ze="base-ui-disable-scrollbar",Bt={className:Ze,getElement(e){return ae.jsx("style",{nonce:e,href:Ze,precedence:"base-ui:low",children:`.${Ze}{scrollbar-width:none}.${Ze}::-webkit-scrollbar{display:none}`})}},oo=o.createContext(void 0),so={disableStyleElements:!1};function io(){return o.useContext(oo)??so}const _t="--transform-origin",lo={...Xn,...Xt},bo=o.forwardRef(function(t,n){const{render:r,className:s,style:i,finalFocus:c,...f}=t,l=Fe(),{multiple:C,readOnly:R,highlightItemOnHover:x}=vt(),T=rn(),{side:d,align:F,alignItemWithTriggerActive:A,isPositioned:E,setControlledAlignItemWithTrigger:y}=to(),$=or()!=null,V=sr(),{nonce:g,disableStyleElements:m}=io(),O=l.useState("id"),p=l.useState("open"),S=l.useState("openMethod"),k=l.useState("mounted"),D=l.useState("popupProps"),G=l.useState("transitionStatus"),K=l.useState("triggerElement"),h=l.useState("positionerElement"),L=l.useState("listElement"),q=o.useRef(!1),J=o.useRef(!1),W=o.useRef({}),v=St(),U=Y(P=>{if(!h||!l.context.popupRef.current||!J.current)return;const H=h.style.top==="0px",X=h.style.bottom==="0px";if(q.current||!A||!H&&!X){l.context.handleScrollArrowVisibility(P);return}const ne=Wt(h),re=Ke(h.getBoundingClientRect().height,"y",ne),se=Ye(h),le=rt(h),oe=le.getComputedStyle(h),fe=parseFloat(oe.marginTop),B=parseFloat(oe.marginBottom),j=jt(le.getComputedStyle(l.context.popupRef.current)),ce=Math.min(se.documentElement.clientHeight-fe-B,j),Z=P.scrollTop,pe=Qe(P);let xe=null;const de=ee=>{h.style.height=`${ee}px`},ue=H?pe-Z:Z,ge=Math.min(re+ue,ce);if(ue<=Ce){const ee=ze(ue,0,ce-re);ee>0&&de(re+ee),P.scrollTop=H?pe:0,ce-(re+ee)<=Ce&&(q.current=!0),l.context.handleScrollArrowVisibility(P);return}if(ce-ge>Ce)xe=H?1/0:0;else if(X&&Z<pe){const ee=re+ue-ce;xe=Z-(ue-ee)}const Se=Math.ceil(ge);if(Se!==0&&de(Se),xe!=null){const ee=ze(xe,0,Qe(P));Math.abs(P.scrollTop-ee)>Ce&&(P.scrollTop=ee)}Se>=ce-Ce&&(q.current=!0),l.context.handleScrollArrowVisibility(P)});o.useImperativeHandle(l.context.scrollHandlerRef,()=>U,[U]),Et({open:p,ref:l.context.popupRef,onComplete(){p&&l.context.onOpenChangeComplete(!0)}});const a={open:p,transitionStatus:G,side:d,align:F};z(()=>{!h||!l.context.popupRef.current||Object.keys(W.current).length||(W.current={top:h.style.top||"0",left:h.style.left||"0",right:h.style.right,height:h.style.height,bottom:h.style.bottom,minHeight:h.style.minHeight,maxHeight:h.style.maxHeight,marginTop:h.style.marginTop,marginBottom:h.style.marginBottom})},[l,h]),z(()=>{p||A||(J.current=!1,q.current=!1,it(h,W.current))},[p,A,h]),z(()=>{const P=l.context.popupRef.current;if(!p||!K||!h||!P||A&&!E||l.state.transitionStatus==="ending")return;if(J.current=!0,P.style.removeProperty(_t),!A){v.request(()=>l.context.handleScrollArrowVisibility(L||P));return}const H=co(P);try{let X=l.context.selectedItemTextRef.current;X?.isConnected||(X=!l.select("hasSelectedValue")&&l.context.firstItemTextRef.current?.isConnected?l.context.firstItemTextRef.current:null);const ne=l.context.valueRef.current,re=rt(h),se=re.getComputedStyle(h),le=re.getComputedStyle(P),oe=Ye(K),fe=Wt(K),B=et(K.getBoundingClientRect(),fe),j=et(h.getBoundingClientRect(),fe),ce=B.height,Z=L||P,pe=Z.scrollHeight,xe=parseFloat(le.borderBottomWidth),de=parseFloat(se.marginTop)||10,ue=parseFloat(se.marginBottom)||10,ge=parseFloat(se.minHeight)||100,Se=jt(le),ee=5,we=5,u=20,b=oe.documentElement.clientHeight-de-ue,Q=oe.documentElement.clientWidth,w=b-B.bottom+ce;let N,Te=V==="rtl"?B.right-j.width:B.left,Me=0;if(X&&ne){const me=et(ne.getBoundingClientRect(),fe);N=et(X.getBoundingClientRect(),fe),Te=j.left+(V==="rtl"?me.right-N.right:me.left-N.left);const ye=me.top-B.top+me.height/2;Me=N.top-j.top+N.height/2-ye}const be=w+Me+ue+xe;let Re=Math.min(b,be);const Ue=b-de-ue,Be=be-Re,_e=Q-we;h.style.left=`${ze(Te,ee,_e-j.width)}px`,h.style.height=`${Re}px`,h.style.maxHeight="none",h.style.marginTop=`${de}px`,h.style.marginBottom=`${ue}px`,P.style.height="100%";const je=Qe(Z),Ve=Be>=je-Ce;Ve&&(Re=Math.min(b,j.height)-(Be-je));const We=B.top<u||B.bottom>b-u||Math.ceil(Re)+Ce<Math.min(pe,ge),at=(re.visualViewport?.scale??1)!==1&&Yt;if(We||at){it(h,W.current),y(!1);return}const Pe=Math.max(ge,Re);if(Ve){const me=Math.max(0,b-be);h.style.top=j.height>=Ue?"0":`${me}px`,h.style.height=`${Re}px`,Z.scrollTop=Qe(Z)}else h.style.bottom="0",Z.scrollTop=Be;if(N){const me=j.top,ye=j.height,Ee=N.top+N.height/2,Le=ze(ye>0?(Ee-me)/ye*100:50,0,100);P.style.setProperty(_t,`50% ${Le}%`)}(Pe===b||Re>=Se)&&(q.current=!0),l.context.handleScrollArrowVisibility(Z),x&&l.state.selectedIndex===null&&l.state.activeIndex===null&&l.context.listRef.current[0]!=null&&l.set("activeIndex",0)}finally{H()}},[l,p,h,K,A,y,v,L,x,V,E]),o.useEffect(()=>{if(!A||!h||!p)return;const P=rt(h);function H(X){l.context.setOpen(!1,he(kn,X))}return Nn(P,"resize",H)},[l,A,h,p]);const I={...L?{role:"presentation"}:{role:"listbox","aria-multiselectable":C||void 0,"aria-readonly":R||void 0,id:`${O}-list`},onKeyDown(P){$&&Jn.has(P.key)&&P.stopPropagation()},onScroll(P){L||U(P.currentTarget)},...A&&{style:L?{height:"100%"}:no},className:!L&&A?Bt.className:void 0},M=ke("div",t,{ref:[n,l.context.popupRef],state:a,stateAttributesMapping:lo,props:[D,I,cr(G),f]});return ae.jsxs(o.Fragment,{children:[!m&&Bt.getElement(g),ae.jsx(Gn,{context:T,modal:!1,disabled:!k,openInteractionType:S,returnFocus:c,restoreFocus:!0,children:M})]})});function jt(e){const t=e.maxHeight;return t.endsWith("px")&&parseFloat(t)||1/0}function Qe(e){return dn(e.scrollHeight,e.clientHeight)}function Wt(e){return ir.getScale(e)}function Ke(e,t,n){return e/n[t]}function et(e,t){return lr({x:Ke(e.x,"x",t),y:Ke(e.y,"y",t),width:Ke(e.width,"x",t),height:Ke(e.height,"y",t)})}const qt=[["transform","none"],["scale","1"],["translate","0 0"]];function co(e){const{style:t}=e,n={};for(const[r,s]of qt)n[r]=t.getPropertyValue(r),t.setProperty(r,s,"important");return()=>{for(const[r]of qt){const s=n[r];s?t.setProperty(r,s):t.removeProperty(r)}}}function uo(e={}){const{guess:t,label:n,metadata:r,textRef:s,index:i}=e,{register:c,unregister:f,subscribeMapChange:l,nextIndexRef:C}=$r(),R=o.useRef(-1),[x,T]=o.useState(i==null&&t?()=>{if(R.current===-1){const E=C.current;C.current+=1,R.current=E}return R.current}:-1),d=i??x,F=o.useRef(null),A=o.useCallback(E=>{const y=F.current;y&&f(y),F.current=E,E&&c(E,{metadata:r??null,index:i??null,label:n,textRef:s})},[i,c,f,r,n,s]);return z(()=>{if(i==null)return l(E=>{const y=F.current?E.get(F.current)?.index:null;y!=null&&T(y)})},[i,l]),{ref:A,index:d}}const hn=o.createContext(void 0);function Tt(){const e=o.useContext(hn);if(!e)throw new Error(Ne(57));return e}const yo=o.memo(o.forwardRef(function(t,n){const{render:r,className:s,style:i,value:c=null,label:f,disabled:l=!1,nativeButton:C=!1,...R}=t,x=o.useRef(null),T=uo({guess:!0,label:f,textRef:x}),d=Fe(),{itemProps:F,multiple:A,disabled:E,readOnly:y}=vt(),$=E||l,V=d.useState("isActive",T.index),g=d.useState("open"),m=d.useState("isSelected",c),O=d.useState("isSelectedByFocus",T.index),p=d.useState("isItemEqualToValue"),S=T.index,k=o.useRef(null);z(()=>{const a=d.context.valuesRef.current;return a[S]=c,()=>{delete a[S]}},[S,c,d]),z(()=>{const a=d.state.value,I=d.state.selectedIndex;let M=I,P;A&&Array.isArray(a)?(M=Or(S,c,d.context.valuesRef.current,a,p,I),P=M===S,S===I&&!P&&(d.context.selectedItemTextRef.current=null)):(P=a!==void 0&&Oe(c,a,p),P&&(M=S)),d.set("selectedIndex",M),P&&x.current&&(d.context.selectedItemTextRef.current=x.current)},[S,A,p,d,c]);const D=o.useRef("mouse"),G=o.useRef(!1),{getButtonProps:K,buttonRef:h}=Gt({disabled:$,focusableWhenDisabled:!0,native:C,composite:!0}),L={disabled:$,selected:m,highlighted:V};function q(a){if(E||y)return;const I=d.state.value;if(A){const M=Array.isArray(I)?I:[],P=m?Fr(M,c,p):[...M,c];d.context.setValue(P,he(ht,a))}else d.context.setValue(c,he(ht,a)),d.context.setOpen(!1,he(ht,a))}function J(){d.context.selectionRef.current.dragY=0}const W={role:"option","aria-selected":m,tabIndex:g&&V?0:-1,onKeyDown(a){d.set("activeIndex",S),a.key===" "&&d.context.typingRef.current&&a.preventDefault()},onClick(a){const I=D.current!=="touch",M=a.nativeEvent.pointerType,P=I&&Zt(a.nativeEvent)&&(M!==void 0||V),H=I&&!P&&!G.current;G.current=!1,!($||H)&&q(a.nativeEvent)},onPointerEnter(a){D.current=a.pointerType},onPointerMove(a){if(a.pointerType==="mouse"&&a.buttons===1){const I=d.context.selectionRef.current;I.dragY+=a.movementY,I.dragY**2>=64&&(I.allowUnselectedMouseUp=!0)}},onPointerDown(a){D.current=a.pointerType,G.current=!0,J()},onMouseUp(){if(J(),$||D.current==="touch"||G.current)return;const a=!d.context.selectionRef.current.allowSelectedMouseUp&&m,I=!d.context.selectionRef.current.allowUnselectedMouseUp&&!m;a||I||(G.current=!0,k.current?.click(),G.current=!1)}},v=ke("div",t,{ref:[h,n,T.ref,k],state:L,props:[F,W,R,K]}),U=o.useMemo(()=>({selected:m,index:S,textRef:x,selectedByFocus:O}),[m,S,x,O]);return ae.jsx(hn.Provider,{value:U,children:v})})),Io=o.forwardRef(function(t,n){const{selected:r}=Tt();return t.keepMounted||r?ae.jsx(ao,{...t,ref:n}):null}),ao=o.memo(o.forwardRef((e,t)=>{const{render:n,className:r,style:s,keepMounted:i,...c}=e,{selected:f}=Tt(),l=o.useRef(null),{transitionStatus:C,setMounted:R}=Qt(f),T=ke("span",e,{ref:[t,l],state:{selected:f,transitionStatus:C},props:[{"aria-hidden":!0,children:"✔️"},c],stateAttributesMapping:Xt});return Et({batch:!0,enabled:!f,open:f,ref:l,onComplete(){f||R(!1)}}),T})),Co=o.memo(o.forwardRef(function(t,n){const{index:r,textRef:s,selectedByFocus:i}=Tt(),c=Fe(),{render:f,className:l,style:C,...R}=t,x=o.useCallback(d=>{d&&(r===0&&(c.context.firstItemTextRef.current=d),i&&(c.context.selectedItemTextRef.current=d))},[c,r,i]);return ke("div",t,{ref:[x,n,s],props:R})}));export{no as L,mo as S,vt as a,to as b,ho as c,xo as d,So as e,Ro as f,bo as g,yo as h,Io as i,Co as j,Cr as k,Ur as l,wt as m,on as n,sn as o,Ut as p,wr as q,Bt as s,Fe as u};
|
package/dashboard/dist/assets/{ServiceStatusPage-Xz-rDYxA.js → ServiceStatusPage-C3ZC1csM.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-oFHfLR8i.js";import{P as f}from"./ProviderIcon-De08Y4_I.js";import{E as b}from"./external-link-DGnoQUQ1.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,2 +1,2 @@
|
|
|
1
|
-
import{m as ee,r as i,j as e,e as F,c as a,I as me,G as Z,R as he,X as ge,d as te,l as x,a3 as pe,a4 as q}from"./__vite-browser-external-
|
|
1
|
+
import{m as ee,r as i,j as e,e as F,c as a,I as me,G as Z,R as he,X as ge,d as te,l as x,a3 as pe,a4 as q}from"./__vite-browser-external-oFHfLR8i.js";import{L as fe,I as be}from"./LocalOnlyNotice-DcjSbtm8.js";import{S as V}from"./SegmentedControl-CJRmt3or.js";import{C as ye}from"./ToolbarRootContext-CPEvPTvc.js";import{S as ae}from"./search-CPdoCrMk.js";import{C as ke}from"./check-BH5FRF8F.js";import{P as _e,a as ve,b as je,c as we,d as Ne}from"./PopoverPopup-BJrL_Eyg.js";import{P as Ce}from"./ProviderIcon-De08Y4_I.js";import{H as Se}from"./HoverTooltip-ClzkNc3q.js";import{u as Me}from"./useCurrency-Cp27r6z0.js";import{i as Le}from"./host-mode-Bc_iTzHk.js";import{L as Re}from"./loader-circle-B6dVl4Im.js";import{T as Te}from"./terminal-CJyI1G2f.js";import"./arrow-up-right-y3EAs6Hg.js";import"./download-p1XPZSMa.js";import"./composite-Bl68G4Qr.js";import"./store-npers9xW.js";const re={name:"calendar",size:24,node:[["path",{d:"M8 2v3",key:"1ioesn"}],["path",{d:"M16 2v3",key:"otl347"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}],["path",{d:"M3 9h18",key:"1pudct"}]]};re.node;const De=ee(re);const se={name:"folder",size:24,node:[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]};se.node;const Ie=ee(se),Ee="flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-sm text-oai-black outline-none hover:bg-oai-gray-100 dark:text-white dark:hover:bg-oai-gray-800";function Pe({options:r,value:t,onChange:s,allValue:m="all",allLabel:p,searchPlaceholder:y,emptyLabel:u,ariaLabel:j,disabled:k=!1,className:w=""}){const[f,b]=i.useState(!1),[h,D]=i.useState(""),[g,_]=i.useState(-1),N=i.useRef(null),C=`${i.useId()}-listbox`,U=t===m?p:r.find(l=>l.value===t)?.label??t,S=h.trim().toLowerCase(),I=i.useMemo(()=>S?r.filter(l=>l.label.toLowerCase().includes(S)):r,[r,S]),E=i.useMemo(()=>[{value:m,label:p},...I],[m,p,I]),M=g>=0&&g<E.length?E[g]:null,P=l=>{s(l),b(!1),D(""),_(-1)};i.useEffect(()=>{f&&N.current?.querySelector('[data-active="true"]')?.scrollIntoView?.({block:"nearest"})},[f,g]);const L=l=>{if(l.key==="ArrowDown"||l.key==="ArrowUp"){l.preventDefault();const v=l.key==="ArrowDown";_($=>{const R=E.length;return R?v?$>=R-1?0:$+1:$<=0?R-1:$-1:-1});return}if(l.key==="Enter"){const v=M||(S&&I.length?I[0]:null);if(!v)return;l.preventDefault(),P(v.value)}};return e.jsxs(_e,{open:f,onOpenChange:l=>{b(l),_(-1),l||D("")},children:[e.jsxs(ve,{disabled:k,"aria-label":j,className:F("inline-flex h-8 max-w-[12rem] shrink-0 items-center gap-1.5 rounded-md border border-oai-gray-200 bg-oai-white px-2.5 text-xs font-medium transition hover:border-oai-gray-300 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 disabled:opacity-60 data-[popup-open]:border-oai-gray-300 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:hover:border-oai-gray-700",t!==m?"text-oai-black dark:text-white":"text-oai-gray-700 dark:text-oai-gray-200",w),children:[e.jsx(Ie,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-400","aria-hidden":!0}),e.jsx("span",{className:"truncate",children:U}),e.jsx(ye,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-400","aria-hidden":!0})]}),e.jsx(je,{children:e.jsx(we,{sideOffset:4,side:"bottom",align:"start",className:"z-[60]",children:e.jsxs(Ne,{className:"w-56 overflow-hidden rounded-md border border-oai-gray-200 bg-white p-1 shadow-[0_12px_32px_-12px_rgba(0,0,0,0.18)] outline-none dark:border-oai-gray-800 dark:bg-oai-gray-950 dark:shadow-[0_12px_32px_-12px_rgba(0,0,0,0.6)]",children:[e.jsxs("div",{className:"relative mb-1",children:[e.jsx(ae,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-oai-gray-400","aria-hidden":!0}),e.jsx("input",{type:"text",role:"combobox","aria-expanded":!0,"aria-controls":C,"aria-activedescendant":M?`${C}-${g}`:void 0,value:h,onChange:l=>{D(l.target.value),_(-1)},onKeyDown:L,placeholder:y,className:"h-8 w-full rounded border border-oai-gray-200 bg-transparent pl-8 pr-2 text-xs text-oai-black outline-none placeholder:text-oai-gray-400 focus:border-oai-gray-400 dark:border-oai-gray-800 dark:text-white dark:focus:border-oai-gray-500"})]}),e.jsxs("div",{ref:N,id:C,role:"listbox","aria-label":j,className:"max-h-64 overflow-y-auto",children:[E.map((l,v)=>e.jsxs("button",{id:`${C}-${v}`,type:"button",role:"option","aria-selected":t===l.value,"data-active":v===g?"true":void 0,onMouseEnter:()=>_(v),onClick:()=>P(l.value),className:F(Ee,t===l.value&&"bg-oai-gray-100 dark:bg-oai-gray-800",v===g&&"ring-1 ring-inset ring-oai-gray-300 dark:ring-oai-gray-600"),children:[e.jsx("span",{className:"flex-1 truncate",children:l.label}),t===l.value?e.jsx(ke,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}):null]},l.value)),I.length===0?e.jsx("div",{className:"px-2 py-3 text-center text-xs text-oai-gray-400 dark:text-oai-gray-500",children:u}):null]})]})})})]})}const Fe="tokentracker-sessions";async function $e(r={}){const t=new URL(`/functions/${Fe}`,window.location.origin);r.from&&t.searchParams.set("from",r.from),r.to&&t.searchParams.set("to",r.to),r.limit&&t.searchParams.set("limit",String(r.limit)),r.refresh&&t.searchParams.set("refresh","1");const s=await fetch(t.toString(),{headers:{Accept:"application/json"},cache:"no-store"}),m=await s.json().catch(()=>null);if(!s.ok){const p=s.status===404?a("sessions.error.outdated_app"):`Request failed with HTTP ${s.status}`,y=new Error(m?.error||p);throw y.status=s.status,y}return m}const X=Le(),Oe=[],z=100,Ae=[{id:"all",label:()=>a("sessions.filter.source_all")},{id:"claude",label:()=>"Claude Code"},{id:"codex",label:()=>"Codex"},{id:"grok",label:()=>"Grok"}],oe=[{id:"all",days:0,label:()=>a("sessions.filter.range_all")},{id:"7d",days:7,label:()=>a("sessions.filter.range_7d")},{id:"30d",days:30,label:()=>a("sessions.filter.range_30d")},{id:"90d",days:90,label:()=>a("sessions.filter.range_90d")}];function Ue(r){const t=oe.find(m=>m.id===r)?.days||0;if(!t)return 0;const s=new Date;return s.setDate(s.getDate()-(t-1)),s.setHours(0,0,0,0),s.getTime()}function qe(r,t){if(!t)return!0;const s=Date.parse(r.ended_at||r.started_at||"");return Number.isFinite(s)?s>=t:!0}function B(r){const t=Array.isArray(r?.model_usage)?r.model_usage.filter(s=>s&&typeof s.model=="string"&&s.model):[];return t.length?t:[{model:r?.model||a("sessions.model.unknown"),total_tokens:Number(r?.own_total_tokens||r?.total_tokens||0)}]}function Be(r){const t=B(r);return t.length===1?t[0].model:t.map(s=>`${s.model} ${x(Number(s.total_tokens||0))}`).join(" · ")}function Ge(r,t){if(!r)return"—";const s=Date.parse(r);if(!Number.isFinite(s))return"—";try{return new Date(s).toLocaleString(t||void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return new Date(s).toISOString().slice(0,16).replace("T"," ")}}function He(r){const t=Number(r);if(!Number.isFinite(t)||t<=0)return null;const s=Math.round(t/6e4);if(s<60)return a("sessions.duration.minutes",{minutes:s});const m=Math.floor(s/60),p=s%60;return a("sessions.duration.hours",{hours:m,minutes:p})}async function J(r){if(navigator?.clipboard?.writeText)return await navigator.clipboard.writeText(r),!0;const t=document.createElement("textarea");t.value=r,t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();const s=document.execCommand("copy");return document.body.removeChild(t),s}const Y=te.memo(function({session:t,locale:s,nested:m=!1,childCount:p=0,expanded:y=!1,onToggle:u}){const{currency:j,rate:k}=Me(),w=String(t.source||"").toUpperCase(),f=He(t.duration_ms),b=t.resume_command,h=t.project_key||a("sessions.project.unknown"),D=m||t.thread_kind==="subagent",g=D?t.agent_nickname||t.agent_role||t.title||h:t.title||h,_=!!(t.title&&t.project_key),N=String(t.source||"").toLowerCase()==="grok",C=N&&t.usage_precision?a("sessions.grok.token_breakdown",{input:x(t.input_tokens),cacheRead:x(t.cached_input_tokens),cacheWrite:x(t.cache_creation_input_tokens),output:x(t.output_tokens),reasoning:x(t.reasoning_output_tokens)}):null,U=N&&t.usage_precision?a("sessions.grok.runtime_breakdown",{calls:x(t.model_calls),seconds:(Number(t.api_duration_ms||0)/1e3).toFixed(1),tools:x(t.tool_calls),errors:x(t.error_count)}):null,S=N&&Number(t.context_window_tokens)>0?a("sessions.grok.context_breakdown",{used:x(t.context_tokens_used),window:x(t.context_window_tokens),percent:Number(t.context_usage_percent||0).toFixed(0)}):null,I=t.project_ref?`${t.project_ref}
|
|
2
2
|
${a("sessions.project.copy_hint")}`:void 0,E=async()=>{if(t.project_ref)try{await J(t.project_ref)?q({title:a("sessions.project.copied")}):q({title:a("sessions.project.copy_failed")})}catch{q({title:a("sessions.project.copy_failed")})}},M=L=>e.jsxs("span",{className:"group relative inline-flex min-w-0 max-w-full",children:[e.jsx(Se,{text:I,placement:"bottom"}),e.jsx("button",{type:"button",onClick:E,"aria-label":a("sessions.project.copy_aria",{project:h}),className:F("max-w-full truncate rounded text-left underline decoration-dotted decoration-oai-gray-300 underline-offset-4 hover:decoration-oai-gray-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:decoration-oai-gray-600 dark:hover:decoration-oai-gray-400",L),children:h})]}),P=async()=>{if(b)try{await J(b)?q({title:a("sessions.resume.copied")}):q({title:a("sessions.resume.copy_failed")})}catch{q({title:a("sessions.resume.copy_failed")})}};return e.jsxs("li",{className:F("flex flex-col gap-3 py-4 sm:flex-row sm:items-start",m&&"ml-6 border-l-2 border-oai-gray-200 pl-4 dark:border-oai-gray-800"),children:[e.jsxs("div",{className:"flex min-w-0 flex-1 items-start gap-2.5",children:[e.jsx("span",{className:"mt-0.5 shrink-0 text-oai-gray-400 dark:text-oai-gray-500",children:e.jsx(Ce,{provider:w,size:20})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[!D&&!t.title&&t.project_ref?M("font-medium text-oai-black dark:text-white"):e.jsx("span",{className:"truncate font-medium text-oai-black dark:text-white",children:g}),D?e.jsxs("span",{className:"inline-flex items-center rounded-full bg-sky-50 px-2 py-0.5 text-[11px] font-medium text-sky-700 dark:bg-sky-500/10 dark:text-sky-300",children:[a("sessions.badge.subagent"),t.agent_role?` · ${t.agent_role}`:""]}):null,t.first_pass?e.jsx("span",{className:"inline-flex items-center rounded-full bg-emerald-50 px-2 py-0.5 text-[11px] font-medium text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-300",children:a("sessions.badge.first_pass")}):null,N&&t.usage_precision||t.cost_is_partial?e.jsx("span",{className:F("inline-flex items-center rounded-full px-2 py-0.5 text-[11px] font-medium",t.usage_is_incomplete||t.cost_is_partial?"bg-amber-50 text-amber-700 dark:bg-amber-500/10 dark:text-amber-300":"bg-sky-50 text-sky-700 dark:bg-sky-500/10 dark:text-sky-300"),children:t.usage_is_incomplete?a("sessions.badge.partial_usage"):t.cost_is_partial?a("sessions.badge.partial_cost"):t.cost_source==="provider_reported"?a("sessions.badge.reported_cost"):a("sessions.badge.reported_usage")}):null,p?e.jsx("button",{type:"button",onClick:u,"aria-expanded":y,className:"inline-flex items-center rounded-full border border-oai-gray-200 px-2 py-0.5 text-[11px] font-medium text-oai-gray-600 transition-colors hover:bg-oai-gray-100 hover:text-oai-black focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800 dark:hover:text-white",children:y?a("sessions.thread.collapse",{count:p}):a("sessions.thread.expand",{count:p})}):null]}),e.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:[_?e.jsxs(e.Fragment,{children:[t.project_ref?M("hover:text-oai-black dark:hover:text-white"):e.jsx("span",{className:"truncate",children:h}),e.jsx("span",{"aria-hidden":!0,children:"·"})]}):null,e.jsx("span",{className:"truncate",children:Be(t)}),e.jsx("span",{"aria-hidden":!0,children:"·"}),e.jsx("span",{className:"tabular-nums",children:Ge(t.started_at,s)}),f?e.jsxs(e.Fragment,{children:[e.jsx("span",{"aria-hidden":!0,children:"·"}),e.jsx("span",{className:"tabular-nums",children:f})]}):null]}),C?e.jsx("div",{className:"mt-1 text-[11px] tabular-nums text-oai-gray-500 dark:text-oai-gray-400",children:C}):null,U?e.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-x-2 text-[11px] tabular-nums text-oai-gray-400 dark:text-oai-gray-500",children:[e.jsx("span",{children:U}),S?e.jsxs(e.Fragment,{children:[e.jsx("span",{"aria-hidden":!0,children:"·"}),e.jsx("span",{children:S})]}):null]}):null]})]}),e.jsxs("div",{className:"flex items-start gap-5 pl-[30px] sm:pl-0",children:[e.jsxs("dl",{className:"flex items-start gap-6 text-right",children:[e.jsxs("div",{className:"flex w-16 flex-col-reverse",children:[e.jsx("dt",{className:"text-[11px] text-oai-gray-400 dark:text-oai-gray-500",children:a("sessions.col.tokens")}),e.jsxs("dd",{title:Number(t.subagent_total_tokens)?a("sessions.thread.tokens_summary",{own:x(t.own_total_tokens),subagents:x(t.subagent_total_tokens),combined:x(t.combined_total_tokens)}):void 0,className:"tabular-nums text-sm font-medium text-oai-black dark:text-white",children:[x(t.total_tokens),Number(t.subagent_total_tokens)?e.jsxs("span",{className:"block text-[9px] font-normal text-oai-gray-400 dark:text-oai-gray-500",children:["Σ ",x(t.combined_total_tokens)]}):null]})]}),e.jsxs("div",{className:"flex w-16 flex-col-reverse",children:[e.jsx("dt",{className:"text-[11px] text-oai-gray-400 dark:text-oai-gray-500",children:a("sessions.col.cost")}),e.jsxs("dd",{className:"tabular-nums text-sm font-medium text-oai-black dark:text-white",title:t.cost_is_partial?a("sessions.cost.partial_title"):void 0,children:[t.cost_is_partial?"≥":"",pe(t.cost_usd,{currency:j,rate:k})]})]}),e.jsxs("div",{className:"hidden w-10 flex-col-reverse sm:flex",children:[e.jsx("dt",{className:"text-[11px] text-oai-gray-400 dark:text-oai-gray-500",children:a("sessions.col.turns")}),e.jsx("dd",{className:"tabular-nums text-sm font-medium text-oai-black dark:text-white",children:x(t.turns)})]}),e.jsxs("div",{className:"hidden w-10 flex-col-reverse sm:flex",children:[e.jsx("dt",{className:"text-[11px] text-oai-gray-400 dark:text-oai-gray-500",children:a("sessions.col.edits")}),e.jsx("dd",{className:"tabular-nums text-sm font-medium text-oai-black dark:text-white",children:x(t.edit_turns)})]})]}),e.jsxs("button",{type:"button",onClick:P,disabled:!b,title:b||a("sessions.resume.unavailable"),"aria-label":b?a("sessions.resume.copy_aria",{command:b}):a("sessions.resume.unavailable"),className:F("-mt-0.5 inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",b?"text-oai-gray-500 hover:bg-oai-gray-100 hover:text-oai-black dark:text-oai-gray-400 dark:hover:bg-oai-gray-800 dark:hover:text-white":"cursor-not-allowed text-oai-gray-300 dark:text-oai-gray-600"),children:[e.jsx(Te,{className:"h-3.5 w-3.5","aria-hidden":!0}),e.jsx("span",{className:"hidden sm:inline",children:a("sessions.resume.copy")})]})]})]})});function ze({sessions:r,selectedModel:t,onSelect:s}){const{groups:m,totalTokens:p}=i.useMemo(()=>{const u=new Map;let j=0;for(const k of r)for(const w of B(k)){const f=w.model||a("sessions.model.unknown"),b=Number(w.total_tokens||0),h=u.get(f)||{model:f,count:0,tokens:0};h.count+=1,h.tokens+=b,j+=b,u.set(f,h)}return{groups:[...u.values()].sort((k,w)=>w.tokens-k.tokens),totalTokens:j}},[r]);function y(u){return F("rounded-full border px-2.5 py-1 text-xs tabular-nums transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",u?"border-oai-brand-500 bg-oai-brand-50 text-oai-brand-700 dark:bg-oai-brand-500/10 dark:text-oai-brand-300":"border-oai-gray-200 text-oai-gray-600 hover:bg-oai-gray-100 dark:border-oai-gray-700 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800")}return e.jsx("li",{className:"ml-6 border-l-2 border-oai-gray-200 py-3 pl-4 dark:border-oai-gray-800",children:e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"mr-1 text-xs font-medium text-oai-gray-500 dark:text-oai-gray-400",children:a("sessions.thread.model_usage")}),e.jsx("button",{type:"button","aria-pressed":t==="all",onClick:()=>s("all"),className:y(t==="all"),children:a("sessions.thread.model_all",{count:r.length,tokens:x(p)})}),m.map(u=>e.jsx("button",{type:"button","aria-pressed":t===u.model,onClick:()=>s(u.model),className:y(t===u.model),children:a("sessions.thread.model_item",{model:u.model,count:u.count,tokens:x(u.tokens)})},u.model))]})})}function ct(){const[r,t]=i.useState(null),[s,m]=i.useState(null),[p,y]=i.useState(!0),[u,j]=i.useState(!1),[k,w]=i.useState("all"),[f,b]=i.useState("all"),[h,D]=i.useState("all"),[g,_]=i.useState(""),[N,C]=i.useState(z),[U,S]=i.useState(()=>new Set),[I,E]=i.useState(()=>new Map),M=i.useRef(0),{resolvedLocale:P}=me(),L=i.useCallback(async(o=!1)=>{const d=++M.current;o?j(!0):y(!0),m(null);try{const n=await $e({refresh:o});d===M.current&&t(n)}catch(n){d===M.current&&m(n?.message||String(n))}finally{d===M.current&&(y(!1),j(!1))}},[]);i.useEffect(()=>{X||Z()?L(!1):y(!1)},[L]);const l=r?.sessions||Oe,v=i.useMemo(()=>{const o=new Set,d=[];for(const n of l){const c=n.project_key;!c||o.has(c)||(o.add(c),d.push({value:c,label:c}))}return d.sort((n,c)=>n.label.localeCompare(c.label))},[l]),$=i.useDeferredValue(g),R=i.useMemo(()=>{const o=$.trim().toLowerCase(),d=Ue(f);return l.filter(n=>{if(k!=="all"&&n.source!==k||h!=="all"&&n.project_key!==h||!qe(n,d))return!1;if(!o)return!0;const c=B(n).map(T=>T.model).join(" ");return`${n.title||""} ${n.project_key||""} ${c} ${n.agent_nickname||""} ${n.agent_role||""} ${n.project_ref||""} ${n.session_id||""}`.toLowerCase().includes(o)})},[l,k,h,f,$]),O=i.useMemo(()=>{const o=new Set(R.map(c=>c.session_hash)),d=new Map,n=[];for(const c of R){const A=c.root_session_hash||c.parent_session_hash;if(c.parent_session_hash&&A&&o.has(A)){const T=d.get(A)||[];T.push(c),d.set(A,T)}else n.push(c)}return{roots:n,childrenByRoot:d,foldedCount:R.length-n.length}},[R]),Q=k!=="all"||f!=="all"||h!=="all"||g.trim()!=="";i.useEffect(()=>{C(z),S(new Set),E(new Map)},[k,h,f,$,l]);const K=i.useMemo(()=>O.roots.slice(0,N),[O.roots,N]),G=O.roots.length>K.length,H=i.useCallback(()=>C(o=>o+z),[]),ne=i.useCallback(o=>{S(d=>{const n=new Set(d);return n.has(o)?n.delete(o):n.add(o),n})},[]),ie=i.useCallback((o,d)=>{E(n=>{const c=new Map(n);return d==="all"?c.delete(o):c.set(o,d),c})},[]),W=i.useRef(null);i.useEffect(()=>{if(!G||typeof IntersectionObserver>"u")return;const o=W.current;if(!o)return;const d=new IntersectionObserver(n=>{n.some(c=>c.isIntersecting)&&H()},{rootMargin:"400px"});return d.observe(o),()=>d.disconnect()},[G,H]);const le=i.useMemo(()=>Ae.map(o=>({id:o.id,label:o.label()})),[P]),ce=i.useMemo(()=>oe.map(o=>({id:o.id,label:o.label()})),[P]),de=Number(r?.session_count)>Number(r?.returned_count);return!X&&!Z()?e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx(fe,{})}):e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:e.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[e.jsxs("div",{className:"mb-8 flex flex-row items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"mb-3 text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:a("nav.sessions")}),e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400 sm:text-base",children:a("sessions.page.subtitle")})]}),e.jsx("button",{type:"button",onClick:()=>{L(!0)},disabled:u||p,"aria-label":a("sessions.page.refresh"),title:a("sessions.page.refresh"),className:"inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-oai-gray-200 text-oai-gray-600 transition-colors hover:bg-oai-gray-100 hover:text-oai-black focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-400 dark:hover:bg-oai-gray-800 dark:hover:text-white",children:e.jsx(he,{className:F("h-4 w-4",u&&"animate-spin"),"aria-hidden":!0})})]}),e.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2 pt-1 text-xs text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx(V,{ariaLabel:a("sessions.filter.source_aria"),options:le,value:k,onChange:w}),e.jsx(V,{className:"pl-2",ariaLabel:a("sessions.filter.range_aria"),leading:e.jsx(De,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-400","aria-hidden":!0}),options:ce,value:f,onChange:b}),e.jsx(Pe,{options:v,value:h,onChange:D,allLabel:a("sessions.filter.project_all"),searchPlaceholder:a("sessions.filter.project_search"),emptyLabel:a("sessions.filter.project_empty"),ariaLabel:a("sessions.filter.project_aria")}),e.jsxs("div",{className:"relative w-72 max-w-full",children:[e.jsx(ae,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-oai-gray-400","aria-hidden":!0}),e.jsx(be,{type:"search",value:g,onChange:o=>_(o.target.value),onKeyDown:o=>{o.key==="Escape"&&g&&(o.preventDefault(),_(""))},"aria-label":a("sessions.action.search_aria"),placeholder:a("sessions.search.placeholder"),className:"h-8 pl-9 pr-8 !border-oai-gray-200 dark:!border-oai-gray-800 focus:!border-oai-gray-400 focus:!ring-oai-gray-400/20 dark:focus:!border-oai-gray-500 dark:focus:!ring-oai-gray-500/20 [&::-webkit-search-cancel-button]:appearance-none"}),e.jsx("button",{type:"button",onMouseDown:o=>o.preventDefault(),onClick:()=>_(""),"aria-label":a("sessions.action.search_clear"),"aria-hidden":!g,tabIndex:g?0:-1,className:F("absolute right-2 top-1/2 flex h-6 w-6 -translate-y-1/2 items-center justify-center rounded-full text-oai-gray-400 transition duration-150 ease-out hover:bg-oai-gray-100 hover:text-oai-gray-600 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-gray-400/40 dark:hover:bg-oai-gray-800 dark:hover:text-oai-gray-200",g?"scale-100 opacity-100":"pointer-events-none scale-90 opacity-0"),children:e.jsx(ge,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),e.jsx("span",{className:"ml-auto shrink-0 tabular-nums text-oai-gray-500 dark:text-oai-gray-400",children:O.foldedCount>0?a("sessions.thread.result_count",{roots:O.roots.length,subagents:O.foldedCount}):a("sessions.filter.result_count",{filtered:R.length,total:l.length})})]}),de?e.jsx("p",{className:"mb-4 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:a("sessions.truncated",{shown:r.returned_count,total:r.session_count})}):null,s&&!r?e.jsxs("div",{className:"rounded-xl border border-dashed border-red-300 py-16 text-center dark:border-red-500/40",children:[e.jsx("p",{className:"text-sm font-medium text-oai-black dark:text-white",children:a("sessions.error.title")}),e.jsx("p",{className:"mt-1 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s}),e.jsx("button",{type:"button",onClick:()=>{L(!1)},className:"mt-4 inline-flex h-8 items-center rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 hover:text-oai-black focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:border-oai-gray-800 dark:text-oai-gray-200 dark:hover:bg-oai-gray-800 dark:hover:text-white",children:a("sessions.error.retry")})]}):p?e.jsxs("div",{className:"flex items-center gap-2 py-16 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:[e.jsx(Re,{className:"h-4 w-4 animate-spin","aria-hidden":!0}),a("sessions.loading")]}):R.length===0?e.jsxs("div",{className:"rounded-xl border border-dashed border-oai-gray-200 py-16 text-center dark:border-oai-gray-800",children:[e.jsx("p",{className:"text-sm font-medium text-oai-black dark:text-white",children:Q?a("sessions.empty.filtered_title"):a("sessions.empty.title")}),e.jsx("p",{className:"mt-1 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:Q?a("sessions.empty.filtered_body"):a("sessions.empty.body")})]}):e.jsxs(e.Fragment,{children:[s?e.jsx("p",{className:"mb-4 text-sm text-red-500 dark:text-red-400",children:a("shared.error.prefix",{error:s})}):null,e.jsx("ul",{className:"divide-y divide-oai-gray-200/70 dark:divide-oai-gray-800/70",children:K.map(o=>{const d=O.childrenByRoot.get(o.session_hash)||[],n=U.has(o.session_hash),c=I.get(o.session_hash)||"all",A=c==="all"?d:d.filter(function(ue){return B(ue).some(xe=>xe.model===c)});return e.jsxs(te.Fragment,{children:[e.jsx(Y,{session:o,locale:P,childCount:d.length,expanded:n,onToggle:()=>ne(o.session_hash)}),n&&d.length?e.jsx(ze,{sessions:d,selectedModel:c,onSelect:T=>ie(o.session_hash,T)}):null,n?A.map(T=>e.jsx(Y,{session:T,locale:P,nested:!0},T.session_hash)):null]},o.session_hash)})}),G?e.jsx("div",{ref:W,className:"flex justify-center pt-6",children:e.jsx("button",{type:"button",onClick:H,className:"inline-flex h-8 items-center rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-600 transition-colors hover:bg-oai-gray-100 hover:text-oai-black focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800 dark:hover:text-white",children:a("sessions.action.load_more")})}):null]}),e.jsx("p",{className:"mt-6 text-xs text-oai-gray-400 dark:text-oai-gray-500",children:a("sessions.privacy")})]})})})}export{ct as SessionsPage};
|