tokentracker-cli 0.15.2 → 0.15.3

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.
Files changed (28) hide show
  1. package/dashboard/dist/assets/{Card-CTRPazyG.js → Card-CFkWVhb0.js} +1 -1
  2. package/dashboard/dist/assets/{DashboardPage-BJVPrOly.js → DashboardPage-RjZ7ipnP.js} +1 -1
  3. package/dashboard/dist/assets/{FadeIn-NAG8xImb.js → FadeIn-Dnh91CXb.js} +1 -1
  4. package/dashboard/dist/assets/{HeaderGithubStar-CwnC8N_4.js → HeaderGithubStar-Csm3Ealb.js} +1 -1
  5. package/dashboard/dist/assets/{IpCheckPage-Bqz8OFmD.js → IpCheckPage-CO11dZjw.js} +1 -1
  6. package/dashboard/dist/assets/{LandingPage-Dz7yTDPI.js → LandingPage-DGwfREJQ.js} +1 -1
  7. package/dashboard/dist/assets/{LeaderboardPage-DX_tP5qi.js → LeaderboardPage-BNEOrCyJ.js} +1 -1
  8. package/dashboard/dist/assets/{LeaderboardProfilePage-BI4R73XX.js → LeaderboardProfilePage-BTr06sjH.js} +1 -1
  9. package/dashboard/dist/assets/{LimitsPage-D15dhSFp.js → LimitsPage-Do6ixJEC.js} +1 -1
  10. package/dashboard/dist/assets/{LoginPage-CSWfDVcM.js → LoginPage-DkI12oqp.js} +1 -1
  11. package/dashboard/dist/assets/{PopoverPopup-DgTXWAeN.js → PopoverPopup-D3QrvkAB.js} +1 -1
  12. package/dashboard/dist/assets/{ProviderIcon-CEhS41Kz.js → ProviderIcon-BrQ-p8RF.js} +1 -1
  13. package/dashboard/dist/assets/{SettingsPage-CaPVlEzU.js → SettingsPage-BRqlRIMB.js} +1 -1
  14. package/dashboard/dist/assets/{SkillsPage-CGH_F5Y0.js → SkillsPage-tu65Bfiu.js} +1 -1
  15. package/dashboard/dist/assets/{WidgetsPage-Cjad4Q71.js → WidgetsPage-C9GQDr-H.js} +1 -1
  16. package/dashboard/dist/assets/{chevron-down-DGOV7_Uw.js → chevron-down-DL3I7ot4.js} +1 -1
  17. package/dashboard/dist/assets/{download-DCjD_Xm9.js → download-6m9qXhnE.js} +1 -1
  18. package/dashboard/dist/assets/{leaderboard-columns-BK2-Jp3k.js → leaderboard-columns-hS7oew2p.js} +1 -1
  19. package/dashboard/dist/assets/{main-DTrs3jUq.js → main-B5QLmAE0.js} +15 -15
  20. package/dashboard/dist/assets/{use-limits-display-prefs-rF66WvRU.js → use-limits-display-prefs-BcoGb7lc.js} +1 -1
  21. package/dashboard/dist/assets/{use-native-settings-DK8RelvO.js → use-native-settings-B3GRVvNg.js} +1 -1
  22. package/dashboard/dist/assets/{use-reduced-motion-BsYZLRkk.js → use-reduced-motion-CybCedEn.js} +1 -1
  23. package/dashboard/dist/assets/{use-usage-limits-jLzoEy77.js → use-usage-limits-CNGlifnQ.js} +1 -1
  24. package/dashboard/dist/index.html +1 -1
  25. package/dashboard/dist/share.html +1 -1
  26. package/package.json +1 -1
  27. package/src/lib/pricing/seed-snapshot.json +1 -1
  28. package/dashboard/dist/assets/NativeAuthCallbackPage-D6Stzae_.js +0 -1
