tokentracker-cli 0.87.2 → 0.87.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dashboard/dist/assets/{AchievementBadge-C468-Rsw.js → AchievementBadge-jaWv39Mh.js} +1 -1
- package/dashboard/dist/assets/{AchievementsPage-CZWzSdiH.js → AchievementsPage-CqIWdffx.js} +2 -2
- package/dashboard/dist/assets/{AchievementsSection-DXt6VbwH.js → AchievementsSection-RAoIBoQ_.js} +1 -1
- package/dashboard/dist/assets/{BadgeDetailModal-BtGvpqQm.js → BadgeDetailModal-CYaSfxwZ.js} +1 -1
- package/dashboard/dist/assets/{Card-DZ-_fXkw.js → Card-Cl4XFCGL.js} +1 -1
- package/dashboard/dist/assets/{ClawdAnimated-9rXaHo1-.js → ClawdAnimated-DuFB46-u.js} +1 -1
- package/dashboard/dist/assets/{CommandPalette-sqIvZNsH.js → CommandPalette-CLfTNQK0.js} +1 -1
- package/dashboard/dist/assets/{CommunityStatsModal-c8VohIqQ.js → CommunityStatsModal-DCRCXmPl.js} +1 -1
- package/dashboard/dist/assets/{ConfirmModal-Ct2HLdds.js → ConfirmModal-B0IuSw4g.js} +1 -1
- package/dashboard/dist/assets/{Controls-DPtXGUGi.js → Controls-BJF1FutB.js} +1 -1
- package/dashboard/dist/assets/DashboardPage-BFthq-Oc.js +1 -0
- package/dashboard/dist/assets/{DevicePage-Ds4GEuqY.js → DevicePage-iZn2m4Y3.js} +1 -1
- package/dashboard/dist/assets/{DialogClose-B2IAbJG4.js → DialogClose-CdPKVRcX.js} +1 -1
- package/dashboard/dist/assets/DialogDescription-pCAELf1b.js +1 -0
- package/dashboard/dist/assets/{DialogTitle-BIwLH6gA.js → DialogTitle-Ul-NH9HD.js} +1 -1
- package/dashboard/dist/assets/{FadeIn-DPS7_DOB.js → FadeIn-Bb3pNOAn.js} +1 -1
- package/dashboard/dist/assets/{HeaderGithubStar-CsSgr9Hd.js → HeaderGithubStar-CtUK-3_x.js} +1 -1
- package/dashboard/dist/assets/{HoverTooltip-CLGZW2d-.js → HoverTooltip-B3TmAZtV.js} +1 -1
- package/dashboard/dist/assets/{IpCheckPage-DEM_uk69.js → IpCheckPage-CXcY3jc-.js} +1 -1
- package/dashboard/dist/assets/{LandingPage-BQ3YzZ68.js → LandingPage-BK4sn4MV.js} +2 -2
- package/dashboard/dist/assets/{LeaderboardAvatar-ySznr4Ml.js → LeaderboardAvatar-AYzG1gTH.js} +1 -1
- package/dashboard/dist/assets/LeaderboardPage-DhKcc74d.js +2 -0
- package/dashboard/dist/assets/{LeaderboardProfileModal-Drvsb5xF.js → LeaderboardProfileModal-DvmDBmOL.js} +3 -3
- package/dashboard/dist/assets/{LeaderboardProfilePage-BD0P-zZF.js → LeaderboardProfilePage-1_GGQngL.js} +1 -1
- package/dashboard/dist/assets/{LimitsPage-Mbn2mj6S.js → LimitsPage-dSEtf2TB.js} +1 -1
- package/dashboard/dist/assets/{LocalOnlyNotice-BsKgtoVa.js → LocalOnlyNotice-Bo1dtxi6.js} +1 -1
- package/dashboard/dist/assets/{LoginCard-CTQDdHcx.js → LoginCard-BpjNU-ah.js} +1 -1
- package/dashboard/dist/assets/{LoginModal-BxCyLDEW.js → LoginModal-D3_vPG1R.js} +1 -1
- package/dashboard/dist/assets/{LoginPage-ftxnX8g1.js → LoginPage-BoeLhbwK.js} +1 -1
- package/dashboard/dist/assets/{PetPage-CQsfqsm8.js → PetPage-BnkNWvcV.js} +1 -1
- package/dashboard/dist/assets/PopoverPopup-CkaOLLN4.js +1 -0
- package/dashboard/dist/assets/{ProviderIcon-7Tkq9_m6.js → ProviderIcon-B3hZ1YWD.js} +1 -1
- package/dashboard/dist/assets/{ResetPasswordPage-D-MPpQd1.js → ResetPasswordPage-BusTiA5M.js} +1 -1
- package/dashboard/dist/assets/{SegmentedControl-CYFrzu9w.js → SegmentedControl-C_IwmWnO.js} +1 -1
- package/dashboard/dist/assets/{Select-Dp4V9p6t.js → Select-Dj3hUGFb.js} +1 -1
- package/dashboard/dist/assets/SelectItemText-BWaMX4pY.js +1 -0
- package/dashboard/dist/assets/{ServiceStatusPage-BT6hvvLW.js → ServiceStatusPage-BnnCouAs.js} +1 -1
- package/dashboard/dist/assets/{SessionsPage-BopeZBiH.js → SessionsPage-DMU5CiFf.js} +1 -1
- package/dashboard/dist/assets/SettingsPage-_cJl0qwK.js +1 -0
- package/dashboard/dist/assets/{SkillsPage-Cr8O6eOH.js → SkillsPage-Cz3tV65I.js} +1 -1
- package/dashboard/dist/assets/{TokenGalaxy-BoUsrUEs.js → TokenGalaxy-BddGGmti.js} +1 -1
- package/dashboard/dist/assets/{ToolbarRootContext-CwRaHhMN.js → ToolbarRootContext-Q_DQJlr5.js} +1 -1
- package/dashboard/dist/assets/{TrendMonitor-BV2ugEsw.js → TrendMonitor-CVi7mLtI.js} +1 -1
- package/dashboard/dist/assets/{WidgetsPage-B7r4mvrw.js → WidgetsPage-BdIGupvg.js} +1 -1
- package/dashboard/dist/assets/{WrappedPage-CFU9l22i.js → WrappedPage-BB-orT9Q.js} +1 -1
- package/dashboard/dist/assets/{__vite-browser-external-Db9onipF.js → __vite-browser-external-egzerGU6.js} +2 -2
- package/dashboard/dist/assets/{agent-logos-DSSn_SPi.js → agent-logos-B2pH4QTS.js} +1 -1
- package/dashboard/dist/assets/{arrow-up-right-COvrArNz.js → arrow-up-right-CEUtBwnj.js} +1 -1
- package/dashboard/dist/assets/{check-CasSqiev.js → check-Ct-iMhaB.js} +1 -1
- package/dashboard/dist/assets/{chevron-right-B1PMeNoD.js → chevron-right-CIcqYgwy.js} +1 -1
- package/dashboard/dist/assets/{copy-D67vycfp.js → copy-Bx07orpr.js} +1 -1
- package/dashboard/dist/assets/{download-adOCFO2v.js → download-6N9dBj_W.js} +1 -1
- package/dashboard/dist/assets/{external-link-DVanKEuy.js → external-link-B39v_fs8.js} +1 -1
- package/dashboard/dist/assets/{flame-RbiHZM9b.js → flame-xbjyxu-1.js} +1 -1
- package/dashboard/dist/assets/{format-tokens-DhMp1e1L.js → format-tokens-C1ZXX8ed.js} +1 -1
- package/dashboard/dist/assets/{icons-BC0p_aGr.js → icons-D7dTRGnv.js} +1 -1
- package/dashboard/dist/assets/{index-A41xjc83.js → index-BJ8Q1dU0.js} +1 -1
- package/dashboard/dist/assets/{index-DrgBqR3o.js → index-MbSf_y6N.js} +1 -1
- package/dashboard/dist/assets/{index-CaRyTJ6K.js → index-pxtsHew5.js} +1 -1
- package/dashboard/dist/assets/{info-D9LwqlnC.js → info-YSmBFAMa.js} +1 -1
- package/dashboard/dist/assets/{limits-providers-CRHpXhmW.js → limits-providers-BDltKBG_.js} +1 -1
- package/dashboard/dist/assets/{link-2-B5f4qFR0.js → link-2--CbT8swK.js} +1 -1
- package/dashboard/dist/assets/{loader-circle-DCmwZEdS.js → loader-circle-B5Hs89F2.js} +1 -1
- package/dashboard/dist/assets/{maximize-2-BMalEDCZ.js → maximize-2-Cj3P-Bay.js} +1 -1
- package/dashboard/dist/assets/modifiers.esm-BXOR3VJH.js +1 -0
- package/dashboard/dist/assets/{provider-display-qMFRUZHm.js → provider-display-BXtFP7Ak.js} +1 -1
- package/dashboard/dist/assets/{react-BnaPNGj8.js → react-DujpLuOh.js} +1 -1
- package/dashboard/dist/assets/{search-BrqBkLs2.js → search-BswhdD2a.js} +1 -1
- package/dashboard/dist/assets/{skills-api-vo3iM6yD.js → skills-api-CGohvSGo.js} +1 -1
- package/dashboard/dist/assets/sortable.esm-BXiHjoqY.js +5 -0
- package/dashboard/dist/assets/{store-BwMVXuz3.js → store-BTdeRhbU.js} +1 -1
- package/dashboard/dist/assets/{terminal-BiyUh_8k.js → terminal-DawYBEVr.js} +1 -1
- package/dashboard/dist/assets/{trash-2-DAr4sqkX.js → trash-2-CSt4wZ-I.js} +1 -1
- package/dashboard/dist/assets/{use-community-stats-Cg48Zphy.js → use-community-stats-CHZTziox.js} +1 -1
- package/dashboard/dist/assets/{use-limits-display-prefs-DfKtH1Zn.js → use-limits-display-prefs-ChK-GCxK.js} +1 -1
- package/dashboard/dist/assets/use-ordered-list-DyyjthSr.js +1 -0
- package/dashboard/dist/assets/use-reduced-motion-B9hTo-eX.js +1 -0
- package/dashboard/dist/assets/{use-session-efficiency-pref-CMDTCAAd.js → use-session-efficiency-pref-Dv1clCTZ.js} +1 -1
- package/dashboard/dist/assets/{use-transform-B2d9Txt5.js → use-transform-DyBvIIFA.js} +1 -1
- package/dashboard/dist/assets/{use-usage-limits-CJbTUl9W.js → use-usage-limits-DrhY6h3M.js} +1 -1
- package/dashboard/dist/assets/{useCurrency-B0hJte5f.js → useCurrency-BgFo76Yb.js} +1 -1
- package/dashboard/dist/assets/{useScrollLock-DuosKdSB.js → useScrollLock-DPW-g15w.js} +1 -1
- package/dashboard/dist/assets/{useTokenFormat-DB8pKLFM.js → useTokenFormat-DrVDs8zo.js} +1 -1
- package/dashboard/dist/assets/{zap-rbzC4XgP.js → zap-Dsg_ZyH3.js} +1 -1
- package/dashboard/dist/index.html +1 -1
- package/dashboard/dist/ip-check.html +1 -1
- package/dashboard/dist/leaderboard.html +1 -1
- package/dashboard/dist/share.html +1 -1
- package/package.json +1 -1
- package/src/lib/codex-token-refresh.js +35 -7
- package/src/lib/pricing/seed-snapshot.json +1 -1
- package/src/lib/usage-limits.js +39 -28
- package/dashboard/dist/assets/DashboardPage-C65hbl8o.js +0 -1
- package/dashboard/dist/assets/DialogDescription-DeRza-LI.js +0 -1
- package/dashboard/dist/assets/LeaderboardPage-Br4JCoVE.js +0 -2
- package/dashboard/dist/assets/PopoverPopup-C16r8jQC.js +0 -1
- package/dashboard/dist/assets/SelectItemText-CxhBeoxx.js +0 -1
- package/dashboard/dist/assets/SettingsPage-D03GJJBd.js +0 -1
- package/dashboard/dist/assets/use-ordered-list-CnXfrWeF.js +0 -5
- package/dashboard/dist/assets/use-reduced-motion-BIgYrbON.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{m as C,j as t,e as N,c as a,a as ne,r as d,aq as ae,aH as ie,aw as se,ax as oe,a7 as U,aI as re,aJ as le,u as ce,d as O,Z as ue,a1 as F,n as I,aK as de,aL as ge,O as H,aM as me,y as he,aN as be,aO as pe,aP as xe,aQ as fe,aR as ye,aS as ve,aT as je,L as ke,R as Ne,aU as Se,aV as Ce,a4 as T,h as we,aW as Le}from"./__vite-browser-external-egzerGU6.js";import{a as Ae,b as G,s as Oe,K as Pe,P as Ee,D as _e,c as Ie,S as Te,v as Ge,u as Re,C as Me}from"./sortable.esm-BXiHjoqY.js";import{a as De}from"./modifiers.esm-BXOR3VJH.js";import{u as Ue,L as R}from"./use-limits-display-prefs-ChK-GCxK.js";import{P as Fe}from"./ProviderIcon-B3hZ1YWD.js";import{a as M,l as D}from"./limits-providers-BDltKBG_.js";import{m as He}from"./react-DujpLuOh.js";import{a as S,T as x,b as h,S as P,u as L}from"./Controls-BJF1FutB.js";import{P as Be,u as $e,a as Ve}from"./use-session-efficiency-pref-Dv1clCTZ.js";import{C as Ke}from"./check-Ct-iMhaB.js";import{C as ze}from"./copy-Bx07orpr.js";import{A as qe}from"./index-pxtsHew5.js";import{u as Ze}from"./useCurrency-BgFo76Yb.js";import{u as We}from"./useTokenFormat-DrVDs8zo.js";import{S as B}from"./Select-Dj3hUGFb.js";import{I as Qe}from"./info-YSmBFAMa.js";import{C as Ye}from"./ConfirmModal-B0IuSw4g.js";import{A as Je}from"./arrow-up-right-CEUtBwnj.js";import{D as Xe}from"./download-6N9dBj_W.js";import"./Card-Cl4XFCGL.js";import"./ToolbarRootContext-Q_DQJlr5.js";import"./useScrollLock-DPW-g15w.js";import"./SelectItemText-BWaMX4pY.js";import"./DialogTitle-Ul-NH9HD.js";import"./store-BTdeRhbU.js";import"./DialogDescription-pCAELf1b.js";const et=[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]],tt=C("flask-conical",et);const nt=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],at=C("grip-vertical",nt);const it=[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]],st=C("languages",it);const ot=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],rt=C("log-out",ot);const lt=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],ct=C("palette",lt);const ut=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],dt=C("user-round",ut),gt="shrink-0 text-oai-gray-900 dark:text-oai-gray-200";function mt({checked:e,onChange:n,ariaLabel:i}){return t.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":i,onClick:n,className:N("relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",e?"bg-oai-brand-500":"bg-oai-gray-300 dark:bg-oai-gray-700"),children:t.jsx("span",{className:N("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",e?"translate-x-[18px]":"translate-x-[3px]")})})}function ht({id:e,visible:n,onToggle:i}){const{attributes:s,listeners:o,setNodeRef:r,transform:l,transition:c,isDragging:u}=Re({id:e}),b={transform:Me.Transform.toString(l)||void 0,transition:c,zIndex:u?20:void 0};return t.jsxs("div",{ref:r,style:b,className:N("flex items-center gap-3 py-2 rounded-md select-none touch-none","cursor-grab active:cursor-grabbing","hover:bg-oai-gray-100/60 dark:hover:bg-oai-gray-800/60","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",u&&"relative bg-oai-gray-100 dark:bg-oai-gray-800"),...s,...o,children:[t.jsx(at,{className:"h-4 w-4 shrink-0 text-oai-gray-400 dark:text-oai-gray-500",strokeWidth:1.75,"aria-hidden":!0}),M(e)?t.jsx(Fe,{provider:M(e),size:18,className:N("pointer-events-none",gt)}):null,t.jsx("span",{className:"flex-1 text-sm text-oai-gray-900 dark:text-oai-gray-200",children:D(e)}),t.jsx("div",{onPointerDown:m=>m.stopPropagation(),children:t.jsx(mt,{checked:n,onChange:i,ariaLabel:`${a("limits.settings.toggle_visible")}: ${D(e)}`})})]})}function bt({prefs:e}){const{order:n,visibility:i,toggle:s,moveToward:o}=e,r=Ae(G(Ee,{activationConstraint:{distance:6}}),G(Pe,{coordinateGetter:Oe})),l=({active:c,over:u})=>{u&&c.id!==u.id&&o(c.id,u.id)};return t.jsx(_e,{sensors:r,collisionDetection:Ie,modifiers:[De],onDragEnd:l,children:t.jsx(Te,{items:n,strategy:Ge,children:t.jsx("div",{className:"flex flex-col",children:n.map(c=>t.jsx(ht,{id:c,visible:i[c]!==!1,onToggle:()=>s(c)},c))})})})}function pt(e){if(!e||typeof e!="object")return"";const n=e.user_metadata&&typeof e.user_metadata=="object"?e.user_metadata:{},i=e.profile&&typeof e.profile=="object"?e.profile:{},s=n.full_name||n.name||i.name||n.user_name||n.preferred_username;return typeof s=="string"&&s.trim()?s.trim():typeof e.email=="string"&&e.email.includes("@")?e.email.split("@")[0].trim()||e.email.trim():typeof e.email=="string"?e.email.trim():""}function xt(e){return!e||typeof e!="object"?"":typeof e.email=="string"?e.email.trim():""}function ft(e){const n=typeof e=="string"?e.trim():"";if(!n)return null;const i=n.match(/^@?([A-Za-z0-9][A-Za-z0-9-]{0,38})$/),s=n.match(/^https:\/\/github\.com\/([A-Za-z0-9][A-Za-z0-9-]{0,38})\/?$/i),o=i?.[1]||s?.[1];return o?`https://github.com/${o}`:null}function E(e,n){console.warn(`[tokentracker] settings ${e}:`,n)}function yt(e,n,i){const[s,o]=d.useState(()=>ae()),r=n&&i&&ie(),l=d.useCallback(async()=>{const c=!s;if(se(c),o(c),!!c)try{await oe(()=>e())}catch(u){E("cloud sync",u)}},[s,e]);return{cloudSyncOn:s,handleCloudSyncToggle:l,showLocalCloudSync:r}}function vt(e){const[n,i]=d.useState(!1),[s,o]=d.useState(!1),[r,l]=d.useState(!1),[c,u]=d.useState(!1),[b,m]=d.useState(null),[y,v]=d.useState(!1),[g,f]=d.useState(""),[p,j]=d.useState(!1),[w,_]=d.useState(""),[z,q]=d.useState(""),[Z,W]=d.useState(!1),[Q,Y]=d.useState(null),J=d.useMemo(()=>pt(e),[e]),X=d.useMemo(()=>xt(e),[e]),ee=d.useMemo(()=>typeof e?.id=="string"?e.id.trim():"",[e]),te=d.useMemo(()=>({setAnonymousOn:o,setCustomDisplayName:m,setGithubUrl:_,setProfileLoading:l,setPublicProfileOn:i,setShowGithubOn:j}),[]);return{anonymousOn:s,customDisplayName:b,displayName:J,editingGithub:Z,editingName:y,email:X,githubError:Q,githubInput:z,githubUrl:w,loadSetters:te,nameInput:g,profileLoading:r,profileSaving:c,publicProfileOn:n,setAnonymousOn:o,setCustomDisplayName:m,setEditingGithub:W,setEditingName:v,setGithubError:Y,setGithubInput:q,setGithubUrl:_,setNameInput:f,setProfileLoading:l,setProfileSaving:u,setPublicProfileOn:i,setShowGithubOn:j,showGithubOn:p,userId:ee}}function jt(e,n,i){d.useEffect(()=>{if(!n)return;let s=!0;return i.setProfileLoading(!0),(async()=>{try{const o=await U({getAccessToken:e});if(!s||!o)return;const r=await re({accessToken:o});if(!s)return;i.setPublicProfileOn(!!r?.enabled),i.setAnonymousOn(!!r?.anonymous),r?.display_name&&i.setCustomDisplayName(r.display_name),i.setShowGithubOn(!!r?.show_github_url),i.setGithubUrl(r?.github_url||"")}catch(o){E("load public profile",o)}finally{s&&i.setProfileLoading(!1)}})(),()=>{s=!1}},[e,n,i])}function kt(e,n){return d.useCallback(async(i,{label:s,onError:o,onSuccess:r}={})=>{if(n.profileSaving)return!1;n.setProfileSaving(!0);try{const l=await U({getAccessToken:e});if(!l)return!1;const c=await le({accessToken:l,...i});return r?.(c),!0}catch(l){return o?o(l):E(s||"mutate profile",l),!1}finally{n.setProfileSaving(!1)}},[e,n])}function Nt(e,n){return{anonymousOn:e.anonymousOn,customDisplayName:e.customDisplayName,displayName:e.displayName,editingName:e.editingName,handleAnonymousToggle:n.handleAnonymousToggle,handleSaveName:n.handleSaveName,nameInput:e.nameInput,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingName:e.setEditingName,setNameInput:e.setNameInput,startEditingName:n.startEditingName}}function St(e,n){return{editingGithub:e.editingGithub,githubError:e.githubError,githubInput:e.githubInput,githubUrl:e.githubUrl,handleSaveGithub:n.handleSaveGithub,handleShowGithubToggle:n.handleShowGithubToggle,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingGithub:e.setEditingGithub,setGithubError:e.setGithubError,setGithubInput:e.setGithubInput,showGithubOn:e.showGithubOn,startEditingGithub:n.startEditingGithub}}function Ct(e,n){const i=d.useCallback(async()=>{const o=!e.publicProfileOn;await n({enabled:o},{label:"toggle public profile",onSuccess:()=>e.setPublicProfileOn(o)})},[n,e]);return{handleAnonymousToggle:d.useCallback(async()=>{const o=!e.anonymousOn;await n({anonymous:o},{label:"toggle anonymous",onSuccess:()=>e.setAnonymousOn(o)})},[n,e]),handlePublicProfileToggle:i}}function wt(e,n,i){const s=d.useCallback(async()=>{const r=e.nameInput.trim().slice(0,50);r&&await n({display_name:r},{label:"save display name",onSuccess:()=>{e.setCustomDisplayName(r),e.setEditingName(!1),i?.()}})},[n,e,i]),o=d.useCallback(()=>{e.setNameInput(e.customDisplayName||e.displayName),e.setEditingName(!0)},[e]);return{handleSaveName:s,startEditingName:o}}function Lt(e,n){const i=d.useCallback(async()=>{if(!e.showGithubOn&&!e.githubUrl){e.setEditingGithub(!0),e.setGithubInput(""),e.setGithubError(null);return}const r=!e.showGithubOn;await n({show_github_url:r},{label:"toggle GitHub profile",onSuccess:()=>e.setShowGithubOn(r)})},[n,e]),s=d.useCallback(async()=>{const r=ft(e.githubInput);if(e.githubInput.trim()&&!r){e.setGithubError(a("settings.account.githubUrlInvalid"));return}e.setGithubError(null),await n({github_url:r,show_github_url:!!r},{label:"save GitHub profile",onError:l=>e.setGithubError(l?.message||a("settings.account.githubUrlInvalid")),onSuccess:l=>{e.setGithubUrl(l?.github_url||r||""),e.setShowGithubOn(!!r),e.setEditingGithub(!1)}})},[n,e]),o=d.useCallback(()=>{e.setGithubInput(e.githubUrl),e.setGithubError(null),e.setEditingGithub(!0)},[e]);return{handleSaveGithub:s,handleShowGithubToggle:i,startEditingGithub:o}}function At(){const e=ne(),n=vt(e.user),i=yt(e.getAccessToken,e.enabled,e.signedIn);jt(e.getAccessToken,e.signedIn,n.loadSetters);const s=kt(e.getAccessToken,n),o=Ct(n,s),r=wt(n,s,e.refreshDisplayName),l=Lt(n,s);return{...e,...i,email:n.email,handlePublicProfileToggle:o.handlePublicProfileToggle,userId:n.userId,name:Nt(n,{...o,...r}),github:St(n,l),profileLoading:n.profileLoading,profileSaving:n.profileSaving,publicProfileOn:n.publicProfileOn}}function $({disabled:e,onCancel:n,onSave:i,saveLabel:s=a("settings.account.save")}){return t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",onClick:i,disabled:e,className:"rounded-md bg-oai-brand-500 px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-oai-brand-600 disabled:opacity-50",children:s}),t.jsx("button",{type:"button",onClick:n,className:"rounded-md px-2 py-1.5 text-xs text-oai-gray-500 transition-colors hover:text-oai-gray-700 dark:hover:text-oai-gray-300",children:a("settings.account.cancel")})]})}function Ot({nameInput:e,setEditingName:n,setNameInput:i,profileSaving:s,handleSaveName:o}){return t.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[t.jsx("input",{type:"text",value:e,onChange:r=>i(r.target.value),onKeyDown:r=>{r.key==="Enter"&&o(),r.key==="Escape"&&n(!1)},maxLength:50,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white",placeholder:a("settings.account.displayName")}),t.jsx($,{disabled:s||!e.trim(),onCancel:()=>n(!1),onSave:o,saveLabel:s?a("settings.account.saving"):void 0})]})}function Pt({githubError:e,githubInput:n,handleSaveGithub:i,profileSaving:s,setEditingGithub:o,setGithubError:r,setGithubInput:l}){return t.jsxs("div",{className:"mt-2",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("input",{type:"text",value:n,onChange:c=>{l(c.target.value),e&&r(null)},onKeyDown:c=>{c.key==="Enter"&&i(),c.key==="Escape"&&(o(!1),r(null))},maxLength:100,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white",placeholder:a("settings.account.githubUrlPlaceholder")}),t.jsx($,{disabled:s,onCancel:()=>{o(!1),r(null)},onSave:i,saveLabel:s?a("settings.account.saving"):void 0})]}),e?t.jsx("div",{className:"mt-1.5 text-xs text-red-600 dark:text-red-400",children:e}):null]})}function V({disabled:e=!1,label:n,onClick:i,title:s}){return t.jsxs("button",{type:"button",onClick:i,disabled:e,title:s,className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-40 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[t.jsx(Be,{className:"h-3.5 w-3.5","aria-hidden":!0}),n]})}function K({actions:e,editing:n,editor:i,hint:s,label:o}){return t.jsx("div",{className:"py-3",children:t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:o}),n?i:t.jsx("div",{className:"mt-0.5 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:s})]}),n?null:e]})})}function Et({name:e}){const n=e.anonymousOn?a("settings.account.displayNameDisabledWhileAnon"):void 0;return t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsx(V,{disabled:e.anonymousOn,label:a("settings.account.edit"),onClick:e.startEditingName,title:n}),t.jsx(x,{checked:!e.anonymousOn,onChange:e.handleAnonymousToggle,disabled:e.profileLoading||e.profileSaving,ariaLabel:a("settings.account.displayName")})]})}function _t({name:e}){const{anonymousOn:n,customDisplayName:i,displayName:s,editingName:o,handleAnonymousToggle:r,handleSaveName:l,nameInput:c,profileLoading:u,profileSaving:b,setEditingName:m,setNameInput:y,startEditingName:v}=e,g=n?a("settings.account.displayNameAnonymousHint"):i||s;return t.jsx(K,{label:a("settings.account.displayName"),editing:o,hint:g,editor:t.jsx(Ot,{nameInput:c,setEditingName:m,setNameInput:y,profileSaving:b,handleSaveName:l}),actions:t.jsx(Et,{name:e})})}function It({github:e}){const{editingGithub:n,githubError:i,githubInput:s,githubUrl:o,handleSaveGithub:r,handleShowGithubToggle:l,profileLoading:c,profileSaving:u,setEditingGithub:b,setGithubError:m,setGithubInput:y,showGithubOn:v,startEditingGithub:g}=e;return t.jsx(t.Fragment,{children:t.jsx(K,{label:a("settings.account.githubUrl"),editing:n,hint:o||a("settings.account.githubUrlHint"),editor:t.jsx(Pt,{githubError:i,githubInput:s,handleSaveGithub:r,profileSaving:u,setEditingGithub:b,setGithubError:m,setGithubInput:y}),actions:t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsx(V,{label:a("settings.account.edit"),onClick:g}),t.jsx(x,{checked:v,onChange:l,disabled:c||u,ariaLabel:a("settings.account.githubUrl")})]})})})}function Tt(){const{openLoginModal:e}=ce();return t.jsx(S,{title:a("settings.section.account"),children:t.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[t.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:a("settings.account.signedOutHint")}),t.jsx("button",{type:"button",onClick:e,className:"inline-flex h-8 shrink-0 items-center justify-center rounded-md bg-oai-gray-900 px-4 text-xs font-medium text-white transition-colors hover:bg-oai-gray-800 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100",children:a("settings.account.signIn")})]})})}function Gt({name:e,github:n}){return t.jsxs(t.Fragment,{children:[t.jsx(_t,{name:e}),t.jsx(It,{github:n})]})}function Rt(){const e=At();return e.enabled?e.signedIn?t.jsxs(S,{title:a("settings.section.account"),subtitle:e.email||e.name.customDisplayName||e.name.displayName,action:t.jsx(Dt,{onSignOut:e.signOut}),children:[t.jsx(Mt,{userId:e.userId}),t.jsx(Ut,{settings:e}),t.jsx(Ft,{checked:e.publicProfileOn,disabled:e.profileLoading||e.profileSaving,onChange:e.handlePublicProfileToggle}),t.jsx(Ht,{visible:e.publicProfileOn,name:e.name,github:e.github})]}):t.jsx(Tt,{}):null}function Mt({userId:e}){const[n,i]=O.useState(!1);if(!e)return null;const s=async()=>{try{if(typeof navigator>"u"||!navigator.clipboard?.writeText)return;await navigator.clipboard.writeText(e),i(!0),globalThis.setTimeout(()=>i(!1),1200)}catch{i(!1)}};return t.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:a("settings.account.userId")}),t.jsx("div",{className:"mt-0.5 truncate font-mono text-xs text-oai-gray-500 dark:text-oai-gray-400",children:e})]}),t.jsxs("button",{type:"button",onClick:s,className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800","aria-label":a("settings.account.copyUserId"),children:[n?t.jsx(Ke,{className:"h-3.5 w-3.5","aria-hidden":!0}):t.jsx(ze,{className:"h-3.5 w-3.5","aria-hidden":!0}),n?a("settings.account.copied"):a("settings.account.copy")]})]})}function Dt({onSignOut:e}){return t.jsxs("button",{type:"button",onClick:()=>e(),className:"inline-flex h-7 items-center gap-1.5 text-xs font-medium text-oai-gray-500 transition-colors hover:text-oai-gray-700 dark:hover:text-oai-gray-300",children:[t.jsx(rt,{className:"h-3.5 w-3.5","aria-hidden":!0}),a("settings.account.signOut")]})}function Ut({settings:e}){return e.showLocalCloudSync?t.jsx(h,{label:a("settings.account.cloudSync"),hint:a("settings.account.cloudSyncHint"),control:t.jsx(x,{checked:e.cloudSyncOn,onChange:e.handleCloudSyncToggle,ariaLabel:a("settings.account.cloudSync")})}):null}function Ft({checked:e,disabled:n,onChange:i}){return t.jsx(h,{label:a("settings.account.publicProfile"),hint:a("settings.account.publicProfileHint"),control:t.jsx(x,{checked:e,onChange:i,disabled:n,ariaLabel:a("settings.account.publicProfile")})})}function Ht({visible:e,name:n,github:i}){return t.jsx(qe,{initial:!1,children:e?t.jsx(He.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{height:{duration:.28,ease:[.22,1,.36,1]},opacity:{duration:.2,ease:[.22,1,.36,1]}},style:{overflow:"hidden"},className:"divide-y divide-oai-gray-200/60 dark:divide-oai-gray-800/60",children:t.jsx(Gt,{name:n,github:i})},"public-profile-fields"):null})}function Bt(){return[{value:"light",label:a("settings.appearance.theme.light"),Icon:de},{value:"dark",label:a("settings.appearance.theme.dark"),Icon:ge},{value:"system",label:a("settings.appearance.theme.system"),Icon:H}]}function $t(){return[{value:be,label:a("settings.appearance.language.system")},{value:pe,label:a("settings.appearance.language.english")},{value:xe,label:a("settings.appearance.language.chinese")},{value:fe,label:a("settings.appearance.language.traditional_chinese")},{value:ye,label:a("settings.appearance.language.japanese")},{value:ve,label:a("settings.appearance.language.korean")},{value:je,label:a("settings.appearance.language.german")}]}function Vt(e){if(!e)return null;try{const n=new Date(e);return Number.isNaN(n.getTime())?null:n.toLocaleString()}catch{return null}}function Kt(e,n){const i=a(`settings.appearance.currency.rate_source.${e}`),s=Vt(n),o=s?a("settings.appearance.currency.rate_updated",{when:s}):a("settings.appearance.currency.rate_never");return`${i} · ${o}`}function zt({locale:e,setLocale:n}){const i=$t();return t.jsx(B,{value:e,onValueChange:n,options:i,ariaLabel:a("settings.appearance.language.label"),className:"px-2.5 py-1.5 text-xs font-medium",leadingIcon:t.jsx(st,{className:"h-3.5 w-3.5 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})})}function qt({currency:e,setCurrency:n}){const i=me().map(s=>({value:s.code,label:a(s.labelKey)}));return t.jsx(B,{value:e,onValueChange:n,options:i,ariaLabel:a("settings.appearance.currency.label"),className:"px-3 py-1.5 text-xs font-medium"})}function Zt({currency:e,rate:n,rateSource:i,rateFetchedAt:s}){if(e===he)return t.jsx(t.Fragment,{children:a("settings.appearance.currency.hint")});const o=Kt(i,s);return t.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[t.jsx("span",{children:`1 USD = ${n.toFixed(4)} ${e}`}),t.jsx("span",{role:"img","aria-label":o,title:o,className:"inline-flex h-4 w-4 cursor-help items-center justify-center text-oai-gray-400 hover:text-oai-gray-600 dark:text-oai-gray-500 dark:hover:text-oai-gray-300",children:t.jsx(Qe,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})}function Wt(){const{theme:e,setTheme:n}=ue(),{locale:i,setLocale:s}=F(),{currency:o,rate:r,rateSource:l,rateFetchedAt:c,setCurrency:u}=Ze(),{mode:b,setMode:m}=We();return t.jsxs(S,{title:a("settings.section.appearance"),children:[t.jsx(h,{label:a("settings.appearance.theme.label"),hint:a("settings.appearance.theme.hint"),control:t.jsx(P,{options:Bt(),value:e,onChange:n})}),t.jsx(h,{label:a("settings.appearance.language.label"),hint:a("settings.appearance.language.hint"),control:t.jsx(zt,{locale:i,setLocale:s})}),t.jsx(h,{label:a("settings.appearance.currency.label"),hint:t.jsx(Zt,{currency:o,rate:r,rateSource:l,rateFetchedAt:c}),control:t.jsx(qt,{currency:o,setCurrency:u})}),t.jsx(h,{label:a("settings.appearance.token_format.label"),hint:a("settings.appearance.token_format.hint"),control:t.jsx(P,{options:[{value:I.COMPACT,label:a("settings.appearance.token_format.compact")},{value:I.FULL,label:a("settings.appearance.token_format.full")}],value:b,onChange:m})})]})}function A({labelKey:e}){return t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("span",{children:a(e)}),t.jsx("span",{className:"px-1.5 py-0.5 text-[8px] font-semibold tracking-wider text-oai-gray-500 bg-oai-gray-100 dark:text-oai-gray-400 dark:bg-oai-gray-800/80 rounded uppercase scale-90 origin-left",children:a("qpd.card.badge")})]})}function Qt(){const{enabled:e,toggle:n}=$e(),{enabled:i,toggle:s}=Ve(),{available:o,settings:r,setSetting:l}=L(),c=o&&!!r?.dynamicIslandSupported,u=!!r?.dynamicIslandEnabled;return t.jsxs(S,{title:a("settings.section.labs"),children:[c&&t.jsxs(t.Fragment,{children:[t.jsx(h,{label:t.jsx(A,{labelKey:"settings.labs.island.label"}),hint:a("settings.labs.island.hint"),control:t.jsx(x,{checked:u,onChange:()=>l("dynamicIslandEnabled",!u),ariaLabel:a("settings.labs.island.aria")})}),u&&t.jsx(h,{label:a("settings.labs.island_hide_menubar.label"),hint:a("settings.labs.island_hide_menubar.hint"),control:t.jsx(x,{checked:!!r?.hideMenuBarIcon,onChange:()=>l("hideMenuBarIcon",!r?.hideMenuBarIcon),ariaLabel:a("settings.labs.island_hide_menubar.aria")})})]}),t.jsx(h,{label:t.jsx(A,{labelKey:"settings.labs.qpd.label"}),hint:a("settings.labs.qpd.hint"),control:t.jsx(x,{checked:e,onChange:n,ariaLabel:a("settings.labs.qpd.aria")})}),t.jsx(h,{label:t.jsx(A,{labelKey:"settings.labs.sessions.label"}),hint:a("settings.labs.sessions.hint"),control:t.jsx(x,{checked:i,onChange:s,ariaLabel:a("settings.labs.sessions.aria")})})]})}function Yt(){const{available:e,settings:n,setSetting:i,runAction:s}=L();if(!e)return null;const o=!!n?.launchAtLogin,r=n?.toastOnReset!==!1,l=n?.confettiOnReset!==!1,c=n?.launchAtLoginSupported!==!1,u=n?.updateStatus||null,b=!!n?.updateBusy,m=!!n?.isSyncing;return t.jsxs(S,{title:a("settings.section.menubar"),children:[t.jsx(h,{label:a("settings.menubar.appearance"),hint:a("settings.menubar.appearanceHint"),control:t.jsxs(ke,{to:"/widgets",className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 no-underline transition-colors hover:bg-oai-gray-100 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[a("settings.menubar.appearanceLink"),t.jsx(Je,{className:"h-3.5 w-3.5","aria-hidden":!0})]})}),t.jsx(h,{label:a("settings.menubar.toastOnReset"),hint:a("settings.menubar.toastOnResetHint"),control:t.jsx(x,{checked:r,onChange:()=>i("toastOnReset",!r),ariaLabel:a("settings.menubar.toastOnReset")})}),t.jsx(h,{label:a("settings.menubar.confettiOnReset"),hint:a("settings.menubar.confettiOnResetHint"),control:t.jsx(x,{checked:l,onChange:()=>i("confettiOnReset",!l),ariaLabel:a("settings.menubar.confettiOnReset")})}),c?t.jsx(h,{label:a("settings.menubar.launchAtLogin"),hint:a("settings.menubar.launchAtLoginHint"),control:t.jsx(x,{checked:o,onChange:()=>i("launchAtLogin",!o),ariaLabel:a("settings.menubar.launchAtLogin")})}):null,t.jsx(h,{label:a("settings.menubar.syncNow"),hint:a("settings.menubar.syncNowHint"),control:t.jsxs("button",{type:"button",onClick:()=>s("syncNow"),disabled:m,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[t.jsx(Ne,{className:N("h-3.5 w-3.5",m&&"animate-spin"),"aria-hidden":!0}),m?a("settings.menubar.syncing"):a("settings.menubar.syncNow")]})}),t.jsx(h,{label:a("settings.menubar.updates"),hint:u||void 0,control:t.jsxs("button",{type:"button",onClick:()=>s("checkForUpdates"),disabled:b,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[t.jsx(Xe,{className:"h-3.5 w-3.5","aria-hidden":!0}),a("settings.menubar.checkUpdates")]})})]})}function Jt(e,n){function i(r){return r.replace(/^v/,"").split(".").map(Number)}const s=i(e),o=i(n);for(let r=0;r<Math.max(s.length,o.length);r++){const l=s[r]||0,c=o[r]||0;if(l<c)return!0;if(l>c)return!1}return!1}function Xt(){const{available:e,settings:n,runAction:i}=L(),s=e&&n?.version,[o,r]=O.useState(!1),[l,c]=O.useState({open:!1,latestVersion:"",htmlUrl:""}),{resolvedLocale:u}=F(),b="0.87.4",m=async()=>{r(!0);try{const p=await fetch("https://api.github.com/repos/mm7894215/TokenTracker/releases/latest");if(!p.ok)throw new Error("Failed to fetch");const j=await p.json(),w=j.tag_name;Jt(b,w)?c({open:!0,latestVersion:w,htmlUrl:j.html_url}):T({title:a("settings.menubar.updates.upToDate")})}catch(p){console.error("Check updates failed:",p),T({title:a("settings.menubar.updates.failed")})}finally{r(!1)}},y=a("settings.menubar.updates.modalTitle"),v=a("settings.menubar.updates.modalDescription",{version:l.latestVersion}),g=a("settings.menubar.updates.modalConfirm"),f=a("settings.menubar.updates.modalCancel");return t.jsxs("div",{className:"mt-6 flex flex-col items-center justify-center gap-4 text-xs text-oai-gray-500 dark:text-oai-gray-500",children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[s?t.jsxs(t.Fragment,{children:[t.jsx("span",{children:a("settings.menubar.updates.footerCombined",{barVersion:n.version,coreVersion:b})}),t.jsx("span",{"aria-hidden":!0,children:"·"}),t.jsx("button",{type:"button",onClick:()=>i("openAbout"),className:"underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300",children:"GitHub"}),t.jsx("span",{"aria-hidden":!0,children:"·"})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{children:a("settings.menubar.updates.footerCore",{version:b})}),t.jsx("span",{"aria-hidden":!0,children:"·"}),t.jsx("button",{type:"button",onClick:m,disabled:o,className:"underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300 disabled:opacity-50",children:o?a("settings.menubar.updates.checking"):a("settings.menubar.checkUpdates")}),t.jsx("span",{"aria-hidden":!0,children:"·"})]}),t.jsxs("a",{href:Se,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300",children:[t.jsx(Ce,{className:"h-3.5 w-3.5","aria-hidden":!0}),a("settings.footer.statusPage")]})]}),t.jsx(Ye,{open:l.open,title:y,description:v,confirmLabel:g,cancelLabel:f,onConfirm:()=>{window.open(l.htmlUrl,"_blank"),c(p=>({...p,open:!1}))},onCancel:()=>c(p=>({...p,open:!1}))})]})}const k={APPEARANCE:"appearance",NATIVE_APP:"native-app",ACCOUNT:"account",LIMITS:"limits",LABS:"labs"};function en({prefs:e}){return t.jsx(P,{options:[{value:R.USED,label:a("limits.settings.display_mode_used")},{value:R.REMAINING,label:a("limits.settings.display_mode_remaining")}],value:e.displayMode,onChange:e.setDisplayMode})}function An(){const e=Ue(),{available:n,settings:i,setSetting:s}=L(),o=i?.toastOnReset!==!1,r=i?.confettiOnReset!==!1,[l,c]=we(),u=l.get("section"),m=Object.values(k).includes(u)&&(u!==k.NATIVE_APP||n)?u:k.APPEARANCE,y=g=>{const f=new URLSearchParams(l);g===k.APPEARANCE?f.delete("section"):f.set("section",g),c(f,{replace:!0})},v=[{id:k.APPEARANCE,label:a("settings.section.appearance"),Icon:ct,content:t.jsx(Wt,{})},...n?[{id:k.NATIVE_APP,label:a("settings.section.menubar"),Icon:H,content:t.jsx(Yt,{})}]:[],{id:k.ACCOUNT,label:a("settings.section.account"),Icon:dt,content:t.jsx(Rt,{})},{id:k.LIMITS,label:a("settings.section.limits"),Icon:Le,content:t.jsxs("div",{className:"space-y-4",children:[t.jsxs(S,{title:a("settings.section.limits"),children:[t.jsx(h,{label:a("limits.settings.display_mode_label"),control:t.jsx(en,{prefs:e})}),t.jsx(h,{label:a("settings.menubar.toastOnReset"),hint:a("settings.menubar.toastOnResetHint"),control:t.jsx(x,{checked:o,disabled:!n,onChange:()=>s("toastOnReset",!o),ariaLabel:a("settings.menubar.toastOnReset")})}),t.jsx(h,{label:a("settings.menubar.confettiOnReset"),hint:a("settings.menubar.confettiOnResetHint"),control:t.jsx(x,{checked:r,disabled:!n,onChange:()=>s("confettiOnReset",!r),ariaLabel:a("settings.menubar.confettiOnReset")})})]}),t.jsx(S,{title:a("settings.limits.providers"),children:t.jsx(bt,{prefs:e})})]})},{id:k.LABS,label:a("settings.section.labs"),Icon:tt,content:t.jsx(Qt,{})}];return t.jsx("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:t.jsx("main",{className:"flex-1 pb-12 pt-8 sm:pb-16 sm:pt-10",children:t.jsxs("div",{className:"mx-auto w-full max-w-5xl px-4 sm:px-6",children:[t.jsx("div",{className:"mb-7",children:t.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:a("settings.page.title")})}),t.jsxs("div",{className:"grid min-w-0 gap-6 md:grid-cols-[12rem_minmax(0,1fr)] md:gap-8 lg:grid-cols-[13.5rem_minmax(0,1fr)]",children:[t.jsx("aside",{className:"min-w-0 border-b border-oai-gray-200 pb-3 dark:border-oai-gray-800 md:border-b-0 md:border-r md:pb-0 md:pr-5",children:t.jsx("nav",{"aria-label":a("settings.page.title"),className:"flex gap-0 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden md:sticky md:top-6 md:flex-col md:gap-1 md:overflow-visible",children:v.map(({id:g,label:f,Icon:p})=>{const j=m===g;return t.jsxs("button",{id:`settings-nav-${g}`,type:"button","aria-current":j?"page":void 0,"aria-controls":`settings-panel-${g}`,onClick:()=>y(g),className:N("inline-flex min-h-10 min-w-max shrink-0 items-center gap-1.5 rounded-md px-2 py-2 text-left text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-oai-brand-500 md:w-full md:min-w-0 md:gap-2 md:px-3",j?"bg-oai-gray-100 text-oai-black dark:bg-oai-gray-800 dark:text-white":"text-oai-gray-500 hover:bg-oai-gray-50 hover:text-oai-gray-900 dark:text-oai-gray-400 dark:hover:bg-oai-gray-900 dark:hover:text-oai-gray-200"),children:[t.jsx(p,{className:N("h-4 w-4 shrink-0",j?"text-oai-black dark:text-white":"text-oai-gray-400 dark:text-oai-gray-500"),"aria-hidden":!0}),t.jsx("span",{className:"truncate",children:f})]},g)})})}),t.jsxs("div",{className:"min-w-0",children:[v.map(({id:g,label:f,content:p})=>t.jsx("section",{id:`settings-panel-${g}`,"aria-labelledby":`settings-nav-${g}`,"aria-label":f,"data-settings-panel":g,hidden:m!==g,children:p},g)),t.jsx(Xt,{})]})]})]})})})}export{An as SettingsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as Sa,r as i,P as it,A as da,j as e,X as Se,c as r,e as me,aH as na,ay as _a,aI as ot,z as lt,aJ as ga,aK as dt,aL as ct,Y as ut,aM as ha,aN as mt,aO as gt,E as ht,aP as xt,aA as pt,az as ft,aQ as yt,a3 as bt,K as kt,B as G,R as wt,d as vt,a4 as Ce}from"./__vite-browser-external-Db9onipF.js";import{L as jt}from"./LocalOnlyNotice-BsKgtoVa.js";import{C as Nt}from"./Card-DZ-_fXkw.js";import{C as xa}from"./ConfirmModal-Ct2HLdds.js";import{S as Ct,I as ca}from"./SegmentedControl-CYFrzu9w.js";import{I as La}from"./info-D9LwqlnC.js";import{P as be}from"./ProviderIcon-7Tkq9_m6.js";import{m as pa}from"./react-BnaPNGj8.js";import{u as St}from"./useCurrency-B0hJte5f.js";import{E as ia}from"./external-link-DVanKEuy.js";import{L as Z}from"./loader-circle-DCmwZEdS.js";import{C as _e}from"./check-CasSqiev.js";import{T as ua}from"./trash-2-DAr4sqkX.js";import{A as _t}from"./index-CaRyTJ6K.js";import{u as Lt}from"./use-reduced-motion-BIgYrbON.js";import{u as Pt,s as Rt,k as Pa,l as Et,m as It,n as Bt,o as $t,p as Tt,S as Ra,c as Ea,d as Ia,e as Ba,f as $a,g as Ta,h as Ge,j as We,i as Qe}from"./SelectItemText-CxhBeoxx.js";import{t as Dt,u as oa,m as Mt}from"./useScrollLock-DuosKdSB.js";import{u as Ot,C as ma}from"./ToolbarRootContext-CwRaHhMN.js";import{g as Ut,a as Ft,d as zt,b as At,c as Kt,e as Vt,s as Ht,i as fa,u as ya,f as ba,r as qt,h as ka,j as wa,k as Gt,l as Wt}from"./skills-api-vo3iM6yD.js";import{F as Qt}from"./flame-RbiHZM9b.js";import{S as la}from"./search-BrqBkLs2.js";import{D as Da}from"./download-adOCFO2v.js";import{C as Xt}from"./chevron-right-B1PMeNoD.js";import{P as Ma,a as Oa,b as Ua,c as Fa,d as za}from"./PopoverPopup-C16r8jQC.js";import"./arrow-up-right-COvrArNz.js";import"./DialogTitle-BIwLH6gA.js";import"./store-BwMVXuz3.js";import"./DialogDescription-DeRza-LI.js";const Yt=[["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=Sa("circle-arrow-up",Yt);const Jt=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Ka=Sa("plus",Jt),Va=i.forwardRef(function(s,l){const{render:u,className:c,style:p,...m}=s,{store:h}=Pt(),b={open:it(h,Rt.open)};return da("span",s,{state:b,ref:l,props:[{"aria-hidden":!0,children:"▼"},m],stateAttributesMapping:Dt})}),Zt="tt:hint:dismissed:";function Ha(a){return Zt+a}function er(a){if(typeof window>"u")return!1;try{return window.localStorage.getItem(Ha(a))==="1"}catch{return!1}}function ar({id:a,children:s,className:l,ariaLabel:u}){const[c,p]=i.useState(()=>er(a)),m=i.useCallback(()=>{if(typeof window<"u")try{window.localStorage.setItem(Ha(a),"1")}catch{}p(!0)},[a]);return c?null:e.jsxs("div",{role:"note","aria-label":u||r("hint.dismissible_aria"),className:me("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:m,"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 tr(a){if(!a)return null;for(const s of a.elements){const l=s.tagName;if(l==="BUTTON"||l==="INPUT"){const u=s;if(u.type==="submit")return u}}return null}let va=(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 qa(a){return i.useMemo(()=>({checked(s){return a.indeterminate?{}:s?{[va.checked]:""}:{[va.unchecked]:""}},...Pa}),[a.indeterminate])}const rr=i.createContext({disabled:!1});function sr(){return i.useContext(rr)}function nr(a,s,l,u=!0,c){const[p,m]=i.useState(),h=oa(c?`${c}-label`:void 0),x=a??s??p;return na(()=>{const b=a||s||!u?void 0:ir(l.current,h);p!==b&&m(b)}),x}function ir(a,s){const l=or(a);if(l)return!l.id&&s&&(l.id=s),l.id||void 0}function or(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 u=a.labels;return u&&u[0]}const lr=i.createContext(void 0);function dr(a=!0){const s=i.useContext(lr);if(s===void 0&&!a)throw new Error(_a(3));return s}const Ga=i.createContext(void 0);function cr(){const a=i.useContext(Ga);if(a===void 0)throw new Error(_a(14));return a}const ur="data-parent",mr=i.forwardRef(function(s,l){const{checked:u,className:c,defaultChecked:p=!1,"aria-labelledby":m,disabled:h=!1,form:x,id:b,indeterminate:o=!1,inputRef:j,name:C,onCheckedChange:k,parent:v=!1,readOnly:y=!1,render:N,required:I=!1,uncheckedValue:O,value:W,nativeButton:U=!1,style:ge,...w}=s,{clearErrors:ee}=Et(),{disabled:B,name:K,setDirty:Q,setFilled:ae,setFocused:F,setTouched:ke,state:we,validationMode:Ue,validityData:Le,validation:Fe}=It(),ze=sr(),{labelId:T,controlId:te,registerControlId:X,getDescriptionProps:ve}=Bt(),L=dr(),V=L?.parent,re=V&&L.allValues,E=B||ze.disabled||L?.disabled||h,se=K??C,P=W??se,Pe=oa(),je=oa();let ne=te;re?ne=v?je:`${V.id}-${P}`:b&&(ne=b);let pe={};re&&(v?pe=L.parent.getParentProps():P&&(pe=L.parent.getChildProps(P)));const{checked:Re=u,indeterminate:Ee=o,onCheckedChange:Ie,...Ne}=pe,H=L?.value,ie=L?.setValue,fe=L?.defaultValue,oe=i.useRef(null),le=ot(()=>Symbol("checkbox-control")),he=i.useRef(!1),{getButtonProps:Ye,buttonRef:Ae}=lt({disabled:E,native:U}),de=L?.validation??Fe,[_,Je]=$t({controlled:P&&H&&!v?H.includes(P):Re,default:P&&fe&&!v?fe.includes(P):p,name:"Checkbox",state:"checked"}),Be=re?!!Re:_,ye=re&&Ee||o;na(()=>{X!==ga&&(he.current=!0,X(le.current,ne))},[ne,X,le]),i.useEffect(()=>{const f=le.current;return()=>{!he.current||X===ga||(he.current=!1,X(f,void 0))}},[X,le]),Tt(oe,Pe,_,void 0,!L&&!E,C);const Y=i.useRef(null),$e=dt(j,Y,de.inputRef,de.registerInput),Ze=nr(m,T,Y,!U,ne??void 0);na(()=>{Y.current&&(Y.current.indeterminate=ye,_&&ae(!0))},[_,ye,ae]),Ot(_,()=>{L||(ee(se),ae(_),Q(_!==Le.initialValue),de.change(_))});const Ke=ct({checked:_,disabled:E,form:x,name:v?void 0:se,id:U?void 0:ne??void 0,required:I,ref:$e,style:se?mt:gt,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(f){if(f.nativeEvent.defaultPrevented)return;if(y){f.preventDefault();return}const D=f.currentTarget.checked,ce=ht(xt,f.nativeEvent);if(k?.(D,ce),!ce.isCanceled&&(Ie?.(D,ce),!ce.isCanceled&&(Je(D),P&&H&&ie&&!v&&!re))){const ue=D?[...H,P]:H.filter($=>$!==P);ie(ue,ce)}},onFocus(){oe.current?.focus()}},W!==void 0?{value:(L?_&&W:W)||""}:ut,ve,f=>de.getValidationProps(E,f));i.useEffect(()=>{if(!V||!P)return;const f=V.disabledStatesRef.current;return f.set(P,E),()=>{f.delete(P)}},[V,E,P]);const Te=i.useMemo(()=>({...we,checked:Be,disabled:E,readOnly:y,required:I,indeterminate:ye}),[we,Be,E,y,I,ye]),ea=qa(Te),aa=da("span",s,{state:Te,ref:[Ae,oe,l,L?.registerControlRef],props:[{id:U?ne??void 0:Pe,role:"checkbox","aria-checked":ye?"mixed":Be,"aria-readonly":y||void 0,"aria-required":I||void 0,"aria-labelledby":Ze,[ur]:v?"":void 0,onFocus(){E||F(!0)},onBlur(){const f=Y.current;f&&(ke(!0),F(!1),Ue==="onBlur"&&de.commit(L?H:f.checked))},onKeyDown(f){if(f.key!=="Enter"||(f.preventBaseUIHandler(),f.defaultPrevented))return;const D=Y.current?.form??null,ce=f.currentTarget,ue=f.nativeEvent,$=f.preventDefault,q=ue.preventDefault;let De=!1;f.preventDefault=()=>{De=!0,$.call(f)},ue.preventDefault=()=>{De=!0,q.call(ue)},q.call(ue),ha(ce).queueMicrotask(()=>{f.preventDefault=$,ue.preventDefault=q,De||tr(D)?.click()})},onClick(f){if(y||E)return;f.preventDefault();const D=Y.current;D&&D.dispatchEvent(new(ha(D)).PointerEvent("click",{bubbles:!0,shiftKey:f.shiftKey,ctrlKey:f.ctrlKey,altKey:f.altKey,metaKey:f.metaKey}))}},w,Ne,Ye,ve,f=>de.getValidationProps(E,f)],stateAttributesMapping:ea});return e.jsxs(Ga.Provider,{value:Te,children:[aa,!_&&!L&&se&&!v&&O!==void 0&&e.jsx("input",{type:"hidden",form:x,name:se,value:O,disabled:E}),e.jsx("input",{...Ke,suppressHydrationWarning:!0})]})}),gr=i.forwardRef(function(s,l){const{render:u,className:c,style:p,keepMounted:m=!1,...h}=s,x=cr(),b=x.checked||x.indeterminate,{mounted:o,transitionStatus:j,setMounted:C}=Mt(b),k=i.useRef(null),v={...x,transitionStatus:j};pt({open:b,ref:k,onComplete(){b||C(!1)}});const N={...qa(x),...ft,...Pa},I=m||o,O=da("span",s,{ref:[l,k],state:v,stateAttributesMapping:N,props:h});return I?O:null});function hr(a,s){return`target:${a}:${s}`}function xr(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 pr(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 fr(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 ra({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 yr({skill:a,targets:s,busyKey:l,usage:u,hasUpdate:c,updating:p,onUpdate:m,onClose:h,onToggleTarget:x,onRemove:b}){return e.jsx(_t,{children:a?e.jsx(br,{skill:a,targets:s,busyKey:l,usage:u,hasUpdate:c,updating:p,onUpdate:m,onClose:h,onToggleTarget:x,onRemove:b},a.id||a.directory):null})}function br({skill:a,targets:s,busyKey:l,usage:u,hasUpdate:c,updating:p,onUpdate:m,onClose:h,onToggleTarget:x,onRemove:b}){const o=Lt(),{currency:j,rate:C}=St(),k=i.useRef(null);i.useEffect(()=>{const w=B=>{B.key==="Escape"&&(B.stopPropagation(),h?.())},ee=B=>{const K=B.target;K instanceof Element&&(k.current?.contains(K)||K.closest('[data-skill-row="1"]')||h?.())};return document.addEventListener("keydown",w),document.addEventListener("mousedown",ee),()=>{document.removeEventListener("keydown",w),document.removeEventListener("mousedown",ee)}},[h]);const v=a.name||a.directory,y=!!(a.repoOwner&&a.repoName),N=y?`https://github.com/${a.repoOwner}/${a.repoName}`:null,I=new Set(a.targets||[]),O=l===xr(a),W=pr(u?.lastUsedAt),U=!!(u&&u.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:h,"aria-hidden":!0}),e.jsxs(pa.aside,{ref:k,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:N,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:N,children:[e.jsxs("span",{className:"truncate",children:[a.repoOwner,"/",a.repoName]}),e.jsx(ia,{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:h,"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:()=>m?.(a),disabled:p,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:[p?e.jsx(Z,{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(ra,{label:r("skills.usage.invocations"),children:yt(u?.invocations||0)}),e.jsx(ra,{label:r("skills.usage.last_used"),children:e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx("span",{className:me("h-1.5 w-1.5 rounded-full",fr(u?.lastUsedAt)),"aria-hidden":!0}),U?W||r("skills.usage.unknown"):r("skills.usage.never")]})}),e.jsx(ra,{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:bt(u?.cost||0,{currency:j,rate:C})})]}),U?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(w=>{const ee=I.has(w.id),B=l===hr(a.id,w.id),K=`skill-detail-sync-${a.id||a.directory}-${w.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(mr,{id:K,checked:ee,disabled:B,onCheckedChange:Q=>x?.(a,w.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(gr,{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:w.id,size:16})}),e.jsx("span",{className:"flex-1",children:w.label}),B?e.jsx(Z,{className:"h-3.5 w-3.5 animate-spin text-oai-gray-400","aria-hidden":!0}):null]},w.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:O,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:[O?e.jsx(Z,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):e.jsx(ua,{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 kr=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),sa=["claude","codex"],A="popular",wr={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 Xe(a){return`${a.repoOwner||"local"}/${a.repoName||"local"}:${a.directory}`}function Qa(a){return String(a||"").replace(/\\/g,"/").trim().toLowerCase()}function vr(a){return Qa(a).split("/").filter(Boolean).pop()||""}function jr(a){if(a.repoOwner||a.repoName)return"";const s=Qa(a.directory);return!s||s.includes("/")?"":`dir:${s}`}function ja(a){const s=vr(a.directory);return s?`dir:${s}`:""}function Na(a){const s=new Set([Xe(a).toLowerCase()]);a.repoOwner&&a.repoName&&s.add(`${a.repoOwner}/${a.repoName}:${a.sourceDirectory||a.directory}`.toLowerCase());const l=jr(a);return l&&s.add(l),s}function qe(a){return`install:${Xe(a)}`}function Ca(a){return`remove:${a.id||a.directory}`}function Xa(a,s){return`target:${a}:${s}`}function Nr({target:a,state:s,busy:l,onToggle:u}){const c=s==="synced",p=s==="orphan",m=p?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:m,"aria-label":m,"aria-pressed":c,disabled:l,onClick:h=>{h.stopPropagation(),u?.(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(Z,{className:"h-4 w-4 animate-spin text-oai-gray-400","aria-hidden":!0}):e.jsx("span",{className:me("flex h-[18px] w-[18px] items-center justify-center transition",c&&wr[a.id],!c&&!p&&"opacity-35 grayscale"),"aria-hidden":!0,children:e.jsx(be,{provider:a.id,size:18})}),p&&!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 Cr({skill:a,targets:s,onToggleTarget:l,busyKey:u}){return e.jsx("div",{className:"flex items-center gap-1",onClick:c=>c.stopPropagation(),children:s.map(c=>e.jsx(Nr,{target:c,state:a.targetStates?.[c.id]||"off",busy:u===Xa(a.id,c.id),onToggle:(p,m)=>l?.(a,p,m)},c.id))})}function Sr({skill:a,targets:s,selected:l,onSelect:u,selectable:c,checked:p,onToggleSelect:m,onToggleTarget:h,hasUpdate:x,busyKey:b}){const o=a.repoOwner&&a.repoName?`${a.repoOwner}/${a.repoName}`:null,j=o?`${a.directory} · ${o}`:a.directory,C=k=>{(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),u?.(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:()=>u?.(a),onKeyDown:C,className:me("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":p?"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:k=>k.stopPropagation(),children:e.jsx("input",{type:"checkbox",checked:p,onChange:k=>m?.(a,k.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:j,children:a.name||a.directory}),x?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(Cr,{skill:a,targets:s,onToggleTarget:h,busyKey:b}),e.jsx(Xt,{className:me("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:me("mt-1 line-clamp-2 text-xs text-oai-gray-500 dark:text-oai-gray-400",c&&"pl-7"),children:a.description}):null]})}function _r({agentFilter:a,agentOptions:s,onAgentFilter:l,filteredCount:u,totalCount:c,anyFilter:p,onClearFilters:m,searchQuery:h,onSearchQuery:x,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(Ra,{value:a,onValueChange:l,children:[e.jsxs(Ea,{"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(Ia,{children:o=>o==="all"?r("skills.filter.agent_all"):s.find(j=>j.id===o)?.label||o}),e.jsx(Va,{className:"text-oai-gray-400",children:e.jsx(ma,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),e.jsx(Ba,{children:e.jsx($a,{sideOffset:4,alignItemWithTrigger:!1,className:"z-[60]",children:e.jsxs(Ta,{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(Ge,{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(We,{children:r("skills.filter.agent_all")}),e.jsx(Qe,{children:e.jsx(_e,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),s.map(o=>e.jsxs(Ge,{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(We,{children:o.label})]}),e.jsx(Qe,{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(la,{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(ca,{type:"search",value:h,onChange:o=>x(o.target.value),onKeyDown:o=>{o.key==="Escape"&&h&&(o.preventDefault(),x(""))},"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:()=>x(""),"aria-label":r("skills.action.search_clear"),"aria-hidden":!h,tabIndex:h?0:-1,className:me("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",h?"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:u,total:c})}),p?e.jsxs("button",{type:"button",onClick:m,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 Lr({count:a,targets:s,busy:l,onBulkSync:u,onBulkRemove:c,onClear:p}){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(Ma,{children:[e.jsxs(Oa,{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(Da,{className:"h-3.5 w-3.5","aria-hidden":!0}),r("skills.select.bulk_sync"),e.jsx(ma,{className:"h-3 w-3","aria-hidden":!0})]}),e.jsx(Ua,{children:e.jsx(Fa,{sideOffset:6,side:"bottom",align:"end",className:"!z-[80]",children:e.jsxs(za,{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(m=>e.jsxs("button",{type:"button",onClick:()=>u(m.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:m.id,size:16}),e.jsx("span",{className:"flex-1",children:m.label})]},m.id))]})})})]}),e.jsxs(G,{type:"button",variant:"ghost",size:"sm",disabled:l,onClick:c,children:[e.jsx(ua,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),r("skills.select.bulk_remove")]}),e.jsxs("button",{type:"button",onClick:p,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 Pr({items:a,totalCount:s,targets:l,agentOptions:u,agentFilter:c,onAgentFilter:p,anyFilter:m,onClearFilters:h,searchQuery:x,onSearchQuery:b,searchPlaceholder:o,selectedId:j,onSelect:C,onToggleTarget:k,busyKey:v,updates:y,selectedIds:N,onToggleSelect:I,onClearSelection:O,onBulkSync:W,onBulkRemove:U}){const ge=N.size;return e.jsxs("div",{children:[ge>0?e.jsx(Lr,{count:ge,targets:l,busy:v==="batch",onBulkSync:W,onBulkRemove:U,onClear:O}):e.jsx(_r,{agentFilter:c,agentOptions:u,onAgentFilter:p,filteredCount:a.length,totalCount:s,anyFilter:m,onClearFilters:h,searchQuery:x,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:h,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(w=>e.jsx(Sr,{skill:w,targets:l,selected:j===(w.id||w.directory),onSelect:C,selectable:!0,checked:N.has(w.id),onToggleSelect:I,onToggleTarget:k,hasUpdate:!!(w.id&&y?.[w.id]),busyKey:v},w.id||w.key))})]})}const Rr={contentVisibility:"auto",containIntrinsicSize:"0 240px"},Er=vt.memo(function({skill:s,installed:l,installing:u,allTargets:c,defaultTargets:p,onInstall:m,onManage:h}){const[x,b]=i.useState(()=>(p||[]).filter(y=>c.some(N=>N.id===y))),o=y=>{b(N=>N.includes(y)?N.filter(I=>I!==y):[...N,y])},j=s.repoOwner&&s.repoName?`${s.repoOwner}/${s.repoName}`:null,C=j?`https://github.com/${s.repoOwner}/${s.repoName}`:null,k=s.installs!=null?r("skills.card.installs",{count:Number(s.installs||0).toLocaleString()}):null,v=x.length?x.map(y=>c.find(N=>N.id===y)?.label||y).join(", "):r("skills.action.choose_targets");return e.jsxs(Nt,{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(ia,{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}),j||k?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:[C?e.jsxs("a",{href:C,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:C,children:[e.jsx("span",{className:"truncate",children:j}),e.jsx(ia,{className:"h-2.5 w-2.5 shrink-0","aria-hidden":!0})]}):null,j&&k?e.jsx("span",{"aria-hidden":!0,children:"·"}):null,k?e.jsx("span",{className:"truncate",children:k}):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:()=>h?.(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:x.length?v:r("skills.target.none")}),e.jsxs(Ma,{children:[e.jsx(Oa,{disabled:u,"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(Ua,{children:e.jsx(Fa,{sideOffset:6,side:"bottom",align:"end",className:"!z-[80]",children:e.jsxs(za,{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 N=x.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:N,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:()=>m(s,x),disabled:u||x.length===0,className:"w-full",children:[u?e.jsx(Z,{className:"mr-1.5 h-3.5 w-3.5 animate-spin","aria-hidden":!0}):e.jsx(Da,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),r("skills.action.install")]})]})})]})});function Ir({repos:a,repoInput:s,onRepoInput:l,busyKey:u,onAdd:c,onRemove:p}){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(ca,{value:s,onChange:m=>l(m.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:u==="repo:add",className:"shrink-0 whitespace-nowrap",children:[u==="repo:add"?e.jsx(Z,{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(m=>{const h=u===`repo:${m.owner}/${m.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:[m.owner,"/",m.name]}),e.jsx("div",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400",children:m.branch})]}),e.jsxs(G,{type:"button",variant:"ghost",size:"sm",disabled:h,onClick:()=>p(m),className:"shrink-0",children:[h?e.jsx(Z,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):e.jsx(ua,{className:"h-3.5 w-3.5","aria-hidden":!0}),e.jsx("span",{className:"sr-only",children:r("skills.repo.remove")})]})]},`${m.owner}/${m.name}`)})}):null]})}function Br(){return typeof window>"u"?"my":new URLSearchParams(window.location.search).get("tab")==="browse"?"browse":"my"}function ls(){const[a,s]=i.useState(Br),[l,u]=i.useState({skills:[],targets:[]}),[c,p]=i.useState([]),[m,h]=i.useState([]),[x,b]=i.useState([]),[o,j]=i.useState(xe),[C,k]=i.useState(""),[v,y]=i.useState(""),[N,I]=i.useState(""),[O,W]=i.useState(""),[U,ge]=i.useState(""),[w,ee]=i.useState(!1),[B,K]=i.useState("all"),[Q,ae]=i.useState(null),[F,ke]=i.useState(""),[we,Ue]=i.useState(!0),[Le,Fe]=i.useState(!1),[ze,T]=i.useState(""),[te,X]=i.useState(null),[ve,L]=i.useState(null),[V,re]=i.useState(()=>new Set),[E,se]=i.useState({}),[P,Pe]=i.useState({}),[je,ne]=i.useState([]),[pe,Re]=i.useState(!1),Ee=i.useRef(!1),Ie=i.useMemo(()=>{const t=new Set;for(const n of l.skills||[])for(const d of Na(n))t.add(d);return t},[l.skills]),Ne=i.useCallback(async()=>{const t=await Ut();u({skills:t.skills||[],targets:t.targets||[]})},[]),H=i.useCallback(async()=>{const t=await Ft();b(t.repos||[])},[]),ie=i.useCallback(async({force:t=!1}={})=>{Fe(!0);try{const n=await zt({force:t});p(n.skills||[])}finally{Fe(!1)}},[]),fe=i.useCallback(async({force:t=!1}={})=>{Re(!0);try{const n=await At({force:t});ne(n.skills||[])}finally{Re(!1)}},[]),oe=i.useCallback(async()=>{try{const t=await Kt();se(t?.updates||{})}catch{se({})}},[]),le=i.useCallback(async()=>{try{const t=await Vt(),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()=>{Ue(!0),T("");try{await Promise.all([Ne(),H()])}catch(t){T(t?.message||r("skills.error.generic"))}finally{Ue(!1)}},[Ne,H]),Ye=i.useCallback(async()=>{await he();const t=n=>T(n?.message||r("skills.error.generic"));a==="my"?(oe(),le()):o===A?fe({force:!0}).catch(t):o!==M&&ie({force:!0}).catch(t)},[ie,he,fe,oe,le,o,a]);i.useEffect(()=>{he()},[he]),i.useEffect(()=>{if(Ee.current||typeof window>"u")return;const t=new URLSearchParams(window.location.search),n=t.get("skill");if(!n){Ee.current=!0;return}const d=l.skills||[];if(!d.length)return;const g=d.find(S=>S.directory===n||S.id===n);g&&(s("my"),ae(g.id||g.directory)),Ee.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===A||c.length===0&&ie().catch(t=>T(t?.message||r("skills.error.generic"))))},[c.length,ie,o,a]),i.useEffect(()=>{a!=="browse"||o!==A||je.length===0&&fe().catch(t=>T(t?.message||r("skills.error.generic")))},[fe,je.length,o,a]);const Ae=Object.keys(E).length>0,de=Object.keys(P).length>0;if(i.useEffect(()=>{a==="my"&&(Ae||oe(),de||le())},[a,Ae,de,oe,le]),i.useEffect(()=>{const t=setTimeout(()=>y(C),200);return()=>clearTimeout(t)},[C]),i.useEffect(()=>{const t=setTimeout(()=>W(N),120);return()=>clearTimeout(t)},[N]),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(),g=`${window.location.pathname}${d?`?${d}`:""}${window.location.hash}`;window.history.replaceState({},"",g)},[a]),!kr&&!kt())return e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx(jt,{})});const _=async(t,n)=>{ke(t),T("");try{await n(),await Ne()}catch(d){T(d?.message||r("skills.error.generic"))}finally{ke("")}},Je=(t,n)=>{const d=(n&&n.length?n:sa).filter(g=>(l.targets||[]).some(R=>R.id===g));_(qe(t),async()=>{await fa(t,d);const g=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:g||r("skills.target.none")}),timeout:4e3})})},Be=t=>{X(t)},ye=()=>{const t=te;t&&(X(null),_(Ca(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 qt(t.id),await Ne()}catch(g){T(g?.message||r("skills.error.generic"))}}}:void 0})}))},Y=(t,n,d)=>_(Xa(t.id,n),async()=>{const g=new Set(t.targets||[]);d?g.add(n):g.delete(n),t.managed?await ka(t.id,Array.from(g)):await wa(t.directory,Array.from(g));const R={name:t.name||t.directory,agent:Ke(n)};Ce({title:d?r("skills.toast.synced_one",R):r("skills.toast.unsynced_one",R),timeout:3e3})}),$e=i.useCallback(()=>re(new Set),[]),Ze=i.useCallback((t,n)=>{re(d=>{const g=new Set(d);return n?g.add(t.id):g.delete(t.id),g})},[]),Ke=t=>(l.targets||[]).find(n=>n.id===t)?.label||t,Te=t=>{const n=(l.skills||[]).filter(d=>V.has(d.id));n.length&&_("batch",async()=>{for(const d of n){const g=new Set(d.targets||[]);g.add(t),d.managed?await ka(d.id,Array.from(g)):await wa(d.directory,Array.from(g))}$e(),Ce({title:r("skills.toast.bulk_synced",{count:n.length,agent:Ke(t)}),timeout:4e3})})},ea=()=>{const t=(l.skills||[]).filter(n=>V.has(n.id));t.length&&L(t)},aa=()=>{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||[]);$e(),Ce({title:r("skills.toast.bulk_removed",{count:t.length}),timeout:4e3})}))},f=t=>{!t?.repoOwner||!t?.repoName||_(qe(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:sa),await oe(),Ce({title:r("skills.toast.updated",{name:t.name||t.directory}),timeout:4e3})})},D=async()=>{const t=C.trim();if(!(t.length<2)){ke("search"),T("");try{const n=await Ht(t);h(n.skills||[])}catch(n){T(n?.message||r("skills.error.generic"))}finally{ke("")}}},ce=async()=>{const t=U.trim().replace(/^https:\/\/github\.com\//,"").replace(/\.git$/,""),[n,d]=t.split("/");if(!n||!d){T(r("skills.repo.invalid"));return}await _("repo:add",async()=>{await Wt({owner:n,name:d,branch:"main",enabled:!0}),ge(""),await H(),await ie()})},ue=async t=>{await _(`repo:${t.owner}/${t.name}`,async()=>{await Gt(t.owner,t.name),await H(),await ie()})},$=l.targets||[],q=l.skills||[],De=i.useMemo(()=>{const t=B==="all"?q:q.filter(d=>(d.targets||[]).includes(B)),n=O.trim().toLowerCase();return n?t.filter(d=>(d.name||"").toLowerCase().includes(n)||(d.directory||"").toLowerCase().includes(n)||(d.description||"").toLowerCase().includes(n)):t},[q,B,O]),Ya=B!=="all",J=i.useMemo(()=>Q&&q.find(t=>(t.id||t.directory)===Q)||null,[q,Q]),Ja=i.useCallback(()=>{K("all"),I("")},[]),Za=i.useCallback(t=>{ae(n=>{const d=t?.id||t?.directory||null;return n===d?null:d})},[]),et=i.useCallback(()=>ae(null),[]),at=i.useCallback(t=>{const n=Xe(t).toLowerCase(),d=ja(t),g=(l.skills||[]).find(R=>{const S=Na(R);return S.has(n)||d&&S.has(d)});g&&ae(g.id||g.directory)},[l.skills]);i.useEffect(()=>{a!=="my"&&V.size&&re(new Set)},[a,V.size]),i.useEffect(()=>{Q&&!J&&ae(null)},[J,Q]);const Me=i.useMemo(()=>{const t=o===M?m:o===A?je:c,d=o===M||o===A||o===xe?t:t.filter(S=>`${S.repoOwner}/${S.repoName}`===o),g=v.trim().toLowerCase();return(o===M||!g?d:d.filter(S=>(S.name||"").toLowerCase().includes(g)||(S.directory||"").toLowerCase().includes(g)||(S.description||"").toLowerCase().includes(g))).map(S=>{const ta=Xe(S).toLowerCase(),z=ja(S);return{...S,installed:Ie.has(ta)||z&&Ie.has(z)}})},[v,c,Ie,je,m,o]),tt=e.jsx("div",{className:"flex h-64 items-center justify-center",children:e.jsx(Z,{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(Z,{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")})]}),Ve=(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=q.length?e.jsx(Pr,{items:De,totalCount:q.length,targets:$,agentOptions:$,agentFilter:B,onAgentFilter:K,anyFilter:Ya,onClearFilters:Ja,searchQuery:N,onSearchQuery:I,searchPlaceholder:r("skills.my.placeholder"),selectedId:Q,onSelect:Za,onToggleTarget:Y,busyKey:F,updates:E,selectedIds:V,onToggleSelect:Ze,onClearSelection:$e,onBulkSync:Te,onBulkRemove:ea}):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:[$.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:[...$,...$].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:[...$,...$].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===A,d=x.length===0&&!t&&!n,g=Le&&!t&&!n||n&&pe,R=!t&&!n&&(v.trim()!==""||o!==xe),S=()=>{k(""),j(xe)},ta=!d&&!g&&(Me.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:Me.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 z;d?z=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")})}):g?z=rt:t&&C.trim().length<2?z=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")}):Me.length?z=e.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:Me.map(Oe=>e.jsx("div",{style:Rr,children:e.jsx(Er,{skill:Oe,installed:!!Oe.installed,installing:F===qe(Oe),allTargets:$,defaultTargets:sa,onInstall:Je,onManage:at})},Oe.id||Oe.key))}):R?z=Ve("skills.empty.no_match",e.jsx(G,{type:"button",variant:"secondary",size:"sm",onClick:S,children:r("skills.filter.clear")})):t?z=Ve("skills.empty.search"):n?z=Ve("skills.empty.popular"):z=Ve("skills.empty.browse");const st=d||w?e.jsx("div",{className:"mb-5",children:e.jsx(Ir,{repos:x,repoInput:U,onRepoInput:ge,busyKey:F,onAdd:ce,onRemove:ue})}):null,nt=!w&&!t&&!n&&x.length<=1&&Me.length>0?e.jsx(ar,{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:()=>ee(!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,ta,z,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:Ye,disabled:we||Le||pe,children:[e.jsx(wt,{className:me("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:me("-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))}),ze?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:ze}):null,a==="browse"?e.jsxs("div",{className:"mb-5 flex flex-col gap-3 sm:flex-row sm:items-center",children:[e.jsx(Ct,{className:"shrink-0",ariaLabel:r("skills.source.label"),options:[{id:"repo",label:r("skills.mode.repo")},{id:"popular",label:r("skills.mode.popular"),icon:e.jsx(Qt,{className:"h-3.5 w-3.5","aria-hidden":!0})},{id:"skillssh",label:r("skills.mode.skillssh")}],value:o===M?"skillssh":o===A?"popular":"repo",onChange:t=>{t==="skillssh"?j(M):t==="popular"?j(A):(o===M||o===A)&&j(xe)}}),o!==M&&o!==A?e.jsxs(Ra,{value:o,onValueChange:j,children:[e.jsxs(Ea,{"aria-label":r("skills.source.label"),className:"inline-flex h-8 w-44 shrink-0 items-center justify-between gap-2 rounded-md border border-oai-gray-200 bg-oai-white px-2.5 text-xs text-oai-black focus:outline-none data-[popup-open]:border-oai-gray-300 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-white dark:data-[popup-open]:border-oai-gray-700",children:[e.jsx(Ia,{children:t=>t===xe?r("skills.source.all"):t}),e.jsx(Va,{className:"text-oai-gray-400",children:e.jsx(ma,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),e.jsx(Ba,{children:e.jsx($a,{sideOffset:4,alignItemWithTrigger:!1,className:"z-[60]",children:e.jsxs(Ta,{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(Ge,{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(We,{children:r("skills.source.all")}),e.jsx(Qe,{children:e.jsx(_e,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),x.map(t=>{const n=`${t.owner}/${t.name}`;return e.jsxs(Ge,{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(We,{children:n}),e.jsx(Qe,{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(la,{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(ca,{type:"search",value:C,onChange:t=>k(t.target.value),onKeyDown:t=>{t.key==="Enter"&&o===M&&D()},"aria-label":r("skills.action.search_aria"),placeholder:o===M?r("skills.browse.placeholder_skillssh"):o===A?r("skills.browse.placeholder_popular"):o===xe?r("skills.browse.placeholder_all"):r("skills.browse.placeholder_repo",{repo:o}),className:"h-8 pl-9 !border-oai-gray-200 dark:!border-oai-gray-800 focus:!border-oai-gray-400 focus:!ring-oai-gray-400/20 dark:focus:!border-oai-gray-500 dark:focus:!ring-oai-gray-500/20"})]}),o===M?e.jsxs(G,{type:"button",size:"sm",onClick:D,disabled:C.trim().length<2||F==="search",className:"focus:!ring-oai-gray-400/30",children:[F==="search"?e.jsx(Z,{className:"mr-1.5 h-4 w-4 animate-spin","aria-hidden":!0}):e.jsx(la,{className:"mr-1.5 h-4 w-4","aria-hidden":!0}),r("skills.action.search")]}):o===A?null:e.jsxs(G,{type:"button",variant:"secondary",size:"sm",onClick:()=>ee(t=>!t),"aria-expanded":w,className:"!h-8 shrink-0 whitespace-nowrap !border-oai-gray-200 dark:!border-oai-gray-800 hover:!border-oai-gray-300 dark:hover:!border-oai-gray-700 hover:!text-oai-black dark:hover:!text-white focus:!ring-oai-gray-400/30",children:[e.jsx(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:x.length})]})]}):null,He,e.jsx(yr,{skill:J,targets:$,busyKey:F,usage:J&&(P[String(J.directory||"").toLowerCase()]||P[String(J.name||"").toLowerCase()])||null,hasUpdate:!!(J?.id&&E?.[J.id]),updating:J?F===qe(J):!1,onUpdate:f,onClose:et,onToggleTarget:Y,onRemove:Be})]})}),e.jsx(xa,{open:!!te,title:r("skills.confirm.remove_title",{name:te?.name||te?.directory||""}),description:te?te.managed?r("skills.confirm.remove_managed"):r("skills.confirm.remove_local"):"",confirmLabel:r("skills.action.remove"),cancelLabel:r("shared.action.cancel"),destructive:!0,busy:F===Ca(te||{}),onCancel:()=>X(null),onConfirm:ye}),e.jsx(xa,{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:F==="batch",onCancel:()=>L(null),onConfirm:aa})]})}export{ls as SkillsPage};
|
|
1
|
+
import{m as Sa,r as i,P as it,A as da,j as e,X as Se,c as r,e as me,aX as na,ay as _a,aY as ot,z as lt,aZ as ga,a_ as dt,a$ as ct,Y as ut,b0 as ha,b1 as mt,b2 as gt,E as ht,b3 as xt,aA as pt,az as ft,b4 as yt,a3 as bt,K as kt,B as H,R as wt,d as vt,a4 as Ce}from"./__vite-browser-external-egzerGU6.js";import{L as jt}from"./LocalOnlyNotice-Bo1dtxi6.js";import{C as Nt}from"./Card-Cl4XFCGL.js";import{C as xa}from"./ConfirmModal-B0IuSw4g.js";import{S as Ct,I as ca}from"./SegmentedControl-C_IwmWnO.js";import{I as La}from"./info-YSmBFAMa.js";import{P as be}from"./ProviderIcon-B3hZ1YWD.js";import{m as pa}from"./react-DujpLuOh.js";import{u as St}from"./useCurrency-BgFo76Yb.js";import{E as ia}from"./external-link-B39v_fs8.js";import{L as Z}from"./loader-circle-B5Hs89F2.js";import{C as _e}from"./check-Ct-iMhaB.js";import{T as ua}from"./trash-2-CSt4wZ-I.js";import{A as _t}from"./index-pxtsHew5.js";import{u as Lt}from"./use-reduced-motion-B9hTo-eX.js";import{u as Pt,s as Rt,k as Pa,l as Et,m as It,n as Bt,o as $t,p as Tt,S as Ra,c as Ea,d as Ia,e as Ba,f as $a,g as Ta,h as He,j as We,i as Xe}from"./SelectItemText-BWaMX4pY.js";import{t as Dt,u as oa,m as Mt}from"./useScrollLock-DPW-g15w.js";import{u as Ot,C as ma}from"./ToolbarRootContext-Q_DQJlr5.js";import{g as Ut,a as Ft,d as zt,b as At,c as Kt,e as Vt,s as qt,i as fa,u as ya,f as ba,r as Gt,h as ka,j as wa,k as Ht,l as Wt}from"./skills-api-CGohvSGo.js";import{F as Xt}from"./flame-xbjyxu-1.js";import{S as la}from"./search-BswhdD2a.js";import{D as Da}from"./download-6N9dBj_W.js";import{C as Yt}from"./chevron-right-CIcqYgwy.js";import{P as Ma,a as Oa,b as Ua,c as Fa,d as za}from"./PopoverPopup-CkaOLLN4.js";import"./arrow-up-right-CEUtBwnj.js";import"./DialogTitle-Ul-NH9HD.js";import"./store-BTdeRhbU.js";import"./DialogDescription-pCAELf1b.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=Sa("circle-arrow-up",Qt);const Jt=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Ka=Sa("plus",Jt),Va=i.forwardRef(function(s,l){const{render:u,className:c,style:p,...m}=s,{store:h}=Pt(),b={open:it(h,Rt.open)};return da("span",s,{state:b,ref:l,props:[{"aria-hidden":!0,children:"▼"},m],stateAttributesMapping:Dt})}),Zt="tt:hint:dismissed:";function qa(a){return Zt+a}function er(a){if(typeof window>"u")return!1;try{return window.localStorage.getItem(qa(a))==="1"}catch{return!1}}function ar({id:a,children:s,className:l,ariaLabel:u}){const[c,p]=i.useState(()=>er(a)),m=i.useCallback(()=>{if(typeof window<"u")try{window.localStorage.setItem(qa(a),"1")}catch{}p(!0)},[a]);return c?null:e.jsxs("div",{role:"note","aria-label":u||r("hint.dismissible_aria"),className:me("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:m,"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 tr(a){if(!a)return null;for(const s of a.elements){const l=s.tagName;if(l==="BUTTON"||l==="INPUT"){const u=s;if(u.type==="submit")return u}}return null}let va=(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 Ga(a){return i.useMemo(()=>({checked(s){return a.indeterminate?{}:s?{[va.checked]:""}:{[va.unchecked]:""}},...Pa}),[a.indeterminate])}const rr=i.createContext({disabled:!1});function sr(){return i.useContext(rr)}function nr(a,s,l,u=!0,c){const[p,m]=i.useState(),h=oa(c?`${c}-label`:void 0),x=a??s??p;return na(()=>{const b=a||s||!u?void 0:ir(l.current,h);p!==b&&m(b)}),x}function ir(a,s){const l=or(a);if(l)return!l.id&&s&&(l.id=s),l.id||void 0}function or(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 u=a.labels;return u&&u[0]}const lr=i.createContext(void 0);function dr(a=!0){const s=i.useContext(lr);if(s===void 0&&!a)throw new Error(_a(3));return s}const Ha=i.createContext(void 0);function cr(){const a=i.useContext(Ha);if(a===void 0)throw new Error(_a(14));return a}const ur="data-parent",mr=i.forwardRef(function(s,l){const{checked:u,className:c,defaultChecked:p=!1,"aria-labelledby":m,disabled:h=!1,form:x,id:b,indeterminate:o=!1,inputRef:j,name:C,onCheckedChange:k,parent:v=!1,readOnly:y=!1,render:N,required:I=!1,uncheckedValue:O,value:W,nativeButton:U=!1,style:ge,...w}=s,{clearErrors:ee}=Et(),{disabled:B,name:K,setDirty:X,setFilled:ae,setFocused:F,setTouched:ke,state:we,validationMode:Ue,validityData:Le,validation:Fe}=It(),ze=sr(),{labelId:T,controlId:te,registerControlId:Y,getDescriptionProps:ve}=Bt(),L=dr(),V=L?.parent,re=V&&L.allValues,E=B||ze.disabled||L?.disabled||h,se=K??C,P=W??se,Pe=oa(),je=oa();let ne=te;re?ne=v?je:`${V.id}-${P}`:b&&(ne=b);let pe={};re&&(v?pe=L.parent.getParentProps():P&&(pe=L.parent.getChildProps(P)));const{checked:Re=u,indeterminate:Ee=o,onCheckedChange:Ie,...Ne}=pe,q=L?.value,ie=L?.setValue,fe=L?.defaultValue,oe=i.useRef(null),le=ot(()=>Symbol("checkbox-control")),he=i.useRef(!1),{getButtonProps:Qe,buttonRef:Ae}=lt({disabled:E,native:U}),de=L?.validation??Fe,[_,Je]=$t({controlled:P&&q&&!v?q.includes(P):Re,default:P&&fe&&!v?fe.includes(P):p,name:"Checkbox",state:"checked"}),Be=re?!!Re:_,ye=re&&Ee||o;na(()=>{Y!==ga&&(he.current=!0,Y(le.current,ne))},[ne,Y,le]),i.useEffect(()=>{const f=le.current;return()=>{!he.current||Y===ga||(he.current=!1,Y(f,void 0))}},[Y,le]),Tt(oe,Pe,_,void 0,!L&&!E,C);const Q=i.useRef(null),$e=dt(j,Q,de.inputRef,de.registerInput),Ze=nr(m,T,Q,!U,ne??void 0);na(()=>{Q.current&&(Q.current.indeterminate=ye,_&&ae(!0))},[_,ye,ae]),Ot(_,()=>{L||(ee(se),ae(_),X(_!==Le.initialValue),de.change(_))});const Ke=ct({checked:_,disabled:E,form:x,name:v?void 0:se,id:U?void 0:ne??void 0,required:I,ref:$e,style:se?mt:gt,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(f){if(f.nativeEvent.defaultPrevented)return;if(y){f.preventDefault();return}const D=f.currentTarget.checked,ce=ht(xt,f.nativeEvent);if(k?.(D,ce),!ce.isCanceled&&(Ie?.(D,ce),!ce.isCanceled&&(Je(D),P&&q&&ie&&!v&&!re))){const ue=D?[...q,P]:q.filter($=>$!==P);ie(ue,ce)}},onFocus(){oe.current?.focus()}},W!==void 0?{value:(L?_&&W:W)||""}:ut,ve,f=>de.getValidationProps(E,f));i.useEffect(()=>{if(!V||!P)return;const f=V.disabledStatesRef.current;return f.set(P,E),()=>{f.delete(P)}},[V,E,P]);const Te=i.useMemo(()=>({...we,checked:Be,disabled:E,readOnly:y,required:I,indeterminate:ye}),[we,Be,E,y,I,ye]),ea=Ga(Te),aa=da("span",s,{state:Te,ref:[Ae,oe,l,L?.registerControlRef],props:[{id:U?ne??void 0:Pe,role:"checkbox","aria-checked":ye?"mixed":Be,"aria-readonly":y||void 0,"aria-required":I||void 0,"aria-labelledby":Ze,[ur]:v?"":void 0,onFocus(){E||F(!0)},onBlur(){const f=Q.current;f&&(ke(!0),F(!1),Ue==="onBlur"&&de.commit(L?q:f.checked))},onKeyDown(f){if(f.key!=="Enter"||(f.preventBaseUIHandler(),f.defaultPrevented))return;const D=Q.current?.form??null,ce=f.currentTarget,ue=f.nativeEvent,$=f.preventDefault,G=ue.preventDefault;let De=!1;f.preventDefault=()=>{De=!0,$.call(f)},ue.preventDefault=()=>{De=!0,G.call(ue)},G.call(ue),ha(ce).queueMicrotask(()=>{f.preventDefault=$,ue.preventDefault=G,De||tr(D)?.click()})},onClick(f){if(y||E)return;f.preventDefault();const D=Q.current;D&&D.dispatchEvent(new(ha(D)).PointerEvent("click",{bubbles:!0,shiftKey:f.shiftKey,ctrlKey:f.ctrlKey,altKey:f.altKey,metaKey:f.metaKey}))}},w,Ne,Qe,ve,f=>de.getValidationProps(E,f)],stateAttributesMapping:ea});return e.jsxs(Ha.Provider,{value:Te,children:[aa,!_&&!L&&se&&!v&&O!==void 0&&e.jsx("input",{type:"hidden",form:x,name:se,value:O,disabled:E}),e.jsx("input",{...Ke,suppressHydrationWarning:!0})]})}),gr=i.forwardRef(function(s,l){const{render:u,className:c,style:p,keepMounted:m=!1,...h}=s,x=cr(),b=x.checked||x.indeterminate,{mounted:o,transitionStatus:j,setMounted:C}=Mt(b),k=i.useRef(null),v={...x,transitionStatus:j};pt({open:b,ref:k,onComplete(){b||C(!1)}});const N={...Ga(x),...ft,...Pa},I=m||o,O=da("span",s,{ref:[l,k],state:v,stateAttributesMapping:N,props:h});return I?O:null});function hr(a,s){return`target:${a}:${s}`}function xr(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 pr(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 fr(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 ra({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 yr({skill:a,targets:s,busyKey:l,usage:u,hasUpdate:c,updating:p,onUpdate:m,onClose:h,onToggleTarget:x,onRemove:b}){return e.jsx(_t,{children:a?e.jsx(br,{skill:a,targets:s,busyKey:l,usage:u,hasUpdate:c,updating:p,onUpdate:m,onClose:h,onToggleTarget:x,onRemove:b},a.id||a.directory):null})}function br({skill:a,targets:s,busyKey:l,usage:u,hasUpdate:c,updating:p,onUpdate:m,onClose:h,onToggleTarget:x,onRemove:b}){const o=Lt(),{currency:j,rate:C}=St(),k=i.useRef(null);i.useEffect(()=>{const w=B=>{B.key==="Escape"&&(B.stopPropagation(),h?.())},ee=B=>{const K=B.target;K instanceof Element&&(k.current?.contains(K)||K.closest('[data-skill-row="1"]')||h?.())};return document.addEventListener("keydown",w),document.addEventListener("mousedown",ee),()=>{document.removeEventListener("keydown",w),document.removeEventListener("mousedown",ee)}},[h]);const v=a.name||a.directory,y=!!(a.repoOwner&&a.repoName),N=y?`https://github.com/${a.repoOwner}/${a.repoName}`:null,I=new Set(a.targets||[]),O=l===xr(a),W=pr(u?.lastUsedAt),U=!!(u&&u.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:h,"aria-hidden":!0}),e.jsxs(pa.aside,{ref:k,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:N,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:N,children:[e.jsxs("span",{className:"truncate",children:[a.repoOwner,"/",a.repoName]}),e.jsx(ia,{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:h,"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:()=>m?.(a),disabled:p,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:[p?e.jsx(Z,{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(ra,{label:r("skills.usage.invocations"),children:yt(u?.invocations||0)}),e.jsx(ra,{label:r("skills.usage.last_used"),children:e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx("span",{className:me("h-1.5 w-1.5 rounded-full",fr(u?.lastUsedAt)),"aria-hidden":!0}),U?W||r("skills.usage.unknown"):r("skills.usage.never")]})}),e.jsx(ra,{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:bt(u?.cost||0,{currency:j,rate:C})})]}),U?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(w=>{const ee=I.has(w.id),B=l===hr(a.id,w.id),K=`skill-detail-sync-${a.id||a.directory}-${w.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(mr,{id:K,checked:ee,disabled:B,onCheckedChange:X=>x?.(a,w.id,!!X),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(gr,{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:w.id,size:16})}),e.jsx("span",{className:"flex-1",children:w.label}),B?e.jsx(Z,{className:"h-3.5 w-3.5 animate-spin text-oai-gray-400","aria-hidden":!0}):null]},w.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:O,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:[O?e.jsx(Z,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):e.jsx(ua,{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 kr=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"),sa=["claude","codex"],A="popular",wr={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 Xa(a){return String(a||"").replace(/\\/g,"/").trim().toLowerCase()}function vr(a){return Xa(a).split("/").filter(Boolean).pop()||""}function jr(a){if(a.repoOwner||a.repoName)return"";const s=Xa(a.directory);return!s||s.includes("/")?"":`dir:${s}`}function ja(a){const s=vr(a.directory);return s?`dir:${s}`:""}function Na(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=jr(a);return l&&s.add(l),s}function Ge(a){return`install:${Ye(a)}`}function Ca(a){return`remove:${a.id||a.directory}`}function Ya(a,s){return`target:${a}:${s}`}function Nr({target:a,state:s,busy:l,onToggle:u}){const c=s==="synced",p=s==="orphan",m=p?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:m,"aria-label":m,"aria-pressed":c,disabled:l,onClick:h=>{h.stopPropagation(),u?.(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(Z,{className:"h-4 w-4 animate-spin text-oai-gray-400","aria-hidden":!0}):e.jsx("span",{className:me("flex h-[18px] w-[18px] items-center justify-center transition",c&&wr[a.id],!c&&!p&&"opacity-35 grayscale"),"aria-hidden":!0,children:e.jsx(be,{provider:a.id,size:18})}),p&&!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 Cr({skill:a,targets:s,onToggleTarget:l,busyKey:u}){return e.jsx("div",{className:"flex items-center gap-1",onClick:c=>c.stopPropagation(),children:s.map(c=>e.jsx(Nr,{target:c,state:a.targetStates?.[c.id]||"off",busy:u===Ya(a.id,c.id),onToggle:(p,m)=>l?.(a,p,m)},c.id))})}function Sr({skill:a,targets:s,selected:l,onSelect:u,selectable:c,checked:p,onToggleSelect:m,onToggleTarget:h,hasUpdate:x,busyKey:b}){const o=a.repoOwner&&a.repoName?`${a.repoOwner}/${a.repoName}`:null,j=o?`${a.directory} · ${o}`:a.directory,C=k=>{(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),u?.(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:()=>u?.(a),onKeyDown:C,className:me("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":p?"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:k=>k.stopPropagation(),children:e.jsx("input",{type:"checkbox",checked:p,onChange:k=>m?.(a,k.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:j,children:a.name||a.directory}),x?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(Cr,{skill:a,targets:s,onToggleTarget:h,busyKey:b}),e.jsx(Yt,{className:me("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:me("mt-1 line-clamp-2 text-xs text-oai-gray-500 dark:text-oai-gray-400",c&&"pl-7"),children:a.description}):null]})}function _r({agentFilter:a,agentOptions:s,onAgentFilter:l,filteredCount:u,totalCount:c,anyFilter:p,onClearFilters:m,searchQuery:h,onSearchQuery:x,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(Ra,{value:a,onValueChange:l,children:[e.jsxs(Ea,{"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(Ia,{children:o=>o==="all"?r("skills.filter.agent_all"):s.find(j=>j.id===o)?.label||o}),e.jsx(Va,{className:"text-oai-gray-400",children:e.jsx(ma,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),e.jsx(Ba,{children:e.jsx($a,{sideOffset:4,alignItemWithTrigger:!1,className:"z-[60]",children:e.jsxs(Ta,{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(He,{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(We,{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(He,{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(We,{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(la,{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(ca,{type:"search",value:h,onChange:o=>x(o.target.value),onKeyDown:o=>{o.key==="Escape"&&h&&(o.preventDefault(),x(""))},"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:()=>x(""),"aria-label":r("skills.action.search_clear"),"aria-hidden":!h,tabIndex:h?0:-1,className:me("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",h?"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:u,total:c})}),p?e.jsxs("button",{type:"button",onClick:m,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 Lr({count:a,targets:s,busy:l,onBulkSync:u,onBulkRemove:c,onClear:p}){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(Ma,{children:[e.jsxs(Oa,{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(Da,{className:"h-3.5 w-3.5","aria-hidden":!0}),r("skills.select.bulk_sync"),e.jsx(ma,{className:"h-3 w-3","aria-hidden":!0})]}),e.jsx(Ua,{children:e.jsx(Fa,{sideOffset:6,side:"bottom",align:"end",className:"!z-[80]",children:e.jsxs(za,{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(m=>e.jsxs("button",{type:"button",onClick:()=>u(m.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:m.id,size:16}),e.jsx("span",{className:"flex-1",children:m.label})]},m.id))]})})})]}),e.jsxs(H,{type:"button",variant:"ghost",size:"sm",disabled:l,onClick:c,children:[e.jsx(ua,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),r("skills.select.bulk_remove")]}),e.jsxs("button",{type:"button",onClick:p,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 Pr({items:a,totalCount:s,targets:l,agentOptions:u,agentFilter:c,onAgentFilter:p,anyFilter:m,onClearFilters:h,searchQuery:x,onSearchQuery:b,searchPlaceholder:o,selectedId:j,onSelect:C,onToggleTarget:k,busyKey:v,updates:y,selectedIds:N,onToggleSelect:I,onClearSelection:O,onBulkSync:W,onBulkRemove:U}){const ge=N.size;return e.jsxs("div",{children:[ge>0?e.jsx(Lr,{count:ge,targets:l,busy:v==="batch",onBulkSync:W,onBulkRemove:U,onClear:O}):e.jsx(_r,{agentFilter:c,agentOptions:u,onAgentFilter:p,filteredCount:a.length,totalCount:s,anyFilter:m,onClearFilters:h,searchQuery:x,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(H,{type:"button",variant:"secondary",size:"sm",onClick:h,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(w=>e.jsx(Sr,{skill:w,targets:l,selected:j===(w.id||w.directory),onSelect:C,selectable:!0,checked:N.has(w.id),onToggleSelect:I,onToggleTarget:k,hasUpdate:!!(w.id&&y?.[w.id]),busyKey:v},w.id||w.key))})]})}const Rr={contentVisibility:"auto",containIntrinsicSize:"0 240px"},Er=vt.memo(function({skill:s,installed:l,installing:u,allTargets:c,defaultTargets:p,onInstall:m,onManage:h}){const[x,b]=i.useState(()=>(p||[]).filter(y=>c.some(N=>N.id===y))),o=y=>{b(N=>N.includes(y)?N.filter(I=>I!==y):[...N,y])},j=s.repoOwner&&s.repoName?`${s.repoOwner}/${s.repoName}`:null,C=j?`https://github.com/${s.repoOwner}/${s.repoName}`:null,k=s.installs!=null?r("skills.card.installs",{count:Number(s.installs||0).toLocaleString()}):null,v=x.length?x.map(y=>c.find(N=>N.id===y)?.label||y).join(", "):r("skills.action.choose_targets");return e.jsxs(Nt,{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(ia,{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}),j||k?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:[C?e.jsxs("a",{href:C,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:C,children:[e.jsx("span",{className:"truncate",children:j}),e.jsx(ia,{className:"h-2.5 w-2.5 shrink-0","aria-hidden":!0})]}):null,j&&k?e.jsx("span",{"aria-hidden":!0,children:"·"}):null,k?e.jsx("span",{className:"truncate",children:k}):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(H,{type:"button",variant:"secondary",size:"sm",onClick:()=>h?.(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:x.length?v:r("skills.target.none")}),e.jsxs(Ma,{children:[e.jsx(Oa,{disabled:u,"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(Ua,{children:e.jsx(Fa,{sideOffset:6,side:"bottom",align:"end",className:"!z-[80]",children:e.jsxs(za,{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 N=x.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:N,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(H,{type:"button",size:"sm",onClick:()=>m(s,x),disabled:u||x.length===0,className:"w-full",children:[u?e.jsx(Z,{className:"mr-1.5 h-3.5 w-3.5 animate-spin","aria-hidden":!0}):e.jsx(Da,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),r("skills.action.install")]})]})})]})});function Ir({repos:a,repoInput:s,onRepoInput:l,busyKey:u,onAdd:c,onRemove:p}){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(ca,{value:s,onChange:m=>l(m.target.value),placeholder:r("skills.repo.placeholder"),className:"min-w-0 flex-1"}),e.jsxs(H,{type:"button",variant:"secondary",size:"md",onClick:c,disabled:u==="repo:add",className:"shrink-0 whitespace-nowrap",children:[u==="repo:add"?e.jsx(Z,{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(m=>{const h=u===`repo:${m.owner}/${m.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:[m.owner,"/",m.name]}),e.jsx("div",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400",children:m.branch})]}),e.jsxs(H,{type:"button",variant:"ghost",size:"sm",disabled:h,onClick:()=>p(m),className:"shrink-0",children:[h?e.jsx(Z,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):e.jsx(ua,{className:"h-3.5 w-3.5","aria-hidden":!0}),e.jsx("span",{className:"sr-only",children:r("skills.repo.remove")})]})]},`${m.owner}/${m.name}`)})}):null]})}function Br(){return typeof window>"u"?"my":new URLSearchParams(window.location.search).get("tab")==="browse"?"browse":"my"}function ls(){const[a,s]=i.useState(Br),[l,u]=i.useState({skills:[],targets:[]}),[c,p]=i.useState([]),[m,h]=i.useState([]),[x,b]=i.useState([]),[o,j]=i.useState(xe),[C,k]=i.useState(""),[v,y]=i.useState(""),[N,I]=i.useState(""),[O,W]=i.useState(""),[U,ge]=i.useState(""),[w,ee]=i.useState(!1),[B,K]=i.useState("all"),[X,ae]=i.useState(null),[F,ke]=i.useState(""),[we,Ue]=i.useState(!0),[Le,Fe]=i.useState(!1),[ze,T]=i.useState(""),[te,Y]=i.useState(null),[ve,L]=i.useState(null),[V,re]=i.useState(()=>new Set),[E,se]=i.useState({}),[P,Pe]=i.useState({}),[je,ne]=i.useState([]),[pe,Re]=i.useState(!1),Ee=i.useRef(!1),Ie=i.useMemo(()=>{const t=new Set;for(const n of l.skills||[])for(const d of Na(n))t.add(d);return t},[l.skills]),Ne=i.useCallback(async()=>{const t=await Ut();u({skills:t.skills||[],targets:t.targets||[]})},[]),q=i.useCallback(async()=>{const t=await Ft();b(t.repos||[])},[]),ie=i.useCallback(async({force:t=!1}={})=>{Fe(!0);try{const n=await zt({force:t});p(n.skills||[])}finally{Fe(!1)}},[]),fe=i.useCallback(async({force:t=!1}={})=>{Re(!0);try{const n=await At({force:t});ne(n.skills||[])}finally{Re(!1)}},[]),oe=i.useCallback(async()=>{try{const t=await Kt();se(t?.updates||{})}catch{se({})}},[]),le=i.useCallback(async()=>{try{const t=await Vt(),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()=>{Ue(!0),T("");try{await Promise.all([Ne(),q()])}catch(t){T(t?.message||r("skills.error.generic"))}finally{Ue(!1)}},[Ne,q]),Qe=i.useCallback(async()=>{await he();const t=n=>T(n?.message||r("skills.error.generic"));a==="my"?(oe(),le()):o===A?fe({force:!0}).catch(t):o!==M&&ie({force:!0}).catch(t)},[ie,he,fe,oe,le,o,a]);i.useEffect(()=>{he()},[he]),i.useEffect(()=>{if(Ee.current||typeof window>"u")return;const t=new URLSearchParams(window.location.search),n=t.get("skill");if(!n){Ee.current=!0;return}const d=l.skills||[];if(!d.length)return;const g=d.find(S=>S.directory===n||S.id===n);g&&(s("my"),ae(g.id||g.directory)),Ee.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===A||c.length===0&&ie().catch(t=>T(t?.message||r("skills.error.generic"))))},[c.length,ie,o,a]),i.useEffect(()=>{a!=="browse"||o!==A||je.length===0&&fe().catch(t=>T(t?.message||r("skills.error.generic")))},[fe,je.length,o,a]);const Ae=Object.keys(E).length>0,de=Object.keys(P).length>0;if(i.useEffect(()=>{a==="my"&&(Ae||oe(),de||le())},[a,Ae,de,oe,le]),i.useEffect(()=>{const t=setTimeout(()=>y(C),200);return()=>clearTimeout(t)},[C]),i.useEffect(()=>{const t=setTimeout(()=>W(N),120);return()=>clearTimeout(t)},[N]),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(),g=`${window.location.pathname}${d?`?${d}`:""}${window.location.hash}`;window.history.replaceState({},"",g)},[a]),!kr&&!kt())return e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx(jt,{})});const _=async(t,n)=>{ke(t),T("");try{await n(),await Ne()}catch(d){T(d?.message||r("skills.error.generic"))}finally{ke("")}},Je=(t,n)=>{const d=(n&&n.length?n:sa).filter(g=>(l.targets||[]).some(R=>R.id===g));_(Ge(t),async()=>{await fa(t,d);const g=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:g||r("skills.target.none")}),timeout:4e3})})},Be=t=>{Y(t)},ye=()=>{const t=te;t&&(Y(null),_(Ca(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 Gt(t.id),await Ne()}catch(g){T(g?.message||r("skills.error.generic"))}}}:void 0})}))},Q=(t,n,d)=>_(Ya(t.id,n),async()=>{const g=new Set(t.targets||[]);d?g.add(n):g.delete(n),t.managed?await ka(t.id,Array.from(g)):await wa(t.directory,Array.from(g));const R={name:t.name||t.directory,agent:Ke(n)};Ce({title:d?r("skills.toast.synced_one",R):r("skills.toast.unsynced_one",R),timeout:3e3})}),$e=i.useCallback(()=>re(new Set),[]),Ze=i.useCallback((t,n)=>{re(d=>{const g=new Set(d);return n?g.add(t.id):g.delete(t.id),g})},[]),Ke=t=>(l.targets||[]).find(n=>n.id===t)?.label||t,Te=t=>{const n=(l.skills||[]).filter(d=>V.has(d.id));n.length&&_("batch",async()=>{for(const d of n){const g=new Set(d.targets||[]);g.add(t),d.managed?await ka(d.id,Array.from(g)):await wa(d.directory,Array.from(g))}$e(),Ce({title:r("skills.toast.bulk_synced",{count:n.length,agent:Ke(t)}),timeout:4e3})})},ea=()=>{const t=(l.skills||[]).filter(n=>V.has(n.id));t.length&&L(t)},aa=()=>{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||[]);$e(),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:sa),await oe(),Ce({title:r("skills.toast.updated",{name:t.name||t.directory}),timeout:4e3})})},D=async()=>{const t=C.trim();if(!(t.length<2)){ke("search"),T("");try{const n=await qt(t);h(n.skills||[])}catch(n){T(n?.message||r("skills.error.generic"))}finally{ke("")}}},ce=async()=>{const t=U.trim().replace(/^https:\/\/github\.com\//,"").replace(/\.git$/,""),[n,d]=t.split("/");if(!n||!d){T(r("skills.repo.invalid"));return}await _("repo:add",async()=>{await Wt({owner:n,name:d,branch:"main",enabled:!0}),ge(""),await q(),await ie()})},ue=async t=>{await _(`repo:${t.owner}/${t.name}`,async()=>{await Ht(t.owner,t.name),await q(),await ie()})},$=l.targets||[],G=l.skills||[],De=i.useMemo(()=>{const t=B==="all"?G:G.filter(d=>(d.targets||[]).includes(B)),n=O.trim().toLowerCase();return n?t.filter(d=>(d.name||"").toLowerCase().includes(n)||(d.directory||"").toLowerCase().includes(n)||(d.description||"").toLowerCase().includes(n)):t},[G,B,O]),Qa=B!=="all",J=i.useMemo(()=>X&&G.find(t=>(t.id||t.directory)===X)||null,[G,X]),Ja=i.useCallback(()=>{K("all"),I("")},[]),Za=i.useCallback(t=>{ae(n=>{const d=t?.id||t?.directory||null;return n===d?null:d})},[]),et=i.useCallback(()=>ae(null),[]),at=i.useCallback(t=>{const n=Ye(t).toLowerCase(),d=ja(t),g=(l.skills||[]).find(R=>{const S=Na(R);return S.has(n)||d&&S.has(d)});g&&ae(g.id||g.directory)},[l.skills]);i.useEffect(()=>{a!=="my"&&V.size&&re(new Set)},[a,V.size]),i.useEffect(()=>{X&&!J&&ae(null)},[J,X]);const Me=i.useMemo(()=>{const t=o===M?m:o===A?je:c,d=o===M||o===A||o===xe?t:t.filter(S=>`${S.repoOwner}/${S.repoName}`===o),g=v.trim().toLowerCase();return(o===M||!g?d:d.filter(S=>(S.name||"").toLowerCase().includes(g)||(S.directory||"").toLowerCase().includes(g)||(S.description||"").toLowerCase().includes(g))).map(S=>{const ta=Ye(S).toLowerCase(),z=ja(S);return{...S,installed:Ie.has(ta)||z&&Ie.has(z)}})},[v,c,Ie,je,m,o]),tt=e.jsx("div",{className:"flex h-64 items-center justify-center",children:e.jsx(Z,{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(Z,{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")})]}),Ve=(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 qe;if(we)qe=tt;else if(a==="my")qe=G.length?e.jsx(Pr,{items:De,totalCount:G.length,targets:$,agentOptions:$,agentFilter:B,onAgentFilter:K,anyFilter:Qa,onClearFilters:Ja,searchQuery:N,onSearchQuery:I,searchPlaceholder:r("skills.my.placeholder"),selectedId:X,onSelect:Za,onToggleTarget:Q,busyKey:F,updates:E,selectedIds:V,onToggleSelect:Ze,onClearSelection:$e,onBulkSync:Te,onBulkRemove:ea}):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:[$.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:[...$,...$].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:[...$,...$].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(H,{type:"button",size:"sm",onClick:()=>s("browse"),children:r("skills.empty.my_cta")})]});else{const t=o===M,n=o===A,d=x.length===0&&!t&&!n,g=Le&&!t&&!n||n&&pe,R=!t&&!n&&(v.trim()!==""||o!==xe),S=()=>{k(""),j(xe)},ta=!d&&!g&&(Me.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:Me.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 z;d?z=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")})}):g?z=rt:t&&C.trim().length<2?z=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")}):Me.length?z=e.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:Me.map(Oe=>e.jsx("div",{style:Rr,children:e.jsx(Er,{skill:Oe,installed:!!Oe.installed,installing:F===Ge(Oe),allTargets:$,defaultTargets:sa,onInstall:Je,onManage:at})},Oe.id||Oe.key))}):R?z=Ve("skills.empty.no_match",e.jsx(H,{type:"button",variant:"secondary",size:"sm",onClick:S,children:r("skills.filter.clear")})):t?z=Ve("skills.empty.search"):n?z=Ve("skills.empty.popular"):z=Ve("skills.empty.browse");const st=d||w?e.jsx("div",{className:"mb-5",children:e.jsx(Ir,{repos:x,repoInput:U,onRepoInput:ge,busyKey:F,onAdd:ce,onRemove:ue})}):null,nt=!w&&!t&&!n&&x.length<=1&&Me.length>0?e.jsx(ar,{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:()=>ee(!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;qe=e.jsxs(e.Fragment,{children:[st,ta,z,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(H,{type:"button",variant:"secondary",size:"sm",onClick:Qe,disabled:we||Le||pe,children:[e.jsx(wt,{className:me("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:me("-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))}),ze?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:ze}):null,a==="browse"?e.jsxs("div",{className:"mb-5 flex flex-col gap-3 sm:flex-row sm:items-center",children:[e.jsx(Ct,{className:"shrink-0",ariaLabel:r("skills.source.label"),options:[{id:"repo",label:r("skills.mode.repo")},{id:"popular",label:r("skills.mode.popular"),icon:e.jsx(Xt,{className:"h-3.5 w-3.5","aria-hidden":!0})},{id:"skillssh",label:r("skills.mode.skillssh")}],value:o===M?"skillssh":o===A?"popular":"repo",onChange:t=>{t==="skillssh"?j(M):t==="popular"?j(A):(o===M||o===A)&&j(xe)}}),o!==M&&o!==A?e.jsxs(Ra,{value:o,onValueChange:j,children:[e.jsxs(Ea,{"aria-label":r("skills.source.label"),className:"inline-flex h-8 w-44 shrink-0 items-center justify-between gap-2 rounded-md border border-oai-gray-200 bg-oai-white px-2.5 text-xs text-oai-black focus:outline-none data-[popup-open]:border-oai-gray-300 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-white dark:data-[popup-open]:border-oai-gray-700",children:[e.jsx(Ia,{children:t=>t===xe?r("skills.source.all"):t}),e.jsx(Va,{className:"text-oai-gray-400",children:e.jsx(ma,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),e.jsx(Ba,{children:e.jsx($a,{sideOffset:4,alignItemWithTrigger:!1,className:"z-[60]",children:e.jsxs(Ta,{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(He,{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(We,{children:r("skills.source.all")}),e.jsx(Xe,{children:e.jsx(_e,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),x.map(t=>{const n=`${t.owner}/${t.name}`;return e.jsxs(He,{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(We,{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(la,{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(ca,{type:"search",value:C,onChange:t=>k(t.target.value),onKeyDown:t=>{t.key==="Enter"&&o===M&&D()},"aria-label":r("skills.action.search_aria"),placeholder:o===M?r("skills.browse.placeholder_skillssh"):o===A?r("skills.browse.placeholder_popular"):o===xe?r("skills.browse.placeholder_all"):r("skills.browse.placeholder_repo",{repo:o}),className:"h-8 pl-9 !border-oai-gray-200 dark:!border-oai-gray-800 focus:!border-oai-gray-400 focus:!ring-oai-gray-400/20 dark:focus:!border-oai-gray-500 dark:focus:!ring-oai-gray-500/20"})]}),o===M?e.jsxs(H,{type:"button",size:"sm",onClick:D,disabled:C.trim().length<2||F==="search",className:"focus:!ring-oai-gray-400/30",children:[F==="search"?e.jsx(Z,{className:"mr-1.5 h-4 w-4 animate-spin","aria-hidden":!0}):e.jsx(la,{className:"mr-1.5 h-4 w-4","aria-hidden":!0}),r("skills.action.search")]}):o===A?null:e.jsxs(H,{type:"button",variant:"secondary",size:"sm",onClick:()=>ee(t=>!t),"aria-expanded":w,className:"!h-8 shrink-0 whitespace-nowrap !border-oai-gray-200 dark:!border-oai-gray-800 hover:!border-oai-gray-300 dark:hover:!border-oai-gray-700 hover:!text-oai-black dark:hover:!text-white focus:!ring-oai-gray-400/30",children:[e.jsx(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:x.length})]})]}):null,qe,e.jsx(yr,{skill:J,targets:$,busyKey:F,usage:J&&(P[String(J.directory||"").toLowerCase()]||P[String(J.name||"").toLowerCase()])||null,hasUpdate:!!(J?.id&&E?.[J.id]),updating:J?F===Ge(J):!1,onUpdate:f,onClose:et,onToggleTarget:Q,onRemove:Be})]})}),e.jsx(xa,{open:!!te,title:r("skills.confirm.remove_title",{name:te?.name||te?.directory||""}),description:te?te.managed?r("skills.confirm.remove_managed"):r("skills.confirm.remove_local"):"",confirmLabel:r("skills.action.remove"),cancelLabel:r("shared.action.cancel"),destructive:!0,busy:F===Ca(te||{}),onCancel:()=>Y(null),onConfirm:ye}),e.jsx(xa,{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:F==="batch",onCancel:()=>L(null),onConfirm:aa})]})}export{ls as SkillsPage};
|