tokentracker-cli 0.5.88 → 0.5.90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/README.zh-CN.md +9 -0
- package/dashboard/dist/assets/{Card-Cwz-PEn8.js → Card-DmEuggKt.js} +1 -1
- package/dashboard/dist/assets/{DashboardPage-qwG6gudg.js → DashboardPage-y-23SkNx.js} +1 -1
- package/dashboard/dist/assets/{FadeIn-CKfrd1Vn.js → FadeIn-CIKEJ1mC.js} +1 -1
- package/dashboard/dist/assets/{IpCheckPage-D0qJYbXD.js → IpCheckPage-gySQmJPU.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardPage-Dkpcb_0Q.js → LeaderboardPage-NXXlBlrm.js} +1 -1
- package/dashboard/dist/assets/{LeaderboardProfilePage-DHxne8i3.js → LeaderboardProfilePage-DzLc0enb.js} +1 -1
- package/dashboard/dist/assets/{LimitsPage-Dvo_YUik.js → LimitsPage-DuFEVRFB.js} +1 -1
- package/dashboard/dist/assets/{PopoverPopup-CAeHe-sn.js → PopoverPopup-RgvO6hnU.js} +2 -2
- package/dashboard/dist/assets/ProviderIcon-C4FxGWlI.js +1 -0
- package/dashboard/dist/assets/SettingsPage-CmdNVChM.js +1 -0
- package/dashboard/dist/assets/SkillsPage-Dkv9LvM1.js +1 -0
- package/dashboard/dist/assets/WidgetsPage-C8SSZ3VZ.js +1 -0
- package/dashboard/dist/assets/{chevron-down-Bj2POypL.js → chevron-down-BS4d25ie.js} +1 -1
- package/dashboard/dist/assets/{download-1Kz0otkw.js → download-Cs4or3vN.js} +1 -1
- package/dashboard/dist/assets/{leaderboard-columns-DRc_1zw2.js → leaderboard-columns-5fNRo700.js} +1 -1
- package/dashboard/dist/assets/{main-jua4nv-E.js → main-Dirgz7qK.js} +53 -34
- package/dashboard/dist/assets/main-HVmSQFS6.css +1 -0
- package/dashboard/dist/assets/{refresh-cw-Dpw9ponb.js → refresh-cw-oESlYWjZ.js} +1 -1
- package/dashboard/dist/assets/{use-limits-display-prefs-CtpaNbnl.js → use-limits-display-prefs-LMbFljwt.js} +1 -1
- package/dashboard/dist/assets/use-native-settings-B9dgqLeX.js +1 -0
- package/dashboard/dist/assets/{use-usage-limits-B0OYz2eA.js → use-usage-limits-Z6xWV0y7.js} +1 -1
- package/dashboard/dist/clawd/mini/idle-tight.svg +15 -0
- package/dashboard/dist/index.html +2 -2
- package/dashboard/dist/share.html +2 -2
- package/package.json +1 -1
- package/dashboard/dist/assets/ProviderIcon-Bz-JlVCc.js +0 -1
- package/dashboard/dist/assets/SettingsPage-M4ONOKBT.js +0 -1
- package/dashboard/dist/assets/SkillsPage-QB4a2NKJ.js +0 -1
- package/dashboard/dist/assets/WidgetsPage-Dqd4z_tl.js +0 -1
- package/dashboard/dist/assets/main-PEflgXnj.css +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{D as o}from"./main-Dirgz7qK.js";function i({size:l=16,className:c=""}){return o.jsx("svg",{width:l,height:l,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:c,children:o.jsx("path",{d:"M4.709 15.955l4.72-2.647.08-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0 11.784l.055-.352.48-.321.686.06 1.52.103 2.278.158 1.652.097 2.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686 1.908 1.476 2.491 1.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97 2.97 0 01-.104-.729L6.283.134 6.696 0l.996.134.42.364.62 1.414 1.002 2.229 1.555 3.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.376-.91.747-.492.584.28.48.685-.067.444-.286 1.851-.559 2.903-.364 1.942h.212l.243-.242.985-1.306 1.652-2.064.73-.82.85-.904.547-.431h1.033l.76 1.129-.34 1.166-1.064 1.347-.881 1.142-1.264 1.7-.79 1.36.073.11.188-.02 2.856-.606 1.543-.28 1.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.049.061 1.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093 1.068 2.006 1.81 2.509 2.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649 2.345 3.521.122 1.08-.17.353-.608.213-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674 7.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434 1.967-2.18 2.945-1.726 1.845-.414.164-.717-.37.067-.662.401-.589 2.388-3.036 1.44-1.882.93-1.086-.006-.158h-.055L4.132 18.56l-1.13.146-.487-.456.061-.746.231-.243 1.908-1.312-.006.006z"})})}function d({size:l=16,className:c=""}){return o.jsx("svg",{width:l,height:l,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",className:c,children:o.jsx("path",{d:"M8.086.457a6.105 6.105 0 013.046-.415c1.333.153 2.521.72 3.564 1.7a.117.117 0 00.107.029c1.408-.346 2.762-.224 4.061.366l.063.03.154.076c1.357.703 2.33 1.77 2.918 3.198.278.679.418 1.388.421 2.126a5.655 5.655 0 01-.18 1.631.167.167 0 00.04.155 5.982 5.982 0 011.578 2.891c.385 1.901-.01 3.615-1.183 5.14l-.182.22a6.063 6.063 0 01-2.934 1.851.162.162 0 00-.108.102c-.255.736-.511 1.364-.987 1.992-1.199 1.582-2.962 2.462-4.948 2.451-1.583-.008-2.986-.587-4.21-1.736a.145.145 0 00-.14-.032c-.518.167-1.04.191-1.604.185a5.924 5.924 0 01-2.595-.622 6.058 6.058 0 01-2.146-1.781c-.203-.269-.404-.522-.551-.821a7.74 7.74 0 01-.495-1.283 6.11 6.11 0 01-.017-3.064.166.166 0 00.008-.074.115.115 0 00-.037-.064 5.958 5.958 0 01-1.38-2.202 5.196 5.196 0 01-.333-1.589 6.915 6.915 0 01.188-2.132c.45-1.484 1.309-2.648 2.577-3.493.282-.188.55-.334.802-.438.286-.12.573-.22.861-.304a.129.129 0 00.087-.087A6.016 6.016 0 015.635 2.31C6.315 1.464 7.132.846 8.086.457zm-.804 7.85a.848.848 0 00-1.473.842l1.694 2.965-1.688 2.848a.849.849 0 001.46.864l1.94-3.272a.849.849 0 00.007-.854l-1.94-3.393zm5.446 6.24a.849.849 0 000 1.695h4.848a.849.849 0 000-1.696h-4.848z"})})}function a({size:l=16,className:c=""}){return o.jsx("svg",{width:l,height:l,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:c,children:o.jsx("path",{d:"M22.106 5.68L12.5.135a.998.998 0 00-.998 0L1.893 5.68a.84.84 0 00-.419.726v11.186c0 .3.16.577.42.727l9.607 5.547a.999.999 0 00.998 0l9.608-5.547a.84.84 0 00.42-.727V6.407a.84.84 0 00-.42-.726zm-.603 1.176L12.228 22.92c-.063.108-.228.064-.228-.061V12.34a.59.59 0 00-.295-.51l-9.11-5.26c-.107-.062-.063-.228.062-.228h18.55c.264 0 .428.286.296.514z"})})}function v({size:l=16,className:c=""}){return o.jsx("svg",{width:l,height:l,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:c,children:o.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z"})})}function u({size:l=16,className:c=""}){return o.jsx("svg",{width:l,height:l,viewBox:"0 -1 22 28",fill:"currentColor",fillRule:"evenodd",className:c,children:o.jsx("path",{d:"M4.125 20.149c-2.69 5.959 3.036 7.453 7.26 3.966 1.24 3.91 5.898.993 7.569-2.036 3.682-6.678 2.195-13.49 1.813-14.895-2.617-9.582-15.699-9.592-17.95.049-.526 1.687-.535 3.606-.833 5.598-.15 1.005-.256 1.646-.645 2.703-.223.607-.53 1.147-1.014 2.056-.75 1.412-.434 4.138 3.434 2.724v.001ZM11.895 11.332c-1.073 0-1.234-1.283-1.234-2.048 0-.69.124-1.239.358-1.586a1 1 0 0 1 .876-.462c.375 0 .697.158.924.47.259.354.395.9.395 1.578 0 1.283-.493 2.048-1.319 2.048Zm4.416 0c-1.073 0-1.234-1.283-1.234-2.048 0-.69.124-1.239.358-1.586a1 1 0 0 1 .876-.462c.375 0 .697.158.924.47.259.354.396.9.396 1.578 0 1.283-.494 2.048-1.32 2.048Z"})})}function s({size:l=16,className:c=""}){return o.jsx("svg",{width:l,height:l,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:c,children:o.jsx("path",{d:"M16 6H8v12h8V6zm4 16H4V2h16v20z"})})}function g({size:l=16,className:c=""}){return o.jsxs("svg",{width:l,height:l,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:c,children:[o.jsx("path",{d:"M21.846 0a1.923 1.923 0 110 3.846H20.15a.226.226 0 01-.227-.226V1.923C19.923.861 20.784 0 21.846 0z"}),o.jsx("path",{d:"M11.065 11.199l7.257-7.2c.137-.136.06-.41-.116-.41H14.3a.164.164 0 00-.117.051l-7.82 7.756c-.122.12-.302.013-.302-.179V3.82c0-.127-.083-.23-.185-.23H3.186c-.103 0-.186.103-.186.23V19.77c0 .128.083.23.186.23h2.69c.103 0 .186-.102.186-.23v-3.25c0-.069.025-.135.069-.178l2.424-2.406a.158.158 0 01.205-.023l6.484 4.772a7.677 7.677 0 003.453 1.283c.108.012.2-.095.2-.23v-3.06c0-.117-.07-.212-.164-.227a5.028 5.028 0 01-2.027-.807l-5.613-4.064c-.117-.078-.132-.279-.028-.381z"})]})}function x({size:l=16,className:c=""}){return o.jsx("svg",{width:l,height:l,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:c,children:o.jsx("path",{d:"M19.245 5.364c1.322 1.36 1.877 3.216 2.11 5.817.622 0 1.2.135 1.592.654l.73.964c.21.278.323.61.323.955v2.62c0 .339-.173.669-.453.868C20.239 19.602 16.157 21.5 12 21.5c-4.6 0-9.205-2.583-11.547-4.258-.28-.2-.452-.53-.453-.868v-2.62c0-.345.113-.679.321-.956l.73-.963c.392-.517.974-.654 1.593-.654l.029-.297c.25-2.446.81-4.213 2.082-5.52 2.461-2.54 5.71-2.851 7.146-2.864h.198c1.436.013 4.685.323 7.146 2.864zm-7.244 4.328c-.284 0-.613.016-.962.05-.123.447-.305.85-.57 1.108-1.05 1.023-2.316 1.18-2.994 1.18-.638 0-1.306-.13-1.851-.464-.516.165-1.012.403-1.044.996a65.882 65.882 0 00-.063 2.884l-.002.48c-.002.563-.005 1.126-.013 1.69.002.326.204.63.51.765 2.482 1.102 4.83 1.657 6.99 1.657 2.156 0 4.504-.555 6.985-1.657a.854.854 0 00.51-.766c.03-1.682.006-3.372-.076-5.053-.031-.596-.528-.83-1.046-.996-.546.333-1.212.464-1.85.464-.677 0-1.942-.157-2.993-1.18-.266-.258-.447-.661-.57-1.108-.32-.032-.64-.049-.96-.05zm-2.525 4.013c.539 0 .976.426.976.95v1.753c0 .525-.437.95-.976.95a.964.964 0 01-.976-.95v-1.752c0-.525.437-.951.976-.951zm5 0c.539 0 .976.426.976.95v1.753c0 .525-.437.95-.976.95a.964.964 0 01-.976-.95v-1.752c0-.525.437-.951.976-.951zM7.635 5.087c-1.05.102-1.935.438-2.385.906-.975 1.037-.765 3.668-.21 4.224.405.394 1.17.657 1.995.657h.09c.649-.013 1.785-.176 2.73-1.11.435-.41.705-1.433.675-2.47-.03-.834-.27-1.52-.63-1.813-.39-.336-1.275-.482-2.265-.394zm6.465.394c-.36.292-.6.98-.63 1.813-.03 1.037.24 2.06.675 2.47.968.957 2.136 1.104 2.776 1.11h.044c.825 0 1.59-.263 1.995-.657.555-.556.765-3.187-.21-4.224-.45-.468-1.335-.804-2.385-.906-.99-.088-1.875.058-2.265.394zM12 7.615c-.24 0-.525.015-.84.044.03.16.045.336.06.526l-.001.159a2.94 2.94 0 01-.014.25c.225-.022.425-.027.612-.028h.366c.187 0 .387.006.612.028-.015-.146-.015-.277-.015-.409.015-.19.03-.365.06-.526a9.29 9.29 0 00-.84-.044z"})})}function f({size:l=16,className:c=""}){return o.jsx("svg",{width:l,height:l,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",className:c,children:o.jsx("path",{d:"M7 2h10a5 5 0 015 5v10a5 5 0 01-5 5H7a5 5 0 01-5-5V7a5 5 0 015-5zm0 4.5v11h2.35v-4.55h5.3V17.5H17v-11h-2.35v4.1h-5.3V6.5H7z"})})}function C({size:l=16,className:c=""}){return o.jsx("svg",{width:l,height:l,viewBox:"0 0 16 16",fill:"currentColor",className:c,children:o.jsx("path",{d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8z"})})}const j={CLAUDE:i,CODEX:d,COPILOT:x,CURSOR:a,GEMINI:v,GITHUB:C,HERMES:f,KIMI:g,KIRO:u,OPENCODE:s},I={ANTIGRAVITY:"/brand-logos/antigravity.svg",CLAUDE:"/brand-logos/claude-code.svg",CODEX:"/brand-logos/codex.svg",GEMINI:"/brand-logos/gemini.svg",HERMES:"/brand-logos/hermes.svg",OPENCLAW:"/brand-logos/openclaw.svg",OPENCODE:"/brand-logos/opencode.svg"};function p({provider:l,size:c=16,color:h,className:n=""}){const e=l?.toUpperCase?.()||"",r=I[e];if(r)return o.jsx("img",{src:r,alt:"",width:c,height:c,className:n,style:{width:c,height:c,objectFit:"contain"},"aria-hidden":!0});const t=j[e];return t?o.jsx(t,{size:c,className:n}):o.jsx("div",{className:"rounded-full shrink-0",style:{width:c*.5,height:c*.5,backgroundColor:h}})}export{p as P};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as l,b as Y,f as J,al as G,D as n,e as S,H as P,a7 as x,B as s,O as Q,ab as X,am as ee,ac as te,ad as ne,ae as A,an as ae,ao as ie,N as oe,P as se,C as re,T as le,ap as ce,aq as ue,ar as D,as as de,at as ge,au as he}from"./main-Dirgz7qK.js";import{L as be,a as L,u as me}from"./use-limits-display-prefs-LMbFljwt.js";import{S as v,T as k,a as f,b as E,u as _}from"./use-native-settings-B9dgqLeX.js";import{R as pe}from"./refresh-cw-oESlYWjZ.js";import{D as fe}from"./download-Cs4or3vN.js";import"./Card-DmEuggKt.js";const ye=e=>!e.isLayoutDirty&&e.willUpdate(!1);function O(){const e=new Set,t=new WeakMap,a=()=>e.forEach(ye);return{add:i=>{e.add(i),t.set(i,i.addEventListener("willUpdate",a))},remove:i=>{e.delete(i);const o=t.get(i);o&&(o(),t.delete(i)),a()},dirty:a}}const xe=l.createContext(null);function ve(){const e=l.useRef(!1);return Y(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function ke(){const e=ve(),[t,a]=l.useState(0),i=l.useCallback(()=>{e.current&&a(t+1)},[t]);return[l.useCallback(()=>J.postRender(i),[i]),t]}const T=e=>e===!0,je=e=>T(e===!0)||e==="id",Ne=({children:e,id:t,inherit:a=!0})=>{const i=l.useContext(G),o=l.useContext(xe),[r,c]=ke(),d=l.useRef(null),g=i.id||o;d.current===null&&(je(a)&&g&&(t=t?g+"-"+t:g),d.current={id:t,group:T(a)&&i.group||O()});const h=l.useMemo(()=>({...d.current,forceRender:r}),[c]);return n.jsx(G.Provider,{value:h,children:e})};const Se=[["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"}]],we=S("grip-vertical",Se);const Ce=[["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"}]],I=S("languages",Ce);const Ge=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],Le=S("log-out",Ge);const Ee=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Oe=S("pencil",Ee),Ie=new Set(["cursor","kiro","copilot"]);function Pe({checked:e,onChange:t,ariaLabel:a}){return n.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":a,onClick:t,className:x("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:n.jsx("span",{className:x("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",e?"translate-x-[18px]":"translate-x-[3px]")})})}function Ae({prefs:e}){const{order:t,visibility:a,toggle:i,moveToward:o}=e,[r,c]=l.useState(null),[d,g]=l.useState(null),h=u=>b=>{c(u),b.dataTransfer.effectAllowed="move",b.dataTransfer.setData("text/plain",u)},m=u=>b=>{b.preventDefault(),b.dataTransfer.dropEffect="move",r&&r!==u&&d!==u&&(g(u),o(r,u))},p=()=>{c(null),g(null)},y=u=>{u.preventDefault(),c(null),g(null)};return n.jsx(Ne,{children:n.jsx("div",{className:"flex flex-col",children:t.map(u=>{const b=a[u]!==!1,j=r===u;return n.jsxs(P.div,{layout:!0,transition:{duration:.28,ease:[.22,1,.36,1]},draggable:!0,onDragStart:h(u),onDragOver:m(u),onDragEnd:p,onDrop:y,className:x("flex items-center gap-3 py-2 rounded-md","hover:bg-oai-gray-100/60 dark:hover:bg-oai-gray-800/60",j&&"opacity-40"),style:{cursor:j?"grabbing":"grab"},children:[n.jsx(we,{className:"h-4 w-4 shrink-0 text-oai-gray-400 dark:text-oai-gray-500",strokeWidth:1.75,"aria-hidden":!0}),n.jsx("img",{src:be[u],alt:"",width:18,height:18,className:x("h-[18px] w-[18px] shrink-0 pointer-events-none",Ie.has(u)&&"dark:invert"),draggable:!1}),n.jsx("span",{className:"flex-1 text-sm text-oai-gray-900 dark:text-oai-gray-200 select-none",children:L[u]}),n.jsx("div",{onMouseDown:N=>N.stopPropagation(),draggable:!1,children:n.jsx(Pe,{checked:b,onChange:()=>i(u),ariaLabel:`${s("limits.settings.toggle_visible")}: ${L[u]}`})})]},u)})})})}function De(e){if(!e||typeof e!="object")return"";const t=e.user_metadata&&typeof e.user_metadata=="object"?e.user_metadata:{},a=e.profile&&typeof e.profile=="object"?e.profile:{},i=t.full_name||t.name||a.name||t.user_name||t.preferred_username;return typeof i=="string"&&i.trim()?i.trim():typeof e.email=="string"&&e.email.includes("@")?e.email.split("@")[0].trim()||e.email.trim():typeof e.email=="string"?e.email.trim():""}function _e(e){return!e||typeof e!="object"?"":typeof e.email=="string"?e.email.trim():""}function Te(e){const t=typeof e=="string"?e.trim():"";if(!t)return null;const a=t.match(/^@?([A-Za-z0-9][A-Za-z0-9-]{0,38})$/),i=t.match(/^https:\/\/github\.com\/([A-Za-z0-9][A-Za-z0-9-]{0,38})\/?$/i),o=a?.[1]||i?.[1];return o?`https://github.com/${o}`:null}function w(e,t){console.warn(`[tokentracker] settings ${e}:`,t)}function Me(e,t,a){const[i,o]=l.useState(()=>X()),r=t&&a&&ee(),c=l.useCallback(async()=>{const d=!i;if(te(d),o(d),!!d)try{await ne(()=>e())}catch(g){w("cloud sync",g)}},[i,e]);return{cloudSyncOn:i,handleCloudSyncToggle:c,showLocalCloudSync:r}}function Ue(e){const[t,a]=l.useState(!1),[i,o]=l.useState(!1),[r,c]=l.useState(!1),[d,g]=l.useState(!1),[h,m]=l.useState(null),[p,y]=l.useState(!1),[u,b]=l.useState(""),[j,N]=l.useState(!1),[B,C]=l.useState(""),[H,F]=l.useState(""),[z,$]=l.useState(!1),[V,Z]=l.useState(null),W=l.useMemo(()=>De(e),[e]),K=l.useMemo(()=>_e(e),[e]),q=l.useMemo(()=>({setAnonymousOn:o,setCustomDisplayName:m,setGithubUrl:C,setProfileLoading:c,setPublicProfileOn:a,setShowGithubOn:N}),[]);return{anonymousOn:i,customDisplayName:h,displayName:W,editingGithub:z,editingName:p,email:K,githubError:V,githubInput:H,githubUrl:B,loadSetters:q,nameInput:u,profileLoading:r,profileSaving:d,publicProfileOn:t,setAnonymousOn:o,setCustomDisplayName:m,setEditingGithub:$,setEditingName:y,setGithubError:Z,setGithubInput:F,setGithubUrl:C,setNameInput:b,setProfileLoading:c,setProfileSaving:g,setPublicProfileOn:a,setShowGithubOn:N,showGithubOn:j}}function Re(e,t,a){l.useEffect(()=>{if(!t)return;let i=!0;return a.setProfileLoading(!0),(async()=>{try{const o=await A({getAccessToken:e});if(!i||!o)return;const r=await ae({accessToken:o});if(!i)return;a.setPublicProfileOn(!!r?.enabled),a.setAnonymousOn(!!r?.anonymous),r?.display_name&&a.setCustomDisplayName(r.display_name),a.setShowGithubOn(!!r?.show_github_url),a.setGithubUrl(r?.github_url||"")}catch(o){w("load public profile",o)}finally{i&&a.setProfileLoading(!1)}})(),()=>{i=!1}},[e,t,a])}function Be(e,t){return l.useCallback(async(a,{label:i,onError:o,onSuccess:r}={})=>{if(t.profileSaving)return!1;t.setProfileSaving(!0);try{const c=await A({getAccessToken:e});if(!c)return!1;const d=await ie({accessToken:c,...a});return r?.(d),!0}catch(c){return o?o(c):w(i||"mutate profile",c),!1}finally{t.setProfileSaving(!1)}},[e,t])}function He(e,t){return{anonymousOn:e.anonymousOn,customDisplayName:e.customDisplayName,displayName:e.displayName,editingName:e.editingName,handleAnonymousToggle:t.handleAnonymousToggle,handleSaveName:t.handleSaveName,nameInput:e.nameInput,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingName:e.setEditingName,setNameInput:e.setNameInput,startEditingName:t.startEditingName}}function Fe(e,t){return{editingGithub:e.editingGithub,githubError:e.githubError,githubInput:e.githubInput,githubUrl:e.githubUrl,handleSaveGithub:t.handleSaveGithub,handleShowGithubToggle:t.handleShowGithubToggle,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingGithub:e.setEditingGithub,setGithubError:e.setGithubError,setGithubInput:e.setGithubInput,showGithubOn:e.showGithubOn,startEditingGithub:t.startEditingGithub}}function ze(e,t){const a=l.useCallback(async()=>{const o=!e.publicProfileOn;await t({enabled:o},{label:"toggle public profile",onSuccess:()=>e.setPublicProfileOn(o)})},[t,e]);return{handleAnonymousToggle:l.useCallback(async()=>{const o=!e.anonymousOn;await t({anonymous:o},{label:"toggle anonymous",onSuccess:()=>e.setAnonymousOn(o)})},[t,e]),handlePublicProfileToggle:a}}function $e(e,t){const a=l.useCallback(async()=>{const o=e.nameInput.trim().slice(0,50);o&&await t({display_name:o},{label:"save display name",onSuccess:()=>{e.setCustomDisplayName(o),e.setEditingName(!1)}})},[t,e]),i=l.useCallback(()=>{e.setNameInput(e.customDisplayName||e.displayName),e.setEditingName(!0)},[e]);return{handleSaveName:a,startEditingName:i}}function Ve(e,t){const a=l.useCallback(async()=>{if(!e.showGithubOn&&!e.githubUrl){e.setEditingGithub(!0),e.setGithubInput(""),e.setGithubError(null);return}const r=!e.showGithubOn;await t({show_github_url:r},{label:"toggle GitHub profile",onSuccess:()=>e.setShowGithubOn(r)})},[t,e]),i=l.useCallback(async()=>{const r=Te(e.githubInput);if(e.githubInput.trim()&&!r){e.setGithubError(s("settings.account.githubUrlInvalid"));return}e.setGithubError(null),await t({github_url:r,show_github_url:!!r},{label:"save GitHub profile",onError:c=>e.setGithubError(c?.message||s("settings.account.githubUrlInvalid")),onSuccess:c=>{e.setGithubUrl(c?.github_url||r||""),e.setShowGithubOn(!!r),e.setEditingGithub(!1)}})},[t,e]),o=l.useCallback(()=>{e.setGithubInput(e.githubUrl),e.setGithubError(null),e.setEditingGithub(!0)},[e]);return{handleSaveGithub:i,handleShowGithubToggle:a,startEditingGithub:o}}function Ze(){const e=Q(),t=Ue(e.user),a=Me(e.getAccessToken,e.enabled,e.signedIn);Re(e.getAccessToken,e.signedIn,t.loadSetters);const i=Be(e.getAccessToken,t),o=ze(t,i),r=$e(t,i),c=Ve(t,i);return{...e,...a,email:t.email,handlePublicProfileToggle:o.handlePublicProfileToggle,name:He(t,{...o,...r}),github:Fe(t,c),profileLoading:t.profileLoading,profileSaving:t.profileSaving,publicProfileOn:t.publicProfileOn}}function M({disabled:e,onCancel:t,onSave:a,saveLabel:i=s("settings.account.save")}){return n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",onClick:a,disabled:e,className:"rounded-md bg-oai-brand-500 px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-oai-brand-600 disabled:opacity-50",children:i}),n.jsx("button",{type:"button",onClick:t,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:s("settings.account.cancel")})]})}function We({nameInput:e,setEditingName:t,setNameInput:a,profileSaving:i,handleSaveName:o}){return n.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[n.jsx("input",{type:"text",value:e,onChange:r=>a(r.target.value),onKeyDown:r=>{r.key==="Enter"&&o(),r.key==="Escape"&&t(!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:s("settings.account.displayName")}),n.jsx(M,{disabled:i||!e.trim(),onCancel:()=>t(!1),onSave:o,saveLabel:i?s("settings.account.saving"):void 0})]})}function Ke({githubError:e,githubInput:t,handleSaveGithub:a,profileSaving:i,setEditingGithub:o,setGithubError:r,setGithubInput:c}){return n.jsxs("div",{className:"mt-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("input",{type:"text",value:t,onChange:d=>{c(d.target.value),e&&r(null)},onKeyDown:d=>{d.key==="Enter"&&a(),d.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:s("settings.account.githubUrlPlaceholder")}),n.jsx(M,{disabled:i,onCancel:()=>{o(!1),r(null)},onSave:a,saveLabel:i?s("settings.account.saving"):void 0})]}),e?n.jsx("div",{className:"mt-1.5 text-xs text-red-600 dark:text-red-400",children:e}):null]})}function U({disabled:e=!1,label:t,onClick:a,title:i}){return n.jsxs("button",{type:"button",onClick:a,disabled:e,title:i,className:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-40 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[n.jsx(Oe,{className:"h-3.5 w-3.5","aria-hidden":!0}),t]})}function R({actions:e,editing:t,editor:a,hint:i,label:o}){return n.jsx("div",{className:"py-3",children:n.jsxs("div",{className:"flex items-start justify-between gap-4",children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:o}),t?a:n.jsx("div",{className:"mt-0.5 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:i})]}),t?null:e]})})}function qe({name:e}){const t=e.anonymousOn?s("settings.account.displayNameDisabledWhileAnon"):void 0;return n.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[n.jsx(U,{disabled:e.anonymousOn,label:s("settings.account.edit"),onClick:e.startEditingName,title:t}),n.jsx(k,{checked:!e.anonymousOn,onChange:e.handleAnonymousToggle,disabled:e.profileLoading||e.profileSaving,ariaLabel:s("settings.account.displayName")})]})}function Ye({name:e}){const{anonymousOn:t,customDisplayName:a,displayName:i,editingName:o,handleAnonymousToggle:r,handleSaveName:c,nameInput:d,profileLoading:g,profileSaving:h,setEditingName:m,setNameInput:p,startEditingName:y}=e,u=t?s("settings.account.displayNameAnonymousHint"):a||i;return n.jsx(R,{label:s("settings.account.displayName"),editing:o,hint:u,editor:n.jsx(We,{nameInput:d,setEditingName:m,setNameInput:p,profileSaving:h,handleSaveName:c}),actions:n.jsx(qe,{name:e})})}function Je({github:e}){const{editingGithub:t,githubError:a,githubInput:i,githubUrl:o,handleSaveGithub:r,handleShowGithubToggle:c,profileLoading:d,profileSaving:g,setEditingGithub:h,setGithubError:m,setGithubInput:p,showGithubOn:y,startEditingGithub:u}=e;return n.jsx(R,{label:s("settings.account.githubUrl"),editing:t,hint:o||s("settings.account.githubUrlHint"),editor:n.jsx(Ke,{githubError:a,githubInput:i,handleSaveGithub:r,profileSaving:g,setEditingGithub:h,setGithubError:m,setGithubInput:p}),actions:n.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[n.jsx(U,{label:s("settings.account.edit"),onClick:u}),n.jsx(k,{checked:y,onChange:c,disabled:d||g,ariaLabel:s("settings.account.githubUrl")})]})})}function Qe(){const{openLoginModal:e}=oe();return n.jsx(v,{title:s("settings.section.account"),children:n.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[n.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("settings.account.signedOutHint")}),n.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:s("settings.account.signIn")})]})})}function Xe({name:e,github:t}){return n.jsxs(n.Fragment,{children:[n.jsx(Ye,{name:e}),n.jsx(Je,{github:t})]})}function et(){const e=Ze();return e.enabled?e.signedIn?n.jsxs(v,{title:s("settings.section.account"),subtitle:e.email||e.name.customDisplayName||e.name.displayName,action:n.jsx(tt,{onSignOut:e.signOut}),children:[n.jsx(nt,{settings:e}),n.jsx(at,{checked:e.publicProfileOn,disabled:e.profileLoading||e.profileSaving,onChange:e.handlePublicProfileToggle}),n.jsx(it,{visible:e.publicProfileOn,name:e.name,github:e.github})]}):n.jsx(Qe,{}):null}function tt({onSignOut:e}){return n.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:[n.jsx(Le,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.account.signOut")]})}function nt({settings:e}){return e.showLocalCloudSync?n.jsx(f,{label:s("settings.account.cloudSync"),hint:s("settings.account.cloudSyncHint"),control:n.jsx(k,{checked:e.cloudSyncOn,onChange:e.handleCloudSyncToggle,ariaLabel:s("settings.account.cloudSync")})}):null}function at({checked:e,disabled:t,onChange:a}){return n.jsx(f,{label:s("settings.account.publicProfile"),hint:s("settings.account.publicProfileHint"),control:n.jsx(k,{checked:e,onChange:a,disabled:t,ariaLabel:s("settings.account.publicProfile")})})}function it({visible:e,name:t,github:a}){return n.jsx(se,{initial:!1,children:e?n.jsx(P.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:n.jsx(Xe,{name:t,github:a})},"public-profile-fields"):null})}function ot(){return[{value:"light",label:s("settings.appearance.theme.light"),Icon:ce},{value:"dark",label:s("settings.appearance.theme.dark"),Icon:ue},{value:"system",label:s("settings.appearance.theme.system"),Icon:D}]}function st(){return[{value:de,label:s("settings.appearance.language.system"),Icon:D},{value:ge,label:s("settings.appearance.language.english"),Icon:I},{value:he,label:s("settings.appearance.language.chinese"),Icon:I}]}function rt(){const{theme:e,setTheme:t}=re(),{locale:a,setLocale:i}=le();return n.jsxs(v,{title:s("settings.section.appearance"),children:[n.jsx(f,{label:s("settings.appearance.theme.label"),hint:s("settings.appearance.theme.hint"),control:n.jsx(E,{options:ot(),value:e,onChange:t})}),n.jsx(f,{label:s("settings.appearance.language.label"),hint:s("settings.appearance.language.hint"),control:n.jsx(E,{options:st(),value:a,onChange:i})})]})}function lt(){const{available:e,settings:t,setSetting:a,runAction:i}=_();if(!e)return null;const o=!!t?.launchAtLogin,r=t?.launchAtLoginSupported!==!1,c=t?.updateStatus||null,d=!!t?.updateBusy,g=!!t?.isSyncing;return n.jsxs(v,{title:s("settings.section.menubar"),children:[r?n.jsx(f,{label:s("settings.menubar.launchAtLogin"),hint:s("settings.menubar.launchAtLoginHint"),control:n.jsx(k,{checked:o,onChange:()=>a("launchAtLogin",!o),ariaLabel:s("settings.menubar.launchAtLogin")})}):null,n.jsx(f,{label:s("settings.menubar.syncNow"),hint:s("settings.menubar.syncNowHint"),control:n.jsxs("button",{type:"button",onClick:()=>i("syncNow"),disabled:g,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[n.jsx(pe,{className:x("h-3.5 w-3.5",g&&"animate-spin"),"aria-hidden":!0}),g?s("settings.menubar.syncing"):s("settings.menubar.syncNow")]})}),n.jsx(f,{label:s("settings.menubar.updates"),hint:c||void 0,control:n.jsxs("button",{type:"button",onClick:()=>i("checkForUpdates"),disabled:d,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:[n.jsx(fe,{className:"h-3.5 w-3.5","aria-hidden":!0}),s("settings.menubar.checkUpdates")]})})]})}function ct(){const{available:e,settings:t,runAction:a}=_();return!e||!t?.version?null:n.jsxs("div",{className:"mt-6 flex items-center justify-center gap-2 text-[11px] text-oai-gray-500 dark:text-oai-gray-500",children:[n.jsxs("span",{children:["TokenTrackerBar v",t.version]}),n.jsx("span",{"aria-hidden":!0,children:"·"}),n.jsx("button",{type:"button",onClick:()=>a("openAbout"),className:"underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300",children:"GitHub"})]})}function pt(){const e=me();return n.jsx("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:n.jsx("main",{className:"flex-1 pb-12 pt-8 sm:pb-16 sm:pt-10",children:n.jsxs("div",{className:"mx-auto max-w-3xl px-4 sm:px-6",children:[n.jsxs("div",{className:"mb-8",children:[n.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:s("settings.page.title")}),n.jsx("p",{className:"mt-2 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("settings.page.subtitle")})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsx(rt,{}),n.jsx(lt,{}),n.jsx(et,{}),n.jsx(v,{title:s("settings.section.limits"),children:n.jsx(Ae,{prefs:e})})]}),n.jsx(ct,{})]})})})}export{pt as SettingsPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{e as Qe,r as a,av as Q,aw as xe,ax as Wt,ay as At,az as at,aA as Pe,aB as Ot,aC as Ln,D as r,a6 as on,aD as Lt,aE as an,aF as ln,E as cn,F as Fe,aG as Kt,a7 as ot,aH as Vn,B as E,R as Dn}from"./main-Dirgz7qK.js";import{A as Ft,s as Re,l as it,m as He,n as $e,o as qt,p as un,q as Ue,r as _n,t as Un,v as Fn,w as Hn,x as Gt,y as $n,z as nt,c as je,C as Nt,E as Bn,F as dn,G as zn,H as Wn,I as Ke,J as fn,K as se,L as mn,M as Kn,S as qn,N as $,O as Gn,Q as Ht,R as Yn,T as Xn,U as Jn,V as Qn,W as Zn,X as er,Y as $t,Z as tr,_ as Vt,$ as nr,a0 as rr,a1 as sr,a2 as or,a3 as ar,a4 as ir,a5 as lr,a6 as cr,a7 as gn,a8 as ur,a9 as dr,aa as fr,ab as mr,ac as gr,ad as hn,ae as hr,af as pr,ag as Ct,u as xr,D as yr,b as br,d as wr,e as vr,f as kr,g as Rr,B as Ve,P as Sr,h as Nr,i as Cr,j as jr,k as Mr}from"./PopoverPopup-RgvO6hnU.js";import{C as Ir}from"./Card-DmEuggKt.js";import{P as yt}from"./ProviderIcon-C4FxGWlI.js";import{R as Tr}from"./refresh-cw-oESlYWjZ.js";import{C as pn}from"./chevron-down-BS4d25ie.js";import{D as Er}from"./download-Cs4or3vN.js";const Pr=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Xe=Qe("check",Pr);const Ar=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],Or=Qe("external-link",Ar);const Lr=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Be=Qe("loader-circle",Lr);const Vr=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],xn=Qe("plus",Vr);const Dr=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Yt=Qe("search",Dr);const _r=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],yn=Qe("trash-2",_r);function Ur(e){const t=a.useRef(!0);t.current&&(t.current=!1,e())}function Xt({controlled:e,default:t,name:n,state:o="value"}){const{current:d}=a.useRef(e!==void 0),[s,l]=a.useState(t),c=d?e:s,x=a.useCallback(p=>{d||l(p)},[]);return[c,x]}function mt(e,t,n){return Math.floor(e/t)!==n}function rt(e,t){return t<0||t>=e.current.length}function jt(e,t){return we(e,{disabledIndices:t})}function Jt(e,t){return we(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function we(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:o,amount:d=1}={}){let s=t;do s+=n?-d:d;while(s>=0&&s<=e.current.length-1&&st(e,s,o));return s}function Fr(e,{event:t,orientation:n,loopFocus:o,rtl:d,cols:s,disabledIndices:l,minIndex:c,maxIndex:x,prevIndex:p,stopEvent:f=!1}){let m=p;const y=[],M={};let b=!1;{let u=null,C=-1;e.current.forEach((h,w)=>{if(h==null)return;const P=h.closest('[role="row"]');P&&(b=!0),(P!==u||C===-1)&&(u=P,C+=1,y[C]=[]),y[C].push(w),M[w]=C})}const v=b&&y.length>0&&y.some(u=>u.length!==s);function T(u){if(!v||p===-1)return;const C=M[p];if(C==null)return;const h=y[C].indexOf(p);let w=u==="up"?C-1:C+1;o&&(w<0?w=y.length-1:w>=y.length&&(w=0));const P=new Set;for(;w>=0&&w<y.length&&!P.has(w);){P.add(w);const U=y[w];if(U.length===0){w=u==="up"?w-1:w+1;continue}const Z=Math.min(h,U.length-1);for(let V=Z;V>=0;V-=1){const oe=U[V];if(!st(e,oe,l))return oe}w=u==="up"?w-1:w+1,o&&(w<0?w=y.length-1:w>=y.length&&(w=0))}}if(t.key===Ft){const u=T("up");if(u!==void 0)f&&Re(t),m=u;else{if(f&&Re(t),p===-1)m=x;else if(m=we(e,{startingIndex:m,amount:s,decrement:!0,disabledIndices:l}),o&&(p-s<c||m<0)){const C=p%s,h=x%s,w=x-(h-C);h===C?m=x:m=h>C?w:w-s}rt(e,m)&&(m=p)}}if(t.key===it){const u=T("down");u!==void 0?(f&&Re(t),m=u):(f&&Re(t),p===-1?m=c:(m=we(e,{startingIndex:p,amount:s,disabledIndices:l}),o&&p+s>x&&(m=we(e,{startingIndex:p%s-s,amount:s,disabledIndices:l}))),rt(e,m)&&(m=p))}if(n==="both"){const u=qt(p/s);t.key===(d?He:$e)&&(f&&Re(t),p%s!==s-1?(m=we(e,{startingIndex:p,disabledIndices:l}),o&&mt(m,s,u)&&(m=we(e,{startingIndex:p-p%s-1,disabledIndices:l}))):o&&(m=we(e,{startingIndex:p-p%s-1,disabledIndices:l})),mt(m,s,u)&&(m=p)),t.key===(d?$e:He)&&(f&&Re(t),p%s!==0?(m=we(e,{startingIndex:p,decrement:!0,disabledIndices:l}),o&&mt(m,s,u)&&(m=we(e,{startingIndex:p+(s-p%s),decrement:!0,disabledIndices:l}))):o&&(m=we(e,{startingIndex:p+(s-p%s),decrement:!0,disabledIndices:l})),mt(m,s,u)&&(m=p));const C=qt(x/s)===u;rt(e,m)&&(o&&C?m=t.key===(d?$e:He)?x:we(e,{startingIndex:p-p%s-1,disabledIndices:l}):m=p)}return m}function Hr(e,t,n){const o=[];let d=0;return e.forEach(({width:s,height:l},c)=>{let x=!1;for(n&&(d=0);!x;){const p=[];for(let f=0;f<s;f+=1)for(let m=0;m<l;m+=1)p.push(d+f+m*t);d%t+s<=t&&p.every(f=>o[f]==null)?(p.forEach(f=>{o[f]=c}),x=!0):d+=1}}),[...o]}function $r(e,t,n,o,d){if(e===-1)return-1;const s=n.indexOf(e),l=t[e];switch(d){case"tl":return s;case"tr":return l?s+l.width-1:s;case"bl":return l?s+(l.height-1)*o:s;case"br":return n.lastIndexOf(e);default:return-1}}function Br(e,t){return t.flatMap((n,o)=>e.includes(n)?[o]:[])}function st(e,t,n){if(typeof n=="function")return n(t);if(n)return n.includes(t);const o=e.current[t];return o?o.hasAttribute("disabled")||o.getAttribute("aria-disabled")==="true":!1}const zr="Escape";function wt(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function gt(e,t){return wt(t,e===Ft||e===it,e===He||e===$e)}function Mt(e,t,n){return wt(t,e===it,n?e===He:e===$e)||e==="Enter"||e===" "||e===""}function Wr(e,t,n){return wt(t,n?e===He:e===$e,e===it)}function Kr(e,t,n,o){const d=n?e===$e:e===He,s=e===Ft;return t==="both"||t==="horizontal"&&o&&o>1?e===zr:wt(t,d,s)}function qr(e,t){const n="rootStore"in e?e.rootStore:e,o=n.useState("open"),d=n.useState("floatingElement"),s=n.useState("domReferenceElement"),l=n.context.dataRef,{listRef:c,activeIndex:x,onNavigate:p=()=>{},enabled:f=!0,selectedIndex:m=null,allowEscape:y=!1,loopFocus:M=!1,nested:b=!1,rtl:v=!1,virtual:T=!1,focusItemOnOpen:u="auto",focusItemOnHover:C=!0,openOnArrowKeyDown:h=!0,disabledIndices:w=void 0,orientation:P="vertical",parentOrientation:U,cols:Z=1,scrollItemIntoView:V=!0,itemSizes:oe,dense:me=!1,id:F,resetOnPointerLeave:G=!0,externalTree:q}=t,J=un(d),re=Ue(J),K=_n(),ee=Un(q);Q(()=>{l.current.orientation=P},[l,P]);const S=Fn(s),B=a.useRef(u),R=a.useRef(m??-1),j=a.useRef(null),le=a.useRef(!0),O=xe(g=>{p(R.current===-1?null:R.current,g)}),he=a.useRef(O),ae=a.useRef(!!d),A=a.useRef(o),z=a.useRef(!1),ue=a.useRef(!1),ve=Ue(w),L=Ue(o),ce=Ue(V),te=Ue(m),pe=Ue(G),ye=xe(()=>{function g(ie){T?ee?.events.emit("virtualfocus",ie):Hn(ie,{sync:z.current,preventScroll:!0})}const H=c.current[R.current],N=ue.current;H&&g(H),(z.current?ie=>ie():requestAnimationFrame)(()=>{const ie=c.current[R.current]||H;if(!ie)return;H||g(ie);const de=ce.current;de&&X&&(N||!le.current)&&ie.scrollIntoView?.(typeof de=="boolean"?{block:"nearest",inline:"nearest"}:de)})});Q(()=>{f&&(o&&d?(R.current=m??-1,B.current&&m!=null&&(ue.current=!0,O())):ae.current&&(R.current=-1,he.current()))},[f,o,d,m,O]),Q(()=>{if(f){if(!o){z.current=!1;return}if(d)if(x==null){if(z.current=!1,te.current!=null)return;if(ae.current&&(R.current=-1,ye()),(!A.current||!ae.current)&&B.current&&(j.current!=null||B.current===!0&&j.current==null)){let g=0;const H=()=>{c.current[0]==null?(g<2&&(g?requestAnimationFrame:queueMicrotask)(H),g+=1):(R.current=j.current==null||Mt(j.current,P,v)||b?jt(c):Jt(c),j.current=null,O())};H()}}else rt(c,x)||(R.current=x,ye(),ue.current=!1)}},[f,o,d,x,te,b,c,P,v,O,ye,ve]),Q(()=>{if(!f||d||!ee||T||!ae.current)return;const g=ee.nodesRef.current,H=g.find(ie=>ie.id===K)?.context?.elements.floating,N=Gt($n(d)),ne=g.some(ie=>ie.context&&nt(ie.context.elements.floating,N));H&&!ne&&le.current&&H.focus({preventScroll:!0})},[f,d,ee,K,T]),Q(()=>{he.current=O,A.current=o,ae.current=!!d}),Q(()=>{o||(j.current=null,B.current=u)},[o,u]);const ge=x!=null,X=a.useMemo(()=>{function g(N){if(!L.current)return;const ne=c.current.indexOf(N.currentTarget);ne!==-1&&R.current!==ne&&(R.current=ne,O(N))}return{onFocus(N){z.current=!0,g(N)},onClick:({currentTarget:N})=>N.focus({preventScroll:!0}),onMouseMove(N){z.current=!0,ue.current=!1,C&&g(N)},onPointerLeave(N){if(!L.current||!le.current||N.pointerType==="touch")return;z.current=!0;const ne=N.relatedTarget;!C||c.current.includes(ne)||pe.current&&(R.current=-1,O(N),T||re.current?.focus({preventScroll:!0}))}}},[L,re,C,c,O,pe,T]),i=a.useCallback(()=>U??ee?.nodesRef.current.find(g=>g.id===K)?.context?.dataRef?.current.orientation,[K,ee,U]),k=xe(g=>{if(le.current=!1,z.current=!0,g.which===229||!L.current&&g.currentTarget===re.current)return;if(b&&Kr(g.key,P,v,Z)){gt(g.key,i())||Re(g),n.setOpen(!1,je(Nt,g.nativeEvent)),Wt(s)&&(T?ee?.events.emit("virtualfocus",s):s.focus());return}const H=R.current,N=jt(c,w),ne=Jt(c,w);if(S||(g.key==="Home"&&(Re(g),R.current=N,O(g)),g.key==="End"&&(Re(g),R.current=ne,O(g))),Z>1){const ie=oe||Array.from({length:c.current.length},()=>({width:1,height:1})),de=Hr(ie,Z,me),be=de.findIndex(Se=>Se!=null&&!st(c,Se,w)),ke=de.reduce((Se,Me,_e)=>Me!=null&&!st(c,Me,w)?_e:Se,-1),De=de[Fr({current:de.map(Se=>Se!=null?c.current[Se]:null)},{event:g,orientation:P,loopFocus:M,rtl:v,cols:Z,disabledIndices:Br([...(typeof w!="function"?w:null)||c.current.map((Se,Me)=>st(c,Me,w)?Me:void 0),void 0],de),minIndex:be,maxIndex:ke,prevIndex:$r(R.current>ne?N:R.current,ie,de,Z,g.key===it?"bl":g.key===(v?He:$e)?"tr":"tl"),stopEvent:!0})];if(De!=null&&(R.current=De,O(g)),P==="both")return}if(gt(g.key,P)){if(Re(g),o&&!T&&Gt(g.currentTarget.ownerDocument)===g.currentTarget){R.current=Mt(g.key,P,v)?N:ne,O(g);return}Mt(g.key,P,v)?M?H>=ne?y&&H!==c.current.length?R.current=-1:(z.current=!1,R.current=N):R.current=we(c,{startingIndex:H,disabledIndices:w}):R.current=Math.min(ne,we(c,{startingIndex:H,disabledIndices:w})):M?H<=N?y&&H!==-1?R.current=c.current.length:(z.current=!1,R.current=ne):R.current=we(c,{startingIndex:H,decrement:!0,disabledIndices:w}):R.current=Math.max(N,we(c,{startingIndex:H,decrement:!0,disabledIndices:w})),rt(c,R.current)&&(R.current=-1),O(g)}}),I=a.useMemo(()=>T&&o&&ge&&{"aria-activedescendant":`${F}-${x}`},[T,o,ge,F,x]),D=a.useMemo(()=>({"aria-orientation":P==="both"?void 0:P,...S?{}:I,onKeyDown(g){if(g.key==="Tab"&&g.shiftKey&&o&&!T){const H=Bn(g.nativeEvent);if(H&&!nt(re.current,H))return;Re(g),n.setOpen(!1,je(dn,g.nativeEvent)),Wt(s)&&s.focus();return}k(g)},onPointerMove(){le.current=!0}}),[I,k,re,P,S,n,o,T,s]),Y=a.useMemo(()=>{function g(N){u==="auto"&&zn(N.nativeEvent)&&(B.current=!T)}function H(N){B.current=u,u==="auto"&&Wn(N.nativeEvent)&&(B.current=!0)}return{onKeyDown(N){const ne=n.select("open");le.current=!1;const ie=N.key.startsWith("Arrow"),de=Wr(N.key,i(),v),be=gt(N.key,P),ke=(b?de:be)||N.key==="Enter"||N.key.trim()==="";if(T&&ne)return k(N);if(!(!ne&&!h&&ie)){if(ke){const De=gt(N.key,i());j.current=b&&De?null:N.key}if(b){de&&(Re(N),ne?(R.current=jt(c,ve.current),O(N)):n.setOpen(!0,je(Nt,N.nativeEvent,N.currentTarget)));return}be&&(te.current!=null&&(R.current=te.current),Re(N),!ne&&h?n.setOpen(!0,je(Nt,N.nativeEvent,N.currentTarget)):k(N),ne&&O(N))}},onFocus(N){n.select("open")&&!T&&(R.current=-1,O(N))},onPointerDown:H,onPointerEnter:H,onMouseDown:g,onClick:g}},[k,ve,u,c,b,O,n,h,P,i,v,te,T]),Ne=a.useMemo(()=>({...I,...Y}),[I,Y]);return a.useMemo(()=>f?{reference:Ne,floating:D,item:X,trigger:Y}:{},[f,Ne,D,Y,X])}function Gr(e,t){const n="rootStore"in e?e.rootStore:e,o=n.useState("open"),d=n.context.dataRef,{listRef:s,activeIndex:l,onMatch:c,onTypingChange:x,enabled:p=!0,findMatch:f=null,resetMs:m=750,ignoreKeys:y=At,selectedIndex:M=null}=t,b=Ke(),v=a.useRef(""),T=a.useRef(M??l??-1),u=a.useRef(null);Q(()=>{o&&(b.clear(),u.current=null,v.current="")},[o,b]),Q(()=>{o&&v.current===""&&(T.current=M??l??-1)},[o,M,l]);const C=xe(U=>{U?d.current.typing||(d.current.typing=U,x?.(U)):d.current.typing&&(d.current.typing=U,x?.(U))}),h=xe(U=>{function Z(G,q,J){const re=f?f(q,J):q.find(K=>K?.toLocaleLowerCase().indexOf(J.toLocaleLowerCase())===0);return re?G.indexOf(re):-1}const V=s.current;if(v.current.length>0&&v.current[0]!==" "&&(Z(V,V,v.current)===-1?C(!1):U.key===" "&&Re(U)),V==null||y.includes(U.key)||U.key.length!==1||U.ctrlKey||U.metaKey||U.altKey)return;o&&U.key!==" "&&(Re(U),C(!0)),V.every(G=>G?G[0]?.toLocaleLowerCase()!==G[1]?.toLocaleLowerCase():!0)&&v.current===U.key&&(v.current="",T.current=u.current),v.current+=U.key,b.start(m,()=>{v.current="",T.current=u.current,C(!1)});const me=T.current,F=Z(V,[...V.slice((me||0)+1),...V.slice(0,(me||0)+1)],v.current);F!==-1?(c?.(F),u.current=F):U.key!==" "&&(v.current="",C(!1))}),w=a.useMemo(()=>({onKeyDown:h}),[h]),P=a.useMemo(()=>({onKeyDown:h,onKeyUp(U){U.key===" "&&C(!1)}}),[h,C]);return a.useMemo(()=>p?{reference:w,floating:P}:{},[p,w,P])}const bn=a.createContext(null),wn=a.createContext(null);function ze(){const e=a.useContext(bn);if(e===null)throw new Error(at(60));return e}function vn(){const e=a.useContext(wn);if(e===null)throw new Error(at(61));return e}let Qt=(function(e){return e.disabled="data-disabled",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const Yr={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Xr={valid(e){return e===null?null:e?{[Qt.valid]:""}:{[Qt.invalid]:""}}},Jr=a.createContext({invalid:void 0,name:void 0,validityData:{state:Yr,errors:[],error:"",value:"",initialValue:null},setValidityData:Pe,disabled:void 0,touched:!1,setTouched:Pe,dirty:!1,setDirty:Pe,filled:!1,setFilled:Pe,focused:!1,setFocused:Pe,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:{disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},markedDirtyRef:{current:!1},validation:{getValidationProps:(e=Ot)=>e,getInputValidationProps:(e=Ot)=>e,inputRef:{current:null},commit:async()=>{}}});function Bt(e=!0){const t=a.useContext(Jr);if(t.setValidityData===Pe&&!e)throw new Error(at(28));return t}const Qr=a.createContext({controlId:void 0,setControlId:Pe,labelId:void 0,setLabelId:Pe,messageIds:[],setMessageIds:Pe,getDescriptionProps:e=>e});function kn(){return a.useContext(Qr)}function Rn(e={}){const{id:t,implicit:n=!1,controlRef:o}=e,{controlId:d,setControlId:s}=kn(),l=fn(t);return Q(()=>{if(!(!n&&!t||s===Pe)){if(n){const c=o?.current;Ln(c)&&c.closest("label")!=null?s(t??null):s(d??l)}else t&&s(t);return()=>{t&&s(void 0)}}},[t,o,d,s,n,l]),d??l}const Zr=(e,t)=>Object.is(e,t);function Je(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function It(e,t,n){return!e||e.length===0?!1:e.some(o=>o===void 0?!1:Je(o,t,n))}function Dt(e,t,n){return!e||e.length===0?-1:e.findIndex(o=>o===void 0?!1:Je(o,t,n))}function es(e,t,n){return e.filter(o=>!Je(o,t,n))}function _t(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function Sn(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function ts(e){if(!Array.isArray(e))return e!=null&&!("null"in e);if(Sn(e)){for(const t of e)for(const n of t.items)if(n&&n.value==null&&n.label!=null)return!0;return!1}for(const t of e)if(t&&t.value==null&&t.label!=null)return!0;return!1}function ns(e,t){if(t&&e!=null)return t(e)??"";if(e&&typeof e=="object"){if("label"in e&&e.label!=null)return String(e.label);if("value"in e)return String(e.value)}return _t(e)}function Ye(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?_t(e.value):_t(e)}function Nn(e,t,n){function o(){return ns(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??o();if(Array.isArray(t)){const d=Sn(t)?t.flatMap(s=>s.items):t;if(e==null||typeof e!="object"){const s=d.find(l=>l.value===e);return s&&s.label!=null?s.label:o()}if("value"in e){const s=d.find(l=>l&&l.value===e.value);if(s&&s.label!=null)return s.label}}return o()}function rs(e,t,n){return e.reduce((o,d,s)=>(s>0&&o.push(", "),o.push(r.jsx(a.Fragment,{children:Nn(d,t,n)},s)),o),[])}const _={id:se(e=>e.id),modal:se(e=>e.modal),multiple:se(e=>e.multiple),items:se(e=>e.items),itemToStringLabel:se(e=>e.itemToStringLabel),itemToStringValue:se(e=>e.itemToStringValue),isItemEqualToValue:se(e=>e.isItemEqualToValue),value:se(e=>e.value),hasSelectedValue:se(e=>{const{value:t,multiple:n,itemToStringValue:o}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:Ye(t,o)!==""}),hasNullItemLabel:se((e,t)=>t?ts(e.items):!1),open:se(e=>e.open),mounted:se(e=>e.mounted),forceMount:se(e=>e.forceMount),transitionStatus:se(e=>e.transitionStatus),openMethod:se(e=>e.openMethod),activeIndex:se(e=>e.activeIndex),selectedIndex:se(e=>e.selectedIndex),isActive:se((e,t)=>e.activeIndex===t),isSelected:se((e,t,n)=>{const o=e.isItemEqualToValue,d=e.value;return e.multiple?Array.isArray(d)&&d.some(s=>Je(s,n,o)):e.selectedIndex===t&&e.selectedIndex!==null?!0:Je(d,n,o)}),isSelectedByFocus:se((e,t)=>e.selectedIndex===t),popupProps:se(e=>e.popupProps),triggerProps:se(e=>e.triggerProps),triggerElement:se(e=>e.triggerElement),positionerElement:se(e=>e.positionerElement),listElement:se(e=>e.listElement),scrollUpArrowVisible:se(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:se(e=>e.scrollDownArrowVisible),hasScrollArrows:se(e=>e.hasScrollArrows)},ss=a.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Pe,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function Cn(){return a.useContext(ss)}function os(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}function as(e){const{enabled:t=!0,value:n,id:o,name:d,controlRef:s,commit:l}=e,{formRef:c}=Cn(),{invalid:x,markedDirtyRef:p,validityData:f,setValidityData:m}=Bt(),y=xe(e.getValue);Q(()=>{if(!t)return;let M=n;M===void 0&&(M=y()),f.initialValue===null&&M!==null&&m(b=>({...b,initialValue:M}))},[t,m,n,f.initialValue,y]),Q(()=>{!t||!o||c.current.fields.set(o,{getValue:y,name:d,controlRef:s,validityData:os(f,x),validate(M=!0){let b=n;b===void 0&&(b=y()),p.current=!0,M?on.flushSync(()=>l(b)):l(b)}})},[l,s,t,c,y,o,x,p,d,f,n]),Q(()=>{const M=c.current.fields;return()=>{o&&M.delete(o)}},[c,o])}function is(e,t){const n=a.useRef(e),o=xe(t);Q(()=>{n.current!==e&&o(n.current)},[e,o]),Q(()=>{n.current=e},[e])}function ls(e){const{id:t,value:n,defaultValue:o=null,onValueChange:d,open:s,defaultOpen:l=!1,onOpenChange:c,name:x,disabled:p=!1,readOnly:f=!1,required:m=!1,modal:y=!0,actionsRef:M,inputRef:b,onOpenChangeComplete:v,items:T,multiple:u=!1,itemToStringLabel:C,itemToStringValue:h,isItemEqualToValue:w=Zr,highlightItemOnHover:P=!0,children:U}=e,{clearErrors:Z}=Cn(),{setDirty:V,setTouched:oe,setFocused:me,shouldValidateOnChange:F,validityData:G,setFilled:q,name:J,disabled:re,validation:K,validationMode:ee}=Bt(),S=Rn({id:t}),B=re||p,R=J??x,[j,le]=Xt({controlled:n,default:u?o??At:o,name:"Select",state:"value"}),[O,he]=Xt({controlled:s,default:l,name:"Select",state:"open"}),ae=a.useRef([]),A=a.useRef([]),z=a.useRef(null),ue=a.useRef(null),ve=a.useRef(0),L=a.useRef(null),ce=a.useRef([]),te=a.useRef(!1),pe=a.useRef(!1),ye=a.useRef(null),ge=a.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),X=a.useRef(!1),{mounted:i,setMounted:k,transitionStatus:I}=mn(O),{openMethod:D,triggerProps:Y,reset:Ne}=Kn(O),g=Lt(()=>new qn({id:S,modal:y,multiple:u,itemToStringLabel:C,itemToStringValue:h,isItemEqualToValue:w,value:j,open:O,mounted:i,transitionStatus:I,items:T,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,H=$(g,_.activeIndex),N=$(g,_.selectedIndex),ne=$(g,_.triggerElement),ie=$(g,_.positionerElement),de=a.useMemo(()=>u&&Array.isArray(j)&&j.length===0?"":Ye(j,h),[u,j,h]),be=a.useMemo(()=>u&&Array.isArray(j)?j.map(W=>Ye(W,h)):Ye(j,h),[u,j,h]),ke=Ue(g.state.triggerElement);as({id:S,commit:K.commit,value:j,controlRef:ke,name:R,getValue:()=>be});const De=a.useRef(j);Q(()=>{j!==De.current&&g.set("forceMount",!0)},[g,j]),Q(()=>{q(u?Array.isArray(j)&&j.length>0:j!=null)},[u,j,q]),Q(function(){if(O)return;const fe=ce.current;if(u){const Te=Array.isArray(j)?j:[];if(Te.length===0){g.set("selectedIndex",null);return}const Ce=Te[Te.length-1],ft=Dt(fe,Ce,w);g.set("selectedIndex",ft===-1?null:ft);return}const Ie=Dt(fe,j,w);g.set("selectedIndex",Ie===-1?null:Ie)},[u,O,j,ce,w,g]),is(j,()=>{Z(R),V(j!==G.initialValue),F()?K.commit(j):K.commit(j,!0)});const Se=xe((W,fe)=>{if(c?.(W,fe),!fe.isCanceled&&(he(W),!W&&(fe.reason===dn||fe.reason===Gn)&&(oe(!0),me(!1),ee==="onBlur"&&K.commit(j)),!W&&g.state.activeIndex!==null)){const Ie=ae.current[g.state.activeIndex];queueMicrotask(()=>{Ie?.setAttribute("tabindex","-1")})}}),Me=xe(()=>{k(!1),g.set("activeIndex",null),Ne(),v?.(!1)});Ht({enabled:!M,open:O,ref:z,onComplete(){O||Me()}}),a.useImperativeHandle(M,()=>({unmount:Me}),[Me]);const _e=xe((W,fe)=>{d?.(W,fe),!fe.isCanceled&&le(W)}),Ae=xe(()=>{const W=g.state.listElement||z.current;if(!W)return;const fe=W.scrollTop,Ie=W.scrollTop+W.clientHeight,Te=fe>1,Ce=Ie<W.scrollHeight-1;g.state.scrollUpArrowVisible!==Te&&g.set("scrollUpArrowVisible",Te),g.state.scrollDownArrowVisible!==Ce&&g.set("scrollDownArrowVisible",Ce)}),Oe=Yn({open:O,onOpenChange:Se,elements:{reference:ne,floating:ie}}),lt=Xn(Oe,{enabled:!f&&!B,event:"mousedown"}),Ze=Jn(Oe,{bubbles:!1}),Le=qr(Oe,{enabled:!f&&!B,listRef:ae,activeIndex:H,selectedIndex:N,disabledIndices:At,onNavigate(W){W===null&&!O||g.set("activeIndex",W)},focusItemOnHover:!1}),kt=Gr(Oe,{enabled:!f&&!B&&(O||!u),listRef:A,activeIndex:H,selectedIndex:N,onMatch(W){O?g.set("activeIndex",W):_e(ce.current[W],je("none"))},onTypingChange(W){te.current=W}}),{getReferenceProps:qe,getFloatingProps:Ge,getItemProps:ct}=Qn([lt,Ze,Le,kt]),et=a.useMemo(()=>an(qe(),Y,S?{id:S}:Ot),[qe,Y,S]);Ur(()=>{g.update({popupProps:Ge(),triggerProps:et})}),Q(()=>{g.update({id:S,modal:y,multiple:u,value:j,open:O,mounted:i,transitionStatus:I,popupProps:Ge(),triggerProps:et,items:T,itemToStringLabel:C,itemToStringValue:h,isItemEqualToValue:w,openMethod:D})},[g,S,y,u,j,O,i,I,Ge,et,T,C,h,w,D]);const ut=a.useMemo(()=>({store:g,name:R,required:m,disabled:B,readOnly:f,multiple:u,itemToStringLabel:C,itemToStringValue:h,highlightItemOnHover:P,setValue:_e,setOpen:Se,listRef:ae,popupRef:z,scrollHandlerRef:ue,handleScrollArrowVisibility:Ae,scrollArrowsMountedCountRef:ve,getItemProps:ct,events:Oe.context.events,valueRef:L,valuesRef:ce,labelsRef:A,typingRef:te,selectionRef:ge,selectedItemTextRef:ye,validation:K,onOpenChangeComplete:v,keyboardActiveRef:pe,alignItemWithTriggerActiveRef:X,initialValueRef:De}),[g,R,m,B,f,u,C,h,P,_e,Se,ct,Oe.context.events,K,v,Ae]),dt=ln(b,K.inputRef),Rt=u&&Array.isArray(j)&&j.length>0,St=a.useMemo(()=>!u||!Array.isArray(j)||!R?null:j.map(W=>{const fe=Ye(W,h);return r.jsx("input",{type:"hidden",name:R,value:fe},fe)}),[u,j,R,h]);return r.jsx(bn.Provider,{value:ut,children:r.jsxs(wn.Provider,{value:Oe,children:[U,r.jsx("input",{...K.getInputValidationProps({onFocus(){g.state.triggerElement?.focus({focusVisible:!0})},onChange(W){if(W.nativeEvent.defaultPrevented)return;const fe=W.target.value,Ie=je($t,W.nativeEvent);function Te(){if(u)return;const Ce=ce.current.find(ft=>Ye(ft,h).toLowerCase()===fe.toLowerCase());Ce!=null&&(V(Ce!==G.initialValue),_e(Ce,Ie),F()&&K.commit(Ce))}g.set("forceMount",!0),queueMicrotask(Te)}}),name:u?void 0:R,value:de,disabled:B,required:m&&!Rt,readOnly:f,ref:dt,style:R?Zn:er,tabIndex:-1,"aria-hidden":!0}),St]})})}function cs(e){const t=e.getBoundingClientRect(),n=window.getComputedStyle(e,"::before"),o=window.getComputedStyle(e,"::after");if(!(n.content!=="none"||o.content!=="none"))return t;const s=parseFloat(n.width)||0,l=parseFloat(n.height)||0,c=parseFloat(o.width)||0,x=parseFloat(o.height)||0,p=Math.max(t.width,s,c),f=Math.max(t.height,l,x),m=p-t.width,y=f-t.height;return{left:t.left-m/2,right:t.right+m/2,top:t.top-y/2,bottom:t.bottom+y/2}}const ht=2,us=400,Zt=200,ds={...tr,...Xr,value:()=>null},fs=a.forwardRef(function(t,n){const{render:o,className:d,id:s,disabled:l=!1,nativeButton:c=!0,...x}=t,{setTouched:p,setFocused:f,validationMode:m,state:y,disabled:M}=Bt(),{labelId:b}=kn(),{store:v,setOpen:T,selectionRef:u,validation:C,readOnly:h,required:w,alignItemWithTriggerActiveRef:P,disabled:U,keyboardActiveRef:Z}=ze(),V=M||U||l,oe=$(v,_.open),me=$(v,_.value),F=$(v,_.triggerProps),G=$(v,_.positionerElement),q=$(v,_.listElement),J=$(v,_.id),re=$(v,_.hasSelectedValue),K=!re&&oe,ee=$(v,_.hasNullItemLabel,K),S=s??J;Rn({id:S});const B=Ue(G),R=a.useRef(null),{getButtonProps:j,buttonRef:le}=cn({disabled:V,native:c}),O=xe(te=>{v.set("triggerElement",te)}),he=ln(n,R,le,O),ae=Ke(),A=Ke(),z=Ke(),ue=Ke();a.useEffect(()=>{if(oe)return!(re||ee)?z.start(us,()=>{u.current.allowUnselectedMouseUp=!0,u.current.allowSelectedMouseUp=!0}):ue.start(Zt,()=>{u.current.allowUnselectedMouseUp=!0,z.start(Zt,()=>{u.current.allowSelectedMouseUp=!0})}),()=>{z.clear(),ue.clear()};u.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},A.clear()},[oe,re,ee,u,A,z,ue]);const ve=a.useMemo(()=>q?.id??un(G)?.id,[q,G]),L=an(F,{id:S,role:"combobox","aria-expanded":oe?"true":"false","aria-haspopup":"listbox","aria-controls":oe?ve:void 0,"aria-labelledby":b,"aria-readonly":h||void 0,"aria-required":w||void 0,tabIndex:V?-1:0,ref:he,onFocus(te){f(!0),oe&&P.current&&T(!1,je($t,te.nativeEvent)),ae.start(0,()=>{v.set("forceMount",!0)})},onBlur(te){nt(G,te.relatedTarget)||(p(!0),f(!1),m==="onBlur"&&C.commit(me))},onPointerMove(){Z.current=!1},onKeyDown(){Z.current=!0},onMouseDown(te){if(oe)return;const pe=Vt(te.currentTarget);function ye(ge){if(!R.current)return;const X=ge.target;if(nt(R.current,X)||nt(B.current,X)||X===R.current)return;const i=cs(R.current);ge.clientX>=i.left-ht&&ge.clientX<=i.right+ht&&ge.clientY>=i.top-ht&&ge.clientY<=i.bottom+ht||T(!1,je(nr,ge))}A.start(0,()=>{pe.addEventListener("mouseup",ye,{once:!0})})}},C.getValidationProps,x,j);L.role="combobox";const ce=a.useMemo(()=>({...y,open:oe,disabled:V,value:me,readOnly:h,placeholder:!re}),[y,oe,V,me,h,re]);return Fe("button",t,{ref:[n,R],state:ce,stateAttributesMapping:ds,props:L})}),ms={value:()=>null},gs=a.forwardRef(function(t,n){const{className:o,render:d,children:s,placeholder:l,...c}=t,{store:x,valueRef:p}=ze(),f=$(x,_.value),m=$(x,_.items),y=$(x,_.itemToStringLabel),M=$(x,_.hasSelectedValue),b=!M&&l!=null&&s==null,v=$(x,_.hasNullItemLabel,b),T=a.useMemo(()=>({value:f,placeholder:!M}),[f,M]);let u=null;return typeof s=="function"?u=s(f):s!=null?u=s:!M&&l!=null&&!v?u=l:Array.isArray(f)?u=rs(f,m,y):u=Nn(f,m,y),Fe("span",t,{state:T,ref:[n,p],props:[{children:u},c],stateAttributesMapping:ms})}),hs=a.forwardRef(function(t,n){const{className:o,render:d,...s}=t,{store:l}=ze(),c=$(l,_.open),x=a.useMemo(()=>({open:c}),[c]);return Fe("span",t,{state:x,ref:n,props:[{"aria-hidden":!0,children:"▼"},s],stateAttributesMapping:rr})}),ps=a.createContext(void 0),xs=a.forwardRef(function(t,n){const{store:o}=ze(),d=$(o,_.mounted),s=$(o,_.forceMount);return d||s?r.jsx(ps.Provider,{value:!0,children:r.jsx(sr,{ref:n,...t})}):null}),jn=a.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function ys(){return a.useContext(jn)}function bs(e){const{children:t,elementsRef:n,labelsRef:o,onMapChange:d}=e,s=xe(d),l=a.useRef(0),c=Lt(vs).current,x=Lt(ws).current,[p,f]=a.useState(0),m=a.useRef(p),y=xe((u,C)=>{x.set(u,C??null),m.current+=1,f(m.current)}),M=xe(u=>{x.delete(u),m.current+=1,f(m.current)}),b=a.useMemo(()=>{const u=new Map;return Array.from(x.keys()).filter(h=>h.isConnected).sort(ks).forEach((h,w)=>{const P=x.get(h)??{};u.set(h,{...P,index:w})}),u},[x,p]);Q(()=>{if(typeof MutationObserver!="function"||b.size===0)return;const u=new MutationObserver(C=>{const h=new Set,w=P=>h.has(P)?h.delete(P):h.add(P);C.forEach(P=>{P.removedNodes.forEach(w),P.addedNodes.forEach(w)}),h.size===0&&(m.current+=1,f(m.current))});return b.forEach((C,h)=>{h.parentElement&&u.observe(h.parentElement,{childList:!0})}),()=>{u.disconnect()}},[b]),Q(()=>{m.current===p&&(n.current.length!==b.size&&(n.current.length=b.size),o&&o.current.length!==b.size&&(o.current.length=b.size),l.current=b.size),s(b)},[s,b,n,o,p]),Q(()=>()=>{n.current=[]},[n]),Q(()=>()=>{o&&(o.current=[])},[o]);const v=xe(u=>(c.add(u),()=>{c.delete(u)}));Q(()=>{c.forEach(u=>u(b))},[c,b]);const T=a.useMemo(()=>({register:y,unregister:M,subscribeMapChange:v,elementsRef:n,labelsRef:o,nextIndexRef:l}),[y,M,v,n,o,l]);return r.jsx(jn.Provider,{value:T,children:t})}function ws(){return new Map}function vs(){return new Set}function ks(e,t){const n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}const Mn=a.createContext(void 0);function Rs(){const e=a.useContext(Mn);if(!e)throw new Error(at(59));return e}function bt(e,t){e&&Object.assign(e.style,t)}const Ss={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},Ns={position:"fixed"},Cs=a.forwardRef(function(t,n){const{anchor:o,positionMethod:d="absolute",className:s,render:l,side:c="bottom",align:x="center",sideOffset:p=0,alignOffset:f=0,collisionBoundary:m="clipping-ancestors",collisionPadding:y,arrowPadding:M=5,sticky:b=!1,disableAnchorTracking:v,alignItemWithTrigger:T=!0,collisionAvoidance:u=or,...C}=t,{store:h,listRef:w,labelsRef:P,alignItemWithTriggerActiveRef:U,selectedItemTextRef:Z,valuesRef:V,initialValueRef:oe,popupRef:me,setValue:F}=ze(),G=vn(),q=$(h,_.open),J=$(h,_.mounted),re=$(h,_.modal),K=$(h,_.value),ee=$(h,_.openMethod),S=$(h,_.positionerElement),B=$(h,_.triggerElement),R=$(h,_.isItemEqualToValue),j=a.useRef(null),le=a.useRef(null),[O,he]=a.useState(T),ae=J&&O&&ee!=="touch";!J&&O!==T&&he(T),Q(()=>{J||(_.scrollUpArrowVisible(h.state)&&h.set("scrollUpArrowVisible",!1),_.scrollDownArrowVisible(h.state)&&h.set("scrollDownArrowVisible",!1))},[h,J]),a.useImperativeHandle(U,()=>ae),ar((ae||re)&&q&&ee!=="touch",B);const A=ir({anchor:o,floatingRootContext:G,positionMethod:d,mounted:J,side:c,sideOffset:p,align:x,alignOffset:f,arrowPadding:M,collisionBoundary:m,collisionPadding:y,sticky:b,disableAnchorTracking:v??ae,collisionAvoidance:u,keepMounted:!0}),z=ae?"none":A.side,ue=ae?Ns:A.positionerStyles,ve=a.useMemo(()=>{const X={};return q||(X.pointerEvents="none"),{role:"presentation",hidden:!J,style:{...ue,...X}}},[q,J,ue]),L=a.useMemo(()=>({open:q,side:z,align:A.align,anchorHidden:A.anchorHidden}),[q,z,A.align,A.anchorHidden]),ce=xe(X=>{h.set("positionerElement",X)}),te=Fe("div",t,{ref:[n,ce],state:L,stateAttributesMapping:gn,props:[ve,C]}),pe=a.useRef(0),ye=xe(X=>{if(X.size===0&&pe.current===0||V.current.length===0)return;const i=pe.current;if(pe.current=X.size,X.size===i)return;const k=je($t);if(i!==0&&!h.state.multiple&&K!==null&&Dt(V.current,K,R)===-1){const D=oe.current,Ne=D!=null&&It(V.current,D,R)?D:null;F(Ne,k),Ne===null&&(h.set("selectedIndex",null),Z.current=null)}if(i!==0&&h.state.multiple&&Array.isArray(K)){const I=K.filter(D=>It(V.current,D,R));(I.length!==K.length||I.some(D=>!It(K,D,R)))&&(F(I,k),I.length===0&&(h.set("selectedIndex",null),Z.current=null))}if(q&&ae){h.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const I={height:""};bt(S,I),bt(me.current,I)}}),ge=a.useMemo(()=>({...A,side:z,alignItemWithTriggerActive:ae,setControlledAlignItemWithTrigger:he,scrollUpArrowRef:j,scrollDownArrowRef:le}),[A,z,ae,he]);return r.jsx(bs,{elementsRef:w,labelsRef:P,onMapChange:ye,children:r.jsxs(Mn.Provider,{value:ge,children:[J&&re&&r.jsx(lr,{inert:cr(!q),cutout:B}),te]})})});function In(e){const t=e.currentTarget.getBoundingClientRect();return t.top+1<=e.clientY&&e.clientY<=t.bottom-1&&t.left+1<=e.clientX&&e.clientX<=t.right-1}const pt="base-ui-disable-scrollbar",en={className:pt,getElement(e){return r.jsx("style",{nonce:e,href:pt,precedence:"base-ui:low",children:`.${pt}{scrollbar-width:none}.${pt}::-webkit-scrollbar{display:none}`})}};function js(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}const Ms=a.createContext(void 0),Is={disableStyleElements:!1};function Ts(){return a.useContext(Ms)??Is}const Es={...gn,...hn},Ps=a.forwardRef(function(t,n){const{render:o,className:d,...s}=t,{store:l,popupRef:c,onOpenChangeComplete:x,setOpen:p,valueRef:f,selectedItemTextRef:m,keyboardActiveRef:y,multiple:M,handleScrollArrowVisibility:b,scrollHandlerRef:v,highlightItemOnHover:T}=ze(),{side:u,align:C,alignItemWithTriggerActive:h,setControlledAlignItemWithTrigger:w,scrollDownArrowRef:P,scrollUpArrowRef:U}=Rs(),Z=ur()!=null,V=vn(),{nonce:oe,disableStyleElements:me}=Ts(),F=Ke(),G=$(l,_.id),q=$(l,_.open),J=$(l,_.mounted),re=$(l,_.popupProps),K=$(l,_.transitionStatus),ee=$(l,_.triggerElement),S=$(l,_.positionerElement),B=$(l,_.listElement),R=a.useRef(0),j=a.useRef(!1),le=a.useRef(0),O=a.useRef(!1),he=a.useRef({}),ae=dr(),A=xe(L=>{if(!S||!c.current||!O.current)return;if(j.current||!h){b();return}const ce=S.style.top==="0px",te=S.style.bottom==="0px",pe=S.getBoundingClientRect().height,ye=Vt(S),ge=getComputedStyle(S),X=parseFloat(ge.marginTop),i=parseFloat(ge.marginBottom),k=tn(getComputedStyle(c.current)),I=ye.documentElement.clientHeight-X-i,D=L.scrollTop,Y=L.scrollHeight,Ne=L.clientHeight,g=Y-Ne;let H=0,N=null,ne=!1;if(ce){const ie=g-D,de=pe+ie,be=Math.min(de,I);H=be,be!==I?N=g:ne=!0}else if(te){const ie=D-0,de=pe+ie,be=Math.min(de,I),ke=de-I;H=be,be!==I?N=0:(ne=!0,D<g&&(N=D-(ie-ke)))}H!==0&&(S.style.height=`${H}px`),N!=null&&(L.scrollTop=N),(ne||H>=k)&&(j.current=!0),b()});a.useImperativeHandle(v,()=>A,[A]),Ht({open:q,ref:c,onComplete(){q&&x?.(!0)}});const z=a.useMemo(()=>({open:q,transitionStatus:K,side:u,align:C}),[q,K,u,C]);Q(()=>{!S||!c.current||Object.keys(he.current).length||(he.current={top:S.style.top||"0",left:S.style.left||"0",right:S.style.right,height:S.style.height,bottom:S.style.bottom,minHeight:S.style.minHeight,maxHeight:S.style.maxHeight,marginTop:S.style.marginTop,marginBottom:S.style.marginBottom})},[c,S]),Q(()=>{q||h||(O.current=!1,j.current=!1,R.current=0,le.current=0,bt(S,he.current))},[q,h,S,c]),Q(()=>{const L=c.current;if(!(!q||!ee||!S||!L||l.state.transitionStatus==="ending")){if(!h){O.current=!0,ae.request(b),L.style.removeProperty("--transform-origin");return}queueMicrotask(()=>{const ce=Os(L);L.style.removeProperty("--transform-origin");try{const te=getComputedStyle(S),pe=getComputedStyle(L),ye=Vt(ee),ge=Kt(S),X=ee.getBoundingClientRect(),i=S.getBoundingClientRect(),k=X.left,I=X.height,D=B||L,Y=D.scrollHeight,Ne=parseFloat(pe.borderBottomWidth),g=parseFloat(te.marginTop)||10,H=parseFloat(te.marginBottom)||10,N=parseFloat(te.minHeight)||100,ne=tn(pe),ie=5,de=5,be=20,ke=ye.documentElement.clientHeight-g-H,De=ye.documentElement.clientWidth,Se=ke-X.bottom+I,Me=m.current,_e=f.current;let Ae,Oe=0,lt=0;if(Me&&_e){const W=_e.getBoundingClientRect();Ae=Me.getBoundingClientRect();const fe=W.left-k,Ie=Ae.left-i.left,Te=W.top-X.top+W.height/2,Ce=Ae.top-i.top+Ae.height/2;Oe=fe-Ie,lt=Ce-Te}const Ze=Se+lt+H+Ne;let Le=Math.min(ke,Ze);const kt=ke-g-H,qe=Ze-Le,Ge=Math.max(ie,k+Oe),ct=De-de,et=Math.max(0,Ge+i.width-ct);S.style.left=`${Ge-et}px`,S.style.height=`${Le}px`,S.style.maxHeight="auto",S.style.marginTop=`${g}px`,S.style.marginBottom=`${H}px`,L.style.height="100%";const ut=D.scrollHeight-D.clientHeight,dt=qe>=ut;dt&&(Le=Math.min(ke,i.height)-(qe-ut));const Rt=X.top<be||X.bottom>ke-be||Le<Math.min(Y,N),St=(ge.visualViewport?.scale??1)!==1&&fr;if(Rt||St){O.current=!0,bt(S,he.current),on.flushSync(()=>w(!1));return}if(dt){const W=Math.max(0,ke-Ze);S.style.top=i.height>=kt?"0":`${W}px`,S.style.height=`${Le}px`,D.scrollTop=D.scrollHeight-D.clientHeight,R.current=Math.max(N,Le)}else S.style.bottom="0",R.current=Math.max(N,Le),D.scrollTop=qe;if(Ae){const W=i.top,fe=i.height,Ie=Ae.top+Ae.height/2,Te=fe>0?(Ie-W)/fe*100:50,Ce=js(Te,0,100);L.style.setProperty("--transform-origin",`50% ${Ce}%`)}(R.current===ke||Le>=ne)&&(j.current=!0),b(),setTimeout(()=>{O.current=!0})}finally{ce()}})}},[l,q,S,ee,f,m,c,b,h,w,ae,P,U,B]),a.useEffect(()=>{if(!h||!S||!q)return;const L=Kt(S);function ce(te){p(!1,je(gr,te))}return L.addEventListener("resize",ce),()=>{L.removeEventListener("resize",ce)}},[p,h,S,q]);const ue={...B?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":M||void 0,id:`${G}-list`},onKeyDown(L){y.current=!0,Z&&pr.has(L.key)&&L.stopPropagation()},onMouseMove(){y.current=!1},onPointerLeave(L){if(!T||In(L)||L.pointerType==="touch")return;const ce=L.currentTarget;F.start(0,()=>{l.set("activeIndex",null),ce.focus({preventScroll:!0})})},onScroll(L){B||v.current?.(L.currentTarget)},...h&&{style:B?{height:"100%"}:Ss}},ve=Fe("div",t,{ref:[n,c],state:z,stateAttributesMapping:Es,props:[re,ue,hr(K),{className:!B&&h?en.className:void 0},s]});return r.jsxs(a.Fragment,{children:[!me&&en.getElement(oe),r.jsx(mr,{context:V,modal:!1,disabled:!J,restoreFocus:!0,children:ve})]})});function tn(e){const t=e.maxHeight||"";return t.endsWith("px")&&parseFloat(t)||1/0}const nn={transform:"none",scale:"1",translate:"0 0"};function As(e,t,n){n?e.setProperty(t,n):e.removeProperty(t)}function Os(e){const{style:t}=e,n={},o=Object.keys(nn);for(const d of o)n[d]=t.getPropertyValue(d),t.setProperty(d,nn[d]);return()=>{for(const d of o)As(t,d,n[d])}}let Tn=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function Ls(e={}){const{label:t,metadata:n,textRef:o,indexGuessBehavior:d,index:s}=e,{register:l,unregister:c,subscribeMapChange:x,elementsRef:p,labelsRef:f,nextIndexRef:m}=ys(),y=a.useRef(-1),[M,b]=a.useState(s??(d===Tn.GuessFromOrder?()=>{if(y.current===-1){const u=m.current;m.current+=1,y.current=u}return y.current}:-1)),v=a.useRef(null),T=a.useCallback(u=>{if(v.current=u,M!==-1&&u!==null&&(p.current[M]=u,f)){const C=t!==void 0;f.current[M]=C?t:o?.current?.textContent??u.textContent}},[M,p,f,t,o]);return Q(()=>{if(s!=null)return;const u=v.current;if(u)return l(u,n),()=>{c(u)}},[s,l,c,n]),Q(()=>{if(s==null)return x(u=>{const C=v.current?u.get(v.current)?.index:null;C!=null&&b(C)})},[s,x,b]),a.useMemo(()=>({ref:T,index:M}),[M,T])}const En=a.createContext(void 0);function zt(){const e=a.useContext(En);if(!e)throw new Error(at(57));return e}const Tt=a.memo(a.forwardRef(function(t,n){const{render:o,className:d,value:s=null,label:l,disabled:c=!1,nativeButton:x=!1,...p}=t,f=a.useRef(null),m=Ls({label:l,textRef:f,indexGuessBehavior:Tn.GuessFromOrder}),{store:y,getItemProps:M,setOpen:b,setValue:v,selectionRef:T,typingRef:u,valuesRef:C,keyboardActiveRef:h,multiple:w,highlightItemOnHover:P}=ze(),U=Ke(),Z=$(y,_.isActive,m.index),V=$(y,_.isSelected,m.index,s),oe=$(y,_.isSelectedByFocus,m.index),me=$(y,_.isItemEqualToValue),F=m.index,G=F!==-1,q=a.useRef(null),J=Ue(F);Q(()=>{if(!G)return;const A=C.current;return A[F]=s,()=>{delete A[F]}},[G,F,s,C]),Q(()=>{if(!G)return;const A=y.state.value;let z=A;w&&Array.isArray(A)&&A.length>0&&(z=A[A.length-1]),z!==void 0&&Je(z,s,me)&&y.set("selectedIndex",F)},[G,F,w,me,y,s]);const re=a.useMemo(()=>({disabled:c,selected:V,highlighted:Z}),[c,V,Z]),K=M({active:Z,selected:V});K.onFocus=void 0,K.id=void 0;const ee=a.useRef(null),S=a.useRef("mouse"),B=a.useRef(!1),{getButtonProps:R,buttonRef:j}=cn({disabled:c,focusableWhenDisabled:!0,native:x});function le(A){const z=y.state.value;if(w){const ue=Array.isArray(z)?z:[],ve=V?es(ue,s,me):[...ue,s];v(ve,je(Ct,A))}else v(s,je(Ct,A)),b(!1,je(Ct,A))}const O={role:"option","aria-selected":V,tabIndex:Z?0:-1,onFocus(){y.set("activeIndex",F)},onMouseEnter(){!h.current&&y.state.selectedIndex===null&&y.set("activeIndex",F)},onMouseMove(){P&&y.set("activeIndex",F)},onMouseLeave(A){!P||h.current||In(A)||U.start(0,()=>{y.state.activeIndex===F&&y.set("activeIndex",null)})},onTouchStart(){T.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}},onKeyDown(A){ee.current=A.key,y.set("activeIndex",F)},onClick(A){B.current=!1,!(A.type==="keydown"&&ee.current===null)&&(c||ee.current===" "&&u.current||S.current!=="touch"&&!Z||(ee.current=null,le(A.nativeEvent)))},onPointerEnter(A){S.current=A.pointerType},onPointerDown(A){S.current=A.pointerType,B.current=!0},onMouseUp(A){if(c)return;if(B.current){B.current=!1;return}const z=!T.current.allowSelectedMouseUp&&V,ue=!T.current.allowUnselectedMouseUp&&!V;z||ue||S.current!=="touch"&&!Z||le(A.nativeEvent)}},he=Fe("div",t,{ref:[j,n,m.ref,q],state:re,props:[K,O,p,R]}),ae=a.useMemo(()=>({selected:V,indexRef:J,textRef:f,selectedByFocus:oe,hasRegistered:G}),[V,J,f,oe,G]);return r.jsx(En.Provider,{value:ae,children:he})})),Et=a.forwardRef(function(t,n){const o=t.keepMounted??!1,{selected:d}=zt();return o||d?r.jsx(Vs,{...t,ref:n}):null}),Vs=a.memo(a.forwardRef((e,t)=>{const{render:n,className:o,keepMounted:d,...s}=e,{selected:l}=zt(),c=a.useRef(null),{transitionStatus:x,setMounted:p}=mn(l),f=a.useMemo(()=>({selected:l,transitionStatus:x}),[l,x]),m=Fe("span",e,{ref:[t,c],state:f,props:[{"aria-hidden":!0,children:"✔️"},s],stateAttributesMapping:hn});return Ht({open:l,ref:c,onComplete(){l||p(!1)}}),m})),Pt=a.memo(a.forwardRef(function(t,n){const{indexRef:o,textRef:d,selectedByFocus:s,hasRegistered:l}=zt(),{selectedItemTextRef:c}=ze(),{className:x,render:p,...f}=t,m=a.useCallback(M=>{if(!M||!l)return;const b=c.current===null||!c.current.isConnected;(s||b&&o.current===0)&&(c.current=M)},[c,o,s,l]);return Fe("div",t,{ref:[m,n,d],props:f})})),Ds=a.forwardRef(function(t,n){const{render:o,className:d,id:s,...l}=t,{store:c}=xr(),x=fn(s);return c.useSyncedValueWithCleanup("descriptionElementId",x),Fe("p",t,{ref:n,props:[{id:x},l]})});function _s({open:e,title:t,description:n,confirmLabel:o,cancelLabel:d,destructive:s=!1,busy:l=!1,onConfirm:c,onCancel:x}){return r.jsx(yr,{open:e,onOpenChange:p=>{!p&&!l&&x?.()},children:r.jsxs(br,{children:[r.jsx(wr,{className:"fixed inset-0 z-[100] bg-black/40 backdrop-blur-[2px] transition-opacity duration-200 ease-out data-[ending-style]:opacity-0 data-[starting-style]:opacity-0"}),r.jsx(vr,{className:"fixed inset-0 z-[101] flex items-center justify-center p-4",children:r.jsxs(kr,{className:"relative w-full max-w-md rounded-2xl bg-white p-6 shadow-[0_20px_60px_-20px_rgba(0,0,0,0.25)] ring-1 ring-oai-gray-200 transition-[opacity,transform] duration-[220ms] ease-[cubic-bezier(0.16,1,0.3,1)] data-[ending-style]:translate-y-2 data-[ending-style]:scale-[0.96] data-[ending-style]:opacity-0 data-[starting-style]:translate-y-2 data-[starting-style]:scale-[0.96] data-[starting-style]:opacity-0 dark:bg-oai-gray-950 dark:shadow-[0_20px_60px_-10px_rgba(0,0,0,0.65)] dark:ring-oai-gray-800",children:[r.jsx(Rr,{className:"text-base font-semibold text-oai-black dark:text-white",children:t}),n?r.jsx(Ds,{className:"mt-2 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:n}):null,r.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[r.jsx(Ve,{type:"button",variant:"secondary",size:"sm",disabled:l,onClick:()=>x?.(),children:d}),r.jsx(Ve,{type:"button",size:"sm",disabled:l,onClick:()=>c?.(),className:ot(s&&"!bg-red-600 hover:!bg-red-700 focus-visible:!outline-red-600 dark:!bg-red-600 dark:hover:!bg-red-500"),children:o})]})]})})]})})}function Pn({value:e,onChange:t,placeholder:n,disabled:o=!1,type:d="text",label:s,error:l,className:c="",...x}){const y=`w-full bg-oai-white dark:bg-oai-gray-900 border border-oai-gray-300 dark:border-oai-gray-700 rounded-md text-oai-black dark:text-oai-white placeholder-oai-gray-400 dark:placeholder-oai-gray-500 transition-all duration-200 focus:outline-none focus:border-oai-brand dark:focus:border-oai-brand focus:ring-1 focus:ring-oai-brand/30 ${o?"bg-oai-gray-50 dark:bg-oai-gray-800 text-oai-gray-400 dark:text-oai-gray-400 cursor-not-allowed":""} ${l?"border-oai-error focus:border-oai-error focus:ring-oai-error/30":""} h-10 px-3 text-sm ${c}`;return r.jsxs("div",{className:"w-full",children:[s&&r.jsx("label",{className:"block text-sm font-medium text-oai-gray-700 dark:text-oai-gray-300 mb-1.5 transition-colors duration-200",children:s}),r.jsx("input",{type:d,value:e,onChange:t,placeholder:n,disabled:o,className:y,...x}),l&&r.jsx("p",{className:"mt-1.5 text-sm text-oai-error",children:l})]})}const An="tokentracker-skills";async function vt(e){const t=new URL(`/functions/${An}`,window.location.origin);if(e)for(const[d,s]of Object.entries(e))s!=null&&s!==""&&t.searchParams.set(d,String(s));const n=await fetch(t.toString(),{headers:{Accept:"application/json"},cache:"no-store"}),o=await n.json().catch(()=>null);if(!n.ok)throw new Error(o?.error||`Request failed with HTTP ${n.status}`);return o}async function We(e){const t=await Vn(),n=await fetch(`/functions/${An}`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json",...t},cache:"no-store",body:JSON.stringify(e)}),o=await n.json().catch(()=>null);if(!n.ok||o?.ok===!1)throw new Error(o?.error||`Request failed with HTTP ${n.status}`);return o}function Us(){return vt({mode:"installed"})}function Fs(e={}){return vt({mode:"discover",...e.force?{force:1}:{}})}function Hs(e,t=0,n=20){return vt({mode:"search",q:e,offset:t,limit:n})}function $s(){return vt({mode:"repos"})}function Bs(e,t){return We({action:"install",skill:e,targets:t})}function zs(e){return We({action:"uninstall",id:e})}function Ws(e){return We({action:"restore",id:e})}function Ks(e,t){return We({action:"set_targets",id:e,targets:t})}function qs(e,t){return We({action:"import_local",directory:e,targets:t})}function Gs(e,t){return We({action:"delete_local",directory:e,targets:t||[]})}function Ys(e){return We({action:"add_repo",repo:e})}function Xs(e,t){return We({action:"remove_repo",owner:e,name:t})}const rn=["claude","codex"],Js={claude:"bg-orange-500/10 ring-1 ring-orange-500/20 hover:bg-orange-500/20",codex:"bg-emerald-500/10 ring-1 ring-emerald-500/20 hover:bg-emerald-500/20",gemini:"bg-sky-500/10 ring-1 ring-sky-500/20 hover:bg-sky-500/20",opencode:"bg-amber-500/10 ring-1 ring-amber-500/20 hover:bg-amber-500/20",hermes:"bg-indigo-500/10 ring-1 ring-indigo-500/20 hover:bg-indigo-500/20"},tt="all",Ee="skillssh";function xt(e){return`${e.repoOwner||"local"}/${e.repoName||"local"}:${e.directory}`}function sn(e){return`install:${xt(e)}`}function Ut(e){return`remove:${e.id||e.directory}`}function On(e,t){return`target:${e}:${t}`}function Qs({skill:e,targets:t,busyKey:n,onToggleTarget:o}){const d=new Set(e.targets||[]);return r.jsx("div",{className:"flex flex-wrap gap-1",children:t.map(s=>{const l=d.has(s.id),c=n===On(e.id,s.id),x=l?"skills.target.remove_title":"skills.target.sync_title";return r.jsx("button",{type:"button","aria-pressed":l,"aria-label":E("skills.target.toggle_aria",{target:s.label}),title:E(x,{target:s.label}),disabled:c,onClick:()=>o(e,s.id,!l),className:ot("inline-flex h-8 w-8 items-center justify-center rounded-md transition disabled:cursor-wait disabled:opacity-70",l?Js[s.id]||"bg-oai-gray-100 dark:bg-oai-gray-800":"opacity-40 grayscale hover:bg-oai-gray-100 hover:opacity-100 hover:grayscale-0 dark:hover:bg-oai-gray-800"),children:c?r.jsx(Be,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):r.jsx(yt,{provider:s.id,size:16})},s.id)})})}function Zs({skill:e,targets:t,busyKey:n,onToggleTarget:o,onRemove:d}){const s=n===Ut(e),l=e.repoOwner&&e.repoName?`${e.repoOwner}/${e.repoName}`:null,c=l?`${e.directory} · ${l}`:e.directory;return r.jsxs("div",{className:"group grid gap-4 px-1 py-3 lg:grid-cols-[minmax(0,1fr)_auto_auto] lg:items-center",children:[r.jsxs("div",{className:"min-w-0",title:c,children:[r.jsx("h2",{className:"truncate text-sm font-semibold text-oai-black dark:text-white",children:e.name||e.directory}),e.description?r.jsx("p",{className:"mt-0.5 line-clamp-2 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:e.description}):null]}),r.jsx(Qs,{skill:e,targets:t,busyKey:n,onToggleTarget:o}),r.jsx("button",{type:"button","aria-label":E("skills.action.remove"),title:E("skills.action.remove"),disabled:s,onClick:()=>d(e),className:"inline-flex h-8 w-8 items-center justify-center rounded-md text-oai-gray-400 opacity-0 transition duration-200 hover:bg-red-50 hover:text-red-600 group-hover:opacity-100 focus:opacity-100 disabled:cursor-wait disabled:opacity-100 dark:hover:bg-red-950/30 dark:hover:text-red-300 lg:justify-self-end",children:s?r.jsx(Be,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):r.jsx(yn,{className:"h-4 w-4","aria-hidden":!0})})]})}function eo({items:e,targets:t,busyKey:n,onToggleTarget:o,onRemove:d}){return r.jsxs("div",{children:[r.jsx("div",{className:"px-1 pb-2 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:E("skills.my.count",{count:e.length})}),r.jsx("div",{className:"divide-y divide-oai-gray-200/70 dark:divide-oai-gray-800/70",children:e.map(s=>r.jsx(Zs,{skill:s,targets:t,busyKey:n,onToggleTarget:o,onRemove:d},s.id||s.key))})]})}const to={contentVisibility:"auto",containIntrinsicSize:"0 240px"},no=Dn.memo(function({skill:t,installed:n,installing:o,allTargets:d,defaultTargets:s,onInstall:l}){const[c,x]=a.useState(()=>(s||[]).filter(b=>d.some(v=>v.id===b))),p=b=>{x(v=>v.includes(b)?v.filter(T=>T!==b):[...v,b])},f=t.repoOwner&&t.repoName?`${t.repoOwner}/${t.repoName}`:null,m=t.installs!=null?E("skills.card.installs",{count:Number(t.installs||0).toLocaleString()}):null,y=[f,m].filter(Boolean).join(" · "),M=c.length?c.map(b=>d.find(v=>v.id===b)?.label||b).join(", "):E("skills.action.choose_targets");return r.jsxs(Ir,{className:"h-full rounded-lg",bodyClassName:"flex h-full flex-col",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"min-w-0",children:[t.readmeUrl?r.jsxs("a",{href:t.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:t.readmeUrl,children:[r.jsx("span",{className:"truncate",children:t.name||t.directory}),r.jsx(Or,{className:"h-3.5 w-3.5 shrink-0 text-oai-gray-400 opacity-0 transition-opacity group-hover:opacity-100","aria-hidden":!0})]}):r.jsx("h2",{className:"truncate text-base font-semibold text-oai-black dark:text-white",children:t.name||t.directory}),y?r.jsx("div",{className:"mt-1 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:y}):null]}),n?r.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-full bg-emerald-50 px-2 py-1 text-xs font-medium text-emerald-700 dark:bg-emerald-950/40 dark:text-emerald-300",children:[r.jsx(Xe,{className:"h-3 w-3","aria-hidden":!0}),E("skills.card.installed")]}):null]}),t.description?r.jsx("p",{className:"mt-3 line-clamp-3 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:t.description}):null,r.jsx("div",{className:"mt-auto pt-5",children:n?r.jsxs(Ve,{type:"button",size:"sm",disabled:!0,className:"w-full",children:[r.jsx(Xe,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),E("skills.card.installed")]}):r.jsxs("div",{className:"flex",children:[r.jsxs(Ve,{type:"button",size:"sm",onClick:()=>l(t,c),disabled:o||c.length===0,className:"flex-1 !rounded-r-none",title:M,children:[o?r.jsx(Be,{className:"mr-1.5 h-3.5 w-3.5 animate-spin","aria-hidden":!0}):r.jsx(Er,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),c.length>1?E("skills.action.install_to",{count:c.length}):E("skills.action.install")]}),r.jsxs(Sr,{children:[r.jsx(Nr,{disabled:o,"aria-label":E("skills.action.choose_targets"),title:M,className:"inline-flex h-8 items-center justify-center rounded-r-md border-l border-white/20 bg-oai-black px-2 text-white hover:bg-oai-gray-800 disabled:cursor-not-allowed disabled:opacity-60 dark:border-oai-black/20 dark:bg-white dark:text-oai-black dark:hover:bg-oai-gray-200",children:r.jsx(pn,{className:"h-3.5 w-3.5","aria-hidden":!0})}),r.jsx(Cr,{children:r.jsx(jr,{sideOffset:6,side:"bottom",align:"end",className:"!z-[80]",children:r.jsxs(Mr,{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:[r.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:E("skills.target.menu_label")}),d.map(b=>{const v=c.includes(b.id);return r.jsxs("button",{type:"button",onClick:()=>p(b.id),className:ot("flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm",v?"bg-oai-gray-100 dark:bg-oai-gray-800":"hover:bg-oai-gray-50 dark:hover:bg-oai-gray-900"),children:[r.jsx(yt,{provider:b.id,size:16,className:v?"":"grayscale opacity-40"}),r.jsx("span",{className:"flex-1 text-left",children:b.label}),v?r.jsx(Xe,{className:"h-3.5 w-3.5 text-emerald-500","aria-hidden":!0}):null]},b.id)})]})})})]})]})})]})});function ro({repos:e,repoInput:t,onRepoInput:n,busyKey:o,onAdd:d,onRemove:s}){return r.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:[r.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[r.jsx(Pn,{value:t,onChange:l=>n(l.target.value),placeholder:E("skills.repo.placeholder"),className:"min-w-0 flex-1"}),r.jsxs(Ve,{type:"button",variant:"secondary",size:"md",onClick:d,disabled:o==="repo:add",className:"shrink-0 whitespace-nowrap",children:[o==="repo:add"?r.jsx(Be,{className:"mr-1.5 h-4 w-4 animate-spin","aria-hidden":!0}):r.jsx(xn,{className:"mr-1.5 h-4 w-4","aria-hidden":!0}),E("skills.repo.add")]})]}),e.length?r.jsx("div",{className:"mt-3 divide-y divide-oai-gray-200/70 dark:divide-oai-gray-800/70",children:e.map(l=>{const c=o===`repo:${l.owner}/${l.name}`;return r.jsxs("div",{className:"flex items-center justify-between gap-3 py-2",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsxs("div",{className:"truncate text-sm font-medium text-oai-black dark:text-white",children:[l.owner,"/",l.name]}),r.jsx("div",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400",children:l.branch})]}),r.jsxs(Ve,{type:"button",variant:"ghost",size:"sm",disabled:c,onClick:()=>s(l),className:"shrink-0",children:[c?r.jsx(Be,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}):r.jsx(yn,{className:"h-3.5 w-3.5","aria-hidden":!0}),r.jsx("span",{className:"sr-only",children:E("skills.repo.remove")})]})]},`${l.owner}/${l.name}`)})}):null]})}function so(){return typeof window>"u"?"my":new URLSearchParams(window.location.search).get("tab")==="browse"?"browse":"my"}function go(){const[e,t]=a.useState(so),[n,o]=a.useState({skills:[],targets:[]}),[d,s]=a.useState([]),[l,c]=a.useState([]),[x,p]=a.useState([]),[f,m]=a.useState(tt),[y,M]=a.useState(""),[b,v]=a.useState(""),[T,u]=a.useState(""),[C,h]=a.useState(!1),[w,P]=a.useState(""),[U,Z]=a.useState(!0),[V,oe]=a.useState(!1),[me,F]=a.useState(""),[G,q]=a.useState(null),[J,re]=a.useState(null),K=a.useMemo(()=>{const i=new Set;for(const k of n.skills||[])i.add(xt(k).toLowerCase()),k.repoOwner&&k.repoName&&i.add(`${k.repoOwner}/${k.repoName}:${k.sourceDirectory||k.directory}`.toLowerCase());return i},[n.skills]),ee=a.useCallback(async()=>{const i=await Us();o({skills:i.skills||[],targets:i.targets||[]})},[]),S=a.useCallback(async()=>{const i=await $s();p(i.repos||[])},[]),B=a.useCallback(async({force:i=!1}={})=>{oe(!0);try{const k=await Fs({force:i});s(k.skills||[])}finally{oe(!1)}},[]),R=a.useCallback(async()=>{Z(!0),F("");try{await Promise.all([ee(),S()])}catch(i){F(i?.message||E("skills.error.generic"))}finally{Z(!1)}},[ee,S]),j=a.useCallback(async()=>{await R(),e==="browse"&&f!==Ee&&B({force:!0}).catch(i=>F(i?.message||E("skills.error.generic")))},[B,R,f,e]);a.useEffect(()=>{R()},[R]),a.useEffect(()=>{e==="browse"&&f!==Ee&&d.length===0&&B().catch(i=>F(i?.message||E("skills.error.generic")))},[d.length,B,f,e]),a.useEffect(()=>{if(!J)return;const i=setTimeout(()=>re(k=>k?.key===J.key?null:k),J.ttlMs||5e3);return()=>clearTimeout(i)},[J]),a.useEffect(()=>{const i=setTimeout(()=>v(y),200);return()=>clearTimeout(i)},[y]),a.useEffect(()=>{if(typeof window>"u")return;const i=new URLSearchParams(window.location.search),k=i.get("tab");if(e==="my"){if(!k)return;i.delete("tab")}else{if(k===e)return;i.set("tab",e)}const I=i.toString(),D=`${window.location.pathname}${I?`?${I}`:""}${window.location.hash}`;window.history.replaceState({},"",D)},[e]);const le=async(i,k)=>{P(i),F("");try{await k(),await ee()}catch(I){F(I?.message||E("skills.error.generic"))}finally{P("")}},O=(i,k)=>{const I=(k&&k.length?k:rn).filter(D=>(n.targets||[]).some(Y=>Y.id===D));le(sn(i),async()=>{await Bs(i,I);const D=I.map(Y=>(n.targets||[]).find(Ne=>Ne.id===Y)?.label||Y).join(", ");re({key:`${Date.now()}:install:${xt(i)}`,message:E("skills.toast.installed",{name:i.name||i.directory,targets:D||E("skills.target.none")}),ttlMs:4e3})})},he=i=>{q(i)},ae=()=>{const i=G;i&&(q(null),le(Ut(i),async()=>{let k=null;i.managed?k=await zs(i.id):await Gs(i.directory,i.targets||[]);const I=!!(k?.trashed&&i.managed&&i.id);re({key:`${Date.now()}:${i.id||i.directory}`,message:E("skills.toast.removed",{name:i.name||i.directory}),undo:I?async()=>{try{await Ws(i.id),await ee(),re(null)}catch(D){F(D?.message||E("skills.error.generic"))}}:null,ttlMs:5e3})}))},A=(i,k,I)=>le(On(i.id,k),async()=>{const D=new Set(i.targets||[]);I?D.add(k):D.delete(k),i.managed?await Ks(i.id,Array.from(D)):await qs(i.directory,Array.from(D))}),z=async()=>{const i=y.trim();if(!(i.length<2)){P("search"),F("");try{const k=await Hs(i);c(k.skills||[])}catch(k){F(k?.message||E("skills.error.generic"))}finally{P("")}}},ue=async()=>{const i=T.trim().replace(/^https:\/\/github\.com\//,"").replace(/\.git$/,""),[k,I]=i.split("/");if(!k||!I){F(E("skills.repo.invalid"));return}await le("repo:add",async()=>{await Ys({owner:k,name:I,branch:"main",enabled:!0}),u(""),await S(),await B()})},ve=async i=>{await le(`repo:${i.owner}/${i.name}`,async()=>{await Xs(i.owner,i.name),await S(),await B()})},L=n.targets||[],ce=n.skills||[],te=a.useMemo(()=>{const i=f===Ee?l:d,k=f===Ee||f===tt?i:i.filter(Y=>`${Y.repoOwner}/${Y.repoName}`===f),I=b.trim().toLowerCase();return(f===Ee||!I?k:k.filter(Y=>(Y.name||"").toLowerCase().includes(I)||(Y.directory||"").toLowerCase().includes(I)||(Y.description||"").toLowerCase().includes(I))).map(Y=>({...Y,installed:K.has(xt(Y).toLowerCase())}))},[b,d,K,l,f]),pe=r.jsx("div",{className:"flex h-64 items-center justify-center",children:r.jsx(Be,{className:"h-8 w-8 animate-spin text-oai-gray-400","aria-hidden":!0})}),ye=r.jsxs("div",{className:"flex h-64 flex-col items-center justify-center gap-3 px-6 text-center",children:[r.jsx(Be,{className:"h-8 w-8 animate-spin text-oai-gray-400","aria-hidden":!0}),r.jsx("p",{className:"max-w-md text-xs text-oai-gray-500 dark:text-oai-gray-400",children:E("skills.browse.loading_hint")})]}),ge=(i,k=null)=>r.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:[r.jsx("p",{children:E(i)}),k]});let X;if(U)X=pe;else if(e==="my")X=ce.length?r.jsx(eo,{items:ce,targets:L,busyKey:w,onToggleTarget:A,onRemove:he}):r.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:[L.length>0?r.jsxs("div",{className:"relative h-11 w-80 overflow-hidden","aria-hidden":!0,children:[r.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:r.jsx("div",{className:"absolute inset-y-0 left-0 flex w-max items-center animate-marquee-x",style:{filter:"blur(2.5px)"},children:[...L,...L].map((i,k)=>r.jsx("span",{className:"shrink-0 px-3",children:r.jsx(yt,{provider:i.id,size:30})},`b-${k}`))})}),r.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:r.jsx("div",{className:"absolute inset-y-0 left-0 flex w-max items-center animate-marquee-x",children:[...L,...L].map((i,k)=>r.jsx("span",{className:"shrink-0 px-3",children:r.jsx(yt,{provider:i.id,size:30})},`c-${k}`))})}),r.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"}),r.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,r.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:E("skills.empty.my")}),r.jsx(Ve,{type:"button",size:"sm",onClick:()=>t("browse"),children:E("skills.empty.my_cta")})]});else{const i=f===Ee,k=x.length===0&&!i;let I;k?I=r.jsx("div",{className:"rounded-lg border border-dashed border-oai-gray-200 p-6 text-center dark:border-oai-gray-800",children:r.jsx("p",{className:"text-sm text-oai-gray-600 dark:text-oai-gray-300",children:E("skills.browse.empty_sources")})}):V&&!i?I=ye:i&&y.trim().length<2?I=r.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:E("skills.browse.hint_skillssh")}):te.length?I=r.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:te.map(Y=>r.jsx("div",{style:to,children:r.jsx(no,{skill:Y,installed:!!Y.installed,installing:w===sn(Y),allTargets:L,defaultTargets:rn,onInstall:O})},Y.id||Y.key))}):i?I=ge("skills.empty.search"):I=ge("skills.empty.browse");const D=k||C?r.jsx("div",{className:"mb-5",children:r.jsx(ro,{repos:x,repoInput:T,onRepoInput:u,busyKey:w,onAdd:ue,onRemove:ve})}):null;X=r.jsxs(r.Fragment,{children:[D,I]})}return r.jsxs("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:[r.jsx("main",{className:"flex-1 pb-12 pt-8 sm:pb-16 sm:pt-10",children:r.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[r.jsxs("div",{className:"mb-6 flex items-end justify-between gap-4",children:[r.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:E("skills.page.title")}),r.jsxs(Ve,{type:"button",variant:"secondary",size:"sm",onClick:j,disabled:U||V,children:[r.jsx(Tr,{className:ot("mr-1.5 h-3.5 w-3.5",(U||V)&&"animate-spin"),"aria-hidden":!0}),E("skills.action.refresh")]})]}),r.jsx("div",{className:"mb-5 flex gap-6 border-b border-oai-gray-200 dark:border-oai-gray-800",children:[["my",E("skills.tab.my")],["browse",E("skills.tab.browse")]].map(([i,k])=>r.jsx("button",{type:"button","aria-pressed":e===i,onClick:()=>t(i),className:ot("-mb-px border-b-2 pb-2 text-sm font-medium transition-colors",e===i?"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:k},i))}),me?r.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:me}):null,e==="browse"?r.jsxs("div",{className:"mb-5 flex flex-col gap-3 sm:flex-row",children:[r.jsxs(ls,{value:f,onValueChange:m,children:[r.jsxs(fs,{"aria-label":E("skills.source.label"),className:"inline-flex h-10 w-44 shrink-0 items-center justify-between gap-2 rounded-md border border-oai-gray-200 bg-white px-3 text-sm text-oai-black focus:outline-none data-[popup-open]:border-oai-gray-300 dark:border-oai-gray-800 dark:bg-oai-gray-950 dark:text-white dark:data-[popup-open]:border-oai-gray-700",children:[r.jsx(gs,{children:i=>i===tt?E("skills.source.all"):i===Ee?E("skills.source.skillssh"):i}),r.jsx(hs,{className:"text-oai-gray-400",children:r.jsx(pn,{className:"h-4 w-4","aria-hidden":!0})})]}),r.jsx(xs,{children:r.jsx(Cs,{sideOffset:4,alignItemWithTrigger:!1,className:"z-[60]",children:r.jsxs(Ps,{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:[r.jsxs(Tt,{value:tt,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:[r.jsx(Pt,{children:E("skills.source.all")}),r.jsx(Et,{children:r.jsx(Xe,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),x.map(i=>{const k=`${i.owner}/${i.name}`;return r.jsxs(Tt,{value:k,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:[r.jsx(Pt,{children:k}),r.jsx(Et,{children:r.jsx(Xe,{className:"h-3.5 w-3.5","aria-hidden":!0})})]},k)}),r.jsxs(Tt,{value:Ee,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:[r.jsx(Pt,{children:E("skills.source.skillssh")}),r.jsx(Et,{children:r.jsx(Xe,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})]})})})]}),r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Yt,{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}),r.jsx(Pn,{value:y,onChange:i=>M(i.target.value),onKeyDown:i=>{i.key==="Enter"&&f===Ee&&z()},placeholder:f===Ee?E("skills.browse.placeholder_skillssh"):f===tt?E("skills.browse.placeholder_all"):E("skills.browse.placeholder_repo",{repo:f}),className:"pl-9"})]}),f===Ee?r.jsxs(Ve,{type:"button",onClick:z,disabled:y.trim().length<2||w==="search",children:[w==="search"?r.jsx(Be,{className:"mr-1.5 h-4 w-4 animate-spin","aria-hidden":!0}):r.jsx(Yt,{className:"mr-1.5 h-4 w-4","aria-hidden":!0}),E("skills.action.search")]}):null,r.jsxs(Ve,{type:"button",variant:"secondary",size:"sm",onClick:()=>h(i=>!i),"aria-expanded":C,className:"!h-10 shrink-0 whitespace-nowrap",children:[r.jsx(xn,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),E("skills.browse.manage_sources"),r.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,X]})}),r.jsx(_s,{open:!!G,title:E("skills.confirm.remove_title",{name:G?.name||G?.directory||""}),description:G?G.managed?E("skills.confirm.remove_managed"):E("skills.confirm.remove_local"):"",confirmLabel:E("skills.action.remove"),cancelLabel:E("shared.action.cancel"),destructive:!0,busy:w===Ut(G||{}),onCancel:()=>q(null),onConfirm:ae}),J?r.jsx("div",{className:"pointer-events-none fixed inset-x-0 bottom-6 z-[90] flex justify-center px-4",children:r.jsxs("div",{className:"pointer-events-auto flex max-w-md items-center gap-3 rounded-full bg-oai-black px-4 py-2 text-sm text-white shadow-lg dark:bg-white dark:text-oai-black",children:[r.jsx("span",{children:J.message}),J.undo?r.jsx("button",{type:"button",onClick:J.undo,className:"rounded-full px-2 py-0.5 text-xs font-semibold uppercase tracking-wide hover:bg-white/10 dark:hover:bg-oai-black/10",children:E("shared.action.undo")}):null]})}):null]})}export{go as SkillsPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{e as T,D as e,B as n,a$ as I,ar as B,r as u,b0 as D,R as E,a7 as b}from"./main-Dirgz7qK.js";import{u as $,T as z}from"./use-native-settings-B9dgqLeX.js";import{F as v,S as P,a as R}from"./FadeIn-CIKEJ1mC.js";import{D as H}from"./download-Cs4or3vN.js";import{C as O}from"./chevron-down-BS4d25ie.js";import"./Card-DmEuggKt.js";const K=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],G=T("arrow-up-right",K),U=["todayTokens","todayCost"],A=[{id:"todayTokens",label:"Today Tokens",shortLabel:"Tokens",category:"tokens"},{id:"todayCost",label:"Today Cost",shortLabel:"Cost",category:"cost"},{id:"last7dTokens",label:"Last 7 Days",shortLabel:"7d",category:"tokens"},{id:"totalTokens",label:"Total Tokens",shortLabel:"Total",category:"tokens"},{id:"totalCost",label:"Total Cost",shortLabel:"All $",category:"cost"},{id:"claude5h",label:"Claude 5h Limit",shortLabel:"Cl 5h",category:"limits"},{id:"claude7d",label:"Claude 7d Limit",shortLabel:"Cl 7d",category:"limits"},{id:"codex5h",label:"Codex 5h Limit",shortLabel:"Cx 5h",category:"limits"},{id:"codex7d",label:"Codex 7d Limit",shortLabel:"Cx 7d",category:"limits"}];function N(t,i=A,s=2){const a=new Set(i.map(o=>o.id)),l=new Set,r=Array.isArray(t)?t.filter(o=>!a.has(o)||l.has(o)?!1:(l.add(o),!0)):[];return(r.length>0?r:U).slice(0,Math.max(1,Number(s)||2))}const X=264,Y=124,x="ui-rounded, -apple-system, system-ui",S=["#5A8CF2","#9973E6","#4DB8A6","#E68C59"],V={claude:"#C77DFF",codex:"#34C759",cursor:"#FFCC00",gemini:"#0A84FF"};function Z(t){return t>=.9?"#E64D4D":t>=.7?"#D9A633":"#33B866"}function y({size:t="sm",children:i}){const s=t==="lg",a=s?560:264,l=s?32:22;return e.jsx("div",{className:b("flex w-full items-center justify-center rounded-xl bg-oai-gray-100 dark:bg-oai-gray-950/60",s?"py-10 sm:py-14 px-6":"py-6 px-4"),children:e.jsx("div",{className:"overflow-hidden bg-white dark:bg-oai-gray-800 shadow-oai-md dark:shadow-[0_2px_4px_rgba(0,0,0,0.4),0_8px_24px_rgba(0,0,0,0.5)]",style:{width:"100%",maxWidth:a,aspectRatio:`${X} / ${Y}`,borderRadius:l},children:i})})}function q({size:t="sm"}){const i="M0,104 L14,104 C26,98 34,100 44,96 S58,88 68,92 80,100 90,94 102,80 112,82 126,92 136,88 150,74 162,76 178,88 188,86 204,72 216,74 236,84 250,80 L264,80",s=`${i} L264,124 L0,124 Z`,a=`sparkArea-${t}`;return e.jsx(y,{size:t,children:e.jsxs("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:a,x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"#0A84FF",stopOpacity:"0.18"}),e.jsx("stop",{offset:"100%",stopColor:"#0A84FF",stopOpacity:"0"})]})}),e.jsx("text",{x:"14",y:"20",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"700",letterSpacing:"0.6",children:"TODAY"}),e.jsx("text",{x:"14",y:"46",className:"fill-oai-black dark:fill-white",fontSize:"22",fontWeight:"700",fontFamily:x,children:"203.2M"}),e.jsx("text",{x:"14",y:"60",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"500",fontFamily:x,children:"$129.56 ±0%"}),e.jsx("text",{x:"134",y:"20",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"700",letterSpacing:"0.6",children:"7 DAYS"}),e.jsx("text",{x:"134",y:"46",className:"fill-oai-black dark:fill-white",fontSize:"22",fontWeight:"700",fontFamily:x,children:"880.9M"}),e.jsx("text",{x:"134",y:"60",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"500",fontFamily:x,children:"$673.61"}),e.jsx("path",{d:s,fill:`url(#${a})`,stroke:"none"}),e.jsx("path",{d:i,fill:"none",stroke:"#0A84FF",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})]})})}const C=(()=>{const s=[];for(let a=0;a<26;a++)for(let l=0;l<7;l++){const r=Math.sin((a+1)*12.9898+(l+1)*78.233+17)*43758.5453,c=Math.floor(Math.abs(r-Math.floor(r))*100);s.push({w:a,d:l,v:c})}return s})();function M(t,i){return t<18?i?"#262626":"#e5e5e5":t<38?"rgba(10, 132, 255, 0.28)":t<58?"rgba(10, 132, 255, 0.50)":t<80?"rgba(10, 132, 255, 0.75)":"#0A84FF"}function J(){return e.jsx(y,{children:e.jsxs("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:[e.jsx("g",{transform:`translate(${19.5}, 10)`,className:"hidden dark:inline",children:C.map(r=>e.jsx("rect",{x:r.w*(7.5+1.2),y:r.d*(8+1.2),width:7.5,height:8,rx:"1.3",fill:M(r.v,!0)},`d-${r.w}-${r.d}`))}),e.jsx("g",{transform:`translate(${19.5}, 10)`,className:"dark:hidden",children:C.map(r=>e.jsx("rect",{x:r.w*(7.5+1.2),y:r.d*(8+1.2),width:7.5,height:8,rx:"1.3",fill:M(r.v,!1)},`l-${r.w}-${r.d}`))}),e.jsx("text",{x:19.5,y:"102",className:"fill-oai-black dark:fill-white",fontSize:"10",fontWeight:"700",fontFamily:x,children:"10.3B"}),e.jsx("text",{x:19.5+30,y:"102",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"9",fontWeight:"500",children:"tokens · 202 active days"})]})})}function Q(){const t=[{name:"claude-opus-4-6",value:"586.4M",pct:59},{name:"claude-sonnet-4-5-20250929",value:"218.7M",pct:22},{name:"gpt-5.4",value:"80.6M",pct:8},{name:"composer-2-fast",value:"52.1M",pct:5}],i=22,s=28,a=14,l=236;return e.jsx(y,{children:e.jsx("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:t.map((r,c)=>{const o=s+c*i,g=S[c%S.length];return e.jsxs("g",{children:[e.jsx("circle",{cx:"18",cy:o-3,r:"2.5",fill:g}),e.jsx("text",{x:"26",y:o,className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"500",children:r.name}),e.jsx("text",{x:"218",y:o,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"9",fontWeight:"600",fontFamily:x,children:r.value}),e.jsxs("text",{x:"250",y:o,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"600",fontFamily:x,children:[r.pct,"%"]}),e.jsx("rect",{x:a,y:o+4,width:l,height:"2.8",rx:"1.4",className:"fill-oai-gray-200 dark:fill-oai-gray-700"}),e.jsx("rect",{x:a,y:o+4,width:Math.max(l*(r.pct/100),4),height:"2.8",rx:"1.4",fill:g})]},r.name)})})})}function ee(){const t=[{label:"Claude · 7d",source:"claude",reset:"in 1d",pct:61},{label:"Claude · 5h",source:"claude",reset:"in 4h 28m",pct:4},{label:"Cursor",source:"cursor",reset:"in 25d",pct:51},{label:"Codex · weekly",source:"codex",reset:"in 1d",pct:32}],i=22,s=28,a=14,l=236;return e.jsx(y,{children:e.jsx("svg",{viewBox:"0 0 264 124",className:"h-full w-full","aria-hidden":"true",children:t.map((r,c)=>{const o=s+c*i,g=V[r.source],p=Z(r.pct/100);return e.jsxs("g",{children:[e.jsx("circle",{cx:"18",cy:o-3,r:"2.5",fill:g}),e.jsx("text",{x:"26",y:o,className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"500",children:r.label}),e.jsx("text",{x:"218",y:o,textAnchor:"end",className:"fill-oai-gray-500 dark:fill-oai-gray-400",fontSize:"8",fontWeight:"500",fontFamily:x,children:r.reset}),e.jsxs("text",{x:"250",y:o,textAnchor:"end",className:"fill-oai-black dark:fill-white",fontSize:"9",fontWeight:"700",fontFamily:x,children:[r.pct,"%"]}),e.jsx("rect",{x:a,y:o+4,width:l,height:"2.8",rx:"1.4",className:"fill-oai-gray-200 dark:fill-oai-gray-700"}),e.jsx("rect",{x:a,y:o+4,width:Math.max(l*(r.pct/100),4),height:"2.8",rx:"1.4",fill:p})]},r.label)})})})}function te(t){switch(t.category){case"cost":return"$8.42";case"limits":return"62%";default:return t.id==="last7dTokens"?"1.8B":"203M"}}function ae(t,i){switch(t){case"todayTokens":return n("menubar.metric.today_tokens");case"todayCost":return n("menubar.metric.today_cost");case"last7dTokens":return n("menubar.metric.last_7d_tokens");case"totalTokens":return n("menubar.metric.total_tokens");case"totalCost":return n("menubar.metric.total_cost");case"claude5h":return n("menubar.metric.claude_5h");case"claude7d":return n("menubar.metric.claude_7d");case"codex5h":return n("menubar.metric.codex_5h");case"codex7d":return n("menubar.metric.codex_7d");default:return i}}function ie(t,i){const s=new Set(i.map(l=>l.id)),a=t.filter(l=>s.has(l));for(const l of i){if(a.length>=2)break;a.includes(l.id)||a.push(l.id)}return a.slice(0,2)}function re({slotConfigs:t,showStats:i}){return e.jsx("div",{className:"flex justify-center rounded-xl bg-gradient-to-b from-oai-gray-100 to-oai-gray-200 px-6 py-8 dark:from-oai-gray-950/80 dark:to-oai-gray-900/80",children:e.jsxs("div",{className:"inline-flex items-stretch rounded-md shadow-[0_1px_3px_rgba(0,0,0,0.18)] ring-1 ring-black/10 dark:ring-white/10 px-3",style:{background:"linear-gradient(180deg, #2c2c2e 0%, #1c1c1e 100%)"},children:[e.jsx("div",{className:"flex items-center pl-2 pr-1 py-2.5",children:e.jsx("img",{src:"/clawd/mini/idle-tight.svg",alt:"","aria-hidden":"true",className:"block shrink-0",style:{height:22,width:"auto"},draggable:"false"})}),i?t.map(({slot:s,item:a},l)=>e.jsxs(E.Fragment,{children:[l>0?e.jsx("span",{className:"my-1 w-px bg-white/20","aria-hidden":"true"}):null,e.jsxs("div",{className:b("flex min-w-[52px] flex-col items-center justify-center py-1.5",l===0?"pl-1 pr-2":"px-2"),children:[e.jsx("span",{className:"text-[13px] font-semibold leading-none tabular-nums text-white",children:a?.previewValue||"--"}),e.jsx("span",{className:"mt-[2px] text-[6px] font-semibold uppercase leading-none text-white/75",children:a?.shortLabel||"Metric"})]})]},s)):null]})})}function se({slot:t,value:i,options:s,disabled:a,onChange:l}){const r=t===0?n("menubar.slot.primary"):n("menubar.slot.secondary");return e.jsxs("label",{className:"flex min-w-0 flex-col gap-1.5",children:[e.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-[0.08em] text-oai-gray-500 dark:text-oai-gray-400",children:r}),e.jsxs("div",{className:"relative",children:[e.jsx("select",{value:i,disabled:a,"aria-label":r,onChange:c=>l(t,c.target.value),className:b("w-full appearance-none rounded-lg border border-oai-gray-200 bg-white px-3 py-2 pr-9 text-sm font-medium text-oai-black transition-colors hover:border-oai-gray-300 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-white dark:hover:border-oai-gray-700",a&&"cursor-not-allowed opacity-50 hover:border-oai-gray-200 dark:hover:border-oai-gray-800"),children:s.map(c=>e.jsx("option",{value:c.id,children:c.displayLabel},c.id))}),e.jsx(O,{className:"pointer-events-none absolute right-3 top-1/2 h-4 w-4 -translate-y-1/2 text-oai-gray-400","aria-hidden":"true"})]})]})}function _({label:t,hint:i,checked:s,disabled:a,onChange:l}){return e.jsxs("div",{className:"flex items-center justify-between gap-3 py-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-oai-black dark:text-white",children:t}),i?e.jsx("p",{className:"mt-0.5 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:i}):null]}),e.jsx(z,{checked:s,disabled:a,onChange:l,ariaLabel:t})]})}function le(){const{available:t,settings:i,setSetting:s}=$(),a=u.useMemo(()=>(Array.isArray(i?.menuBarAvailableItems)?i.menuBarAvailableItems:A).map(m=>({...m,displayLabel:ae(m.id,m.label),previewValue:te(m)})),[i?.menuBarAvailableItems]),l=Number(i?.menuBarMaxItems)||2,r=u.useMemo(()=>N(i?.menuBarItems,a,l),[a,l,i?.menuBarItems]),c=u.useMemo(()=>ie(r,a),[a,r]),o=i?.showStats!==!1,g=d=>{s("menuBarItems",N(d,a,l))},p=(d,m)=>{const h=[...c];h[d===0?1:0]!==m&&(h[d]=m,g(h))},w=[0,1].map(d=>{const m=c[d]||a[d]?.id||"",j=c[d===0?1:0],W=a.filter(f=>f.id===m||f.id!==j),F=a.find(f=>f.id===m);return{slot:d,currentValue:m,options:W,item:F}}),k=i?.animatedIcon!==!1;return e.jsxs("article",{className:"rounded-xl border border-oai-gray-200 bg-white p-5 transition-colors duration-200 dark:border-oai-gray-800 dark:bg-oai-gray-900 sm:p-6",children:[e.jsx(re,{slotConfigs:w,showStats:o}),e.jsx("div",{className:"mt-5 grid grid-cols-1 gap-3 sm:grid-cols-2 sm:gap-4",children:w.map(({slot:d,currentValue:m,options:h})=>e.jsx(se,{slot:d,value:m,options:h,disabled:!t||!o,onChange:p},d))}),e.jsxs("div",{className:"mt-5 divide-y divide-oai-gray-100 border-t border-oai-gray-100 dark:divide-oai-gray-800 dark:border-oai-gray-800",children:[e.jsx(_,{label:n("settings.menubar.showStats"),hint:t?n("settings.menubar.showStatsHint"):n("menubar.native_only"),checked:o,disabled:!t,onChange:()=>s("showStats",!o)}),e.jsx(_,{label:n("settings.menubar.animatedIcon"),hint:n("settings.menubar.animatedIconHint"),checked:k,disabled:!t,onChange:()=>s("animatedIcon",!k)})]})]})}function ne(){const[t,i]=u.useState("loading");return u.useEffect(()=>{if(typeof window>"u")return;if(D()){i("native");return}const s=(navigator.userAgent||"").toLowerCase(),a=/mac/.test(s)&&!/iphone|ipad/.test(s);i(a?"mac-web":"other")},[]),t}function oe(){const t=ne();return t==="loading"?e.jsx("div",{className:"h-10 w-40","aria-hidden":"true"}):t==="native"?e.jsxs("button",{type:"button",onClick:()=>I("openWidgetGallery"),className:"inline-flex h-10 items-center gap-2 rounded-lg bg-oai-black px-4 text-sm font-medium text-white transition-colors hover:bg-oai-gray-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 focus-visible:ring-offset-2 dark:bg-white dark:text-oai-black dark:hover:bg-oai-gray-200",children:[n("widgets.cta.open_gallery"),e.jsx(G,{className:"h-4 w-4","aria-hidden":"true"})]}):t==="mac-web"?e.jsxs("a",{href:"https://github.com/mm7894215/TokenTracker/releases/latest",target:"_blank",rel:"noopener noreferrer",className:"inline-flex h-10 items-center gap-2 rounded-lg bg-oai-black px-4 text-sm font-medium text-white no-underline transition-colors hover:bg-oai-gray-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 focus-visible:ring-offset-2 dark:bg-white dark:text-oai-black dark:hover:bg-oai-gray-200",children:[e.jsx(H,{className:"h-4 w-4","aria-hidden":"true"}),n("widgets.cta.download")]}):e.jsxs("span",{className:"inline-flex h-10 items-center gap-2 rounded-lg border border-oai-gray-200 bg-oai-gray-50 px-4 text-sm font-medium text-oai-gray-500 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-oai-gray-400",children:[e.jsx(B,{className:"h-4 w-4","aria-hidden":"true"}),n("widgets.cta.macos_only")]})}const ce=[{id:"summary",Preview:q,nameKey:"widgets.summary.name",descKey:"widgets.summary.description"},{id:"heatmap",Preview:J,nameKey:"widgets.heatmap.name",descKey:"widgets.heatmap.description"},{id:"topModels",Preview:Q,nameKey:"widgets.topModels.name",descKey:"widgets.topModels.description"},{id:"limits",Preview:ee,nameKey:"widgets.limits.name",descKey:"widgets.limits.description"}];function de({Preview:t,nameKey:i,descKey:s}){return e.jsxs("article",{className:"flex h-full flex-col rounded-xl border border-oai-gray-200 bg-white p-4 transition-colors duration-200 dark:border-oai-gray-800 dark:bg-oai-gray-900 sm:p-5",children:[e.jsx(t,{}),e.jsxs("div",{className:"mt-4",children:[e.jsx("h3",{className:"text-[15px] font-semibold text-oai-black dark:text-white",children:n(i)}),e.jsx("p",{className:"mt-1.5 text-sm leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:n(s)})]})]})}function L({titleKey:t}){return e.jsx("h2",{className:"mb-4 text-xl font-semibold tracking-tight text-oai-black dark:text-white sm:mb-5 sm:text-2xl",children:n(t)})}function ye(){return e.jsx("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:e.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:e.jsxs("div",{className:"mx-auto max-w-5xl px-4 sm:px-6",children:[e.jsx(v,{y:12,children:e.jsxs("header",{className:"mb-10 flex items-start justify-between gap-4 sm:mb-12",children:[e.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:n("widgets.page.title")}),e.jsx("div",{className:"shrink-0",children:e.jsx(oe,{})})]})}),e.jsx(v,{y:12,delay:.06,children:e.jsxs("section",{"aria-label":n("widgets.menubar.section.title"),className:"mb-12 sm:mb-14",children:[e.jsx(L,{titleKey:"widgets.menubar.section.title"}),e.jsx(le,{})]})}),e.jsxs("section",{"aria-label":n("widgets.gallery.section.title"),children:[e.jsx(L,{titleKey:"widgets.gallery.section.title"}),e.jsx(P,{staggerDelay:.08,initialDelay:.04,children:e.jsx("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-2 lg:gap-5",children:ce.map(({id:t,Preview:i,nameKey:s,descKey:a})=>e.jsx(R,{children:e.jsx(de,{Preview:i,nameKey:s,descKey:a})},t))})})]})]})})})}export{ye as WidgetsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as o}from"./main-
|
|
1
|
+
import{e as o}from"./main-Dirgz7qK.js";const e=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],c=o("chevron-down",e);export{c as C};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as o}from"./main-
|
|
1
|
+
import{e as o}from"./main-Dirgz7qK.js";const a=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],d=o("download",a);export{d as D};
|
package/dashboard/dist/assets/{leaderboard-columns-DRc_1zw2.js → leaderboard-columns-5fNRo700.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{R as c,D as n,a7 as i}from"./main-
|
|
1
|
+
import{R as c,D as n,a7 as i}from"./main-Dirgz7qK.js";function y(e){let r=0;const o=String(e??"");for(let a=0;a<o.length;a+=1)r=Math.imul(31,r)+o.charCodeAt(a)|0;return Math.abs(r)%360}function m(e){const r=String(e??"").trim();if(!r)return"?";const o=r.split(/\s+/).filter(Boolean);if(o.length>=2){const a=o[0][0]||"",t=o[1][0]||"";return`${a}${t}`.toUpperCase()}return r.slice(0,2).toUpperCase()}const g={sm:"h-7 w-7 min-h-7 min-w-7 text-[10px]",md:"h-8 w-8 min-h-8 min-w-8 text-[11px]",lg:"h-14 w-14 min-h-14 min-w-14 text-base"};function h({avatarUrl:e,displayName:r,seed:o,size:a="md",className:t}){const d=g[a]||g.md,p=y(o??r??""),s=typeof e=="string"?e.trim():"",[b,l]=c.useState(!1);return c.useEffect(()=>{l(!1)},[s]),s&&!b?n.jsx("img",{src:s,alt:"",referrerPolicy:"no-referrer",onError:()=>l(!0),className:i("rounded-full object-cover ring-1 ring-white/10",d,t)}):n.jsx("div",{className:i("flex shrink-0 items-center justify-center rounded-full font-semibold text-white ring-1 ring-white/10",d,t),style:{backgroundColor:`hsl(${p} 42% 34%)`},"aria-hidden":!0,children:m(r)})}const u=new Set(["/brand-logos/cursor.svg","/brand-logos/kiro.svg","/brand-logos/copilot.svg"]);function w({iconSrc:e,label:r}){return n.jsxs("span",{className:"inline-flex items-center gap-3",children:[e?n.jsx("img",{src:e,alt:"",width:16,height:16,className:`h-4 w-4 shrink-0 object-contain opacity-90 ${u.has(e)?"dark:invert":""}`}):null,n.jsx("span",{className:"whitespace-nowrap",children:r})]})}const x=[{key:"gpt_tokens",copyKey:"leaderboard.column.codex",icon:"/brand-logos/codex.svg"},{key:"claude_tokens",copyKey:"leaderboard.column.claude",icon:"/brand-logos/claude-code.svg"},{key:"gemini_tokens",copyKey:"leaderboard.column.gemini",icon:"/brand-logos/gemini.svg"},{key:"cursor_tokens",copyKey:"leaderboard.column.cursor",icon:"/brand-logos/cursor.svg"},{key:"kiro_tokens",copyKey:"leaderboard.column.kiro",icon:"/brand-logos/kiro.svg"},{key:"copilot_tokens",copyKey:"leaderboard.column.copilot",icon:"/brand-logos/copilot.svg"},{key:"kimi_tokens",copyKey:"leaderboard.column.kimi",icon:"/brand-logos/kimi.svg"},{key:"opencode_tokens",copyKey:"leaderboard.column.opencode",icon:"/brand-logos/opencode.svg"},{key:"openclaw_tokens",copyKey:"leaderboard.column.openclaw",icon:"/brand-logos/openclaw.svg"},{key:"hermes_tokens",copyKey:"leaderboard.column.hermes",icon:null},{key:"other_tokens",copyKey:"leaderboard.column.supplemental",icon:null}],f="sticky left-0 z-40 w-[72px] min-w-[72px] max-w-[72px] bg-white dark:bg-oai-gray-950 px-4 py-4 align-middle",_="sticky left-[71px] z-40 min-w-[200px] max-w-[min(260px,45vw)] border-l border-r border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-950 px-4 py-4 align-middle",v="sticky left-[71px] z-40 min-w-[6rem] border-l border-r border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-950 px-4 py-4";function K(e){return i("sticky left-0 z-30 w-[72px] min-w-[72px] max-w-[72px] px-4 py-4 whitespace-nowrap",e?"bg-oai-brand-50 dark:bg-emerald-950":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60")}function T(e){return i("sticky left-[71px] z-30 hover:z-50 min-w-[200px] max-w-[min(260px,45vw)] border-l border-r border-oai-gray-200 dark:border-oai-gray-800 px-4 py-4 min-w-0",e?"bg-oai-brand-50 dark:bg-emerald-950":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60")}function S(e){return i("sticky left-[71px] z-30 min-w-[6rem] border-l border-r border-oai-gray-200 dark:border-oai-gray-800 px-4 py-4 whitespace-nowrap","bg-white dark:bg-oai-gray-950")}export{f as L,_ as a,x as b,T as c,w as d,h as e,S as f,v as g,K as l};
|