@@ -1 +1 @@
1
- import{D as l}from"./main-DTrs3jUq.js";function i({size:r=16,className:t=""}){return l.jsx("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:t,children:l.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:r=16,className:t=""}){return l.jsx("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",className:t,children:l.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:r=16,className:t=""}){return l.jsx("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:t,children:l.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 x({size:r=16,className:t=""}){return l.jsx("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:t,children:l.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 s({size:r=16,className:t=""}){return l.jsx("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:t,children:l.jsx("path",{d:"M9.27 15.29l7.978-5.897c.391-.29.95-.177 1.137.272.98 2.369.542 5.215-1.41 7.169-1.951 1.954-4.667 2.382-7.149 1.406l-2.711 1.257c3.889 2.661 8.611 2.003 11.562-.953 2.341-2.344 3.066-5.539 2.388-8.42l.006.007c-.983-4.232.242-5.924 2.75-9.383.06-.082.12-.164.179-.248l-3.301 3.305v-.01L9.267 15.292M7.623 16.723c-2.792-2.67-2.31-6.801.071-9.184 1.761-1.763 4.647-2.483 7.166-1.425l2.705-1.25a7.808 7.808 0 00-1.829-1A8.975 8.975 0 005.984 5.83c-2.533 2.536-3.33 6.436-1.962 9.764 1.022 2.487-.653 4.246-2.34 6.022-.599.63-1.199 1.259-1.682 1.925l7.62-6.815"})})}function C({size:r=16,className:t=""}){return l.jsx("svg",{width:r,height:r,viewBox:"0 -1 22 28",fill:"currentColor",fillRule:"evenodd",className:t,children:l.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 u({size:r=16,className:t=""}){return l.jsx("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:t,children:l.jsx("path",{d:"M16 6H8v12h8V6zm4 16H4V2h16v20z"})})}function v({size:r=16,className:t=""}){return l.jsxs("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:t,children:[l.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"}),l.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 g({size:r=16,className:t=""}){return l.jsx("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:t,children:l.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:r=16,className:t=""}){return l.jsxs("svg",{width:r,height:r,viewBox:"0 0 64 60",fill:"none",className:t,"aria-hidden":"true",children:[l.jsx("path",{fill:"currentColor",d:"M37.2114 3.75318C37.6821 3.33106 37.7106 3.31457 38.0558 3.29385C38.6149 3.2531 39.1272 3.52199 39.9989 4.31564C42.0356 6.16652 44.8714 9.97183 46.6346 13.2212L47.3163 14.4819L48.2782 14.9605C49.2072 15.4299 50.7308 16.3923 51.3672 16.9085C51.655 17.1464 51.6956 17.1508 51.9947 17.0344C53.3454 16.5084 55.2803 17.206 56.9869 18.8432C58.5231 20.3155 59.9943 22.8312 60.558 24.9308C60.6403 25.2687 60.7493 25.9952 60.7891 26.5362C60.9177 28.4358 60.3092 29.9532 59.1362 30.64C58.8965 30.7784 58.8801 30.8158 58.8868 31.4132C58.9409 34.2583 58.1741 37.0985 56.6335 39.8679C54.8946 42.9773 51.7981 46.1938 47.6074 49.2243C45.357 50.8619 40.0323 53.964 37.6248 55.0532C31.8578 57.6496 27.2346 58.646 23.2188 58.154C20.8236 57.8638 18.1124 56.9287 16.5082 55.8433C16.086 55.5515 16.0191 55.5329 15.6966 55.6251C13.9793 56.1185 11.73 55.1053 9.81931 52.9844C9.05725 52.1366 7.82714 50.0548 7.42839 48.9409C6.50606 46.3339 6.68976 43.9816 7.91836 42.5767C8.23573 42.2149 8.2453 42.1995 8.17598 41.5912C8.06148 40.5951 8.00971 39.1206 8.06202 38.1692L8.10361 37.2803L6.76977 34.9212C4.70378 31.2451 3.3912 28.1582 2.88489 25.7998C2.61762 24.5066 2.63385 23.9324 2.96214 23.5078C3.16198 23.2515 3.81796 22.9866 4.60785 22.8407C6.59665 22.4917 10.9334 22.8076 15.7581 23.6595L16.259 23.7458L17.3608 22.7713C19.1891 21.1519 20.4038 20.244 22.6429 18.8478C24.9768 17.3876 27.6108 16.1858 30.577 15.2346L31.5295 14.9294L32.0526 13.5561C33.9257 8.61146 35.8437 4.96584 37.2114 3.75318ZM21.5208 29.0919C19.404 30.314 18.3453 30.9251 17.5676 31.6099C14.4179 34.3835 13.2414 38.777 14.5823 42.7537C14.9135 43.7357 15.5247 44.7942 16.7469 46.9111C17.9691 49.0279 18.5801 50.0865 19.2649 50.8643C22.0385 54.014 26.4316 55.1918 30.4084 53.8509C31.3904 53.5198 32.4489 52.9085 34.5657 51.6863L46.7442 44.6551C48.8613 43.4328 49.9205 42.8214 50.6983 42.1365C53.8479 39.363 55.0245 34.9695 53.6835 30.9927C53.3524 30.0107 52.7412 28.9522 51.519 26.8354C50.2968 24.7185 49.6858 23.66 49.0009 22.8822C46.2274 19.7325 41.8342 18.5547 37.8575 19.8956C36.8754 20.2267 35.8163 20.8383 33.6993 22.0606L21.5208 29.0919Z"}),l.jsx("g",{transform:"rotate(-30 22.6953 37.6011)",children:l.jsx("rect",{x:"22.6953",y:"37.6011",width:"4.81084",height:"9.99175",rx:"2.40542",fill:"currentColor"})}),l.jsx("g",{transform:"rotate(-30 35.6748 30.1074)",children:l.jsx("rect",{x:"35.6748",y:"30.1074",width:"4.81084",height:"9.99175",rx:"2.40542",fill:"currentColor"})})]})}function w({size:r=16,className:t=""}){return l.jsx("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",className:t,children:l.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 j({size:r=16,className:t=""}){return l.jsx("svg",{width:r,height:r,viewBox:"0 0 16 16",fill:"currentColor",className:t,children:l.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"})})}function L({size:r=16,className:t=""}){return l.jsx("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,"aria-hidden":"true",children:l.jsx("g",{transform:"translate(3.4502, 3)",fill:"#9570BE",children:l.jsx("path",{d:"M3.17890888,3.6 L3.17890888,0 L16,0 L16,3.6 L3.17890888,3.6 Z M9.642,7.2 L9.64218223,10.8 L0,10.8 L0,3.6 L16,3.6 L16,7.2 L9.642,7.2 Z M3.17890888,18 L3.178,14.4 L0,14.4 L0,10.8 L16,10.8 L16,18 L3.17890888,18 Z",fillRule:"nonzero"})})})}function I({size:r=16,className:t=""}){return l.jsxs("svg",{width:r,height:r,viewBox:"0 0 120 90",fill:"currentColor",className:t,children:[l.jsx("rect",{x:"10",y:"8",width:"100",height:"12",rx:"2"}),l.jsx("rect",{x:"25",y:"20",width:"12",height:"62",rx:"2"}),l.jsx("rect",{x:"75",y:"20",width:"12",height:"45",rx:"2"}),l.jsx("rect",{x:"71",y:"55",width:"20",height:"16",rx:"3"}),l.jsx("rect",{x:"76",y:"71",width:"3",height:"8",rx:"1"}),l.jsx("rect",{x:"82",y:"71",width:"3",height:"8",rx:"1"})]})}function M({size:r=16,className:t=""}){return l.jsxs("svg",{width:r,height:r,viewBox:"0 0 120 90",fill:"currentColor",className:t,children:[l.jsx("rect",{x:"10",y:"8",width:"100",height:"12",rx:"2"}),l.jsx("rect",{x:"25",y:"20",width:"12",height:"62",rx:"2"}),l.jsx("rect",{x:"83",y:"20",width:"12",height:"62",rx:"2"})]})}const p={CLAUDE:i,CODEBUDDY:f,CODEX:d,COPILOT:g,CRAFT:L,CURSOR:a,GEMINI:x,GITHUB:j,GROK:s,HERMES:w,KIMI:v,KIRO:C,OPENCODE:u,OMP:I,PI:M},m={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","KILO-CLI":"/brand-logos/kilo.svg","KILO-CODE":"/brand-logos/kilo.svg",OPENCLAW:"/brand-logos/openclaw.svg",OPENCODE:"/brand-logos/opencode.svg"};function O({provider:r,size:t=16,color:h,className:e=""}){const o=r?.toUpperCase?.()||"",c=m[o];if(c)return l.jsx("img",{src:c,alt:"",width:t,height:t,className:e,style:{width:t,height:t,objectFit:"contain"},"aria-hidden":!0});const n=p[o];return n?l.jsx(n,{size:t,className:e}):l.jsx("div",{className:"rounded-full shrink-0",style:{width:t*.5,height:t*.5,backgroundColor:h}})}export{O as P};
1
+ import{D as l}from"./main-B5QLmAE0.js";function i({size:r=16,className:t=""}){return l.jsx("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:t,children:l.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:r=16,className:t=""}){return l.jsx("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",className:t,children:l.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:r=16,className:t=""}){return l.jsx("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:t,children:l.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 x({size:r=16,className:t=""}){return l.jsx("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:t,children:l.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 s({size:r=16,className:t=""}){return l.jsx("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:t,children:l.jsx("path",{d:"M9.27 15.29l7.978-5.897c.391-.29.95-.177 1.137.272.98 2.369.542 5.215-1.41 7.169-1.951 1.954-4.667 2.382-7.149 1.406l-2.711 1.257c3.889 2.661 8.611 2.003 11.562-.953 2.341-2.344 3.066-5.539 2.388-8.42l.006.007c-.983-4.232.242-5.924 2.75-9.383.06-.082.12-.164.179-.248l-3.301 3.305v-.01L9.267 15.292M7.623 16.723c-2.792-2.67-2.31-6.801.071-9.184 1.761-1.763 4.647-2.483 7.166-1.425l2.705-1.25a7.808 7.808 0 00-1.829-1A8.975 8.975 0 005.984 5.83c-2.533 2.536-3.33 6.436-1.962 9.764 1.022 2.487-.653 4.246-2.34 6.022-.599.63-1.199 1.259-1.682 1.925l7.62-6.815"})})}function C({size:r=16,className:t=""}){return l.jsx("svg",{width:r,height:r,viewBox:"0 -1 22 28",fill:"currentColor",fillRule:"evenodd",className:t,children:l.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 u({size:r=16,className:t=""}){return l.jsx("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:t,children:l.jsx("path",{d:"M16 6H8v12h8V6zm4 16H4V2h16v20z"})})}function v({size:r=16,className:t=""}){return l.jsxs("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:t,children:[l.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"}),l.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 g({size:r=16,className:t=""}){return l.jsx("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:t,children:l.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:r=16,className:t=""}){return l.jsxs("svg",{width:r,height:r,viewBox:"0 0 64 60",fill:"none",className:t,"aria-hidden":"true",children:[l.jsx("path",{fill:"currentColor",d:"M37.2114 3.75318C37.6821 3.33106 37.7106 3.31457 38.0558 3.29385C38.6149 3.2531 39.1272 3.52199 39.9989 4.31564C42.0356 6.16652 44.8714 9.97183 46.6346 13.2212L47.3163 14.4819L48.2782 14.9605C49.2072 15.4299 50.7308 16.3923 51.3672 16.9085C51.655 17.1464 51.6956 17.1508 51.9947 17.0344C53.3454 16.5084 55.2803 17.206 56.9869 18.8432C58.5231 20.3155 59.9943 22.8312 60.558 24.9308C60.6403 25.2687 60.7493 25.9952 60.7891 26.5362C60.9177 28.4358 60.3092 29.9532 59.1362 30.64C58.8965 30.7784 58.8801 30.8158 58.8868 31.4132C58.9409 34.2583 58.1741 37.0985 56.6335 39.8679C54.8946 42.9773 51.7981 46.1938 47.6074 49.2243C45.357 50.8619 40.0323 53.964 37.6248 55.0532C31.8578 57.6496 27.2346 58.646 23.2188 58.154C20.8236 57.8638 18.1124 56.9287 16.5082 55.8433C16.086 55.5515 16.0191 55.5329 15.6966 55.6251C13.9793 56.1185 11.73 55.1053 9.81931 52.9844C9.05725 52.1366 7.82714 50.0548 7.42839 48.9409C6.50606 46.3339 6.68976 43.9816 7.91836 42.5767C8.23573 42.2149 8.2453 42.1995 8.17598 41.5912C8.06148 40.5951 8.00971 39.1206 8.06202 38.1692L8.10361 37.2803L6.76977 34.9212C4.70378 31.2451 3.3912 28.1582 2.88489 25.7998C2.61762 24.5066 2.63385 23.9324 2.96214 23.5078C3.16198 23.2515 3.81796 22.9866 4.60785 22.8407C6.59665 22.4917 10.9334 22.8076 15.7581 23.6595L16.259 23.7458L17.3608 22.7713C19.1891 21.1519 20.4038 20.244 22.6429 18.8478C24.9768 17.3876 27.6108 16.1858 30.577 15.2346L31.5295 14.9294L32.0526 13.5561C33.9257 8.61146 35.8437 4.96584 37.2114 3.75318ZM21.5208 29.0919C19.404 30.314 18.3453 30.9251 17.5676 31.6099C14.4179 34.3835 13.2414 38.777 14.5823 42.7537C14.9135 43.7357 15.5247 44.7942 16.7469 46.9111C17.9691 49.0279 18.5801 50.0865 19.2649 50.8643C22.0385 54.014 26.4316 55.1918 30.4084 53.8509C31.3904 53.5198 32.4489 52.9085 34.5657 51.6863L46.7442 44.6551C48.8613 43.4328 49.9205 42.8214 50.6983 42.1365C53.8479 39.363 55.0245 34.9695 53.6835 30.9927C53.3524 30.0107 52.7412 28.9522 51.519 26.8354C50.2968 24.7185 49.6858 23.66 49.0009 22.8822C46.2274 19.7325 41.8342 18.5547 37.8575 19.8956C36.8754 20.2267 35.8163 20.8383 33.6993 22.0606L21.5208 29.0919Z"}),l.jsx("g",{transform:"rotate(-30 22.6953 37.6011)",children:l.jsx("rect",{x:"22.6953",y:"37.6011",width:"4.81084",height:"9.99175",rx:"2.40542",fill:"currentColor"})}),l.jsx("g",{transform:"rotate(-30 35.6748 30.1074)",children:l.jsx("rect",{x:"35.6748",y:"30.1074",width:"4.81084",height:"9.99175",rx:"2.40542",fill:"currentColor"})})]})}function w({size:r=16,className:t=""}){return l.jsx("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",className:t,children:l.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 j({size:r=16,className:t=""}){return l.jsx("svg",{width:r,height:r,viewBox:"0 0 16 16",fill:"currentColor",className:t,children:l.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"})})}function L({size:r=16,className:t=""}){return l.jsx("svg",{width:r,height:r,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,"aria-hidden":"true",children:l.jsx("g",{transform:"translate(3.4502, 3)",fill:"#9570BE",children:l.jsx("path",{d:"M3.17890888,3.6 L3.17890888,0 L16,0 L16,3.6 L3.17890888,3.6 Z M9.642,7.2 L9.64218223,10.8 L0,10.8 L0,3.6 L16,3.6 L16,7.2 L9.642,7.2 Z M3.17890888,18 L3.178,14.4 L0,14.4 L0,10.8 L16,10.8 L16,18 L3.17890888,18 Z",fillRule:"nonzero"})})})}function I({size:r=16,className:t=""}){return l.jsxs("svg",{width:r,height:r,viewBox:"0 0 120 90",fill:"currentColor",className:t,children:[l.jsx("rect",{x:"10",y:"8",width:"100",height:"12",rx:"2"}),l.jsx("rect",{x:"25",y:"20",width:"12",height:"62",rx:"2"}),l.jsx("rect",{x:"75",y:"20",width:"12",height:"45",rx:"2"}),l.jsx("rect",{x:"71",y:"55",width:"20",height:"16",rx:"3"}),l.jsx("rect",{x:"76",y:"71",width:"3",height:"8",rx:"1"}),l.jsx("rect",{x:"82",y:"71",width:"3",height:"8",rx:"1"})]})}function M({size:r=16,className:t=""}){return l.jsxs("svg",{width:r,height:r,viewBox:"0 0 120 90",fill:"currentColor",className:t,children:[l.jsx("rect",{x:"10",y:"8",width:"100",height:"12",rx:"2"}),l.jsx("rect",{x:"25",y:"20",width:"12",height:"62",rx:"2"}),l.jsx("rect",{x:"83",y:"20",width:"12",height:"62",rx:"2"})]})}const p={CLAUDE:i,CODEBUDDY:f,CODEX:d,COPILOT:g,CRAFT:L,CURSOR:a,GEMINI:x,GITHUB:j,GROK:s,HERMES:w,KIMI:v,KIRO:C,OPENCODE:u,OMP:I,PI:M},m={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","KILO-CLI":"/brand-logos/kilo.svg","KILO-CODE":"/brand-logos/kilo.svg",OPENCLAW:"/brand-logos/openclaw.svg",OPENCODE:"/brand-logos/opencode.svg"};function O({provider:r,size:t=16,color:h,className:e=""}){const o=r?.toUpperCase?.()||"",c=m[o];if(c)return l.jsx("img",{src:c,alt:"",width:t,height:t,className:e,style:{width:t,height:t,objectFit:"contain"},"aria-hidden":!0});const n=p[o];return n?l.jsx(n,{size:t,className:e}):l.jsx("div",{className:"rounded-full shrink-0",style:{width:t*.5,height:t*.5,backgroundColor:h}})}export{O as P};
@@ -1 +1 @@
1
- import{c as S,r as l,b as Q,f as Y,al as G,D as n,E as P,a5 as x,B as o,Q as J,ab as X,am as ee,ac as te,ad as ne,ae as A,an as ae,ao as ie,P as se,O as oe,C as re,U as le,ap as ce,aq as ue,ar as D,as as de,at as ge,au as he,av as be}from"./main-DTrs3jUq.js";import{L as me,a as L,u as pe}from"./use-limits-display-prefs-rF66WvRU.js";import{S as v,T as k,a as f,b as E,u as _}from"./use-native-settings-DK8RelvO.js";import{D as fe}from"./download-DCjD_Xm9.js";import"./Card-CTRPazyG.js";const ye=[["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"}]],xe=S("grip-vertical",ye);const ve=[["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"}]],O=S("languages",ve);const ke=[["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"}]],je=S("log-out",ke);const Ne=[["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"}]],Se=S("pencil",Ne),we=e=>!e.isLayoutDirty&&e.willUpdate(!1);function I(){const e=new Set,t=new WeakMap,a=()=>e.forEach(we);return{add:i=>{e.add(i),t.set(i,i.addEventListener("willUpdate",a))},remove:i=>{e.delete(i);const s=t.get(i);s&&(s(),t.delete(i)),a()},dirty:a}}const Ce=l.createContext(null);function Ge(){const e=l.useRef(!1);return Q(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function Le(){const e=Ge(),[t,a]=l.useState(0),i=l.useCallback(()=>{e.current&&a(t+1)},[t]);return[l.useCallback(()=>Y.postRender(i),[i]),t]}const T=e=>e===!0,Ee=e=>T(e===!0)||e==="id",Oe=({children:e,id:t,inherit:a=!0})=>{const i=l.useContext(G),s=l.useContext(Ce),[r,c]=Le(),d=l.useRef(null),g=i.id||s;d.current===null&&(Ee(a)&&g&&(t=t?g+"-"+t:g),d.current={id:t,group:T(a)&&i.group||I()});const h=l.useMemo(()=>({...d.current,forceRender:r}),[c]);return n.jsx(G.Provider,{value:h,children:e})},Ie=new Set(["cursor","kiro","copilot","kimi"]);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:s}=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),s(r,u))},p=()=>{c(null),g(null)},y=u=>{u.preventDefault(),c(null),g(null)};return n.jsx(Oe,{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(xe,{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:me[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:`${o("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),s=a?.[1]||i?.[1];return s?`https://github.com/${s}`:null}function w(e,t){console.warn(`[tokentracker] settings ${e}:`,t)}function Me(e,t,a){const[i,s]=l.useState(()=>X()),r=t&&a&&ee(),c=l.useCallback(async()=>{const d=!i;if(te(d),s(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,s]=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(""),[F,H]=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:s,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:F,githubUrl:B,loadSetters:q,nameInput:u,profileLoading:r,profileSaving:d,publicProfileOn:t,setAnonymousOn:s,setCustomDisplayName:m,setEditingGithub:$,setEditingName:y,setGithubError:Z,setGithubInput:H,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 s=await A({getAccessToken:e});if(!i||!s)return;const r=await ae({accessToken:s});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(s){w("load public profile",s)}finally{i&&a.setProfileLoading(!1)}})(),()=>{i=!1}},[e,t,a])}function Be(e,t){return l.useCallback(async(a,{label:i,onError:s,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 s?s(c):w(i||"mutate profile",c),!1}finally{t.setProfileSaving(!1)}},[e,t])}function Fe(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 He(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 s=!e.publicProfileOn;await t({enabled:s},{label:"toggle public profile",onSuccess:()=>e.setPublicProfileOn(s)})},[t,e]);return{handleAnonymousToggle:l.useCallback(async()=>{const s=!e.anonymousOn;await t({anonymous:s},{label:"toggle anonymous",onSuccess:()=>e.setAnonymousOn(s)})},[t,e]),handlePublicProfileToggle:a}}function $e(e,t){const a=l.useCallback(async()=>{const s=e.nameInput.trim().slice(0,50);s&&await t({display_name:s},{label:"save display name",onSuccess:()=>{e.setCustomDisplayName(s),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(o("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||o("settings.account.githubUrlInvalid")),onSuccess:c=>{e.setGithubUrl(c?.github_url||r||""),e.setShowGithubOn(!!r),e.setEditingGithub(!1)}})},[t,e]),s=l.useCallback(()=>{e.setGithubInput(e.githubUrl),e.setGithubError(null),e.setEditingGithub(!0)},[e]);return{handleSaveGithub:i,handleShowGithubToggle:a,startEditingGithub:s}}function Ze(){const e=J(),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),s=ze(t,i),r=$e(t,i),c=Ve(t,i);return{...e,...a,email:t.email,handlePublicProfileToggle:s.handlePublicProfileToggle,name:Fe(t,{...s,...r}),github:He(t,c),profileLoading:t.profileLoading,profileSaving:t.profileSaving,publicProfileOn:t.publicProfileOn}}function M({disabled:e,onCancel:t,onSave:a,saveLabel:i=o("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:o("settings.account.cancel")})]})}function We({nameInput:e,setEditingName:t,setNameInput:a,profileSaving:i,handleSaveName:s}){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"&&s(),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:o("settings.account.displayName")}),n.jsx(M,{disabled:i||!e.trim(),onCancel:()=>t(!1),onSave:s,saveLabel:i?o("settings.account.saving"):void 0})]})}function Ke({githubError:e,githubInput:t,handleSaveGithub:a,profileSaving:i,setEditingGithub:s,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"&&(s(!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:o("settings.account.githubUrlPlaceholder")}),n.jsx(M,{disabled:i,onCancel:()=>{s(!1),r(null)},onSave:a,saveLabel:i?o("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(Se,{className:"h-3.5 w-3.5","aria-hidden":!0}),t]})}function R({actions:e,editing:t,editor:a,hint:i,label:s}){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:s}),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?o("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:o("settings.account.edit"),onClick:e.startEditingName,title:t}),n.jsx(k,{checked:!e.anonymousOn,onChange:e.handleAnonymousToggle,disabled:e.profileLoading||e.profileSaving,ariaLabel:o("settings.account.displayName")})]})}function Qe({name:e}){const{anonymousOn:t,customDisplayName:a,displayName:i,editingName:s,handleAnonymousToggle:r,handleSaveName:c,nameInput:d,profileLoading:g,profileSaving:h,setEditingName:m,setNameInput:p,startEditingName:y}=e,u=t?o("settings.account.displayNameAnonymousHint"):a||i;return n.jsx(R,{label:o("settings.account.displayName"),editing:s,hint:u,editor:n.jsx(We,{nameInput:d,setEditingName:m,setNameInput:p,profileSaving:h,handleSaveName:c}),actions:n.jsx(qe,{name:e})})}function Ye({github:e}){const{editingGithub:t,githubError:a,githubInput:i,githubUrl:s,handleSaveGithub:r,handleShowGithubToggle:c,profileLoading:d,profileSaving:g,setEditingGithub:h,setGithubError:m,setGithubInput:p,showGithubOn:y,startEditingGithub:u}=e;return n.jsx(R,{label:o("settings.account.githubUrl"),editing:t,hint:s||o("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:o("settings.account.edit"),onClick:u}),n.jsx(k,{checked:y,onChange:c,disabled:d||g,ariaLabel:o("settings.account.githubUrl")})]})})}function Je(){const{openLoginModal:e}=se();return n.jsx(v,{title:o("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:o("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:o("settings.account.signIn")})]})})}function Xe({name:e,github:t}){return n.jsxs(n.Fragment,{children:[n.jsx(Qe,{name:e}),n.jsx(Ye,{github:t})]})}function et(){const e=Ze();return e.enabled?e.signedIn?n.jsxs(v,{title:o("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(Je,{}):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(je,{className:"h-3.5 w-3.5","aria-hidden":!0}),o("settings.account.signOut")]})}function nt({settings:e}){return e.showLocalCloudSync?n.jsx(f,{label:o("settings.account.cloudSync"),hint:o("settings.account.cloudSyncHint"),control:n.jsx(k,{checked:e.cloudSyncOn,onChange:e.handleCloudSyncToggle,ariaLabel:o("settings.account.cloudSync")})}):null}function at({checked:e,disabled:t,onChange:a}){return n.jsx(f,{label:o("settings.account.publicProfile"),hint:o("settings.account.publicProfileHint"),control:n.jsx(k,{checked:e,onChange:a,disabled:t,ariaLabel:o("settings.account.publicProfile")})})}function it({visible:e,name:t,github:a}){return n.jsx(oe,{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 st(){return[{value:"light",label:o("settings.appearance.theme.light"),Icon:ce},{value:"dark",label:o("settings.appearance.theme.dark"),Icon:ue},{value:"system",label:o("settings.appearance.theme.system"),Icon:D}]}function ot(){return[{value:de,label:o("settings.appearance.language.system"),Icon:D},{value:ge,label:o("settings.appearance.language.english"),Icon:O},{value:he,label:o("settings.appearance.language.chinese"),Icon:O}]}function rt(){const{theme:e,setTheme:t}=re(),{locale:a,setLocale:i}=le();return n.jsxs(v,{title:o("settings.section.appearance"),children:[n.jsx(f,{label:o("settings.appearance.theme.label"),hint:o("settings.appearance.theme.hint"),control:n.jsx(E,{options:st(),value:e,onChange:t})}),n.jsx(f,{label:o("settings.appearance.language.label"),hint:o("settings.appearance.language.hint"),control:n.jsx(E,{options:ot(),value:a,onChange:i})})]})}function lt(){const{available:e,settings:t,setSetting:a,runAction:i}=_();if(!e)return null;const s=!!t?.launchAtLogin,r=t?.launchAtLoginSupported!==!1,c=t?.updateStatus||null,d=!!t?.updateBusy,g=!!t?.isSyncing;return n.jsxs(v,{title:o("settings.section.menubar"),children:[r?n.jsx(f,{label:o("settings.menubar.launchAtLogin"),hint:o("settings.menubar.launchAtLoginHint"),control:n.jsx(k,{checked:s,onChange:()=>a("launchAtLogin",!s),ariaLabel:o("settings.menubar.launchAtLogin")})}):null,n.jsx(f,{label:o("settings.menubar.syncNow"),hint:o("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(be,{className:x("h-3.5 w-3.5",g&&"animate-spin"),"aria-hidden":!0}),g?o("settings.menubar.syncing"):o("settings.menubar.syncNow")]})}),n.jsx(f,{label:o("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}),o("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 mt(){const e=pe();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:o("settings.page.title")}),n.jsx("p",{className:"mt-2 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:o("settings.page.subtitle")})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsx(rt,{}),n.jsx(lt,{}),n.jsx(et,{}),n.jsx(v,{title:o("settings.section.limits"),children:n.jsx(Ae,{prefs:e})})]}),n.jsx(ct,{})]})})})}export{mt as SettingsPage};
1
+ import{c as S,r as l,b as Q,f as Y,al as G,D as n,E as P,a5 as x,B as o,Q as J,ab as X,am as ee,ac as te,ad as ne,ae as A,an as ae,ao as ie,P as se,O as oe,C as re,U as le,ap as ce,aq as ue,ar as D,as as de,at as ge,au as he,av as be}from"./main-B5QLmAE0.js";import{L as me,a as L,u as pe}from"./use-limits-display-prefs-BcoGb7lc.js";import{S as v,T as k,a as f,b as E,u as _}from"./use-native-settings-B3GRVvNg.js";import{D as fe}from"./download-6m9qXhnE.js";import"./Card-CFkWVhb0.js";const ye=[["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"}]],xe=S("grip-vertical",ye);const ve=[["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"}]],O=S("languages",ve);const ke=[["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"}]],je=S("log-out",ke);const Ne=[["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"}]],Se=S("pencil",Ne),we=e=>!e.isLayoutDirty&&e.willUpdate(!1);function I(){const e=new Set,t=new WeakMap,a=()=>e.forEach(we);return{add:i=>{e.add(i),t.set(i,i.addEventListener("willUpdate",a))},remove:i=>{e.delete(i);const s=t.get(i);s&&(s(),t.delete(i)),a()},dirty:a}}const Ce=l.createContext(null);function Ge(){const e=l.useRef(!1);return Q(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function Le(){const e=Ge(),[t,a]=l.useState(0),i=l.useCallback(()=>{e.current&&a(t+1)},[t]);return[l.useCallback(()=>Y.postRender(i),[i]),t]}const T=e=>e===!0,Ee=e=>T(e===!0)||e==="id",Oe=({children:e,id:t,inherit:a=!0})=>{const i=l.useContext(G),s=l.useContext(Ce),[r,c]=Le(),d=l.useRef(null),g=i.id||s;d.current===null&&(Ee(a)&&g&&(t=t?g+"-"+t:g),d.current={id:t,group:T(a)&&i.group||I()});const h=l.useMemo(()=>({...d.current,forceRender:r}),[c]);return n.jsx(G.Provider,{value:h,children:e})},Ie=new Set(["cursor","kiro","copilot","kimi"]);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:s}=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),s(r,u))},p=()=>{c(null),g(null)},y=u=>{u.preventDefault(),c(null),g(null)};return n.jsx(Oe,{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(xe,{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:me[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:`${o("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),s=a?.[1]||i?.[1];return s?`https://github.com/${s}`:null}function w(e,t){console.warn(`[tokentracker] settings ${e}:`,t)}function Me(e,t,a){const[i,s]=l.useState(()=>X()),r=t&&a&&ee(),c=l.useCallback(async()=>{const d=!i;if(te(d),s(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,s]=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(""),[F,H]=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:s,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:F,githubUrl:B,loadSetters:q,nameInput:u,profileLoading:r,profileSaving:d,publicProfileOn:t,setAnonymousOn:s,setCustomDisplayName:m,setEditingGithub:$,setEditingName:y,setGithubError:Z,setGithubInput:H,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 s=await A({getAccessToken:e});if(!i||!s)return;const r=await ae({accessToken:s});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(s){w("load public profile",s)}finally{i&&a.setProfileLoading(!1)}})(),()=>{i=!1}},[e,t,a])}function Be(e,t){return l.useCallback(async(a,{label:i,onError:s,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 s?s(c):w(i||"mutate profile",c),!1}finally{t.setProfileSaving(!1)}},[e,t])}function Fe(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 He(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 s=!e.publicProfileOn;await t({enabled:s},{label:"toggle public profile",onSuccess:()=>e.setPublicProfileOn(s)})},[t,e]);return{handleAnonymousToggle:l.useCallback(async()=>{const s=!e.anonymousOn;await t({anonymous:s},{label:"toggle anonymous",onSuccess:()=>e.setAnonymousOn(s)})},[t,e]),handlePublicProfileToggle:a}}function $e(e,t){const a=l.useCallback(async()=>{const s=e.nameInput.trim().slice(0,50);s&&await t({display_name:s},{label:"save display name",onSuccess:()=>{e.setCustomDisplayName(s),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(o("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||o("settings.account.githubUrlInvalid")),onSuccess:c=>{e.setGithubUrl(c?.github_url||r||""),e.setShowGithubOn(!!r),e.setEditingGithub(!1)}})},[t,e]),s=l.useCallback(()=>{e.setGithubInput(e.githubUrl),e.setGithubError(null),e.setEditingGithub(!0)},[e]);return{handleSaveGithub:i,handleShowGithubToggle:a,startEditingGithub:s}}function Ze(){const e=J(),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),s=ze(t,i),r=$e(t,i),c=Ve(t,i);return{...e,...a,email:t.email,handlePublicProfileToggle:s.handlePublicProfileToggle,name:Fe(t,{...s,...r}),github:He(t,c),profileLoading:t.profileLoading,profileSaving:t.profileSaving,publicProfileOn:t.publicProfileOn}}function M({disabled:e,onCancel:t,onSave:a,saveLabel:i=o("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:o("settings.account.cancel")})]})}function We({nameInput:e,setEditingName:t,setNameInput:a,profileSaving:i,handleSaveName:s}){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"&&s(),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:o("settings.account.displayName")}),n.jsx(M,{disabled:i||!e.trim(),onCancel:()=>t(!1),onSave:s,saveLabel:i?o("settings.account.saving"):void 0})]})}function Ke({githubError:e,githubInput:t,handleSaveGithub:a,profileSaving:i,setEditingGithub:s,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"&&(s(!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:o("settings.account.githubUrlPlaceholder")}),n.jsx(M,{disabled:i,onCancel:()=>{s(!1),r(null)},onSave:a,saveLabel:i?o("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(Se,{className:"h-3.5 w-3.5","aria-hidden":!0}),t]})}function R({actions:e,editing:t,editor:a,hint:i,label:s}){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:s}),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?o("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:o("settings.account.edit"),onClick:e.startEditingName,title:t}),n.jsx(k,{checked:!e.anonymousOn,onChange:e.handleAnonymousToggle,disabled:e.profileLoading||e.profileSaving,ariaLabel:o("settings.account.displayName")})]})}function Qe({name:e}){const{anonymousOn:t,customDisplayName:a,displayName:i,editingName:s,handleAnonymousToggle:r,handleSaveName:c,nameInput:d,profileLoading:g,profileSaving:h,setEditingName:m,setNameInput:p,startEditingName:y}=e,u=t?o("settings.account.displayNameAnonymousHint"):a||i;return n.jsx(R,{label:o("settings.account.displayName"),editing:s,hint:u,editor:n.jsx(We,{nameInput:d,setEditingName:m,setNameInput:p,profileSaving:h,handleSaveName:c}),actions:n.jsx(qe,{name:e})})}function Ye({github:e}){const{editingGithub:t,githubError:a,githubInput:i,githubUrl:s,handleSaveGithub:r,handleShowGithubToggle:c,profileLoading:d,profileSaving:g,setEditingGithub:h,setGithubError:m,setGithubInput:p,showGithubOn:y,startEditingGithub:u}=e;return n.jsx(R,{label:o("settings.account.githubUrl"),editing:t,hint:s||o("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:o("settings.account.edit"),onClick:u}),n.jsx(k,{checked:y,onChange:c,disabled:d||g,ariaLabel:o("settings.account.githubUrl")})]})})}function Je(){const{openLoginModal:e}=se();return n.jsx(v,{title:o("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:o("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:o("settings.account.signIn")})]})})}function Xe({name:e,github:t}){return n.jsxs(n.Fragment,{children:[n.jsx(Qe,{name:e}),n.jsx(Ye,{github:t})]})}function et(){const e=Ze();return e.enabled?e.signedIn?n.jsxs(v,{title:o("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(Je,{}):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(je,{className:"h-3.5 w-3.5","aria-hidden":!0}),o("settings.account.signOut")]})}function nt({settings:e}){return e.showLocalCloudSync?n.jsx(f,{label:o("settings.account.cloudSync"),hint:o("settings.account.cloudSyncHint"),control:n.jsx(k,{checked:e.cloudSyncOn,onChange:e.handleCloudSyncToggle,ariaLabel:o("settings.account.cloudSync")})}):null}function at({checked:e,disabled:t,onChange:a}){return n.jsx(f,{label:o("settings.account.publicProfile"),hint:o("settings.account.publicProfileHint"),control:n.jsx(k,{checked:e,onChange:a,disabled:t,ariaLabel:o("settings.account.publicProfile")})})}function it({visible:e,name:t,github:a}){return n.jsx(oe,{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 st(){return[{value:"light",label:o("settings.appearance.theme.light"),Icon:ce},{value:"dark",label:o("settings.appearance.theme.dark"),Icon:ue},{value:"system",label:o("settings.appearance.theme.system"),Icon:D}]}function ot(){return[{value:de,label:o("settings.appearance.language.system"),Icon:D},{value:ge,label:o("settings.appearance.language.english"),Icon:O},{value:he,label:o("settings.appearance.language.chinese"),Icon:O}]}function rt(){const{theme:e,setTheme:t}=re(),{locale:a,setLocale:i}=le();return n.jsxs(v,{title:o("settings.section.appearance"),children:[n.jsx(f,{label:o("settings.appearance.theme.label"),hint:o("settings.appearance.theme.hint"),control:n.jsx(E,{options:st(),value:e,onChange:t})}),n.jsx(f,{label:o("settings.appearance.language.label"),hint:o("settings.appearance.language.hint"),control:n.jsx(E,{options:ot(),value:a,onChange:i})})]})}function lt(){const{available:e,settings:t,setSetting:a,runAction:i}=_();if(!e)return null;const s=!!t?.launchAtLogin,r=t?.launchAtLoginSupported!==!1,c=t?.updateStatus||null,d=!!t?.updateBusy,g=!!t?.isSyncing;return n.jsxs(v,{title:o("settings.section.menubar"),children:[r?n.jsx(f,{label:o("settings.menubar.launchAtLogin"),hint:o("settings.menubar.launchAtLoginHint"),control:n.jsx(k,{checked:s,onChange:()=>a("launchAtLogin",!s),ariaLabel:o("settings.menubar.launchAtLogin")})}):null,n.jsx(f,{label:o("settings.menubar.syncNow"),hint:o("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(be,{className:x("h-3.5 w-3.5",g&&"animate-spin"),"aria-hidden":!0}),g?o("settings.menubar.syncing"):o("settings.menubar.syncNow")]})}),n.jsx(f,{label:o("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}),o("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 mt(){const e=pe();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:o("settings.page.title")}),n.jsx("p",{className:"mt-2 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:o("settings.page.subtitle")})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsx(rt,{}),n.jsx(lt,{}),n.jsx(et,{}),n.jsx(v,{title:o("settings.section.limits"),children:n.jsx(Ae,{prefs:e})})]}),n.jsx(ct,{})]})})})}export{mt as SettingsPage};
@@ -1 +1 @@
1
- import{c as ot,r as a,D as r,a7 as on,H as Ue,a5 as Je,aw as Ln,B as T,av as Vn,R as Dn}from"./main-DTrs3jUq.js";import{C as _n}from"./Card-CTRPazyG.js";import{A as Dt,s as Se,n as at,o as Fe,p as $e,q as $t,r as an,t as _e,v as Un,w as Hn,x as Q,y as Fn,z as xe,B as $n,C as Bt,E as Bn,F as tt,c as Me,G as Nt,H as zt,I as zn,J as ln,K as Wn,M as Kn,N as Ke,O as Tt,Q as it,R as Pe,S as Et,T as cn,U as qn,V as se,W as un,X as Yn,Y as Pt,Z as $,_ as _t,$ as Gn,a0 as Xn,a1 as Jn,a2 as Qn,a3 as dn,a4 as fn,a5 as Zn,a6 as er,a7 as Ut,a8 as tr,a9 as nr,a as gn,b as He,aa as rr,ab as At,ac as sr,ad as or,ae as ar,af as ir,ag as lr,ah as cr,ai as ur,aj as dr,ak as mn,al as fr,am as gr,an as Wt,ao as mr,ap as hr,aq as pr,ar as hn,as as xr,at as yr,au as Ct,u as br,D as wr,e as kr,f as vr,g as Rr,h as Sr,i as Nr,L as Be,P as Cr,j as jr,k as Mr,l as Ir,m as Tr}from"./PopoverPopup-DgTXWAeN.js";import{P as yt}from"./ProviderIcon-CEhS41Kz.js";import{C as pn}from"./chevron-down-DGOV7_Uw.js";import{D as Er}from"./download-DCjD_Xm9.js";const Pr=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],nt=ot("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=ot("external-link",Ar);const Lr=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],xn=ot("plus",Lr);const Vr=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Kt=ot("search",Vr);const Dr=[["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=ot("trash-2",Dr);function _r(e){const t=a.useRef(!0);t.current&&(t.current=!1,e())}function qt({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 gt(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 Yt(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 Ur(e,{event:t,orientation:n,loopFocus:o,rtl:d,cols:s,disabledIndices:l,minIndex:c,maxIndex:x,prevIndex:p,stopEvent:f=!1}){let g=p;const y=[],I={};let b=!1;{let u=null,C=-1;e.current.forEach((h,k)=>{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(k),I[k]=C})}const v=b&&y.length>0&&y.some(u=>u.length!==s);function E(u){if(!v||p===-1)return;const C=I[p];if(C==null)return;const h=y[C].indexOf(p);let k=u==="up"?C-1:C+1;o&&(k<0?k=y.length-1:k>=y.length&&(k=0));const P=new Set;for(;k>=0&&k<y.length&&!P.has(k);){P.add(k);const H=y[k];if(H.length===0){k=u==="up"?k-1:k+1;continue}const Z=Math.min(h,H.length-1);for(let D=Z;D>=0;D-=1){const oe=H[D];if(!st(e,oe,l))return oe}k=u==="up"?k-1:k+1,o&&(k<0?k=y.length-1:k>=y.length&&(k=0))}}if(t.key===Dt){const u=E("up");if(u!==void 0)f&&Se(t),g=u;else{if(f&&Se(t),p===-1)g=x;else if(g=we(e,{startingIndex:g,amount:s,decrement:!0,disabledIndices:l}),o&&(p-s<c||g<0)){const C=p%s,h=x%s,k=x-(h-C);h===C?g=x:g=h>C?k:k-s}rt(e,g)&&(g=p)}}if(t.key===at){const u=E("down");u!==void 0?(f&&Se(t),g=u):(f&&Se(t),p===-1?g=c:(g=we(e,{startingIndex:p,amount:s,disabledIndices:l}),o&&p+s>x&&(g=we(e,{startingIndex:p%s-s,amount:s,disabledIndices:l}))),rt(e,g)&&(g=p))}if(n==="both"){const u=$t(p/s);t.key===(d?Fe:$e)&&(f&&Se(t),p%s!==s-1?(g=we(e,{startingIndex:p,disabledIndices:l}),o&&gt(g,s,u)&&(g=we(e,{startingIndex:p-p%s-1,disabledIndices:l}))):o&&(g=we(e,{startingIndex:p-p%s-1,disabledIndices:l})),gt(g,s,u)&&(g=p)),t.key===(d?$e:Fe)&&(f&&Se(t),p%s!==0?(g=we(e,{startingIndex:p,decrement:!0,disabledIndices:l}),o&&gt(g,s,u)&&(g=we(e,{startingIndex:p+(s-p%s),decrement:!0,disabledIndices:l}))):o&&(g=we(e,{startingIndex:p+(s-p%s),decrement:!0,disabledIndices:l})),gt(g,s,u)&&(g=p));const C=$t(x/s)===u;rt(e,g)&&(o&&C?g=t.key===(d?$e:Fe)?x:we(e,{startingIndex:p-p%s-1,disabledIndices:l}):g=p)}return g}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 g=0;g<l;g+=1)p.push(d+f+g*t);d%t+s<=t&&p.every(f=>o[f]==null)?(p.forEach(f=>{o[f]=c}),x=!0):d+=1}}),[...o]}function Fr(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 $r(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 Br="Escape";function wt(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function mt(e,t){return wt(t,e===Dt||e===at,e===Fe||e===$e)}function Mt(e,t,n){return wt(t,e===at,n?e===Fe:e===$e)||e==="Enter"||e===" "||e===""}function zr(e,t,n){return wt(t,n?e===Fe:e===$e,e===at)}function Wr(e,t,n,o){const d=n?e===$e:e===Fe,s=e===Dt;return t==="both"||t==="horizontal"&&o&&o>1?e===Br:wt(t,d,s)}function Kr(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:g=null,allowEscape:y=!1,loopFocus:I=!1,nested:b=!1,rtl:v=!1,virtual:E=!1,focusItemOnOpen:u="auto",focusItemOnHover:C=!0,openOnArrowKeyDown:h=!0,disabledIndices:k=void 0,orientation:P="vertical",parentOrientation:H,cols:Z=1,scrollItemIntoView:D=!0,itemSizes:oe,dense:ge=!1,id:F,resetOnPointerLeave:Y=!0,externalTree:q}=t,J=an(d),re=_e(J),K=Un(),ee=Hn(q);Q(()=>{l.current.orientation=P},[l,P]);const S=Fn(s),B=a.useRef(u),R=a.useRef(g??-1),M=a.useRef(null),le=a.useRef(!0),O=xe(m=>{p(R.current===-1?null:R.current,m)}),he=a.useRef(O),ae=a.useRef(!!d),A=a.useRef(o),z=a.useRef(!1),ue=a.useRef(!1),ke=_e(k),L=_e(o),ce=_e(D),te=_e(g),pe=_e(Y),ye=xe(()=>{function m(ie){E?ee?.events.emit("virtualfocus",ie):$n(ie,{sync:z.current,preventScroll:!0})}const V=c.current[R.current],N=ue.current;V&&m(V),(z.current?ie=>ie():requestAnimationFrame)(()=>{const ie=c.current[R.current]||V;if(!ie)return;V||m(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=g??-1,B.current&&g!=null&&(ue.current=!0,O())):ae.current&&(R.current=-1,he.current()))},[f,o,d,g,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&&(M.current!=null||B.current===!0&&M.current==null)){let m=0;const V=()=>{c.current[0]==null?(m<2&&(m?requestAnimationFrame:queueMicrotask)(V),m+=1):(R.current=M.current==null||Mt(M.current,P,v)||b?jt(c):Yt(c),M.current=null,O())};V()}}else rt(c,x)||(R.current=x,ye(),ue.current=!1)}},[f,o,d,x,te,b,c,P,v,O,ye,ke]),Q(()=>{if(!f||d||!ee||E||!ae.current)return;const m=ee.nodesRef.current,V=m.find(ie=>ie.id===K)?.context?.elements.floating,N=Bt(Bn(d)),ne=m.some(ie=>ie.context&&tt(ie.context.elements.floating,N));V&&!ne&&le.current&&V.focus({preventScroll:!0})},[f,d,ee,K,E]),Q(()=>{he.current=O,A.current=o,ae.current=!!d}),Q(()=>{o||(M.current=null,B.current=u)},[o,u]);const me=x!=null,X=a.useMemo(()=>{function m(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,m(N)},onClick:({currentTarget:N})=>N.focus({preventScroll:!0}),onMouseMove(N){z.current=!0,ue.current=!1,C&&m(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),E||re.current?.focus({preventScroll:!0}))}}},[L,re,C,c,O,pe,E]),i=a.useCallback(()=>H??ee?.nodesRef.current.find(m=>m.id===K)?.context?.dataRef?.current.orientation,[K,ee,H]),w=xe(m=>{if(le.current=!1,z.current=!0,m.which===229||!L.current&&m.currentTarget===re.current)return;if(b&&Wr(m.key,P,v,Z)){mt(m.key,i())||Se(m),n.setOpen(!1,Me(Nt,m.nativeEvent)),zt(s)&&(E?ee?.events.emit("virtualfocus",s):s.focus());return}const V=R.current,N=jt(c,k),ne=Yt(c,k);if(S||(m.key==="Home"&&(Se(m),R.current=N,O(m)),m.key==="End"&&(Se(m),R.current=ne,O(m))),Z>1){const ie=oe||Array.from({length:c.current.length},()=>({width:1,height:1})),de=Hr(ie,Z,ge),be=de.findIndex(Ne=>Ne!=null&&!st(c,Ne,k)),Re=de.reduce((Ne,Ie,De)=>Ie!=null&&!st(c,Ie,k)?De:Ne,-1),Ve=de[Ur({current:de.map(Ne=>Ne!=null?c.current[Ne]:null)},{event:m,orientation:P,loopFocus:I,rtl:v,cols:Z,disabledIndices:$r([...(typeof k!="function"?k:null)||c.current.map((Ne,Ie)=>st(c,Ie,k)?Ie:void 0),void 0],de),minIndex:be,maxIndex:Re,prevIndex:Fr(R.current>ne?N:R.current,ie,de,Z,m.key===at?"bl":m.key===(v?Fe:$e)?"tr":"tl"),stopEvent:!0})];if(Ve!=null&&(R.current=Ve,O(m)),P==="both")return}if(mt(m.key,P)){if(Se(m),o&&!E&&Bt(m.currentTarget.ownerDocument)===m.currentTarget){R.current=Mt(m.key,P,v)?N:ne,O(m);return}Mt(m.key,P,v)?I?V>=ne?y&&V!==c.current.length?R.current=-1:(z.current=!1,R.current=N):R.current=we(c,{startingIndex:V,disabledIndices:k}):R.current=Math.min(ne,we(c,{startingIndex:V,disabledIndices:k})):I?V<=N?y&&V!==-1?R.current=c.current.length:(z.current=!1,R.current=ne):R.current=we(c,{startingIndex:V,decrement:!0,disabledIndices:k}):R.current=Math.max(N,we(c,{startingIndex:V,decrement:!0,disabledIndices:k})),rt(c,R.current)&&(R.current=-1),O(m)}}),j=a.useMemo(()=>E&&o&&me&&{"aria-activedescendant":`${F}-${x}`},[E,o,me,F,x]),_=a.useMemo(()=>({"aria-orientation":P==="both"?void 0:P,...S?{}:j,onKeyDown(m){if(m.key==="Tab"&&m.shiftKey&&o&&!E){const V=zn(m.nativeEvent);if(V&&!tt(re.current,V))return;Se(m),n.setOpen(!1,Me(ln,m.nativeEvent)),zt(s)&&s.focus();return}w(m)},onPointerMove(){le.current=!0}}),[j,w,re,P,S,n,o,E,s]),G=a.useMemo(()=>{function m(N){u==="auto"&&Wn(N.nativeEvent)&&(B.current=!E)}function V(N){B.current=u,u==="auto"&&Kn(N.nativeEvent)&&(B.current=!0)}return{onKeyDown(N){const ne=n.select("open");le.current=!1;const ie=N.key.startsWith("Arrow"),de=zr(N.key,i(),v),be=mt(N.key,P),Re=(b?de:be)||N.key==="Enter"||N.key.trim()==="";if(E&&ne)return w(N);if(!(!ne&&!h&&ie)){if(Re){const Ve=mt(N.key,i());M.current=b&&Ve?null:N.key}if(b){de&&(Se(N),ne?(R.current=jt(c,ke.current),O(N)):n.setOpen(!0,Me(Nt,N.nativeEvent,N.currentTarget)));return}be&&(te.current!=null&&(R.current=te.current),Se(N),!ne&&h?n.setOpen(!0,Me(Nt,N.nativeEvent,N.currentTarget)):w(N),ne&&O(N))}},onFocus(N){n.select("open")&&!E&&(R.current=-1,O(N))},onPointerDown:V,onPointerEnter:V,onMouseDown:m,onClick:m}},[w,ke,u,c,b,O,n,h,P,i,v,te,E]),ve=a.useMemo(()=>({...j,...G}),[j,G]);return a.useMemo(()=>f?{reference:ve,floating:_,item:X,trigger:G}:{},[f,ve,_,G,X])}function qr(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:g=750,ignoreKeys:y=Tt,selectedIndex:I=null}=t,b=Ke(),v=a.useRef(""),E=a.useRef(I??l??-1),u=a.useRef(null);Q(()=>{o&&(b.clear(),u.current=null,v.current="")},[o,b]),Q(()=>{o&&v.current===""&&(E.current=I??l??-1)},[o,I,l]);const C=xe(H=>{H?d.current.typing||(d.current.typing=H,x?.(H)):d.current.typing&&(d.current.typing=H,x?.(H))}),h=xe(H=>{function Z(Y,q,J){const re=f?f(q,J):q.find(K=>K?.toLocaleLowerCase().indexOf(J.toLocaleLowerCase())===0);return re?Y.indexOf(re):-1}const D=s.current;if(v.current.length>0&&v.current[0]!==" "&&(Z(D,D,v.current)===-1?C(!1):H.key===" "&&Se(H)),D==null||y.includes(H.key)||H.key.length!==1||H.ctrlKey||H.metaKey||H.altKey)return;o&&H.key!==" "&&(Se(H),C(!0)),D.every(Y=>Y?Y[0]?.toLocaleLowerCase()!==Y[1]?.toLocaleLowerCase():!0)&&v.current===H.key&&(v.current="",E.current=u.current),v.current+=H.key,b.start(g,()=>{v.current="",E.current=u.current,C(!1)});const ge=E.current,F=Z(D,[...D.slice((ge||0)+1),...D.slice(0,(ge||0)+1)],v.current);F!==-1?(c?.(F),u.current=F):H.key!==" "&&(v.current="",C(!1))}),k=a.useMemo(()=>({onKeyDown:h}),[h]),P=a.useMemo(()=>({onKeyDown:h,onKeyUp(H){H.key===" "&&C(!1)}}),[h,C]);return a.useMemo(()=>p?{reference:k,floating:P}:{},[p,k,P])}const bn=a.createContext(null),wn=a.createContext(null);function ze(){const e=a.useContext(bn);if(e===null)throw new Error(it(60));return e}function kn(){const e=a.useContext(wn);if(e===null)throw new Error(it(61));return e}let Gt=(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},Gr={valid(e){return e===null?null:e?{[Gt.valid]:""}:{[Gt.invalid]:""}}},Xr=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=Et)=>e,getInputValidationProps:(e=Et)=>e,inputRef:{current:null},commit:async()=>{}}});function Ht(e=!0){const t=a.useContext(Xr);if(t.setValidityData===Pe&&!e)throw new Error(it(28));return t}const Jr=a.createContext({controlId:void 0,setControlId:Pe,labelId:void 0,setLabelId:Pe,messageIds:[],setMessageIds:Pe,getDescriptionProps:e=>e});function vn(){return a.useContext(Jr)}function Rn(e={}){const{id:t,implicit:n=!1,controlRef:o}=e,{controlId:d,setControlId:s}=vn(),l=cn(t);return Q(()=>{if(!(!n&&!t||s===Pe)){if(n){const c=o?.current;qn(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 Qr=(e,t)=>Object.is(e,t);function Qe(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:Qe(o,t,n))}function Ot(e,t,n){return!e||e.length===0?-1:e.findIndex(o=>o===void 0?!1:Qe(o,t,n))}function Zr(e,t,n){return e.filter(o=>!Qe(o,t,n))}function Lt(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 es(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 ts(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 Lt(e)}function Xe(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?Lt(e.value):Lt(e)}function Nn(e,t,n){function o(){return ts(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 ns(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 U={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:Xe(t,o)!==""}),hasNullItemLabel:se((e,t)=>t?es(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=>Qe(s,n,o)):e.selectedIndex===t&&e.selectedIndex!==null?!0:Qe(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)},rs=a.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Pe,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function Cn(){return a.useContext(rs)}function ss(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}function os(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:g}=Ht(),y=xe(e.getValue);Q(()=>{if(!t)return;let I=n;I===void 0&&(I=y()),f.initialValue===null&&I!==null&&g(b=>({...b,initialValue:I}))},[t,g,n,f.initialValue,y]),Q(()=>{!t||!o||c.current.fields.set(o,{getValue:y,name:d,controlRef:s,validityData:ss(f,x),validate(I=!0){let b=n;b===void 0&&(b=y()),p.current=!0,I?on.flushSync(()=>l(b)):l(b)}})},[l,s,t,c,y,o,x,p,d,f,n]),Q(()=>{const I=c.current.fields;return()=>{o&&I.delete(o)}},[c,o])}function as(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 is(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:g=!1,modal:y=!0,actionsRef:I,inputRef:b,onOpenChangeComplete:v,items:E,multiple:u=!1,itemToStringLabel:C,itemToStringValue:h,isItemEqualToValue:k=Qr,highlightItemOnHover:P=!0,children:H}=e,{clearErrors:Z}=Cn(),{setDirty:D,setTouched:oe,setFocused:ge,shouldValidateOnChange:F,validityData:Y,setFilled:q,name:J,disabled:re,validation:K,validationMode:ee}=Ht(),S=Rn({id:t}),B=re||p,R=J??x,[M,le]=qt({controlled:n,default:u?o??Tt:o,name:"Select",state:"value"}),[O,he]=qt({controlled:s,default:l,name:"Select",state:"open"}),ae=a.useRef([]),A=a.useRef([]),z=a.useRef(null),ue=a.useRef(null),ke=a.useRef(0),L=a.useRef(null),ce=a.useRef([]),te=a.useRef(!1),pe=a.useRef(!1),ye=a.useRef(null),me=a.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),X=a.useRef(!1),{mounted:i,setMounted:w,transitionStatus:j}=un(O),{openMethod:_,triggerProps:G,reset:ve}=Yn(O),m=Pt(()=>new tr({id:S,modal:y,multiple:u,itemToStringLabel:C,itemToStringValue:h,isItemEqualToValue:k,value:M,open:O,mounted:i,transitionStatus:j,items:E,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,V=$(m,U.activeIndex),N=$(m,U.selectedIndex),ne=$(m,U.triggerElement),ie=$(m,U.positionerElement),de=a.useMemo(()=>u&&Array.isArray(M)&&M.length===0?"":Xe(M,h),[u,M,h]),be=a.useMemo(()=>u&&Array.isArray(M)?M.map(W=>Xe(W,h)):Xe(M,h),[u,M,h]),Re=_e(m.state.triggerElement);os({id:S,commit:K.commit,value:M,controlRef:Re,name:R,getValue:()=>be});const Ve=a.useRef(M);Q(()=>{M!==Ve.current&&m.set("forceMount",!0)},[m,M]),Q(()=>{q(u?Array.isArray(M)&&M.length>0:M!=null)},[u,M,q]),Q(function(){if(O)return;const fe=ce.current;if(u){const Ee=Array.isArray(M)?M:[];if(Ee.length===0){m.set("selectedIndex",null);return}const Ce=Ee[Ee.length-1],ft=Ot(fe,Ce,k);m.set("selectedIndex",ft===-1?null:ft);return}const Te=Ot(fe,M,k);m.set("selectedIndex",Te===-1?null:Te)},[u,O,M,ce,k,m]),as(M,()=>{Z(R),D(M!==Y.initialValue),F()?K.commit(M):K.commit(M,!0)});const Ne=xe((W,fe)=>{if(c?.(W,fe),!fe.isCanceled&&(he(W),!W&&(fe.reason===ln||fe.reason===nr)&&(oe(!0),ge(!1),ee==="onBlur"&&K.commit(M)),!W&&m.state.activeIndex!==null)){const Te=ae.current[m.state.activeIndex];queueMicrotask(()=>{Te?.setAttribute("tabindex","-1")})}}),Ie=xe(()=>{w(!1),m.set("activeIndex",null),ve(),v?.(!1)});_t({enabled:!I,open:O,ref:z,onComplete(){O||Ie()}}),a.useImperativeHandle(I,()=>({unmount:Ie}),[Ie]);const De=xe((W,fe)=>{d?.(W,fe),!fe.isCanceled&&le(W)}),Ae=xe(()=>{const W=m.state.listElement||z.current;if(!W)return;const fe=W.scrollTop,Te=W.scrollTop+W.clientHeight,Ee=fe>1,Ce=Te<W.scrollHeight-1;m.state.scrollUpArrowVisible!==Ee&&m.set("scrollUpArrowVisible",Ee),m.state.scrollDownArrowVisible!==Ce&&m.set("scrollDownArrowVisible",Ce)}),Oe=Gn({open:O,onOpenChange:Ne,elements:{reference:ne,floating:ie}}),lt=Xn(Oe,{enabled:!f&&!B,event:"mousedown"}),Ze=Jn(Oe,{bubbles:!1}),Le=Kr(Oe,{enabled:!f&&!B,listRef:ae,activeIndex:V,selectedIndex:N,disabledIndices:Tt,onNavigate(W){W===null&&!O||m.set("activeIndex",W)},focusItemOnHover:!1}),vt=qr(Oe,{enabled:!f&&!B&&(O||!u),listRef:A,activeIndex:V,selectedIndex:N,onMatch(W){O?m.set("activeIndex",W):De(ce.current[W],Me("none"))},onTypingChange(W){te.current=W}}),{getReferenceProps:qe,getFloatingProps:Ye,getItemProps:ct}=Qn([lt,Ze,Le,vt]),et=a.useMemo(()=>dn(qe(),G,S?{id:S}:Et),[qe,G,S]);_r(()=>{m.update({popupProps:Ye(),triggerProps:et})}),Q(()=>{m.update({id:S,modal:y,multiple:u,value:M,open:O,mounted:i,transitionStatus:j,popupProps:Ye(),triggerProps:et,items:E,itemToStringLabel:C,itemToStringValue:h,isItemEqualToValue:k,openMethod:_})},[m,S,y,u,M,O,i,j,Ye,et,E,C,h,k,_]);const ut=a.useMemo(()=>({store:m,name:R,required:g,disabled:B,readOnly:f,multiple:u,itemToStringLabel:C,itemToStringValue:h,highlightItemOnHover:P,setValue:De,setOpen:Ne,listRef:ae,popupRef:z,scrollHandlerRef:ue,handleScrollArrowVisibility:Ae,scrollArrowsMountedCountRef:ke,getItemProps:ct,events:Oe.context.events,valueRef:L,valuesRef:ce,labelsRef:A,typingRef:te,selectionRef:me,selectedItemTextRef:ye,validation:K,onOpenChangeComplete:v,keyboardActiveRef:pe,alignItemWithTriggerActiveRef:X,initialValueRef:Ve}),[m,R,g,B,f,u,C,h,P,De,Ne,ct,Oe.context.events,K,v,Ae]),dt=fn(b,K.inputRef),Rt=u&&Array.isArray(M)&&M.length>0,St=a.useMemo(()=>!u||!Array.isArray(M)||!R?null:M.map(W=>{const fe=Xe(W,h);return r.jsx("input",{type:"hidden",name:R,value:fe},fe)}),[u,M,R,h]);return r.jsx(bn.Provider,{value:ut,children:r.jsxs(wn.Provider,{value:Oe,children:[H,r.jsx("input",{...K.getInputValidationProps({onFocus(){m.state.triggerElement?.focus({focusVisible:!0})},onChange(W){if(W.nativeEvent.defaultPrevented)return;const fe=W.target.value,Te=Me(Ut,W.nativeEvent);function Ee(){if(u)return;const Ce=ce.current.find(ft=>Xe(ft,h).toLowerCase()===fe.toLowerCase());Ce!=null&&(D(Ce!==Y.initialValue),De(Ce,Te),F()&&K.commit(Ce))}m.set("forceMount",!0),queueMicrotask(Ee)}}),name:u?void 0:R,value:de,disabled:B,required:g&&!Rt,readOnly:f,ref:dt,style:R?Zn:er,tabIndex:-1,"aria-hidden":!0}),St]})})}function ls(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),g=p-t.width,y=f-t.height;return{left:t.left-g/2,right:t.right+g/2,top:t.top-y/2,bottom:t.bottom+y/2}}const ht=2,cs=400,Xt=200,us={...rr,...Gr,value:()=>null},ds=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:g,state:y,disabled:I}=Ht(),{labelId:b}=vn(),{store:v,setOpen:E,selectionRef:u,validation:C,readOnly:h,required:k,alignItemWithTriggerActiveRef:P,disabled:H,keyboardActiveRef:Z}=ze(),D=I||H||l,oe=$(v,U.open),ge=$(v,U.value),F=$(v,U.triggerProps),Y=$(v,U.positionerElement),q=$(v,U.listElement),J=$(v,U.id),re=$(v,U.hasSelectedValue),K=!re&&oe,ee=$(v,U.hasNullItemLabel,K),S=s??J;Rn({id:S});const B=_e(Y),R=a.useRef(null),{getButtonProps:M,buttonRef:le}=gn({disabled:D,native:c}),O=xe(te=>{v.set("triggerElement",te)}),he=fn(n,R,le,O),ae=Ke(),A=Ke(),z=Ke(),ue=Ke();a.useEffect(()=>{if(oe)return!(re||ee)?z.start(cs,()=>{u.current.allowUnselectedMouseUp=!0,u.current.allowSelectedMouseUp=!0}):ue.start(Xt,()=>{u.current.allowUnselectedMouseUp=!0,z.start(Xt,()=>{u.current.allowSelectedMouseUp=!0})}),()=>{z.clear(),ue.clear()};u.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},A.clear()},[oe,re,ee,u,A,z,ue]);const ke=a.useMemo(()=>q?.id??an(Y)?.id,[q,Y]),L=dn(F,{id:S,role:"combobox","aria-expanded":oe?"true":"false","aria-haspopup":"listbox","aria-controls":oe?ke:void 0,"aria-labelledby":b,"aria-readonly":h||void 0,"aria-required":k||void 0,tabIndex:D?-1:0,ref:he,onFocus(te){f(!0),oe&&P.current&&E(!1,Me(Ut,te.nativeEvent)),ae.start(0,()=>{v.set("forceMount",!0)})},onBlur(te){tt(Y,te.relatedTarget)||(p(!0),f(!1),g==="onBlur"&&C.commit(ge))},onPointerMove(){Z.current=!1},onKeyDown(){Z.current=!0},onMouseDown(te){if(oe)return;const pe=At(te.currentTarget);function ye(me){if(!R.current)return;const X=me.target;if(tt(R.current,X)||tt(B.current,X)||X===R.current)return;const i=ls(R.current);me.clientX>=i.left-ht&&me.clientX<=i.right+ht&&me.clientY>=i.top-ht&&me.clientY<=i.bottom+ht||E(!1,Me(sr,me))}A.start(0,()=>{pe.addEventListener("mouseup",ye,{once:!0})})}},C.getValidationProps,x,M);L.role="combobox";const ce=a.useMemo(()=>({...y,open:oe,disabled:D,value:ge,readOnly:h,placeholder:!re}),[y,oe,D,ge,h,re]);return He("button",t,{ref:[n,R],state:ce,stateAttributesMapping:us,props:L})}),fs={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,U.value),g=$(x,U.items),y=$(x,U.itemToStringLabel),I=$(x,U.hasSelectedValue),b=!I&&l!=null&&s==null,v=$(x,U.hasNullItemLabel,b),E=a.useMemo(()=>({value:f,placeholder:!I}),[f,I]);let u=null;return typeof s=="function"?u=s(f):s!=null?u=s:!I&&l!=null&&!v?u=l:Array.isArray(f)?u=ns(f,g,y):u=Nn(f,g,y),He("span",t,{state:E,ref:[n,p],props:[{children:u},c],stateAttributesMapping:fs})}),ms=a.forwardRef(function(t,n){const{className:o,render:d,...s}=t,{store:l}=ze(),c=$(l,U.open),x=a.useMemo(()=>({open:c}),[c]);return He("span",t,{state:x,ref:n,props:[{"aria-hidden":!0,children:"▼"},s],stateAttributesMapping:or})}),hs=a.createContext(void 0),ps=a.forwardRef(function(t,n){const{store:o}=ze(),d=$(o,U.mounted),s=$(o,U.forceMount);return d||s?r.jsx(hs.Provider,{value:!0,children:r.jsx(ar,{ref:n,...t})}):null}),jn=a.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function xs(){return a.useContext(jn)}function ys(e){const{children:t,elementsRef:n,labelsRef:o,onMapChange:d}=e,s=xe(d),l=a.useRef(0),c=Pt(ws).current,x=Pt(bs).current,[p,f]=a.useState(0),g=a.useRef(p),y=xe((u,C)=>{x.set(u,C??null),g.current+=1,f(g.current)}),I=xe(u=>{x.delete(u),g.current+=1,f(g.current)}),b=a.useMemo(()=>{const u=new Map;return Array.from(x.keys()).filter(h=>h.isConnected).sort(ks).forEach((h,k)=>{const P=x.get(h)??{};u.set(h,{...P,index:k})}),u},[x,p]);Q(()=>{if(typeof MutationObserver!="function"||b.size===0)return;const u=new MutationObserver(C=>{const h=new Set,k=P=>h.has(P)?h.delete(P):h.add(P);C.forEach(P=>{P.removedNodes.forEach(k),P.addedNodes.forEach(k)}),h.size===0&&(g.current+=1,f(g.current))});return b.forEach((C,h)=>{h.parentElement&&u.observe(h.parentElement,{childList:!0})}),()=>{u.disconnect()}},[b]),Q(()=>{g.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 E=a.useMemo(()=>({register:y,unregister:I,subscribeMapChange:v,elementsRef:n,labelsRef:o,nextIndexRef:l}),[y,I,v,n,o,l]);return r.jsx(jn.Provider,{value:E,children:t})}function bs(){return new Map}function ws(){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 vs(){const e=a.useContext(Mn);if(!e)throw new Error(it(59));return e}function bt(e,t){e&&Object.assign(e.style,t)}const Rs={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},Ss={position:"fixed"},Ns=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:g="clipping-ancestors",collisionPadding:y,arrowPadding:I=5,sticky:b=!1,disableAnchorTracking:v,alignItemWithTrigger:E=!0,collisionAvoidance:u=ir,...C}=t,{store:h,listRef:k,labelsRef:P,alignItemWithTriggerActiveRef:H,selectedItemTextRef:Z,valuesRef:D,initialValueRef:oe,popupRef:ge,setValue:F}=ze(),Y=kn(),q=$(h,U.open),J=$(h,U.mounted),re=$(h,U.modal),K=$(h,U.value),ee=$(h,U.openMethod),S=$(h,U.positionerElement),B=$(h,U.triggerElement),R=$(h,U.isItemEqualToValue),M=a.useRef(null),le=a.useRef(null),[O,he]=a.useState(E),ae=J&&O&&ee!=="touch";!J&&O!==E&&he(E),Q(()=>{J||(U.scrollUpArrowVisible(h.state)&&h.set("scrollUpArrowVisible",!1),U.scrollDownArrowVisible(h.state)&&h.set("scrollDownArrowVisible",!1))},[h,J]),a.useImperativeHandle(H,()=>ae),lr((ae||re)&&q&&ee!=="touch",B);const A=cr({anchor:o,floatingRootContext:Y,positionMethod:d,mounted:J,side:c,sideOffset:p,align:x,alignOffset:f,arrowPadding:I,collisionBoundary:g,collisionPadding:y,sticky:b,disableAnchorTracking:v??ae,collisionAvoidance:u,keepMounted:!0}),z=ae?"none":A.side,ue=ae?Ss:A.positionerStyles,ke=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=He("div",t,{ref:[n,ce],state:L,stateAttributesMapping:mn,props:[ke,C]}),pe=a.useRef(0),ye=xe(X=>{if(X.size===0&&pe.current===0||D.current.length===0)return;const i=pe.current;if(pe.current=X.size,X.size===i)return;const w=Me(Ut);if(i!==0&&!h.state.multiple&&K!==null&&Ot(D.current,K,R)===-1){const _=oe.current,ve=_!=null&&It(D.current,_,R)?_:null;F(ve,w),ve===null&&(h.set("selectedIndex",null),Z.current=null)}if(i!==0&&h.state.multiple&&Array.isArray(K)){const j=K.filter(_=>It(D.current,_,R));(j.length!==K.length||j.some(_=>!It(K,_,R)))&&(F(j,w),j.length===0&&(h.set("selectedIndex",null),Z.current=null))}if(q&&ae){h.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const j={height:""};bt(S,j),bt(ge.current,j)}}),me=a.useMemo(()=>({...A,side:z,alignItemWithTriggerActive:ae,setControlledAlignItemWithTrigger:he,scrollUpArrowRef:M,scrollDownArrowRef:le}),[A,z,ae,he]);return r.jsx(ys,{elementsRef:k,labelsRef:P,onMapChange:ye,children:r.jsxs(Mn.Provider,{value:me,children:[J&&re&&r.jsx(ur,{inert:dr(!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",Jt={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 Cs(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}const js=a.createContext(void 0),Ms={disableStyleElements:!1};function Is(){return a.useContext(js)??Ms}const Ts={...mn,...hn},Es=a.forwardRef(function(t,n){const{render:o,className:d,...s}=t,{store:l,popupRef:c,onOpenChangeComplete:x,setOpen:p,valueRef:f,selectedItemTextRef:g,keyboardActiveRef:y,multiple:I,handleScrollArrowVisibility:b,scrollHandlerRef:v,highlightItemOnHover:E}=ze(),{side:u,align:C,alignItemWithTriggerActive:h,setControlledAlignItemWithTrigger:k,scrollDownArrowRef:P,scrollUpArrowRef:H}=vs(),Z=fr()!=null,D=kn(),{nonce:oe,disableStyleElements:ge}=Is(),F=Ke(),Y=$(l,U.id),q=$(l,U.open),J=$(l,U.mounted),re=$(l,U.popupProps),K=$(l,U.transitionStatus),ee=$(l,U.triggerElement),S=$(l,U.positionerElement),B=$(l,U.listElement),R=a.useRef(0),M=a.useRef(!1),le=a.useRef(0),O=a.useRef(!1),he=a.useRef({}),ae=gr(),A=xe(L=>{if(!S||!c.current||!O.current)return;if(M.current||!h){b();return}const ce=S.style.top==="0px",te=S.style.bottom==="0px",pe=S.getBoundingClientRect().height,ye=At(S),me=getComputedStyle(S),X=parseFloat(me.marginTop),i=parseFloat(me.marginBottom),w=Qt(getComputedStyle(c.current)),j=ye.documentElement.clientHeight-X-i,_=L.scrollTop,G=L.scrollHeight,ve=L.clientHeight,m=G-ve;let V=0,N=null,ne=!1;if(ce){const ie=m-_,de=pe+ie,be=Math.min(de,j);V=be,be!==j?N=m:ne=!0}else if(te){const ie=_-0,de=pe+ie,be=Math.min(de,j),Re=de-j;V=be,be!==j?N=0:(ne=!0,_<m&&(N=_-(ie-Re)))}V!==0&&(S.style.height=`${V}px`),N!=null&&(L.scrollTop=N),(ne||V>=w)&&(M.current=!0),b()});a.useImperativeHandle(v,()=>A,[A]),_t({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,M.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=As(L);L.style.removeProperty("--transform-origin");try{const te=getComputedStyle(S),pe=getComputedStyle(L),ye=At(ee),me=Wt(S),X=ee.getBoundingClientRect(),i=S.getBoundingClientRect(),w=X.left,j=X.height,_=B||L,G=_.scrollHeight,ve=parseFloat(pe.borderBottomWidth),m=parseFloat(te.marginTop)||10,V=parseFloat(te.marginBottom)||10,N=parseFloat(te.minHeight)||100,ne=Qt(pe),ie=5,de=5,be=20,Re=ye.documentElement.clientHeight-m-V,Ve=ye.documentElement.clientWidth,Ne=Re-X.bottom+j,Ie=g.current,De=f.current;let Ae,Oe=0,lt=0;if(Ie&&De){const W=De.getBoundingClientRect();Ae=Ie.getBoundingClientRect();const fe=W.left-w,Te=Ae.left-i.left,Ee=W.top-X.top+W.height/2,Ce=Ae.top-i.top+Ae.height/2;Oe=fe-Te,lt=Ce-Ee}const Ze=Ne+lt+V+ve;let Le=Math.min(Re,Ze);const vt=Re-m-V,qe=Ze-Le,Ye=Math.max(ie,w+Oe),ct=Ve-de,et=Math.max(0,Ye+i.width-ct);S.style.left=`${Ye-et}px`,S.style.height=`${Le}px`,S.style.maxHeight="auto",S.style.marginTop=`${m}px`,S.style.marginBottom=`${V}px`,L.style.height="100%";const ut=_.scrollHeight-_.clientHeight,dt=qe>=ut;dt&&(Le=Math.min(Re,i.height)-(qe-ut));const Rt=X.top<be||X.bottom>Re-be||Le<Math.min(G,N),St=(me.visualViewport?.scale??1)!==1&&mr;if(Rt||St){O.current=!0,bt(S,he.current),on.flushSync(()=>k(!1));return}if(dt){const W=Math.max(0,Re-Ze);S.style.top=i.height>=vt?"0":`${W}px`,S.style.height=`${Le}px`,_.scrollTop=_.scrollHeight-_.clientHeight,R.current=Math.max(N,Le)}else S.style.bottom="0",R.current=Math.max(N,Le),_.scrollTop=qe;if(Ae){const W=i.top,fe=i.height,Te=Ae.top+Ae.height/2,Ee=fe>0?(Te-W)/fe*100:50,Ce=Cs(Ee,0,100);L.style.setProperty("--transform-origin",`50% ${Ce}%`)}(R.current===Re||Le>=ne)&&(M.current=!0),b(),setTimeout(()=>{O.current=!0})}finally{ce()}})}},[l,q,S,ee,f,g,c,b,h,k,ae,P,H,B]),a.useEffect(()=>{if(!h||!S||!q)return;const L=Wt(S);function ce(te){p(!1,Me(pr,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":I||void 0,id:`${Y}-list`},onKeyDown(L){y.current=!0,Z&&yr.has(L.key)&&L.stopPropagation()},onMouseMove(){y.current=!1},onPointerLeave(L){if(!E||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%"}:Rs}},ke=He("div",t,{ref:[n,c],state:z,stateAttributesMapping:Ts,props:[re,ue,xr(K),{className:!B&&h?Jt.className:void 0},s]});return r.jsxs(a.Fragment,{children:[!ge&&Jt.getElement(oe),r.jsx(hr,{context:D,modal:!1,disabled:!J,restoreFocus:!0,children:ke})]})});function Qt(e){const t=e.maxHeight||"";return t.endsWith("px")&&parseFloat(t)||1/0}const Zt={transform:"none",scale:"1",translate:"0 0"};function Ps(e,t,n){n?e.setProperty(t,n):e.removeProperty(t)}function As(e){const{style:t}=e,n={},o=Object.keys(Zt);for(const d of o)n[d]=t.getPropertyValue(d),t.setProperty(d,Zt[d]);return()=>{for(const d of o)Ps(t,d,n[d])}}let Tn=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function Os(e={}){const{label:t,metadata:n,textRef:o,indexGuessBehavior:d,index:s}=e,{register:l,unregister:c,subscribeMapChange:x,elementsRef:p,labelsRef:f,nextIndexRef:g}=xs(),y=a.useRef(-1),[I,b]=a.useState(s??(d===Tn.GuessFromOrder?()=>{if(y.current===-1){const u=g.current;g.current+=1,y.current=u}return y.current}:-1)),v=a.useRef(null),E=a.useCallback(u=>{if(v.current=u,I!==-1&&u!==null&&(p.current[I]=u,f)){const C=t!==void 0;f.current[I]=C?t:o?.current?.textContent??u.textContent}},[I,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:E,index:I}),[I,E])}const En=a.createContext(void 0);function Ft(){const e=a.useContext(En);if(!e)throw new Error(it(57));return e}const en=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),g=Os({label:l,textRef:f,indexGuessBehavior:Tn.GuessFromOrder}),{store:y,getItemProps:I,setOpen:b,setValue:v,selectionRef:E,typingRef:u,valuesRef:C,keyboardActiveRef:h,multiple:k,highlightItemOnHover:P}=ze(),H=Ke(),Z=$(y,U.isActive,g.index),D=$(y,U.isSelected,g.index,s),oe=$(y,U.isSelectedByFocus,g.index),ge=$(y,U.isItemEqualToValue),F=g.index,Y=F!==-1,q=a.useRef(null),J=_e(F);Q(()=>{if(!Y)return;const A=C.current;return A[F]=s,()=>{delete A[F]}},[Y,F,s,C]),Q(()=>{if(!Y)return;const A=y.state.value;let z=A;k&&Array.isArray(A)&&A.length>0&&(z=A[A.length-1]),z!==void 0&&Qe(z,s,ge)&&y.set("selectedIndex",F)},[Y,F,k,ge,y,s]);const re=a.useMemo(()=>({disabled:c,selected:D,highlighted:Z}),[c,D,Z]),K=I({active:Z,selected:D});K.onFocus=void 0,K.id=void 0;const ee=a.useRef(null),S=a.useRef("mouse"),B=a.useRef(!1),{getButtonProps:R,buttonRef:M}=gn({disabled:c,focusableWhenDisabled:!0,native:x});function le(A){const z=y.state.value;if(k){const ue=Array.isArray(z)?z:[],ke=D?Zr(ue,s,ge):[...ue,s];v(ke,Me(Ct,A))}else v(s,Me(Ct,A)),b(!1,Me(Ct,A))}const O={role:"option","aria-selected":D,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)||H.start(0,()=>{y.state.activeIndex===F&&y.set("activeIndex",null)})},onTouchStart(){E.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=!E.current.allowSelectedMouseUp&&D,ue=!E.current.allowUnselectedMouseUp&&!D;z||ue||S.current!=="touch"&&!Z||le(A.nativeEvent)}},he=He("div",t,{ref:[M,n,g.ref,q],state:re,props:[K,O,p,R]}),ae=a.useMemo(()=>({selected:D,indexRef:J,textRef:f,selectedByFocus:oe,hasRegistered:Y}),[D,J,f,oe,Y]);return r.jsx(En.Provider,{value:ae,children:he})})),tn=a.forwardRef(function(t,n){const o=t.keepMounted??!1,{selected:d}=Ft();return o||d?r.jsx(Ls,{...t,ref:n}):null}),Ls=a.memo(a.forwardRef((e,t)=>{const{render:n,className:o,keepMounted:d,...s}=e,{selected:l}=Ft(),c=a.useRef(null),{transitionStatus:x,setMounted:p}=un(l),f=a.useMemo(()=>({selected:l,transitionStatus:x}),[l,x]),g=He("span",e,{ref:[t,c],state:f,props:[{"aria-hidden":!0,children:"✔️"},s],stateAttributesMapping:hn});return _t({open:l,ref:c,onComplete(){l||p(!1)}}),g})),nn=a.memo(a.forwardRef(function(t,n){const{indexRef:o,textRef:d,selectedByFocus:s,hasRegistered:l}=Ft(),{selectedItemTextRef:c}=ze(),{className:x,render:p,...f}=t,g=a.useCallback(I=>{if(!I||!l)return;const b=c.current===null||!c.current.isConnected;(s||b&&o.current===0)&&(c.current=I)},[c,o,s,l]);return He("div",t,{ref:[g,n,d],props:f})})),Vs=a.forwardRef(function(t,n){const{render:o,className:d,id:s,...l}=t,{store:c}=br(),x=cn(s);return c.useSyncedValueWithCleanup("descriptionElementId",x),He("p",t,{ref:n,props:[{id:x},l]})});function Ds({open:e,title:t,description:n,confirmLabel:o,cancelLabel:d,destructive:s=!1,busy:l=!1,onConfirm:c,onCancel:x}){return r.jsx(wr,{open:e,onOpenChange:p=>{!p&&!l&&x?.()},children:r.jsxs(kr,{children:[r.jsx(vr,{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(Rr,{className:"fixed inset-0 z-[101] flex items-center justify-center p-4",children:r.jsxs(Sr,{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(Nr,{className:"text-base font-semibold text-oai-black dark:text-white",children:t}),n?r.jsx(Vs,{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(Ue,{type:"button",variant:"secondary",size:"sm",disabled:l,onClick:()=>x?.(),children:d}),r.jsx(Ue,{type:"button",size:"sm",disabled:l,onClick:()=>c?.(),className:Je(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 kt(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 Ln(),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 _s(){return kt({mode:"installed"})}function Us(e={}){return kt({mode:"discover",...e.force?{force:1}:{}})}function Hs(e,t=0,n=20){return kt({mode:"search",q:e,offset:t,limit:n})}function Fs(){return kt({mode:"repos"})}function $s(e,t){return We({action:"install",skill:e,targets:t})}function Bs(e){return We({action:"uninstall",id:e})}function zs(e){return We({action:"restore",id:e})}function Ws(e,t){return We({action:"set_targets",id:e,targets:t})}function Ks(e,t){return We({action:"import_local",directory:e,targets:t})}function qs(e,t){return We({action:"delete_local",directory:e,targets:t||[]})}function Ys(e){return We({action:"add_repo",repo:e})}function Gs(e,t){return We({action:"remove_repo",owner:e,name:t})}const rn=["claude","codex"],Xs={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"},Ge="all",je="skillssh";function xt(e){return`${e.repoOwner||"local"}/${e.repoName||"local"}:${e.directory}`}function sn(e){return`install:${xt(e)}`}function Vt(e){return`remove:${e.id||e.directory}`}function On(e,t){return`target:${e}:${t}`}function Js({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":T("skills.target.toggle_aria",{target:s.label}),title:T(x,{target:s.label}),disabled:c,onClick:()=>o(e,s.id,!l),className:Je("inline-flex h-8 w-8 items-center justify-center rounded-md transition disabled:cursor-wait disabled:opacity-70",l?Xs[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 Qs({skill:e,targets:t,busyKey:n,onToggleTarget:o,onRemove:d}){const s=n===Vt(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(Js,{skill:e,targets:t,busyKey:n,onToggleTarget:o}),r.jsx("button",{type:"button","aria-label":T("skills.action.remove"),title:T("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 Zs({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:T("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(Qs,{skill:s,targets:t,busyKey:n,onToggleTarget:o,onRemove:d},s.id||s.key))})]})}const eo={contentVisibility:"auto",containIntrinsicSize:"0 240px"},to=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(E=>E!==b):[...v,b])},f=t.repoOwner&&t.repoName?`${t.repoOwner}/${t.repoName}`:null,g=t.installs!=null?T("skills.card.installs",{count:Number(t.installs||0).toLocaleString()}):null,y=[f,g].filter(Boolean).join(" · "),I=c.length?c.map(b=>d.find(v=>v.id===b)?.label||b).join(", "):T("skills.action.choose_targets");return r.jsxs(_n,{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-md bg-oai-black/[0.06] px-2 py-1 text-xs font-medium text-oai-gray-700 ring-1 ring-oai-black/10 dark:bg-white/[0.08] dark:text-oai-gray-200 dark:ring-white/10",children:[r.jsx(nt,{className:"h-3 w-3","aria-hidden":!0}),T("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("div",{className:"inline-flex h-8 w-full items-center justify-center gap-1.5 rounded-md bg-oai-black/[0.04] text-sm font-medium text-oai-gray-700 ring-1 ring-inset ring-oai-black/[0.08] dark:bg-white/[0.05] dark:text-oai-gray-200 dark:ring-white/[0.08]",children:[r.jsx(nt,{className:"h-3.5 w-3.5","aria-hidden":!0}),T("skills.card.installed")]}):r.jsxs("div",{className:"flex",children:[r.jsxs(Ue,{type:"button",size:"sm",onClick:()=>l(t,c),disabled:o||c.length===0,className:"flex-1 !rounded-r-none",title:I,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?T("skills.action.install_to",{count:c.length}):T("skills.action.install")]}),r.jsxs(Cr,{children:[r.jsx(jr,{disabled:o,"aria-label":T("skills.action.choose_targets"),title:I,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(Mr,{children:r.jsx(Ir,{sideOffset:6,side:"bottom",align:"end",className:"!z-[80]",children:r.jsxs(Tr,{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:T("skills.target.menu_label")}),d.map(b=>{const v=c.includes(b.id);return r.jsxs("button",{type:"button",onClick:()=>p(b.id),className:Je("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(nt,{className:"h-3.5 w-3.5 text-emerald-500","aria-hidden":!0}):null]},b.id)})]})})})]})]})})]})});function no({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:T("skills.repo.placeholder"),className:"min-w-0 flex-1"}),r.jsxs(Ue,{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}),T("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(Ue,{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:T("skills.repo.remove")})]})]},`${l.owner}/${l.name}`)})}):null]})}function ro(){return typeof window>"u"?"my":new URLSearchParams(window.location.search).get("tab")==="browse"?"browse":"my"}function fo(){const[e,t]=a.useState(ro),[n,o]=a.useState({skills:[],targets:[]}),[d,s]=a.useState([]),[l,c]=a.useState([]),[x,p]=a.useState([]),[f,g]=a.useState(Ge),[y,I]=a.useState(""),[b,v]=a.useState(""),[E,u]=a.useState(""),[C,h]=a.useState(!1),[k,P]=a.useState(""),[H,Z]=a.useState(!0),[D,oe]=a.useState(!1),[ge,F]=a.useState(""),[Y,q]=a.useState(null),[J,re]=a.useState(null),K=a.useMemo(()=>{const i=new Set;for(const w of n.skills||[]){i.add(xt(w).toLowerCase()),w.repoOwner&&w.repoName&&i.add(`${w.repoOwner}/${w.repoName}:${w.sourceDirectory||w.directory}`.toLowerCase());const j=String(w.directory||"").split(/[\\/]/).pop().toLowerCase();j&&i.add(`dir:${j}`)}return i},[n.skills]),ee=a.useCallback(async()=>{const i=await _s();o({skills:i.skills||[],targets:i.targets||[]})},[]),S=a.useCallback(async()=>{const i=await Fs();p(i.repos||[])},[]),B=a.useCallback(async({force:i=!1}={})=>{oe(!0);try{const w=await Us({force:i});s(w.skills||[])}finally{oe(!1)}},[]),R=a.useCallback(async()=>{Z(!0),F("");try{await Promise.all([ee(),S()])}catch(i){F(i?.message||T("skills.error.generic"))}finally{Z(!1)}},[ee,S]),M=a.useCallback(async()=>{await R(),e==="browse"&&f!==je&&B({force:!0}).catch(i=>F(i?.message||T("skills.error.generic")))},[B,R,f,e]);a.useEffect(()=>{R()},[R]),a.useEffect(()=>{e==="browse"&&f!==je&&d.length===0&&B().catch(i=>F(i?.message||T("skills.error.generic")))},[d.length,B,f,e]),a.useEffect(()=>{if(!J)return;const i=setTimeout(()=>re(w=>w?.key===J.key?null:w),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),w=i.get("tab");if(e==="my"){if(!w)return;i.delete("tab")}else{if(w===e)return;i.set("tab",e)}const j=i.toString(),_=`${window.location.pathname}${j?`?${j}`:""}${window.location.hash}`;window.history.replaceState({},"",_)},[e]);const le=async(i,w)=>{P(i),F("");try{await w(),await ee()}catch(j){F(j?.message||T("skills.error.generic"))}finally{P("")}},O=(i,w)=>{const j=(w&&w.length?w:rn).filter(_=>(n.targets||[]).some(G=>G.id===_));le(sn(i),async()=>{await $s(i,j);const _=j.map(G=>(n.targets||[]).find(ve=>ve.id===G)?.label||G).join(", ");re({key:`${Date.now()}:install:${xt(i)}`,message:T("skills.toast.installed",{name:i.name||i.directory,targets:_||T("skills.target.none")}),ttlMs:4e3})})},he=i=>{q(i)},ae=()=>{const i=Y;i&&(q(null),le(Vt(i),async()=>{let w=null;i.managed?w=await Bs(i.id):await qs(i.directory,i.targets||[]);const j=!!(w?.trashed&&i.managed&&i.id);re({key:`${Date.now()}:${i.id||i.directory}`,message:T("skills.toast.removed",{name:i.name||i.directory}),undo:j?async()=>{try{await zs(i.id),await ee(),re(null)}catch(_){F(_?.message||T("skills.error.generic"))}}:null,ttlMs:5e3})}))},A=(i,w,j)=>le(On(i.id,w),async()=>{const _=new Set(i.targets||[]);j?_.add(w):_.delete(w),i.managed?await Ws(i.id,Array.from(_)):await Ks(i.directory,Array.from(_))}),z=async()=>{const i=y.trim();if(!(i.length<2)){P("search"),F("");try{const w=await Hs(i);c(w.skills||[])}catch(w){F(w?.message||T("skills.error.generic"))}finally{P("")}}},ue=async()=>{const i=E.trim().replace(/^https:\/\/github\.com\//,"").replace(/\.git$/,""),[w,j]=i.split("/");if(!w||!j){F(T("skills.repo.invalid"));return}await le("repo:add",async()=>{await Ys({owner:w,name:j,branch:"main",enabled:!0}),u(""),await S(),await B()})},ke=async i=>{await le(`repo:${i.owner}/${i.name}`,async()=>{await Gs(i.owner,i.name),await S(),await B()})},L=n.targets||[],ce=n.skills||[],te=a.useMemo(()=>{const i=f===je?l:d,w=f===je||f===Ge?i:i.filter(G=>`${G.repoOwner}/${G.repoName}`===f),j=b.trim().toLowerCase();return(f===je||!j?w:w.filter(G=>(G.name||"").toLowerCase().includes(j)||(G.directory||"").toLowerCase().includes(j)||(G.description||"").toLowerCase().includes(j))).map(G=>{const ve=xt(G).toLowerCase(),m=String(G.directory||"").split(/[\\/]/).pop().toLowerCase(),V=m?`dir:${m}`:"";return{...G,installed:K.has(ve)||V&&K.has(V)}})},[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:T("skills.browse.loading_hint")})]}),me=(i,w=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:T(i)}),w]});let X;if(H)X=pe;else if(e==="my")X=ce.length?r.jsx(Zs,{items:ce,targets:L,busyKey:k,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,w)=>r.jsx("span",{className:"shrink-0 px-3",children:r.jsx(yt,{provider:i.id,size:30})},`b-${w}`))})}),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,w)=>r.jsx("span",{className:"shrink-0 px-3",children:r.jsx(yt,{provider:i.id,size:30})},`c-${w}`))})}),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:T("skills.empty.my")}),r.jsx(Ue,{type:"button",size:"sm",onClick:()=>t("browse"),children:T("skills.empty.my_cta")})]});else{const i=f===je,w=x.length===0&&!i;let j;w?j=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:T("skills.browse.empty_sources")})}):D&&!i?j=ye:i&&y.trim().length<2?j=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:T("skills.browse.hint_skillssh")}):te.length?j=r.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:te.map(G=>r.jsx("div",{style:eo,children:r.jsx(to,{skill:G,installed:!!G.installed,installing:k===sn(G),allTargets:L,defaultTargets:rn,onInstall:O})},G.id||G.key))}):i?j=me("skills.empty.search"):j=me("skills.empty.browse");const _=w||C?r.jsx("div",{className:"mb-5",children:r.jsx(no,{repos:x,repoInput:E,onRepoInput:u,busyKey:k,onAdd:ue,onRemove:ke})}):null;X=r.jsxs(r.Fragment,{children:[_,j]})}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:T("skills.page.title")}),r.jsxs(Ue,{type:"button",variant:"secondary",size:"sm",onClick:M,disabled:H||D,children:[r.jsx(Vn,{className:Je("mr-1.5 h-3.5 w-3.5",(H||D)&&"animate-spin"),"aria-hidden":!0}),T("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",T("skills.tab.my")],["browse",T("skills.tab.browse")]].map(([i,w])=>r.jsx("button",{type:"button","aria-pressed":e===i,onClick:()=>t(i),className:Je("-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:w},i))}),ge?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:ge}):null,e==="browse"?r.jsxs("div",{className:"mb-5 flex flex-col gap-3 sm:flex-row sm:items-center",children:[r.jsx("div",{role:"tablist","aria-label":T("skills.source.label"),className:"inline-flex h-10 shrink-0 items-center rounded-md border border-oai-gray-200 bg-oai-white p-1 dark:border-oai-gray-800 dark:bg-oai-gray-900",children:[["repo",T("skills.mode.repo")],["skillssh",T("skills.mode.skillssh")]].map(([i,w])=>{const j=i==="skillssh"==(f===je);return r.jsx("button",{type:"button",role:"tab","aria-selected":j,onClick:()=>{i==="skillssh"?g(je):f===je&&g(Ge)},className:Je("rounded px-3 py-1 text-sm font-medium transition-colors",j?"bg-oai-gray-100 text-oai-black dark:bg-oai-gray-700 dark:text-white":"text-oai-gray-500 hover:text-oai-gray-800 dark:text-oai-gray-400 dark:hover:text-oai-gray-200"),children:w},i)})}),f!==je?r.jsxs(is,{value:f,onValueChange:g,children:[r.jsxs(ds,{"aria-label":T("skills.source.label"),className:"inline-flex h-10 w-44 shrink-0 items-center justify-between gap-2 rounded-md border border-oai-gray-200 bg-oai-white px-3 text-sm text-oai-black focus:outline-none data-[popup-open]:border-oai-gray-300 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-white dark:data-[popup-open]:border-oai-gray-700",children:[r.jsx(gs,{children:i=>i===Ge?T("skills.source.all"):i}),r.jsx(ms,{className:"text-oai-gray-400",children:r.jsx(pn,{className:"h-4 w-4","aria-hidden":!0})})]}),r.jsx(ps,{children:r.jsx(Ns,{sideOffset:4,alignItemWithTrigger:!1,className:"z-[60]",children:r.jsxs(Es,{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(en,{value:Ge,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(nn,{children:T("skills.source.all")}),r.jsx(tn,{children:r.jsx(nt,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),x.map(i=>{const w=`${i.owner}/${i.name}`;return r.jsxs(en,{value:w,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(nn,{children:w}),r.jsx(tn,{children:r.jsx(nt,{className:"h-3.5 w-3.5","aria-hidden":!0})})]},w)})]})})})]}):null,r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Kt,{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=>I(i.target.value),onKeyDown:i=>{i.key==="Enter"&&f===je&&z()},placeholder:f===je?T("skills.browse.placeholder_skillssh"):f===Ge?T("skills.browse.placeholder_all"):T("skills.browse.placeholder_repo",{repo:f}),className:"pl-9 !border-oai-gray-200 dark:!border-oai-gray-800 focus:!border-oai-gray-400 focus:!ring-oai-gray-400/20 dark:focus:!border-oai-gray-500 dark:focus:!ring-oai-gray-500/20"})]}),f===je?r.jsxs(Ue,{type:"button",onClick:z,disabled:y.trim().length<2||k==="search",className:"focus:!ring-oai-gray-400/30",children:[k==="search"?r.jsx(Be,{className:"mr-1.5 h-4 w-4 animate-spin","aria-hidden":!0}):r.jsx(Kt,{className:"mr-1.5 h-4 w-4","aria-hidden":!0}),T("skills.action.search")]}):r.jsxs(Ue,{type:"button",variant:"secondary",size:"sm",onClick:()=>h(i=>!i),"aria-expanded":C,className:"!h-10 shrink-0 whitespace-nowrap !border-oai-gray-200 dark:!border-oai-gray-800 hover:!border-oai-gray-300 dark:hover:!border-oai-gray-700 hover:!text-oai-black dark:hover:!text-white focus:!ring-oai-gray-400/30",children:[r.jsx(xn,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),T("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(Ds,{open:!!Y,title:T("skills.confirm.remove_title",{name:Y?.name||Y?.directory||""}),description:Y?Y.managed?T("skills.confirm.remove_managed"):T("skills.confirm.remove_local"):"",confirmLabel:T("skills.action.remove"),cancelLabel:T("shared.action.cancel"),destructive:!0,busy:k===Vt(Y||{}),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:T("shared.action.undo")}):null]})}):null]})}export{fo as SkillsPage};
1
+ import{c as ot,r as a,D as r,a7 as on,H as Ue,a5 as Je,aw as Ln,B as T,av as Vn,R as Dn}from"./main-B5QLmAE0.js";import{C as _n}from"./Card-CFkWVhb0.js";import{A as Dt,s as Se,n as at,o as Fe,p as $e,q as $t,r as an,t as _e,v as Un,w as Hn,x as Q,y as Fn,z as xe,B as $n,C as Bt,E as Bn,F as tt,c as Me,G as Nt,H as zt,I as zn,J as ln,K as Wn,M as Kn,N as Ke,O as Tt,Q as it,R as Pe,S as Et,T as cn,U as qn,V as se,W as un,X as Yn,Y as Pt,Z as $,_ as _t,$ as Gn,a0 as Xn,a1 as Jn,a2 as Qn,a3 as dn,a4 as fn,a5 as Zn,a6 as er,a7 as Ut,a8 as tr,a9 as nr,a as gn,b as He,aa as rr,ab as At,ac as sr,ad as or,ae as ar,af as ir,ag as lr,ah as cr,ai as ur,aj as dr,ak as mn,al as fr,am as gr,an as Wt,ao as mr,ap as hr,aq as pr,ar as hn,as as xr,at as yr,au as Ct,u as br,D as wr,e as kr,f as vr,g as Rr,h as Sr,i as Nr,L as Be,P as Cr,j as jr,k as Mr,l as Ir,m as Tr}from"./PopoverPopup-D3QrvkAB.js";import{P as yt}from"./ProviderIcon-BrQ-p8RF.js";import{C as pn}from"./chevron-down-DL3I7ot4.js";import{D as Er}from"./download-6m9qXhnE.js";const Pr=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],nt=ot("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=ot("external-link",Ar);const Lr=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],xn=ot("plus",Lr);const Vr=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Kt=ot("search",Vr);const Dr=[["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=ot("trash-2",Dr);function _r(e){const t=a.useRef(!0);t.current&&(t.current=!1,e())}function qt({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 gt(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 Yt(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 Ur(e,{event:t,orientation:n,loopFocus:o,rtl:d,cols:s,disabledIndices:l,minIndex:c,maxIndex:x,prevIndex:p,stopEvent:f=!1}){let g=p;const y=[],I={};let b=!1;{let u=null,C=-1;e.current.forEach((h,k)=>{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(k),I[k]=C})}const v=b&&y.length>0&&y.some(u=>u.length!==s);function E(u){if(!v||p===-1)return;const C=I[p];if(C==null)return;const h=y[C].indexOf(p);let k=u==="up"?C-1:C+1;o&&(k<0?k=y.length-1:k>=y.length&&(k=0));const P=new Set;for(;k>=0&&k<y.length&&!P.has(k);){P.add(k);const H=y[k];if(H.length===0){k=u==="up"?k-1:k+1;continue}const Z=Math.min(h,H.length-1);for(let D=Z;D>=0;D-=1){const oe=H[D];if(!st(e,oe,l))return oe}k=u==="up"?k-1:k+1,o&&(k<0?k=y.length-1:k>=y.length&&(k=0))}}if(t.key===Dt){const u=E("up");if(u!==void 0)f&&Se(t),g=u;else{if(f&&Se(t),p===-1)g=x;else if(g=we(e,{startingIndex:g,amount:s,decrement:!0,disabledIndices:l}),o&&(p-s<c||g<0)){const C=p%s,h=x%s,k=x-(h-C);h===C?g=x:g=h>C?k:k-s}rt(e,g)&&(g=p)}}if(t.key===at){const u=E("down");u!==void 0?(f&&Se(t),g=u):(f&&Se(t),p===-1?g=c:(g=we(e,{startingIndex:p,amount:s,disabledIndices:l}),o&&p+s>x&&(g=we(e,{startingIndex:p%s-s,amount:s,disabledIndices:l}))),rt(e,g)&&(g=p))}if(n==="both"){const u=$t(p/s);t.key===(d?Fe:$e)&&(f&&Se(t),p%s!==s-1?(g=we(e,{startingIndex:p,disabledIndices:l}),o&&gt(g,s,u)&&(g=we(e,{startingIndex:p-p%s-1,disabledIndices:l}))):o&&(g=we(e,{startingIndex:p-p%s-1,disabledIndices:l})),gt(g,s,u)&&(g=p)),t.key===(d?$e:Fe)&&(f&&Se(t),p%s!==0?(g=we(e,{startingIndex:p,decrement:!0,disabledIndices:l}),o&&gt(g,s,u)&&(g=we(e,{startingIndex:p+(s-p%s),decrement:!0,disabledIndices:l}))):o&&(g=we(e,{startingIndex:p+(s-p%s),decrement:!0,disabledIndices:l})),gt(g,s,u)&&(g=p));const C=$t(x/s)===u;rt(e,g)&&(o&&C?g=t.key===(d?$e:Fe)?x:we(e,{startingIndex:p-p%s-1,disabledIndices:l}):g=p)}return g}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 g=0;g<l;g+=1)p.push(d+f+g*t);d%t+s<=t&&p.every(f=>o[f]==null)?(p.forEach(f=>{o[f]=c}),x=!0):d+=1}}),[...o]}function Fr(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 $r(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 Br="Escape";function wt(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function mt(e,t){return wt(t,e===Dt||e===at,e===Fe||e===$e)}function Mt(e,t,n){return wt(t,e===at,n?e===Fe:e===$e)||e==="Enter"||e===" "||e===""}function zr(e,t,n){return wt(t,n?e===Fe:e===$e,e===at)}function Wr(e,t,n,o){const d=n?e===$e:e===Fe,s=e===Dt;return t==="both"||t==="horizontal"&&o&&o>1?e===Br:wt(t,d,s)}function Kr(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:g=null,allowEscape:y=!1,loopFocus:I=!1,nested:b=!1,rtl:v=!1,virtual:E=!1,focusItemOnOpen:u="auto",focusItemOnHover:C=!0,openOnArrowKeyDown:h=!0,disabledIndices:k=void 0,orientation:P="vertical",parentOrientation:H,cols:Z=1,scrollItemIntoView:D=!0,itemSizes:oe,dense:ge=!1,id:F,resetOnPointerLeave:Y=!0,externalTree:q}=t,J=an(d),re=_e(J),K=Un(),ee=Hn(q);Q(()=>{l.current.orientation=P},[l,P]);const S=Fn(s),B=a.useRef(u),R=a.useRef(g??-1),M=a.useRef(null),le=a.useRef(!0),O=xe(m=>{p(R.current===-1?null:R.current,m)}),he=a.useRef(O),ae=a.useRef(!!d),A=a.useRef(o),z=a.useRef(!1),ue=a.useRef(!1),ke=_e(k),L=_e(o),ce=_e(D),te=_e(g),pe=_e(Y),ye=xe(()=>{function m(ie){E?ee?.events.emit("virtualfocus",ie):$n(ie,{sync:z.current,preventScroll:!0})}const V=c.current[R.current],N=ue.current;V&&m(V),(z.current?ie=>ie():requestAnimationFrame)(()=>{const ie=c.current[R.current]||V;if(!ie)return;V||m(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=g??-1,B.current&&g!=null&&(ue.current=!0,O())):ae.current&&(R.current=-1,he.current()))},[f,o,d,g,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&&(M.current!=null||B.current===!0&&M.current==null)){let m=0;const V=()=>{c.current[0]==null?(m<2&&(m?requestAnimationFrame:queueMicrotask)(V),m+=1):(R.current=M.current==null||Mt(M.current,P,v)||b?jt(c):Yt(c),M.current=null,O())};V()}}else rt(c,x)||(R.current=x,ye(),ue.current=!1)}},[f,o,d,x,te,b,c,P,v,O,ye,ke]),Q(()=>{if(!f||d||!ee||E||!ae.current)return;const m=ee.nodesRef.current,V=m.find(ie=>ie.id===K)?.context?.elements.floating,N=Bt(Bn(d)),ne=m.some(ie=>ie.context&&tt(ie.context.elements.floating,N));V&&!ne&&le.current&&V.focus({preventScroll:!0})},[f,d,ee,K,E]),Q(()=>{he.current=O,A.current=o,ae.current=!!d}),Q(()=>{o||(M.current=null,B.current=u)},[o,u]);const me=x!=null,X=a.useMemo(()=>{function m(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,m(N)},onClick:({currentTarget:N})=>N.focus({preventScroll:!0}),onMouseMove(N){z.current=!0,ue.current=!1,C&&m(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),E||re.current?.focus({preventScroll:!0}))}}},[L,re,C,c,O,pe,E]),i=a.useCallback(()=>H??ee?.nodesRef.current.find(m=>m.id===K)?.context?.dataRef?.current.orientation,[K,ee,H]),w=xe(m=>{if(le.current=!1,z.current=!0,m.which===229||!L.current&&m.currentTarget===re.current)return;if(b&&Wr(m.key,P,v,Z)){mt(m.key,i())||Se(m),n.setOpen(!1,Me(Nt,m.nativeEvent)),zt(s)&&(E?ee?.events.emit("virtualfocus",s):s.focus());return}const V=R.current,N=jt(c,k),ne=Yt(c,k);if(S||(m.key==="Home"&&(Se(m),R.current=N,O(m)),m.key==="End"&&(Se(m),R.current=ne,O(m))),Z>1){const ie=oe||Array.from({length:c.current.length},()=>({width:1,height:1})),de=Hr(ie,Z,ge),be=de.findIndex(Ne=>Ne!=null&&!st(c,Ne,k)),Re=de.reduce((Ne,Ie,De)=>Ie!=null&&!st(c,Ie,k)?De:Ne,-1),Ve=de[Ur({current:de.map(Ne=>Ne!=null?c.current[Ne]:null)},{event:m,orientation:P,loopFocus:I,rtl:v,cols:Z,disabledIndices:$r([...(typeof k!="function"?k:null)||c.current.map((Ne,Ie)=>st(c,Ie,k)?Ie:void 0),void 0],de),minIndex:be,maxIndex:Re,prevIndex:Fr(R.current>ne?N:R.current,ie,de,Z,m.key===at?"bl":m.key===(v?Fe:$e)?"tr":"tl"),stopEvent:!0})];if(Ve!=null&&(R.current=Ve,O(m)),P==="both")return}if(mt(m.key,P)){if(Se(m),o&&!E&&Bt(m.currentTarget.ownerDocument)===m.currentTarget){R.current=Mt(m.key,P,v)?N:ne,O(m);return}Mt(m.key,P,v)?I?V>=ne?y&&V!==c.current.length?R.current=-1:(z.current=!1,R.current=N):R.current=we(c,{startingIndex:V,disabledIndices:k}):R.current=Math.min(ne,we(c,{startingIndex:V,disabledIndices:k})):I?V<=N?y&&V!==-1?R.current=c.current.length:(z.current=!1,R.current=ne):R.current=we(c,{startingIndex:V,decrement:!0,disabledIndices:k}):R.current=Math.max(N,we(c,{startingIndex:V,decrement:!0,disabledIndices:k})),rt(c,R.current)&&(R.current=-1),O(m)}}),j=a.useMemo(()=>E&&o&&me&&{"aria-activedescendant":`${F}-${x}`},[E,o,me,F,x]),_=a.useMemo(()=>({"aria-orientation":P==="both"?void 0:P,...S?{}:j,onKeyDown(m){if(m.key==="Tab"&&m.shiftKey&&o&&!E){const V=zn(m.nativeEvent);if(V&&!tt(re.current,V))return;Se(m),n.setOpen(!1,Me(ln,m.nativeEvent)),zt(s)&&s.focus();return}w(m)},onPointerMove(){le.current=!0}}),[j,w,re,P,S,n,o,E,s]),G=a.useMemo(()=>{function m(N){u==="auto"&&Wn(N.nativeEvent)&&(B.current=!E)}function V(N){B.current=u,u==="auto"&&Kn(N.nativeEvent)&&(B.current=!0)}return{onKeyDown(N){const ne=n.select("open");le.current=!1;const ie=N.key.startsWith("Arrow"),de=zr(N.key,i(),v),be=mt(N.key,P),Re=(b?de:be)||N.key==="Enter"||N.key.trim()==="";if(E&&ne)return w(N);if(!(!ne&&!h&&ie)){if(Re){const Ve=mt(N.key,i());M.current=b&&Ve?null:N.key}if(b){de&&(Se(N),ne?(R.current=jt(c,ke.current),O(N)):n.setOpen(!0,Me(Nt,N.nativeEvent,N.currentTarget)));return}be&&(te.current!=null&&(R.current=te.current),Se(N),!ne&&h?n.setOpen(!0,Me(Nt,N.nativeEvent,N.currentTarget)):w(N),ne&&O(N))}},onFocus(N){n.select("open")&&!E&&(R.current=-1,O(N))},onPointerDown:V,onPointerEnter:V,onMouseDown:m,onClick:m}},[w,ke,u,c,b,O,n,h,P,i,v,te,E]),ve=a.useMemo(()=>({...j,...G}),[j,G]);return a.useMemo(()=>f?{reference:ve,floating:_,item:X,trigger:G}:{},[f,ve,_,G,X])}function qr(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:g=750,ignoreKeys:y=Tt,selectedIndex:I=null}=t,b=Ke(),v=a.useRef(""),E=a.useRef(I??l??-1),u=a.useRef(null);Q(()=>{o&&(b.clear(),u.current=null,v.current="")},[o,b]),Q(()=>{o&&v.current===""&&(E.current=I??l??-1)},[o,I,l]);const C=xe(H=>{H?d.current.typing||(d.current.typing=H,x?.(H)):d.current.typing&&(d.current.typing=H,x?.(H))}),h=xe(H=>{function Z(Y,q,J){const re=f?f(q,J):q.find(K=>K?.toLocaleLowerCase().indexOf(J.toLocaleLowerCase())===0);return re?Y.indexOf(re):-1}const D=s.current;if(v.current.length>0&&v.current[0]!==" "&&(Z(D,D,v.current)===-1?C(!1):H.key===" "&&Se(H)),D==null||y.includes(H.key)||H.key.length!==1||H.ctrlKey||H.metaKey||H.altKey)return;o&&H.key!==" "&&(Se(H),C(!0)),D.every(Y=>Y?Y[0]?.toLocaleLowerCase()!==Y[1]?.toLocaleLowerCase():!0)&&v.current===H.key&&(v.current="",E.current=u.current),v.current+=H.key,b.start(g,()=>{v.current="",E.current=u.current,C(!1)});const ge=E.current,F=Z(D,[...D.slice((ge||0)+1),...D.slice(0,(ge||0)+1)],v.current);F!==-1?(c?.(F),u.current=F):H.key!==" "&&(v.current="",C(!1))}),k=a.useMemo(()=>({onKeyDown:h}),[h]),P=a.useMemo(()=>({onKeyDown:h,onKeyUp(H){H.key===" "&&C(!1)}}),[h,C]);return a.useMemo(()=>p?{reference:k,floating:P}:{},[p,k,P])}const bn=a.createContext(null),wn=a.createContext(null);function ze(){const e=a.useContext(bn);if(e===null)throw new Error(it(60));return e}function kn(){const e=a.useContext(wn);if(e===null)throw new Error(it(61));return e}let Gt=(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},Gr={valid(e){return e===null?null:e?{[Gt.valid]:""}:{[Gt.invalid]:""}}},Xr=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=Et)=>e,getInputValidationProps:(e=Et)=>e,inputRef:{current:null},commit:async()=>{}}});function Ht(e=!0){const t=a.useContext(Xr);if(t.setValidityData===Pe&&!e)throw new Error(it(28));return t}const Jr=a.createContext({controlId:void 0,setControlId:Pe,labelId:void 0,setLabelId:Pe,messageIds:[],setMessageIds:Pe,getDescriptionProps:e=>e});function vn(){return a.useContext(Jr)}function Rn(e={}){const{id:t,implicit:n=!1,controlRef:o}=e,{controlId:d,setControlId:s}=vn(),l=cn(t);return Q(()=>{if(!(!n&&!t||s===Pe)){if(n){const c=o?.current;qn(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 Qr=(e,t)=>Object.is(e,t);function Qe(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:Qe(o,t,n))}function Ot(e,t,n){return!e||e.length===0?-1:e.findIndex(o=>o===void 0?!1:Qe(o,t,n))}function Zr(e,t,n){return e.filter(o=>!Qe(o,t,n))}function Lt(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 es(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 ts(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 Lt(e)}function Xe(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?Lt(e.value):Lt(e)}function Nn(e,t,n){function o(){return ts(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 ns(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 U={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:Xe(t,o)!==""}),hasNullItemLabel:se((e,t)=>t?es(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=>Qe(s,n,o)):e.selectedIndex===t&&e.selectedIndex!==null?!0:Qe(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)},rs=a.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Pe,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function Cn(){return a.useContext(rs)}function ss(e,t){return{...e,state:{...e.state,valid:!t&&e.state.valid}}}function os(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:g}=Ht(),y=xe(e.getValue);Q(()=>{if(!t)return;let I=n;I===void 0&&(I=y()),f.initialValue===null&&I!==null&&g(b=>({...b,initialValue:I}))},[t,g,n,f.initialValue,y]),Q(()=>{!t||!o||c.current.fields.set(o,{getValue:y,name:d,controlRef:s,validityData:ss(f,x),validate(I=!0){let b=n;b===void 0&&(b=y()),p.current=!0,I?on.flushSync(()=>l(b)):l(b)}})},[l,s,t,c,y,o,x,p,d,f,n]),Q(()=>{const I=c.current.fields;return()=>{o&&I.delete(o)}},[c,o])}function as(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 is(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:g=!1,modal:y=!0,actionsRef:I,inputRef:b,onOpenChangeComplete:v,items:E,multiple:u=!1,itemToStringLabel:C,itemToStringValue:h,isItemEqualToValue:k=Qr,highlightItemOnHover:P=!0,children:H}=e,{clearErrors:Z}=Cn(),{setDirty:D,setTouched:oe,setFocused:ge,shouldValidateOnChange:F,validityData:Y,setFilled:q,name:J,disabled:re,validation:K,validationMode:ee}=Ht(),S=Rn({id:t}),B=re||p,R=J??x,[M,le]=qt({controlled:n,default:u?o??Tt:o,name:"Select",state:"value"}),[O,he]=qt({controlled:s,default:l,name:"Select",state:"open"}),ae=a.useRef([]),A=a.useRef([]),z=a.useRef(null),ue=a.useRef(null),ke=a.useRef(0),L=a.useRef(null),ce=a.useRef([]),te=a.useRef(!1),pe=a.useRef(!1),ye=a.useRef(null),me=a.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),X=a.useRef(!1),{mounted:i,setMounted:w,transitionStatus:j}=un(O),{openMethod:_,triggerProps:G,reset:ve}=Yn(O),m=Pt(()=>new tr({id:S,modal:y,multiple:u,itemToStringLabel:C,itemToStringValue:h,isItemEqualToValue:k,value:M,open:O,mounted:i,transitionStatus:j,items:E,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,V=$(m,U.activeIndex),N=$(m,U.selectedIndex),ne=$(m,U.triggerElement),ie=$(m,U.positionerElement),de=a.useMemo(()=>u&&Array.isArray(M)&&M.length===0?"":Xe(M,h),[u,M,h]),be=a.useMemo(()=>u&&Array.isArray(M)?M.map(W=>Xe(W,h)):Xe(M,h),[u,M,h]),Re=_e(m.state.triggerElement);os({id:S,commit:K.commit,value:M,controlRef:Re,name:R,getValue:()=>be});const Ve=a.useRef(M);Q(()=>{M!==Ve.current&&m.set("forceMount",!0)},[m,M]),Q(()=>{q(u?Array.isArray(M)&&M.length>0:M!=null)},[u,M,q]),Q(function(){if(O)return;const fe=ce.current;if(u){const Ee=Array.isArray(M)?M:[];if(Ee.length===0){m.set("selectedIndex",null);return}const Ce=Ee[Ee.length-1],ft=Ot(fe,Ce,k);m.set("selectedIndex",ft===-1?null:ft);return}const Te=Ot(fe,M,k);m.set("selectedIndex",Te===-1?null:Te)},[u,O,M,ce,k,m]),as(M,()=>{Z(R),D(M!==Y.initialValue),F()?K.commit(M):K.commit(M,!0)});const Ne=xe((W,fe)=>{if(c?.(W,fe),!fe.isCanceled&&(he(W),!W&&(fe.reason===ln||fe.reason===nr)&&(oe(!0),ge(!1),ee==="onBlur"&&K.commit(M)),!W&&m.state.activeIndex!==null)){const Te=ae.current[m.state.activeIndex];queueMicrotask(()=>{Te?.setAttribute("tabindex","-1")})}}),Ie=xe(()=>{w(!1),m.set("activeIndex",null),ve(),v?.(!1)});_t({enabled:!I,open:O,ref:z,onComplete(){O||Ie()}}),a.useImperativeHandle(I,()=>({unmount:Ie}),[Ie]);const De=xe((W,fe)=>{d?.(W,fe),!fe.isCanceled&&le(W)}),Ae=xe(()=>{const W=m.state.listElement||z.current;if(!W)return;const fe=W.scrollTop,Te=W.scrollTop+W.clientHeight,Ee=fe>1,Ce=Te<W.scrollHeight-1;m.state.scrollUpArrowVisible!==Ee&&m.set("scrollUpArrowVisible",Ee),m.state.scrollDownArrowVisible!==Ce&&m.set("scrollDownArrowVisible",Ce)}),Oe=Gn({open:O,onOpenChange:Ne,elements:{reference:ne,floating:ie}}),lt=Xn(Oe,{enabled:!f&&!B,event:"mousedown"}),Ze=Jn(Oe,{bubbles:!1}),Le=Kr(Oe,{enabled:!f&&!B,listRef:ae,activeIndex:V,selectedIndex:N,disabledIndices:Tt,onNavigate(W){W===null&&!O||m.set("activeIndex",W)},focusItemOnHover:!1}),vt=qr(Oe,{enabled:!f&&!B&&(O||!u),listRef:A,activeIndex:V,selectedIndex:N,onMatch(W){O?m.set("activeIndex",W):De(ce.current[W],Me("none"))},onTypingChange(W){te.current=W}}),{getReferenceProps:qe,getFloatingProps:Ye,getItemProps:ct}=Qn([lt,Ze,Le,vt]),et=a.useMemo(()=>dn(qe(),G,S?{id:S}:Et),[qe,G,S]);_r(()=>{m.update({popupProps:Ye(),triggerProps:et})}),Q(()=>{m.update({id:S,modal:y,multiple:u,value:M,open:O,mounted:i,transitionStatus:j,popupProps:Ye(),triggerProps:et,items:E,itemToStringLabel:C,itemToStringValue:h,isItemEqualToValue:k,openMethod:_})},[m,S,y,u,M,O,i,j,Ye,et,E,C,h,k,_]);const ut=a.useMemo(()=>({store:m,name:R,required:g,disabled:B,readOnly:f,multiple:u,itemToStringLabel:C,itemToStringValue:h,highlightItemOnHover:P,setValue:De,setOpen:Ne,listRef:ae,popupRef:z,scrollHandlerRef:ue,handleScrollArrowVisibility:Ae,scrollArrowsMountedCountRef:ke,getItemProps:ct,events:Oe.context.events,valueRef:L,valuesRef:ce,labelsRef:A,typingRef:te,selectionRef:me,selectedItemTextRef:ye,validation:K,onOpenChangeComplete:v,keyboardActiveRef:pe,alignItemWithTriggerActiveRef:X,initialValueRef:Ve}),[m,R,g,B,f,u,C,h,P,De,Ne,ct,Oe.context.events,K,v,Ae]),dt=fn(b,K.inputRef),Rt=u&&Array.isArray(M)&&M.length>0,St=a.useMemo(()=>!u||!Array.isArray(M)||!R?null:M.map(W=>{const fe=Xe(W,h);return r.jsx("input",{type:"hidden",name:R,value:fe},fe)}),[u,M,R,h]);return r.jsx(bn.Provider,{value:ut,children:r.jsxs(wn.Provider,{value:Oe,children:[H,r.jsx("input",{...K.getInputValidationProps({onFocus(){m.state.triggerElement?.focus({focusVisible:!0})},onChange(W){if(W.nativeEvent.defaultPrevented)return;const fe=W.target.value,Te=Me(Ut,W.nativeEvent);function Ee(){if(u)return;const Ce=ce.current.find(ft=>Xe(ft,h).toLowerCase()===fe.toLowerCase());Ce!=null&&(D(Ce!==Y.initialValue),De(Ce,Te),F()&&K.commit(Ce))}m.set("forceMount",!0),queueMicrotask(Ee)}}),name:u?void 0:R,value:de,disabled:B,required:g&&!Rt,readOnly:f,ref:dt,style:R?Zn:er,tabIndex:-1,"aria-hidden":!0}),St]})})}function ls(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),g=p-t.width,y=f-t.height;return{left:t.left-g/2,right:t.right+g/2,top:t.top-y/2,bottom:t.bottom+y/2}}const ht=2,cs=400,Xt=200,us={...rr,...Gr,value:()=>null},ds=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:g,state:y,disabled:I}=Ht(),{labelId:b}=vn(),{store:v,setOpen:E,selectionRef:u,validation:C,readOnly:h,required:k,alignItemWithTriggerActiveRef:P,disabled:H,keyboardActiveRef:Z}=ze(),D=I||H||l,oe=$(v,U.open),ge=$(v,U.value),F=$(v,U.triggerProps),Y=$(v,U.positionerElement),q=$(v,U.listElement),J=$(v,U.id),re=$(v,U.hasSelectedValue),K=!re&&oe,ee=$(v,U.hasNullItemLabel,K),S=s??J;Rn({id:S});const B=_e(Y),R=a.useRef(null),{getButtonProps:M,buttonRef:le}=gn({disabled:D,native:c}),O=xe(te=>{v.set("triggerElement",te)}),he=fn(n,R,le,O),ae=Ke(),A=Ke(),z=Ke(),ue=Ke();a.useEffect(()=>{if(oe)return!(re||ee)?z.start(cs,()=>{u.current.allowUnselectedMouseUp=!0,u.current.allowSelectedMouseUp=!0}):ue.start(Xt,()=>{u.current.allowUnselectedMouseUp=!0,z.start(Xt,()=>{u.current.allowSelectedMouseUp=!0})}),()=>{z.clear(),ue.clear()};u.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},A.clear()},[oe,re,ee,u,A,z,ue]);const ke=a.useMemo(()=>q?.id??an(Y)?.id,[q,Y]),L=dn(F,{id:S,role:"combobox","aria-expanded":oe?"true":"false","aria-haspopup":"listbox","aria-controls":oe?ke:void 0,"aria-labelledby":b,"aria-readonly":h||void 0,"aria-required":k||void 0,tabIndex:D?-1:0,ref:he,onFocus(te){f(!0),oe&&P.current&&E(!1,Me(Ut,te.nativeEvent)),ae.start(0,()=>{v.set("forceMount",!0)})},onBlur(te){tt(Y,te.relatedTarget)||(p(!0),f(!1),g==="onBlur"&&C.commit(ge))},onPointerMove(){Z.current=!1},onKeyDown(){Z.current=!0},onMouseDown(te){if(oe)return;const pe=At(te.currentTarget);function ye(me){if(!R.current)return;const X=me.target;if(tt(R.current,X)||tt(B.current,X)||X===R.current)return;const i=ls(R.current);me.clientX>=i.left-ht&&me.clientX<=i.right+ht&&me.clientY>=i.top-ht&&me.clientY<=i.bottom+ht||E(!1,Me(sr,me))}A.start(0,()=>{pe.addEventListener("mouseup",ye,{once:!0})})}},C.getValidationProps,x,M);L.role="combobox";const ce=a.useMemo(()=>({...y,open:oe,disabled:D,value:ge,readOnly:h,placeholder:!re}),[y,oe,D,ge,h,re]);return He("button",t,{ref:[n,R],state:ce,stateAttributesMapping:us,props:L})}),fs={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,U.value),g=$(x,U.items),y=$(x,U.itemToStringLabel),I=$(x,U.hasSelectedValue),b=!I&&l!=null&&s==null,v=$(x,U.hasNullItemLabel,b),E=a.useMemo(()=>({value:f,placeholder:!I}),[f,I]);let u=null;return typeof s=="function"?u=s(f):s!=null?u=s:!I&&l!=null&&!v?u=l:Array.isArray(f)?u=ns(f,g,y):u=Nn(f,g,y),He("span",t,{state:E,ref:[n,p],props:[{children:u},c],stateAttributesMapping:fs})}),ms=a.forwardRef(function(t,n){const{className:o,render:d,...s}=t,{store:l}=ze(),c=$(l,U.open),x=a.useMemo(()=>({open:c}),[c]);return He("span",t,{state:x,ref:n,props:[{"aria-hidden":!0,children:"▼"},s],stateAttributesMapping:or})}),hs=a.createContext(void 0),ps=a.forwardRef(function(t,n){const{store:o}=ze(),d=$(o,U.mounted),s=$(o,U.forceMount);return d||s?r.jsx(hs.Provider,{value:!0,children:r.jsx(ar,{ref:n,...t})}):null}),jn=a.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function xs(){return a.useContext(jn)}function ys(e){const{children:t,elementsRef:n,labelsRef:o,onMapChange:d}=e,s=xe(d),l=a.useRef(0),c=Pt(ws).current,x=Pt(bs).current,[p,f]=a.useState(0),g=a.useRef(p),y=xe((u,C)=>{x.set(u,C??null),g.current+=1,f(g.current)}),I=xe(u=>{x.delete(u),g.current+=1,f(g.current)}),b=a.useMemo(()=>{const u=new Map;return Array.from(x.keys()).filter(h=>h.isConnected).sort(ks).forEach((h,k)=>{const P=x.get(h)??{};u.set(h,{...P,index:k})}),u},[x,p]);Q(()=>{if(typeof MutationObserver!="function"||b.size===0)return;const u=new MutationObserver(C=>{const h=new Set,k=P=>h.has(P)?h.delete(P):h.add(P);C.forEach(P=>{P.removedNodes.forEach(k),P.addedNodes.forEach(k)}),h.size===0&&(g.current+=1,f(g.current))});return b.forEach((C,h)=>{h.parentElement&&u.observe(h.parentElement,{childList:!0})}),()=>{u.disconnect()}},[b]),Q(()=>{g.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 E=a.useMemo(()=>({register:y,unregister:I,subscribeMapChange:v,elementsRef:n,labelsRef:o,nextIndexRef:l}),[y,I,v,n,o,l]);return r.jsx(jn.Provider,{value:E,children:t})}function bs(){return new Map}function ws(){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 vs(){const e=a.useContext(Mn);if(!e)throw new Error(it(59));return e}function bt(e,t){e&&Object.assign(e.style,t)}const Rs={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},Ss={position:"fixed"},Ns=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:g="clipping-ancestors",collisionPadding:y,arrowPadding:I=5,sticky:b=!1,disableAnchorTracking:v,alignItemWithTrigger:E=!0,collisionAvoidance:u=ir,...C}=t,{store:h,listRef:k,labelsRef:P,alignItemWithTriggerActiveRef:H,selectedItemTextRef:Z,valuesRef:D,initialValueRef:oe,popupRef:ge,setValue:F}=ze(),Y=kn(),q=$(h,U.open),J=$(h,U.mounted),re=$(h,U.modal),K=$(h,U.value),ee=$(h,U.openMethod),S=$(h,U.positionerElement),B=$(h,U.triggerElement),R=$(h,U.isItemEqualToValue),M=a.useRef(null),le=a.useRef(null),[O,he]=a.useState(E),ae=J&&O&&ee!=="touch";!J&&O!==E&&he(E),Q(()=>{J||(U.scrollUpArrowVisible(h.state)&&h.set("scrollUpArrowVisible",!1),U.scrollDownArrowVisible(h.state)&&h.set("scrollDownArrowVisible",!1))},[h,J]),a.useImperativeHandle(H,()=>ae),lr((ae||re)&&q&&ee!=="touch",B);const A=cr({anchor:o,floatingRootContext:Y,positionMethod:d,mounted:J,side:c,sideOffset:p,align:x,alignOffset:f,arrowPadding:I,collisionBoundary:g,collisionPadding:y,sticky:b,disableAnchorTracking:v??ae,collisionAvoidance:u,keepMounted:!0}),z=ae?"none":A.side,ue=ae?Ss:A.positionerStyles,ke=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=He("div",t,{ref:[n,ce],state:L,stateAttributesMapping:mn,props:[ke,C]}),pe=a.useRef(0),ye=xe(X=>{if(X.size===0&&pe.current===0||D.current.length===0)return;const i=pe.current;if(pe.current=X.size,X.size===i)return;const w=Me(Ut);if(i!==0&&!h.state.multiple&&K!==null&&Ot(D.current,K,R)===-1){const _=oe.current,ve=_!=null&&It(D.current,_,R)?_:null;F(ve,w),ve===null&&(h.set("selectedIndex",null),Z.current=null)}if(i!==0&&h.state.multiple&&Array.isArray(K)){const j=K.filter(_=>It(D.current,_,R));(j.length!==K.length||j.some(_=>!It(K,_,R)))&&(F(j,w),j.length===0&&(h.set("selectedIndex",null),Z.current=null))}if(q&&ae){h.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const j={height:""};bt(S,j),bt(ge.current,j)}}),me=a.useMemo(()=>({...A,side:z,alignItemWithTriggerActive:ae,setControlledAlignItemWithTrigger:he,scrollUpArrowRef:M,scrollDownArrowRef:le}),[A,z,ae,he]);return r.jsx(ys,{elementsRef:k,labelsRef:P,onMapChange:ye,children:r.jsxs(Mn.Provider,{value:me,children:[J&&re&&r.jsx(ur,{inert:dr(!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",Jt={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 Cs(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}const js=a.createContext(void 0),Ms={disableStyleElements:!1};function Is(){return a.useContext(js)??Ms}const Ts={...mn,...hn},Es=a.forwardRef(function(t,n){const{render:o,className:d,...s}=t,{store:l,popupRef:c,onOpenChangeComplete:x,setOpen:p,valueRef:f,selectedItemTextRef:g,keyboardActiveRef:y,multiple:I,handleScrollArrowVisibility:b,scrollHandlerRef:v,highlightItemOnHover:E}=ze(),{side:u,align:C,alignItemWithTriggerActive:h,setControlledAlignItemWithTrigger:k,scrollDownArrowRef:P,scrollUpArrowRef:H}=vs(),Z=fr()!=null,D=kn(),{nonce:oe,disableStyleElements:ge}=Is(),F=Ke(),Y=$(l,U.id),q=$(l,U.open),J=$(l,U.mounted),re=$(l,U.popupProps),K=$(l,U.transitionStatus),ee=$(l,U.triggerElement),S=$(l,U.positionerElement),B=$(l,U.listElement),R=a.useRef(0),M=a.useRef(!1),le=a.useRef(0),O=a.useRef(!1),he=a.useRef({}),ae=gr(),A=xe(L=>{if(!S||!c.current||!O.current)return;if(M.current||!h){b();return}const ce=S.style.top==="0px",te=S.style.bottom==="0px",pe=S.getBoundingClientRect().height,ye=At(S),me=getComputedStyle(S),X=parseFloat(me.marginTop),i=parseFloat(me.marginBottom),w=Qt(getComputedStyle(c.current)),j=ye.documentElement.clientHeight-X-i,_=L.scrollTop,G=L.scrollHeight,ve=L.clientHeight,m=G-ve;let V=0,N=null,ne=!1;if(ce){const ie=m-_,de=pe+ie,be=Math.min(de,j);V=be,be!==j?N=m:ne=!0}else if(te){const ie=_-0,de=pe+ie,be=Math.min(de,j),Re=de-j;V=be,be!==j?N=0:(ne=!0,_<m&&(N=_-(ie-Re)))}V!==0&&(S.style.height=`${V}px`),N!=null&&(L.scrollTop=N),(ne||V>=w)&&(M.current=!0),b()});a.useImperativeHandle(v,()=>A,[A]),_t({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,M.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=As(L);L.style.removeProperty("--transform-origin");try{const te=getComputedStyle(S),pe=getComputedStyle(L),ye=At(ee),me=Wt(S),X=ee.getBoundingClientRect(),i=S.getBoundingClientRect(),w=X.left,j=X.height,_=B||L,G=_.scrollHeight,ve=parseFloat(pe.borderBottomWidth),m=parseFloat(te.marginTop)||10,V=parseFloat(te.marginBottom)||10,N=parseFloat(te.minHeight)||100,ne=Qt(pe),ie=5,de=5,be=20,Re=ye.documentElement.clientHeight-m-V,Ve=ye.documentElement.clientWidth,Ne=Re-X.bottom+j,Ie=g.current,De=f.current;let Ae,Oe=0,lt=0;if(Ie&&De){const W=De.getBoundingClientRect();Ae=Ie.getBoundingClientRect();const fe=W.left-w,Te=Ae.left-i.left,Ee=W.top-X.top+W.height/2,Ce=Ae.top-i.top+Ae.height/2;Oe=fe-Te,lt=Ce-Ee}const Ze=Ne+lt+V+ve;let Le=Math.min(Re,Ze);const vt=Re-m-V,qe=Ze-Le,Ye=Math.max(ie,w+Oe),ct=Ve-de,et=Math.max(0,Ye+i.width-ct);S.style.left=`${Ye-et}px`,S.style.height=`${Le}px`,S.style.maxHeight="auto",S.style.marginTop=`${m}px`,S.style.marginBottom=`${V}px`,L.style.height="100%";const ut=_.scrollHeight-_.clientHeight,dt=qe>=ut;dt&&(Le=Math.min(Re,i.height)-(qe-ut));const Rt=X.top<be||X.bottom>Re-be||Le<Math.min(G,N),St=(me.visualViewport?.scale??1)!==1&&mr;if(Rt||St){O.current=!0,bt(S,he.current),on.flushSync(()=>k(!1));return}if(dt){const W=Math.max(0,Re-Ze);S.style.top=i.height>=vt?"0":`${W}px`,S.style.height=`${Le}px`,_.scrollTop=_.scrollHeight-_.clientHeight,R.current=Math.max(N,Le)}else S.style.bottom="0",R.current=Math.max(N,Le),_.scrollTop=qe;if(Ae){const W=i.top,fe=i.height,Te=Ae.top+Ae.height/2,Ee=fe>0?(Te-W)/fe*100:50,Ce=Cs(Ee,0,100);L.style.setProperty("--transform-origin",`50% ${Ce}%`)}(R.current===Re||Le>=ne)&&(M.current=!0),b(),setTimeout(()=>{O.current=!0})}finally{ce()}})}},[l,q,S,ee,f,g,c,b,h,k,ae,P,H,B]),a.useEffect(()=>{if(!h||!S||!q)return;const L=Wt(S);function ce(te){p(!1,Me(pr,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":I||void 0,id:`${Y}-list`},onKeyDown(L){y.current=!0,Z&&yr.has(L.key)&&L.stopPropagation()},onMouseMove(){y.current=!1},onPointerLeave(L){if(!E||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%"}:Rs}},ke=He("div",t,{ref:[n,c],state:z,stateAttributesMapping:Ts,props:[re,ue,xr(K),{className:!B&&h?Jt.className:void 0},s]});return r.jsxs(a.Fragment,{children:[!ge&&Jt.getElement(oe),r.jsx(hr,{context:D,modal:!1,disabled:!J,restoreFocus:!0,children:ke})]})});function Qt(e){const t=e.maxHeight||"";return t.endsWith("px")&&parseFloat(t)||1/0}const Zt={transform:"none",scale:"1",translate:"0 0"};function Ps(e,t,n){n?e.setProperty(t,n):e.removeProperty(t)}function As(e){const{style:t}=e,n={},o=Object.keys(Zt);for(const d of o)n[d]=t.getPropertyValue(d),t.setProperty(d,Zt[d]);return()=>{for(const d of o)Ps(t,d,n[d])}}let Tn=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function Os(e={}){const{label:t,metadata:n,textRef:o,indexGuessBehavior:d,index:s}=e,{register:l,unregister:c,subscribeMapChange:x,elementsRef:p,labelsRef:f,nextIndexRef:g}=xs(),y=a.useRef(-1),[I,b]=a.useState(s??(d===Tn.GuessFromOrder?()=>{if(y.current===-1){const u=g.current;g.current+=1,y.current=u}return y.current}:-1)),v=a.useRef(null),E=a.useCallback(u=>{if(v.current=u,I!==-1&&u!==null&&(p.current[I]=u,f)){const C=t!==void 0;f.current[I]=C?t:o?.current?.textContent??u.textContent}},[I,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:E,index:I}),[I,E])}const En=a.createContext(void 0);function Ft(){const e=a.useContext(En);if(!e)throw new Error(it(57));return e}const en=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),g=Os({label:l,textRef:f,indexGuessBehavior:Tn.GuessFromOrder}),{store:y,getItemProps:I,setOpen:b,setValue:v,selectionRef:E,typingRef:u,valuesRef:C,keyboardActiveRef:h,multiple:k,highlightItemOnHover:P}=ze(),H=Ke(),Z=$(y,U.isActive,g.index),D=$(y,U.isSelected,g.index,s),oe=$(y,U.isSelectedByFocus,g.index),ge=$(y,U.isItemEqualToValue),F=g.index,Y=F!==-1,q=a.useRef(null),J=_e(F);Q(()=>{if(!Y)return;const A=C.current;return A[F]=s,()=>{delete A[F]}},[Y,F,s,C]),Q(()=>{if(!Y)return;const A=y.state.value;let z=A;k&&Array.isArray(A)&&A.length>0&&(z=A[A.length-1]),z!==void 0&&Qe(z,s,ge)&&y.set("selectedIndex",F)},[Y,F,k,ge,y,s]);const re=a.useMemo(()=>({disabled:c,selected:D,highlighted:Z}),[c,D,Z]),K=I({active:Z,selected:D});K.onFocus=void 0,K.id=void 0;const ee=a.useRef(null),S=a.useRef("mouse"),B=a.useRef(!1),{getButtonProps:R,buttonRef:M}=gn({disabled:c,focusableWhenDisabled:!0,native:x});function le(A){const z=y.state.value;if(k){const ue=Array.isArray(z)?z:[],ke=D?Zr(ue,s,ge):[...ue,s];v(ke,Me(Ct,A))}else v(s,Me(Ct,A)),b(!1,Me(Ct,A))}const O={role:"option","aria-selected":D,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)||H.start(0,()=>{y.state.activeIndex===F&&y.set("activeIndex",null)})},onTouchStart(){E.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=!E.current.allowSelectedMouseUp&&D,ue=!E.current.allowUnselectedMouseUp&&!D;z||ue||S.current!=="touch"&&!Z||le(A.nativeEvent)}},he=He("div",t,{ref:[M,n,g.ref,q],state:re,props:[K,O,p,R]}),ae=a.useMemo(()=>({selected:D,indexRef:J,textRef:f,selectedByFocus:oe,hasRegistered:Y}),[D,J,f,oe,Y]);return r.jsx(En.Provider,{value:ae,children:he})})),tn=a.forwardRef(function(t,n){const o=t.keepMounted??!1,{selected:d}=Ft();return o||d?r.jsx(Ls,{...t,ref:n}):null}),Ls=a.memo(a.forwardRef((e,t)=>{const{render:n,className:o,keepMounted:d,...s}=e,{selected:l}=Ft(),c=a.useRef(null),{transitionStatus:x,setMounted:p}=un(l),f=a.useMemo(()=>({selected:l,transitionStatus:x}),[l,x]),g=He("span",e,{ref:[t,c],state:f,props:[{"aria-hidden":!0,children:"✔️"},s],stateAttributesMapping:hn});return _t({open:l,ref:c,onComplete(){l||p(!1)}}),g})),nn=a.memo(a.forwardRef(function(t,n){const{indexRef:o,textRef:d,selectedByFocus:s,hasRegistered:l}=Ft(),{selectedItemTextRef:c}=ze(),{className:x,render:p,...f}=t,g=a.useCallback(I=>{if(!I||!l)return;const b=c.current===null||!c.current.isConnected;(s||b&&o.current===0)&&(c.current=I)},[c,o,s,l]);return He("div",t,{ref:[g,n,d],props:f})})),Vs=a.forwardRef(function(t,n){const{render:o,className:d,id:s,...l}=t,{store:c}=br(),x=cn(s);return c.useSyncedValueWithCleanup("descriptionElementId",x),He("p",t,{ref:n,props:[{id:x},l]})});function Ds({open:e,title:t,description:n,confirmLabel:o,cancelLabel:d,destructive:s=!1,busy:l=!1,onConfirm:c,onCancel:x}){return r.jsx(wr,{open:e,onOpenChange:p=>{!p&&!l&&x?.()},children:r.jsxs(kr,{children:[r.jsx(vr,{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(Rr,{className:"fixed inset-0 z-[101] flex items-center justify-center p-4",children:r.jsxs(Sr,{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(Nr,{className:"text-base font-semibold text-oai-black dark:text-white",children:t}),n?r.jsx(Vs,{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(Ue,{type:"button",variant:"secondary",size:"sm",disabled:l,onClick:()=>x?.(),children:d}),r.jsx(Ue,{type:"button",size:"sm",disabled:l,onClick:()=>c?.(),className:Je(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 kt(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 Ln(),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 _s(){return kt({mode:"installed"})}function Us(e={}){return kt({mode:"discover",...e.force?{force:1}:{}})}function Hs(e,t=0,n=20){return kt({mode:"search",q:e,offset:t,limit:n})}function Fs(){return kt({mode:"repos"})}function $s(e,t){return We({action:"install",skill:e,targets:t})}function Bs(e){return We({action:"uninstall",id:e})}function zs(e){return We({action:"restore",id:e})}function Ws(e,t){return We({action:"set_targets",id:e,targets:t})}function Ks(e,t){return We({action:"import_local",directory:e,targets:t})}function qs(e,t){return We({action:"delete_local",directory:e,targets:t||[]})}function Ys(e){return We({action:"add_repo",repo:e})}function Gs(e,t){return We({action:"remove_repo",owner:e,name:t})}const rn=["claude","codex"],Xs={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"},Ge="all",je="skillssh";function xt(e){return`${e.repoOwner||"local"}/${e.repoName||"local"}:${e.directory}`}function sn(e){return`install:${xt(e)}`}function Vt(e){return`remove:${e.id||e.directory}`}function On(e,t){return`target:${e}:${t}`}function Js({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":T("skills.target.toggle_aria",{target:s.label}),title:T(x,{target:s.label}),disabled:c,onClick:()=>o(e,s.id,!l),className:Je("inline-flex h-8 w-8 items-center justify-center rounded-md transition disabled:cursor-wait disabled:opacity-70",l?Xs[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 Qs({skill:e,targets:t,busyKey:n,onToggleTarget:o,onRemove:d}){const s=n===Vt(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(Js,{skill:e,targets:t,busyKey:n,onToggleTarget:o}),r.jsx("button",{type:"button","aria-label":T("skills.action.remove"),title:T("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 Zs({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:T("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(Qs,{skill:s,targets:t,busyKey:n,onToggleTarget:o,onRemove:d},s.id||s.key))})]})}const eo={contentVisibility:"auto",containIntrinsicSize:"0 240px"},to=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(E=>E!==b):[...v,b])},f=t.repoOwner&&t.repoName?`${t.repoOwner}/${t.repoName}`:null,g=t.installs!=null?T("skills.card.installs",{count:Number(t.installs||0).toLocaleString()}):null,y=[f,g].filter(Boolean).join(" · "),I=c.length?c.map(b=>d.find(v=>v.id===b)?.label||b).join(", "):T("skills.action.choose_targets");return r.jsxs(_n,{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-md bg-oai-black/[0.06] px-2 py-1 text-xs font-medium text-oai-gray-700 ring-1 ring-oai-black/10 dark:bg-white/[0.08] dark:text-oai-gray-200 dark:ring-white/10",children:[r.jsx(nt,{className:"h-3 w-3","aria-hidden":!0}),T("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("div",{className:"inline-flex h-8 w-full items-center justify-center gap-1.5 rounded-md bg-oai-black/[0.04] text-sm font-medium text-oai-gray-700 ring-1 ring-inset ring-oai-black/[0.08] dark:bg-white/[0.05] dark:text-oai-gray-200 dark:ring-white/[0.08]",children:[r.jsx(nt,{className:"h-3.5 w-3.5","aria-hidden":!0}),T("skills.card.installed")]}):r.jsxs("div",{className:"flex",children:[r.jsxs(Ue,{type:"button",size:"sm",onClick:()=>l(t,c),disabled:o||c.length===0,className:"flex-1 !rounded-r-none",title:I,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?T("skills.action.install_to",{count:c.length}):T("skills.action.install")]}),r.jsxs(Cr,{children:[r.jsx(jr,{disabled:o,"aria-label":T("skills.action.choose_targets"),title:I,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(Mr,{children:r.jsx(Ir,{sideOffset:6,side:"bottom",align:"end",className:"!z-[80]",children:r.jsxs(Tr,{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:T("skills.target.menu_label")}),d.map(b=>{const v=c.includes(b.id);return r.jsxs("button",{type:"button",onClick:()=>p(b.id),className:Je("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(nt,{className:"h-3.5 w-3.5 text-emerald-500","aria-hidden":!0}):null]},b.id)})]})})})]})]})})]})});function no({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:T("skills.repo.placeholder"),className:"min-w-0 flex-1"}),r.jsxs(Ue,{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}),T("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(Ue,{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:T("skills.repo.remove")})]})]},`${l.owner}/${l.name}`)})}):null]})}function ro(){return typeof window>"u"?"my":new URLSearchParams(window.location.search).get("tab")==="browse"?"browse":"my"}function fo(){const[e,t]=a.useState(ro),[n,o]=a.useState({skills:[],targets:[]}),[d,s]=a.useState([]),[l,c]=a.useState([]),[x,p]=a.useState([]),[f,g]=a.useState(Ge),[y,I]=a.useState(""),[b,v]=a.useState(""),[E,u]=a.useState(""),[C,h]=a.useState(!1),[k,P]=a.useState(""),[H,Z]=a.useState(!0),[D,oe]=a.useState(!1),[ge,F]=a.useState(""),[Y,q]=a.useState(null),[J,re]=a.useState(null),K=a.useMemo(()=>{const i=new Set;for(const w of n.skills||[]){i.add(xt(w).toLowerCase()),w.repoOwner&&w.repoName&&i.add(`${w.repoOwner}/${w.repoName}:${w.sourceDirectory||w.directory}`.toLowerCase());const j=String(w.directory||"").split(/[\\/]/).pop().toLowerCase();j&&i.add(`dir:${j}`)}return i},[n.skills]),ee=a.useCallback(async()=>{const i=await _s();o({skills:i.skills||[],targets:i.targets||[]})},[]),S=a.useCallback(async()=>{const i=await Fs();p(i.repos||[])},[]),B=a.useCallback(async({force:i=!1}={})=>{oe(!0);try{const w=await Us({force:i});s(w.skills||[])}finally{oe(!1)}},[]),R=a.useCallback(async()=>{Z(!0),F("");try{await Promise.all([ee(),S()])}catch(i){F(i?.message||T("skills.error.generic"))}finally{Z(!1)}},[ee,S]),M=a.useCallback(async()=>{await R(),e==="browse"&&f!==je&&B({force:!0}).catch(i=>F(i?.message||T("skills.error.generic")))},[B,R,f,e]);a.useEffect(()=>{R()},[R]),a.useEffect(()=>{e==="browse"&&f!==je&&d.length===0&&B().catch(i=>F(i?.message||T("skills.error.generic")))},[d.length,B,f,e]),a.useEffect(()=>{if(!J)return;const i=setTimeout(()=>re(w=>w?.key===J.key?null:w),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),w=i.get("tab");if(e==="my"){if(!w)return;i.delete("tab")}else{if(w===e)return;i.set("tab",e)}const j=i.toString(),_=`${window.location.pathname}${j?`?${j}`:""}${window.location.hash}`;window.history.replaceState({},"",_)},[e]);const le=async(i,w)=>{P(i),F("");try{await w(),await ee()}catch(j){F(j?.message||T("skills.error.generic"))}finally{P("")}},O=(i,w)=>{const j=(w&&w.length?w:rn).filter(_=>(n.targets||[]).some(G=>G.id===_));le(sn(i),async()=>{await $s(i,j);const _=j.map(G=>(n.targets||[]).find(ve=>ve.id===G)?.label||G).join(", ");re({key:`${Date.now()}:install:${xt(i)}`,message:T("skills.toast.installed",{name:i.name||i.directory,targets:_||T("skills.target.none")}),ttlMs:4e3})})},he=i=>{q(i)},ae=()=>{const i=Y;i&&(q(null),le(Vt(i),async()=>{let w=null;i.managed?w=await Bs(i.id):await qs(i.directory,i.targets||[]);const j=!!(w?.trashed&&i.managed&&i.id);re({key:`${Date.now()}:${i.id||i.directory}`,message:T("skills.toast.removed",{name:i.name||i.directory}),undo:j?async()=>{try{await zs(i.id),await ee(),re(null)}catch(_){F(_?.message||T("skills.error.generic"))}}:null,ttlMs:5e3})}))},A=(i,w,j)=>le(On(i.id,w),async()=>{const _=new Set(i.targets||[]);j?_.add(w):_.delete(w),i.managed?await Ws(i.id,Array.from(_)):await Ks(i.directory,Array.from(_))}),z=async()=>{const i=y.trim();if(!(i.length<2)){P("search"),F("");try{const w=await Hs(i);c(w.skills||[])}catch(w){F(w?.message||T("skills.error.generic"))}finally{P("")}}},ue=async()=>{const i=E.trim().replace(/^https:\/\/github\.com\//,"").replace(/\.git$/,""),[w,j]=i.split("/");if(!w||!j){F(T("skills.repo.invalid"));return}await le("repo:add",async()=>{await Ys({owner:w,name:j,branch:"main",enabled:!0}),u(""),await S(),await B()})},ke=async i=>{await le(`repo:${i.owner}/${i.name}`,async()=>{await Gs(i.owner,i.name),await S(),await B()})},L=n.targets||[],ce=n.skills||[],te=a.useMemo(()=>{const i=f===je?l:d,w=f===je||f===Ge?i:i.filter(G=>`${G.repoOwner}/${G.repoName}`===f),j=b.trim().toLowerCase();return(f===je||!j?w:w.filter(G=>(G.name||"").toLowerCase().includes(j)||(G.directory||"").toLowerCase().includes(j)||(G.description||"").toLowerCase().includes(j))).map(G=>{const ve=xt(G).toLowerCase(),m=String(G.directory||"").split(/[\\/]/).pop().toLowerCase(),V=m?`dir:${m}`:"";return{...G,installed:K.has(ve)||V&&K.has(V)}})},[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:T("skills.browse.loading_hint")})]}),me=(i,w=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:T(i)}),w]});let X;if(H)X=pe;else if(e==="my")X=ce.length?r.jsx(Zs,{items:ce,targets:L,busyKey:k,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,w)=>r.jsx("span",{className:"shrink-0 px-3",children:r.jsx(yt,{provider:i.id,size:30})},`b-${w}`))})}),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,w)=>r.jsx("span",{className:"shrink-0 px-3",children:r.jsx(yt,{provider:i.id,size:30})},`c-${w}`))})}),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:T("skills.empty.my")}),r.jsx(Ue,{type:"button",size:"sm",onClick:()=>t("browse"),children:T("skills.empty.my_cta")})]});else{const i=f===je,w=x.length===0&&!i;let j;w?j=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:T("skills.browse.empty_sources")})}):D&&!i?j=ye:i&&y.trim().length<2?j=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:T("skills.browse.hint_skillssh")}):te.length?j=r.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3",children:te.map(G=>r.jsx("div",{style:eo,children:r.jsx(to,{skill:G,installed:!!G.installed,installing:k===sn(G),allTargets:L,defaultTargets:rn,onInstall:O})},G.id||G.key))}):i?j=me("skills.empty.search"):j=me("skills.empty.browse");const _=w||C?r.jsx("div",{className:"mb-5",children:r.jsx(no,{repos:x,repoInput:E,onRepoInput:u,busyKey:k,onAdd:ue,onRemove:ke})}):null;X=r.jsxs(r.Fragment,{children:[_,j]})}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:T("skills.page.title")}),r.jsxs(Ue,{type:"button",variant:"secondary",size:"sm",onClick:M,disabled:H||D,children:[r.jsx(Vn,{className:Je("mr-1.5 h-3.5 w-3.5",(H||D)&&"animate-spin"),"aria-hidden":!0}),T("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",T("skills.tab.my")],["browse",T("skills.tab.browse")]].map(([i,w])=>r.jsx("button",{type:"button","aria-pressed":e===i,onClick:()=>t(i),className:Je("-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:w},i))}),ge?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:ge}):null,e==="browse"?r.jsxs("div",{className:"mb-5 flex flex-col gap-3 sm:flex-row sm:items-center",children:[r.jsx("div",{role:"tablist","aria-label":T("skills.source.label"),className:"inline-flex h-10 shrink-0 items-center rounded-md border border-oai-gray-200 bg-oai-white p-1 dark:border-oai-gray-800 dark:bg-oai-gray-900",children:[["repo",T("skills.mode.repo")],["skillssh",T("skills.mode.skillssh")]].map(([i,w])=>{const j=i==="skillssh"==(f===je);return r.jsx("button",{type:"button",role:"tab","aria-selected":j,onClick:()=>{i==="skillssh"?g(je):f===je&&g(Ge)},className:Je("rounded px-3 py-1 text-sm font-medium transition-colors",j?"bg-oai-gray-100 text-oai-black dark:bg-oai-gray-700 dark:text-white":"text-oai-gray-500 hover:text-oai-gray-800 dark:text-oai-gray-400 dark:hover:text-oai-gray-200"),children:w},i)})}),f!==je?r.jsxs(is,{value:f,onValueChange:g,children:[r.jsxs(ds,{"aria-label":T("skills.source.label"),className:"inline-flex h-10 w-44 shrink-0 items-center justify-between gap-2 rounded-md border border-oai-gray-200 bg-oai-white px-3 text-sm text-oai-black focus:outline-none data-[popup-open]:border-oai-gray-300 dark:border-oai-gray-800 dark:bg-oai-gray-900 dark:text-white dark:data-[popup-open]:border-oai-gray-700",children:[r.jsx(gs,{children:i=>i===Ge?T("skills.source.all"):i}),r.jsx(ms,{className:"text-oai-gray-400",children:r.jsx(pn,{className:"h-4 w-4","aria-hidden":!0})})]}),r.jsx(ps,{children:r.jsx(Ns,{sideOffset:4,alignItemWithTrigger:!1,className:"z-[60]",children:r.jsxs(Es,{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(en,{value:Ge,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(nn,{children:T("skills.source.all")}),r.jsx(tn,{children:r.jsx(nt,{className:"h-3.5 w-3.5","aria-hidden":!0})})]}),x.map(i=>{const w=`${i.owner}/${i.name}`;return r.jsxs(en,{value:w,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(nn,{children:w}),r.jsx(tn,{children:r.jsx(nt,{className:"h-3.5 w-3.5","aria-hidden":!0})})]},w)})]})})})]}):null,r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Kt,{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=>I(i.target.value),onKeyDown:i=>{i.key==="Enter"&&f===je&&z()},placeholder:f===je?T("skills.browse.placeholder_skillssh"):f===Ge?T("skills.browse.placeholder_all"):T("skills.browse.placeholder_repo",{repo:f}),className:"pl-9 !border-oai-gray-200 dark:!border-oai-gray-800 focus:!border-oai-gray-400 focus:!ring-oai-gray-400/20 dark:focus:!border-oai-gray-500 dark:focus:!ring-oai-gray-500/20"})]}),f===je?r.jsxs(Ue,{type:"button",onClick:z,disabled:y.trim().length<2||k==="search",className:"focus:!ring-oai-gray-400/30",children:[k==="search"?r.jsx(Be,{className:"mr-1.5 h-4 w-4 animate-spin","aria-hidden":!0}):r.jsx(Kt,{className:"mr-1.5 h-4 w-4","aria-hidden":!0}),T("skills.action.search")]}):r.jsxs(Ue,{type:"button",variant:"secondary",size:"sm",onClick:()=>h(i=>!i),"aria-expanded":C,className:"!h-10 shrink-0 whitespace-nowrap !border-oai-gray-200 dark:!border-oai-gray-800 hover:!border-oai-gray-300 dark:hover:!border-oai-gray-700 hover:!text-oai-black dark:hover:!text-white focus:!ring-oai-gray-400/30",children:[r.jsx(xn,{className:"mr-1.5 h-3.5 w-3.5","aria-hidden":!0}),T("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(Ds,{open:!!Y,title:T("skills.confirm.remove_title",{name:Y?.name||Y?.directory||""}),description:Y?Y.managed?T("skills.confirm.remove_managed"):T("skills.confirm.remove_local"):"",confirmLabel:T("skills.action.remove"),cancelLabel:T("shared.action.cancel"),destructive:!0,busy:k===Vt(Y||{}),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:T("shared.action.undo")}):null]})}):null]})}export{fo as SkillsPage};