tokentracker-cli 0.76.2 → 0.77.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.de.md +10 -0
- package/README.ja.md +9 -0
- package/README.ko.md +9 -0
- package/README.md +10 -0
- package/README.zh-CN.md +9 -0
- package/dashboard/dist/assets/{ActivityHeatmap-CPGN-WN1.js → ActivityHeatmap-B7z62JlL.js} +1 -1
- package/dashboard/dist/assets/{Card-Bw438EXT.js → Card-__rwvnP4.js} +1 -1
- package/dashboard/dist/assets/ClawdAnimated-DaCAutqr.js +1 -0
- package/dashboard/dist/assets/{CommunityStatsModal--AuOLfq1.js → CommunityStatsModal-CWm0mzAf.js} +1 -1
- package/dashboard/dist/assets/{ConfirmModal-DXV9mzMw.js → ConfirmModal-B7N0Zppz.js} +1 -1
- package/dashboard/dist/assets/{Controls-D0h-lPHC.js → Controls-BTDwRDvm.js} +1 -1
- package/dashboard/dist/assets/DashboardPage-D1_icfKi.js +19 -0
- package/dashboard/dist/assets/{DevicePage-CMa1l2sC.js → DevicePage-gtfDUhRQ.js} +1 -1
- package/dashboard/dist/assets/{DialogClose-DBKCvZPm.js → DialogClose-qIxDdczo.js} +1 -1
- package/dashboard/dist/assets/DialogDescription-DbGIQcnQ.js +1 -0
- package/dashboard/dist/assets/{DialogTitle-CuhKU10w.js → DialogTitle-CSDMrQhN.js} +1 -1
- package/dashboard/dist/assets/{FadeIn-BoYq0Lpr.js → FadeIn-NsSXdhWN.js} +1 -1
- package/dashboard/dist/assets/{HeaderGithubStar-DD58NKiQ.js → HeaderGithubStar-bKcBtWVl.js} +1 -1
- package/dashboard/dist/assets/{IpCheckPage-Pw-_Uvsa.js → IpCheckPage-CE76US_W.js} +1 -1
- package/dashboard/dist/assets/{LandingPage-D2t79SLx.js → LandingPage-D41_7gBb.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardAvatar-D_fl_xuD.js → LeaderboardAvatar-Cy3g-HWp.js} +1 -1
- package/dashboard/dist/assets/LeaderboardPage-1WBDWMat.js +2 -0
- package/dashboard/dist/assets/{LeaderboardProfileModal-DSMTxieN.js → LeaderboardProfileModal-D2QG43nj.js} +3 -3
- package/dashboard/dist/assets/{LeaderboardProfilePage-neatevKp.js → LeaderboardProfilePage-v4ko4GNe.js} +2 -2
- package/dashboard/dist/assets/{LimitsPage-DqaIA0Es.js → LimitsPage-DTZULDvf.js} +1 -1
- package/dashboard/dist/assets/{LocalOnlyNotice-Ds7yPxS1.js → LocalOnlyNotice-C-ee2yBe.js} +1 -1
- package/dashboard/dist/assets/{LoginPage-7dsJbTEb.js → LoginPage-CDEH8cRz.js} +1 -1
- package/dashboard/dist/assets/PetPage-DvfRgRhO.js +1 -0
- package/dashboard/dist/assets/PopoverPopup-BLppStGT.js +1 -0
- package/dashboard/dist/assets/{ResetPasswordPage-Czaz9zzN.js → ResetPasswordPage-BiyFeB4S.js} +1 -1
- package/dashboard/dist/assets/{Select-Dk9uTtUI.js → Select-CuIsuAVQ.js} +1 -1
- package/dashboard/dist/assets/{SelectItemText-Dontd_dr.js → SelectItemText-BD39TQ1S.js} +1 -1
- package/dashboard/dist/assets/{SettingsPage-CunCphUc.js → SettingsPage-DQSVBBG9.js} +1 -1
- package/dashboard/dist/assets/SkillsPage-DaIdd4xK.js +1 -0
- package/dashboard/dist/assets/{WidgetsPage-CpAPhR3_.js → WidgetsPage-3UhcR9QZ.js} +1 -1
- package/dashboard/dist/assets/{WrappedPage-DikP22Sw.js → WrappedPage-DCVq4Xff.js} +1 -1
- package/dashboard/dist/assets/{agent-logos-D8OYqlhF.js → agent-logos-R2tmPdL9.js} +1 -1
- package/dashboard/dist/assets/{arrow-up-right-DsLWfytD.js → arrow-up-right-BHRB6j-Z.js} +1 -1
- package/dashboard/dist/assets/check-BbbG2Gcp.js +1 -0
- package/dashboard/dist/assets/{copy-BxHuZgA1.js → copy-DqnHEyjG.js} +1 -1
- package/dashboard/dist/assets/{download-tXehSjsQ.js → download-BENVX8oP.js} +1 -1
- package/dashboard/dist/assets/{format-tokens-ab57-P2J.js → format-tokens-UEB1iTo5.js} +1 -1
- package/dashboard/dist/assets/{info-Xcqww53Y.js → info-BJz0ItGV.js} +1 -1
- package/dashboard/dist/assets/link-2-DTkXHGCX.js +1 -0
- package/dashboard/dist/assets/loader-circle-CD8DppwM.js +1 -0
- package/dashboard/dist/assets/main-B8lT0e78.css +1 -0
- package/dashboard/dist/assets/{main-BQdH4mOs.js → main-D0segwJ8.js} +15 -4
- package/dashboard/dist/assets/trash-2-BkzmWJMI.js +1 -0
- package/dashboard/dist/assets/{use-community-stats-DFBJP4bf.js → use-community-stats-Bye7a_kk.js} +1 -1
- package/dashboard/dist/assets/{use-limits-display-prefs-gmXXzoWe.js → use-limits-display-prefs-Cd7QCxBh.js} +1 -1
- package/dashboard/dist/assets/{use-native-settings-BNv4MqR-.js → use-native-settings-BfB5GsUB.js} +1 -1
- package/dashboard/dist/assets/{use-ordered-list-Dl82Utll.js → use-ordered-list-CRDF6ju7.js} +1 -1
- package/dashboard/dist/assets/{use-quality-per-dollar-pref-XOF93N4q.js → use-quality-per-dollar-pref-D_UMPxxS.js} +1 -1
- package/dashboard/dist/assets/{use-usage-limits-YUhemFAp.js → use-usage-limits-D6h39bCy.js} +1 -1
- package/dashboard/dist/assets/{useCurrency-B6KHWgVk.js → useCurrency-CtAxkO0_.js} +1 -1
- package/dashboard/dist/assets/{useScrollLock-BEZTkDaR.js → useScrollLock-DFY_kQZc.js} +1 -1
- package/dashboard/dist/index.html +2 -2
- package/dashboard/dist/share.html +2 -2
- package/package.json +3 -2
- package/src/commands/status.js +44 -7
- package/src/commands/sync.js +83 -108
- package/src/lib/install-resolver.js +1 -1
- package/src/lib/local-api.js +97 -0
- package/src/lib/pet-packages.js +373 -0
- package/src/lib/pricing/seed-snapshot.json +1 -1
- package/src/lib/rollout.js +42 -28
- package/dashboard/dist/assets/ClawdAnimated-DuxB7qei.js +0 -1
- package/dashboard/dist/assets/DashboardPage-_9IPwhlZ.js +0 -19
- package/dashboard/dist/assets/DialogDescription-Dj5LvyRi.js +0 -1
- package/dashboard/dist/assets/LeaderboardPage-0jDDohE4.js +0 -2
- package/dashboard/dist/assets/PetPage-UWW1N1PL.js +0 -1
- package/dashboard/dist/assets/PopoverPopup-Bg8XtAJ5.js +0 -1
- package/dashboard/dist/assets/SkillsPage-BElcW79T.js +0 -1
- package/dashboard/dist/assets/check-CPB_1BeX.js +0 -1
- package/dashboard/dist/assets/main-zch5Z6OA.css +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as n,b9 as a}from"./main-BQdH4mOs.js";import{u as p}from"./DialogTitle-CuhKU10w.js";import{u as c}from"./useScrollLock-BEZTkDaR.js";const x=n.forwardRef(function(e,r){const{render:l,className:u,style:m,id:s,...t}=e,{store:i}=p(),o=c(s);return i.useSyncedValueWithCleanup("descriptionElementId",o),a("p",e,{ref:r,props:[{id:o},t]})});export{x as D};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/LeaderboardProfileModal-DSMTxieN.js","assets/main-BQdH4mOs.js","assets/main-zch5Z6OA.css","assets/useCurrency-B6KHWgVk.js","assets/LeaderboardAvatar-D_fl_xuD.js","assets/ActivityHeatmap-CPGN-WN1.js","assets/info-Xcqww53Y.js","assets/arrow-up-right-DsLWfytD.js","assets/check-CPB_1BeX.js","assets/DialogTitle-CuhKU10w.js","assets/useScrollLock-BEZTkDaR.js","assets/CommunityStatsModal--AuOLfq1.js","assets/format-tokens-ab57-P2J.js","assets/DialogClose-DBKCvZPm.js","assets/DialogDescription-Dj5LvyRi.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{c as la,j as e,a0 as d,r as i,N as n,av as da,aw as ca,a1 as ua,a2 as ma,ax as xa,l as ga,n as ba,ay as pa,az as ha,aA as re,aa as ya,aB as fa,h as ka,$ as wa,L as va,Q as ja,am as Ie,O as Na,aC as _a,aD as Sa,aE as Le,aF as Ca,a8 as Be,S as La}from"./main-BQdH4mOs.js";import{S as Pa}from"./Select-Dk9uTtUI.js";import{a as Ma,C as Ea,u as Aa,b as Ka,c as Pe,D as Ta,d as Ra,S as za,h as Ia,s as Ba,K as Ua,P as Oa}from"./use-ordered-list-Dl82Utll.js";import{u as $a}from"./useCurrency-B6KHWgVk.js";import{L as te}from"./LeaderboardAvatar-D_fl_xuD.js";import{u as Da}from"./use-community-stats-DFBJP4bf.js";import"./SelectItemText-Dontd_dr.js";import"./useScrollLock-BEZTkDaR.js";import"./check-CPB_1BeX.js";const Fa=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Ga=la("arrow-right",Fa),Ya=a=>{let{transform:r}=a;return{...r,y:0}};function D(a,{min:r,max:o,fallback:s}){const c=Number(a);if(!Number.isFinite(c))return s;const l=Math.floor(c);return l<r?r:l>o?o:l}function Ha(a,r){const o=D(r,{min:0,max:1e6,fallback:0}),s=D(a,{min:1,max:Math.max(1,o||1),fallback:1});if(o<=1)return[1];const c=new Set([1,o,s-2,s-1,s,s+1,s+2]),l=Array.from(c).filter(m=>Number.isInteger(m)&&m>=1&&m<=o).sort((m,h)=>m-h),b=[];let p=null;for(const m of l)p!=null&&m-p>1&&b.push(null),b.push(m),p=m;return b}function Wa({page:a,totalPages:r}){const o=typeof r=="number"&&Number.isFinite(r)&&r>=0,s=o?D(r,{min:0,max:1e6,fallback:0}):null,c=D(a,{min:1,max:o?Math.max(1,s||1):1e6,fallback:1}),l=c>1,b=o?c<s:!0;return{canPrev:l,canNext:b,safePage:c,safeTotal:s}}function Va({entries:a,me:r,meLabel:o}){const s=Array.isArray(a)?a:[],c=r&&typeof r.rank=="number"?r.rank:null;return!c||s.some(b=>!!b?.is_me)?s:[{rank:c,is_me:!0,is_pinned:!0,user_id:r?.user_id??null,display_name:o,avatar_url:r?.avatar_url??null,github_url:null,is_public:!1,gpt_tokens:r?.gpt_tokens??"0",claude_tokens:r?.claude_tokens??"0",gemini_tokens:r?.gemini_tokens??"0",cursor_tokens:r?.cursor_tokens??"0",opencode_tokens:r?.opencode_tokens??"0",openclaw_tokens:r?.openclaw_tokens??"0",hermes_tokens:r?.hermes_tokens??"0",kiro_tokens:r?.kiro_tokens??"0",copilot_tokens:r?.copilot_tokens??"0",kimi_tokens:r?.kimi_tokens??"0",other_tokens:r?.other_tokens??"0",total_tokens:r?.total_tokens??"0",estimated_cost_usd:r?.estimated_cost_usd??null},...s]}function Ja(a,r){const o=Number(a),s=Number(r);return!Number.isFinite(o)||o<1||!Number.isFinite(s)||s<1?null:Math.ceil(o/s)}const Za=new Set(["/brand-logos/cursor.svg","/brand-logos/kimi.svg","/brand-logos/kiro.svg","/brand-logos/copilot.svg","/brand-logos/hermes.svg"]);function qa({iconSrc:a,label:r}){return e.jsxs("span",{className:"inline-flex items-center gap-3",children:[a?e.jsx("img",{src:a,alt:"",width:16,height:16,className:`h-4 w-4 shrink-0 object-contain opacity-90 ${Za.has(a)?"dark:invert":""}`}):null,e.jsx("span",{className:"whitespace-nowrap",children:r})]})}const V=[{key:"gpt_tokens",copyKey:"leaderboard.column.codex",icon:"/brand-logos/codex.svg"},{key:"claude_tokens",copyKey:"leaderboard.column.claude",icon:"/brand-logos/claude-code.svg"},{key:"gemini_tokens",copyKey:"leaderboard.column.gemini",icon:"/brand-logos/gemini.svg"},{key:"cursor_tokens",copyKey:"leaderboard.column.cursor",icon:"/brand-logos/cursor.svg"},{key:"kiro_tokens",copyKey:"leaderboard.column.kiro",icon:"/brand-logos/kiro.svg"},{key:"copilot_tokens",copyKey:"leaderboard.column.copilot",icon:"/brand-logos/copilot.svg"},{key:"kimi_tokens",copyKey:"leaderboard.column.kimi",icon:"/brand-logos/kimi.svg"},{key:"opencode_tokens",copyKey:"leaderboard.column.opencode",icon:"/brand-logos/opencode.svg"},{key:"openclaw_tokens",copyKey:"leaderboard.column.openclaw",icon:"/brand-logos/openclaw.svg"},{key:"hermes_tokens",copyKey:"leaderboard.column.hermes",icon:"/brand-logos/hermes.svg"},{key:"other_tokens",copyKey:"leaderboard.column.supplemental",icon:null}],Ue="sticky left-0 z-40 w-14 min-w-14 max-w-14 sm:w-[72px] sm:min-w-[72px] sm:max-w-[72px] bg-white dark:bg-oai-gray-950 px-2.5 sm:px-4 py-4 align-middle",Oe="sticky left-[55px] sm:left-[71px] z-40 min-w-[96px] sm:min-w-[200px] max-w-[170px] sm:max-w-[min(260px,45vw)] border-l border-r border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-950 px-3 sm:px-4 py-4 align-middle";function oe(a){return d("sticky left-0 z-30 w-14 min-w-14 max-w-14 sm:w-[72px] sm:min-w-[72px] sm:max-w-[72px] px-2.5 sm:px-4 py-4 whitespace-nowrap",a?"bg-oai-brand-50 dark:bg-emerald-950":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60")}function ne(a){return d("sticky left-[55px] sm:left-[71px] z-30 hover:z-50 min-w-[96px] sm:min-w-[200px] max-w-[170px] sm:max-w-[min(260px,45vw)] border-l border-r border-oai-gray-200 dark:border-oai-gray-800 px-3 sm:px-4 py-4 min-w-0",a?"bg-oai-brand-50 dark:bg-emerald-950":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60")}function j({className:a}){return e.jsx("div",{className:d("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",a)})}function Qa({index:a}){const r=a<3?"w-24":a<8?"w-20":"w-16",o=a<3?"w-16":"w-12",s=a<5?"w-14":"w-10";return e.jsxs("tr",{className:"group",children:[e.jsx("td",{className:d(oe(!1),"!group-hover:bg-transparent"),children:e.jsx(j,{className:"h-4 w-6"})}),e.jsx("td",{className:d(ne(!1),"!group-hover:bg-transparent"),children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(j,{className:"h-8 w-8 min-w-8 rounded-full"}),e.jsx(j,{className:d("h-4",r)})]})}),e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(j,{className:d("h-4",o)})}),e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(j,{className:"h-4 w-12"})}),V.map(c=>e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(j,{className:d("h-4",s)})},c.key))]})}function Xa({rows:a=10}){return e.jsx("div",{className:"w-full overflow-x-auto",children:e.jsxs("table",{className:"min-w-max w-full text-left text-sm",children:[e.jsx("thead",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800",children:e.jsxs("tr",{children:[e.jsx("th",{className:d(Ue,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx(j,{className:"h-3.5 w-6"})}),e.jsx("th",{className:d(Oe,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx(j,{className:"h-3.5 w-12"})}),e.jsx("th",{className:"px-4 py-4",children:e.jsx(j,{className:"h-3.5 w-10"})}),e.jsx("th",{className:"px-4 py-4",children:e.jsx(j,{className:"h-3.5 w-14"})}),V.map(r=>e.jsx("th",{className:"px-4 py-4",children:e.jsx(j,{className:"h-3.5 w-12"})},r.key))]})}),e.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:Array.from({length:a},(r,o)=>e.jsx(Qa,{index:o},o))})]})})}function er({id:a,thClassName:r,children:o}){const{attributes:s,listeners:c,setNodeRef:l,transform:b,transition:p,isDragging:m}=Ma({id:a}),h=Ea.Transform.toString(b)||"";i.useLayoutEffect(()=>{const y=document.querySelectorAll(`td[data-column-key="${a}"]`),f="0 2px 10px rgba(15, 23, 42, 0.10), 0 1px 3px rgba(15, 23, 42, 0.06)";return y.forEach(x=>{x.style.transform=h,x.style.transition=p||"",x.style.zIndex=m?"20":"",x.style.position=h?"relative":"",x.style.boxShadow=m?f:""}),()=>{y.forEach(x=>{x.style.transform="",x.style.transition="",x.style.zIndex="",x.style.position="",x.style.boxShadow=""})}},[a,h,p,m]);const L={transform:h,transition:p,position:h?"relative":void 0,zIndex:m?20:void 0,boxShadow:m?"0 2px 10px rgba(15, 23, 42, 0.10), 0 1px 3px rgba(15, 23, 42, 0.06)":void 0};return e.jsx("th",{ref:l,style:L,className:d(r,"group/col select-none cursor-grab active:cursor-grabbing touch-none"),...s,...c,children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx("span",{"aria-hidden":"true",className:d("-mr-1 inline-flex h-4 w-3 shrink-0 items-center justify-center text-oai-gray-400 dark:text-oai-gray-600","opacity-0 transition-opacity duration-150 group-hover/col:opacity-100",m&&"opacity-100"),children:e.jsxs("svg",{viewBox:"0 0 8 14",width:"8",height:"14",fill:"currentColor","aria-hidden":"true",children:[e.jsx("circle",{cx:"2",cy:"2",r:"1"}),e.jsx("circle",{cx:"6",cy:"2",r:"1"}),e.jsx("circle",{cx:"2",cy:"7",r:"1"}),e.jsx("circle",{cx:"6",cy:"7",r:"1"}),e.jsx("circle",{cx:"2",cy:"12",r:"1"}),e.jsx("circle",{cx:"6",cy:"12",r:"1"})]})}),o]})})}const ar="tokentracker.leaderboard.columnOrder.v1";function rr(a){return Aa(ar,a)}const tr=50;function or(a,r){const o=Number(a),s=Number(r);return!Number.isFinite(o)||o<1||!Number.isFinite(s)||s<1?null:Math.min(100,Math.max(1,Math.ceil(o/s*100)))}function $e(a){return typeof a=="string"?a.trim():""}function nr(a){const r=$e(a);return r?r.toLowerCase()==="anonymous":!0}function sr({me:a,totalEntries:r,meLabel:o,onOpenProfile:s,onJumpToMe:c,canJump:l,className:b}){const p=a&&typeof a.rank=="number"?a.rank:null;if(!p)return null;const m=Number(r)||0,h=or(p,m),L=$e(a?.display_name),y=!L||nr(L)?o||"You":L,f=a?.user_id||y,x=s||(l?c:null),E=typeof x=="function",A=E?"button":"div",J=E?{type:"button",onClick:x,"aria-label":n(s?"leaderboard.summary.view_profile":"leaderboard.summary.jump_to_me")}:{};return e.jsxs(A,{...J,className:d("group inline-flex h-9 items-center gap-2.5 rounded-full border pl-1 pr-3.5 transition-all duration-300 select-none",E?"border-oai-gray-200 hover:border-oai-brand-400 dark:border-oai-gray-800 dark:hover:border-oai-brand-500/80 bg-oai-gray-50/50 dark:bg-white/[0.02] backdrop-blur-md hover:bg-oai-brand-50/40 dark:hover:bg-oai-brand-950/20 active:scale-[0.97] dark:ring-1 dark:ring-white/[0.04] dark:hover:ring-white/[0.08]":"border-oai-gray-100 dark:border-oai-gray-800/60 bg-oai-gray-50/20 dark:bg-white/[0.01] backdrop-blur-sm dark:ring-1 dark:ring-white/[0.02]",b),children:[e.jsx(te,{size:"sm",avatarUrl:a?.avatar_url,displayName:y,seed:f}),e.jsx("span",{className:"hidden sm:inline max-w-[120px] truncate text-xs font-semibold text-oai-black dark:text-oai-gray-200 group-hover:text-oai-brand-600 dark:group-hover:text-oai-brand-400 transition-colors",children:y}),e.jsxs("span",{className:"text-xs font-bold tabular-nums text-oai-gray-800 dark:text-white",children:["#",p.toLocaleString()]}),h!=null&&h<=tr&&e.jsx("span",{className:d("hidden sm:inline-flex items-center rounded-full px-2 py-0.5 text-[9px] font-extrabold tracking-wider tabular-nums uppercase transition-colors duration-300 ring-1",h<=10?"bg-amber-500/10 text-amber-600 dark:bg-amber-500/15 dark:text-amber-400 ring-amber-500/20":"bg-oai-brand-100/50 text-oai-brand-700 dark:bg-oai-brand-500/10 dark:text-oai-brand-400 ring-oai-brand-500/10"),children:n("leaderboard.summary.percentile",{p:String(h)})}),E?e.jsx(Ga,{"aria-hidden":!0,className:"size-3 text-oai-gray-400 transition-all duration-300 group-hover:text-oai-brand-500 dark:text-oai-gray-500 group-hover:translate-x-0.5 group-hover:scale-110"}):e.jsxs("span",{className:"relative flex h-1.5 w-1.5 shrink-0 items-center justify-center ml-1",title:"You are here",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-emerald-400 opacity-75 duration-1000"}),e.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-emerald-500"})]})]})}const ir=i.lazy(()=>Be(()=>import("./LeaderboardProfileModal-DSMTxieN.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])).then(a=>({default:a.LeaderboardProfileModal}))),lr=i.lazy(()=>Be(()=>import("./CommunityStatsModal--AuOLfq1.js"),__vite__mapDeps([11,1,2,12,9,10,13,14])).then(a=>({default:a.CommunityStatsModal}))),se=[10,20,50,100],ie=20,De="tokentracker:leaderboard:pageSize";function dr(){if(typeof window>"u")return ie;try{const a=window.localStorage.getItem(De),r=Number(a);if(se.includes(r))return r}catch{}return ie}function Me(a,r,o){const s=Number(a);if(!Number.isFinite(s)||s<=0)return"-";const c=Na(r),l=r===La?s:s*o;return l>=1e3?`${c}${Math.round(l).toLocaleString()}`:l>=10?`${c}${Math.round(l)}`:`${c}${l.toFixed(2)}`}function Ee({value:a}){return e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"sm:hidden",children:ja(a)}),e.jsx("span",{className:"hidden sm:inline",children:Ie(a)})]})}function cr({communityStats:a,onClick:r}){return a.status!=="ready"?null:e.jsxs("button",{type:"button",onClick:r,className:"inline-flex h-9 items-center gap-2.5 rounded-full border border-oai-gray-200 dark:border-oai-gray-800 bg-oai-gray-50/50 dark:bg-white/[0.02] backdrop-blur-md px-3.5 select-none text-xs text-oai-gray-500 dark:text-oai-gray-400 hover:border-oai-brand-400 dark:hover:border-oai-brand-500/80 hover:bg-oai-brand-50/40 dark:hover:bg-oai-brand-950/20 transition-all duration-300 active:scale-[0.97] cursor-pointer",title:n("leaderboard.community.view_stats"),children:[e.jsxs("span",{className:"relative flex h-1.5 w-1.5 shrink-0","aria-hidden":"true",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-emerald-500/80 opacity-75 duration-1000"}),e.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-emerald-500"})]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"font-semibold text-oai-black dark:text-white tabular-nums",children:Math.round(a.tokenFloor).toLocaleString("en-US")}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:n("leaderboard.community.tokens_chip")})]}),e.jsx("span",{className:"text-oai-gray-200 dark:text-oai-gray-800 select-none",children:"·"}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"font-semibold text-oai-black dark:text-white tabular-nums",children:(Number(a.totalEntries)||0).toLocaleString("en-US")}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:n("leaderboard.community.devs_chip")})]})]})}function Ae(a,r,o){const s=r?"text-oai-gray-700 dark:text-oai-gray-300":"text-oai-gray-500 dark:text-oai-gray-400",c=r?"bg-oai-brand-50 dark:bg-oai-brand-900/10":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60";return o.map(l=>e.jsx("td",{"data-column-key":l.key,className:d("hidden sm:table-cell px-3 sm:px-4 py-4 whitespace-nowrap text-right tabular-nums",s,c),children:Ie(a?.[l.key])},l.key))}const ur={1:{text:"text-amber-600 dark:text-amber-400",badge:"bg-amber-50 dark:bg-amber-900/20"},2:{text:"text-gray-500 dark:text-gray-300",badge:"bg-gray-50 dark:bg-gray-800/40"},3:{text:"text-orange-700 dark:text-orange-400",badge:"bg-orange-50 dark:bg-orange-900/20"}};function Ke({rank:a,placeholder:r}){const o=ur[a];return o?e.jsx("span",{className:d("inline-flex items-center justify-center h-7 w-7 rounded-full text-xs font-bold",o.text,o.badge),children:a}):e.jsx("span",{className:"inline-flex items-center justify-center h-7 w-7 text-sm",children:a??r})}function Te(a){if(typeof a!="string")return null;const r=a.trim().toLowerCase();return r==="week"||r==="month"||r==="total"?r:null}function mr(a){if(!a)return n("shared.error.prefix",{error:n("leaderboard.error.unknown")});const r=a?.message||String(a),o=String(r||"").trim()||n("leaderboard.error.unknown");return n("shared.error.prefix",{error:o})}function Fe(a){return typeof a!="string"?"":a.trim()}function xr(a){const r=Fe(a);return r?r.toLowerCase()==="anonymous":!0}function Re(a,r){const o=typeof a?.user_id=="string"?a.user_id.trim():"";return o||`${a?.rank??""}:${r}`}function ze({githubUrl:a}){return e.jsxs("span",{className:"relative inline-flex items-center group/gh shrink-0",children:[e.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",onClick:r=>r.stopPropagation(),"aria-label":n("leaderboard.github.aria"),className:"text-oai-black hover:text-oai-gray-500 dark:text-white dark:hover:text-oai-gray-400 transition-colors",children:e.jsx(wa,{provider:"GITHUB",size:16})}),e.jsxs("span",{role:"tooltip",className:"invisible opacity-0 group-hover/gh:visible group-hover/gh:opacity-100 absolute right-0 bottom-full mb-2 whitespace-nowrap rounded-md bg-oai-black dark:bg-oai-gray-700 px-2.5 py-1.5 text-[11px] leading-relaxed text-white shadow-lg transition-opacity duration-150 z-50 before:content-[''] before:absolute before:inset-x-0 before:top-full before:h-2.5",children:[e.jsx("span",{className:"block",children:n("leaderboard.github.tooltipAction")}),e.jsxs("span",{className:"block text-oai-gray-300 dark:text-oai-gray-400",children:[n("leaderboard.github.tooltipPrefix")," ",e.jsx(va,{to:"/settings",onClick:r=>r.stopPropagation(),className:"text-white underline underline-offset-2 decoration-oai-gray-400 hover:text-oai-brand-300 hover:decoration-oai-brand-300",children:n("leaderboard.github.tooltipSettingsLink")}),n("leaderboard.github.tooltipSuffix")]})]})]})}function _r({auth:a,signedIn:r,sessionSoftExpired:o}){const s=da(),c=ca(),{openLoginModal:l}=ua(),{signedIn:b,loading:p,user:m}=ma(),{currency:h,rate:L}=$a(),y=i.useMemo(()=>xa(),[]),f=ga(),x=r&&!o,E=i.useMemo(()=>x&&(typeof a=="function"||typeof a=="string"||a&&typeof a=="object")?a:null,[a,x]),A=x?E:null,J=x&&ba(A),le=n("shared.placeholder.short"),Ge=i.useMemo(()=>V.map(t=>t.key),[]),{order:Z,reorder:de}=rr(Ge),ce=i.useMemo(()=>{const t=new Map;for(const u of V)t.set(u.key,u);return t},[]),F=i.useMemo(()=>Z.map(t=>ce.get(t)).filter(Boolean),[Z,ce]),Ye=Ka(Pe(Oa,{activationConstraint:{distance:6}}),Pe(Ua,{coordinateGetter:Ba})),He=i.useCallback(t=>{const{active:u,over:w}=t;!w||u.id===w.id||de(String(u.id),String(w.id))},[de]),[q,P]=i.useState(1),[N,We]=i.useState(dr),[ue,me]=i.useState(null),[Ve,xe]=i.useState(!1),Q=i.useCallback(t=>{typeof t=="string"&&t.trim()&&me(t.trim())},[]),Je=i.useCallback(()=>me(null),[]),Ze=i.useCallback(t=>{const u=se.includes(t)?t:ie;We(u),P(1);try{window.localStorage.setItem(De,String(u))}catch{}},[]),[ge,qe]=i.useState(0),[Qe,Xe]=i.useState(()=>pa()),[be,pe]=i.useState(!1),v=i.useMemo(()=>{const t=new URLSearchParams(s?.search||"");return Te(t.get("period"))||"total"},[s?.search]),ea=t=>{const u=Te(t);if(!u||u===v)return;const w=new URLSearchParams(s?.search||"");w.set("period",u),P(1),c(`${s?.pathname||"/leaderboard"}?${w.toString()}`,{replace:!0})};i.useEffect(()=>{p||f||b||l()},[b,p,f,l]),i.useEffect(()=>{P(1)},[v]);const G=i.useMemo(()=>(D(q,{min:1,max:1e6,fallback:1})-1)*N,[q,N]),K=i.useMemo(()=>f?"mock":p?"unavailable":b?"cloud":r?"local":y?"public":"unavailable",[p,b,y,f,r]),g=i.useMemo(()=>ha({accessMode:K,baseUrl:y,mockEnabled:f,userId:m?.id||null,period:v,pageSize:N,offset:G}),[m?.id,K,y,G,f,N,v]),[I,B]=i.useState(()=>{const t=re(g);return t?{loading:!1,error:null,data:t.data,contextKey:g}:{loading:!1,error:null,data:null,contextKey:null}});i.useEffect(()=>{if(!y&&!f||!f&&K==="unavailable"){B({loading:!1,error:null,data:null,contextKey:null});return}const t=re(g);let u=!0;return B(t?{loading:!1,error:null,data:t.data,contextKey:g}:{loading:!0,error:null,data:null,contextKey:null}),(async()=>{const w=await ya({userId:m?.id||null,period:v,limit:N,offset:G});u&&(fa(w,{activeContextKey:g,contextKey:g,source:ge>0?"manual-refresh":"page-load"}),B({loading:!1,error:null,data:w,contextKey:g}))})().catch(w=>{if(!u)return;const z=mr(w);B(O=>O.contextKey===g?{...O,loading:!1,error:z}:{loading:!1,error:z,data:null,contextKey:g})}),()=>{u=!1}},[y,K,m?.id,g,G,ge,f,v,N]);const X=i.useMemo(()=>I.contextKey===g?null:re(g),[g,I.contextKey]),k=i.useMemo(()=>I.contextKey===g?I:X?{loading:!1,error:null,data:X.data,contextKey:g}:{loading:!!(y||f)&&K!=="unavailable",error:null,data:null,contextKey:g},[K,y,g,I,f,X]),_=k.data,Y=_?.total_pages??null,aa=_?.total_entries??0,T=_?.page??q,ra=i.useMemo(()=>Ha(T,Y),[T,Y]),he=_?.from||null,ye=_?.to||null,fe=_?.generated_at||null,ke=Da(),M=_?.me||null,H=n("leaderboard.me_label"),ta=n("leaderboard.anon_label"),we=n("leaderboard.period.week"),ve=n("leaderboard.period.month"),je=n("leaderboard.period.total"),Ne=v==="month"?ve:v==="total"?je:we,ee=i.useMemo(()=>{const t=Array.isArray(_?.entries)?_.entries:[];return Va({entries:t,me:M,meLabel:H})},[_?.entries,M,H]),R=i.useMemo(()=>Ja(M?.rank,N),[M?.rank,N]),oa=R!=null&&R===T,na=i.useCallback(()=>{R!=null&&P(R)},[R]),sa=async()=>{pe(!0);try{_a(!0),Xe(!0),await Sa(()=>Le(A));const t=await Le(A);t&&await Ca({accessToken:t,period:v,source:"leaderboard-enable-sync"}),qe(u=>u+1)}catch(t){console.warn("[tokentracker] sync:",t)}finally{pe(!1)}},{canPrev:_e,canNext:Se}=Wa({page:T,totalPages:Y}),W=Array.isArray(ee)&&ee.length!==0;let U=null;k.loading&&!W?U=e.jsx(Xa,{rows:N}):k.error&&!W?U=e.jsx("div",{className:"px-6 py-12 text-center",children:e.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:k.error})}):W?U=e.jsx(Ta,{sensors:Ye,collisionDetection:Ra,modifiers:[Ya],onDragEnd:He,children:e.jsx("div",{className:"w-full overflow-x-auto",children:e.jsxs("table",{className:"min-w-full sm:min-w-max w-full text-left text-sm",children:[e.jsx("thead",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800",children:e.jsxs("tr",{children:[e.jsx("th",{className:d(Ue,"text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500"),children:n("leaderboard.column.rank")}),e.jsx("th",{className:d(Oe,"text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500"),children:n("leaderboard.column.user")}),e.jsx("th",{className:"px-3 sm:px-4 py-4 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500 whitespace-nowrap text-right align-middle",children:n("leaderboard.column.total")}),e.jsx("th",{className:"hidden sm:table-cell px-3 sm:px-4 py-4 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500 whitespace-nowrap text-right align-middle",title:"Based on estimated API pricing, not actual billing",children:n("leaderboard.column.est_cost")}),e.jsx(za,{items:Z,strategy:Ia,children:F.map(t=>e.jsx(er,{id:t.key,thClassName:"hidden sm:table-cell px-3 sm:px-4 py-4 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500 whitespace-nowrap align-middle",children:e.jsx(qa,{iconSrc:t.icon,label:n(t.copyKey)})},t.key))})]})}),e.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:ee.map((t,u)=>{if(t?.is_ellipsis){const C=4+F.length;return e.jsx("tr",{"aria-hidden":"true",children:e.jsx("td",{colSpan:C,className:"px-4 py-2 text-center text-oai-gray-400 dark:text-oai-gray-600 bg-white dark:bg-oai-gray-950 select-none tracking-[0.4em] text-xs",children:"···"})},`ellipsis-${u}`)}const w=!!t?.is_me,z=typeof t?.user_id=="string"?t.user_id:null,O=Fe(t?.display_name),ia=xr(O)?ta:O,S=w?H:ia,$=!!z,Ce=$?{role:"button",tabIndex:0,onClick:$?()=>Q(z):void 0,onKeyDown:$?C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),Q(z))}:void 0,"aria-label":n("leaderboard.profile_modal.row_aria",{name:S})}:{};if(w){const C=!!t?.is_pinned;return e.jsxs("tr",{...Ce,className:d("bg-oai-brand-50 dark:bg-oai-brand-900/10 transition-colors",C?"border-t border-b border-oai-brand-300/40 dark:border-oai-brand-500/20":"border-y border-oai-brand-300/40 dark:border-oai-brand-500/30",$&&"cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500/60"),children:[e.jsx("td",{className:d(oe(!0),"font-semibold text-oai-brand-600 dark:text-oai-brand-400",C&&"before:absolute before:left-0 before:top-[15%] before:h-[70%] before:w-[3px] before:rounded-r before:bg-oai-brand-500 dark:before:bg-oai-brand-400"),children:e.jsx(Ke,{rank:t?.rank,placeholder:le})}),e.jsx("td",{className:ne(!0),children:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(te,{avatarUrl:t?.avatar_url,displayName:S,seed:Re(t,S)}),e.jsx("span",{className:"truncate font-semibold text-oai-black dark:text-oai-white",children:S}),t?.github_url&&e.jsx(ze,{githubUrl:t.github_url})]})}),e.jsx("td",{className:"px-3 sm:px-4 py-4 font-medium text-oai-black dark:text-oai-white whitespace-nowrap text-right tabular-nums bg-oai-brand-50 dark:bg-oai-brand-900/10",children:e.jsx(Ee,{value:t?.total_tokens})}),e.jsx("td",{className:"hidden sm:table-cell px-3 sm:px-4 py-4 font-medium text-oai-brand-600 dark:text-oai-brand-400 whitespace-nowrap text-right tabular-nums bg-oai-brand-50 dark:bg-oai-brand-900/10",title:"Based on estimated API pricing, not actual billing",children:Me(t?.estimated_cost_usd,h,L)}),Ae(t,!0,F)]},`row-${t?.rank}-${S}${C?"-pin":""}`)}return e.jsxs("tr",{...Ce,className:d("group transition-colors",$&&"cursor-pointer hover:bg-oai-gray-50 dark:hover:bg-oai-gray-900/60 focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500/60"),children:[e.jsx("td",{className:d(oe(!1),"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx(Ke,{rank:t?.rank,placeholder:le})}),e.jsx("td",{className:ne(!1),children:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(te,{avatarUrl:t?.avatar_url,displayName:S,seed:Re(t,S)}),e.jsx("span",{className:"truncate font-medium text-oai-gray-800 dark:text-oai-gray-200",children:S}),t?.github_url&&e.jsx(ze,{githubUrl:t.github_url})]})}),e.jsx("td",{className:"px-3 sm:px-4 py-4 font-semibold text-oai-gray-800 dark:text-oai-gray-200 whitespace-nowrap text-right tabular-nums bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60",children:e.jsx(Ee,{value:t?.total_tokens})}),e.jsx("td",{className:"hidden sm:table-cell px-3 sm:px-4 py-4 text-oai-gray-500 dark:text-oai-gray-400 whitespace-nowrap text-right tabular-nums bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60",title:"Based on estimated API pricing, not actual billing",children:Me(t?.estimated_cost_usd,h,L)}),Ae(t,!1,F)]},`row-${t?.rank}-${S}`)})})]})})}):U=e.jsx("div",{className:"px-6 py-12 text-center",children:e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:n("leaderboard.empty")})});let ae=null;return typeof Y=="number"?ae=ra.map((t,u)=>t==null?e.jsx("span",{className:"px-2 text-oai-gray-400 dark:text-oai-gray-500",children:n("leaderboard.pagination.ellipsis")},`ellipsis-${u}`):e.jsx("button",{className:d("flex h-8 w-8 items-center justify-center rounded-md text-sm font-medium transition-colors",t===T?"bg-oai-gray-200 dark:bg-oai-gray-800 text-oai-black dark:text-white":"text-oai-gray-500 dark:text-oai-gray-400 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white"),onClick:()=>P(t),disabled:k.loading,children:String(t)},`page-${t}`)):ae=e.jsx("span",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:n("leaderboard.pagination.page_unknown",{page:String(T)})}),e.jsxs("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:[e.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:e.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[e.jsxs("div",{className:"mb-5 sm:mb-6",children:[e.jsx("h1",{className:"text-3xl sm:text-4xl font-semibold tracking-tight text-oai-black dark:text-white mb-2 sm:mb-3",children:n("leaderboard.title")}),e.jsxs("p",{className:"text-oai-gray-500 dark:text-oai-gray-400 text-sm sm:text-base",children:[v==="total"?n("leaderboard.range.total"):he&&ye?n("leaderboard.range",{period:Ne,from:he,to:ye}):n("leaderboard.range_loading",{period:Ne}),fe&&e.jsx("span",{className:"ml-2 pl-2 border-l border-oai-gray-200 dark:border-oai-gray-800 hidden sm:inline-block text-oai-gray-400 dark:text-oai-gray-500 text-xs",children:n("leaderboard.generated_at",{ts:fe})})]})]}),e.jsxs("div",{className:"mb-6 sm:mb-8 flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsx("div",{className:"inline-flex h-9 p-1 border border-oai-gray-200 dark:border-oai-gray-800 rounded-full items-center relative self-start",children:["week","month","total"].map(t=>{const u=v===t;return e.jsxs("button",{onClick:()=>ea(t),disabled:k.loading,className:d("px-3 sm:px-4 h-7 text-sm font-medium rounded-full flex items-center justify-center transition-colors relative",u?"text-oai-black dark:text-white":"text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-800 dark:hover:text-oai-gray-200"),children:[e.jsx("span",{className:"relative z-10",children:t==="week"?we:t==="month"?ve:je}),u&&e.jsx(ka.div,{layoutId:"leaderboard-period-active-bg",className:"absolute inset-0 bg-oai-gray-200 dark:bg-oai-gray-800 rounded-full z-0",transition:{type:"spring",stiffness:380,damping:30}})]},t)})}),e.jsxs("div",{className:"flex flex-row items-center gap-2.5 self-end sm:self-auto shrink-0 flex-wrap",children:[e.jsx(cr,{communityStats:ke,onClick:()=>xe(!0)}),e.jsx(sr,{me:M,totalEntries:aa,meLabel:H,onOpenProfile:M?.user_id?()=>Q(M.user_id):void 0,onJumpToMe:na,canJump:R!=null&&!oa&&!k.loading,className:"shrink-0"})]})]}),!r&&e.jsxs("div",{className:"mb-6 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between text-sm",children:[e.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:n("leaderboard.signin_prompt")}),e.jsx("button",{onClick:l,className:"shrink-0 whitespace-nowrap self-start sm:self-auto px-3 py-1.5 text-sm font-medium text-oai-gray-600 dark:text-oai-gray-300 border border-oai-gray-300 dark:border-oai-gray-700 rounded-md hover:text-oai-black dark:hover:text-white hover:border-oai-gray-400 dark:hover:border-oai-gray-600 transition-colors",children:n("leaderboard.signin_button")})]}),x&&J&&!Qe&&e.jsxs("div",{className:"mb-6 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between text-sm",children:[e.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:n("leaderboard.sync_prompt")}),e.jsx("button",{onClick:sa,disabled:be,className:"shrink-0 whitespace-nowrap self-start sm:self-auto px-3 py-1.5 text-sm font-medium text-oai-gray-600 dark:text-oai-gray-300 border border-oai-gray-300 dark:border-oai-gray-700 rounded-md hover:text-oai-black dark:hover:text-white hover:border-oai-gray-400 dark:hover:border-oai-gray-600 disabled:opacity-50 transition-colors",children:be?n("leaderboard.sync_button.busy"):n("leaderboard.sync_button.idle")})]}),e.jsxs("div",{className:"rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 overflow-hidden",children:[k.error&&W?e.jsx("div",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800 px-6 py-3",children:e.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:k.error})}):null,U,e.jsxs("div",{className:"px-6 py-3 border-t border-oai-gray-200 dark:border-oai-gray-800 flex flex-wrap items-center justify-end gap-x-4 gap-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:[e.jsx("label",{htmlFor:"leaderboard-page-size",className:"whitespace-nowrap",children:n("leaderboard.pagination.page_size_label")}),e.jsx(Pa,{id:"leaderboard-page-size",value:N,onValueChange:t=>Ze(Number(t)),disabled:k.loading,ariaLabel:n("leaderboard.pagination.page_size_label"),options:se.map(t=>({value:t,label:String(t)})),align:"end",className:"px-3 py-1 text-oai-gray-700 dark:text-oai-gray-300"})]}),e.jsx("div",{className:"h-5 w-px bg-oai-gray-200 dark:bg-oai-gray-800","aria-hidden":"true"}),e.jsx("button",{className:d("px-3 py-1.5 text-sm font-medium text-oai-gray-500 dark:text-oai-gray-400 rounded-md transition-colors",_e&&!k.loading?"hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white":"opacity-50 cursor-not-allowed"),onClick:()=>P(t=>Math.max(1,t-1)),disabled:!_e||k.loading,children:n("leaderboard.pagination.prev")}),e.jsx("div",{className:"flex flex-wrap items-center gap-1",children:ae}),e.jsx("button",{className:d("px-3 py-1.5 text-sm font-medium text-oai-gray-500 dark:text-oai-gray-400 rounded-md transition-colors",Se&&!k.loading?"hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white":"opacity-50 cursor-not-allowed"),onClick:()=>P(t=>t+1),disabled:!Se||k.loading,children:n("leaderboard.pagination.next")})]})]})]})}),e.jsx("footer",{className:"border-t border-oai-gray-200 dark:border-oai-gray-900 py-8 transition-colors duration-200",children:e.jsxs("div",{className:"mx-auto flex max-w-6xl items-center justify-between px-4 sm:px-6 text-sm text-oai-gray-400 dark:text-oai-gray-500",children:[e.jsx("p",{children:n("landing.v2.footer.line")}),e.jsx("a",{href:"https://github.com/mm7894215/TokenTracker",className:"text-oai-gray-400 dark:text-oai-gray-500 hover:text-oai-black dark:hover:text-white transition-colors",target:"_blank",rel:"noopener noreferrer",children:n("landing.v2.nav.github")})]})}),e.jsxs(i.Suspense,{fallback:null,children:[e.jsx(ir,{isOpen:!!ue,userId:ue,period:v,accessToken:A,onClose:Je}),e.jsx(lr,{isOpen:Ve,onClose:()=>xe(!1),communityStats:ke})]})]})}export{_r as LeaderboardPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as h,aI as v,d5 as j,r as n,d6 as N,d7 as w,d8 as S,N as t,j as e,a0 as x}from"./main-BQdH4mOs.js";import{T as z,b as C}from"./Controls-D0h-lPHC.js";import{n as K,C as p}from"./ClawdAnimated-DuxB7qei.js";import{F as b}from"./FadeIn-BoYq0Lpr.js";import"./Card-Bw438EXT.js";const P=[["path",{d:"m9 10 3-3 3 3",key:"11gsxs"}],["path",{d:"M12 13V7",key:"h0r20n"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]],A=h("monitor-up",P);const E=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],I=h("zap",E),_={visible:!1,character:"clawd",size:"medium"};function R(){const r=v()&&j(),[i,s]=n.useState(_);n.useEffect(()=>{if(!r)return;const d=N(a=>{s({visible:!!a.visible,character:K(a.character),size:["small","medium","large"].includes(a.size)?a.size:"medium"})});return w(),d},[r]);const o=n.useCallback((d,a)=>{s(c=>({...c,[d]:a})),r&&S(d,a)},[r]);return{available:r,settings:i,setSetting:o}}const T=[{id:"clawd",nameKey:"pet.character.clawd",tint:"from-oai-amber-50 dark:from-orange-950/70"},{id:"sprout",nameKey:"pet.character.sprout",tint:"from-oai-brand-100 dark:from-emerald-950/70"},{id:"byte",nameKey:"pet.character.byte",tint:"from-oai-gray-200 dark:from-slate-800/70"},{id:"ember",nameKey:"pet.character.ember",tint:"from-orange-100 dark:from-orange-950/80"}],m=[{id:"idle-living",labelKey:"pet.state.calm"},{id:"working-thinking",labelKey:"pet.state.focus"},{id:"working-juggling",labelKey:"pet.state.multitask"},{id:"working-wizard",labelKey:"pet.state.streak"},{id:"happy",labelKey:"pet.state.celebrate"},{id:"sleeping",labelKey:"pet.state.rest"}];function M({character:r,selected:i,onSelect:s}){return e.jsxs("button",{type:"button",onClick:s,"aria-pressed":i,className:x("group relative overflow-hidden rounded-xl border p-2.5 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",i?"border-oai-brand-500/40 bg-white dark:border-oai-brand-500/25 dark:bg-oai-gray-900/80":"border-oai-gray-200/80 bg-white/55 hover:border-oai-gray-400 dark:border-oai-gray-800 dark:bg-oai-gray-950/55 dark:hover:border-oai-gray-600"),children:[e.jsx("div",{className:x("absolute inset-0 bg-gradient-to-br to-transparent opacity-80 dark:opacity-55",r.tint)}),e.jsxs("div",{className:"relative flex items-center gap-2.5",children:[e.jsx("div",{className:"flex h-12 w-12 shrink-0 items-center justify-center rounded-lg bg-white/70 dark:bg-black/15",children:e.jsx(p,{state:"idle-living",character:r.id,size:44})}),e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-semibold text-oai-black dark:text-white",children:t(r.nameKey)}),i?e.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-oai-brand-500","aria-hidden":!0}):null]})]})]})}function L({character:r,state:i,onStateChange:s}){const o=m.find(function(c){return c.id===i}),d=t(o?.labelKey||"pet.state.calm");return e.jsxs("section",{className:"relative flex min-h-[400px] flex-col overflow-hidden bg-oai-gray-50 dark:bg-oai-gray-950 sm:min-h-[440px] lg:min-h-[480px]",children:[e.jsx("div",{className:"absolute inset-0 opacity-[0.16] dark:opacity-[0.12]",style:{backgroundImage:"radial-gradient(currentColor 0.7px, transparent 0.7px)",backgroundSize:"14px 14px"},"aria-hidden":!0}),e.jsxs("div",{className:"relative flex items-center justify-between gap-3 px-5 pt-5",children:[e.jsx("span",{className:"text-xs font-semibold uppercase tracking-[0.14em] text-oai-gray-500 dark:text-oai-gray-400",children:t("pet.preview.states")}),e.jsxs("div",{className:"flex items-center gap-2 rounded-full border border-black/5 bg-white/65 px-3 py-1.5 text-[11px] font-medium text-oai-gray-600 backdrop-blur-md dark:border-white/10 dark:bg-black/20 dark:text-oai-gray-300",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500","aria-hidden":!0}),d]})]}),e.jsx("div",{className:"relative flex flex-1 items-center justify-center px-6 py-5",children:e.jsxs("div",{className:"relative flex h-52 w-52 items-center justify-center sm:h-56 sm:w-56",children:[e.jsx("div",{className:"absolute bottom-5 h-3 w-28 rounded-full bg-black/10 blur-sm dark:bg-black/35","aria-hidden":!0}),e.jsx(p,{state:i,character:r,size:190})]})}),e.jsx("div",{className:"relative border-t border-oai-gray-200/70 bg-white/70 px-3 py-2 backdrop-blur-sm dark:border-oai-gray-800 dark:bg-oai-gray-950/70",children:e.jsx("div",{className:"grid grid-cols-3 gap-1","aria-label":t("pet.preview.states"),children:m.map(a=>e.jsxs("button",{type:"button",onClick:()=>s(a.id),"aria-pressed":i===a.id,className:x("flex min-h-10 flex-col items-center justify-center gap-1 rounded-lg px-1.5 text-xs transition-colors duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-oai-brand-500",i===a.id?"font-semibold text-oai-black dark:text-white":"font-medium text-oai-gray-500 hover:text-oai-black dark:text-oai-gray-400 dark:hover:text-white"),children:[e.jsx("span",{children:t(a.labelKey)}),e.jsx("span",{className:x("h-1 w-1 rounded-full transition-colors duration-200",i===a.id?"bg-oai-black dark:bg-white":"bg-transparent"),"aria-hidden":!0})]},a.id))})})]})}function W(){const{available:r,settings:i,setSetting:s}=R(),[o,d]=n.useState("idle-living"),[a,c]=n.useState(!0),g=i.character||"clawd";n.useEffect(()=>{if(!a)return;const l=window.setInterval(()=>{d(f=>{const y=m.findIndex(k=>k.id===f);return m[(y+1)%m.length].id})},5e3);return()=>window.clearInterval(l)},[a]);const u=[{value:"small",label:t("pet.size.small")},{value:"medium",label:t("pet.size.medium")},{value:"large",label:t("pet.size.large")}];return e.jsx("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:e.jsx("main",{className:"flex-1 pb-14 pt-8 sm:pt-10",children:e.jsxs("div",{className:"mx-auto max-w-5xl px-4 sm:px-6",children:[e.jsx(b,{y:12,children:e.jsxs("header",{className:"mb-8",children:[e.jsx("h1",{className:"text-3xl font-semibold tracking-tight sm:text-4xl",children:t("pet.page.title")}),e.jsx("p",{className:"mt-2 max-w-2xl text-sm leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:t("pet.page.subtitle")})]})}),e.jsx(b,{y:12,delay:.04,children:e.jsxs("div",{className:"overflow-hidden rounded-[28px] border border-oai-gray-200 bg-white/75 dark:border-oai-gray-800 dark:bg-oai-gray-900/60 lg:grid lg:grid-cols-[1.12fr_0.88fr]",children:[e.jsx(L,{character:g,state:o,onStateChange:l=>{c(!1),d(l)}}),e.jsxs("aside",{className:"flex flex-col border-t border-oai-gray-200 p-5 dark:border-oai-gray-800 lg:min-h-[480px] lg:border-l lg:border-t-0",children:[e.jsxs("section",{"aria-labelledby":"pet-character-title",children:[e.jsxs("div",{children:[e.jsx("h2",{id:"pet-character-title",className:"text-sm font-semibold",children:t("pet.characters.title")}),e.jsx("p",{className:"mt-1 text-xs leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:t("pet.characters.subtitle")})]}),e.jsx("div",{className:"mt-4 grid grid-cols-2 gap-2",children:T.map(l=>e.jsx(M,{character:l,selected:g===l.id,onSelect:()=>s("character",l.id)},l.id))})]}),e.jsxs("section",{className:"mt-6 border-t border-oai-gray-200/70 pt-5 dark:border-oai-gray-800",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(A,{className:"h-4 w-4 text-oai-gray-500 dark:text-oai-gray-400",strokeWidth:1.75,"aria-hidden":!0}),e.jsx("h2",{className:"text-sm font-semibold",children:t("pet.controls.title")})]}),e.jsxs("div",{className:"mt-4 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("div",{className:"text-sm font-medium",children:t("pet.controls.show")}),e.jsx(z,{checked:i.visible,onChange:()=>s("visible",!i.visible),disabled:!r,ariaLabel:t("pet.controls.show")})]}),e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("div",{className:"text-sm font-medium",children:t("pet.controls.size")}),e.jsx("div",{className:"shrink-0",children:e.jsx(C,{options:u,value:i.size,onChange:l=>s("size",l),disabled:!r})})]})]})]}),r?null:e.jsxs("div",{className:"mt-6 flex gap-2 rounded-xl bg-oai-gray-100 p-3 text-xs leading-relaxed text-oai-gray-500 dark:bg-oai-gray-800/70 dark:text-oai-gray-400",children:[e.jsx(I,{className:"mt-0.5 h-3.5 w-3.5 shrink-0","aria-hidden":!0}),t("pet.controls.native_only")]})]})]})})]})})})}export{W as PetPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as we,bc as Ue,bF as Ke,bG as le,bH as We,bI as ne,ba as ge,r as m,bJ as z,bK as me,bL as he,bM as oe,bN as be,bO as qe,bP as Le,bQ as $,bl as J,bR as W,aG as ue,bb as pe,bS as $e,bT as Ee,bU as Qe,bV as Je,bW as ze,bX as Te,bY as q,j as Y,bZ as Ze,bh as Me,bg as et,b_ as tt,b$ as nt,c0 as ot,c1 as st,bd as rt,b9 as He,c2 as it,c3 as ye,c4 as at,c5 as ct,c6 as lt,c7 as ut,bn as ft,c8 as dt,bo as pt}from"./main-BQdH4mOs.js";import{i as Ce,b as Ae,c as _e,g as Pe,d as se,P as gt,e as mt,f as ht,s as Et,F as Tt,h as Ct,j as Pt,k as vt,l as bt,m as Rt,n as Be,o as St,u as Ot,p as It,q as Mt,t as yt,r as xt,I as Ft,v as kt,w as wt,x as Lt,C as Ht,y as At}from"./useScrollLock-BEZTkDaR.js";import{f as _t,p as Bt,g as Dt}from"./DialogTitle-CuhKU10w.js";import{p as Nt,q as jt,r as Yt,t as Gt,v as Vt,w as Xt,x as Ut,y as Kt}from"./SelectItemText-Dontd_dr.js";const Wt=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Cn=we("chevron-right",Wt);const qt=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Pn=we("loader-circle",qt);function $t(e,n){return n!=null&&!Ce(n)?0:typeof e=="function"?e():e}function ve(e,n,t){const l=$t(e,t);return typeof l=="number"?l:l?.[n]}function xe(e){return typeof e=="function"?e():e}function De(e,n){return n||e==="click"||e==="mousedown"}function Qt(e){return e?.includes("mouse")&&e!=="mousedown"}class Re{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new le,this.restTimeout=new le,this.handleCloseOptions=void 0}static create(){return new Re}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}const fe=new WeakMap;function de(e){if(!e.performedPointerEventsMutation)return;const n=e.pointerEventsScopeElement;n&&fe.get(n)===e&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),fe.delete(n)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function Ne(e,n){const{scopeElement:t,referenceElement:l,floatingElement:i}=n,o=fe.get(t);o&&o!==e&&de(o),de(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=t,e.pointerEventsReferenceElement=l,e.pointerEventsFloatingElement=i,fe.set(t,e),t.style.pointerEvents="none",l.style.pointerEvents="auto",i.style.pointerEvents="auto"}function je(e){const n=e.context.dataRef.current,t=Ue(()=>n.hoverInteractionState??Re.create()).current;return n.hoverInteractionState||(n.hoverInteractionState=t),Ke(n.hoverInteractionState.disposeEffect),n.hoverInteractionState}function Jt(e,n={}){const{enabled:t=!0,closeDelay:l=0,nodeId:i}=n,o="rootStore"in e?e.rootStore:e,p=o.useState("open"),E=o.useState("floatingElement"),S=o.useState("domReferenceElement"),{dataRef:c}=o.context,r=Ae(),O=_e(),h=je(o),j=We(),u=ne(()=>De(c.current.openEvent?.type,h.interactedInside)),_=ne(()=>Qt(c.current.openEvent?.type)),g=ne(()=>{de(h)});ge(()=>{p||(h.pointerType=void 0,h.restTimeoutPending=!1,h.interactedInside=!1,g())},[p,h,g]),m.useEffect(()=>g,[g]),ge(()=>{if(t&&p&&h.handleCloseOptions?.blockPointerEvents&&_()&&z(S)&&E){const x=S,a=E,d=me(E),F=r?.nodesRef.current.find(b=>b.id===O)?.context?.elements.floating;F&&(F.style.pointerEvents="");const A=h.pointerEventsScopeElement!==a?h.pointerEventsScopeElement:null,C=F!==a?F:null,v=h.handleCloseOptions?.getScope?.()??A??C??x.closest("[data-rootownerid]")??d.body;return Ne(h,{scopeElement:v,referenceElement:x,floatingElement:a}),()=>{g()}}},[t,p,S,E,h,_,r,O,g]),m.useEffect(()=>{if(!t)return;function x(){return!!(r&&O&&Pe(r.nodesRef.current,O).length>0)}function a(b){const M=ve(l,"close",h.pointerType),D=()=>{o.setOpen(!1,J(W,b)),r?.events.emit("floating.closed",b)};M?h.openChangeTimeout.start(M,D):(h.openChangeTimeout.clear(),D())}function d(b){const M=be(b);if(!qe(M)){h.interactedInside=!1;return}h.interactedInside=M?.closest("[aria-haspopup]")!=null}function F(){h.openChangeTimeout.clear(),j.clear(),r?.events.off("floating.closed",C),g()}function A(b){if(x()&&r){r.events.on("floating.closed",C);return}if(Le(b.relatedTarget,o.context.triggerElements))return;const M=c.current.floatingContext?.nodeId??i,D=b.relatedTarget;if(!(r&&M&&z(D)&&Pe(r.nodesRef.current,M,!1).some(X=>$(X.context?.elements.floating,D)))){if(h.handler){h.handler(b);return}g(),_()&&!u()&&a(b)}}function C(b){!r||!O||x()||j.start(0,()=>{r.events.off("floating.closed",C),o.setOpen(!1,J(W,b)),r.events.emit("floating.closed",b)})}const v=E;return he(v&&oe(v,"mouseenter",F),v&&oe(v,"mouseleave",A),v&&oe(v,"pointerdown",d,!0),()=>{r?.events.off("floating.closed",C)})},[t,E,o,c,l,i,_,u,g,h,r,O,j])}const zt={current:null};function Zt(e,n={}){const{enabled:t=!0,delay:l=0,handleClose:i=null,mouseOnly:o=!1,restMs:p=0,move:E=!0,triggerElementRef:S=zt,externalTree:c,isActiveTrigger:r=!0,getHandleCloseContext:O,isClosing:h,shouldOpen:j}=n,u="rootStore"in e?e.rootStore:e,{dataRef:_,events:g}=u.context,x=Ae(c),a=je(u),d=m.useRef(!1),F=se(i),A=se(l),C=se(p),v=se(t),b=se(j),M=se(h),D=ne(()=>De(_.current.openEvent?.type,a.interactedInside)),V=ne(()=>b.current?.()!==!1),X=ne((s,T,L)=>{const R=u.context.triggerElements;if(R.hasElement(T))return!s||!$(s,T);if(!z(L))return!1;const f=L;return R.hasMatchingElement(H=>$(H,f))&&(!s||!$(s,f))}),N=ne(()=>{if(!a.handler)return;me(u.select("domReferenceElement")).removeEventListener("mousemove",a.handler),a.handler=void 0}),w=ne(()=>{de(a)});return r&&(a.handleCloseOptions=F.current?.__options),m.useEffect(()=>N,[N]),m.useEffect(()=>{if(!t)return;function s(T){T.open?d.current=!1:(d.current=T.reason===W,N(),a.openChangeTimeout.clear(),a.restTimeout.clear(),a.blockMouseMove=!0,a.restTimeoutPending=!1)}return g.on("openchange",s),()=>{g.off("openchange",s)}},[t,g,a,N]),m.useEffect(()=>{if(!t)return;function s(f,H=!0){const B=ve(A.current,"close",a.pointerType);B?a.openChangeTimeout.start(B,()=>{u.setOpen(!1,J(W,f)),x?.events.emit("floating.closed",f)}):H&&(a.openChangeTimeout.clear(),u.setOpen(!1,J(W,f)),x?.events.emit("floating.closed",f))}const T=S.current??(r?u.select("domReferenceElement"):null);if(!z(T))return;function L(f){if(a.openChangeTimeout.clear(),a.blockMouseMove=!1,o&&!Ce(a.pointerType))return;const H=xe(C.current),B=ve(A.current,"open",a.pointerType),G=be(f),U=f.currentTarget??null,I=u.select("domReferenceElement");let k=U;if(z(G)&&!u.context.triggerElements.hasElement(G)){for(const Ie of u.context.triggerElements.elements())if($(Ie,G)){k=Ie;break}}z(U)&&z(I)&&!u.context.triggerElements.hasElement(U)&&$(U,I)&&(k=I);const P=k==null?!1:X(I,k,G),Q=u.select("open"),Z=M.current?.()??u.select("transitionStatus")==="ending",K=!Q&&Z&&d.current,ee=!P&&z(k)&&z(I)&&$(I,k)&&K,te=H>0&&!B,Xe=P&&(Q||K)||ee,Oe=!Q||P;if(Xe){V()&&u.setOpen(!0,J(W,f,k));return}te||(B?a.openChangeTimeout.start(B,()=>{Oe&&V()&&u.setOpen(!0,J(W,f,k))}):Oe&&V()&&u.setOpen(!0,J(W,f,k)))}function R(f){if(D()){w();return}N();const H=u.select("domReferenceElement"),B=me(H);a.restTimeout.clear(),a.restTimeoutPending=!1;const G=_.current.floatingContext??O?.();if(Le(f.relatedTarget,u.context.triggerElements))return;if(F.current&&G){u.select("open")||a.openChangeTimeout.clear();const I=S.current;a.handler=F.current({...G,tree:x,x:f.clientX,y:f.clientY,onClose(){w(),N(),v.current&&!D()&&I===u.select("domReferenceElement")&&s(f,!0)}}),B.addEventListener("mousemove",a.handler),a.handler(f);return}(a.pointerType!=="touch"||!$(u.select("floatingElement"),f.relatedTarget))&&s(f)}return E?he(oe(T,"mousemove",L,{once:!0}),oe(T,"mouseenter",L),oe(T,"mouseleave",R)):he(oe(T,"mouseenter",L),oe(T,"mouseleave",R))},[N,w,_,A,u,t,F,a,r,X,D,o,E,C,S,x,v,O,M,V]),m.useMemo(()=>{if(!t)return;function s(T){a.pointerType=T.pointerType}return{onPointerDown:s,onPointerEnter:s,onMouseMove(T){const{nativeEvent:L}=T,R=T.currentTarget,f=u.select("domReferenceElement"),H=u.select("open"),B=X(f,R,T.target);if(o&&!Ce(a.pointerType))return;if(H&&B&&a.handleCloseOptions?.blockPointerEvents){const I=u.select("floatingElement");if(I){const k=a.handleCloseOptions?.getScope?.()??R.ownerDocument.body;Ne(a,{scopeElement:k,referenceElement:R,floatingElement:I})}}const G=xe(C.current);if(H&&!B||G===0||!B&&a.restTimeoutPending&&T.movementX**2+T.movementY**2<2)return;a.restTimeout.clear();function U(){if(a.restTimeoutPending=!1,D())return;const I=u.select("open");!a.blockMouseMove&&(!I||B)&&V()&&u.setOpen(!0,J(W,L,R))}a.pointerType==="touch"?ue.flushSync(()=>{U()}):B&&H?U():(a.restTimeoutPending=!0,a.restTimeout.start(G,U))}}},[t,a,D,X,o,u,C,V])}const Fe=.1,en=Fe*Fe,y=.5;function ie(e,n,t,l,i,o){return l>=n!=o>=n&&e<=(i-t)*(n-l)/(o-l)+t}function ae(e,n,t,l,i,o,p,E,S,c){let r=!1;return ie(e,n,t,l,i,o)&&(r=!r),ie(e,n,i,o,p,E)&&(r=!r),ie(e,n,p,E,S,c)&&(r=!r),ie(e,n,S,c,t,l)&&(r=!r),r}function tn(e,n,t){return e>=t.x&&e<=t.x+t.width&&n>=t.y&&n<=t.y+t.height}function ce(e,n,t,l,i,o){const p=Math.min(t,i),E=Math.max(t,i),S=Math.min(l,o),c=Math.max(l,o);return e>=p&&e<=E&&n>=S&&n<=c}function nn(e={}){const{blockPointerEvents:n=!1}=e,t=new le,l=({x:i,y:o,placement:p,elements:E,onClose:S,nodeId:c,tree:r})=>{const O=p?.split("-")[0];let h=!1,j=null,u=null,_=typeof performance<"u"?performance.now():0;function g(a,d){const F=performance.now(),A=F-_;if(j===null||u===null||A===0)return j=a,u=d,_=F,!1;const C=a-j,v=d-u,b=C*C+v*v,M=A*A*en;return j=a,u=d,_=F,b<M}function x(){t.clear(),S()}return function(d){t.clear();const F=E.domReference,A=E.floating;if(!F||!A||O==null||i==null||o==null)return;const{clientX:C,clientY:v}=d,b=be(d),M=d.type==="mouseleave",D=$(A,b),V=$(F,b);if(D&&(h=!0,!M))return;if(V&&(h=!1,!M)){h=!0;return}if(M&&z(d.relatedTarget)&&$(A,d.relatedTarget))return;function X(){return!!(r&&Pe(r.nodesRef.current,c).length>0)}function N(){X()||x()}if(X())return;const w=F.getBoundingClientRect(),s=A.getBoundingClientRect(),T=i>s.right-s.width/2,L=o>s.bottom-s.height/2,R=s.width>w.width,f=s.height>w.height,H=(R?w:s).left,B=(R?w:s).right,G=(f?w:s).top,U=(f?w:s).bottom;if(O==="top"&&o>=w.bottom-1||O==="bottom"&&o<=w.top+1||O==="left"&&i>=w.right-1||O==="right"&&i<=w.left+1){N();return}let I=!1;switch(O){case"top":I=ce(C,v,H,w.top+1,B,s.bottom-1);break;case"bottom":I=ce(C,v,H,s.top+1,B,w.bottom-1);break;case"left":I=ce(C,v,s.right-1,U,w.left+1,G);break;case"right":I=ce(C,v,w.right-1,U,s.left+1,G);break}if(I)return;if(h&&!tn(C,v,w)){N();return}if(!M&&g(C,v)){N();return}let k=!1;switch(O){case"top":{const P=R?y/2:y*4,Q=R||T?i+P:i-P,Z=R?i-P:T?i+P:i-P,K=o+y+1,ee=T||R?s.bottom-y:s.top,te=T?R?s.bottom-y:s.top:s.bottom-y;k=ae(C,v,Q,K,Z,K,s.left,ee,s.right,te);break}case"bottom":{const P=R?y/2:y*4,Q=R||T?i+P:i-P,Z=R?i-P:T?i+P:i-P,K=o-y,ee=T||R?s.top+y:s.bottom,te=T?R?s.top+y:s.bottom:s.top+y;k=ae(C,v,Q,K,Z,K,s.left,ee,s.right,te);break}case"left":{const P=f?y/2:y*4,Q=f||L?o+P:o-P,Z=f?o-P:L?o+P:o-P,K=i+y+1,ee=L||f?s.right-y:s.left,te=L?f?s.right-y:s.left:s.right-y;k=ae(C,v,ee,s.top,te,s.bottom,K,Q,K,Z);break}case"right":{const P=f?y/2:y*4,Q=f||L?o+P:o-P,Z=f?o-P:L?o+P:o-P,K=i-y,ee=L||f?s.left+y:s.right,te=L?f?s.left+y:s.right:s.left+y;k=ae(C,v,K,Q,K,Z,ee,s.top,te,s.bottom);break}}k?h||t.start(40,N):N()}};return l.__options={...e,blockPointerEvents:n},l}const Ye=m.createContext(void 0);function re(e){const n=m.useContext(Ye);if(n===void 0&&!e)throw new Error(pe(47));return n}function on(){return{...Dt(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}const sn={...Bt,disabled:q(e=>e.disabled),instantType:q(e=>e.instantType),openMethod:q(e=>e.openMethod),openChangeReason:q(e=>e.openChangeReason),modal:q(e=>e.modal),focusManagerModal:q(e=>e.focusManagerModal),stickIfOpen:q(e=>e.stickIfOpen),titleElementId:q(e=>e.titleElementId),descriptionElementId:q(e=>e.descriptionElementId),openOnHover:q(e=>e.openOnHover),closeDelay:q(e=>e.closeDelay),hasViewport:q(e=>e.hasViewport)};class Se extends $e{constructor(n,t,l=!1){const i={...on(),...n},o=new gt;i.open&&n?.mounted===void 0&&(i.mounted=!0),i.floatingRootContext=_t(o,t,l),super(i,{popupRef:m.createRef(),backdropRef:m.createRef(),internalBackdropRef:m.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:m.createRef(),beforeContentFocusGuardRef:m.createRef(),stickIfOpenTimeout:new le,triggerElements:o},sn)}setOpen=(n,t)=>{const l=t.reason===W,i=t.reason===Ee&&t.event.detail===0,o=!n&&(t.reason===Qe||t.reason==null),p=mt(t),E=this.select("activeTriggerId");if(!n&&t.reason===Je&&t.trigger==null&&E!=null&&(t.trigger=this.context.triggerElements.getById(E)??this.select("activeTriggerElement")??void 0),this.context.onOpenChange?.(n,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(n,t);const S=()=>{const c={open:n,openChangeReason:t.reason};Et(c,n,t.trigger,p()),this.update(c)};l?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(ze,()=>{this.set("stickIfOpen",!1)}),ue.flushSync(S)):S(),i||o?this.set("instantType",i?"click":"dismiss"):t.reason===Te?this.set("instantType","focus"):this.set("instantType",void 0)};static useStore(n,t){const{store:l,internalStore:i}=ht(n,(o,p)=>new Se(t,o,p));return m.useEffect(()=>i?.disposeEffect(),[i]),l}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()}function ke({props:e}){const{children:n,open:t,defaultOpen:l=!1,onOpenChange:i,onOpenChangeComplete:o,modal:p=!1,handle:E,triggerId:S,defaultTriggerId:c=null}=e,r=Se.useStore(E?.store,{modal:p,open:l,openProp:t,activeTriggerId:c,triggerIdProp:S});Ct(r,t,l,c),r.useControlledProp("openProp",t),r.useControlledProp("triggerIdProp",S);const O=r.useState("open"),h=r.useState("mounted"),j=r.useState("payload"),u=_e()!=null;r.useContextCallback("onOpenChange",i),r.useContextCallback("onOpenChangeComplete",o),Pt(r,O),vt(r);const{forceUnmount:_}=bt(O,r,()=>{r.update({stickIfOpen:!0,openChangeReason:null})});r.useSyncedValues({modal:p,nested:u}),m.useEffect(()=>{O||r.context.stickIfOpenTimeout.clear()},[r,O]);const g=m.useCallback(()=>{r.setOpen(!1,J(Ze))},[r]);m.useImperativeHandle(e.actionsRef,()=>({unmount:_,close:g}),[_,g]);const x=O||h,a=m.useMemo(()=>({store:r}),[r]);return Y.jsxs(Ye.Provider,{value:a,children:[x&&Y.jsx(rn,{store:r,modal:p}),typeof n=="function"?n({payload:j}):n]})}function vn(e){return re(!0)?Y.jsx(ke,{props:e}):Y.jsx(Tt,{children:Y.jsx(ke,{props:e})})}function rn({store:e,modal:n}){const t=e.useState("floatingRootContext"),l=Rt(t,{outsidePressEvent:{mouse:n==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),i=l.reference??Me,o=l.trigger??Me,p=m.useMemo(()=>et(Be,l.floating),[l.floating]);return St(e,{activeTriggerProps:i,inactiveTriggerProps:o,popupProps:p}),null}const an=300;function cn(e,n){const t=m.useRef(null);function l(o){ue.flushSync(()=>{e.setOpen(!1,J(Te,o.nativeEvent,o.currentTarget))}),st(t.current)?.focus()}function i(o){const p=e.select("positionerElement");if(p&&tt(o,p))e.context.beforeContentFocusGuardRef.current?.focus();else{ue.flushSync(()=>{e.setOpen(!1,J(Te,o.nativeEvent,o.currentTarget))});let E=nt(e.context.triggerFocusTargetRef.current||n.current);for(;E!==null&&$(p,E);){const S=E;if(E=ot(E),E===S)break}E?.focus()}}return{preFocusGuardRef:t,handlePreFocusGuardFocus:l,handleFocusTargetFocus:i}}const bn=m.forwardRef(function(n,t){const{render:l,className:i,style:o,disabled:p=!1,nativeButton:E=!0,handle:S,payload:c,openOnHover:r=!1,delay:O=an,closeDelay:h=0,id:j,...u}=n,_=re(!0),g=S?.store??_?.store;if(!g)throw new Error(pe(74));const x=Ot(j),a=g.useState("isTriggerActive",x),d=g.useState("floatingRootContext"),F=g.useState("isOpenedByTrigger",x),A=g.useState("triggerPopupId",x),C=m.useRef(null),{registerTrigger:v,isMountedByThisTrigger:b}=It(x,C,g,{payload:c,disabled:p,openOnHover:r,closeDelay:h}),M=g.useState("openChangeReason"),D=g.useState("stickIfOpen"),V=g.useState("openMethod"),X=g.useState("focusManagerModal"),N=Zt(d,{enabled:!p&&d!=null&&r&&(V!=="touch"||M!==Ee),mouseOnly:!0,move:!1,handleClose:nn(),restMs:O,delay:{close:h},triggerElementRef:C,isActiveTrigger:a,isClosing:()=>g.select("transitionStatus")==="ending"}),w=Nt(d,{enabled:d!=null,stickIfOpen:D}),s=jt(()=>g.select("open"),k=>{g.set("openMethod",k)}),T=g.useState("triggerProps",b),{getButtonProps:L,buttonRef:R}=rt({disabled:p,native:E}),f={open(k){return k&&M===Ee?Mt.open(k):yt.open(k)}},{preFocusGuardRef:H,handlePreFocusGuardFocus:B,handleFocusTargetFocus:G}=cn(g,C),I=He("button",n,{state:{disabled:p,open:F},ref:[R,t,v,C],props:[w.reference,N,T,s,{[it]:"",id:x,"aria-haspopup":"dialog","aria-expanded":F,"aria-controls":A},u,L],stateAttributesMapping:f});return b&&!X?Y.jsxs(m.Fragment,{children:[Y.jsx(ye,{ref:H,onFocus:B}),Y.jsx(m.Fragment,{children:I},x),Y.jsx(ye,{ref:g.context.triggerFocusTargetRef,onFocus:G})]}):Y.jsx(m.Fragment,{children:I},x)}),Ge=m.createContext(void 0);function ln(){const e=m.useContext(Ge);if(e===void 0)throw new Error(pe(45));return e}const Rn=m.forwardRef(function(n,t){const{keepMounted:l=!1,...i}=n,{store:o}=re();return o.useState("mounted")||l?Y.jsx(Ge.Provider,{value:l,children:Y.jsx(at,{ref:t,...i})}):null}),Ve=m.createContext(void 0);function un(){const e=m.useContext(Ve);if(!e)throw new Error(pe(46));return e}const Sn=m.forwardRef(function(n,t){const{render:l,className:i,style:o,anchor:p,positionMethod:E="absolute",side:S="bottom",align:c="center",sideOffset:r=0,alignOffset:O=0,collisionBoundary:h="clipping-ancestors",collisionPadding:j=5,arrowPadding:u=5,sticky:_=!1,disableAnchorTracking:g=!1,collisionAvoidance:x=ct,...a}=n,{store:d}=re(),F=ln(),A=xt(),C=d.useState("floatingRootContext"),v=d.useState("mounted"),b=d.useState("open"),M=d.useState("openChangeReason"),D=d.useState("activeTriggerElement"),V=d.useState("modal"),X=d.useState("openMethod"),N=d.useState("positionerElement"),w=d.useState("instantType"),s=d.useState("transitionStatus"),T=d.useState("hasViewport"),L=m.useRef(null),R=lt(N,!1,!1),f=Yt({anchor:p,floatingRootContext:C,positionMethod:E,mounted:v,side:S,sideOffset:r,align:c,alignOffset:O,arrowPadding:u,collisionBoundary:h,collisionPadding:j,sticky:_,disableAnchorTracking:g,keepMounted:F,nodeId:A,collisionAvoidance:x,adaptiveOrigin:T?Xt:void 0}),H=C.useState("domReferenceElement");ge(()=>{const I=H,k=L.current;if(I&&(L.current=I),k&&I&&I!==k){d.set("instantType",void 0);const P=new AbortController;return R(()=>{d.set("instantType","trigger-change")},P.signal),()=>{P.abort()}}},[H,R,d]),Gt(b&&V===!0&&M!==W,X==="touch",N,D);const B=m.useCallback(I=>{d.set("positionerElement",I)},[d]),G={open:b,side:f.side,align:f.align,anchorHidden:f.anchorHidden,instant:w},U=Vt(n,G,{styles:f.positionerStyles,transitionStatus:s,props:a,refs:[t,B],hidden:!v,inert:!b});return Y.jsxs(Ve.Provider,{value:f,children:[v&&V===!0&&M!==W&&Y.jsx(Ft,{ref:d.context.internalBackdropRef,inert:ut(!b),cutout:D}),Y.jsx(kt,{id:A,children:U})]})}),fn=m.createContext(void 0);function dn(){const[e,n]=m.useState(0),t=ne(()=>(n(i=>i+1),()=>{n(i=>Math.max(0,i-1))}));return{context:m.useMemo(()=>({register:t}),[t]),hasClosePart:e>0}}function pn(e){const{value:n,children:t}=e;return Y.jsx(fn.Provider,{value:n,children:t})}const gn={...At,...pt},On=m.forwardRef(function(n,t){const{render:l,className:i,style:o,initialFocus:p,finalFocus:E,...S}=n,{store:c}=re(),r=un(),O=Ut()!=null,{context:h,hasClosePart:j}=dn(),u=c.useState("open"),_=c.useState("openMethod"),g=c.useState("instantType"),x=c.useState("transitionStatus"),a=c.useState("popupProps"),d=c.useState("titleElementId"),F=c.useState("descriptionElementId"),A=c.useState("modal"),C=c.useState("mounted"),v=c.useState("openChangeReason"),b=c.useState("activeTriggerElement"),M=c.useState("floatingRootContext"),D=M.useState("floatingId"),V=c.useState("disabled"),X=c.useState("openOnHover"),N=c.useState("closeDelay"),w=S.id??D;ft({open:u,ref:c.context.popupRef,onComplete(){u&&c.context.onOpenChangeComplete?.(!0)}}),Jt(M,{enabled:X&&!V,closeDelay:N});const s=p===void 0?wt(c.context.popupRef):p,T=A!==!1&&j;c.useSyncedValue("focusManagerModal",T);const L=m.useCallback(H=>{c.set("popupElement",H)},[c]),R={open:u,side:r.side,align:r.align,instant:g,transitionStatus:x},f=He("div",n,{state:R,ref:[t,c.context.popupRef,L],props:[a,{id:w,role:"dialog",...Be,"aria-labelledby":d,"aria-describedby":F,onKeyDown(H){O&&Ht.has(H.key)&&H.stopPropagation()}},Kt(x),S],stateAttributesMapping:gn});return Y.jsx(Lt,{context:M,openInteractionType:_,modal:T,disabled:!C||v===W,initialFocus:s,returnFocus:E,restoreFocus:"popup",previousFocusableElement:dt(b)?b:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:Y.jsx(pn,{value:h,children:f})})});export{Cn as C,Pn as L,vn as P,bn as a,Rn as b,Sn as c,On as d};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as Ue,r as i,j as e,b8 as it,b9 as ca,X as Se,N as r,a0 as Z,ba as ia,bb as _a,bc as ot,bd as lt,be as ha,bf as dt,bg as ct,bh as ut,bi as xa,bj as mt,bk as gt,bl as ht,bm as xt,bn as pt,bo as ft,Z as yt,g as bt,h as pa,am as kt,P as wt,$ as be,bp as vt,bq as jt,br as Nt,bs as Ct,bt as St,bu as _t,l as Lt,T as G,b2 as Pt,bv as oa,R as Rt,bw as It,bx as fa,b3 as Ce,by as ya,bz as ba,bA as $t,bB as ka,bC as wa,bD as Et,bE as Bt}from"./main-BQdH4mOs.js";import{L as Mt}from"./LocalOnlyNotice-Ds7yPxS1.js";import{C as Dt}from"./Card-Bw438EXT.js";import{C as va}from"./ConfirmModal-DXV9mzMw.js";import{I as La}from"./info-Xcqww53Y.js";import{u as Tt}from"./useCurrency-B6KHWgVk.js";import{L as ee,P as Pa,a as Ra,b as Ia,c as $a,d as Ea,C as Ot}from"./PopoverPopup-Bg8XtAJ5.js";import{C as _e}from"./check-CPB_1BeX.js";import{u as Ut,s as Ft,f as Ba,a as zt,b as At,c as Kt,d as Vt,e as qt,g as Ht,S as Ma,h as Da,i as Ta,C as ua,j as Oa,k as Ua,l as Fa,m as We,n as Qe,o as Xe}from"./SelectItemText-Dontd_dr.js";import{t as Gt,u as la,a as Wt}from"./useScrollLock-BEZTkDaR.js";import{D as za}from"./download-tXehSjsQ.js";import"./arrow-up-right-DsLWfytD.js";import"./DialogTitle-CuhKU10w.js";import"./DialogDescription-Dj5LvyRi.js";const Qt=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]],Aa=Ue("circle-arrow-up",Qt);const Xt=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],da=Ue("external-link",Xt);const Yt=[["path",{d:"M12 3q1 4 4 6.5t3 5.5a1 1 0 0 1-14 0 5 5 0 0 1 1-3 1 1 0 0 0 5 0c0-2-1.5-3-1.5-5q0-2 2.5-4",key:"1slcih"}]],Jt=Ue("flame",Yt);const Zt=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Ka=Ue("plus",Zt);const er=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],ma=Ue("trash-2",er);function ga({id:a,value:s,onChange:l,placeholder:m,disabled:c=!1,type:x="text",label:u,error:g,className:h="",...b}){const o=i.useId(),k=a||o,N=g?`${k}-error`:void 0,C=`w-full bg-oai-white dark:bg-oai-gray-900 border border-oai-gray-300 dark:border-oai-gray-700 rounded-md text-oai-black dark:text-oai-white placeholder-oai-gray-400 dark:placeholder-oai-gray-500 transition-all duration-200 focus:outline-none focus:border-oai-brand dark:focus:border-oai-brand focus:ring-1 focus:ring-oai-brand/30 ${c?"bg-oai-gray-50 dark:bg-oai-gray-800 text-oai-gray-400 dark:text-oai-gray-400 cursor-not-allowed":""} ${g?"border-oai-error focus:border-oai-error focus:ring-oai-error/30":""} h-10 px-3 text-sm ${h}`;return e.jsxs("div",{className:"w-full",children:[u&&e.jsx("label",{htmlFor:k,className:"block text-sm font-medium text-oai-gray-700 dark:text-oai-gray-300 mb-1.5 transition-colors duration-200",children:u}),e.jsx("input",{id:k,type:x,value:s,onChange:l,placeholder:m,disabled:c,"aria-invalid":g?!0:void 0,"aria-describedby":N,className:C,...b}),g&&e.jsx("p",{id:N,className:"mt-1.5 text-sm text-oai-error",children:g})]})}const Va=i.forwardRef(function(s,l){const{render:m,className:c,style:x,...u}=s,{store:g}=Ut(),b={open:it(g,Ft.open)};return ca("span",s,{state:b,ref:l,props:[{"aria-hidden":!0,children:"▼"},u],stateAttributesMapping:Gt})}),ar="tt:hint:dismissed:";function qa(a){return ar+a}function tr(a){if(typeof window>"u")return!1;try{return window.localStorage.getItem(qa(a))==="1"}catch{return!1}}function rr({id:a,children:s,className:l,ariaLabel:m}){const[c,x]=i.useState(()=>tr(a)),u=i.useCallback(()=>{if(typeof window<"u")try{window.localStorage.setItem(qa(a),"1")}catch{}x(!0)},[a]);return c?null:e.jsxs("div",{role:"note","aria-label":m||r("hint.dismissible_aria"),className:Z("relative rounded-lg border border-oai-gray-200 bg-oai-gray-50 px-4 py-3 text-sm text-oai-gray-700","dark:border-oai-gray-800 dark:bg-oai-gray-900/40 dark:text-oai-gray-300",l),children:[e.jsx("button",{type:"button",onClick:u,"aria-label":r("hint.dismiss"),className:"absolute top-2 right-2 inline-flex h-7 w-7 items-center justify-center rounded-md text-oai-gray-500 transition-colors hover:bg-oai-gray-200/70 hover:text-oai-gray-700 focus:outline-none focus:ring-2 focus:ring-oai-blue/30 dark:text-oai-gray-400 dark:hover:bg-oai-gray-800/70 dark:hover:text-oai-gray-200",children:e.jsx(Se,{className:"h-4 w-4","aria-hidden":"true"})}),e.jsxs("div",{className:"flex items-start gap-2 pr-8",children:[e.jsx(La,{className:"mt-0.5 h-4 w-4 shrink-0 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":"true"}),e.jsx("div",{className:"min-w-0 flex-1",children:s})]})]})}function sr(a){if(!a)return null;for(const s of a.elements){const l=s.tagName;if(l==="BUTTON"||l==="INPUT"){const m=s;if(m.type==="submit")return m}}return null}let ja=(function(a){return a.checked="data-checked",a.unchecked="data-unchecked",a.indeterminate="data-indeterminate",a.disabled="data-disabled",a.readonly="data-readonly",a.required="data-required",a.valid="data-valid",a.invalid="data-invalid",a.touched="data-touched",a.dirty="data-dirty",a.filled="data-filled",a.focused="data-focused",a})({});function Ha(a){return i.useMemo(()=>({checked(s){return a.indeterminate?{}:s?{[ja.checked]:""}:{[ja.unchecked]:""}},...Ba}),[a.indeterminate])}const nr=i.createContext({disabled:!1});function ir(){return i.useContext(nr)}function or(a,s,l,m=!0,c){const[x,u]=i.useState(),g=la(c?`${c}-label`:void 0),h=a??s??x;return ia(()=>{const b=a||s||!m?void 0:lr(l.current,g);x!==b&&u(b)}),h}function lr(a,s){const l=dr(a);if(l)return!l.id&&s&&(l.id=s),l.id||void 0}function dr(a){if(!a)return;const s=a.parentElement;if(s&&s.tagName==="LABEL")return s;const l=a.id;if(l){const c=a.nextElementSibling;if(c&&c.htmlFor===l)return c}const m=a.labels;return m&&m[0]}const cr=i.createContext(void 0);function ur(a=!0){const s=i.useContext(cr);if(s===void 0&&!a)throw new Error(_a(3));return s}const Ga=i.createContext(void 0);function mr(){const a=i.useContext(Ga);if(a===void 0)throw new Error(_a(14));return a}const gr="data-parent",hr=i.forwardRef(function(s,l){const{checked:m,className:c,defaultChecked:x=!1,"aria-labelledby":u,disabled:g=!1,form:h,id:b,indeterminate:o=!1,inputRef:k,name:N,onCheckedChange:w,parent:v=!1,readOnly:y=!1,render:C,required:$=!1,uncheckedValue:U,value:W,nativeButton:F=!1,style:ge,...j}=s,{clearErrors:ae}=zt(),{disabled:E,name:K,setDirty:Q,setFilled:te,setFocused:z,setTouched:ke,state:we,validationMode:Fe,validityData:Le,validation:ze}=At(),Ae=ir(),{labelId:D,controlId:re,registerControlId:X,getDescriptionProps:ve}=Kt(),L=ur(),V=L?.parent,se=V&&L.allValues,I=E||Ae.disabled||L?.disabled||g,ne=K??N,P=W??ne,Pe=la(),je=la();let ie=re;se?ie=v?je:`${V.id}-${P}`:b&&(ie=b);let pe={};se&&(v?pe=L.parent.getParentProps():P&&(pe=L.parent.getChildProps(P)));const{checked:Re=m,indeterminate:Ie=o,onCheckedChange:$e,...Ne}=pe,q=L?.value,oe=L?.setValue,fe=L?.defaultValue,le=i.useRef(null),de=ot(()=>Symbol("checkbox-control")),he=i.useRef(!1),{getButtonProps:Je,buttonRef:Ke}=lt({disabled:I,native:F}),ce=L?.validation??ze,[_,Ze]=Vt({controlled:P&&q&&!v?q.includes(P):Re,default:P&&fe&&!v?fe.includes(P):x,name:"Checkbox",state:"checked"}),Ee=se?!!Re:_,ye=se&&Ie||o;ia(()=>{X!==ha&&(he.current=!0,X(de.current,ie))},[ie,X,de]),i.useEffect(()=>{const f=de.current;return()=>{!he.current||X===ha||(he.current=!1,X(f,void 0))}},[X,de]),qt(le,Pe,_,void 0,!L&&!I,N);const Y=i.useRef(null),Be=dt(k,Y,ce.inputRef,ce.registerInput),ea=or(u,D,Y,!F,ie??void 0);ia(()=>{Y.current&&(Y.current.indeterminate=ye,_&&te(!0))},[_,ye,te]),Ht(_,()=>{L||(ae(ne),te(_),Q(_!==Le.initialValue),ce.change(_))});const Ve=ct({checked:_,disabled:I,form:h,name:v?void 0:ne,id:F?void 0:ie??void 0,required:$,ref:Be,style:ne?mt:gt,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(f){if(f.nativeEvent.defaultPrevented)return;if(y){f.preventDefault();return}const T=f.currentTarget.checked,ue=ht(xt,f.nativeEvent);if(w?.(T,ue),!ue.isCanceled&&($e?.(T,ue),!ue.isCanceled&&(Ze(T),P&&q&&oe&&!v&&!se))){const me=T?[...q,P]:q.filter(B=>B!==P);oe(me,ue)}},onFocus(){le.current?.focus()}},W!==void 0?{value:(L?_&&W:W)||""}:ut,ve,f=>ce.getValidationProps(I,f));i.useEffect(()=>{if(!V||!P)return;const f=V.disabledStatesRef.current;return f.set(P,I),()=>{f.delete(P)}},[V,I,P]);const Me=i.useMemo(()=>({...we,checked:Ee,disabled:I,readOnly:y,required:$,indeterminate:ye}),[we,Ee,I,y,$,ye]),aa=Ha(Me),ta=ca("span",s,{state:Me,ref:[Ke,le,l,L?.registerControlRef],props:[{id:F?ie??void 0:Pe,role:"checkbox","aria-checked":ye?"mixed":Ee,"aria-readonly":y||void 0,"aria-required":$||void 0,"aria-labelledby":ea,[gr]:v?"":void 0,onFocus(){I||z(!0)},onBlur(){const f=Y.current;f&&(ke(!0),z(!1),Fe==="onBlur"&&ce.commit(L?q:f.checked))},onKeyDown(f){if(f.key!=="Enter"||(f.preventBaseUIHandler(),f.defaultPrevented))return;const T=Y.current?.form??null,ue=f.currentTarget,me=f.nativeEvent,B=f.preventDefault,H=me.preventDefault;let De=!1;f.preventDefault=()=>{De=!0,B.call(f)},me.preventDefault=()=>{De=!0,H.call(me)},H.call(me),xa(ue).queueMicrotask(()=>{f.preventDefault=B,me.preventDefault=H,De||sr(T)?.click()})},onClick(f){if(y||I)return;f.preventDefault();const T=Y.current;T&&T.dispatchEvent(new(xa(T)).PointerEvent("click",{bubbles:!0,shiftKey:f.shiftKey,ctrlKey:f.ctrlKey,altKey:f.altKey,metaKey:f.metaKey}))}},j,Ne,Je,ve,f=>ce.getValidationProps(I,f)],stateAttributesMapping:aa});return e.jsxs(Ga.Provider,{value:Me,children:[ta,!_&&!L&&ne&&!v&&U!==void 0&&e.jsx("input",{type:"hidden",form:h,name:ne,value:U,disabled:I}),e.jsx("input",{...Ve,suppressHydrationWarning:!0})]})}),xr=i.forwardRef(function(s,l){const{render:m,className:c,style:x,keepMounted:u=!1,...g}=s,h=mr(),b=h.checked||h.indeterminate,{mounted:o,transitionStatus:k,setMounted:N}=Wt(b),w=i.useRef(null),v={...h,transitionStatus:k};pt({open:b,ref:w,onComplete(){b||N(!1)}});const C={...Ha(h),...ft,...Ba},$=u||o,U=ca("span",s,{ref:[l,w],state:v,stateAttributesMapping:C,props:g});return $?U:null});function pr(a,s){return`target:${a}:${s}`}function fr(a){return`remove:${a.id||a.directory}`}function Wa(a){if(!a)return null;const s=new Date(a).getTime();return Number.isFinite(s)?Math.floor((Date.now()-s)/864e5):null}function yr(a){const s=Wa(a);if(s==null)return null;if(s<=0)return r("skills.usage.today");if(s<30)return r("skills.usage.days_ago",{days:s});const l=Math.max(1,Math.floor(s/30));return r("skills.usage.months_ago",{months:l})}function br(a){const s=Wa(a);return s==null?"bg-oai-gray-300 dark:bg-oai-gray-600":s<=7?"bg-emerald-500":s<=30?"bg-amber-500":"bg-oai-gray-300 dark:bg-oai-gray-600"}function sa({label:a,children:s}){return e.jsxs("div",{className:"flex items-center justify-between gap-3 py-2 text-sm",children:[e.jsx("dt",{className:"flex items-center gap-1 text-oai-gray-500 dark:text-oai-gray-400",children:a}),e.jsx("dd",{className:"text-right font-medium tabular-nums text-oai-black dark:text-white",children:s})]})}function kr({skill:a,targets:s,busyKey:l,usage:m,hasUpdate:c,updating:x,onUpdate:u,onClose:g,onToggleTarget:h,onRemove:b}){return e.jsx(yt,{children:a?e.jsx(wr,{skill:a,targets:s,busyKey:l,usage:m,hasUpdate:c,updating:x,onUpdate:u,onClose:g,onToggleTarget:h,onRemove:b},a.id||a.directory):null})}function wr({skill:a,targets:s,busyKey:l,usage:m,hasUpdate:c,updating:x,onUpdate:u,onClose:g,onToggleTarget:h,onRemove:b}){const o=bt(),{currency:k,rate:N}=Tt(),w=i.useRef(null);i.useEffect(()=>{const j=E=>{E.key==="Escape"&&(E.stopPropagation(),g?.())},ae=E=>{const K=E.target;K instanceof Element&&(w.current?.contains(K)||K.closest('[data-skill-row="1"]')||g?.())};return document.addEventListener("keydown",j),document.addEventListener("mousedown",ae),()=>{document.removeEventListener("keydown",j),document.removeEventListener("mousedown",ae)}},[g]);const v=a.name||a.directory,y=!!(a.repoOwner&&a.repoName),C=y?`https://github.com/${a.repoOwner}/${a.repoName}`:null,$=new Set(a.targets||[]),U=l===fr(a),W=yr(m?.lastUsedAt),F=!!(m&&m.invocations>0),ge=o?{duration:0}:{type:"spring",stiffness:320,damping:30,mass:.7};return e.jsxs(e.Fragment,{children:[e.jsx(pa.div,{className:"fixed inset-0 z-20 bg-oai-black/30 backdrop-blur-[2px] lg:hidden",initial:o?!1:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:o?0:.15},onClick:g,"aria-hidden":!0}),e.jsxs(pa.aside,{ref:w,role:"complementary","aria-label":v,initial:o?!1:{opacity:0,x:24,scale:.98},animate:{opacity:1,x:0,scale:1},exit:o?{opacity:0}:{opacity:0,x:24,scale:.98},transition:ge,className:"fixed inset-x-3 bottom-3 top-20 z-30 flex flex-col overflow-hidden rounded-2xl border border-white/40 bg-white/75 shadow-[0_24px_60px_-20px_rgba(15,23,42,0.25)] backdrop-blur-xl backdrop-saturate-150 supports-[backdrop-filter]:bg-white/65 dark:border-white/10 dark:bg-oai-gray-950/70 dark:shadow-[0_24px_60px_-20px_rgba(0,0,0,0.7)] dark:supports-[backdrop-filter]:bg-oai-gray-950/55 lg:inset-auto lg:right-6 lg:top-24 lg:bottom-6 lg:w-[22rem] lg:max-h-[calc(100vh-7.5rem)]",children:[e.jsxs("header",{className:"flex items-center gap-3 border-b border-white/40 bg-gradient-to-b from-white/30 to-transparent px-5 pb-4 pt-5 dark:border-white/10 dark:from-white/[0.04]",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h2",{className:"truncate text-base font-semibold text-oai-black dark:text-white",title:v,children:v}),y?e.jsxs("a",{href:C,target:"_blank",rel:"noreferrer noopener",className:"mt-1 inline-flex max-w-full items-center gap-1 truncate text-xs text-oai-gray-500 transition-colors hover:text-oai-black hover:underline dark:text-oai-gray-400 dark:hover:text-white",title:C,children:[e.jsxs("span",{className:"truncate",children:[a.repoOwner,"/",a.repoName]}),e.jsx(da,{className:"h-3 w-3 shrink-0","aria-hidden":!0})]}):a.directory&&a.directory!==v?e.jsx("div",{className:"mt-1 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",title:a.directory,children:a.directory}):null]}),e.jsx("button",{type:"button",onClick:g,"aria-label":r("skills.detail.close"),className:"-mr-1 inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-full text-oai-gray-500 transition hover:bg-oai-gray-100 hover:text-oai-black focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:text-oai-gray-400 dark:hover:bg-oai-gray-800 dark:hover:text-white",children:e.jsx(Se,{className:"h-4 w-4","aria-hidden":!0})})]}),e.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-5 py-5",children:[c?e.jsxs("div",{className:"mb-4 flex items-center gap-3 rounded-xl bg-sky-50/80 px-3 py-2.5 ring-1 ring-sky-200 dark:bg-sky-950/30 dark:ring-sky-800/60",children:[e.jsx(Aa,{className:"h-4 w-4 shrink-0 text-sky-600 dark:text-sky-300","aria-hidden":!0}),e.jsx("span",{className:"min-w-0 flex-1 text-xs text-sky-800 dark:text-sky-200",children:r("skills.update.available")}),e.jsxs("button",{type:"button",onClick:()=>u?.(a),disabled:x,className:"inline-flex h-7 shrink-0 items-center gap-1 rounded-md bg-sky-600 px-2.5 text-xs font-semibold text-white transition hover:bg-sky-700 focus:outline-none focus:ring-2 focus:ring-sky-400/40 disabled:cursor-not-allowed disabled:opacity-60 dark:bg-sky-500 dark:hover:bg-sky-400",children:[x?e.jsx(ee,{className:"h-3 w-3 animate-spin","aria-hidden":!0}):null,r("skills.update.action")]})]}):null,a.description?e.jsx("p",{className:"text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:a.description}):null,e.jsxs("section",{className:"mt-6",children:[e.jsx("h3",{className:"mb-1 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.usage.section_title")}),e.jsxs("dl",{className:"divide-y divide-oai-gray-200/60 dark:divide-white/[0.06]",children:[e.jsx(sa,{label:r("skills.usage.invocations"),children:kt(m?.invocations||0)}),e.jsx(sa,{label:r("skills.usage.last_used"),children:e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx("span",{className:Z("h-1.5 w-1.5 rounded-full",br(m?.lastUsedAt)),"aria-hidden":!0}),F?W||r("skills.usage.unknown"):r("skills.usage.never")]})}),e.jsx(sa,{label:e.jsxs(e.Fragment,{children:[r("skills.usage.cost"),e.jsx("span",{title:r("skills.usage.disclaimer"),className:"inline-flex cursor-help text-oai-gray-400 dark:text-oai-gray-500",children:e.jsx(La,{className:"h-3 w-3","aria-label":r("skills.usage.disclaimer")})})]}),children:wt(m?.cost||0,{currency:k,rate:N})})]}),F?null:e.jsx("p",{className:"mt-2 text-[11px] leading-4 text-oai-gray-400 dark:text-oai-gray-500",children:r("skills.usage.unused")})]}),e.jsxs("section",{className:"mt-6",children:[e.jsx("h3",{className:"mb-1 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.detail.sync_section_title")}),e.jsx("div",{children:(s||[]).map(j=>{const ae=$.has(j.id),E=l===pr(a.id,j.id),K=`skill-detail-sync-${a.id||a.directory}-${j.id}`;return e.jsxs("label",{htmlFor:K,className:"-mx-2 flex cursor-pointer items-center gap-3 rounded-md px-2 py-2 text-sm text-oai-black transition-colors hover:bg-oai-gray-100/70 dark:text-white dark:hover:bg-white/[0.05]",children:[e.jsx(hr,{id:K,checked:ae,disabled:E,onCheckedChange:Q=>h?.(a,j.id,!!Q),className:"peer flex h-4 w-4 shrink-0 items-center justify-center rounded-[4px] border border-oai-gray-300/80 bg-white/80 shadow-sm transition-colors hover:border-oai-gray-400 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-gray-400/40 focus-visible:ring-offset-1 focus-visible:ring-offset-transparent disabled:cursor-not-allowed disabled:opacity-50 data-[checked]:border-oai-black data-[checked]:bg-oai-black dark:border-oai-gray-500/60 dark:bg-oai-gray-900/60 dark:hover:border-oai-gray-400 dark:data-[checked]:border-white dark:data-[checked]:bg-white",children:e.jsx(xr,{className:"flex items-center justify-center text-white dark:text-oai-black",children:e.jsx(_e,{className:"h-3 w-3",strokeWidth:3.5,"aria-hidden":!0})})}),e.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center","aria-hidden":!0,children:e.jsx(be,{provider:j.id,size:16})}),e.jsx("span",{className:"flex-1",children:j.label}),E?e.jsx(ee,{className:"h-3.5 w-3.5 animate-spin text-oai-gray-400","aria-hidden":!0}):null]},j.id)})})]})]}),e.jsxs("footer",{className:"border-t border-white/40 bg-white/30 px-5 py-4 dark:border-white/10 dark:bg-white/[0.02]",children:[e.jsxs("button",{type:"button",onClick:()=>b?.(a),disabled:U,className:"inline-flex w-full items-center justify-center gap-2 rounded-lg border border-red-200/70 bg-white px-3 py-2 text-sm font-medium text-red-600 transition hover:border-red-300 hover:bg-red-50 focus:outline-none focus:ring-2 focus:ring-red-400/30 disabled:cursor-not-allowed disabled:opacity-60 dark:border-red-900/60 dark:bg-oai-gray-950 dark:text-red-300 dark:hover:border-red-800 dark:hover:bg-red-950/30",children:[U?e.jsx(ee,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):e.jsx(ma,{className:"h-3.5 w-3.5","aria-hidden":!0}),r("skills.detail.remove_button")]}),e.jsx("p",{className:"mt-2 text-center text-[11px] text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.detail.remove_confirm_hint")})]})]})]})}const vr=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),na=["claude","codex"],O="popular",jr={claude:"text-orange-500 dark:text-orange-300",codex:"text-emerald-600 dark:text-emerald-300",grok:"text-zinc-700 dark:text-zinc-200",antigravity:"text-violet-600 dark:text-violet-300",gemini:"text-sky-600 dark:text-sky-300",opencode:"text-amber-600 dark:text-amber-300",hermes:"text-indigo-500 dark:text-indigo-300"},xe="all",M="skillssh";function Ye(a){return`${a.repoOwner||"local"}/${a.repoName||"local"}:${a.directory}`}function Qa(a){return String(a||"").replace(/\\/g,"/").trim().toLowerCase()}function Nr(a){return Qa(a).split("/").filter(Boolean).pop()||""}function Cr(a){if(a.repoOwner||a.repoName)return"";const s=Qa(a.directory);return!s||s.includes("/")?"":`dir:${s}`}function Na(a){const s=Nr(a.directory);return s?`dir:${s}`:""}function Ca(a){const s=new Set([Ye(a).toLowerCase()]);a.repoOwner&&a.repoName&&s.add(`${a.repoOwner}/${a.repoName}:${a.sourceDirectory||a.directory}`.toLowerCase());const l=Cr(a);return l&&s.add(l),s}function Ge(a){return`install:${Ye(a)}`}function Sa(a){return`remove:${a.id||a.directory}`}function Xa(a,s){return`target:${a}:${s}`}function Sr({target:a,state:s,busy:l,onToggle:m}){const c=s==="synced",x=s==="orphan",u=x?r("skills.dot.orphan_aria",{agent:a.label}):c?r("skills.dot.synced_aria",{agent:a.label}):r("skills.dot.off_aria",{agent:a.label});return e.jsxs("button",{type:"button",title:u,"aria-label":u,"aria-pressed":c,disabled:l,onClick:g=>{g.stopPropagation(),m?.(a.id,!c)},className:"relative flex h-7 w-7 items-center justify-center rounded-md transition-colors hover:bg-oai-gray-100 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/40 disabled:cursor-not-allowed dark:hover:bg-oai-gray-800/60",children:[l?e.jsx(ee,{className:"h-4 w-4 animate-spin text-oai-gray-400","aria-hidden":!0}):e.jsx("span",{className:Z("flex h-[18px] w-[18px] items-center justify-center transition",c&&jr[a.id],!c&&!x&&"opacity-35 grayscale"),"aria-hidden":!0,children:e.jsx(be,{provider:a.id,size:18})}),x&&!l?e.jsx("span",{className:"absolute -bottom-px -right-px h-2 w-2 rounded-full bg-amber-500 ring-2 ring-oai-white dark:ring-oai-gray-900","aria-hidden":!0}):null]})}function _r({skill:a,targets:s,onToggleTarget:l,busyKey:m}){return e.jsx("div",{className:"flex items-center gap-1",onClick:c=>c.stopPropagation(),children:s.map(c=>e.jsx(Sr,{target:c,state:a.targetStates?.[c.id]||"off",busy:m===Xa(a.id,c.id),onToggle:(x,u)=>l?.(a,x,u)},c.id))})}function Lr({skill:a,targets:s,selected:l,onSelect:m,selectable:c,checked:x,onToggleSelect:u,onToggleTarget:g,hasUpdate:h,busyKey:b}){const o=a.repoOwner&&a.repoName?`${a.repoOwner}/${a.repoName}`:null,k=o?`${a.directory} · ${o}`:a.directory,N=w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),m?.(a))};return e.jsxs("div",{"data-skill-row":"1",role:"button",tabIndex:0,"aria-pressed":l,"aria-label":r("skills.row.open_details",{name:a.name||a.directory}),onClick:()=>m?.(a),onKeyDown:N,className:Z("cursor-pointer rounded-md py-3 pr-2 transition focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30",l?"bg-oai-gray-100 ring-1 ring-oai-gray-200 dark:bg-oai-gray-800/60 dark:ring-oai-gray-800":x?"bg-oai-gray-50 dark:bg-oai-gray-900/40":"hover:bg-oai-gray-50 dark:hover:bg-oai-gray-900/40"),children:[e.jsxs("div",{className:"flex items-center gap-3",children:[c?e.jsx("label",{className:"flex shrink-0 items-center",onClick:w=>w.stopPropagation(),children:e.jsx("input",{type:"checkbox",checked:x,onChange:w=>u?.(a,w.target.checked),"aria-label":r("skills.select.row_aria",{name:a.name||a.directory}),className:"h-4 w-4 rounded border-oai-gray-300 text-oai-black focus:ring-oai-gray-400 dark:border-oai-gray-600 dark:bg-oai-gray-900 dark:text-white"})}):null,e.jsx("h2",{className:"min-w-0 flex-1 truncate text-sm font-semibold text-oai-black dark:text-white",title:k,children:a.name||a.directory}),h?e.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-full bg-sky-50 px-1.5 py-0.5 text-[10px] font-semibold text-sky-700 ring-1 ring-sky-200 dark:bg-sky-950/40 dark:text-sky-300 dark:ring-sky-800/60",children:[e.jsx(Aa,{className:"h-2.5 w-2.5","aria-hidden":!0}),r("skills.update.badge")]}):null,e.jsx(_r,{skill:a,targets:s,onToggleTarget:g,busyKey:b}),e.jsx(Ot,{className:Z("hidden h-4 w-4 shrink-0 text-oai-gray-300 transition-colors dark:text-oai-gray-600 lg:block",l&&"text-oai-gray-500 dark:text-oai-gray-300"),"aria-hidden":!0})]}),a.description?e.jsx("p",{className:Z("mt-1 line-clamp-2 text-xs text-oai-gray-500 dark:text-oai-gray-400",c&&"pl-7"),children:a.description}):null]})}function Pr({agentFilter:a,agentOptions:s,onAgentFilter:l,filteredCount:m,totalCount:c,anyFilter:x,onClearFilters:u,searchQuery:g,onSearchQuery:h,searchPlaceholder:b}){return e.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2 pt-1 text-xs text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsxs(Ma,{value:a,onValueChange:l,children:[e.jsxs(Da,{"aria-label":r("skills.filter.agent_label"),className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 bg-oai-white px-2.5 text-xs font-medium text-oai-gray-700 transition hover:border-oai-gray-300 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 data-[popup-open]:border-oai-gray-300 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-oai-gray-200 dark:hover:border-oai-gray-700",children:[e.jsxs("span",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:[r("skills.filter.agent_label"),":"]}),e.jsx(Ta,{children:o=>o==="all"?r("skills.filter.agent_all"):s.find(k=>k.id===o)?.label||o}),e.jsx(Va,{className:"text-oai-gray-400",children:e.jsx(ua,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),e.jsx(Oa,{children:e.jsx(Ua,{sideOffset:4,alignItemWithTrigger:!1,className:"z-[60]",children:e.jsxs(Fa,{className:"min-w-[var(--anchor-width)] overflow-hidden rounded-md border border-oai-gray-200 bg-white p-1 shadow-[0_12px_32px_-12px_rgba(0,0,0,0.18)] outline-none dark:border-oai-gray-800 dark:bg-oai-gray-950 dark:shadow-[0_12px_32px_-12px_rgba(0,0,0,0.6)]",children:[e.jsxs(We,{value:"all",className:"flex cursor-default select-none items-center justify-between gap-2 rounded px-3 py-1.5 text-sm text-oai-black outline-none data-[highlighted]:bg-oai-gray-100 dark:text-white dark:data-[highlighted]:bg-oai-gray-800",children:[e.jsx(Qe,{children:r("skills.filter.agent_all")}),e.jsx(Xe,{children:e.jsx(_e,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),s.map(o=>e.jsxs(We,{value:o.id,className:"flex cursor-default select-none items-center justify-between gap-2 rounded px-3 py-1.5 text-sm text-oai-black outline-none data-[highlighted]:bg-oai-gray-100 dark:text-white dark:data-[highlighted]:bg-oai-gray-800",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(be,{provider:o.id,size:14}),e.jsx(Qe,{children:o.label})]}),e.jsx(Xe,{children:e.jsx(_e,{className:"h-3.5 w-3.5","aria-hidden":!0})})]},o.id))]})})})]}),e.jsxs("div",{className:"relative w-56 max-w-full",children:[e.jsx(oa,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-oai-gray-400","aria-hidden":!0}),e.jsx(ga,{type:"search",value:g,onChange:o=>h(o.target.value),onKeyDown:o=>{o.key==="Escape"&&g&&(o.preventDefault(),h(""))},"aria-label":r("skills.action.search_aria"),placeholder:b,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:()=>h(""),"aria-label":r("skills.action.search_clear"),"aria-hidden":!g,tabIndex:g?0:-1,className:Z("absolute right-2 top-1/2 flex h-6 w-6 -translate-y-1/2 items-center justify-center rounded-full text-oai-gray-400 transition duration-150 ease-out before:absolute before:-inset-1.5 before:content-[''] hover:bg-oai-gray-100 hover:text-oai-gray-600 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-gray-400/40 motion-reduce:transition-none dark:hover:bg-oai-gray-800 dark:hover:text-oai-gray-200",g?"scale-100 opacity-100":"pointer-events-none scale-90 opacity-0"),children:e.jsx(Se,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),e.jsx("span",{role:"status","aria-live":"polite",className:"ml-auto shrink-0 tabular-nums text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.filter.result_count",{filtered:m,total:c})}),x?e.jsxs("button",{type:"button",onClick:u,className:"shrink-0 inline-flex h-7 items-center gap-1 rounded-full bg-oai-gray-100 px-2.5 text-[11px] font-medium text-oai-gray-700 transition hover:bg-oai-gray-200 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:bg-oai-gray-800/70 dark:text-oai-gray-200 dark:hover:bg-oai-gray-700",children:[e.jsx(Se,{className:"h-3 w-3","aria-hidden":!0}),r("skills.filter.clear")]}):null]})}function Rr({count:a,targets:s,busy:l,onBulkSync:m,onBulkRemove:c,onClear:x}){return e.jsxs("div",{role:"toolbar","aria-label":r("skills.select.toolbar_aria"),className:"mb-2 flex flex-wrap items-center gap-2 rounded-lg border border-oai-gray-200 bg-oai-gray-50 px-3 py-2 dark:border-oai-gray-800 dark:bg-oai-gray-900/50",children:[e.jsx("span",{className:"text-xs font-medium text-oai-gray-700 dark:text-oai-gray-200","aria-live":"polite",children:r("skills.select.count",{count:a})}),e.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[e.jsxs(Pa,{children:[e.jsxs(Ra,{disabled:l,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 bg-oai-white px-2.5 text-xs font-medium text-oai-gray-700 transition hover:border-oai-gray-300 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 disabled:opacity-60 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-oai-gray-200",children:[e.jsx(za,{className:"h-3.5 w-3.5","aria-hidden":!0}),r("skills.select.bulk_sync"),e.jsx(ua,{className:"h-3 w-3","aria-hidden":!0})]}),e.jsx(Ia,{children:e.jsx($a,{sideOffset:6,side:"bottom",align:"end",className:"!z-[80]",children:e.jsxs(Ea,{className:"min-w-[200px] rounded-lg bg-white p-1.5 shadow-lg ring-1 ring-oai-gray-200 dark:bg-oai-gray-950 dark:ring-oai-gray-800",children:[e.jsx("div",{className:"px-2 pb-1 pt-0.5 text-[11px] font-medium uppercase tracking-wide text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.select.bulk_sync_hint")}),s.map(u=>e.jsxs("button",{type:"button",onClick:()=>m(u.id),className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm text-oai-black hover:bg-oai-gray-100 dark:text-white dark:hover:bg-oai-gray-800",children:[e.jsx(be,{provider:u.id,size:16}),e.jsx("span",{className:"flex-1",children:u.label})]},u.id))]})})})]}),e.jsxs(G,{type:"button",variant:"ghost",size:"sm",disabled:l,onClick:c,children:[e.jsx(ma,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),r("skills.select.bulk_remove")]}),e.jsxs("button",{type:"button",onClick:x,className:"inline-flex h-7 items-center gap-1 rounded-full px-2 text-[11px] font-medium text-oai-gray-500 transition hover:text-oai-black focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:text-oai-gray-400 dark:hover:text-white",children:[e.jsx(Se,{className:"h-3 w-3","aria-hidden":!0}),r("skills.select.clear")]})]})]})}function Ir({items:a,totalCount:s,targets:l,agentOptions:m,agentFilter:c,onAgentFilter:x,anyFilter:u,onClearFilters:g,searchQuery:h,onSearchQuery:b,searchPlaceholder:o,selectedId:k,onSelect:N,onToggleTarget:w,busyKey:v,updates:y,selectedIds:C,onToggleSelect:$,onClearSelection:U,onBulkSync:W,onBulkRemove:F}){const ge=C.size;return e.jsxs("div",{children:[ge>0?e.jsx(Rr,{count:ge,targets:l,busy:v==="batch",onBulkSync:W,onBulkRemove:F,onClear:U}):e.jsx(Pr,{agentFilter:c,agentOptions:m,onAgentFilter:x,filteredCount:a.length,totalCount:s,anyFilter:u,onClearFilters:g,searchQuery:h,onSearchQuery:b,searchPlaceholder:o}),a.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-lg border border-dashed border-oai-gray-200 px-4 py-10 text-center text-sm text-oai-gray-500 dark:border-oai-gray-800 dark:text-oai-gray-400",children:[e.jsx("p",{children:r("skills.empty.no_match")}),e.jsx(G,{type:"button",variant:"secondary",size:"sm",onClick:g,children:r("skills.filter.clear")})]}):e.jsx("div",{className:"divide-y divide-oai-gray-200/70 dark:divide-oai-gray-800/70",children:a.map(j=>e.jsx(Lr,{skill:j,targets:l,selected:k===(j.id||j.directory),onSelect:N,selectable:!0,checked:C.has(j.id),onToggleSelect:$,onToggleTarget:w,hasUpdate:!!(j.id&&y?.[j.id]),busyKey:v},j.id||j.key))})]})}const $r={contentVisibility:"auto",containIntrinsicSize:"0 240px"},Er=Rt.memo(function({skill:s,installed:l,installing:m,allTargets:c,defaultTargets:x,onInstall:u,onManage:g}){const[h,b]=i.useState(()=>(x||[]).filter(y=>c.some(C=>C.id===y))),o=y=>{b(C=>C.includes(y)?C.filter($=>$!==y):[...C,y])},k=s.repoOwner&&s.repoName?`${s.repoOwner}/${s.repoName}`:null,N=k?`https://github.com/${s.repoOwner}/${s.repoName}`:null,w=s.installs!=null?r("skills.card.installs",{count:Number(s.installs||0).toLocaleString()}):null,v=h.length?h.map(y=>c.find(C=>C.id===y)?.label||y).join(", "):r("skills.action.choose_targets");return e.jsxs(Dt,{className:"h-full rounded-lg",bodyClassName:"flex h-full flex-col",children:[e.jsx("div",{className:"flex items-start justify-between gap-3",children:e.jsxs("div",{className:"min-w-0",children:[s.readmeUrl?e.jsxs("a",{href:s.readmeUrl,target:"_blank",rel:"noopener noreferrer",className:"group inline-flex max-w-full items-center gap-1 truncate text-base font-semibold text-oai-black hover:underline dark:text-white",title:s.readmeUrl,children:[e.jsx("span",{className:"truncate",children:s.name||s.directory}),e.jsx(da,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-400 opacity-0 transition-opacity group-hover:opacity-100","aria-hidden":!0})]}):e.jsx("h2",{className:"truncate text-base font-semibold text-oai-black dark:text-white",children:s.name||s.directory}),k||w?e.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-x-1.5 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:[N?e.jsxs("a",{href:N,target:"_blank",rel:"noopener noreferrer",onClick:y=>y.stopPropagation(),className:"inline-flex items-center gap-1 truncate rounded text-oai-gray-500 hover:text-oai-black hover:underline focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:text-oai-gray-400 dark:hover:text-white",title:N,children:[e.jsx("span",{className:"truncate",children:k}),e.jsx(da,{className:"h-2.5 w-2.5 shrink-0","aria-hidden":!0})]}):null,k&&w?e.jsx("span",{"aria-hidden":!0,children:"·"}):null,w?e.jsx("span",{className:"truncate",children:w}):null]}):null]})}),s.description?e.jsx("p",{className:"mt-3 line-clamp-3 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:s.description}):null,e.jsx("div",{className:"mt-auto pt-5",children:l?e.jsxs(G,{type:"button",variant:"secondary",size:"sm",onClick:()=>g?.(s),className:"w-full",children:[e.jsx(_e,{className:"mr-1.5 h-3.5 w-3.5 text-emerald-500 dark:text-emerald-400","aria-hidden":!0}),r("skills.card.manage")]}):e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-1 text-xs text-oai-gray-600 dark:text-oai-gray-300",children:[e.jsx("span",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.card.targets_prefix")}),e.jsx("span",{className:"min-w-0 truncate font-medium text-oai-black dark:text-white",children:h.length?v:r("skills.target.none")}),e.jsxs(Pa,{children:[e.jsx(Ra,{disabled:m,"aria-label":r("skills.action.choose_targets"),className:"rounded text-xs font-medium text-oai-gray-500 underline decoration-oai-gray-300 decoration-dotted underline-offset-2 transition hover:text-oai-black hover:decoration-oai-gray-500 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 disabled:cursor-not-allowed disabled:opacity-60 dark:text-oai-gray-400 dark:decoration-oai-gray-600 dark:hover:text-white dark:hover:decoration-oai-gray-400",children:r("skills.card.targets_change")}),e.jsx(Ia,{children:e.jsx($a,{sideOffset:6,side:"bottom",align:"end",className:"!z-[80]",children:e.jsxs(Ea,{className:"min-w-[220px] rounded-lg bg-white p-1.5 shadow-lg ring-1 ring-oai-gray-200 dark:bg-oai-gray-950 dark:ring-oai-gray-800",children:[e.jsx("div",{className:"px-2 pb-1 pt-0.5 text-[11px] font-medium uppercase tracking-wide text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.target.menu_label")}),c.map(y=>{const C=h.includes(y.id);return e.jsxs("label",{className:"flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-sm text-oai-black hover:bg-oai-gray-100 dark:text-white dark:hover:bg-oai-gray-800",children:[e.jsx("input",{type:"checkbox",className:"h-4 w-4 shrink-0 rounded border-oai-gray-300 text-oai-black focus:ring-oai-gray-400 dark:border-oai-gray-600 dark:bg-oai-gray-900 dark:text-white",checked:C,onChange:()=>o(y.id)}),e.jsx(be,{provider:y.id,size:16}),e.jsx("span",{className:"flex-1 text-left",children:y.label})]},y.id)})]})})})]})]}),e.jsxs(G,{type:"button",size:"sm",onClick:()=>u(s,h),disabled:m||h.length===0,className:"w-full",children:[m?e.jsx(ee,{className:"mr-1.5 h-3.5 w-3.5 animate-spin","aria-hidden":!0}):e.jsx(za,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),r("skills.action.install")]})]})})]})});function Br({repos:a,repoInput:s,onRepoInput:l,busyKey:m,onAdd:c,onRemove:x}){return e.jsxs("div",{className:"rounded-lg border border-oai-gray-200 bg-white p-4 dark:border-oai-gray-800 dark:bg-oai-gray-950",children:[e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[e.jsx(ga,{value:s,onChange:u=>l(u.target.value),placeholder:r("skills.repo.placeholder"),className:"min-w-0 flex-1"}),e.jsxs(G,{type:"button",variant:"secondary",size:"md",onClick:c,disabled:m==="repo:add",className:"shrink-0 whitespace-nowrap",children:[m==="repo:add"?e.jsx(ee,{className:"mr-1.5 h-4 w-4 animate-spin","aria-hidden":!0}):e.jsx(Ka,{className:"mr-1.5 h-4 w-4","aria-hidden":!0}),r("skills.repo.add")]})]}),a.length?e.jsx("div",{className:"mt-3 divide-y divide-oai-gray-200/70 dark:divide-oai-gray-800/70",children:a.map(u=>{const g=m===`repo:${u.owner}/${u.name}`;return e.jsxs("div",{className:"flex items-center justify-between gap-3 py-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"truncate text-sm font-medium text-oai-black dark:text-white",children:[u.owner,"/",u.name]}),e.jsx("div",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400",children:u.branch})]}),e.jsxs(G,{type:"button",variant:"ghost",size:"sm",disabled:g,onClick:()=>x(u),className:"shrink-0",children:[g?e.jsx(ee,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):e.jsx(ma,{className:"h-3.5 w-3.5","aria-hidden":!0}),e.jsx("span",{className:"sr-only",children:r("skills.repo.remove")})]})]},`${u.owner}/${u.name}`)})}):null]})}function Mr(){return typeof window>"u"?"my":new URLSearchParams(window.location.search).get("tab")==="browse"?"browse":"my"}function Xr(){const[a,s]=i.useState(Mr),[l,m]=i.useState({skills:[],targets:[]}),[c,x]=i.useState([]),[u,g]=i.useState([]),[h,b]=i.useState([]),[o,k]=i.useState(xe),[N,w]=i.useState(""),[v,y]=i.useState(""),[C,$]=i.useState(""),[U,W]=i.useState(""),[F,ge]=i.useState(""),[j,ae]=i.useState(!1),[E,K]=i.useState("all"),[Q,te]=i.useState(null),[z,ke]=i.useState(""),[we,Fe]=i.useState(!0),[Le,ze]=i.useState(!1),[Ae,D]=i.useState(""),[re,X]=i.useState(null),[ve,L]=i.useState(null),[V,se]=i.useState(()=>new Set),[I,ne]=i.useState({}),[P,Pe]=i.useState({}),[je,ie]=i.useState([]),[pe,Re]=i.useState(!1),Ie=i.useRef(!1),$e=i.useMemo(()=>{const t=new Set;for(const n of l.skills||[])for(const d of Ca(n))t.add(d);return t},[l.skills]),Ne=i.useCallback(async()=>{const t=await vt();m({skills:t.skills||[],targets:t.targets||[]})},[]),q=i.useCallback(async()=>{const t=await jt();b(t.repos||[])},[]),oe=i.useCallback(async({force:t=!1}={})=>{ze(!0);try{const n=await Nt({force:t});x(n.skills||[])}finally{ze(!1)}},[]),fe=i.useCallback(async({force:t=!1}={})=>{Re(!0);try{const n=await Ct({force:t});ie(n.skills||[])}finally{Re(!1)}},[]),le=i.useCallback(async()=>{try{const t=await St();ne(t?.updates||{})}catch{ne({})}},[]),de=i.useCallback(async()=>{try{const t=await _t(),n={};for(const d of t?.skills||[])d.installed&&(d.directory&&(n[String(d.directory).toLowerCase()]=d),n[String(d.skill).toLowerCase()]=d);Pe(n)}catch{Pe({})}},[]),he=i.useCallback(async()=>{Fe(!0),D("");try{await Promise.all([Ne(),q()])}catch(t){D(t?.message||r("skills.error.generic"))}finally{Fe(!1)}},[Ne,q]),Je=i.useCallback(async()=>{await he();const t=n=>D(n?.message||r("skills.error.generic"));a==="my"?(le(),de()):o===O?fe({force:!0}).catch(t):o!==M&&oe({force:!0}).catch(t)},[oe,he,fe,le,de,o,a]);i.useEffect(()=>{he()},[he]),i.useEffect(()=>{if(Ie.current||typeof window>"u")return;const t=new URLSearchParams(window.location.search),n=t.get("skill");if(!n){Ie.current=!0;return}const d=l.skills||[];if(!d.length)return;const p=d.find(S=>S.directory===n||S.id===n);p&&(s("my"),te(p.id||p.directory)),Ie.current=!0,t.delete("skill");const R=t.toString();window.history.replaceState({},"",`${window.location.pathname}${R?`?${R}`:""}${window.location.hash}`)},[l.skills]),i.useEffect(()=>{a==="browse"&&(o===M||o===O||c.length===0&&oe().catch(t=>D(t?.message||r("skills.error.generic"))))},[c.length,oe,o,a]),i.useEffect(()=>{a!=="browse"||o!==O||je.length===0&&fe().catch(t=>D(t?.message||r("skills.error.generic")))},[fe,je.length,o,a]);const Ke=Object.keys(I).length>0,ce=Object.keys(P).length>0;if(i.useEffect(()=>{a==="my"&&(Ke||le(),ce||de())},[a,Ke,ce,le,de]),i.useEffect(()=>{const t=setTimeout(()=>y(N),200);return()=>clearTimeout(t)},[N]),i.useEffect(()=>{const t=setTimeout(()=>W(C),120);return()=>clearTimeout(t)},[C]),i.useEffect(()=>{if(typeof window>"u")return;const t=new URLSearchParams(window.location.search),n=t.get("tab");if(a==="my"){if(!n)return;t.delete("tab")}else{if(n===a)return;t.set("tab",a)}const d=t.toString(),p=`${window.location.pathname}${d?`?${d}`:""}${window.location.hash}`;window.history.replaceState({},"",p)},[a]),!vr&&!Lt())return e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx(Mt,{})});const _=async(t,n)=>{ke(t),D("");try{await n(),await Ne()}catch(d){D(d?.message||r("skills.error.generic"))}finally{ke("")}},Ze=(t,n)=>{const d=(n&&n.length?n:na).filter(p=>(l.targets||[]).some(R=>R.id===p));_(Ge(t),async()=>{await fa(t,d);const p=d.map(R=>(l.targets||[]).find(S=>S.id===R)?.label||R).join(", ");Ce({title:r("skills.toast.installed",{name:t.name||t.directory,targets:p||r("skills.target.none")}),timeout:4e3})})},Ee=t=>{X(t)},ye=()=>{const t=re;t&&(X(null),_(Sa(t),async()=>{let n=null;t.managed?n=await ya(t.id):await ba(t.directory,t.targets||[]);const d=!!(n?.trashed&&t.managed&&t.id);Ce({title:r("skills.toast.removed",{name:t.name||t.directory}),timeout:6e3,data:d?{onUndo:async()=>{try{await $t(t.id),await Ne()}catch(p){D(p?.message||r("skills.error.generic"))}}}:void 0})}))},Y=(t,n,d)=>_(Xa(t.id,n),async()=>{const p=new Set(t.targets||[]);d?p.add(n):p.delete(n),t.managed?await ka(t.id,Array.from(p)):await wa(t.directory,Array.from(p));const R={name:t.name||t.directory,agent:Ve(n)};Ce({title:d?r("skills.toast.synced_one",R):r("skills.toast.unsynced_one",R),timeout:3e3})}),Be=i.useCallback(()=>se(new Set),[]),ea=i.useCallback((t,n)=>{se(d=>{const p=new Set(d);return n?p.add(t.id):p.delete(t.id),p})},[]),Ve=t=>(l.targets||[]).find(n=>n.id===t)?.label||t,Me=t=>{const n=(l.skills||[]).filter(d=>V.has(d.id));n.length&&_("batch",async()=>{for(const d of n){const p=new Set(d.targets||[]);p.add(t),d.managed?await ka(d.id,Array.from(p)):await wa(d.directory,Array.from(p))}Be(),Ce({title:r("skills.toast.bulk_synced",{count:n.length,agent:Ve(t)}),timeout:4e3})})},aa=()=>{const t=(l.skills||[]).filter(n=>V.has(n.id));t.length&&L(t)},ta=()=>{const t=ve;t&&(L(null),_("batch",async()=>{for(const n of t)n.managed?await ya(n.id):await ba(n.directory,n.targets||[]);Be(),Ce({title:r("skills.toast.bulk_removed",{count:t.length}),timeout:4e3})}))},f=t=>{!t?.repoOwner||!t?.repoName||_(Ge(t),async()=>{await fa({key:t.key,name:t.name,description:t.description,directory:t.sourceDirectory||t.directory,repoOwner:t.repoOwner,repoName:t.repoName,repoBranch:t.repoBranch,readmeUrl:t.readmeUrl},t.targets&&t.targets.length?t.targets:na),await le(),Ce({title:r("skills.toast.updated",{name:t.name||t.directory}),timeout:4e3})})},T=async()=>{const t=N.trim();if(!(t.length<2)){ke("search"),D("");try{const n=await It(t);g(n.skills||[])}catch(n){D(n?.message||r("skills.error.generic"))}finally{ke("")}}},ue=async()=>{const t=F.trim().replace(/^https:\/\/github\.com\//,"").replace(/\.git$/,""),[n,d]=t.split("/");if(!n||!d){D(r("skills.repo.invalid"));return}await _("repo:add",async()=>{await Bt({owner:n,name:d,branch:"main",enabled:!0}),ge(""),await q(),await oe()})},me=async t=>{await _(`repo:${t.owner}/${t.name}`,async()=>{await Et(t.owner,t.name),await q(),await oe()})},B=l.targets||[],H=l.skills||[],De=i.useMemo(()=>{const t=E==="all"?H:H.filter(d=>(d.targets||[]).includes(E)),n=U.trim().toLowerCase();return n?t.filter(d=>(d.name||"").toLowerCase().includes(n)||(d.directory||"").toLowerCase().includes(n)||(d.description||"").toLowerCase().includes(n)):t},[H,E,U]),Ya=E!=="all",J=i.useMemo(()=>Q&&H.find(t=>(t.id||t.directory)===Q)||null,[H,Q]),Ja=i.useCallback(()=>{K("all"),$("")},[]),Za=i.useCallback(t=>{te(n=>{const d=t?.id||t?.directory||null;return n===d?null:d})},[]),et=i.useCallback(()=>te(null),[]),at=i.useCallback(t=>{const n=Ye(t).toLowerCase(),d=Na(t),p=(l.skills||[]).find(R=>{const S=Ca(R);return S.has(n)||d&&S.has(d)});p&&te(p.id||p.directory)},[l.skills]);i.useEffect(()=>{a!=="my"&&V.size&&se(new Set)},[a,V.size]),i.useEffect(()=>{Q&&!J&&te(null)},[J,Q]);const Te=i.useMemo(()=>{const t=o===M?u:o===O?je:c,d=o===M||o===O||o===xe?t:t.filter(S=>`${S.repoOwner}/${S.repoName}`===o),p=v.trim().toLowerCase();return(o===M||!p?d:d.filter(S=>(S.name||"").toLowerCase().includes(p)||(S.directory||"").toLowerCase().includes(p)||(S.description||"").toLowerCase().includes(p))).map(S=>{const ra=Ye(S).toLowerCase(),A=Na(S);return{...S,installed:$e.has(ra)||A&&$e.has(A)}})},[v,c,$e,je,u,o]),tt=e.jsx("div",{className:"flex h-64 items-center justify-center",children:e.jsx(ee,{className:"h-8 w-8 animate-spin text-oai-gray-400","aria-hidden":!0})}),rt=e.jsxs("div",{className:"flex h-64 flex-col items-center justify-center gap-3 px-6 text-center",children:[e.jsx(ee,{className:"h-8 w-8 animate-spin text-oai-gray-400","aria-hidden":!0}),e.jsx("p",{className:"max-w-md text-xs text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.browse.loading_hint")})]}),qe=(t,n=null)=>e.jsxs("div",{className:"flex flex-col items-center gap-4 rounded-lg border border-dashed border-oai-gray-200 px-4 py-10 text-center text-sm text-oai-gray-500 dark:border-oai-gray-800 dark:text-oai-gray-400",children:[e.jsx("p",{children:r(t)}),n]});let He;if(we)He=tt;else if(a==="my")He=H.length?e.jsx(Ir,{items:De,totalCount:H.length,targets:B,agentOptions:B,agentFilter:E,onAgentFilter:K,anyFilter:Ya,onClearFilters:Ja,searchQuery:C,onSearchQuery:$,searchPlaceholder:r("skills.my.placeholder"),selectedId:Q,onSelect:Za,onToggleTarget:Y,busyKey:z,updates:I,selectedIds:V,onToggleSelect:ea,onClearSelection:Be,onBulkSync:Me,onBulkRemove:aa}):e.jsxs("div",{className:"flex flex-col items-center gap-4 rounded-lg border border-dashed border-oai-gray-200 px-4 py-10 text-center dark:border-oai-gray-800",children:[B.length>0?e.jsxs("div",{className:"relative h-11 w-80 overflow-hidden","aria-hidden":!0,children:[e.jsx("div",{className:"pointer-events-none absolute inset-0",style:{maskImage:"linear-gradient(to right, transparent 8%, black 20%, black 32%, transparent 44%, transparent 56%, black 68%, black 80%, transparent 92%)",WebkitMaskImage:"linear-gradient(to right, transparent 8%, black 20%, black 32%, transparent 44%, transparent 56%, black 68%, black 80%, transparent 92%)"},children:e.jsx("div",{className:"absolute inset-y-0 left-0 flex w-max items-center animate-marquee-x",style:{filter:"blur(2.5px)"},children:[...B,...B].map((t,n)=>e.jsx("span",{className:"shrink-0 px-3",children:e.jsx(be,{provider:t.id,size:30})},`b-${n}`))})}),e.jsx("div",{className:"pointer-events-none absolute inset-0",style:{maskImage:"linear-gradient(to right, transparent 28%, black 42%, black 58%, transparent 72%)",WebkitMaskImage:"linear-gradient(to right, transparent 28%, black 42%, black 58%, transparent 72%)"},children:e.jsx("div",{className:"absolute inset-y-0 left-0 flex w-max items-center animate-marquee-x",children:[...B,...B].map((t,n)=>e.jsx("span",{className:"shrink-0 px-3",children:e.jsx(be,{provider:t.id,size:30})},`c-${n}`))})}),e.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-0 w-20 bg-gradient-to-r from-oai-white to-transparent dark:from-oai-gray-900"}),e.jsx("div",{className:"pointer-events-none absolute inset-y-0 right-0 w-20 bg-gradient-to-l from-oai-white to-transparent dark:from-oai-gray-900"})]}):null,e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:r("skills.empty.my")}),e.jsx(G,{type:"button",size:"sm",onClick:()=>s("browse"),children:r("skills.empty.my_cta")})]});else{const t=o===M,n=o===O,d=h.length===0&&!t&&!n,p=Le&&!t&&!n||n&&pe,R=!t&&!n&&(v.trim()!==""||o!==xe),S=()=>{w(""),k(xe)},ra=!d&&!p&&(Te.length>0||R)?e.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2 px-1 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:[e.jsx("span",{children:r("skills.filter.result_count_browse",{count:Te.length})}),R?e.jsxs("button",{type:"button",onClick:S,className:"ml-auto inline-flex h-7 items-center gap-1 rounded-full bg-oai-gray-100 px-2.5 text-[11px] font-medium text-oai-gray-700 transition hover:bg-oai-gray-200 focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:bg-oai-gray-800/70 dark:text-oai-gray-200 dark:hover:bg-oai-gray-700",children:[e.jsx(Se,{className:"h-3 w-3","aria-hidden":!0}),r("skills.filter.clear")]}):null]}):null;let A;d?A=e.jsx("div",{className:"rounded-lg border border-dashed border-oai-gray-200 p-6 text-center dark:border-oai-gray-800",children:e.jsx("p",{className:"text-sm text-oai-gray-600 dark:text-oai-gray-300",children:r("skills.browse.empty_sources")})}):p?A=rt:t&&N.trim().length<2?A=e.jsx("div",{className:"rounded-lg border border-dashed border-oai-gray-200 px-4 py-6 text-center text-sm text-oai-gray-500 dark:border-oai-gray-800 dark:text-oai-gray-400",children:r("skills.browse.hint_skillssh")}):Te.length?A=e.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:Te.map(Oe=>e.jsx("div",{style:$r,children:e.jsx(Er,{skill:Oe,installed:!!Oe.installed,installing:z===Ge(Oe),allTargets:B,defaultTargets:na,onInstall:Ze,onManage:at})},Oe.id||Oe.key))}):R?A=qe("skills.empty.no_match",e.jsx(G,{type:"button",variant:"secondary",size:"sm",onClick:S,children:r("skills.filter.clear")})):t?A=qe("skills.empty.search"):n?A=qe("skills.empty.popular"):A=qe("skills.empty.browse");const st=d||j?e.jsx("div",{className:"mb-5",children:e.jsx(Br,{repos:h,repoInput:F,onRepoInput:ge,busyKey:z,onAdd:ue,onRemove:me})}):null,nt=!j&&!t&&!n&&h.length<=1&&Te.length>0?e.jsx(rr,{id:"skills-browse-intro",className:"mt-6",children:e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[e.jsx("span",{children:r("skills.browse.add_repo_hint")}),e.jsx("button",{type:"button",onClick:()=>ae(!0),className:"rounded font-medium text-oai-gray-700 underline decoration-dotted underline-offset-2 transition hover:text-oai-black focus:outline-none focus:ring-2 focus:ring-oai-gray-400/30 dark:text-oai-gray-200 dark:hover:text-white",children:r("skills.browse.manage_sources")})]})}):null;He=e.jsxs(e.Fragment,{children:[st,ra,A,nt]})}return e.jsxs("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:[e.jsx("main",{className:"flex-1 pb-12 pt-8 sm:pb-16 sm:pt-10",children:e.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[e.jsxs("div",{className:"mb-6 flex items-end justify-between gap-4",children:[e.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:r("skills.page.title")}),e.jsxs(G,{type:"button",variant:"secondary",size:"sm",onClick:Je,disabled:we||Le||pe,children:[e.jsx(Pt,{className:Z("mr-1.5 h-3.5 w-3.5",(we||Le||pe)&&"animate-spin"),"aria-hidden":!0}),r("skills.action.refresh")]})]}),e.jsx("div",{className:"mb-5 flex gap-6 border-b border-oai-gray-200 dark:border-oai-gray-800",children:[["my",r("skills.tab.my")],["browse",r("skills.tab.browse")]].map(([t,n])=>e.jsx("button",{type:"button","aria-pressed":a===t,onClick:()=>s(t),className:Z("-mb-px border-b-2 pb-2 text-sm font-medium transition-colors",a===t?"border-oai-black text-oai-black dark:border-white dark:text-white":"border-transparent text-oai-gray-500 hover:text-oai-black dark:text-oai-gray-400 dark:hover:text-white"),children:n},t))}),Ae?e.jsx("div",{className:"mb-4 rounded-lg border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700 dark:border-red-900/60 dark:bg-red-950/30 dark:text-red-200",children:Ae}):null,a==="browse"?e.jsxs("div",{className:"mb-5 flex flex-col gap-3 sm:flex-row sm:items-center",children:[e.jsx("div",{role:"tablist","aria-label":r("skills.source.label"),className:"inline-flex h-10 shrink-0 items-center rounded-md border border-oai-gray-200 bg-oai-white p-1 dark:border-oai-gray-800 dark:bg-oai-gray-900",children:[["repo",r("skills.mode.repo"),o!==M&&o!==O],["popular",r("skills.mode.popular"),o===O],["skillssh",r("skills.mode.skillssh"),o===M]].map(([t,n,d])=>e.jsxs("button",{type:"button",role:"tab","aria-selected":d,onClick:()=>{t==="skillssh"?k(M):t==="popular"?k(O):(o===M||o===O)&&k(xe)},className:Z("inline-flex items-center gap-1.5 rounded px-3 py-1 text-sm font-medium transition-colors",d?"bg-oai-gray-100 text-oai-black dark:bg-oai-gray-700 dark:text-white":"text-oai-gray-500 hover:text-oai-gray-800 dark:text-oai-gray-400 dark:hover:text-oai-gray-200"),children:[t==="popular"?e.jsx(Jt,{className:"h-3.5 w-3.5","aria-hidden":!0}):null,n]},t))}),o!==M&&o!==O?e.jsxs(Ma,{value:o,onValueChange:k,children:[e.jsxs(Da,{"aria-label":r("skills.source.label"),className:"inline-flex h-10 w-44 shrink-0 items-center justify-between gap-2 rounded-md border border-oai-gray-200 bg-oai-white px-3 text-sm text-oai-black focus:outline-none data-[popup-open]:border-oai-gray-300 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-white dark:data-[popup-open]:border-oai-gray-700",children:[e.jsx(Ta,{children:t=>t===xe?r("skills.source.all"):t}),e.jsx(Va,{className:"text-oai-gray-400",children:e.jsx(ua,{className:"h-4 w-4","aria-hidden":!0})})]}),e.jsx(Oa,{children:e.jsx(Ua,{sideOffset:4,alignItemWithTrigger:!1,className:"z-[60]",children:e.jsxs(Fa,{className:"min-w-[var(--anchor-width)] overflow-hidden rounded-md border border-oai-gray-200 bg-white p-1 shadow-[0_12px_32px_-12px_rgba(0,0,0,0.18)] outline-none transition-[opacity,transform] duration-150 ease-out data-[ending-style]:scale-[0.97] data-[ending-style]:opacity-0 data-[starting-style]:scale-[0.97] data-[starting-style]:opacity-0 dark:border-oai-gray-800 dark:bg-oai-gray-950 dark:shadow-[0_12px_32px_-12px_rgba(0,0,0,0.6)]",children:[e.jsxs(We,{value:xe,className:"flex cursor-default select-none items-center justify-between gap-2 rounded px-3 py-1.5 text-sm text-oai-black outline-none data-[highlighted]:bg-oai-gray-100 dark:text-white dark:data-[highlighted]:bg-oai-gray-800",children:[e.jsx(Qe,{children:r("skills.source.all")}),e.jsx(Xe,{children:e.jsx(_e,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),h.map(t=>{const n=`${t.owner}/${t.name}`;return e.jsxs(We,{value:n,className:"flex cursor-default select-none items-center justify-between gap-2 rounded px-3 py-1.5 text-sm text-oai-black outline-none data-[highlighted]:bg-oai-gray-100 dark:text-white dark:data-[highlighted]:bg-oai-gray-800",children:[e.jsx(Qe,{children:n}),e.jsx(Xe,{children:e.jsx(_e,{className:"h-3.5 w-3.5","aria-hidden":!0})})]},n)})]})})})]}):null,e.jsxs("div",{className:"relative flex-1",children:[e.jsx(oa,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-oai-gray-400","aria-hidden":!0}),e.jsx(ga,{type:"search",value:N,onChange:t=>w(t.target.value),onKeyDown:t=>{t.key==="Enter"&&o===M&&T()},"aria-label":r("skills.action.search_aria"),placeholder:o===M?r("skills.browse.placeholder_skillssh"):o===O?r("skills.browse.placeholder_popular"):o===xe?r("skills.browse.placeholder_all"):r("skills.browse.placeholder_repo",{repo:o}),className:"pl-9 !border-oai-gray-200 dark:!border-oai-gray-800 focus:!border-oai-gray-400 focus:!ring-oai-gray-400/20 dark:focus:!border-oai-gray-500 dark:focus:!ring-oai-gray-500/20"})]}),o===M?e.jsxs(G,{type:"button",onClick:T,disabled:N.trim().length<2||z==="search",className:"focus:!ring-oai-gray-400/30",children:[z==="search"?e.jsx(ee,{className:"mr-1.5 h-4 w-4 animate-spin","aria-hidden":!0}):e.jsx(oa,{className:"mr-1.5 h-4 w-4","aria-hidden":!0}),r("skills.action.search")]}):o===O?null:e.jsxs(G,{type:"button",variant:"secondary",size:"sm",onClick:()=>ae(t=>!t),"aria-expanded":j,className:"!h-10 shrink-0 whitespace-nowrap !border-oai-gray-200 dark:!border-oai-gray-800 hover:!border-oai-gray-300 dark:hover:!border-oai-gray-700 hover:!text-oai-black dark:hover:!text-white focus:!ring-oai-gray-400/30",children:[e.jsx(Ka,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),r("skills.browse.manage_sources"),e.jsx("span",{className:"ml-1.5 rounded bg-oai-gray-100 px-1.5 py-0.5 text-xs font-medium text-oai-gray-600 dark:bg-oai-gray-800 dark:text-oai-gray-300",children:h.length})]})]}):null,He,e.jsx(kr,{skill:J,targets:B,busyKey:z,usage:J&&(P[String(J.directory||"").toLowerCase()]||P[String(J.name||"").toLowerCase()])||null,hasUpdate:!!(J?.id&&I?.[J.id]),updating:J?z===Ge(J):!1,onUpdate:f,onClose:et,onToggleTarget:Y,onRemove:Ee})]})}),e.jsx(va,{open:!!re,title:r("skills.confirm.remove_title",{name:re?.name||re?.directory||""}),description:re?re.managed?r("skills.confirm.remove_managed"):r("skills.confirm.remove_local"):"",confirmLabel:r("skills.action.remove"),cancelLabel:r("shared.action.cancel"),destructive:!0,busy:z===Sa(re||{}),onCancel:()=>X(null),onConfirm:ye}),e.jsx(va,{open:!!ve,title:r("skills.confirm.bulk_remove_title",{count:ve?.length||0}),description:r("skills.confirm.bulk_remove_desc"),confirmLabel:r("skills.action.remove"),cancelLabel:r("shared.action.cancel"),destructive:!0,busy:z==="batch",onCancel:()=>L(null),onConfirm:ta})]})}export{Xr as SkillsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c}from"./main-BQdH4mOs.js";const e=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],t=c("check",e);export{t as C};
|