tokentracker-cli 0.87.2 → 0.87.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dashboard/dist/assets/{AchievementBadge-C468-Rsw.js → AchievementBadge-jaWv39Mh.js} +1 -1
- package/dashboard/dist/assets/{AchievementsPage-CZWzSdiH.js → AchievementsPage-CqIWdffx.js} +2 -2
- package/dashboard/dist/assets/{AchievementsSection-DXt6VbwH.js → AchievementsSection-RAoIBoQ_.js} +1 -1
- package/dashboard/dist/assets/{BadgeDetailModal-BtGvpqQm.js → BadgeDetailModal-CYaSfxwZ.js} +1 -1
- package/dashboard/dist/assets/{Card-DZ-_fXkw.js → Card-Cl4XFCGL.js} +1 -1
- package/dashboard/dist/assets/{ClawdAnimated-9rXaHo1-.js → ClawdAnimated-DuFB46-u.js} +1 -1
- package/dashboard/dist/assets/{CommandPalette-sqIvZNsH.js → CommandPalette-CLfTNQK0.js} +1 -1
- package/dashboard/dist/assets/{CommunityStatsModal-c8VohIqQ.js → CommunityStatsModal-DCRCXmPl.js} +1 -1
- package/dashboard/dist/assets/{ConfirmModal-Ct2HLdds.js → ConfirmModal-B0IuSw4g.js} +1 -1
- package/dashboard/dist/assets/{Controls-DPtXGUGi.js → Controls-BJF1FutB.js} +1 -1
- package/dashboard/dist/assets/DashboardPage-BFthq-Oc.js +1 -0
- package/dashboard/dist/assets/{DevicePage-Ds4GEuqY.js → DevicePage-iZn2m4Y3.js} +1 -1
- package/dashboard/dist/assets/{DialogClose-B2IAbJG4.js → DialogClose-CdPKVRcX.js} +1 -1
- package/dashboard/dist/assets/DialogDescription-pCAELf1b.js +1 -0
- package/dashboard/dist/assets/{DialogTitle-BIwLH6gA.js → DialogTitle-Ul-NH9HD.js} +1 -1
- package/dashboard/dist/assets/{FadeIn-DPS7_DOB.js → FadeIn-Bb3pNOAn.js} +1 -1
- package/dashboard/dist/assets/{HeaderGithubStar-CsSgr9Hd.js → HeaderGithubStar-CtUK-3_x.js} +1 -1
- package/dashboard/dist/assets/{HoverTooltip-CLGZW2d-.js → HoverTooltip-B3TmAZtV.js} +1 -1
- package/dashboard/dist/assets/{IpCheckPage-DEM_uk69.js → IpCheckPage-CXcY3jc-.js} +1 -1
- package/dashboard/dist/assets/{LandingPage-BQ3YzZ68.js → LandingPage-BK4sn4MV.js} +2 -2
- package/dashboard/dist/assets/{LeaderboardAvatar-ySznr4Ml.js → LeaderboardAvatar-AYzG1gTH.js} +1 -1
- package/dashboard/dist/assets/LeaderboardPage-DhKcc74d.js +2 -0
- package/dashboard/dist/assets/{LeaderboardProfileModal-Drvsb5xF.js → LeaderboardProfileModal-DvmDBmOL.js} +3 -3
- package/dashboard/dist/assets/{LeaderboardProfilePage-BD0P-zZF.js → LeaderboardProfilePage-1_GGQngL.js} +1 -1
- package/dashboard/dist/assets/{LimitsPage-Mbn2mj6S.js → LimitsPage-dSEtf2TB.js} +1 -1
- package/dashboard/dist/assets/{LocalOnlyNotice-BsKgtoVa.js → LocalOnlyNotice-Bo1dtxi6.js} +1 -1
- package/dashboard/dist/assets/{LoginCard-CTQDdHcx.js → LoginCard-BpjNU-ah.js} +1 -1
- package/dashboard/dist/assets/{LoginModal-BxCyLDEW.js → LoginModal-D3_vPG1R.js} +1 -1
- package/dashboard/dist/assets/{LoginPage-ftxnX8g1.js → LoginPage-BoeLhbwK.js} +1 -1
- package/dashboard/dist/assets/{PetPage-CQsfqsm8.js → PetPage-BnkNWvcV.js} +1 -1
- package/dashboard/dist/assets/PopoverPopup-CkaOLLN4.js +1 -0
- package/dashboard/dist/assets/{ProviderIcon-7Tkq9_m6.js → ProviderIcon-B3hZ1YWD.js} +1 -1
- package/dashboard/dist/assets/{ResetPasswordPage-D-MPpQd1.js → ResetPasswordPage-BusTiA5M.js} +1 -1
- package/dashboard/dist/assets/{SegmentedControl-CYFrzu9w.js → SegmentedControl-C_IwmWnO.js} +1 -1
- package/dashboard/dist/assets/{Select-Dp4V9p6t.js → Select-Dj3hUGFb.js} +1 -1
- package/dashboard/dist/assets/SelectItemText-BWaMX4pY.js +1 -0
- package/dashboard/dist/assets/{ServiceStatusPage-BT6hvvLW.js → ServiceStatusPage-BnnCouAs.js} +1 -1
- package/dashboard/dist/assets/{SessionsPage-BopeZBiH.js → SessionsPage-DMU5CiFf.js} +1 -1
- package/dashboard/dist/assets/SettingsPage-_cJl0qwK.js +1 -0
- package/dashboard/dist/assets/{SkillsPage-Cr8O6eOH.js → SkillsPage-Cz3tV65I.js} +1 -1
- package/dashboard/dist/assets/{TokenGalaxy-BoUsrUEs.js → TokenGalaxy-BddGGmti.js} +1 -1
- package/dashboard/dist/assets/{ToolbarRootContext-CwRaHhMN.js → ToolbarRootContext-Q_DQJlr5.js} +1 -1
- package/dashboard/dist/assets/{TrendMonitor-BV2ugEsw.js → TrendMonitor-CVi7mLtI.js} +1 -1
- package/dashboard/dist/assets/{WidgetsPage-B7r4mvrw.js → WidgetsPage-BdIGupvg.js} +1 -1
- package/dashboard/dist/assets/{WrappedPage-CFU9l22i.js → WrappedPage-BB-orT9Q.js} +1 -1
- package/dashboard/dist/assets/{__vite-browser-external-Db9onipF.js → __vite-browser-external-egzerGU6.js} +2 -2
- package/dashboard/dist/assets/{agent-logos-DSSn_SPi.js → agent-logos-B2pH4QTS.js} +1 -1
- package/dashboard/dist/assets/{arrow-up-right-COvrArNz.js → arrow-up-right-CEUtBwnj.js} +1 -1
- package/dashboard/dist/assets/{check-CasSqiev.js → check-Ct-iMhaB.js} +1 -1
- package/dashboard/dist/assets/{chevron-right-B1PMeNoD.js → chevron-right-CIcqYgwy.js} +1 -1
- package/dashboard/dist/assets/{copy-D67vycfp.js → copy-Bx07orpr.js} +1 -1
- package/dashboard/dist/assets/{download-adOCFO2v.js → download-6N9dBj_W.js} +1 -1
- package/dashboard/dist/assets/{external-link-DVanKEuy.js → external-link-B39v_fs8.js} +1 -1
- package/dashboard/dist/assets/{flame-RbiHZM9b.js → flame-xbjyxu-1.js} +1 -1
- package/dashboard/dist/assets/{format-tokens-DhMp1e1L.js → format-tokens-C1ZXX8ed.js} +1 -1
- package/dashboard/dist/assets/{icons-BC0p_aGr.js → icons-D7dTRGnv.js} +1 -1
- package/dashboard/dist/assets/{index-A41xjc83.js → index-BJ8Q1dU0.js} +1 -1
- package/dashboard/dist/assets/{index-DrgBqR3o.js → index-MbSf_y6N.js} +1 -1
- package/dashboard/dist/assets/{index-CaRyTJ6K.js → index-pxtsHew5.js} +1 -1
- package/dashboard/dist/assets/{info-D9LwqlnC.js → info-YSmBFAMa.js} +1 -1
- package/dashboard/dist/assets/{limits-providers-CRHpXhmW.js → limits-providers-BDltKBG_.js} +1 -1
- package/dashboard/dist/assets/{link-2-B5f4qFR0.js → link-2--CbT8swK.js} +1 -1
- package/dashboard/dist/assets/{loader-circle-DCmwZEdS.js → loader-circle-B5Hs89F2.js} +1 -1
- package/dashboard/dist/assets/{maximize-2-BMalEDCZ.js → maximize-2-Cj3P-Bay.js} +1 -1
- package/dashboard/dist/assets/modifiers.esm-BXOR3VJH.js +1 -0
- package/dashboard/dist/assets/{provider-display-qMFRUZHm.js → provider-display-BXtFP7Ak.js} +1 -1
- package/dashboard/dist/assets/{react-BnaPNGj8.js → react-DujpLuOh.js} +1 -1
- package/dashboard/dist/assets/{search-BrqBkLs2.js → search-BswhdD2a.js} +1 -1
- package/dashboard/dist/assets/{skills-api-vo3iM6yD.js → skills-api-CGohvSGo.js} +1 -1
- package/dashboard/dist/assets/sortable.esm-BXiHjoqY.js +5 -0
- package/dashboard/dist/assets/{store-BwMVXuz3.js → store-BTdeRhbU.js} +1 -1
- package/dashboard/dist/assets/{terminal-BiyUh_8k.js → terminal-DawYBEVr.js} +1 -1
- package/dashboard/dist/assets/{trash-2-DAr4sqkX.js → trash-2-CSt4wZ-I.js} +1 -1
- package/dashboard/dist/assets/{use-community-stats-Cg48Zphy.js → use-community-stats-CHZTziox.js} +1 -1
- package/dashboard/dist/assets/{use-limits-display-prefs-DfKtH1Zn.js → use-limits-display-prefs-ChK-GCxK.js} +1 -1
- package/dashboard/dist/assets/use-ordered-list-DyyjthSr.js +1 -0
- package/dashboard/dist/assets/use-reduced-motion-B9hTo-eX.js +1 -0
- package/dashboard/dist/assets/{use-session-efficiency-pref-CMDTCAAd.js → use-session-efficiency-pref-Dv1clCTZ.js} +1 -1
- package/dashboard/dist/assets/{use-transform-B2d9Txt5.js → use-transform-DyBvIIFA.js} +1 -1
- package/dashboard/dist/assets/{use-usage-limits-CJbTUl9W.js → use-usage-limits-DrhY6h3M.js} +1 -1
- package/dashboard/dist/assets/{useCurrency-B0hJte5f.js → useCurrency-BgFo76Yb.js} +1 -1
- package/dashboard/dist/assets/{useScrollLock-DuosKdSB.js → useScrollLock-DPW-g15w.js} +1 -1
- package/dashboard/dist/assets/{useTokenFormat-DB8pKLFM.js → useTokenFormat-DrVDs8zo.js} +1 -1
- package/dashboard/dist/assets/{zap-rbzC4XgP.js → zap-Dsg_ZyH3.js} +1 -1
- package/dashboard/dist/index.html +1 -1
- package/dashboard/dist/ip-check.html +1 -1
- package/dashboard/dist/leaderboard.html +1 -1
- package/dashboard/dist/share.html +1 -1
- package/package.json +1 -1
- package/src/lib/codex-token-refresh.js +35 -7
- package/src/lib/pricing/seed-snapshot.json +1 -1
- package/src/lib/usage-limits.js +39 -28
- package/dashboard/dist/assets/DashboardPage-C65hbl8o.js +0 -1
- package/dashboard/dist/assets/DialogDescription-DeRza-LI.js +0 -1
- package/dashboard/dist/assets/LeaderboardPage-Br4JCoVE.js +0 -2
- package/dashboard/dist/assets/PopoverPopup-C16r8jQC.js +0 -1
- package/dashboard/dist/assets/SelectItemText-CxhBeoxx.js +0 -1
- package/dashboard/dist/assets/SettingsPage-D03GJJBd.js +0 -1
- package/dashboard/dist/assets/use-ordered-list-CnXfrWeF.js +0 -5
- package/dashboard/dist/assets/use-reduced-motion-BIgYrbON.js +0 -1
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/LeaderboardProfileModal-Drvsb5xF.js","assets/__vite-browser-external-Db9onipF.js","assets/__vite-browser-external-CzQk3FUc.css","assets/provider-display-qMFRUZHm.js","assets/useCurrency-B0hJte5f.js","assets/useTokenFormat-DB8pKLFM.js","assets/maximize-2-BMalEDCZ.js","assets/terminal-BiyUh_8k.js","assets/info-D9LwqlnC.js","assets/LeaderboardAvatar-ySznr4Ml.js","assets/ProviderIcon-7Tkq9_m6.js","assets/AchievementBadge-C468-Rsw.js","assets/zap-rbzC4XgP.js","assets/flame-RbiHZM9b.js","assets/AchievementsSection-DXt6VbwH.js","assets/react-BnaPNGj8.js","assets/format-tokens-DhMp1e1L.js","assets/use-reduced-motion-BIgYrbON.js","assets/arrow-up-right-COvrArNz.js","assets/link-2-B5f4qFR0.js","assets/check-CasSqiev.js","assets/DialogTitle-BIwLH6gA.js","assets/useScrollLock-DuosKdSB.js","assets/store-BwMVXuz3.js","assets/CommunityStatsModal-c8VohIqQ.js","assets/icons-BC0p_aGr.js","assets/TrendMonitor-BV2ugEsw.js","assets/chevron-right-B1PMeNoD.js","assets/PopoverPopup-C16r8jQC.js","assets/ToolbarRootContext-CwRaHhMN.js","assets/DialogDescription-DeRza-LI.js","assets/DialogClose-B2IAbJG4.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{m as ua,j as e,d as xa,c as s,e as d,r as c,an as ga,f as ba,u as pa,a as ha,ao as fa,K as ya,ap as ka,aq as wa,ar as ze,as as ja,at as ne,g as va,au as Na,L as _a,av as Sa,l as Ca,aw as La,ax as Ea,a7 as Ta,_ as Fe,k as Aa,y as Ma}from"./__vite-browser-external-Db9onipF.js";import{S as Pa}from"./Select-Dp4V9p6t.js";import{m as Ka}from"./react-BnaPNGj8.js";import{u as Ra,C as Ia,a as za,b as Ba,c as Be,D as Da,d as $a,S as Ua,h as Oa,s as Fa,K as Ga,P as Ha}from"./use-ordered-list-CnXfrWeF.js";import{P as he}from"./ProviderIcon-7Tkq9_m6.js";import{u as Ya}from"./useCurrency-B0hJte5f.js";import{u as Q}from"./useTokenFormat-DB8pKLFM.js";import{L as Z}from"./LeaderboardAvatar-ySznr4Ml.js";import{s as Wa,c as Va,A as qa,t as Ja,b as Za}from"./AchievementBadge-C468-Rsw.js";import{u as Xa}from"./use-community-stats-Cg48Zphy.js";import"./ToolbarRootContext-CwRaHhMN.js";import"./useScrollLock-DuosKdSB.js";import"./check-CasSqiev.js";import"./SelectItemText-CxhBeoxx.js";import"./zap-rbzC4XgP.js";import"./flame-RbiHZM9b.js";const Qa=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],er=ua("arrow-right",Qa),ar=a=>{let{transform:r}=a;return{...r,y:0}};function H(a,{min:r,max:o,fallback:n}){const l=Number(a);if(!Number.isFinite(l))return n;const i=Math.floor(l);return i<r?r:i>o?o:i}function rr(a,r){const o=H(r,{min:0,max:1e6,fallback:0}),n=H(a,{min:1,max:Math.max(1,o||1),fallback:1});if(o<=1)return[1];const l=new Set([1,o,n-2,n-1,n,n+1,n+2]),i=Array.from(l).filter(x=>Number.isInteger(x)&&x>=1&&x<=o).sort((x,p)=>x-p),m=[];let b=null;for(const x of i)b!=null&&x-b>1&&m.push(null),m.push(x),b=x;return m}function tr({page:a,totalPages:r}){const o=typeof r=="number"&&Number.isFinite(r)&&r>=0,n=o?H(r,{min:0,max:1e6,fallback:0}):null,l=H(a,{min:1,max:o?Math.max(1,n||1):1e6,fallback:1}),i=l>1,m=o?l<n:!0;return{canPrev:i,canNext:m,safePage:l,safeTotal:n}}function or({entries:a,me:r,meLabel:o}){const n=Array.isArray(a)?a:[],l=r&&typeof r.rank=="number"?r.rank:null;return!l||n.some(m=>!!m?.is_me)?n:[{rank:l,is_me:!0,is_pinned:!0,user_id:r?.user_id??null,display_name:o,avatar_url:r?.avatar_url??null,github_url:null,is_public:!1,gpt_tokens:r?.gpt_tokens??"0",claude_tokens:r?.claude_tokens??"0",gemini_tokens:r?.gemini_tokens??"0",cursor_tokens:r?.cursor_tokens??"0",opencode_tokens:r?.opencode_tokens??"0",openclaw_tokens:r?.openclaw_tokens??"0",hermes_tokens:r?.hermes_tokens??"0",kiro_tokens:r?.kiro_tokens??"0",copilot_tokens:r?.copilot_tokens??"0",kimi_tokens:r?.kimi_tokens??"0",other_tokens:r?.other_tokens??"0",total_tokens:r?.total_tokens??"0",estimated_cost_usd:r?.estimated_cost_usd??null,badges:Array.isArray(r?.badges)?r.badges:[]},...n]}function sr(a,r){const o=Number(a),n=Number(r);return!Number.isFinite(o)||o<1||!Number.isFinite(n)||n<1?null:Math.ceil(o/n)}const nr=new Set(["/brand-logos/cursor.svg","/brand-logos/kimi.svg","/brand-logos/kiro.svg","/brand-logos/copilot.svg","/brand-logos/hermes.svg"]);function ir({iconSrc:a,label:r}){return e.jsxs("span",{className:"inline-flex items-center gap-3",children:[a?e.jsx("img",{src:a,alt:"",width:16,height:16,className:`h-4 w-4 shrink-0 object-contain opacity-90 ${nr.has(a)?"dark:invert":""}`}):null,e.jsx("span",{className:"whitespace-nowrap",children:r})]})}const ie=xa.memo(function({badges:r,max:o=3,className:n=""}){const l=Wa((r||[]).filter(i=>i&&Va.has(i.id)&&(i.tier||0)>=1)).slice(0,o);return l.length===0?null:e.jsx("span",{className:`pointer-events-none inline-flex shrink-0 items-center ${n}`,children:l.map((i,m)=>e.jsx("span",{title:s("achievements.mini.tooltip",{name:s(Za(i.id,"name")),tier:s(`achievements.tier.${Ja(i.tier)}`)}),style:{zIndex:l.length-m},className:`pointer-events-auto relative inline-flex ${m>0?"-ml-1.5":""}`,children:e.jsx(qa,{badgeId:i.id,tier:i.tier,size:"xs",className:"rounded-full ring-[1.5px] ring-white dark:ring-oai-gray-950"})},i.id))})}),X=[{key:"gpt_tokens",copyKey:"leaderboard.column.codex",icon:"/brand-logos/codex.svg"},{key:"claude_tokens",copyKey:"leaderboard.column.claude",icon:"/brand-logos/claude-code.svg"},{key:"gemini_tokens",copyKey:"leaderboard.column.gemini",icon:"/brand-logos/gemini.svg"},{key:"cursor_tokens",copyKey:"leaderboard.column.cursor",icon:"/brand-logos/cursor.svg"},{key:"kiro_tokens",copyKey:"leaderboard.column.kiro",icon:"/brand-logos/kiro.svg"},{key:"copilot_tokens",copyKey:"leaderboard.column.copilot",icon:"/brand-logos/copilot.svg"},{key:"kimi_tokens",copyKey:"leaderboard.column.kimi",icon:"/brand-logos/kimi.svg"},{key:"opencode_tokens",copyKey:"leaderboard.column.opencode",icon:"/brand-logos/opencode.svg"},{key:"openclaw_tokens",copyKey:"leaderboard.column.openclaw",icon:"/brand-logos/openclaw.svg"},{key:"hermes_tokens",copyKey:"leaderboard.column.hermes",icon:"/brand-logos/hermes.svg"},{key:"other_tokens",copyKey:"leaderboard.column.supplemental",icon:null}],Ge="sticky left-0 z-40 w-14 min-w-14 max-w-14 sm:w-[72px] sm:min-w-[72px] sm:max-w-[72px] bg-white dark:bg-oai-gray-950 px-2.5 sm:px-4 py-4 align-middle",He="sticky left-[55px] sm:left-[71px] z-40 min-w-[96px] sm:min-w-[200px] max-w-[170px] sm:max-w-[min(260px,45vw)] border-l border-r border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-950 px-3 sm:px-4 py-4 align-middle";function le(a){return d("sticky left-0 z-30 w-14 min-w-14 max-w-14 sm:w-[72px] sm:min-w-[72px] sm:max-w-[72px] px-2.5 sm:px-4 py-4 whitespace-nowrap",a?"bg-oai-brand-50 dark:bg-emerald-950":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900")}function de(a){return d("sticky left-[55px] sm:left-[71px] z-30 hover:z-50 min-w-[96px] sm:min-w-[200px] max-w-[170px] sm:max-w-[min(260px,45vw)] border-l border-r border-oai-gray-200 dark:border-oai-gray-800 px-3 sm:px-4 py-4 min-w-0",a?"bg-oai-brand-50 dark:bg-emerald-950":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900")}function y({className:a}){return e.jsx("div",{className:d("rounded bg-oai-gray-200/70 dark:bg-oai-gray-800/70 animate-pulse",a)})}function lr({index:a}){const r=a<3?"w-24":a<8?"w-20":"w-16",o=a<3?"w-16":"w-12",n=a<5?"w-14":"w-10";return e.jsxs("tr",{className:"group",children:[e.jsx("td",{className:d(le(!1),"!group-hover:bg-transparent"),children:e.jsx(y,{className:"h-4 w-6"})}),e.jsx("td",{className:d(de(!1),"!group-hover:bg-transparent"),children:e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx(y,{className:"h-8 w-8 min-w-8 rounded-full"}),e.jsx(y,{className:d("h-4",r)})]})}),e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(y,{className:d("h-4",o)})}),e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(y,{className:"h-4 w-12"})}),X.map(l=>e.jsx("td",{className:"px-4 py-4 bg-white dark:bg-oai-gray-950",children:e.jsx(y,{className:d("h-4",n)})},l.key))]})}function dr({index:a}){const r=a<3?"w-24":a<8?"w-20":"w-16",o=a%3===0?3:a%3===1?2:1;return e.jsxs("div",{className:"mx-0 my-1 rounded-xl bg-white dark:bg-oai-gray-950 border border-oai-gray-100 dark:border-oai-gray-800/60 px-3.5 py-3 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(y,{className:"h-4 w-3 shrink-0 rounded"}),e.jsx(y,{className:"h-9 w-9 shrink-0 rounded-full"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx(y,{className:d("h-4",r)}),e.jsx(y,{className:"mt-2 h-3.5 w-20"})]}),e.jsxs("div",{className:"shrink-0 text-right",children:[e.jsx(y,{className:"ml-auto h-3 w-8"}),e.jsx(y,{className:"mt-1.5 ml-auto h-4 w-14"})]})]}),e.jsx("div",{className:"mt-3 flex flex-wrap items-center gap-2 border-t border-oai-gray-100 pt-2.5 dark:border-oai-gray-800/70",children:Array.from({length:o},(n,l)=>e.jsx(y,{className:"h-5 w-12 rounded-full"},l))})]})}function cr({rows:a=10}){return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"hidden w-full overflow-x-auto sm:block",children:e.jsxs("table",{className:"min-w-max w-full text-left text-sm",children:[e.jsx("thead",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800",children:e.jsxs("tr",{children:[e.jsx("th",{className:d(Ge,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx(y,{className:"h-3.5 w-6"})}),e.jsx("th",{className:d(He,"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx(y,{className:"h-3.5 w-12"})}),e.jsx("th",{className:"px-4 py-4",children:e.jsx(y,{className:"h-3.5 w-10"})}),e.jsx("th",{className:"px-4 py-4",children:e.jsx(y,{className:"h-3.5 w-14"})}),X.map(r=>e.jsx("th",{className:"px-4 py-4",children:e.jsx(y,{className:"h-3.5 w-12"})},r.key))]})}),e.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:Array.from({length:a},(r,o)=>e.jsx(lr,{index:o},o))})]})}),e.jsx("div",{className:"flex flex-col py-1 sm:hidden",children:Array.from({length:a},(r,o)=>e.jsx(dr,{index:o},o))})]})}function mr({id:a,thClassName:r,children:o}){const{attributes:n,listeners:l,setNodeRef:i,transform:m,transition:b,isDragging:x}=Ra({id:a}),p=Ia.Transform.toString(m)||"";c.useLayoutEffect(()=>{const f=document.querySelectorAll(`td[data-column-key="${a}"]`),h="0 2px 10px rgba(15, 23, 42, 0.10), 0 1px 3px rgba(15, 23, 42, 0.06)";return f.forEach(g=>{g.style.transform=p,g.style.transition=b||"",g.style.zIndex=x?"20":"",g.style.position=p?"relative":"",g.style.boxShadow=x?h:""}),()=>{f.forEach(g=>{g.style.transform="",g.style.transition="",g.style.zIndex="",g.style.position="",g.style.boxShadow=""})}},[a,p,b,x]);const j={transform:p,transition:b,position:p?"relative":void 0,zIndex:x?20:void 0,boxShadow:x?"0 2px 10px rgba(15, 23, 42, 0.10), 0 1px 3px rgba(15, 23, 42, 0.06)":void 0};return e.jsx("th",{ref:i,style:j,className:d(r,"group/col select-none cursor-grab active:cursor-grabbing touch-none"),...n,...l,children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx("span",{"aria-hidden":"true",className:d("-mr-1 inline-flex h-4 w-3 shrink-0 items-center justify-center text-oai-gray-400 dark:text-oai-gray-600","opacity-0 transition-opacity duration-150 group-hover/col:opacity-100",x&&"opacity-100"),children:e.jsxs("svg",{viewBox:"0 0 8 14",width:"8",height:"14",fill:"currentColor","aria-hidden":"true",children:[e.jsx("circle",{cx:"2",cy:"2",r:"1"}),e.jsx("circle",{cx:"6",cy:"2",r:"1"}),e.jsx("circle",{cx:"2",cy:"7",r:"1"}),e.jsx("circle",{cx:"6",cy:"7",r:"1"}),e.jsx("circle",{cx:"2",cy:"12",r:"1"}),e.jsx("circle",{cx:"6",cy:"12",r:"1"})]})}),o]})})}const ur="tokentracker.leaderboard.columnOrder.v1";function xr(a){return za(ur,a)}const gr=50;function br(a,r){const o=Number(a),n=Number(r);return!Number.isFinite(o)||o<1||!Number.isFinite(n)||n<1?null:Math.min(100,Math.max(1,Math.ceil(o/n*100)))}function Ye(a){return typeof a=="string"?a.trim():""}function pr(a){const r=Ye(a);return r?r.toLowerCase()==="anonymous":!0}function hr({me:a,totalEntries:r,meLabel:o,onOpenProfile:n,onJumpToMe:l,canJump:i,className:m}){const b=a&&typeof a.rank=="number"?a.rank:null;if(!b)return null;const x=Number(r)||0,p=br(b,x),j=Ye(a?.display_name),f=!j||pr(j)?o||"You":j,h=a?.user_id||f,g=n||(i?l:null),T=typeof g=="function",C=T?"button":"div",ee=T?{type:"button",onClick:g,"aria-label":s(n?"leaderboard.summary.view_profile":"leaderboard.summary.jump_to_me")}:{};return e.jsxs(C,{...ee,className:d("group inline-flex h-9 items-center gap-2.5 rounded-full border pl-1 pr-3.5 transition-all duration-300 select-none",T?"border-oai-gray-200 hover:border-oai-brand-400 dark:border-oai-gray-800 dark:hover:border-oai-brand-500/80 bg-oai-gray-50/50 dark:bg-white/[0.02] backdrop-blur-md hover:bg-oai-brand-50/40 dark:hover:bg-oai-brand-950/20 active:scale-[0.97] dark:ring-1 dark:ring-white/[0.04] dark:hover:ring-white/[0.08]":"border-oai-gray-100 dark:border-oai-gray-800/60 bg-oai-gray-50/20 dark:bg-white/[0.01] backdrop-blur-sm dark:ring-1 dark:ring-white/[0.02]",m),children:[e.jsx(Z,{size:"sm",avatarUrl:a?.avatar_url,displayName:f,seed:h}),e.jsx("span",{className:"hidden sm:inline max-w-[120px] truncate text-xs font-semibold text-oai-black dark:text-oai-gray-200 group-hover:text-oai-brand-600 dark:group-hover:text-oai-brand-400 transition-colors",children:f}),e.jsxs("span",{className:"text-xs font-bold tabular-nums text-oai-gray-800 dark:text-white",children:["#",b.toLocaleString()]}),p!=null&&p<=gr&&e.jsx("span",{className:d("hidden sm:inline-flex items-center rounded-full px-2 py-0.5 text-[9px] font-extrabold tracking-wider tabular-nums uppercase transition-colors duration-300 ring-1",p<=10?"bg-amber-500/10 text-amber-600 dark:bg-amber-500/15 dark:text-amber-400 ring-amber-500/20":"bg-oai-brand-100/50 text-oai-brand-700 dark:bg-oai-brand-500/10 dark:text-oai-brand-400 ring-oai-brand-500/10"),children:s("leaderboard.summary.percentile",{p:String(p)})}),T?e.jsx(er,{"aria-hidden":!0,className:"size-3 text-oai-gray-400 transition-all duration-300 group-hover:text-oai-brand-500 dark:text-oai-gray-500 group-hover:translate-x-0.5 group-hover:scale-110"}):e.jsxs("span",{className:"relative flex h-1.5 w-1.5 shrink-0 items-center justify-center ml-1",title:"You are here",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-emerald-400 opacity-75 duration-1000"}),e.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-emerald-500"})]})]})}const fr=c.lazy(()=>Fe(()=>import("./LeaderboardProfileModal-Drvsb5xF.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23])).then(a=>({default:a.LeaderboardProfileModal}))),yr=c.lazy(()=>Fe(()=>import("./CommunityStatsModal-c8VohIqQ.js"),__vite__mapDeps([24,1,2,15,25,5,10,26,4,7,27,28,22,23,29,6,17,11,12,13,21,30,31])).then(a=>({default:a.CommunityStatsModal}))),ce=[10,20,50,100],me=20,We="tokentracker:leaderboard:pageSize";function kr(){if(typeof window>"u")return me;try{const a=window.localStorage.getItem(We),r=Number(a);if(ce.includes(r))return r}catch{}return me}function ue(a,r,o){const n=Number(a);if(!Number.isFinite(n)||n<=0)return"-";const l=Sa(r),i=r===Ma?n:n*o;return i>=1e3?`${l}${Math.round(i).toLocaleString()}`:i>=10?`${l}${Math.round(i)}`:`${l}${i.toFixed(2)}`}function wr(a){if(typeof a!="string"||!a.trim())return null;const r=new Date(a);if(!Number.isFinite(r.getTime()))return null;const o=Aa();return{dateTime:r.toISOString(),display:new Intl.DateTimeFormat(o,{dateStyle:"medium",timeStyle:"short"}).format(r),exact:new Intl.DateTimeFormat(o,{dateStyle:"full",timeStyle:"long"}).format(r)}}function xe({value:a}){const{formatTokens:r,formatTokensTooltip:o}=Q();return e.jsx("span",{title:o(a),children:r(a)})}function jr({communityStats:a,onClick:r}){const{formatTokens:o,formatTokensTooltip:n}=Q();return a.status!=="ready"?null:e.jsxs("button",{type:"button",onClick:r,className:"inline-flex min-w-0 max-w-full flex-1 items-center gap-1.5 whitespace-nowrap rounded-xl border border-oai-gray-200 bg-oai-gray-50/50 px-2.5 py-2 text-xs text-oai-gray-500 backdrop-blur-md transition-all duration-300 hover:border-oai-brand-400 hover:bg-oai-brand-50/40 active:scale-[0.97] dark:border-oai-gray-800 dark:bg-white/[0.02] dark:text-oai-gray-400 dark:hover:border-oai-brand-500/80 dark:hover:bg-oai-brand-950/20 sm:h-9 sm:flex-none sm:gap-2.5 sm:rounded-full sm:px-3.5 sm:py-0",title:s("leaderboard.community.view_stats"),children:[e.jsxs("span",{className:"relative flex h-1.5 w-1.5 shrink-0","aria-hidden":"true",children:[e.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-emerald-500/80 opacity-75 duration-1000"}),e.jsx("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-emerald-500"})]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:"font-semibold text-oai-black dark:text-white tabular-nums",children:e.jsx("span",{title:n(a.tokenFloor),children:o(a.tokenFloor)})}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:s("leaderboard.community.tokens_chip")})]}),e.jsx("span",{className:"text-oai-gray-200 dark:text-oai-gray-800 select-none",children:"·"}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsxs("span",{className:"font-semibold text-oai-black dark:text-white tabular-nums",children:[e.jsx("span",{className:"sm:hidden",children:Ca(a.totalEntries)}),e.jsx("span",{className:"hidden sm:inline",children:(Number(a.totalEntries)||0).toLocaleString("en-US")})]}),e.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-500",children:s("leaderboard.community.devs_chip")})]})]})}function De({entry:a,isMe:r,orderedColumns:o}){const{formatTokens:n,formatTokensTooltip:l}=Q(),i=r?"text-oai-gray-700 dark:text-oai-gray-300":"text-oai-gray-500 dark:text-oai-gray-400",m=r?"bg-oai-brand-50 dark:bg-oai-brand-900/10":"bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900";return o.map(b=>e.jsx("td",{"data-column-key":b.key,title:l(a?.[b.key]),className:d("hidden sm:table-cell px-3 sm:px-4 py-4 whitespace-nowrap text-right tabular-nums",i,m),children:n(a?.[b.key])},b.key))}function vr(a){return a?.key==="gpt_tokens"?"CODEX":a?.key==="claude_tokens"?"CLAUDE":(a?.icon?.split("/").pop()||"").replace(/\.svg$/i,"").toUpperCase()||"OTHER"}const Nr={1:"ring-2 ring-amber-400 dark:ring-amber-500/80 shadow-[0_0_8px_rgba(245,158,11,0.25)]",2:"ring-2 ring-slate-350 dark:ring-slate-450 shadow-[0_0_8px_rgba(148,163,184,0.2)]",3:"ring-2 ring-orange-400 dark:ring-orange-500/70 shadow-[0_0_8px_rgba(249,115,22,0.25)]"};function _r({rank:a,placeholder:r}){return a===1?e.jsx("span",{className:"text-base font-extrabold italic text-amber-500 dark:text-amber-400 tracking-tighter",children:"1"}):a===2?e.jsx("span",{className:"text-base font-extrabold italic text-slate-400 dark:text-slate-350 tracking-tighter",children:"2"}):a===3?e.jsx("span",{className:"text-base font-extrabold italic text-orange-500 dark:text-orange-400 tracking-tighter",children:"3"}):e.jsx("span",{className:"text-[13px] font-bold tabular-nums text-oai-gray-400 dark:text-oai-gray-500",children:a==null?r:`#${a}`})}function Sr({githubUrl:a}){return e.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",onClick:r=>r.stopPropagation(),"aria-label":"GitHub profile",className:"absolute bottom-0 right-0 translate-x-1 translate-y-1 flex h-4.5 w-4.5 items-center justify-center rounded-full bg-white dark:bg-oai-gray-950 text-oai-black dark:text-oai-gray-100 shadow border border-oai-gray-100 dark:border-oai-gray-800 transition-transform active:scale-110",children:e.jsx(he,{provider:"GITHUB",size:11})})}function Cr({entry:a,orderedColumns:r}){const{formatTokens:o,formatTokensTooltip:n}=Q(),l=r.filter(i=>{const m=Number(a?.[i.key]);return Number.isFinite(m)&&m>0});return l.length===0?null:e.jsx("div",{className:"mt-3 flex flex-wrap items-center gap-x-1.5 gap-y-2 border-t border-oai-gray-100/70 pt-3 dark:border-oai-gray-800/60",children:l.map(i=>{const m=s(i.copyKey);return e.jsxs("span",{title:m,"aria-label":`${m}: ${n(a?.[i.key])}`,className:"inline-flex shrink-0 items-center gap-1 rounded-full bg-oai-gray-50/80 dark:bg-oai-gray-900/60 px-2 py-0.5 border border-oai-gray-100/80 dark:border-oai-gray-800/40 text-[10px] font-medium text-oai-gray-600 dark:text-oai-gray-300 transition-colors",children:[e.jsx(he,{provider:vr(i),size:12,className:"shrink-0 opacity-90"}),e.jsx("span",{className:"tabular-nums",children:o(a?.[i.key])})]},i.key)})})}function Lr({entry:a,entryIdx:r,name:o,meLabel:n,currency:l,rate:i,orderedColumns:m,placeholder:b,onOpenProfile:x}){if(a?.is_ellipsis)return e.jsx("div",{"aria-hidden":"true",className:"px-4 py-2 text-center text-xs tracking-[0.4em] text-oai-gray-400 dark:text-oai-gray-600",children:"···"},`mobile-ellipsis-${r}`);const p=!!a?.is_me,j=!p&&be(a?.display_name),f=typeof a?.user_id=="string"?a.user_id:null,h=!!f,g=p?n:o,T=C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),x(f))};return e.jsxs("div",{role:h?"button":void 0,tabIndex:h?0:void 0,onClick:h?()=>x(f):void 0,onKeyDown:h?T:void 0,"aria-label":h?s("leaderboard.profile_modal.row_aria",{name:g}):void 0,className:d("relative mx-0 my-1 rounded-xl px-3.5 py-3 transition-all duration-200 border shadow-sm select-none",p?"bg-gradient-to-br from-oai-brand-50/70 via-oai-brand-50/20 to-transparent dark:from-oai-brand-950/20 dark:via-oai-brand-950/5 dark:to-transparent border-oai-brand-200/60 dark:border-oai-brand-500/25":j?"bg-white/90 dark:bg-oai-gray-950/90 border-oai-gray-100/70 dark:border-oai-gray-800/40":"bg-white dark:bg-oai-gray-950 border-oai-gray-100 dark:border-oai-gray-800/60",h&&"cursor-pointer hover:border-oai-gray-200 dark:hover:border-oai-gray-700/80 active:scale-[0.985] active:bg-oai-gray-50/60 dark:active:bg-oai-gray-900/40 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-oai-brand-500/60"),children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e.jsx("span",{className:"flex w-5 shrink-0 items-center justify-center",children:e.jsx(_r,{rank:a?.rank,placeholder:b})}),e.jsxs("span",{className:"relative inline-flex shrink-0",children:[e.jsx("span",{className:d("inline-flex rounded-full p-0.5 transition-all duration-300",Nr[a?.rank]||"ring-1 ring-oai-gray-200 dark:ring-oai-gray-800/80",j&&"opacity-60 grayscale-[15%]"),children:e.jsx(Z,{size:"md",avatarUrl:a?.avatar_url,displayName:g,seed:pe(a,g)})}),a?.github_url&&e.jsx(Sr,{githubUrl:a.github_url})]}),e.jsxs("div",{className:"min-w-0 flex-1 pl-1",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[e.jsx("span",{className:d("min-w-0 truncate text-sm tracking-tight",p?"font-semibold text-oai-black dark:text-oai-white":j?"font-normal text-oai-gray-400 dark:text-oai-gray-500":"font-medium text-oai-gray-800 dark:text-oai-gray-200"),children:g}),e.jsx(ie,{badges:a?.badges,className:"shrink-0 scale-95"})]}),e.jsxs("div",{className:"mt-1 text-[11px] text-oai-gray-400 dark:text-oai-gray-500",children:[e.jsx("span",{children:s("leaderboard.column.est_cost")}),e.jsx("span",{className:d("ml-1 tabular-nums font-medium",j?"text-oai-gray-400/80 dark:text-oai-gray-500/80":"text-oai-gray-600 dark:text-oai-gray-300"),children:ue(a?.estimated_cost_usd,l,i)})]})]}),e.jsxs("div",{className:"shrink-0 text-right",children:[e.jsx("div",{className:"text-[9px] font-semibold uppercase tracking-[0.08em] text-oai-gray-400 dark:text-oai-gray-500",children:s("leaderboard.column.total")}),e.jsx("div",{className:d("mt-0.5 text-sm font-semibold tabular-nums tracking-tight",p?"text-oai-black dark:text-oai-white":j?"text-oai-gray-400 dark:text-oai-gray-500":"text-oai-gray-800 dark:text-oai-gray-200"),children:e.jsx(xe,{value:a?.total_tokens})})]})]}),e.jsx(Cr,{entry:a,orderedColumns:m})]},`mobile-row-${a?.rank}-${g}`)}const Er={1:{text:"text-amber-600 dark:text-amber-400",badge:"bg-amber-50 dark:bg-amber-900/20"},2:{text:"text-gray-500 dark:text-gray-300",badge:"bg-gray-50 dark:bg-gray-800/40"},3:{text:"text-orange-700 dark:text-orange-400",badge:"bg-orange-50 dark:bg-orange-900/20"}};function $e({rank:a,placeholder:r}){const o=Er[a];return o?e.jsx("span",{className:d("inline-flex items-center justify-center h-7 w-7 rounded-full text-xs font-bold",o.text,o.badge),children:a}):e.jsx("span",{className:"inline-flex items-center justify-center h-7 w-7 text-sm",children:a??r})}function Ue(a){if(typeof a!="string")return null;const r=a.trim().toLowerCase();return r==="week"||r==="month"||r==="total"?r:null}function Tr(a){if(!a)return s("shared.error.prefix",{error:s("leaderboard.error.unknown")});const r=a?.message||String(a),o=String(r||"").trim()||s("leaderboard.error.unknown");return s("shared.error.prefix",{error:o})}function ge(a){return typeof a!="string"?"":a.trim()}function be(a){const r=ge(a);return r?r.toLowerCase()==="anonymous":!0}function pe(a,r){const o=typeof a?.user_id=="string"?a.user_id.trim():"";return o||`${a?.rank??""}:${r}`}function Oe({githubUrl:a}){return e.jsxs("span",{className:"absolute left-1/2 top-full -translate-x-1/2 -translate-y-1/2 inline-flex group/gh",children:[e.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",onClick:r=>r.stopPropagation(),"aria-label":s("leaderboard.github.aria"),className:"flex h-4 w-4 items-center justify-center rounded-full bg-white dark:bg-oai-gray-950 text-oai-black dark:text-oai-gray-100 transition-transform hover:scale-110",children:e.jsx(he,{provider:"GITHUB",size:14})}),e.jsxs("span",{role:"tooltip",className:"invisible opacity-0 group-hover/gh:visible group-hover/gh:opacity-100 absolute left-0 bottom-full mb-2 whitespace-nowrap rounded-md bg-oai-black dark:bg-oai-gray-700 px-2.5 py-1.5 text-[11px] leading-relaxed text-white shadow-lg transition-opacity duration-150 z-50 before:content-[''] before:absolute before:inset-x-0 before:top-full before:h-2.5",children:[e.jsx("span",{className:"block",children:s("leaderboard.github.tooltipAction")}),e.jsxs("span",{className:"block text-oai-gray-300 dark:text-oai-gray-400",children:[s("leaderboard.github.tooltipPrefix")," ",e.jsx(_a,{to:"/settings",onClick:r=>r.stopPropagation(),className:"text-white underline underline-offset-2 decoration-oai-gray-400 hover:text-oai-brand-300 hover:decoration-oai-brand-300",children:s("leaderboard.github.tooltipSettingsLink")})," ",s("leaderboard.github.tooltipSuffix")]})]})]})}function qr({auth:a,signedIn:r,sessionSoftExpired:o}){const n=ga(),l=ba(),{openLoginModal:i}=pa(),{signedIn:m,loading:b,user:x}=ha(),{currency:p,rate:j}=Ya(),f=c.useMemo(()=>fa(),[]),h=ya(),g=r&&!o,T=c.useMemo(()=>g&&(typeof a=="function"||typeof a=="string"||a&&typeof a=="object")?a:null,[a,g]),C=g?T:null,ee=g&&ka(C),ae=s("shared.placeholder.short"),Ve=c.useMemo(()=>X.map(t=>t.key),[]),{order:re,reorder:fe}=xr(Ve),ye=c.useMemo(()=>{const t=new Map;for(const u of X)t.set(u.key,u);return t},[]),B=c.useMemo(()=>re.map(t=>ye.get(t)).filter(Boolean),[re,ye]),qe=Ba(Be(Ha,{activationConstraint:{distance:6}}),Be(Ga,{coordinateGetter:Fa})),Je=c.useCallback(t=>{const{active:u,over:w}=t;!w||u.id===w.id||fe(String(u.id),String(w.id))},[fe]),[te,M]=c.useState(1),[_,Ze]=c.useState(kr),[ke,we]=c.useState(null),[Xe,je]=c.useState(!1),Y=c.useCallback(t=>{typeof t=="string"&&t.trim()&&we(t.trim())},[]),Qe=c.useCallback(()=>we(null),[]),ea=c.useCallback(t=>{const u=ce.includes(t)?t:me;Ze(u),M(1);try{window.localStorage.setItem(We,String(u))}catch{}},[]),[ve,aa]=c.useState(0),[ra,ta]=c.useState(()=>wa()),[Ne,_e]=c.useState(!1);c.useEffect(()=>{if(typeof window>"u")return;const t=()=>{aa(u=>u+1)};return window.addEventListener(ze,t),()=>{window.removeEventListener(ze,t)}},[]);const N=c.useMemo(()=>{const t=new URLSearchParams(n?.search||"");return Ue(t.get("period"))||"total"},[n?.search]),oa=t=>{const u=Ue(t);if(!u||u===N)return;const w=new URLSearchParams(n?.search||"");w.set("period",u),M(1),l(`${n?.pathname||"/leaderboard"}?${w.toString()}`,{replace:!0})};c.useEffect(()=>{b||h||m||i()},[m,b,h,i]),c.useEffect(()=>{M(1)},[N]);const W=c.useMemo(()=>(H(te,{min:1,max:1e6,fallback:1})-1)*_,[te,_]),R=c.useMemo(()=>h?"mock":b?"unavailable":m?"cloud":r?"local":f?"public":"unavailable",[b,m,f,h,r]),k=c.useMemo(()=>ja({accessMode:R,baseUrl:f,mockEnabled:h,userId:x?.id||null,period:N,pageSize:_,offset:W}),[x?.id,R,f,W,h,_,N]),[D,$]=c.useState(()=>{const t=ne(k);return t?{loading:!1,error:null,data:t.data,contextKey:k}:{loading:!1,error:null,data:null,contextKey:null}});c.useEffect(()=>{if(!f&&!h||!h&&R==="unavailable"){$({loading:!1,error:null,data:null,contextKey:null});return}const t=ne(k);let u=!0;return $(t?{loading:!1,error:null,data:t.data,contextKey:k}:{loading:!0,error:null,data:null,contextKey:null}),(async()=>{const w=await va({userId:x?.id||null,period:N,limit:_,offset:W});u&&(Na(w,{activeContextKey:k,contextKey:k,source:ve>0?"manual-refresh":"page-load"}),$({loading:!1,error:null,data:w,contextKey:k}))})().catch(w=>{if(!u)return;const A=Tr(w);$(F=>F.contextKey===k?{...F,loading:!1,error:A}:{loading:!1,error:A,data:null,contextKey:k})}),()=>{u=!1}},[f,R,x?.id,k,W,ve,h,N,_]);const oe=c.useMemo(()=>D.contextKey===k?null:ne(k),[k,D.contextKey]),v=c.useMemo(()=>D.contextKey===k?D:oe?{loading:!1,error:null,data:oe.data,contextKey:k}:{loading:!!(f||h)&&R!=="unavailable",error:null,data:null,contextKey:k},[R,f,k,D,h,oe]),S=v.data,U=S?.total_pages??null,sa=S?.total_entries??0,P=S?.page??te,na=c.useMemo(()=>rr(P,U),[P,U]),Se=S?.from||null,Ce=S?.to||null,ia=S?.generated_at||null,V=wr(ia),Le=Xa(),K=S?.me||null,I=s("leaderboard.me_label"),Ee=s("leaderboard.anon_label"),Te=s("leaderboard.period.week"),Ae=s("leaderboard.period.month"),Me=s("leaderboard.period.total"),Pe=N==="month"?Ae:N==="total"?Me:Te,q=c.useMemo(()=>{const t=Array.isArray(S?.entries)?S.entries:[];return or({entries:t,me:K,meLabel:I})},[S?.entries,K,I]),z=c.useMemo(()=>sr(K?.rank,_),[K?.rank,_]),la=z!=null&&z===P,da=c.useCallback(()=>{z!=null&&M(z)},[z]),ca=async()=>{_e(!0);try{La(!0),ta(!0),await Ea(()=>Ta(C))}catch(t){console.warn("[tokentracker] sync:",t)}finally{_e(!1)}},{canPrev:Ke,canNext:Re}=tr({page:P,totalPages:U}),J=Array.isArray(q)&&q.length!==0;let O=null;v.loading&&!J?O=e.jsx(cr,{rows:_}):v.error&&!J?O=e.jsx("div",{className:"px-6 py-12 text-center",children:e.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:v.error})}):J?O=e.jsxs(Da,{sensors:qe,collisionDetection:$a,modifiers:[ar],onDragEnd:Je,children:[e.jsx("div",{className:"hidden w-full overflow-x-auto sm:block",children:e.jsxs("table",{className:"min-w-full w-full text-left text-sm sm:min-w-max",children:[e.jsx("thead",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800",children:e.jsxs("tr",{children:[e.jsx("th",{className:d(Ge,"text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500"),children:s("leaderboard.column.rank")}),e.jsx("th",{className:d(He,"text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500"),children:s("leaderboard.column.user")}),e.jsx("th",{className:"px-3 sm:px-4 py-4 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500 whitespace-nowrap text-right align-middle",children:s("leaderboard.column.total")}),e.jsx("th",{className:"hidden sm:table-cell px-3 sm:px-4 py-4 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500 whitespace-nowrap text-right align-middle",title:"Based on estimated API pricing, not actual billing",children:s("leaderboard.column.est_cost")}),e.jsx(Ua,{items:re,strategy:Oa,children:B.map(t=>e.jsx(mr,{id:t.key,thClassName:"hidden sm:table-cell px-3 sm:px-4 py-4 text-[11px] font-semibold uppercase tracking-wider text-oai-gray-400 dark:text-oai-gray-500 whitespace-nowrap align-middle",children:e.jsx(ir,{iconSrc:t.icon,label:s(t.copyKey)})},t.key))})]})}),e.jsx("tbody",{className:"divide-y divide-oai-gray-100 dark:divide-oai-gray-800/50",children:q.map((t,u)=>{if(t?.is_ellipsis){const E=4+B.length;return e.jsx("tr",{"aria-hidden":"true",children:e.jsx("td",{colSpan:E,className:"px-4 py-2 text-center text-oai-gray-400 dark:text-oai-gray-600 bg-white dark:bg-oai-gray-950 select-none tracking-[0.4em] text-xs",children:"···"})},`ellipsis-${u}`)}const w=!!t?.is_me,A=typeof t?.user_id=="string"?t.user_id:null,F=ge(t?.display_name),ma=be(F)?Ee:F,L=w?I:ma,G=!!A,Ie=G?{role:"button",tabIndex:0,onClick:G?()=>Y(A):void 0,onKeyDown:G?E=>{(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),Y(A))}:void 0,"aria-label":s("leaderboard.profile_modal.row_aria",{name:L})}:{};if(w){const E=!!t?.is_pinned;return e.jsxs("tr",{...Ie,className:d("bg-oai-brand-50 dark:bg-oai-brand-900/10 transition-colors",E?"border-t border-b border-oai-brand-300/40 dark:border-oai-brand-500/20":"border-y border-oai-brand-300/40 dark:border-oai-brand-500/30",G&&"cursor-pointer focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500/60"),children:[e.jsx("td",{className:d(le(!0),"font-semibold text-oai-brand-600 dark:text-oai-brand-400",E&&"before:absolute before:left-0 before:top-[15%] before:h-[70%] before:w-[3px] before:rounded-r before:bg-oai-brand-500 dark:before:bg-oai-brand-400"),children:e.jsx($e,{rank:t?.rank,placeholder:ae})}),e.jsx("td",{className:de(!0),children:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsxs("span",{className:d("relative inline-flex shrink-0 rounded-full p-[2px]",t?.github_url&&"gh-avatar-frame"),children:[e.jsx("span",{className:d("inline-flex rounded-full p-px",t?.github_url&&"bg-white dark:bg-oai-gray-950"),children:e.jsx(Z,{avatarUrl:t?.avatar_url,displayName:L,seed:pe(t,L)})}),t?.github_url&&e.jsx(Oe,{githubUrl:t.github_url})]}),e.jsx("span",{className:"truncate font-semibold text-oai-black dark:text-oai-white",children:L}),e.jsx(ie,{badges:t?.badges,className:"hidden sm:inline-flex"})]})}),e.jsx("td",{className:"px-3 sm:px-4 py-4 font-medium text-oai-black dark:text-oai-white whitespace-nowrap text-right tabular-nums bg-oai-brand-50 dark:bg-oai-brand-900/10",children:e.jsx(xe,{value:t?.total_tokens})}),e.jsx("td",{className:"hidden sm:table-cell px-3 sm:px-4 py-4 font-medium text-oai-brand-600 dark:text-oai-brand-400 whitespace-nowrap text-right tabular-nums bg-oai-brand-50 dark:bg-oai-brand-900/10",title:"Based on estimated API pricing, not actual billing",children:ue(t?.estimated_cost_usd,p,j)}),e.jsx(De,{entry:t,isMe:!0,orderedColumns:B})]},`row-${t?.rank}-${L}${E?"-pin":""}`)}return e.jsxs("tr",{...Ie,className:d("group transition-colors",G&&"cursor-pointer hover:bg-oai-gray-50 dark:hover:bg-oai-gray-900/60 focus:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500/60"),children:[e.jsx("td",{className:d(le(!1),"font-medium text-oai-gray-500 dark:text-oai-gray-400"),children:e.jsx($e,{rank:t?.rank,placeholder:ae})}),e.jsx("td",{className:de(!1),children:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsxs("span",{className:d("relative inline-flex shrink-0 rounded-full p-[2px]",t?.github_url&&"gh-avatar-frame"),children:[e.jsx("span",{className:d("inline-flex rounded-full p-px",t?.github_url&&"bg-white dark:bg-oai-gray-950"),children:e.jsx(Z,{avatarUrl:t?.avatar_url,displayName:L,seed:pe(t,L)})}),t?.github_url&&e.jsx(Oe,{githubUrl:t.github_url})]}),e.jsx("span",{className:"truncate font-medium text-oai-gray-800 dark:text-oai-gray-200",children:L}),e.jsx(ie,{badges:t?.badges,className:"hidden sm:inline-flex"})]})}),e.jsx("td",{className:"px-3 sm:px-4 py-4 font-semibold text-oai-gray-800 dark:text-oai-gray-200 whitespace-nowrap text-right tabular-nums bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60",children:e.jsx(xe,{value:t?.total_tokens})}),e.jsx("td",{className:"hidden sm:table-cell px-3 sm:px-4 py-4 text-oai-gray-500 dark:text-oai-gray-400 whitespace-nowrap text-right tabular-nums bg-white dark:bg-oai-gray-950 group-hover:bg-oai-gray-50 dark:group-hover:bg-oai-gray-900/60",title:"Based on estimated API pricing, not actual billing",children:ue(t?.estimated_cost_usd,p,j)}),e.jsx(De,{entry:t,isMe:!1,orderedColumns:B})]},`row-${t?.rank}-${L}`)})})]})}),e.jsx("div",{className:"flex flex-col py-1.5 sm:hidden",children:q.map((t,u)=>{const w=ge(t?.display_name),A=be(w)?Ee:w;return e.jsx(Lr,{entry:t,entryIdx:u,name:t?.is_me?I:A,meLabel:I,currency:p,rate:j,orderedColumns:B,placeholder:ae,onOpenProfile:Y},`mobile-${t?.rank??"ellipsis"}-${u}`)})})]}):O=e.jsx("div",{className:"px-6 py-12 text-center",children:e.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("leaderboard.empty")})});let se=null;return typeof U=="number"?se=na.map((t,u)=>t==null?e.jsx("span",{className:"px-2 text-oai-gray-400 dark:text-oai-gray-500",children:s("leaderboard.pagination.ellipsis")},`ellipsis-${u}`):e.jsx("button",{className:d("flex h-8 w-8 items-center justify-center rounded-md text-sm font-medium transition-colors",t===P?"bg-oai-gray-200 dark:bg-oai-gray-800 text-oai-black dark:text-white":"text-oai-gray-500 dark:text-oai-gray-400 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white"),onClick:()=>M(t),disabled:v.loading,children:String(t)},`page-${t}`)):se=e.jsx("span",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:s("leaderboard.pagination.page_unknown",{page:String(P)})}),e.jsxs("div",{className:"flex flex-col flex-1 text-oai-black dark:text-oai-white font-oai antialiased",children:[e.jsx("main",{className:"flex-1 pt-8 sm:pt-10 pb-12 sm:pb-16",children:e.jsxs("div",{className:"mx-auto max-w-6xl px-4 sm:px-6",children:[e.jsxs("div",{className:"mb-4 grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-3 gap-y-3.5 sm:mb-8 sm:grid-cols-[minmax(0,1fr)_auto] sm:gap-4",children:[e.jsx("h1",{className:"col-start-1 row-start-1 min-w-0 whitespace-nowrap text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:col-span-2 sm:row-start-1 sm:text-4xl",children:s("leaderboard.title")}),e.jsxs("p",{className:"col-span-2 row-start-2 hidden text-sm text-oai-gray-500 dark:text-oai-gray-400 sm:block sm:row-start-2 sm:text-base",children:[N==="total"?s("leaderboard.range.total"):Se&&Ce?s("leaderboard.range",{period:Pe,from:Se,to:Ce}):s("leaderboard.range_loading",{period:Pe}),V&&e.jsx("time",{dateTime:V.dateTime,title:s("leaderboard.generated_at",{ts:V.exact}),className:"ml-2 hidden border-l border-oai-gray-200 pl-2 text-xs text-oai-gray-500 dark:border-oai-gray-800 dark:text-oai-gray-400 sm:inline-block",children:s("leaderboard.generated_at",{ts:V.display})})]}),e.jsx("div",{className:"col-start-2 row-start-1 inline-flex h-9 shrink-0 items-center rounded-full border border-oai-gray-200 p-1 dark:border-oai-gray-800 sm:col-start-1 sm:row-start-3 sm:justify-self-start",children:["week","month","total"].map(t=>{const u=N===t;return e.jsxs("button",{onClick:()=>oa(t),disabled:v.loading,className:d("px-3 sm:px-4 h-7 text-sm font-medium rounded-full flex items-center justify-center transition-colors relative",u?"text-oai-black dark:text-white":"text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-800 dark:hover:text-oai-gray-200"),children:[e.jsx("span",{className:"relative z-10",children:t==="week"?Te:t==="month"?Ae:Me}),u&&e.jsx(Ka.div,{layoutId:"leaderboard-period-active-bg",className:"absolute inset-0 bg-oai-gray-200 dark:bg-oai-gray-800 rounded-full z-0",transition:{type:"spring",stiffness:380,damping:30}})]},t)})}),e.jsxs("div",{className:"col-span-2 row-start-2 mb-0 flex w-full min-w-0 items-center justify-between sm:justify-end gap-2.5 sm:col-span-1 sm:col-start-2 sm:row-start-3 sm:mb-0 sm:w-auto sm:shrink-0",children:[e.jsx(jr,{communityStats:Le,onClick:()=>je(!0)}),e.jsx(hr,{me:K,totalEntries:sa,meLabel:I,onOpenProfile:K?.user_id?()=>Y(K.user_id):void 0,onJumpToMe:da,canJump:z!=null&&!la&&!v.loading,className:"shrink-0"})]})]}),!r&&e.jsxs("div",{className:"mb-6 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between text-sm",children:[e.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:s("leaderboard.signin_prompt")}),e.jsx("button",{onClick:i,className:"shrink-0 whitespace-nowrap self-start sm:self-auto px-3 py-1.5 text-sm font-medium text-oai-gray-600 dark:text-oai-gray-300 border border-oai-gray-300 dark:border-oai-gray-700 rounded-md hover:text-oai-black dark:hover:text-white hover:border-oai-gray-400 dark:hover:border-oai-gray-600 transition-colors",children:s("leaderboard.signin_button")})]}),g&&ee&&!ra&&e.jsxs("div",{className:"mb-6 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between text-sm",children:[e.jsx("p",{className:"text-oai-gray-500 dark:text-oai-gray-400",children:s("leaderboard.sync_prompt")}),e.jsx("button",{onClick:ca,disabled:Ne,className:"shrink-0 whitespace-nowrap self-start sm:self-auto px-3 py-1.5 text-sm font-medium text-oai-gray-600 dark:text-oai-gray-300 border border-oai-gray-300 dark:border-oai-gray-700 rounded-md hover:text-oai-black dark:hover:text-white hover:border-oai-gray-400 dark:hover:border-oai-gray-600 disabled:opacity-50 transition-colors",children:Ne?s("leaderboard.sync_button.busy"):s("leaderboard.sync_button.idle")})]}),e.jsxs("div",{className:"sm:rounded-xl sm:border sm:border-oai-gray-200 sm:dark:border-oai-gray-800 sm:overflow-hidden border-none bg-transparent",children:[v.error&&J?e.jsx("div",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800 px-6 py-3",children:e.jsx("p",{className:"text-sm text-red-500 dark:text-red-400",children:v.error})}):null,O,e.jsxs("div",{className:"flex flex-col gap-3 sm:border-t border-oai-gray-200 px-4 py-3 sm:flex-row sm:items-center sm:justify-end sm:gap-x-4 sm:px-6 dark:border-oai-gray-800 border-none mt-2.5 sm:mt-0",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 text-sm text-oai-gray-500 dark:text-oai-gray-400 sm:justify-start",children:[e.jsx("label",{htmlFor:"leaderboard-page-size",className:"whitespace-nowrap",children:s("leaderboard.pagination.page_size_label")}),e.jsx(Pa,{id:"leaderboard-page-size",value:_,onValueChange:t=>ea(Number(t)),disabled:v.loading,ariaLabel:s("leaderboard.pagination.page_size_label"),options:ce.map(t=>({value:t,label:String(t)})),align:"end",className:"px-3 py-1 text-oai-gray-700 dark:text-oai-gray-300"})]}),e.jsx("div",{className:"hidden h-5 w-px bg-oai-gray-200 dark:bg-oai-gray-800 sm:block","aria-hidden":"true"}),e.jsxs("div",{className:"flex w-full items-center justify-between sm:w-auto sm:justify-end gap-1.5",children:[e.jsx("button",{className:d("whitespace-nowrap rounded-xl border border-oai-gray-100 bg-oai-gray-50/50 px-3.5 py-2 text-xs font-medium text-oai-gray-500 dark:border-oai-gray-800/80 dark:bg-white/[0.01] dark:text-oai-gray-400 transition-all duration-200 active:scale-[0.97] sm:rounded-md sm:border-0 sm:bg-transparent sm:px-3 sm:py-1.5 sm:text-sm sm:font-medium sm:active:scale-100",Ke&&!v.loading?"hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white":"opacity-50 cursor-not-allowed"),onClick:()=>M(t=>Math.max(1,t-1)),disabled:!Ke||v.loading,children:s("leaderboard.pagination.prev")}),e.jsxs("span",{className:"text-xs font-semibold tabular-nums text-oai-gray-500 dark:text-oai-gray-455 px-2 sm:hidden",children:[P," / ",U||"?"]}),e.jsx("div",{className:"hidden sm:flex items-center gap-1",children:se}),e.jsx("button",{className:d("whitespace-nowrap rounded-xl border border-oai-gray-100 bg-oai-gray-50/50 px-3.5 py-2 text-xs font-medium text-oai-gray-500 dark:border-oai-gray-800/80 dark:bg-white/[0.01] dark:text-oai-gray-400 transition-all duration-200 active:scale-[0.97] sm:rounded-md sm:border-0 sm:bg-transparent sm:px-3 sm:py-1.5 sm:text-sm sm:font-medium sm:active:scale-100",Re&&!v.loading?"hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white":"opacity-50 cursor-not-allowed"),onClick:()=>M(t=>t+1),disabled:!Re||v.loading,children:s("leaderboard.pagination.next")})]})]})]})]})}),e.jsx("footer",{className:"border-t border-oai-gray-200 dark:border-oai-gray-900 py-8 transition-colors duration-200",children:e.jsxs("div",{className:"mx-auto flex max-w-6xl items-center justify-between px-4 sm:px-6 text-sm text-oai-gray-400 dark:text-oai-gray-500",children:[e.jsx("p",{children:s("landing.v2.footer.line")}),e.jsx("a",{href:"https://github.com/mm7894215/TokenTracker",className:"text-oai-gray-400 dark:text-oai-gray-500 hover:text-oai-black dark:hover:text-white transition-colors",target:"_blank",rel:"noopener noreferrer",children:s("landing.v2.nav.github")})]})}),e.jsxs(c.Suspense,{fallback:null,children:[e.jsx(fr,{isOpen:!!ke,userId:ke,period:N,accessToken:C,onClose:Qe}),e.jsx(yr,{isOpen:Xe,onClose:()=>je(!1),communityStats:Le})]})]})}export{qr as LeaderboardPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{aI as Xe,aR as Ue,aS as le,aT as We,Q as ne,aH as ge,r as m,aU as J,aV as me,aW as he,aX as oe,aE as Re,aY as Ke,aZ as we,aF as z,E as $,a_ as K,a2 as ue,ay as pe,aG as qe,a$ as Ee,b0 as ze,F as Qe,b1 as $e,b2 as Te,W as q,j as Y,aD as Je,Y as Me,aL as Ze,b3 as et,b4 as tt,b5 as nt,b6 as ot,z as st,A as Le,b7 as rt,b8 as ye,aB as it,b9 as at,ba as ct,aC as lt,aA as ut,bb as ft,az as dt}from"./__vite-browser-external-Db9onipF.js";import{n as Pe,o as Ae,q as He,r as Ce,v as se,P as pt,w as gt,k as mt,s as ht,x as Et,y as Tt,e as Pt,f as Ct,g as vt,h as Rt,a as Be,j as St,u as bt,z as Ot,A as It,t as Mt,B as yt,I as xt,D as Ft,c as kt,d as wt,b as Lt,p as At}from"./useScrollLock-DuosKdSB.js";import{c as Ht,p as Bt,a as Dt}from"./store-BwMVXuz3.js";import{a as _t,b as jt,c as Nt,d as Yt,e as Vt,f as Gt,g as Xt,h as Ut}from"./ToolbarRootContext-CwRaHhMN.js";function Wt(e,n){return n!=null&&!Pe(n)?0:typeof e=="function"?e():e}function ve(e,n,t){const l=Wt(e,t);return typeof l=="number"?l:l?.[n]}function xe(e){return typeof e=="function"?e():e}function De(e,n){return n||e==="click"||e==="mousedown"}function Kt(e){return e?.includes("mouse")&&e!=="mousedown"}class Se{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new le,this.restTimeout=new le,this.handleCloseOptions=void 0}static create(){return new Se}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}const fe=new WeakMap;function de(e){if(!e.performedPointerEventsMutation)return;const n=e.pointerEventsScopeElement;n&&fe.get(n)===e&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),fe.delete(n)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function _e(e,n){const{scopeElement:t,referenceElement:l,floatingElement:i}=n,o=fe.get(t);o&&o!==e&&de(o),de(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=t,e.pointerEventsReferenceElement=l,e.pointerEventsFloatingElement=i,fe.set(t,e),t.style.pointerEvents="none",l.style.pointerEvents="auto",i.style.pointerEvents="auto"}function je(e){const n=e.context.dataRef.current,t=Xe(()=>n.hoverInteractionState??Se.create()).current;return n.hoverInteractionState||(n.hoverInteractionState=t),Ue(n.hoverInteractionState.disposeEffect),n.hoverInteractionState}function qt(e,n={}){const{enabled:t=!0,closeDelay:l=0,nodeId:i}=n,o="rootStore"in e?e.rootStore:e,p=o.useState("open"),E=o.useState("floatingElement"),b=o.useState("domReferenceElement"),{dataRef:c}=o.context,r=Ae(),O=He(),h=je(o),N=We(),u=ne(()=>De(c.current.openEvent?.type,h.interactedInside)),B=ne(()=>Kt(c.current.openEvent?.type)),g=ne(()=>{de(h)});ge(()=>{p||(h.pointerType=void 0,h.restTimeoutPending=!1,h.interactedInside=!1,g())},[p,h,g]),m.useEffect(()=>g,[g]),ge(()=>{if(t&&p&&h.handleCloseOptions?.blockPointerEvents&&B()&&J(b)&&E){const x=b,a=E,d=me(E),F=r?.nodesRef.current.find(R=>R.id===O)?.context?.elements.floating;F&&(F.style.pointerEvents="");const H=h.pointerEventsScopeElement!==a?h.pointerEventsScopeElement:null,P=F!==a?F:null,v=h.handleCloseOptions?.getScope?.()??H??P??x.closest("[data-rootownerid]")??d.body;return _e(h,{scopeElement:v,referenceElement:x,floatingElement:a}),()=>{g()}}},[t,p,b,E,h,B,r,O,g]),m.useEffect(()=>{if(!t)return;function x(){return!!(r&&O&&Ce(r.nodesRef.current,O).length>0)}function a(R){const M=ve(l,"close",h.pointerType),_=()=>{o.setOpen(!1,$(K,R)),r?.events.emit("floating.closed",R)};M?h.openChangeTimeout.start(M,_):(h.openChangeTimeout.clear(),_())}function d(R){const M=Re(R);if(!Ke(M)){h.interactedInside=!1;return}h.interactedInside=M?.closest("[aria-haspopup]")!=null}function F(){h.openChangeTimeout.clear(),N.clear(),r?.events.off("floating.closed",P),g()}function H(R){if(x()&&r){r.events.on("floating.closed",P);return}if(we(R.relatedTarget,o.context.triggerElements))return;const M=c.current.floatingContext?.nodeId??i,_=R.relatedTarget;if(!(r&&M&&J(_)&&Ce(r.nodesRef.current,M,!1).some(X=>z(X.context?.elements.floating,_)))){if(h.handler){h.handler(R);return}g(),B()&&!u()&&a(R)}}function P(R){!r||!O||x()||N.start(0,()=>{r.events.off("floating.closed",P),o.setOpen(!1,$(K,R)),r.events.emit("floating.closed",R)})}const v=E;return he(v&&oe(v,"mouseenter",F),v&&oe(v,"mouseleave",H),v&&oe(v,"pointerdown",d,!0),()=>{r?.events.off("floating.closed",P)})},[t,E,o,c,l,i,B,u,g,h,r,O,N])}const zt={current:null};function Qt(e,n={}){const{enabled:t=!0,delay:l=0,handleClose:i=null,mouseOnly:o=!1,restMs:p=0,move:E=!0,triggerElementRef:b=zt,externalTree:c,isActiveTrigger:r=!0,getHandleCloseContext:O,isClosing:h,shouldOpen:N}=n,u="rootStore"in e?e.rootStore:e,{dataRef:B,events:g}=u.context,x=Ae(c),a=je(u),d=m.useRef(!1),F=se(i),H=se(l),P=se(p),v=se(t),R=se(N),M=se(h),_=ne(()=>De(B.current.openEvent?.type,a.interactedInside)),G=ne(()=>R.current?.()!==!1),X=ne((s,T,L)=>{const S=u.context.triggerElements;if(S.hasElement(T))return!s||!z(s,T);if(!J(L))return!1;const f=L;return S.hasMatchingElement(A=>z(A,f))&&(!s||!z(s,f))}),j=ne(()=>{if(!a.handler)return;me(u.select("domReferenceElement")).removeEventListener("mousemove",a.handler),a.handler=void 0}),w=ne(()=>{de(a)});return r&&(a.handleCloseOptions=F.current?.__options),m.useEffect(()=>j,[j]),m.useEffect(()=>{if(!t)return;function s(T){T.open?d.current=!1:(d.current=T.reason===K,j(),a.openChangeTimeout.clear(),a.restTimeout.clear(),a.blockMouseMove=!0,a.restTimeoutPending=!1)}return g.on("openchange",s),()=>{g.off("openchange",s)}},[t,g,a,j]),m.useEffect(()=>{if(!t)return;function s(f,A=!0){const D=ve(H.current,"close",a.pointerType);D?a.openChangeTimeout.start(D,()=>{u.setOpen(!1,$(K,f)),x?.events.emit("floating.closed",f)}):A&&(a.openChangeTimeout.clear(),u.setOpen(!1,$(K,f)),x?.events.emit("floating.closed",f))}const T=b.current??(r?u.select("domReferenceElement"):null);if(!J(T))return;function L(f){if(a.openChangeTimeout.clear(),a.blockMouseMove=!1,o&&!Pe(a.pointerType))return;const A=xe(P.current),D=ve(H.current,"open",a.pointerType),V=Re(f),U=f.currentTarget??null,I=u.select("domReferenceElement");let k=U;if(J(V)&&!u.context.triggerElements.hasElement(V)){for(const Ie of u.context.triggerElements.elements())if(z(Ie,V)){k=Ie;break}}J(U)&&J(I)&&!u.context.triggerElements.hasElement(U)&&z(U,I)&&(k=I);const C=k==null?!1:X(I,k,V),Q=u.select("open"),Z=M.current?.()??u.select("transitionStatus")==="ending",W=!Q&&Z&&d.current,ee=!C&&J(k)&&J(I)&&z(I,k)&&W,te=A>0&&!D,Ge=C&&(Q||W)||ee,Oe=!Q||C;if(Ge){G()&&u.setOpen(!0,$(K,f,k));return}te||(D?a.openChangeTimeout.start(D,()=>{Oe&&G()&&u.setOpen(!0,$(K,f,k))}):Oe&&G()&&u.setOpen(!0,$(K,f,k)))}function S(f){if(_()){w();return}j();const A=u.select("domReferenceElement"),D=me(A);a.restTimeout.clear(),a.restTimeoutPending=!1;const V=B.current.floatingContext??O?.();if(we(f.relatedTarget,u.context.triggerElements))return;if(F.current&&V){u.select("open")||a.openChangeTimeout.clear();const I=b.current;a.handler=F.current({...V,tree:x,x:f.clientX,y:f.clientY,onClose(){w(),j(),v.current&&!_()&&I===u.select("domReferenceElement")&&s(f,!0)}}),D.addEventListener("mousemove",a.handler),a.handler(f);return}(a.pointerType!=="touch"||!z(u.select("floatingElement"),f.relatedTarget))&&s(f)}return E?he(oe(T,"mousemove",L,{once:!0}),oe(T,"mouseenter",L),oe(T,"mouseleave",S)):he(oe(T,"mouseenter",L),oe(T,"mouseleave",S))},[j,w,B,H,u,t,F,a,r,X,_,o,E,P,b,x,v,O,M,G]),m.useMemo(()=>{if(!t)return;function s(T){a.pointerType=T.pointerType}return{onPointerDown:s,onPointerEnter:s,onMouseMove(T){const{nativeEvent:L}=T,S=T.currentTarget,f=u.select("domReferenceElement"),A=u.select("open"),D=X(f,S,T.target);if(o&&!Pe(a.pointerType))return;if(A&&D&&a.handleCloseOptions?.blockPointerEvents){const I=u.select("floatingElement");if(I){const k=a.handleCloseOptions?.getScope?.()??S.ownerDocument.body;_e(a,{scopeElement:k,referenceElement:S,floatingElement:I})}}const V=xe(P.current);if(A&&!D||V===0||!D&&a.restTimeoutPending&&T.movementX**2+T.movementY**2<2)return;a.restTimeout.clear();function U(){if(a.restTimeoutPending=!1,_())return;const I=u.select("open");!a.blockMouseMove&&(!I||D)&&G()&&u.setOpen(!0,$(K,L,S))}a.pointerType==="touch"?ue.flushSync(()=>{U()}):D&&A?U():(a.restTimeoutPending=!0,a.restTimeout.start(V,U))}}},[t,a,_,X,o,u,P,G])}const Fe=.1,$t=Fe*Fe,y=.5;function ie(e,n,t,l,i,o){return l>=n!=o>=n&&e<=(i-t)*(n-l)/(o-l)+t}function ae(e,n,t,l,i,o,p,E,b,c){let r=!1;return ie(e,n,t,l,i,o)&&(r=!r),ie(e,n,i,o,p,E)&&(r=!r),ie(e,n,p,E,b,c)&&(r=!r),ie(e,n,b,c,t,l)&&(r=!r),r}function Jt(e,n,t){return e>=t.x&&e<=t.x+t.width&&n>=t.y&&n<=t.y+t.height}function ce(e,n,t,l,i,o){const p=Math.min(t,i),E=Math.max(t,i),b=Math.min(l,o),c=Math.max(l,o);return e>=p&&e<=E&&n>=b&&n<=c}function Zt(e={}){const{blockPointerEvents:n=!1}=e,t=new le,l=({x:i,y:o,placement:p,elements:E,onClose:b,nodeId:c,tree:r})=>{const O=p?.split("-")[0];let h=!1,N=null,u=null,B=typeof performance<"u"?performance.now():0;function g(a,d){const F=performance.now(),H=F-B;if(N===null||u===null||H===0)return N=a,u=d,B=F,!1;const P=a-N,v=d-u,R=P*P+v*v,M=H*H*$t;return N=a,u=d,B=F,R<M}function x(){t.clear(),b()}return function(d){t.clear();const F=E.domReference,H=E.floating;if(!F||!H||O==null||i==null||o==null)return;const{clientX:P,clientY:v}=d,R=Re(d),M=d.type==="mouseleave",_=z(H,R),G=z(F,R);if(_&&(h=!0,!M))return;if(G&&(h=!1,!M)){h=!0;return}if(M&&J(d.relatedTarget)&&z(H,d.relatedTarget))return;function X(){return!!(r&&Ce(r.nodesRef.current,c).length>0)}function j(){X()||x()}if(X())return;const w=F.getBoundingClientRect(),s=H.getBoundingClientRect(),T=i>s.right-s.width/2,L=o>s.bottom-s.height/2,S=s.width>w.width,f=s.height>w.height,A=(S?w:s).left,D=(S?w:s).right,V=(f?w:s).top,U=(f?w:s).bottom;if(O==="top"&&o>=w.bottom-1||O==="bottom"&&o<=w.top+1||O==="left"&&i>=w.right-1||O==="right"&&i<=w.left+1){j();return}let I=!1;switch(O){case"top":I=ce(P,v,A,w.top+1,D,s.bottom-1);break;case"bottom":I=ce(P,v,A,s.top+1,D,w.bottom-1);break;case"left":I=ce(P,v,s.right-1,U,w.left+1,V);break;case"right":I=ce(P,v,w.right-1,U,s.left+1,V);break}if(I)return;if(h&&!Jt(P,v,w)){j();return}if(!M&&g(P,v)){j();return}let k=!1;switch(O){case"top":{const C=S?y/2:y*4,Q=S||T?i+C:i-C,Z=S?i-C:T?i+C:i-C,W=o+y+1,ee=T||S?s.bottom-y:s.top,te=T?S?s.bottom-y:s.top:s.bottom-y;k=ae(P,v,Q,W,Z,W,s.left,ee,s.right,te);break}case"bottom":{const C=S?y/2:y*4,Q=S||T?i+C:i-C,Z=S?i-C:T?i+C:i-C,W=o-y,ee=T||S?s.top+y:s.bottom,te=T?S?s.top+y:s.bottom:s.top+y;k=ae(P,v,Q,W,Z,W,s.left,ee,s.right,te);break}case"left":{const C=f?y/2:y*4,Q=f||L?o+C:o-C,Z=f?o-C:L?o+C:o-C,W=i+y+1,ee=L||f?s.right-y:s.left,te=L?f?s.right-y:s.left:s.right-y;k=ae(P,v,ee,s.top,te,s.bottom,W,Q,W,Z);break}case"right":{const C=f?y/2:y*4,Q=f||L?o+C:o-C,Z=f?o-C:L?o+C:o-C,W=i-y,ee=L||f?s.left+y:s.right,te=L?f?s.left+y:s.right:s.left+y;k=ae(P,v,W,Q,W,Z,ee,s.top,te,s.bottom);break}}k?h||t.start(40,j):j()}};return l.__options={...e,blockPointerEvents:n},l}const Ne=m.createContext(void 0);function re(e){const n=m.useContext(Ne);if(n===void 0&&!e)throw new Error(pe(47));return n}function en(){return{...Dt(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}const tn={...Bt,disabled:q(e=>e.disabled),instantType:q(e=>e.instantType),openMethod:q(e=>e.openMethod),openChangeReason:q(e=>e.openChangeReason),modal:q(e=>e.modal),focusManagerModal:q(e=>e.focusManagerModal),stickIfOpen:q(e=>e.stickIfOpen),titleElementId:q(e=>e.titleElementId),descriptionElementId:q(e=>e.descriptionElementId),openOnHover:q(e=>e.openOnHover),closeDelay:q(e=>e.closeDelay),hasViewport:q(e=>e.hasViewport)};class be extends qe{constructor(n,t,l=!1){const i={...en(),...n},o=new pt;i.open&&n?.mounted===void 0&&(i.mounted=!0),i.floatingRootContext=Ht(o,t,l),super(i,{popupRef:m.createRef(),backdropRef:m.createRef(),internalBackdropRef:m.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:m.createRef(),beforeContentFocusGuardRef:m.createRef(),stickIfOpenTimeout:new le,triggerElements:o},tn)}setOpen=(n,t)=>{const l=t.reason===K,i=t.reason===Ee&&t.event.detail===0,o=!n&&(t.reason===ze||t.reason==null),p=gt(t),E=this.select("activeTriggerId");if(!n&&t.reason===Qe&&t.trigger==null&&E!=null&&(t.trigger=this.context.triggerElements.getById(E)??this.select("activeTriggerElement")??void 0),this.context.onOpenChange?.(n,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(n,t);const b=()=>{const c={open:n,openChangeReason:t.reason};ht(c,n,t.trigger,p()),this.update(c)};l?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start($e,()=>{this.set("stickIfOpen",!1)}),ue.flushSync(b)):b(),i||o?this.set("instantType",i?"click":"dismiss"):t.reason===Te?this.set("instantType","focus"):this.set("instantType",void 0)};static useStore(n,t){const{store:l,internalStore:i}=mt(n,(o,p)=>new be(t,o,p));return m.useEffect(()=>i?.disposeEffect(),[i]),l}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()}function ke({props:e}){const{children:n,open:t,defaultOpen:l=!1,onOpenChange:i,onOpenChangeComplete:o,modal:p=!1,handle:E,triggerId:b,defaultTriggerId:c=null}=e,r=be.useStore(E?.store,{modal:p,open:l,openProp:t,activeTriggerId:c,triggerIdProp:b});Tt(r,t,l,c),r.useControlledProp("openProp",t),r.useControlledProp("triggerIdProp",b);const O=r.useState("open"),h=r.useState("mounted"),N=r.useState("payload"),u=He()!=null;r.useContextCallback("onOpenChange",i),r.useContextCallback("onOpenChangeComplete",o),Pt(r,O),Ct(r);const{forceUnmount:B}=vt(O,r,()=>{r.update({stickIfOpen:!0,openChangeReason:null})});r.useSyncedValues({modal:p,nested:u}),m.useEffect(()=>{O||r.context.stickIfOpenTimeout.clear()},[r,O]);const g=m.useCallback(()=>{r.setOpen(!1,$(Je))},[r]);m.useImperativeHandle(e.actionsRef,()=>({unmount:B,close:g}),[B,g]);const x=O||h,a=m.useMemo(()=>({store:r}),[r]);return Y.jsxs(Ne.Provider,{value:a,children:[x&&Y.jsx(nn,{store:r,modal:p}),typeof n=="function"?n({payload:N}):n]})}function hn(e){return re(!0)?Y.jsx(ke,{props:e}):Y.jsx(Et,{children:Y.jsx(ke,{props:e})})}function nn({store:e,modal:n}){const t=e.useState("floatingRootContext"),l=Rt(t,{outsidePressEvent:{mouse:n==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),i=l.reference??Me,o=l.trigger??Me,p=m.useMemo(()=>Ze(Be,l.floating),[l.floating]);return St(e,{activeTriggerProps:i,inactiveTriggerProps:o,popupProps:p}),null}const on=300;function sn(e,n){const t=m.useRef(null);function l(o){ue.flushSync(()=>{e.setOpen(!1,$(Te,o.nativeEvent,o.currentTarget))}),ot(t.current)?.focus()}function i(o){const p=e.select("positionerElement");if(p&&et(o,p))e.context.beforeContentFocusGuardRef.current?.focus();else{ue.flushSync(()=>{e.setOpen(!1,$(Te,o.nativeEvent,o.currentTarget))});let E=tt(e.context.triggerFocusTargetRef.current||n.current);for(;E!==null&&z(p,E);){const b=E;if(E=nt(E),E===b)break}E?.focus()}}return{preFocusGuardRef:t,handlePreFocusGuardFocus:l,handleFocusTargetFocus:i}}const En=m.forwardRef(function(n,t){const{render:l,className:i,style:o,disabled:p=!1,nativeButton:E=!0,handle:b,payload:c,openOnHover:r=!1,delay:O=on,closeDelay:h=0,id:N,...u}=n,B=re(!0),g=b?.store??B?.store;if(!g)throw new Error(pe(74));const x=bt(N),a=g.useState("isTriggerActive",x),d=g.useState("floatingRootContext"),F=g.useState("isOpenedByTrigger",x),H=g.useState("triggerPopupId",x),P=m.useRef(null),{registerTrigger:v,isMountedByThisTrigger:R}=Ot(x,P,g,{payload:c,disabled:p,openOnHover:r,closeDelay:h}),M=g.useState("openChangeReason"),_=g.useState("stickIfOpen"),G=g.useState("openMethod"),X=g.useState("focusManagerModal"),j=Qt(d,{enabled:!p&&d!=null&&r&&(G!=="touch"||M!==Ee),mouseOnly:!0,move:!1,handleClose:Zt(),restMs:O,delay:{close:h},triggerElementRef:P,isActiveTrigger:a,isClosing:()=>g.select("transitionStatus")==="ending"}),w=_t(d,{enabled:d!=null,stickIfOpen:_}),s=jt(()=>g.select("open"),k=>{g.set("openMethod",k)}),T=g.useState("triggerProps",R),{getButtonProps:L,buttonRef:S}=st({disabled:p,native:E}),f={open(k){return k&&M===Ee?It.open(k):Mt.open(k)}},{preFocusGuardRef:A,handlePreFocusGuardFocus:D,handleFocusTargetFocus:V}=sn(g,P),I=Le("button",n,{state:{disabled:p,open:F},ref:[S,t,v,P],props:[w.reference,j,T,s,{[rt]:"",id:x,"aria-haspopup":"dialog","aria-expanded":F,"aria-controls":H},u,L],stateAttributesMapping:f});return R&&!X?Y.jsxs(m.Fragment,{children:[Y.jsx(ye,{ref:A,onFocus:D}),Y.jsx(m.Fragment,{children:I},x),Y.jsx(ye,{ref:g.context.triggerFocusTargetRef,onFocus:V})]}):Y.jsx(m.Fragment,{children:I},x)}),Ye=m.createContext(void 0);function rn(){const e=m.useContext(Ye);if(e===void 0)throw new Error(pe(45));return e}const Tn=m.forwardRef(function(n,t){const{keepMounted:l=!1,...i}=n,{store:o}=re();return o.useState("mounted")||l?Y.jsx(Ye.Provider,{value:l,children:Y.jsx(it,{ref:t,...i})}):null}),Ve=m.createContext(void 0);function an(){const e=m.useContext(Ve);if(!e)throw new Error(pe(46));return e}const Pn=m.forwardRef(function(n,t){const{render:l,className:i,style:o,anchor:p,positionMethod:E="absolute",side:b="bottom",align:c="center",sideOffset:r=0,alignOffset:O=0,collisionBoundary:h="clipping-ancestors",collisionPadding:N=5,arrowPadding:u=5,sticky:B=!1,disableAnchorTracking:g=!1,collisionAvoidance:x=at,...a}=n,{store:d}=re(),F=rn(),H=yt(),P=d.useState("floatingRootContext"),v=d.useState("mounted"),R=d.useState("open"),M=d.useState("openChangeReason"),_=d.useState("activeTriggerElement"),G=d.useState("modal"),X=d.useState("openMethod"),j=d.useState("positionerElement"),w=d.useState("instantType"),s=d.useState("transitionStatus"),T=d.useState("hasViewport"),L=m.useRef(null),S=ct(j,!1,!1),f=Nt({anchor:p,floatingRootContext:P,positionMethod:E,mounted:v,side:b,sideOffset:r,align:c,alignOffset:O,arrowPadding:u,collisionBoundary:h,collisionPadding:N,sticky:B,disableAnchorTracking:g,keepMounted:F,nodeId:H,collisionAvoidance:x,adaptiveOrigin:T?Gt:void 0}),A=P.useState("domReferenceElement");ge(()=>{const I=A,k=L.current;if(I&&(L.current=I),k&&I&&I!==k){d.set("instantType",void 0);const C=new AbortController;return S(()=>{d.set("instantType","trigger-change")},C.signal),()=>{C.abort()}}},[A,S,d]),Yt(R&&G===!0&&M!==K,X==="touch",j,_);const D=m.useCallback(I=>{d.set("positionerElement",I)},[d]),V={open:R,side:f.side,align:f.align,anchorHidden:f.anchorHidden,instant:w},U=Vt(n,V,{styles:f.positionerStyles,transitionStatus:s,props:a,refs:[t,D],hidden:!v,inert:!R});return Y.jsxs(Ve.Provider,{value:f,children:[v&&G===!0&&M!==K&&Y.jsx(xt,{ref:d.context.internalBackdropRef,inert:lt(!R),cutout:_}),Y.jsx(Ft,{id:H,children:U})]})}),cn=m.createContext(void 0);function ln(){const[e,n]=m.useState(0),t=ne(()=>(n(i=>i+1),()=>{n(i=>Math.max(0,i-1))}));return{context:m.useMemo(()=>({register:t}),[t]),hasClosePart:e>0}}function un(e){const{value:n,children:t}=e;return Y.jsx(cn.Provider,{value:n,children:t})}const fn={...At,...dt},Cn=m.forwardRef(function(n,t){const{render:l,className:i,style:o,initialFocus:p,finalFocus:E,...b}=n,{store:c}=re(),r=an(),O=Xt()!=null,{context:h,hasClosePart:N}=ln(),u=c.useState("open"),B=c.useState("openMethod"),g=c.useState("instantType"),x=c.useState("transitionStatus"),a=c.useState("popupProps"),d=c.useState("titleElementId"),F=c.useState("descriptionElementId"),H=c.useState("modal"),P=c.useState("mounted"),v=c.useState("openChangeReason"),R=c.useState("activeTriggerElement"),M=c.useState("floatingRootContext"),_=M.useState("floatingId"),G=c.useState("disabled"),X=c.useState("openOnHover"),j=c.useState("closeDelay"),w=b.id??_;ut({open:u,ref:c.context.popupRef,onComplete(){u&&c.context.onOpenChangeComplete?.(!0)}}),qt(M,{enabled:X&&!G,closeDelay:j});const s=p===void 0?kt(c.context.popupRef):p,T=H!==!1&&N;c.useSyncedValue("focusManagerModal",T);const L=m.useCallback(A=>{c.set("popupElement",A)},[c]),S={open:u,side:r.side,align:r.align,instant:g,transitionStatus:x},f=Le("div",n,{state:S,ref:[t,c.context.popupRef,L],props:[a,{id:w,role:"dialog",...Be,"aria-labelledby":d,"aria-describedby":F,onKeyDown(A){O&&Lt.has(A.key)&&A.stopPropagation()}},Ut(x),b],stateAttributesMapping:fn});return Y.jsx(wt,{context:M,openInteractionType:B,modal:T,disabled:!P||v===K,initialFocus:s,returnFocus:E,restoreFocus:"popup",previousFocusableElement:ft(R)?R:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:Y.jsx(un,{value:h,children:f})})});export{hn as P,En as a,Tn as b,Pn as c,Cn as d};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{bR as Xt,bP as Rn,r,Q as le,bt as Pt,aH as G,cb as _t,cc as Mt,cd as Bt,bV as Ct,aV as st,aF as Ue,E as Me,ce as zt,bb as jt,cf as at,aE as bn,b2 as Jt,cg as bt,ch as It,ci as Qt,cj as Lt,aT as ht,ck as In,bZ as Sn,cl as At,ay as it,aJ as be,Y as Zt,aI as xt,aU as En,j as ye,W as Y,P as w,aA as Ft,aL as Ot,aK as Tn,aN as Mn,aO as Cn,aP as Dt,cm as vn,bW as wn,aM as yt,bN as Pn,z as en,A as Qe,cn as An,aB as On,co as Vn,aC as Ln,bX as Fn,aX as Dn,cp as Nn,az as tn,cq as vt}from"./__vite-browser-external-Db9onipF.js";import{v as We,q as kn,o as Hn,E as Un,G as Le,H as nn,J as _n,u as Bn,m as rn,h as zn,a as jn,l as Wn,A as Kn,I as Yn,d as qn,p as $n,b as Gn}from"./useScrollLock-DuosKdSB.js";import{i as Xn,u as Jn,j as Qn,a as Zn,d as er,c as tr,e as nr,g as rr,k as or,p as sr,r as ir,h as lr}from"./ToolbarRootContext-CwRaHhMN.js";function tt(e,t=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,n))}const cr="Escape";function St(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function ft(e,t){return St(t,e===Qt||e===Lt,e===bt||e===It)}function wt(e,t,n){return St(t,e===Lt,n?e===bt:e===It)||e==="Enter"||e===" "||e===""}function ur(e,t,n){return St(t,n?e===bt:e===It,e===Lt)}function ar(e,t,n,o){const l=n?e===It:e===bt,c=e===Qt;return t==="both"||t==="horizontal"&&o?e===cr:St(t,l,c)}function fr(e,t){const{listRef:n,activeIndex:o,onNavigate:l=()=>{},enabled:c=!0,selectedIndex:i=null,allowEscape:R=!1,loopFocus:u=!1,nested:m=!1,rtl:v=!1,virtual:a=!1,focusItemOnOpen:p="auto",focusItemOnHover:b=!0,openOnArrowKeyDown:y=!0,disabledIndices:O=void 0,orientation:g="vertical",parentOrientation:I,id:V,resetOnPointerLeave:E=!0,externalTree:d,grid:L}=t,j=L!=null,q="rootStore"in e?e.rootStore:e,D=q.useState("open"),W=q.useState("floatingElement"),J=q.useState("domReferenceElement"),me=q.context.dataRef,he=Xt(W),$=Rn(J),P=We(he),U=kn(),oe=Hn(d),z=r.useRef(p),T=r.useRef(i??-1),K=r.useRef(null),k=r.useRef(!0),s=le(f=>{l(T.current===-1?null:T.current,f)}),M=r.useRef(!!W),ae=r.useRef(D),H=r.useRef(!1),pe=r.useRef(!1),ge=r.useRef(null),h=We(O),F=We(D),se=We(i),Ie=We(E),B=Pt(),ne=Pt(),Q=le(()=>{function f(_){a?oe?.events.emit("virtualfocus",_):ge.current=Un(_,{sync:H.current,preventScroll:!0})}const x=n.current[T.current],X=pe.current;x&&f(x),(H.current?_=>_():_=>B.request(_))(()=>{const _=n.current[T.current]||x;if(!_)return;x||f(_),Re&&(X||!k.current)&&_.scrollIntoView?.({block:"nearest",inline:"nearest"})})});G(()=>{me.current.orientation=g},[me,g]),G(()=>{c&&(D&&W?(T.current=i??-1,z.current&&i!=null&&(pe.current=!0,s())):M.current&&(T.current=-1,s()))},[c,D,W,i,s]),G(()=>{if(c){if(!D){H.current=!1;return}if(W)if(o==null){if(H.current=!1,se.current!=null)return;if(M.current&&(T.current=-1,Q()),(!ae.current||!M.current)&&z.current&&(K.current!=null||z.current===!0&&K.current==null)){let f=0;const x=()=>{n.current[0]==null?(f<2&&(f?S=>ne.request(S):queueMicrotask)(x),f+=1):(T.current=K.current==null||wt(K.current,g,v)||m?Mt(n):Bt(n),K.current=null,s())};x()}}else _t(n.current,o)||(T.current=o,Q(),pe.current=!1)}},[c,D,W,o,se,m,n,g,v,s,Q,ne]),G(()=>{if(!c||W||!oe||a||!M.current)return;const f=oe.nodesRef.current,x=f.find(_=>_.id===U)?.context?.elements.floating,X=Ct(st(J??x??null)),S=f.some(_=>_.context&&Ue(_.context.elements.floating,X));x&&!S&&k.current&&x.focus({preventScroll:!0})},[c,W,J,oe,U,a]),G(()=>{ae.current=D,M.current=!!W}),G(()=>{D||(K.current=null,z.current=p)},[D,p]);const xe=o!=null,ce=le(f=>{if(!F.current)return;const x=n.current.indexOf(f.currentTarget);x!==-1&&(T.current!==x||o!==x)&&(T.current=x,s(f))}),ue=le(()=>I??oe?.nodesRef.current.find(f=>f.id===U)?.context?.dataRef?.current.orientation),de=le(()=>Mt(n,h.current)),ee=le(f=>{if(k.current=!1,H.current=!0,f.which===229||!F.current&&f.currentTarget===P.current)return;if(m&&ar(f.key,g,v,j)){ft(f.key,ue())||Le(f),q.setOpen(!1,Me(zt,f.nativeEvent)),jt(J)&&(a?oe?.events.emit("virtualfocus",J):J.focus());return}const x=T.current,X=Mt(n,O),S=Bt(n,O);if($||(f.key==="Home"&&(Le(f),T.current=X,s(f)),f.key==="End"&&(Le(f),T.current=S,s(f))),L!=null){const _=L(f,T.current,n,g,u,v,O,X,S);if(_!=null&&(T.current=_,s(f)),g==="both")return}if(ft(f.key,g)){if(Le(f),D&&!a&&Ct(f.currentTarget.ownerDocument)===f.currentTarget){T.current=wt(f.key,g,v)?X:S,s(f);return}wt(f.key,g,v)?u?x>=S?R&&x!==n.current.length?T.current=-1:(H.current=!1,T.current=X):T.current=at(n.current,{startingIndex:x,disabledIndices:O}):T.current=Math.min(S,at(n.current,{startingIndex:x,disabledIndices:O})):u?x<=X?R&&x!==-1?T.current=n.current.length:(H.current=!1,T.current=S):T.current=at(n.current,{startingIndex:x,decrement:!0,disabledIndices:O}):T.current=Math.max(X,at(n.current,{startingIndex:x,decrement:!0,disabledIndices:O})),_t(n.current,T.current)&&(T.current=-1),s(f)}}),Re=r.useMemo(()=>({onFocus(x){H.current=!0,ce(x)},onClick:({currentTarget:x})=>x.focus({preventScroll:!0}),onMouseMove(x){H.current=!0,pe.current=!1,b&&ce(x)},onPointerLeave(x){if(!F.current||!k.current||x.pointerType==="touch")return;H.current=!0;const X=x.relatedTarget;if(!(!b||n.current.includes(X))&&Ie.current&&(ge.current?.(),ge.current=null,T.current=-1,s(x),!a)){const S=P.current,_=Ct(st(S));S&&Ue(S,_)&&S.focus({preventScroll:!0})}}}),[ce,F,P,b,n,s,Ie,a]),te=r.useMemo(()=>a&&D&&xe&&{"aria-activedescendant":`${V}-${o}`},[a,D,xe,V,o]),Z=r.useMemo(()=>({"aria-orientation":g==="both"?void 0:g,...$?{}:te,onKeyDown(f){if(f.key==="Tab"&&f.shiftKey&&D&&!a){const x=bn(f.nativeEvent);if(x&&!Ue(P.current,x))return;Le(f),q.setOpen(!1,Me(Jt,f.nativeEvent)),jt(J)&&J.focus();return}ee(f)},onPointerMove(){k.current=!0}}),[te,ee,P,g,$,q,D,a,J]),re=r.useMemo(()=>{function f(S){q.setOpen(!0,Me(zt,S.nativeEvent,S.currentTarget))}function x(S){p==="auto"&&nn(S.nativeEvent)&&(z.current=!a)}function X(S){z.current=p,p==="auto"&&_n(S.nativeEvent)&&(z.current=!0)}return{onKeyDown(S){const _=q.select("open");k.current=!1;const ve=S.key.startsWith("Arrow"),De=ur(S.key,ue(),v),Ee=ft(S.key,g),Ae=(m?De:Ee)||S.key==="Enter"||S.key.trim()==="";if(a&&_)return ee(S);if(!(!_&&!y&&ve)){if(Ae){const fe=ft(S.key,ue());K.current=m&&fe?null:S.key}if(m){De&&(Le(S),_?(T.current=de(),s(S)):f(S));return}Ee&&(se.current!=null&&(T.current=se.current),Le(S),!_&&y?f(S):ee(S),_&&s(S))}},onFocus(S){q.select("open")&&!a&&(T.current=-1,s(S))},onPointerDown:X,onPointerEnter:X,onMouseDown:x,onClick:x}},[ee,p,de,m,s,q,y,g,ue,v,se,a]),A=r.useMemo(()=>({...te,...re}),[te,re]);return r.useMemo(()=>c?{reference:A,floating:Z,item:Re,trigger:re}:{},[c,A,Z,re,Re])}function dr(e,t){const{listRef:n,elementsRef:o,activeIndex:l,onMatch:c,disabledIndices:i,onTyping:R,enabled:u=!0,resetMs:m=750,selectedIndex:v=null}=t,a="rootStore"in e?e.rootStore:e,p=a.useState("open"),b=ht(),y=r.useRef(""),O=r.useRef(v??l??-1),g=r.useRef(null),I=le(d=>{function L(P){const U=o?.current[P];return!U||Sn(U)}function j(P){return L(P)?i==null||!In(At,P,i):!1}function q(P,U,oe=0){if(P.length===0)return-1;const z=(oe%P.length+P.length)%P.length,T=U.toLowerCase();for(let K=0;K<P.length;K+=1){const k=(z+K)%P.length;if(!(!P[k]?.toLowerCase().startsWith(T)||!j(k)))return k}return-1}const D=n.current;if(y.current.length>0&&d.key===" "&&(Le(d),R?.(!0)),y.current.length>0&&y.current[0]!==" "&&q(D,y.current)===-1&&d.key!==" "&&R?.(!1),D==null||d.key.length!==1||d.ctrlKey||d.metaKey||d.altKey)return;p&&d.key!==" "&&(Le(d),R?.(!0));const W=y.current==="";W&&(O.current=v??l??-1),D.every((P,U)=>P&&j(U)?P[0]?.toLowerCase()!==P[1]?.toLowerCase():!0)&&y.current===d.key&&(y.current="",O.current=g.current),y.current+=d.key,b.start(m,()=>{y.current="",O.current=g.current,R?.(!1)});const he=((W?v??l??-1:O.current)??0)+1,$=q(D,y.current,he);$!==-1?(c?.($),g.current=$):d.key!==" "&&(y.current="",R?.(!1))}),V=le(d=>{const L=d.relatedTarget,j=a.select("domReferenceElement"),q=a.select("floatingElement");Ue(j,L)||Ue(q,L)||(b.clear(),y.current="",O.current=g.current,R?.(!1))});G(()=>{!p&&v!==null||(b.clear(),g.current=null,y.current!==""&&(y.current=""))},[p,v,b]),G(()=>{p&&y.current===""&&(O.current=v??l??-1)},[p,v,l]);const E=r.useMemo(()=>({onKeyDown:I,onBlur:V}),[I,V]);return r.useMemo(()=>u?{reference:E,floating:E}:{},[u,E])}function pr(e){const[t,n]=r.useState({current:e,previous:null});return e!==t.current&&n({current:e,previous:t.current}),t.previous}function gr(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}function Wt({controlled:e,default:t,name:n,state:o="value"}){const{current:l}=r.useRef(e!==void 0),[c,i]=r.useState(t),R=l?e:c,u=r.useCallback(m=>{l||i(m)},[]);return[R,u]}const on=r.createContext(null),sn=r.createContext(null);function Ye(){const e=r.useContext(on);if(e===null)throw new Error(it(60));return e}function ln(){const e=r.useContext(sn);if(e===null)throw new Error(it(61));return e}let Kt=(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 mr={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},nt={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},hr={disabled:!1,...nt},yr={valid(e){return e===null?null:e?{[Kt.valid]:""}:{[Kt.invalid]:""}}},xr={invalid:void 0,name:void 0,validityData:{state:mr,errors:[],error:"",value:"",initialValue:null},setValidityData:be,disabled:void 0,touched:nt.touched,setTouched:be,dirty:nt.dirty,setDirty:be,filled:nt.filled,setFilled:be,focused:nt.focused,setFocused:be,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:hr,markedDirtyRef:{current:!1},registerFieldControl:be,validation:{getValidationProps:(e,t=Zt)=>t,inputRef:{current:null},registerInput:be,commit:async()=>{},change:be}},Rr=r.createContext(xr);function Nt(e=!0){const t=r.useContext(Rr);if(t.setValidityData===be&&!e)throw new Error(it(28));return t}function br(e,t,n,o,l=!0,c){const{registerFieldControl:i}=Nt(),R=r.useRef(null);R.current||(R.current=Symbol()),G(()=>{const u=R.current;return!u||!l?void 0:(i(u,{controlRef:e,getValue:o,id:t,name:c,value:n}),()=>{i(u,void 0)})},[e,l,o,t,c,i,n])}const Ir=r.createContext({controlId:void 0,registerControlId:be,labelId:void 0,setLabelId:be,messageIds:[],setMessageIds:be,getDescriptionProps:e=>e});function cn(){return r.useContext(Ir)}function un(e={}){const{id:t,implicit:n=!1,controlRef:o}=e,{controlId:l,registerControlId:c}=cn(),i=Bn(t),R=n?l:void 0,u=xt(()=>Symbol("labelable-control")),m=r.useRef(!1),v=r.useRef(t!=null),a=le(()=>{!m.current||c===be||(m.current=!1,c(u.current,void 0))});return G(()=>{if(c===be)return;let p;if(n){const b=o?.current;En(b)&&b.closest("label")!=null?p=t??null:p=R??i}else if(t!=null)v.current=!0,p=t;else if(v.current)p=i;else{a();return}if(p===void 0){a();return}m.current=!0,c(u.current,p)},[t,o,R,c,n,i,u,a]),r.useEffect(()=>a,[a]),l??i}const Sr=(e,t)=>Object.is(e,t);function Ke(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Er(e,t,n){return!e||e.length===0?!1:e.some(o=>o===void 0?!1:Ke(t,o,n))}function ot(e,t,n){return!e||e.length===0?-1:e.findIndex(o=>o===void 0?!1:Ke(o,t,n))}function Tr(e,t,n){return e.filter(o=>!Ke(t,o,n))}function Vt(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function an(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function Mr(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(an(t)){for(const n of t)for(const o of n.items)if(o&&o.value==null&&o.label!=null)return!0;return!1}for(const n of t)if(n&&n.value==null&&n.label!=null)return!0;return!1}function fn(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 Vt(e)}function je(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?Vt(e.value):Vt(e)}function dn(e,t,n){function o(){return fn(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 l=t,c=an(l)?l.flatMap(i=>i.items):l;if(e==null||typeof e!="object"){const i=c.find(R=>R.value===e);return i&&i.label!=null?i.label:o()}if("value"in e){const i=c.find(R=>R&&R.value===e.value);if(i&&i.label!=null)return i.label}}return o()}function Cr(e,t,n){return e.reduce((o,l,c)=>(c>0&&o.push(", "),o.push(ye.jsx(r.Fragment,{children:dn(l,t,n)},c)),o),[])}const C={id:Y(e=>e.id),labelId:Y(e=>e.labelId),modal:Y(e=>e.modal),multiple:Y(e=>e.multiple),items:Y(e=>e.items),itemToStringLabel:Y(e=>e.itemToStringLabel),itemToStringValue:Y(e=>e.itemToStringValue),isItemEqualToValue:Y(e=>e.isItemEqualToValue),value:Y(e=>e.value),hasSelectedValue:Y(e=>{const{value:t,multiple:n,itemToStringValue:o}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:je(t,o)!==""}),hasNullItemLabel:Y((e,t)=>t?Mr(e.items):!1),open:Y(e=>e.open),mounted:Y(e=>e.mounted),forceMount:Y(e=>e.forceMount),transitionStatus:Y(e=>e.transitionStatus),openMethod:Y(e=>e.openMethod),activeIndex:Y(e=>e.activeIndex),selectedIndex:Y(e=>e.selectedIndex),isActive:Y((e,t)=>e.activeIndex===t),isSelected:Y((e,t)=>{const n=e.isItemEqualToValue,o=e.value;return e.multiple?Array.isArray(o)&&o.some(l=>Ke(t,l,n)):Ke(t,o,n)}),isSelectedByFocus:Y((e,t)=>e.selectedIndex===t),popupProps:Y(e=>e.popupProps),triggerProps:Y(e=>e.triggerProps),triggerElement:Y(e=>e.triggerElement),positionerElement:Y(e=>e.positionerElement),listElement:Y(e=>e.listElement),popupSide:Y(e=>e.popupSide),scrollUpArrowVisible:Y(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:Y(e=>e.scrollDownArrowVisible),hasScrollArrows:Y(e=>e.hasScrollArrows)},vr=r.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:be,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function wr(){return r.useContext(vr)}function Pr(e,t,n=(o,l)=>o===l){return e.length===t.length&&e.every((o,l)=>n(o,t[l]))}const Fe=1;function pn(e,t){return Math.max(0,e-t)}function Ar(e,t){if(t<=0)return 0;const n=tt(e,0,t),o=n,l=t-n,c=o<=Fe,i=l<=Fe;return c&&i?o<=l?0:t:c?0:i?t:n}function to(e){const{id:t,value:n,defaultValue:o=null,onValueChange:l,open:c,defaultOpen:i=!1,onOpenChange:R,name:u,form:m,autoComplete:v,disabled:a=!1,readOnly:p=!1,required:b=!1,modal:y=!0,actionsRef:O,inputRef:g,onOpenChangeComplete:I,items:V,multiple:E=!1,itemToStringLabel:d,itemToStringValue:L,isItemEqualToValue:j=Sr,highlightItemOnHover:q=!0,children:D}=e,{clearErrors:W}=wr(),{setDirty:J,setTouched:me,setFocused:he,validityData:$,setFilled:P,name:U,disabled:oe,validation:z,validationMode:T}=Nt(),K=un({id:t}),k=oe||a,s=U??u,[M,ae]=Wt({controlled:n,default:E?o??At:o,name:"Select",state:"value"}),[H,pe]=Wt({controlled:c,default:i,name:"Select",state:"open"}),ge=r.useRef([]),h=r.useRef([]),F=r.useRef(null),se=r.useRef(null),Ie=r.useRef(0),B=r.useRef(null),ne=r.useRef([]),Q=r.useRef(!1),xe=r.useRef(null),ce=r.useRef(null),ue=r.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),de=r.useRef(!1),{mounted:ee,setMounted:Re,transitionStatus:te}=rn(H),{openMethod:Z,triggerProps:re}=Xn(H),A=xt(()=>new vn({id:K,labelId:void 0,modal:y,multiple:E,itemToStringLabel:d,itemToStringValue:L,isItemEqualToValue:j,value:M,open:H,mounted:ee,transitionStatus:te,items:V,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,f=w(A,C.activeIndex),x=w(A,C.selectedIndex),X=w(A,C.triggerElement),S=w(A,C.positionerElement),_=pr(Z),ve=Z??_??null,De=r.useMemo(()=>E?"":je(M,L),[E,M,L]),Ee=r.useMemo(()=>E&&Array.isArray(M)?M.map(N=>je(N,L)):je(M,L),[E,M,L]),Ae=We(A.state.triggerElement),fe=le(()=>Ee);br(Ae,K,M,fe,!k,u);const Oe=r.useRef(M),Ve=E?Array.isArray(M)&&M.length>0:M!=null&&je(M,L)!=="";G(()=>{M!==Oe.current&&A.set("forceMount",!0)},[A,M]),G(()=>{P(Ve)},[Ve,P]),G(function(){const ie=ne.current;let Te;if(E){const Se=Array.isArray(M)?M:[];if(Se.length===0)Te=null;else{const He=Se[Se.length-1],ze=ot(ie,He,j);Te=ze===-1?null:ze}}else{const Se=ot(ie,M,j);Te=Se===-1?null:Se}Te===null&&(ce.current=null),!H&&A.set("selectedIndex",Te)},[Ve,E,H,M,ne,j,A,ce]);function we(N){const ie=$.initialValue;return Array.isArray(N)&&Array.isArray(ie)?!Pr(N,ie,(Te,Se)=>Ke(Te,Se,j)):N!==ie}Jn(M,()=>{W(s),J(we(M)),z.change(M)});const qe=le((N,ie)=>{R?.(N,ie),!ie.isCanceled&&(pe(N),!N&&(ie.reason===Jt||ie.reason===wn)&&(me(!0),he(!1),T==="onBlur"&&z.commit(M)))}),$e=le(()=>{Re(!1),A.update({activeIndex:null,openMethod:null}),I?.(!1)});Ft({enabled:!O,open:H,ref:F,onComplete(){H||$e()}}),r.useImperativeHandle(O,()=>({unmount:$e}),[$e]);const Ne=le((N,ie)=>{l?.(N,ie),!ie.isCanceled&&ae(N)}),Pe=le(()=>{const N=A.state.listElement||F.current;if(!N)return;const ie=pn(N.scrollHeight,N.clientHeight),Te=Ar(N.scrollTop,ie),Se=Te>0,He=Te<ie;A.state.scrollUpArrowVisible!==Se&&A.set("scrollUpArrowVisible",Se),A.state.scrollDownArrowVisible!==He&&A.set("scrollDownArrowVisible",He)}),_e=Qn({open:H,onOpenChange:qe,elements:{reference:X,floating:S}}),Ge=Zn(_e,{enabled:!p&&!k,event:"mousedown"}),Xe=zn(_e),ke=fr(_e,{enabled:!p&&!k,listRef:ge,activeIndex:f,selectedIndex:x,disabledIndices:At,onNavigate(N){N===null&&!H||A.set("activeIndex",N)},focusItemOnHover:q}),Be=dr(_e,{enabled:!p&&!k&&(H||!E),listRef:h,activeIndex:f,selectedIndex:x,disabledIndices:N=>gr(ge.current[N]),onMatch(N){H?A.set("activeIndex",N):Ne(ne.current[N],Me("none"))},onTyping(N){Q.current=N}}),Ze=r.useMemo(()=>{const N=Ot(Be.reference,ke.reference,Xe.reference,Ge.reference,re);return K&&(N.id=K),N},[Ge.reference,Be.reference,ke.reference,Xe.reference,re,K]),et=r.useMemo(()=>Ot(jn,Be.floating,ke.floating,Xe.floating),[Be.floating,ke.floating,Xe.floating]),lt=ke.item??Zt;Wn(()=>{A.update({popupProps:et,triggerProps:Ze})}),G(()=>{A.update({id:K,modal:y,multiple:E,value:M,open:H,mounted:ee,transitionStatus:te,popupProps:et,triggerProps:Ze,items:V,itemToStringLabel:d,itemToStringValue:L,isItemEqualToValue:j,openMethod:ve})},[A,K,y,E,M,H,ee,te,et,Ze,V,d,L,j,ve]);const Ce=r.useMemo(()=>({store:A,name:s,required:b,disabled:k,readOnly:p,multiple:E,highlightItemOnHover:q,setValue:Ne,setOpen:qe,listRef:ge,popupRef:F,scrollHandlerRef:se,handleScrollArrowVisibility:Pe,scrollArrowsMountedCountRef:Ie,itemProps:lt,valueRef:B,valuesRef:ne,labelsRef:h,typingRef:Q,selectionRef:ue,firstItemTextRef:xe,selectedItemTextRef:ce,validation:z,onOpenChangeComplete:I,alignItemWithTriggerActiveRef:de,initialValueRef:Oe}),[A,s,b,k,p,E,q,Ne,qe,lt,z,I,Pe]),Je=Tn(g,z.inputRef),ct=E&&Array.isArray(M)&&M.length>0,ut=E?void 0:s,Et=r.useMemo(()=>!E||!Array.isArray(M)||!s?null:M.map(N=>{const ie=je(N,L);return ye.jsx("input",{type:"hidden",form:m,name:s,value:ie,disabled:k},ie)}),[E,M,m,s,L,k]);return ye.jsx(on.Provider,{value:Ce,children:ye.jsxs(sn.Provider,{value:_e,children:[D,ye.jsx("input",{...z.getValidationProps(k,{onFocus(){A.state.triggerElement?.focus({focusVisible:!0})},onChange(N){if(N.nativeEvent.defaultPrevented||k||p)return;const ie=N.currentTarget.value,Te=Me(Dt,N.nativeEvent);function Se(){if(E)return;const He=ie.toLowerCase();let ze=ne.current.findIndex(Tt=>je(Tt,L).toLowerCase()===He||fn(Tt,d).toLowerCase()===He);ze===-1&&(ze=ne.current.findIndex((Tt,xn)=>{const Ut=h.current[xn];return Ut!=null&&Ut.toLowerCase()===He}));const Ht=ze===-1?void 0:ne.current[ze];Ht!=null&&Ne(Ht,Te)}A.set("forceMount",!0),queueMicrotask(Se)}}),id:K&&ut==null?`${K}-hidden-input`:void 0,form:m,name:ut,autoComplete:v,value:De,disabled:k,required:b&&!ct,readOnly:p,ref:Je,style:s?Mn:Cn,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Et]})})}function Or(e,t){return e??t}function Vr(e){const t=e.getBoundingClientRect(),n=yt(e);if(Pn)return t;const o=n.getComputedStyle(e,"::before"),l=n.getComputedStyle(e,"::after");if(!(o.content!=="none"||l.content!=="none"))return t;const i=parseFloat(o.width)||0,R=parseFloat(o.height)||0,u=parseFloat(l.width)||0,m=parseFloat(l.height)||0,v=Math.max(t.width,i,u),a=Math.max(t.height,R,m),p=v-t.width,b=a-t.height;return{left:t.left-p/2,right:t.right+p/2,top:t.top-b/2,bottom:t.bottom+b/2}}const dt=2,Lr=400,Fr={...Kn,...yr,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},no=r.forwardRef(function(t,n){const{render:o,className:l,id:c,disabled:i=!1,nativeButton:R=!0,style:u,...m}=t,{setTouched:v,setFocused:a,validationMode:p,state:b,disabled:y}=Nt(),{labelId:O}=cn(),{store:g,setOpen:I,selectionRef:V,validation:E,readOnly:d,required:L,alignItemWithTriggerActiveRef:j,disabled:q}=Ye(),D=y||q||i,W=w(g,C.open),J=w(g,C.mounted),me=w(g,C.value),he=w(g,C.triggerProps),$=w(g,C.positionerElement),P=w(g,C.listElement),U=w(g,C.popupSide),oe=w(g,C.id),z=w(g,C.labelId),T=w(g,C.hasSelectedValue),K=J&&$?U:null,k=c??oe,s=Or(O,z);un({id:k});const M=We($),ae=r.useRef(null),{getButtonProps:H,buttonRef:pe}=en({disabled:D,native:R}),ge=le(Q=>{g.set("triggerElement",Q)}),h=ht(),F=ht(),se=ht();r.useEffect(()=>{if(W)return se.start(Lr,()=>{V.current.allowUnselectedMouseUp=!0,V.current.allowSelectedMouseUp=!0}),()=>{se.clear()};V.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},F.clear()},[W,V,F,se]);const Ie=Ot(he,{id:k,role:"combobox","aria-expanded":W?"true":"false","aria-haspopup":"listbox","aria-controls":W?P?.id??Xt($)?.id:void 0,"aria-labelledby":s,"aria-readonly":d||void 0,"aria-required":L||void 0,tabIndex:D?-1:0,onFocus(Q){a(!0),W&&j.current&&I(!1,Me(Dt,Q.nativeEvent)),h.start(0,()=>{g.set("forceMount",!0)})},onBlur(Q){Ue($,Q.relatedTarget)||(v(!0),a(!1),p==="onBlur"&&E.commit(me))},onMouseDown(Q){if(W)return;const xe=st(Q.currentTarget);function ce(ue){if(!ae.current)return;const de=ue.target;if(Ue(ae.current,de)||Ue(M.current,de))return;const ee=Vr(ae.current);ue.clientX>=ee.left-dt&&ue.clientX<=ee.right+dt&&ue.clientY>=ee.top-dt&&ue.clientY<=ee.bottom+dt||I(!1,Me(An,ue))}F.start(0,()=>{xe.addEventListener("mouseup",ce,{once:!0})})}},m,H),B=E.getValidationProps(D,Ie);B.role="combobox";const ne={...b,open:W,disabled:D,value:me,readOnly:d,popupSide:K,placeholder:!T};return Qe("button",t,{ref:[n,ae,pe,ge],state:ne,stateAttributesMapping:Fr,props:B})}),Dr={value:()=>null},ro=r.forwardRef(function(t,n){const{className:o,render:l,children:c,placeholder:i,style:R,...u}=t,{store:m,valueRef:v}=Ye(),a=w(m,C.value),p=w(m,C.items),b=w(m,C.itemToStringLabel),y=w(m,C.hasSelectedValue),O=!y&&i!=null&&c==null,g=w(m,C.hasNullItemLabel,O),I={value:a,placeholder:!y};let V=null;return typeof c=="function"?V=c(a):c!=null?V=c:!y&&i!=null&&!g?V=i:Array.isArray(a)?V=Cr(a,p,b):V=dn(a,p,b),Qe("span",t,{state:I,ref:[n,v],props:[{children:V},u],stateAttributesMapping:Dr})}),Nr=r.createContext(void 0),oo=r.forwardRef(function(t,n){const{store:o}=Ye(),l=w(o,C.mounted),c=w(o,C.forceMount);return l||c?ye.jsx(Nr.Provider,{value:!0,children:ye.jsx(On,{ref:n,...t})}):null}),gn=r.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function kr(){return r.useContext(gn)}function Hr(e){const{children:t,elementsRef:n,labelsRef:o,onMapChange:l}=e,c=le(l),i=r.useRef(0),R=xt(_r).current,u=xt(Ur).current,[m,v]=r.useState(0),a=r.useRef(m),p=le((I,V)=>{u.set(I,V??null),a.current+=1,v(a.current)}),b=le(I=>{u.delete(I),a.current+=1,v(a.current)}),y=r.useMemo(()=>{const I=new Map;return Array.from(u.keys()).filter(E=>E.isConnected).sort(Br).forEach((E,d)=>{const L=u.get(E)??{};I.set(E,{...L,index:d})}),I},[u,m]);G(()=>{if(typeof MutationObserver!="function"||y.size===0)return;const I=new MutationObserver(V=>{const E=new Set,d=L=>E.has(L)?E.delete(L):E.add(L);V.forEach(L=>{L.removedNodes.forEach(d),L.addedNodes.forEach(d)}),E.size===0&&(a.current+=1,v(a.current))});return y.forEach((V,E)=>{E.parentElement&&I.observe(E.parentElement,{childList:!0})}),()=>{I.disconnect()}},[y]),G(()=>{a.current===m&&(n.current.length!==y.size&&(n.current.length=y.size),o&&o.current.length!==y.size&&(o.current.length=y.size),i.current=y.size),c(y)},[c,y,n,o,m]),G(()=>()=>{n.current=[]},[n]),G(()=>()=>{o&&(o.current=[])},[o]);const O=le(I=>(R.add(I),()=>{R.delete(I)}));G(()=>{R.forEach(I=>I(y))},[R,y]);const g=r.useMemo(()=>({register:p,unregister:b,subscribeMapChange:O,elementsRef:n,labelsRef:o,nextIndexRef:i}),[p,b,O,n,o,i]);return ye.jsx(gn.Provider,{value:g,children:t})}function Ur(){return new Map}function _r(){return new Set}function Br(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=r.createContext(void 0);function zr(){const e=r.useContext(mn);if(!e)throw new Error(it(59));return e}function Rt(e,t){e&&Object.assign(e.style,t)}const jr={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},Wr={position:"fixed"},so=r.forwardRef(function(t,n){const{anchor:o,positionMethod:l="absolute",className:c,render:i,side:R="bottom",align:u="center",sideOffset:m=0,alignOffset:v=0,collisionBoundary:a="clipping-ancestors",collisionPadding:p,arrowPadding:b=5,sticky:y=!1,disableAnchorTracking:O,alignItemWithTrigger:g=!0,collisionAvoidance:I=Vn,style:V,...E}=t,{store:d,listRef:L,labelsRef:j,alignItemWithTriggerActiveRef:q,selectedItemTextRef:D,valuesRef:W,initialValueRef:J,popupRef:me,setValue:he}=Ye(),$=ln(),P=w(d,C.open),U=w(d,C.mounted),oe=w(d,C.modal),z=w(d,C.value),T=w(d,C.openMethod),K=w(d,C.positionerElement),k=w(d,C.triggerElement),s=w(d,C.isItemEqualToValue),M=w(d,C.transitionStatus),ae=r.useRef(null),H=r.useRef(null),[pe,ge]=r.useState(g),h=U&&pe&&T!=="touch";!U&&pe!==g&&ge(g),G(()=>{U||(C.scrollUpArrowVisible(d.state)&&d.set("scrollUpArrowVisible",!1),C.scrollDownArrowVisible(d.state)&&d.set("scrollDownArrowVisible",!1))},[d,U]),r.useImperativeHandle(q,()=>h),er((h||oe)&&P,T==="touch",K,k);const F=tr({anchor:o,floatingRootContext:$,positionMethod:l,mounted:U,side:R,sideOffset:m,align:u,alignOffset:v,arrowPadding:b,collisionBoundary:a,collisionPadding:p,sticky:y,disableAnchorTracking:O??h,collisionAvoidance:I,keepMounted:!0}),se=h?"none":F.side,Ie=h?Wr:F.positionerStyles,B={open:P,side:se,align:F.align,anchorHidden:F.anchorHidden};G(()=>{d.set("popupSide",F.side)},[d,F.side]);const ne=le(de=>{d.set("positionerElement",de)}),Q=nr(t,B,{styles:Ie,transitionStatus:M,props:E,refs:[n,ne],hidden:!U,inert:!P}),xe=r.useRef(0),ce=le(de=>{if(de.size===0&&xe.current===0||W.current.length===0)return;const ee=xe.current;if(xe.current=de.size,de.size===ee)return;const Re=Me(Dt);if(ee!==0&&!d.state.multiple&&z!==null&&ot(W.current,z,s)===-1){const Z=J.current,A=Z!=null&&ot(W.current,Z,s)!==-1?Z:null;he(A,Re),A===null&&(d.set("selectedIndex",null),D.current=null)}if(ee!==0&&d.state.multiple&&Array.isArray(z)){const te=re=>ot(W.current,re,s)!==-1,Z=z.filter(re=>te(re));(Z.length!==z.length||Z.some(re=>!Er(z,re,s)))&&(he(Z,Re),Z.length===0&&(d.set("selectedIndex",null),D.current=null))}if(P&&h){d.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const te={height:""};Rt(K,te),Rt(me.current,te)}}),ue=r.useMemo(()=>({...F,side:se,alignItemWithTriggerActive:h,setControlledAlignItemWithTrigger:ge,scrollUpArrowRef:ae,scrollDownArrowRef:H}),[F,se,h,ge]);return ye.jsx(Hr,{elementsRef:L,labelsRef:j,onMapChange:ce,children:ye.jsxs(mn.Provider,{value:ue,children:[U&&oe&&ye.jsx(Yn,{inert:Ln(!P),cutout:k}),Q]})})}),pt="base-ui-disable-scrollbar",Yt={className:pt,getElement(e){return ye.jsx("style",{nonce:e,href:pt,precedence:"base-ui:low",children:`.${pt}{scrollbar-width:none}.${pt}::-webkit-scrollbar{display:none}`})}},Kr=r.createContext(void 0),Yr={disableStyleElements:!1};function qr(){return r.useContext(Kr)??Yr}const $r={...$n,...tn},io=r.forwardRef(function(t,n){const{render:o,className:l,style:c,finalFocus:i,...R}=t,{store:u,popupRef:m,onOpenChangeComplete:v,setOpen:a,valueRef:p,firstItemTextRef:b,selectedItemTextRef:y,multiple:O,handleScrollArrowVisibility:g,scrollHandlerRef:I,listRef:V,highlightItemOnHover:E}=Ye(),{side:d,align:L,alignItemWithTriggerActive:j,isPositioned:q,setControlledAlignItemWithTrigger:D}=zr(),W=rr()!=null,J=ln(),me=or(),{nonce:he,disableStyleElements:$}=qr(),P=w(u,C.id),U=w(u,C.open),oe=w(u,C.openMethod),z=w(u,C.mounted),T=w(u,C.popupProps),K=w(u,C.transitionStatus),k=w(u,C.triggerElement),s=w(u,C.positionerElement),M=w(u,C.listElement),ae=r.useRef(!1),H=r.useRef(!1),pe=r.useRef({}),ge=Pt(),h=le(B=>{if(!s||!m.current||!H.current)return;if(ae.current||!j){g();return}const ne=s.style.top==="0px",Q=s.style.bottom==="0px";if(!ne&&!Q){g();return}const xe=$t(s),ce=rt(s.getBoundingClientRect().height,"y",xe),ue=st(s),de=yt(s),ee=de.getComputedStyle(s),Re=parseFloat(ee.marginTop),te=parseFloat(ee.marginBottom),Z=qt(de.getComputedStyle(m.current)),re=Math.min(ue.documentElement.clientHeight-Re-te,Z),A=B.scrollTop,f=gt(B);let x=0,X=null,S=!1,_=!1;const ve=fe=>{s.style.height=`${fe}px`},De=(fe,Oe)=>{const Ve=tt(fe,0,re-ce);Ve>0&&ve(ce+Ve),B.scrollTop=Oe,re-(ce+Ve)<=Fe&&(ae.current=!0),g()},Ee=ne?f-A:A,Ae=Math.min(ce+Ee,re);if(x=Ae,Ee<=Fe){De(Ee,ne?f:0);return}if(re-Ae>Fe)ne?_=!0:X=0;else if(S=!0,Q&&A<f){const fe=ce+Ee-re;X=A-(Ee-fe)}if(x=Math.ceil(x),x!==0&&ve(x),_||X!=null){const fe=gt(B),Oe=_?fe:tt(X,0,fe);Math.abs(B.scrollTop-Oe)>Fe&&(B.scrollTop=Oe)}(S||x>=re-Fe)&&(ae.current=!0),g()});r.useImperativeHandle(I,()=>h,[h]),Ft({open:U,ref:m,onComplete(){U&&v?.(!0)}});const F={open:U,transitionStatus:K,side:d,align:L};G(()=>{!s||!m.current||Object.keys(pe.current).length||(pe.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})},[m,s]),G(()=>{U||j||(H.current=!1,ae.current=!1,Rt(s,pe.current))},[U,j,s,m]),G(()=>{const B=m.current;if(!U||!k||!s||!B||j&&!q||u.state.transitionStatus==="ending")return;if(!j){H.current=!0,ge.request(g),B.style.removeProperty("--transform-origin");return}const ne=Gr(B);B.style.removeProperty("--transform-origin");try{let Q=y.current;Q?.isConnected||(Q=!C.hasSelectedValue(u.state)&&b.current?.isConnected?b.current:null);const xe=p.current,ce=yt(s),ue=ce.getComputedStyle(s),de=ce.getComputedStyle(B),ee=st(k),Re=$t(k),te=mt(k.getBoundingClientRect(),Re),Z=mt(s.getBoundingClientRect(),Re),re=te.height,A=M||B,f=A.scrollHeight,x=parseFloat(de.borderBottomWidth),X=parseFloat(ue.marginTop)||10,S=parseFloat(ue.marginBottom)||10,_=parseFloat(ue.minHeight)||100,ve=qt(de),De=5,Ee=5,Ae=20,fe=ee.documentElement.clientHeight-X-S,Oe=ee.documentElement.clientWidth,Ve=fe-te.bottom+re;let we,qe=me==="rtl"?te.right-Z.width:te.left,$e=0;if(Q&&xe){const Ce=mt(xe.getBoundingClientRect(),Re);we=mt(Q.getBoundingClientRect(),Re),qe=Z.left+(me==="rtl"?Ce.right-we.right:Ce.left-we.left);const Je=Ce.top-te.top+Ce.height/2;$e=we.top-Z.top+we.height/2-Je}const Ne=Ve+$e+S+x;let Pe=Math.min(fe,Ne);const _e=fe-X-S,Ge=Ne-Pe,Xe=Oe-Ee;s.style.left=`${tt(qe,De,Xe-Z.width)}px`,s.style.height=`${Pe}px`,s.style.maxHeight="none",s.style.marginTop=`${X}px`,s.style.marginBottom=`${S}px`,B.style.height="100%";const ke=gt(A),Be=Ge>=ke-Fe;Be&&(Pe=Math.min(fe,Z.height)-(Ge-ke));const Ze=te.top<Ae||te.bottom>fe-Ae||Math.ceil(Pe)+Fe<Math.min(f,_),et=(ce.visualViewport?.scale??1)!==1&&Fn;if(Ze||et){H.current=!0,Rt(s,pe.current),D(!1);return}const lt=Math.max(_,Pe);if(Be){const Ce=Math.max(0,fe-Ne);s.style.top=Z.height>=_e?"0":`${Ce}px`,s.style.height=`${Pe}px`,A.scrollTop=gt(A)}else s.style.bottom="0",A.scrollTop=Ge;if(we){const Ce=Z.top,Je=Z.height,ct=we.top+we.height/2,ut=Je>0?(ct-Ce)/Je*100:50,Et=tt(ut,0,100);B.style.setProperty("--transform-origin",`50% ${Et}%`)}(lt===fe||Pe>=ve)&&(ae.current=!0),g(),E&&u.state.selectedIndex===null&&u.state.activeIndex===null&&V.current[0]!=null&&u.set("activeIndex",0),H.current=!0}finally{ne()}},[u,U,s,k,p,b,y,m,g,j,D,ge,M,V,E,me,q]),r.useEffect(()=>{if(!j||!s||!U)return;const B=yt(s);function ne(Q){a(!1,Me(Nn,Q))}return Dn(B,"resize",ne)},[a,j,s,U]);const se={...M?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":O||void 0,id:`${P}-list`},onKeyDown(B){W&&Gn.has(B.key)&&B.stopPropagation()},onScroll(B){M||h(B.currentTarget)},...j&&{style:M?{height:"100%"}:jr}},Ie=Qe("div",t,{ref:[n,m],state:F,stateAttributesMapping:$r,props:[T,se,lr(K),{className:!M&&j?Yt.className:void 0},R]});return ye.jsxs(r.Fragment,{children:[!$&&Yt.getElement(he),ye.jsx(qn,{context:J,modal:!1,disabled:!z,openInteractionType:oe,returnFocus:i,restoreFocus:!0,children:Ie})]})});function qt(e){const t=e.maxHeight||"";return t.endsWith("px")&&parseFloat(t)||1/0}function gt(e){return pn(e.scrollHeight,e.clientHeight)}function $t(e){return sr.getScale(e)}function rt(e,t,n){return e/n[t]}function mt(e,t){return ir({x:rt(e.x,"x",t),y:rt(e.y,"y",t),width:rt(e.width,"x",t),height:rt(e.height,"y",t)})}const Gt=[["transform","none"],["scale","1"],["translate","0 0"]];function Gr(e){const{style:t}=e,n={};for(const[o,l]of Gt)n[o]=t.getPropertyValue(o),t.setProperty(o,l,"important");return()=>{for(const[o]of Gt){const l=n[o];l?t.setProperty(o,l):t.removeProperty(o)}}}let hn=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function Xr(e={}){const{label:t,metadata:n,textRef:o,indexGuessBehavior:l,index:c}=e,{register:i,unregister:R,subscribeMapChange:u,elementsRef:m,labelsRef:v,nextIndexRef:a}=kr(),p=r.useRef(-1),[b,y]=r.useState(c??(l===hn.GuessFromOrder?()=>{if(p.current===-1){const I=a.current;a.current+=1,p.current=I}return p.current}:-1)),O=r.useRef(null),g=r.useCallback(I=>{if(O.current=I,b!==-1&&I!==null&&(m.current[b]=I,v)){const V=t!==void 0;v.current[b]=V?t:o?.current?.textContent??I.textContent}},[b,m,v,t,o]);return G(()=>{if(c!=null)return;const I=O.current;if(I)return i(I,n),()=>{R(I)}},[c,i,R,n]),G(()=>{if(c==null)return u(I=>{const V=O.current?I.get(O.current)?.index:null;V!=null&&y(V)})},[c,u,y]),{ref:g,index:b}}const yn=r.createContext(void 0);function kt(){const e=r.useContext(yn);if(!e)throw new Error(it(57));return e}const lo=r.memo(r.forwardRef(function(t,n){const{render:o,className:l,style:c,value:i=null,label:R,disabled:u=!1,nativeButton:m=!1,...v}=t,a=r.useRef(null),p=Xr({label:R,textRef:a,indexGuessBehavior:hn.GuessFromOrder}),{store:b,itemProps:y,setOpen:O,setValue:g,selectionRef:I,typingRef:V,valuesRef:E,multiple:d,selectedItemTextRef:L,disabled:j,readOnly:q}=Ye(),D=w(b,C.isActive,p.index),W=w(b,C.open),J=w(b,C.isSelected,i),me=w(b,C.isSelectedByFocus,p.index),he=w(b,C.isItemEqualToValue),$=p.index,P=$!==-1,U=r.useRef(null);G(()=>{if(!P)return;const h=E.current;return h[$]=i,()=>{delete h[$]}},[P,$,i,E]),G(()=>{if(!P)return;const h=b.state.value;let F=h;d&&Array.isArray(h)&&(F=h.length>0?h[h.length-1]:void 0),F!==void 0&&Ke(i,F,he)&&(b.set("selectedIndex",$),a.current&&(L.current=a.current))},[P,$,d,he,b,i,L]);const oe=r.useRef(null),z=r.useRef("mouse"),T=r.useRef(!1),{getButtonProps:K,buttonRef:k}=en({disabled:u,focusableWhenDisabled:!0,native:m,composite:!0}),s={disabled:u,selected:J,highlighted:D};function M(h){if(j||q)return;const F=b.state.value;if(d){const se=Array.isArray(F)?F:[],Ie=J?Tr(se,i,he):[...se,i];g(Ie,Me(vt,h))}else g(i,Me(vt,h)),O(!1,Me(vt,h))}function ae(){I.current.dragY=0}const H={role:"option","aria-selected":J,tabIndex:W&&D?0:-1,onKeyDown(h){oe.current=h.key,b.set("activeIndex",$),h.key===" "&&V.current&&h.preventDefault()},onClick(h){const F=h.type==="click"&&z.current!=="touch",se=h.nativeEvent.pointerType,Ie=F&&nn(h.nativeEvent)&&(se!==void 0||D),B=F&&!Ie&&!T.current;T.current=!1,!(h.type==="keydown"&&oe.current===null)&&(u||h.type==="keydown"&&oe.current===" "&&V.current||B||(oe.current=null,M(h.nativeEvent)))},onPointerEnter(h){z.current=h.pointerType},onPointerMove(h){if(h.pointerType==="mouse"&&h.buttons===1){const F=I.current;F.dragY+=h.movementY,F.dragY**2>=64&&(F.allowUnselectedMouseUp=!0)}},onPointerDown(h){z.current=h.pointerType,T.current=!0,ae()},onMouseUp(){if(ae(),u||z.current==="touch"||T.current)return;const h=!I.current.allowSelectedMouseUp&&J,F=!I.current.allowUnselectedMouseUp&&!J;h||F||(T.current=!0,U.current?.click(),T.current=!1)}},pe=Qe("div",t,{ref:[k,n,p.ref,U],state:s,props:[y,H,v,K]}),ge=r.useMemo(()=>({selected:J,index:$,textRef:a,selectedByFocus:me,hasRegistered:P}),[J,$,a,me,P]);return ye.jsx(yn.Provider,{value:ge,children:pe})})),co=r.forwardRef(function(t,n){const o=t.keepMounted??!1,{selected:l}=kt();return o||l?ye.jsx(Jr,{...t,ref:n}):null}),Jr=r.memo(r.forwardRef((e,t)=>{const{render:n,className:o,style:l,keepMounted:c,...i}=e,{selected:R}=kt(),u=r.useRef(null),{transitionStatus:m,setMounted:v}=rn(R),p=Qe("span",e,{ref:[t,u],state:{selected:R,transitionStatus:m},props:[{"aria-hidden":!0,children:"✔️"},i],stateAttributesMapping:tn});return Ft({open:R,ref:u,onComplete(){R||v(!1)}}),p})),uo=r.memo(r.forwardRef(function(t,n){const{index:o,textRef:l,selectedByFocus:c,hasRegistered:i}=kt(),{firstItemTextRef:R,selectedItemTextRef:u}=Ye(),{render:m,className:v,style:a,...p}=t,b=r.useCallback(O=>{O&&(i&&o===0&&(R.current=O),i&&c&&(u.current=O))},[R,u,o,c,i]);return Qe("div",t,{ref:[b,n,l],props:p})}));export{jr as L,to as S,zr as a,Yt as b,no as c,ro as d,oo as e,so as f,io as g,lo as h,co as i,uo as j,yr as k,wr as l,Nt as m,cn as n,Wt as o,br as p,C as s,Ye as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{m as C,r as u,j as t,e as N,c as a,a as ie,aq as oe,bd as re,aw as le,ax as ce,a7 as F,be as ue,bf as de,u as ge,d as O,Z as he,a1 as B,n as _,bg as me,bh as be,O as H,bi as pe,y as fe,bj as xe,bk as ye,bl as ve,bm as je,bn as ke,bo as Ne,bp as Se,L as Ce,R as we,bq as Le,br as Ae,a4 as G,h as Oe,bs as Ee}from"./__vite-browser-external-Db9onipF.js";import{b as Ie,g as Pe,L as T,m as $}from"./react-BnaPNGj8.js";import{u as _e,L as D}from"./use-limits-display-prefs-DfKtH1Zn.js";import{P as Ge}from"./ProviderIcon-7Tkq9_m6.js";import{a as R,l as M}from"./limits-providers-CRHpXhmW.js";import{a as S,T as x,b,S as E,u as L}from"./Controls-DPtXGUGi.js";import{P as Te,u as De,a as Re}from"./use-session-efficiency-pref-CMDTCAAd.js";import{C as Me}from"./check-CasSqiev.js";import{C as Ue}from"./copy-D67vycfp.js";import{A as Fe}from"./index-CaRyTJ6K.js";import{u as Be}from"./useCurrency-B0hJte5f.js";import{u as He}from"./useTokenFormat-DB8pKLFM.js";import{S as V}from"./Select-Dp4V9p6t.js";import{I as $e}from"./info-D9LwqlnC.js";import{C as Ve}from"./ConfirmModal-Ct2HLdds.js";import{A as qe}from"./arrow-up-right-COvrArNz.js";import{D as ze}from"./download-adOCFO2v.js";import"./Card-DZ-_fXkw.js";import"./ToolbarRootContext-CwRaHhMN.js";import"./useScrollLock-DuosKdSB.js";import"./SelectItemText-CxhBeoxx.js";import"./DialogTitle-BIwLH6gA.js";import"./store-BwMVXuz3.js";import"./DialogDescription-DeRza-LI.js";const Ke=[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]],Ze=C("flask-conical",Ke);const We=[["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"}]],Ye=C("grip-vertical",We);const Qe=[["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"}]],Je=C("languages",Qe);const Xe=[["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"}]],et=C("log-out",Xe);const tt=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],nt=C("palette",tt);const at=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],st=C("user-round",at),it=e=>!e.isLayoutDirty&&e.willUpdate(!1);function U(){const e=new Set,n=new WeakMap,s=()=>e.forEach(it);return{add:i=>{e.add(i),n.set(i,i.addEventListener("willUpdate",s))},remove:i=>{e.delete(i);const o=n.get(i);o&&(o(),n.delete(i)),s()},dirty:s}}const ot=u.createContext(null);function rt(){const e=u.useRef(!1);return Ie(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function lt(){const e=rt(),[n,s]=u.useState(0),i=u.useCallback(()=>{e.current&&s(n+1)},[n]);return[u.useCallback(()=>Pe.postRender(i),[i]),n]}const q=e=>e===!0,ct=e=>q(e===!0)||e==="id",ut=({children:e,id:n,inherit:s=!0})=>{const i=u.useContext(T),o=u.useContext(ot),[r,l]=lt(),d=u.useRef(null),g=i.id||o;d.current===null&&(ct(s)&&g&&(n=n?g+"-"+n:g),d.current={id:n,group:q(s)&&i.group||U()});const p=u.useMemo(()=>({...d.current,forceRender:r}),[l]);return t.jsx(T.Provider,{value:p,children:e})},dt="shrink-0 text-oai-gray-900 dark:text-oai-gray-200";function gt({checked:e,onChange:n,ariaLabel:s}){return t.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":s,onClick:n,className:N("relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",e?"bg-oai-brand-500":"bg-oai-gray-300 dark:bg-oai-gray-700"),children:t.jsx("span",{className:N("inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform",e?"translate-x-[18px]":"translate-x-[3px]")})})}function ht({prefs:e}){const{order:n,visibility:s,toggle:i,moveToward:o}=e,[r,l]=u.useState(null),[d,g]=u.useState(null),p=c=>m=>{l(c),m.dataTransfer.effectAllowed="move",m.dataTransfer.setData("text/plain",c)},h=c=>m=>{m.preventDefault(),m.dataTransfer.dropEffect="move",r&&r!==c&&d!==c&&(g(c),o(r,c))},y=()=>{l(null),g(null)},v=c=>{c.preventDefault(),l(null),g(null)};return t.jsx(ut,{children:t.jsx("div",{className:"flex flex-col",children:n.map(c=>{const m=s[c]!==!1,f=r===c;return t.jsxs($.div,{layout:!0,transition:{duration:.28,ease:[.22,1,.36,1]},draggable:!0,onDragStart:p(c),onDragOver:h(c),onDragEnd:y,onDrop:v,className:N("flex items-center gap-3 py-2 rounded-md","hover:bg-oai-gray-100/60 dark:hover:bg-oai-gray-800/60",f&&"opacity-40"),style:{cursor:f?"grabbing":"grab"},children:[t.jsx(Ye,{className:"h-4 w-4 shrink-0 text-oai-gray-400 dark:text-oai-gray-500",strokeWidth:1.75,"aria-hidden":!0}),R(c)?t.jsx(Ge,{provider:R(c),size:18,className:N("pointer-events-none",dt)}):null,t.jsx("span",{className:"flex-1 text-sm text-oai-gray-900 dark:text-oai-gray-200 select-none",children:M(c)}),t.jsx("div",{onMouseDown:j=>j.stopPropagation(),draggable:!1,children:t.jsx(gt,{checked:m,onChange:()=>i(c),ariaLabel:`${a("limits.settings.toggle_visible")}: ${M(c)}`})})]},c)})})})}function mt(e){if(!e||typeof e!="object")return"";const n=e.user_metadata&&typeof e.user_metadata=="object"?e.user_metadata:{},s=e.profile&&typeof e.profile=="object"?e.profile:{},i=n.full_name||n.name||s.name||n.user_name||n.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 bt(e){return!e||typeof e!="object"?"":typeof e.email=="string"?e.email.trim():""}function pt(e){const n=typeof e=="string"?e.trim():"";if(!n)return null;const s=n.match(/^@?([A-Za-z0-9][A-Za-z0-9-]{0,38})$/),i=n.match(/^https:\/\/github\.com\/([A-Za-z0-9][A-Za-z0-9-]{0,38})\/?$/i),o=s?.[1]||i?.[1];return o?`https://github.com/${o}`:null}function I(e,n){console.warn(`[tokentracker] settings ${e}:`,n)}function ft(e,n,s){const[i,o]=u.useState(()=>oe()),r=n&&s&&re(),l=u.useCallback(async()=>{const d=!i;if(le(d),o(d),!!d)try{await ce(()=>e())}catch(g){I("cloud sync",g)}},[i,e]);return{cloudSyncOn:i,handleCloudSyncToggle:l,showLocalCloudSync:r}}function xt(e){const[n,s]=u.useState(!1),[i,o]=u.useState(!1),[r,l]=u.useState(!1),[d,g]=u.useState(!1),[p,h]=u.useState(null),[y,v]=u.useState(!1),[c,m]=u.useState(""),[f,j]=u.useState(!1),[w,P]=u.useState(""),[W,Y]=u.useState(""),[Q,J]=u.useState(!1),[X,ee]=u.useState(null),te=u.useMemo(()=>mt(e),[e]),ne=u.useMemo(()=>bt(e),[e]),ae=u.useMemo(()=>typeof e?.id=="string"?e.id.trim():"",[e]),se=u.useMemo(()=>({setAnonymousOn:o,setCustomDisplayName:h,setGithubUrl:P,setProfileLoading:l,setPublicProfileOn:s,setShowGithubOn:j}),[]);return{anonymousOn:i,customDisplayName:p,displayName:te,editingGithub:Q,editingName:y,email:ne,githubError:X,githubInput:W,githubUrl:w,loadSetters:se,nameInput:c,profileLoading:r,profileSaving:d,publicProfileOn:n,setAnonymousOn:o,setCustomDisplayName:h,setEditingGithub:J,setEditingName:v,setGithubError:ee,setGithubInput:Y,setGithubUrl:P,setNameInput:m,setProfileLoading:l,setProfileSaving:g,setPublicProfileOn:s,setShowGithubOn:j,showGithubOn:f,userId:ae}}function yt(e,n,s){u.useEffect(()=>{if(!n)return;let i=!0;return s.setProfileLoading(!0),(async()=>{try{const o=await F({getAccessToken:e});if(!i||!o)return;const r=await ue({accessToken:o});if(!i)return;s.setPublicProfileOn(!!r?.enabled),s.setAnonymousOn(!!r?.anonymous),r?.display_name&&s.setCustomDisplayName(r.display_name),s.setShowGithubOn(!!r?.show_github_url),s.setGithubUrl(r?.github_url||"")}catch(o){I("load public profile",o)}finally{i&&s.setProfileLoading(!1)}})(),()=>{i=!1}},[e,n,s])}function vt(e,n){return u.useCallback(async(s,{label:i,onError:o,onSuccess:r}={})=>{if(n.profileSaving)return!1;n.setProfileSaving(!0);try{const l=await F({getAccessToken:e});if(!l)return!1;const d=await de({accessToken:l,...s});return r?.(d),!0}catch(l){return o?o(l):I(i||"mutate profile",l),!1}finally{n.setProfileSaving(!1)}},[e,n])}function jt(e,n){return{anonymousOn:e.anonymousOn,customDisplayName:e.customDisplayName,displayName:e.displayName,editingName:e.editingName,handleAnonymousToggle:n.handleAnonymousToggle,handleSaveName:n.handleSaveName,nameInput:e.nameInput,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingName:e.setEditingName,setNameInput:e.setNameInput,startEditingName:n.startEditingName}}function kt(e,n){return{editingGithub:e.editingGithub,githubError:e.githubError,githubInput:e.githubInput,githubUrl:e.githubUrl,handleSaveGithub:n.handleSaveGithub,handleShowGithubToggle:n.handleShowGithubToggle,profileLoading:e.profileLoading,profileSaving:e.profileSaving,setEditingGithub:e.setEditingGithub,setGithubError:e.setGithubError,setGithubInput:e.setGithubInput,showGithubOn:e.showGithubOn,startEditingGithub:n.startEditingGithub}}function Nt(e,n){const s=u.useCallback(async()=>{const o=!e.publicProfileOn;await n({enabled:o},{label:"toggle public profile",onSuccess:()=>e.setPublicProfileOn(o)})},[n,e]);return{handleAnonymousToggle:u.useCallback(async()=>{const o=!e.anonymousOn;await n({anonymous:o},{label:"toggle anonymous",onSuccess:()=>e.setAnonymousOn(o)})},[n,e]),handlePublicProfileToggle:s}}function St(e,n,s){const i=u.useCallback(async()=>{const r=e.nameInput.trim().slice(0,50);r&&await n({display_name:r},{label:"save display name",onSuccess:()=>{e.setCustomDisplayName(r),e.setEditingName(!1),s?.()}})},[n,e,s]),o=u.useCallback(()=>{e.setNameInput(e.customDisplayName||e.displayName),e.setEditingName(!0)},[e]);return{handleSaveName:i,startEditingName:o}}function Ct(e,n){const s=u.useCallback(async()=>{if(!e.showGithubOn&&!e.githubUrl){e.setEditingGithub(!0),e.setGithubInput(""),e.setGithubError(null);return}const r=!e.showGithubOn;await n({show_github_url:r},{label:"toggle GitHub profile",onSuccess:()=>e.setShowGithubOn(r)})},[n,e]),i=u.useCallback(async()=>{const r=pt(e.githubInput);if(e.githubInput.trim()&&!r){e.setGithubError(a("settings.account.githubUrlInvalid"));return}e.setGithubError(null),await n({github_url:r,show_github_url:!!r},{label:"save GitHub profile",onError:l=>e.setGithubError(l?.message||a("settings.account.githubUrlInvalid")),onSuccess:l=>{e.setGithubUrl(l?.github_url||r||""),e.setShowGithubOn(!!r),e.setEditingGithub(!1)}})},[n,e]),o=u.useCallback(()=>{e.setGithubInput(e.githubUrl),e.setGithubError(null),e.setEditingGithub(!0)},[e]);return{handleSaveGithub:i,handleShowGithubToggle:s,startEditingGithub:o}}function wt(){const e=ie(),n=xt(e.user),s=ft(e.getAccessToken,e.enabled,e.signedIn);yt(e.getAccessToken,e.signedIn,n.loadSetters);const i=vt(e.getAccessToken,n),o=Nt(n,i),r=St(n,i,e.refreshDisplayName),l=Ct(n,i);return{...e,...s,email:n.email,handlePublicProfileToggle:o.handlePublicProfileToggle,userId:n.userId,name:jt(n,{...o,...r}),github:kt(n,l),profileLoading:n.profileLoading,profileSaving:n.profileSaving,publicProfileOn:n.publicProfileOn}}function z({disabled:e,onCancel:n,onSave:s,saveLabel:i=a("settings.account.save")}){return t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",onClick:s,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}),t.jsx("button",{type:"button",onClick:n,className:"rounded-md px-2 py-1.5 text-xs text-oai-gray-500 transition-colors hover:text-oai-gray-700 dark:hover:text-oai-gray-300",children:a("settings.account.cancel")})]})}function Lt({nameInput:e,setEditingName:n,setNameInput:s,profileSaving:i,handleSaveName:o}){return t.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[t.jsx("input",{type:"text",value:e,onChange:r=>s(r.target.value),onKeyDown:r=>{r.key==="Enter"&&o(),r.key==="Escape"&&n(!1)},maxLength:50,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white",placeholder:a("settings.account.displayName")}),t.jsx(z,{disabled:i||!e.trim(),onCancel:()=>n(!1),onSave:o,saveLabel:i?a("settings.account.saving"):void 0})]})}function At({githubError:e,githubInput:n,handleSaveGithub:s,profileSaving:i,setEditingGithub:o,setGithubError:r,setGithubInput:l}){return t.jsxs("div",{className:"mt-2",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("input",{type:"text",value:n,onChange:d=>{l(d.target.value),e&&r(null)},onKeyDown:d=>{d.key==="Enter"&&s(),d.key==="Escape"&&(o(!1),r(null))},maxLength:100,autoFocus:!0,className:"flex-1 rounded-md border border-oai-gray-300 bg-transparent px-2.5 py-1.5 text-sm text-oai-black outline-none focus:border-oai-brand-500 focus:ring-1 focus:ring-inset focus:ring-oai-brand-500 dark:border-oai-gray-700 dark:text-white",placeholder:a("settings.account.githubUrlPlaceholder")}),t.jsx(z,{disabled:i,onCancel:()=>{o(!1),r(null)},onSave:s,saveLabel:i?a("settings.account.saving"):void 0})]}),e?t.jsx("div",{className:"mt-1.5 text-xs text-red-600 dark:text-red-400",children:e}):null]})}function K({disabled:e=!1,label:n,onClick:s,title:i}){return t.jsxs("button",{type:"button",onClick:s,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:[t.jsx(Te,{className:"h-3.5 w-3.5","aria-hidden":!0}),n]})}function Z({actions:e,editing:n,editor:s,hint:i,label:o}){return t.jsx("div",{className:"py-3",children:t.jsxs("div",{className:"flex items-start justify-between gap-4",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:o}),n?s:t.jsx("div",{className:"mt-0.5 truncate text-xs text-oai-gray-500 dark:text-oai-gray-400",children:i})]}),n?null:e]})})}function Ot({name:e}){const n=e.anonymousOn?a("settings.account.displayNameDisabledWhileAnon"):void 0;return t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsx(K,{disabled:e.anonymousOn,label:a("settings.account.edit"),onClick:e.startEditingName,title:n}),t.jsx(x,{checked:!e.anonymousOn,onChange:e.handleAnonymousToggle,disabled:e.profileLoading||e.profileSaving,ariaLabel:a("settings.account.displayName")})]})}function Et({name:e}){const{anonymousOn:n,customDisplayName:s,displayName:i,editingName:o,handleAnonymousToggle:r,handleSaveName:l,nameInput:d,profileLoading:g,profileSaving:p,setEditingName:h,setNameInput:y,startEditingName:v}=e,c=n?a("settings.account.displayNameAnonymousHint"):s||i;return t.jsx(Z,{label:a("settings.account.displayName"),editing:o,hint:c,editor:t.jsx(Lt,{nameInput:d,setEditingName:h,setNameInput:y,profileSaving:p,handleSaveName:l}),actions:t.jsx(Ot,{name:e})})}function It({github:e}){const{editingGithub:n,githubError:s,githubInput:i,githubUrl:o,handleSaveGithub:r,handleShowGithubToggle:l,profileLoading:d,profileSaving:g,setEditingGithub:p,setGithubError:h,setGithubInput:y,showGithubOn:v,startEditingGithub:c}=e;return t.jsx(t.Fragment,{children:t.jsx(Z,{label:a("settings.account.githubUrl"),editing:n,hint:o||a("settings.account.githubUrlHint"),editor:t.jsx(At,{githubError:s,githubInput:i,handleSaveGithub:r,profileSaving:g,setEditingGithub:p,setGithubError:h,setGithubInput:y}),actions:t.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[t.jsx(K,{label:a("settings.account.edit"),onClick:c}),t.jsx(x,{checked:v,onChange:l,disabled:d||g,ariaLabel:a("settings.account.githubUrl")})]})})})}function Pt(){const{openLoginModal:e}=ge();return t.jsx(S,{title:a("settings.section.account"),children:t.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[t.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-400",children:a("settings.account.signedOutHint")}),t.jsx("button",{type:"button",onClick:e,className:"inline-flex h-8 shrink-0 items-center justify-center rounded-md bg-oai-gray-900 px-4 text-xs font-medium text-white transition-colors hover:bg-oai-gray-800 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100",children:a("settings.account.signIn")})]})})}function _t({name:e,github:n}){return t.jsxs(t.Fragment,{children:[t.jsx(Et,{name:e}),t.jsx(It,{github:n})]})}function Gt(){const e=wt();return e.enabled?e.signedIn?t.jsxs(S,{title:a("settings.section.account"),subtitle:e.email||e.name.customDisplayName||e.name.displayName,action:t.jsx(Dt,{onSignOut:e.signOut}),children:[t.jsx(Tt,{userId:e.userId}),t.jsx(Rt,{settings:e}),t.jsx(Mt,{checked:e.publicProfileOn,disabled:e.profileLoading||e.profileSaving,onChange:e.handlePublicProfileToggle}),t.jsx(Ut,{visible:e.publicProfileOn,name:e.name,github:e.github})]}):t.jsx(Pt,{}):null}function Tt({userId:e}){const[n,s]=O.useState(!1);if(!e)return null;const i=async()=>{try{if(typeof navigator>"u"||!navigator.clipboard?.writeText)return;await navigator.clipboard.writeText(e),s(!0),globalThis.setTimeout(()=>s(!1),1200)}catch{s(!1)}};return t.jsxs("div",{className:"flex items-center justify-between gap-4 py-3",children:[t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("div",{className:"text-sm text-oai-gray-900 dark:text-oai-gray-200",children:a("settings.account.userId")}),t.jsx("div",{className:"mt-0.5 truncate font-mono text-xs text-oai-gray-500 dark:text-oai-gray-400",children:e})]}),t.jsxs("button",{type:"button",onClick: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 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800","aria-label":a("settings.account.copyUserId"),children:[n?t.jsx(Me,{className:"h-3.5 w-3.5","aria-hidden":!0}):t.jsx(Ue,{className:"h-3.5 w-3.5","aria-hidden":!0}),n?a("settings.account.copied"):a("settings.account.copy")]})]})}function Dt({onSignOut:e}){return t.jsxs("button",{type:"button",onClick:()=>e(),className:"inline-flex h-7 items-center gap-1.5 text-xs font-medium text-oai-gray-500 transition-colors hover:text-oai-gray-700 dark:hover:text-oai-gray-300",children:[t.jsx(et,{className:"h-3.5 w-3.5","aria-hidden":!0}),a("settings.account.signOut")]})}function Rt({settings:e}){return e.showLocalCloudSync?t.jsx(b,{label:a("settings.account.cloudSync"),hint:a("settings.account.cloudSyncHint"),control:t.jsx(x,{checked:e.cloudSyncOn,onChange:e.handleCloudSyncToggle,ariaLabel:a("settings.account.cloudSync")})}):null}function Mt({checked:e,disabled:n,onChange:s}){return t.jsx(b,{label:a("settings.account.publicProfile"),hint:a("settings.account.publicProfileHint"),control:t.jsx(x,{checked:e,onChange:s,disabled:n,ariaLabel:a("settings.account.publicProfile")})})}function Ut({visible:e,name:n,github:s}){return t.jsx(Fe,{initial:!1,children:e?t.jsx($.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{height:{duration:.28,ease:[.22,1,.36,1]},opacity:{duration:.2,ease:[.22,1,.36,1]}},style:{overflow:"hidden"},className:"divide-y divide-oai-gray-200/60 dark:divide-oai-gray-800/60",children:t.jsx(_t,{name:n,github:s})},"public-profile-fields"):null})}function Ft(){return[{value:"light",label:a("settings.appearance.theme.light"),Icon:me},{value:"dark",label:a("settings.appearance.theme.dark"),Icon:be},{value:"system",label:a("settings.appearance.theme.system"),Icon:H}]}function Bt(){return[{value:xe,label:a("settings.appearance.language.system")},{value:ye,label:a("settings.appearance.language.english")},{value:ve,label:a("settings.appearance.language.chinese")},{value:je,label:a("settings.appearance.language.traditional_chinese")},{value:ke,label:a("settings.appearance.language.japanese")},{value:Ne,label:a("settings.appearance.language.korean")},{value:Se,label:a("settings.appearance.language.german")}]}function Ht(e){if(!e)return null;try{const n=new Date(e);return Number.isNaN(n.getTime())?null:n.toLocaleString()}catch{return null}}function $t(e,n){const s=a(`settings.appearance.currency.rate_source.${e}`),i=Ht(n),o=i?a("settings.appearance.currency.rate_updated",{when:i}):a("settings.appearance.currency.rate_never");return`${s} · ${o}`}function Vt({locale:e,setLocale:n}){const s=Bt();return t.jsx(V,{value:e,onValueChange:n,options:s,ariaLabel:a("settings.appearance.language.label"),className:"px-2.5 py-1.5 text-xs font-medium",leadingIcon:t.jsx(Je,{className:"h-3.5 w-3.5 text-oai-gray-500 dark:text-oai-gray-400","aria-hidden":!0})})}function qt({currency:e,setCurrency:n}){const s=pe().map(i=>({value:i.code,label:a(i.labelKey)}));return t.jsx(V,{value:e,onValueChange:n,options:s,ariaLabel:a("settings.appearance.currency.label"),className:"px-3 py-1.5 text-xs font-medium"})}function zt({currency:e,rate:n,rateSource:s,rateFetchedAt:i}){if(e===fe)return t.jsx(t.Fragment,{children:a("settings.appearance.currency.hint")});const o=$t(s,i);return t.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[t.jsx("span",{children:`1 USD = ${n.toFixed(4)} ${e}`}),t.jsx("span",{role:"img","aria-label":o,title:o,className:"inline-flex h-4 w-4 cursor-help items-center justify-center text-oai-gray-400 hover:text-oai-gray-600 dark:text-oai-gray-500 dark:hover:text-oai-gray-300",children:t.jsx($e,{className:"h-3.5 w-3.5","aria-hidden":!0})})]})}function Kt(){const{theme:e,setTheme:n}=he(),{locale:s,setLocale:i}=B(),{currency:o,rate:r,rateSource:l,rateFetchedAt:d,setCurrency:g}=Be(),{mode:p,setMode:h}=He();return t.jsxs(S,{title:a("settings.section.appearance"),children:[t.jsx(b,{label:a("settings.appearance.theme.label"),hint:a("settings.appearance.theme.hint"),control:t.jsx(E,{options:Ft(),value:e,onChange:n})}),t.jsx(b,{label:a("settings.appearance.language.label"),hint:a("settings.appearance.language.hint"),control:t.jsx(Vt,{locale:s,setLocale:i})}),t.jsx(b,{label:a("settings.appearance.currency.label"),hint:t.jsx(zt,{currency:o,rate:r,rateSource:l,rateFetchedAt:d}),control:t.jsx(qt,{currency:o,setCurrency:g})}),t.jsx(b,{label:a("settings.appearance.token_format.label"),hint:a("settings.appearance.token_format.hint"),control:t.jsx(E,{options:[{value:_.COMPACT,label:a("settings.appearance.token_format.compact")},{value:_.FULL,label:a("settings.appearance.token_format.full")}],value:p,onChange:h})})]})}function A({labelKey:e}){return t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx("span",{children:a(e)}),t.jsx("span",{className:"px-1.5 py-0.5 text-[8px] font-semibold tracking-wider text-oai-gray-500 bg-oai-gray-100 dark:text-oai-gray-400 dark:bg-oai-gray-800/80 rounded uppercase scale-90 origin-left",children:a("qpd.card.badge")})]})}function Zt(){const{enabled:e,toggle:n}=De(),{enabled:s,toggle:i}=Re(),{available:o,settings:r,setSetting:l}=L(),d=o&&!!r?.dynamicIslandSupported,g=!!r?.dynamicIslandEnabled;return t.jsxs(S,{title:a("settings.section.labs"),children:[d&&t.jsxs(t.Fragment,{children:[t.jsx(b,{label:t.jsx(A,{labelKey:"settings.labs.island.label"}),hint:a("settings.labs.island.hint"),control:t.jsx(x,{checked:g,onChange:()=>l("dynamicIslandEnabled",!g),ariaLabel:a("settings.labs.island.aria")})}),g&&t.jsx(b,{label:a("settings.labs.island_hide_menubar.label"),hint:a("settings.labs.island_hide_menubar.hint"),control:t.jsx(x,{checked:!!r?.hideMenuBarIcon,onChange:()=>l("hideMenuBarIcon",!r?.hideMenuBarIcon),ariaLabel:a("settings.labs.island_hide_menubar.aria")})})]}),t.jsx(b,{label:t.jsx(A,{labelKey:"settings.labs.qpd.label"}),hint:a("settings.labs.qpd.hint"),control:t.jsx(x,{checked:e,onChange:n,ariaLabel:a("settings.labs.qpd.aria")})}),t.jsx(b,{label:t.jsx(A,{labelKey:"settings.labs.sessions.label"}),hint:a("settings.labs.sessions.hint"),control:t.jsx(x,{checked:s,onChange:i,ariaLabel:a("settings.labs.sessions.aria")})})]})}function Wt(){const{available:e,settings:n,setSetting:s,runAction:i}=L();if(!e)return null;const o=!!n?.launchAtLogin,r=n?.toastOnReset!==!1,l=n?.confettiOnReset!==!1,d=n?.launchAtLoginSupported!==!1,g=n?.updateStatus||null,p=!!n?.updateBusy,h=!!n?.isSyncing;return t.jsxs(S,{title:a("settings.section.menubar"),children:[t.jsx(b,{label:a("settings.menubar.appearance"),hint:a("settings.menubar.appearanceHint"),control:t.jsxs(Ce,{to:"/widgets",className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 no-underline transition-colors hover:bg-oai-gray-100 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[a("settings.menubar.appearanceLink"),t.jsx(qe,{className:"h-3.5 w-3.5","aria-hidden":!0})]})}),t.jsx(b,{label:a("settings.menubar.toastOnReset"),hint:a("settings.menubar.toastOnResetHint"),control:t.jsx(x,{checked:r,onChange:()=>s("toastOnReset",!r),ariaLabel:a("settings.menubar.toastOnReset")})}),t.jsx(b,{label:a("settings.menubar.confettiOnReset"),hint:a("settings.menubar.confettiOnResetHint"),control:t.jsx(x,{checked:l,onChange:()=>s("confettiOnReset",!l),ariaLabel:a("settings.menubar.confettiOnReset")})}),d?t.jsx(b,{label:a("settings.menubar.launchAtLogin"),hint:a("settings.menubar.launchAtLoginHint"),control:t.jsx(x,{checked:o,onChange:()=>s("launchAtLogin",!o),ariaLabel:a("settings.menubar.launchAtLogin")})}):null,t.jsx(b,{label:a("settings.menubar.syncNow"),hint:a("settings.menubar.syncNowHint"),control:t.jsxs("button",{type:"button",onClick:()=>i("syncNow"),disabled:h,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[t.jsx(we,{className:N("h-3.5 w-3.5",h&&"animate-spin"),"aria-hidden":!0}),h?a("settings.menubar.syncing"):a("settings.menubar.syncNow")]})}),t.jsx(b,{label:a("settings.menubar.updates"),hint:g||void 0,control:t.jsxs("button",{type:"button",onClick:()=>i("checkForUpdates"),disabled:p,className:"inline-flex h-8 items-center gap-1.5 rounded-md border border-oai-gray-200 px-3 text-xs font-medium text-oai-gray-700 transition-colors hover:bg-oai-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-oai-gray-800 dark:text-oai-gray-300 dark:hover:bg-oai-gray-800",children:[t.jsx(ze,{className:"h-3.5 w-3.5","aria-hidden":!0}),a("settings.menubar.checkUpdates")]})})]})}function Yt(e,n){function s(r){return r.replace(/^v/,"").split(".").map(Number)}const i=s(e),o=s(n);for(let r=0;r<Math.max(i.length,o.length);r++){const l=i[r]||0,d=o[r]||0;if(l<d)return!0;if(l>d)return!1}return!1}function Qt(){const{available:e,settings:n,runAction:s}=L(),i=e&&n?.version,[o,r]=O.useState(!1),[l,d]=O.useState({open:!1,latestVersion:"",htmlUrl:""}),{resolvedLocale:g}=B(),p="0.87.2",h=async()=>{r(!0);try{const f=await fetch("https://api.github.com/repos/mm7894215/TokenTracker/releases/latest");if(!f.ok)throw new Error("Failed to fetch");const j=await f.json(),w=j.tag_name;Yt(p,w)?d({open:!0,latestVersion:w,htmlUrl:j.html_url}):G({title:a("settings.menubar.updates.upToDate")})}catch(f){console.error("Check updates failed:",f),G({title:a("settings.menubar.updates.failed")})}finally{r(!1)}},y=a("settings.menubar.updates.modalTitle"),v=a("settings.menubar.updates.modalDescription",{version:l.latestVersion}),c=a("settings.menubar.updates.modalConfirm"),m=a("settings.menubar.updates.modalCancel");return t.jsxs("div",{className:"mt-6 flex flex-col items-center justify-center gap-4 text-xs text-oai-gray-500 dark:text-oai-gray-500",children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[i?t.jsxs(t.Fragment,{children:[t.jsx("span",{children:a("settings.menubar.updates.footerCombined",{barVersion:n.version,coreVersion:p})}),t.jsx("span",{"aria-hidden":!0,children:"·"}),t.jsx("button",{type:"button",onClick:()=>s("openAbout"),className:"underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300",children:"GitHub"}),t.jsx("span",{"aria-hidden":!0,children:"·"})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{children:a("settings.menubar.updates.footerCore",{version:p})}),t.jsx("span",{"aria-hidden":!0,children:"·"}),t.jsx("button",{type:"button",onClick:h,disabled:o,className:"underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300 disabled:opacity-50",children:o?a("settings.menubar.updates.checking"):a("settings.menubar.checkUpdates")}),t.jsx("span",{"aria-hidden":!0,children:"·"})]}),t.jsxs("a",{href:Le,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 underline-offset-2 transition-colors hover:text-oai-gray-700 hover:underline dark:hover:text-oai-gray-300",children:[t.jsx(Ae,{className:"h-3.5 w-3.5","aria-hidden":!0}),a("settings.footer.statusPage")]})]}),t.jsx(Ve,{open:l.open,title:y,description:v,confirmLabel:c,cancelLabel:m,onConfirm:()=>{window.open(l.htmlUrl,"_blank"),d(f=>({...f,open:!1}))},onCancel:()=>d(f=>({...f,open:!1}))})]})}const k={APPEARANCE:"appearance",NATIVE_APP:"native-app",ACCOUNT:"account",LIMITS:"limits",LABS:"labs"};function Jt({prefs:e}){return t.jsx(E,{options:[{value:D.USED,label:a("limits.settings.display_mode_used")},{value:D.REMAINING,label:a("limits.settings.display_mode_remaining")}],value:e.displayMode,onChange:e.setDisplayMode})}function Sn(){const e=_e(),{available:n,settings:s,setSetting:i}=L(),o=s?.toastOnReset!==!1,r=s?.confettiOnReset!==!1,[l,d]=Oe(),g=l.get("section"),h=Object.values(k).includes(g)&&(g!==k.NATIVE_APP||n)?g:k.APPEARANCE,y=c=>{const m=new URLSearchParams(l);c===k.APPEARANCE?m.delete("section"):m.set("section",c),d(m,{replace:!0})},v=[{id:k.APPEARANCE,label:a("settings.section.appearance"),Icon:nt,content:t.jsx(Kt,{})},...n?[{id:k.NATIVE_APP,label:a("settings.section.menubar"),Icon:H,content:t.jsx(Wt,{})}]:[],{id:k.ACCOUNT,label:a("settings.section.account"),Icon:st,content:t.jsx(Gt,{})},{id:k.LIMITS,label:a("settings.section.limits"),Icon:Ee,content:t.jsxs("div",{className:"space-y-4",children:[t.jsxs(S,{title:a("settings.section.limits"),children:[t.jsx(b,{label:a("limits.settings.display_mode_label"),control:t.jsx(Jt,{prefs:e})}),t.jsx(b,{label:a("settings.menubar.toastOnReset"),hint:a("settings.menubar.toastOnResetHint"),control:t.jsx(x,{checked:o,disabled:!n,onChange:()=>i("toastOnReset",!o),ariaLabel:a("settings.menubar.toastOnReset")})}),t.jsx(b,{label:a("settings.menubar.confettiOnReset"),hint:a("settings.menubar.confettiOnResetHint"),control:t.jsx(x,{checked:r,disabled:!n,onChange:()=>i("confettiOnReset",!r),ariaLabel:a("settings.menubar.confettiOnReset")})})]}),t.jsx(S,{title:a("settings.limits.providers"),children:t.jsx(ht,{prefs:e})})]})},{id:k.LABS,label:a("settings.section.labs"),Icon:Ze,content:t.jsx(Zt,{})}];return t.jsx("div",{className:"flex flex-1 flex-col font-oai text-oai-black antialiased dark:text-oai-white",children:t.jsx("main",{className:"flex-1 pb-12 pt-8 sm:pb-16 sm:pt-10",children:t.jsxs("div",{className:"mx-auto w-full max-w-5xl px-4 sm:px-6",children:[t.jsx("div",{className:"mb-7",children:t.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-oai-black dark:text-white sm:text-4xl",children:a("settings.page.title")})}),t.jsxs("div",{className:"grid min-w-0 gap-6 md:grid-cols-[12rem_minmax(0,1fr)] md:gap-8 lg:grid-cols-[13.5rem_minmax(0,1fr)]",children:[t.jsx("aside",{className:"min-w-0 border-b border-oai-gray-200 pb-3 dark:border-oai-gray-800 md:border-b-0 md:border-r md:pb-0 md:pr-5",children:t.jsx("nav",{"aria-label":a("settings.page.title"),className:"flex gap-0 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden md:sticky md:top-6 md:flex-col md:gap-1 md:overflow-visible",children:v.map(({id:c,label:m,Icon:f})=>{const j=h===c;return t.jsxs("button",{id:`settings-nav-${c}`,type:"button","aria-current":j?"page":void 0,"aria-controls":`settings-panel-${c}`,onClick:()=>y(c),className:N("inline-flex min-h-10 min-w-max shrink-0 items-center gap-1.5 rounded-md px-2 py-2 text-left text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-oai-brand-500 md:w-full md:min-w-0 md:gap-2 md:px-3",j?"bg-oai-gray-100 text-oai-black dark:bg-oai-gray-800 dark:text-white":"text-oai-gray-500 hover:bg-oai-gray-50 hover:text-oai-gray-900 dark:text-oai-gray-400 dark:hover:bg-oai-gray-900 dark:hover:text-oai-gray-200"),children:[t.jsx(f,{className:N("h-4 w-4 shrink-0",j?"text-oai-black dark:text-white":"text-oai-gray-400 dark:text-oai-gray-500"),"aria-hidden":!0}),t.jsx("span",{className:"truncate",children:m})]},c)})})}),t.jsxs("div",{className:"min-w-0",children:[v.map(({id:c,label:m,content:f})=>t.jsx("section",{id:`settings-panel-${c}`,"aria-labelledby":`settings-nav-${c}`,"aria-label":m,"data-settings-panel":c,hidden:h!==c,children:f},c)),t.jsx(Qt,{})]})]})]})})})}export{Sn as SettingsPage};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{r as c,d as P,a2 as Oe}from"./__vite-browser-external-Db9onipF.js";function In(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return c.useMemo(()=>r=>{t.forEach(o=>o(r))},t)}const tt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function me(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function wt(e){return"nodeType"in e}function B(e){var t,n;return e?me(e)?e:wt(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function mt(e){const{Document:t}=B(e);return e instanceof t}function Be(e){return me(e)?!1:e instanceof B(e).HTMLElement}function Vt(e){return e instanceof B(e).SVGElement}function ye(e){return e?me(e)?e.document:wt(e)?mt(e)?e:Be(e)||Vt(e)?e.ownerDocument:document:document:document}const Q=tt?c.useLayoutEffect:c.useEffect;function yt(e){const t=c.useRef(e);return Q(()=>{t.current=e}),c.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function Mn(){const e=c.useRef(null),t=c.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=c.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function ke(e,t){t===void 0&&(t=[e]);const n=c.useRef(e);return Q(()=>{n.current!==e&&(n.current=e)},t),n}function Fe(e,t){const n=c.useRef();return c.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Ke(e){const t=yt(e),n=c.useRef(null),r=c.useCallback(o=>{o!==n.current&&t?.(o,n.current),n.current=o},[]);return[n,r]}function ht(e){const t=c.useRef();return c.useEffect(()=>{t.current=e},[e]),t.current}let ct={};function $e(e,t){return c.useMemo(()=>{if(t)return t;const n=ct[e]==null?0:ct[e]+1;return ct[e]=n,e+"-"+n},[e,t])}function qt(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((i,a)=>{const s=Object.entries(a);for(const[l,u]of s){const f=i[l];f!=null&&(i[l]=f+e*u)}return i},{...t})}}const we=qt(1),ze=qt(-1);function An(e){return"clientX"in e&&"clientY"in e}function xt(e){if(!e)return!1;const{KeyboardEvent:t}=B(e.target);return t&&e instanceof t}function On(e){if(!e)return!1;const{TouchEvent:t}=B(e.target);return t&&e instanceof t}function gt(e){if(On(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return An(e)?{x:e.clientX,y:e.clientY}:null}const _e=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[_e.Translate.toString(e),_e.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),Nt="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Tn(e){return e.matches(Nt)?e:e.querySelector(Nt)}const Nn={display:"none"};function Ln(e){let{id:t,value:n}=e;return P.createElement("div",{id:t,style:Nn},n)}function kn(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return P.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function zn(){const[e,t]=c.useState("");return{announce:c.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const Gt=c.createContext(null);function Pn(e){const t=c.useContext(Gt);c.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function Bn(){const[e]=c.useState(()=>new Set),t=c.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[c.useCallback(r=>{let{type:o,event:i}=r;e.forEach(a=>{var s;return(s=a[o])==null?void 0:s.call(a,i)})},[e]),t]}const Fn={draggable:`
|
|
2
|
-
To pick up a draggable item, press the space bar.
|
|
3
|
-
While dragging, use the arrow keys to move the item.
|
|
4
|
-
Press space again to drop the item in its new position, or press escape to cancel.
|
|
5
|
-
`},$n={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Xn(e){let{announcements:t=$n,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=Fn}=e;const{announce:i,announcement:a}=zn(),s=$e("DndLiveRegion"),[l,u]=c.useState(!1);if(c.useEffect(()=>{u(!0)},[]),Pn(c.useMemo(()=>({onDragStart(d){let{active:h}=d;i(t.onDragStart({active:h}))},onDragMove(d){let{active:h,over:g}=d;t.onDragMove&&i(t.onDragMove({active:h,over:g}))},onDragOver(d){let{active:h,over:g}=d;i(t.onDragOver({active:h,over:g}))},onDragEnd(d){let{active:h,over:g}=d;i(t.onDragEnd({active:h,over:g}))},onDragCancel(d){let{active:h,over:g}=d;i(t.onDragCancel({active:h,over:g}))}}),[i,t])),!l)return null;const f=P.createElement(P.Fragment,null,P.createElement(Ln,{id:r,value:o.draggable}),P.createElement(kn,{id:s,announcement:a}));return n?Oe.createPortal(f,n):f}var O;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(O||(O={}));function Qe(){}function uo(e,t){return c.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function fo(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return c.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const q=Object.freeze({x:0,y:0});function Jt(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Kt(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Yn(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Lt(e){let{left:t,top:n,height:r,width:o}=e;return[{x:t,y:n},{x:t+o,y:n},{x:t,y:n+r},{x:t+o,y:n+r}]}function _t(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function kt(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const ho=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=kt(t,t.left,t.top),i=[];for(const a of r){const{id:s}=a,l=n.get(s);if(l){const u=Jt(kt(l),o);i.push({id:s,data:{droppableContainer:a,value:u}})}}return i.sort(Kt)},jn=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=Lt(t),i=[];for(const a of r){const{id:s}=a,l=n.get(s);if(l){const u=Lt(l),f=o.reduce((h,g,C)=>h+Jt(u[C],g),0),d=Number((f/4).toFixed(4));i.push({id:s,data:{droppableContainer:a,value:d}})}}return i.sort(Kt)};function Un(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),o=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),a=o-r,s=i-n;if(r<o&&n<i){const l=t.width*t.height,u=e.width*e.height,f=a*s,d=f/(l+u-f);return Number(d.toFixed(4))}return 0}const Wn=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const o=[];for(const i of r){const{id:a}=i,s=n.get(a);if(s){const l=Un(s,t);l>0&&o.push({id:a,data:{droppableContainer:i,value:l}})}}return o.sort(Yn)};function Hn(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Qt(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:q}function Vn(e){return function(n){for(var r=arguments.length,o=new Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return o.reduce((a,s)=>({...a,top:a.top+e*s.y,bottom:a.bottom+e*s.y,left:a.left+e*s.x,right:a.right+e*s.x}),{...n})}}const qn=Vn(1);function Gn(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function Jn(e,t,n){const r=Gn(t);if(!r)return e;const{scaleX:o,scaleY:i,x:a,y:s}=r,l=e.left-a-(1-o)*parseFloat(n),u=e.top-s-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),f=o?e.width/o:e.width,d=i?e.height/i:e.height;return{width:f,height:d,top:u,right:l+f,bottom:u+d,left:l}}const Kn={ignoreTransform:!1};function xe(e,t){t===void 0&&(t=Kn);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:f}=B(e).getComputedStyle(e);u&&(n=Jn(n,u,f))}const{top:r,left:o,width:i,height:a,bottom:s,right:l}=n;return{top:r,left:o,width:i,height:a,bottom:s,right:l}}function zt(e){return xe(e,{ignoreTransform:!0})}function _n(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Qn(e,t){return t===void 0&&(t=B(e).getComputedStyle(e)),t.position==="fixed"}function Zn(e,t){t===void 0&&(t=B(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const i=t[o];return typeof i=="string"?n.test(i):!1})}function nt(e,t){const n=[];function r(o){if(t!=null&&n.length>=t||!o)return n;if(mt(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!Be(o)||Vt(o)||n.includes(o))return n;const i=B(e).getComputedStyle(o);return o!==e&&Zn(o,i)&&n.push(o),Qn(o,i)?n:r(o.parentNode)}return e?r(e):n}function Zt(e){const[t]=nt(e,1);return t??null}function lt(e){return!tt||!e?null:me(e)?e:wt(e)?mt(e)||e===ye(e).scrollingElement?window:Be(e)?e:null:null}function en(e){return me(e)?e.scrollX:e.scrollLeft}function tn(e){return me(e)?e.scrollY:e.scrollTop}function vt(e){return{x:en(e),y:tn(e)}}var N;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(N||(N={}));function nn(e){return!tt||!e?!1:e===document.scrollingElement}function rn(e){const t={x:0,y:0},n=nn(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},o=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,a=e.scrollTop>=r.y,s=e.scrollLeft>=r.x;return{isTop:o,isLeft:i,isBottom:a,isRight:s,maxScroll:r,minScroll:t}}const er={x:.2,y:.2};function tr(e,t,n,r,o){let{top:i,left:a,right:s,bottom:l}=n;r===void 0&&(r=10),o===void 0&&(o=er);const{isTop:u,isBottom:f,isLeft:d,isRight:h}=rn(e),g={x:0,y:0},C={x:0,y:0},v={height:t.height*o.y,width:t.width*o.x};return!u&&i<=t.top+v.height?(g.y=N.Backward,C.y=r*Math.abs((t.top+v.height-i)/v.height)):!f&&l>=t.bottom-v.height&&(g.y=N.Forward,C.y=r*Math.abs((t.bottom-v.height-l)/v.height)),!h&&s>=t.right-v.width?(g.x=N.Forward,C.x=r*Math.abs((t.right-v.width-s)/v.width)):!d&&a<=t.left+v.width&&(g.x=N.Backward,C.x=r*Math.abs((t.left+v.width-a)/v.width)),{direction:g,speed:C}}function nr(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:a}=window;return{top:0,left:0,right:i,bottom:a,width:i,height:a}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function on(e){return e.reduce((t,n)=>we(t,vt(n)),q)}function rr(e){return e.reduce((t,n)=>t+en(n),0)}function or(e){return e.reduce((t,n)=>t+tn(n),0)}function ir(e,t){if(t===void 0&&(t=xe),!e)return;const{top:n,left:r,bottom:o,right:i}=t(e);Zt(e)&&(o<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const sr=[["x",["left","right"],rr],["y",["top","bottom"],or]];class Dt{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=nt(n),o=on(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,a,s]of sr)for(const l of a)Object.defineProperty(this,l,{get:()=>{const u=s(r),f=o[i]-u;return this.rect[l]+f},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Te{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function ar(e){const{EventTarget:t}=B(e);return e instanceof t?e:ye(e)}function ut(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var W;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(W||(W={}));function Pt(e){e.preventDefault()}function cr(e){e.stopPropagation()}var w;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(w||(w={}));const sn={start:[w.Space,w.Enter],cancel:[w.Esc],end:[w.Space,w.Enter,w.Tab]},lr=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case w.Right:return{...n,x:n.x+25};case w.Left:return{...n,x:n.x-25};case w.Down:return{...n,y:n.y+25};case w.Up:return{...n,y:n.y-25}}};class an{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Te(ye(n)),this.windowListeners=new Te(B(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(W.Resize,this.handleCancel),this.windowListeners.add(W.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(W.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&ir(r),n(q)}handleKeyDown(t){if(xt(t)){const{active:n,context:r,options:o}=this.props,{keyboardCodes:i=sn,coordinateGetter:a=lr,scrollBehavior:s="smooth"}=o,{code:l}=t;if(i.end.includes(l)){this.handleEnd(t);return}if(i.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:u}=r.current,f=u?{x:u.left,y:u.top}:q;this.referenceCoordinates||(this.referenceCoordinates=f);const d=a(t,{active:n,context:r.current,currentCoordinates:f});if(d){const h=ze(d,f),g={x:0,y:0},{scrollableAncestors:C}=r.current;for(const v of C){const p=t.code,{isTop:m,isRight:y,isLeft:b,isBottom:S,maxScroll:R,minScroll:E}=rn(v),x=nr(v),D={x:Math.min(p===w.Right?x.right-x.width/2:x.right,Math.max(p===w.Right?x.left:x.left+x.width/2,d.x)),y:Math.min(p===w.Down?x.bottom-x.height/2:x.bottom,Math.max(p===w.Down?x.top:x.top+x.height/2,d.y))},A=p===w.Right&&!y||p===w.Left&&!b,T=p===w.Down&&!S||p===w.Up&&!m;if(A&&D.x!==d.x){const M=v.scrollLeft+h.x,H=p===w.Right&&M<=R.x||p===w.Left&&M>=E.x;if(H&&!h.y){v.scrollTo({left:M,behavior:s});return}H?g.x=v.scrollLeft-M:g.x=p===w.Right?v.scrollLeft-R.x:v.scrollLeft-E.x,g.x&&v.scrollBy({left:-g.x,behavior:s});break}else if(T&&D.y!==d.y){const M=v.scrollTop+h.y,H=p===w.Down&&M<=R.y||p===w.Up&&M>=E.y;if(H&&!h.x){v.scrollTo({top:M,behavior:s});return}H?g.y=v.scrollTop-M:g.y=p===w.Down?v.scrollTop-R.y:v.scrollTop-E.y,g.y&&v.scrollBy({top:-g.y,behavior:s});break}}this.handleMove(t,we(ze(d,this.referenceCoordinates),g))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}an.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=sn,onActivation:o}=t,{active:i}=n;const{code:a}=e.nativeEvent;if(r.start.includes(a)){const s=i.activatorNode.current;return s&&e.target!==s?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function Bt(e){return!!(e&&"distance"in e)}function Ft(e){return!!(e&&"delay"in e)}class Ct{constructor(t,n,r){var o;r===void 0&&(r=ar(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:i}=t,{target:a}=i;this.props=t,this.events=n,this.document=ye(a),this.documentListeners=new Te(this.document),this.listeners=new Te(r),this.windowListeners=new Te(B(a)),this.initialCoordinates=(o=gt(i))!=null?o:q,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(W.Resize,this.handleCancel),this.windowListeners.add(W.DragStart,Pt),this.windowListeners.add(W.VisibilityChange,this.handleCancel),this.windowListeners.add(W.ContextMenu,Pt),this.documentListeners.add(W.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Ft(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Bt(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:o}=this.props;o(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(W.Click,cr,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(W.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:o,props:i}=this,{onMove:a,options:{activationConstraint:s}}=i;if(!o)return;const l=(n=gt(t))!=null?n:q,u=ze(o,l);if(!r&&s){if(Bt(s)){if(s.tolerance!=null&&ut(u,s.tolerance))return this.handleCancel();if(ut(u,s.distance))return this.handleStart()}if(Ft(s)&&ut(u,s.tolerance))return this.handleCancel();this.handlePending(s,u);return}t.cancelable&&t.preventDefault(),a(l)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===w.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const ur={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class cn extends Ct{constructor(t){const{event:n}=t,r=ye(n.target);super(t,ur,r)}}cn.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const dr={move:{name:"mousemove"},end:{name:"mouseup"}};var pt;(function(e){e[e.RightClick=2]="RightClick"})(pt||(pt={}));class fr extends Ct{constructor(t){super(t,dr,ye(t.event.target))}}fr.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===pt.RightClick?!1:(r?.({event:n}),!0)}}];const dt={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class hr extends Ct{constructor(t){super(t,dt)}static setup(){return window.addEventListener(dt.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(dt.move.name,t)};function t(){}}}hr.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:o}=n;return o.length>1?!1:(r?.({event:n}),!0)}}];var Ne;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Ne||(Ne={}));var Ze;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Ze||(Ze={}));function gr(e){let{acceleration:t,activator:n=Ne.Pointer,canScroll:r,draggingRect:o,enabled:i,interval:a=5,order:s=Ze.TreeOrder,pointerCoordinates:l,scrollableAncestors:u,scrollableAncestorRects:f,delta:d,threshold:h}=e;const g=pr({delta:d,disabled:!i}),[C,v]=Mn(),p=c.useRef({x:0,y:0}),m=c.useRef({x:0,y:0}),y=c.useMemo(()=>{switch(n){case Ne.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Ne.DraggableRect:return o}},[n,o,l]),b=c.useRef(null),S=c.useCallback(()=>{const E=b.current;if(!E)return;const x=p.current.x*m.current.x,D=p.current.y*m.current.y;E.scrollBy(x,D)},[]),R=c.useMemo(()=>s===Ze.TreeOrder?[...u].reverse():u,[s,u]);c.useEffect(()=>{if(!i||!u.length||!y){v();return}for(const E of R){if(r?.(E)===!1)continue;const x=u.indexOf(E),D=f[x];if(!D)continue;const{direction:A,speed:T}=tr(E,D,y,t,h);for(const M of["x","y"])g[M][A[M]]||(T[M]=0,A[M]=0);if(T.x>0||T.y>0){v(),b.current=E,C(S,a),p.current=T,m.current=A;return}}p.current={x:0,y:0},m.current={x:0,y:0},v()},[t,S,r,v,i,a,JSON.stringify(y),JSON.stringify(g),C,u,R,f,JSON.stringify(h)])}const vr={x:{[N.Backward]:!1,[N.Forward]:!1},y:{[N.Backward]:!1,[N.Forward]:!1}};function pr(e){let{delta:t,disabled:n}=e;const r=ht(t);return Fe(o=>{if(n||!r||!o)return vr;const i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[N.Backward]:o.x[N.Backward]||i.x===-1,[N.Forward]:o.x[N.Forward]||i.x===1},y:{[N.Backward]:o.y[N.Backward]||i.y===-1,[N.Forward]:o.y[N.Forward]||i.y===1}}},[n,t,r])}function br(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return Fe(o=>{var i;return t==null?null:(i=r??o)!=null?i:null},[r,t])}function wr(e,t){return c.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,i=o.activators.map(a=>({eventName:a.eventName,handler:t(a.handler,r)}));return[...n,...i]},[]),[e,t])}var Pe;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Pe||(Pe={}));var bt;(function(e){e.Optimized="optimized"})(bt||(bt={}));const $t=new Map;function mr(e,t){let{dragging:n,dependencies:r,config:o}=t;const[i,a]=c.useState(null),{frequency:s,measure:l,strategy:u}=o,f=c.useRef(e),d=p(),h=ke(d),g=c.useCallback(function(m){m===void 0&&(m=[]),!h.current&&a(y=>y===null?m:y.concat(m.filter(b=>!y.includes(b))))},[h]),C=c.useRef(null),v=Fe(m=>{if(d&&!n)return $t;if(!m||m===$t||f.current!==e||i!=null){const y=new Map;for(let b of e){if(!b)continue;if(i&&i.length>0&&!i.includes(b.id)&&b.rect.current){y.set(b.id,b.rect.current);continue}const S=b.node.current,R=S?new Dt(l(S),S):null;b.rect.current=R,R&&y.set(b.id,R)}return y}return m},[e,i,n,d,l]);return c.useEffect(()=>{f.current=e},[e]),c.useEffect(()=>{d||g()},[n,d]),c.useEffect(()=>{i&&i.length>0&&a(null)},[JSON.stringify(i)]),c.useEffect(()=>{d||typeof s!="number"||C.current!==null||(C.current=setTimeout(()=>{g(),C.current=null},s))},[s,d,g,...r]),{droppableRects:v,measureDroppableContainers:g,measuringScheduled:i!=null};function p(){switch(u){case Pe.Always:return!1;case Pe.BeforeDragging:return n;default:return!n}}}function ln(e,t){return Fe(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function yr(e,t){return ln(e,t)}function xr(e){let{callback:t,disabled:n}=e;const r=yt(t),o=c.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return c.useEffect(()=>()=>o?.disconnect(),[o]),o}function rt(e){let{callback:t,disabled:n}=e;const r=yt(t),o=c.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return c.useEffect(()=>()=>o?.disconnect(),[o]),o}function Dr(e){return new Dt(xe(e),e)}function Xt(e,t,n){t===void 0&&(t=Dr);const[r,o]=c.useState(null);function i(){o(l=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=l??n)!=null?u:null}const f=t(e);return JSON.stringify(l)===JSON.stringify(f)?l:f})}const a=xr({callback(l){if(e)for(const u of l){const{type:f,target:d}=u;if(f==="childList"&&d instanceof HTMLElement&&d.contains(e)){i();break}}}}),s=rt({callback:i});return Q(()=>{i(),e?(s?.observe(e),a?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),a?.disconnect())},[e]),r}function Cr(e){const t=ln(e);return Qt(e,t)}const Yt=[];function Sr(e){const t=c.useRef(e),n=Fe(r=>e?r&&r!==Yt&&e&&t.current&&e.parentNode===t.current.parentNode?r:nt(e):Yt,[e]);return c.useEffect(()=>{t.current=e},[e]),n}function Rr(e){const[t,n]=c.useState(null),r=c.useRef(e),o=c.useCallback(i=>{const a=lt(i.target);a&&n(s=>s?(s.set(a,vt(a)),new Map(s)):null)},[]);return c.useEffect(()=>{const i=r.current;if(e!==i){a(i);const s=e.map(l=>{const u=lt(l);return u?(u.addEventListener("scroll",o,{passive:!0}),[u,vt(u)]):null}).filter(l=>l!=null);n(s.length?new Map(s):null),r.current=e}return()=>{a(e),a(i)};function a(s){s.forEach(l=>{const u=lt(l);u?.removeEventListener("scroll",o)})}},[o,e]),c.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,a)=>we(i,a),q):on(e):q,[e,t])}function jt(e,t){t===void 0&&(t=[]);const n=c.useRef(null);return c.useEffect(()=>{n.current=null},t),c.useEffect(()=>{const r=e!==q;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?ze(e,n.current):q}function Er(e){c.useEffect(()=>{if(!tt)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function Ir(e,t){return c.useMemo(()=>e.reduce((n,r)=>{let{eventName:o,handler:i}=r;return n[o]=a=>{i(a,t)},n},{}),[e,t])}function un(e){return c.useMemo(()=>e?_n(e):null,[e])}const Ut=[];function Mr(e,t){t===void 0&&(t=xe);const[n]=e,r=un(n?B(n):null),[o,i]=c.useState(Ut);function a(){i(()=>e.length?e.map(l=>nn(l)?r:new Dt(t(l),l)):Ut)}const s=rt({callback:a});return Q(()=>{s?.disconnect(),a(),e.forEach(l=>s?.observe(l))},[e]),o}function Ar(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Be(t)?t:e}function Or(e){let{measure:t}=e;const[n,r]=c.useState(null),o=c.useCallback(u=>{for(const{target:f}of u)if(Be(f)){r(d=>{const h=t(f);return d?{...d,width:h.width,height:h.height}:h});break}},[t]),i=rt({callback:o}),a=c.useCallback(u=>{const f=Ar(u);i?.disconnect(),f&&i?.observe(f),r(f?t(f):null)},[t,i]),[s,l]=Ke(a);return c.useMemo(()=>({nodeRef:s,rect:n,setRef:l}),[n,s,l])}const Tr=[{sensor:cn,options:{}},{sensor:an,options:{}}],Nr={current:{}},Je={draggable:{measure:zt},droppable:{measure:zt,strategy:Pe.WhileDragging,frequency:bt.Optimized},dragOverlay:{measure:xe}};class Le extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const Lr={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Le,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Qe},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Je,measureDroppableContainers:Qe,windowRect:null,measuringScheduled:!1},kr={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Qe,draggableNodes:new Map,over:null,measureDroppableContainers:Qe},ot=c.createContext(kr),dn=c.createContext(Lr);function zr(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Le}}}function Pr(e,t){switch(t.type){case O.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case O.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case O.DragEnd:case O.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case O.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new Le(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case O.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const a=new Le(e.droppable.containers);return a.set(n,{...i,disabled:o}),{...e,droppable:{...e.droppable,containers:a}}}case O.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const i=new Le(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function Br(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:o}=c.useContext(ot),i=ht(r),a=ht(n?.id);return c.useEffect(()=>{if(!t&&!r&&i&&a!=null){if(!xt(i)||document.activeElement===i.target)return;const s=o.get(a);if(!s)return;const{activatorNode:l,node:u}=s;if(!l.current&&!u.current)return;requestAnimationFrame(()=>{for(const f of[l.current,u.current]){if(!f)continue;const d=Tn(f);if(d){d.focus();break}}})}},[r,t,o,a,i]),null}function Fr(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((o,i)=>i({transform:o,...r}),n):n}function $r(e){return c.useMemo(()=>({draggable:{...Je.draggable,...e?.draggable},droppable:{...Je.droppable,...e?.droppable},dragOverlay:{...Je.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Xr(e){let{activeNode:t,measure:n,initialRect:r,config:o=!0}=e;const i=c.useRef(!1),{x:a,y:s}=typeof o=="boolean"?{x:o,y:o}:o;Q(()=>{if(!a&&!s||!t){i.current=!1;return}if(i.current||!r)return;const u=t?.node.current;if(!u||u.isConnected===!1)return;const f=n(u),d=Qt(f,r);if(a||(d.x=0),s||(d.y=0),i.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const h=Zt(u);h&&h.scrollBy({top:d.y,left:d.x})}},[t,a,s,r,n])}const fn=c.createContext({...q,scaleX:1,scaleY:1});var ue;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(ue||(ue={}));const go=c.memo(function(t){var n,r,o,i;let{id:a,accessibility:s,autoScroll:l=!0,children:u,sensors:f=Tr,collisionDetection:d=Wn,measuring:h,modifiers:g,...C}=t;const v=c.useReducer(Pr,void 0,zr),[p,m]=v,[y,b]=Bn(),[S,R]=c.useState(ue.Uninitialized),E=S===ue.Initialized,{draggable:{active:x,nodes:D,translate:A},droppable:{containers:T}}=p,M=x!=null?D.get(x):null,H=c.useRef({initial:null,translated:null}),V=c.useMemo(()=>{var k;return x!=null?{id:x,data:(k=M?.data)!=null?k:Nr,rect:H}:null},[x,M]),G=c.useRef(null),[De,Xe]=c.useState(null),[F,Ye]=c.useState(null),Z=ke(C,Object.values(C)),Ce=$e("DndDescribedBy",a),je=c.useMemo(()=>T.getEnabled(),[T]),z=$r(h),{droppableRects:ee,measureDroppableContainers:de,measuringScheduled:Se}=mr(je,{dragging:E,dependencies:[A.x,A.y],config:z.droppable}),j=br(D,x),Ue=c.useMemo(()=>F?gt(F):null,[F]),oe=En(),te=yr(j,z.draggable.measure);Xr({activeNode:x!=null?D.get(x):null,config:oe.layoutShiftCompensation,initialRect:te,measure:z.draggable.measure});const I=Xt(j,z.draggable.measure,te),Re=Xt(j?j.parentElement:null),J=c.useRef({activatorEvent:null,active:null,activeNode:j,collisionRect:null,collisions:null,droppableRects:ee,draggableNodes:D,draggingNode:null,draggingNodeRect:null,droppableContainers:T,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),fe=T.getNodeFor((n=J.current.over)==null?void 0:n.id),ne=Or({measure:z.dragOverlay.measure}),he=(r=ne.nodeRef.current)!=null?r:j,ge=E?(o=ne.rect)!=null?o:I:null,St=!!(ne.nodeRef.current&&ne.rect),Rt=Cr(St?null:I),it=un(he?B(he):null),ie=Sr(E?fe??j:null),We=Mr(ie),He=Fr(g,{transform:{x:A.x-Rt.x,y:A.y-Rt.y,scaleX:1,scaleY:1},activatorEvent:F,active:V,activeNodeRect:I,containerNodeRect:Re,draggingNodeRect:ge,over:J.current.over,overlayNodeRect:ne.rect,scrollableAncestors:ie,scrollableAncestorRects:We,windowRect:it}),Et=Ue?we(Ue,A):null,It=Rr(ie),mn=jt(It),yn=jt(It,[I]),ve=we(He,mn),pe=ge?qn(ge,He):null,Ee=V&&pe?d({active:V,collisionRect:pe,droppableRects:ee,droppableContainers:je,pointerCoordinates:Et}):null,Mt=_t(Ee,"id"),[se,At]=c.useState(null),xn=St?He:we(He,yn),Dn=Hn(xn,(i=se?.rect)!=null?i:null,I),st=c.useRef(null),Ot=c.useCallback((k,$)=>{let{sensor:X,options:ae}=$;if(G.current==null)return;const U=D.get(G.current);if(!U)return;const Y=k.nativeEvent,K=new X({active:G.current,activeNode:U,event:Y,options:ae,context:J,onAbort(L){if(!D.get(L))return;const{onDragAbort:_}=Z.current,re={id:L};_?.(re),y({type:"onDragAbort",event:re})},onPending(L,ce,_,re){if(!D.get(L))return;const{onDragPending:Me}=Z.current,le={id:L,constraint:ce,initialCoordinates:_,offset:re};Me?.(le),y({type:"onDragPending",event:le})},onStart(L){const ce=G.current;if(ce==null)return;const _=D.get(ce);if(!_)return;const{onDragStart:re}=Z.current,Ie={activatorEvent:Y,active:{id:ce,data:_.data,rect:H}};Oe.unstable_batchedUpdates(()=>{re?.(Ie),R(ue.Initializing),m({type:O.DragStart,initialCoordinates:L,active:ce}),y({type:"onDragStart",event:Ie}),Xe(st.current),Ye(Y)})},onMove(L){m({type:O.DragMove,coordinates:L})},onEnd:be(O.DragEnd),onCancel:be(O.DragCancel)});st.current=K;function be(L){return async function(){const{active:_,collisions:re,over:Ie,scrollAdjustedTranslate:Me}=J.current;let le=null;if(_&&Me){const{cancelDrop:Ae}=Z.current;le={activatorEvent:Y,active:_,collisions:re,delta:Me,over:Ie},L===O.DragEnd&&typeof Ae=="function"&&await Promise.resolve(Ae(le))&&(L=O.DragCancel)}G.current=null,Oe.unstable_batchedUpdates(()=>{m({type:L}),R(ue.Uninitialized),At(null),Xe(null),Ye(null),st.current=null;const Ae=L===O.DragEnd?"onDragEnd":"onDragCancel";if(le){const at=Z.current[Ae];at?.(le),y({type:Ae,event:le})}})}}},[D]),Cn=c.useCallback((k,$)=>(X,ae)=>{const U=X.nativeEvent,Y=D.get(ae);if(G.current!==null||!Y||U.dndKit||U.defaultPrevented)return;const K={active:Y};k(X,$.options,K)===!0&&(U.dndKit={capturedBy:$.sensor},G.current=ae,Ot(X,$))},[D,Ot]),Tt=wr(f,Cn);Er(f),Q(()=>{I&&S===ue.Initializing&&R(ue.Initialized)},[I,S]),c.useEffect(()=>{const{onDragMove:k}=Z.current,{active:$,activatorEvent:X,collisions:ae,over:U}=J.current;if(!$||!X)return;const Y={active:$,activatorEvent:X,collisions:ae,delta:{x:ve.x,y:ve.y},over:U};Oe.unstable_batchedUpdates(()=>{k?.(Y),y({type:"onDragMove",event:Y})})},[ve.x,ve.y]),c.useEffect(()=>{const{active:k,activatorEvent:$,collisions:X,droppableContainers:ae,scrollAdjustedTranslate:U}=J.current;if(!k||G.current==null||!$||!U)return;const{onDragOver:Y}=Z.current,K=ae.get(Mt),be=K&&K.rect.current?{id:K.id,rect:K.rect.current,data:K.data,disabled:K.disabled}:null,L={active:k,activatorEvent:$,collisions:X,delta:{x:U.x,y:U.y},over:be};Oe.unstable_batchedUpdates(()=>{At(be),Y?.(L),y({type:"onDragOver",event:L})})},[Mt]),Q(()=>{J.current={activatorEvent:F,active:V,activeNode:j,collisionRect:pe,collisions:Ee,droppableRects:ee,draggableNodes:D,draggingNode:he,draggingNodeRect:ge,droppableContainers:T,over:se,scrollableAncestors:ie,scrollAdjustedTranslate:ve},H.current={initial:ge,translated:pe}},[V,j,Ee,pe,D,he,ge,ee,T,se,ie,ve]),gr({...oe,delta:A,draggingRect:pe,pointerCoordinates:Et,scrollableAncestors:ie,scrollableAncestorRects:We});const Sn=c.useMemo(()=>({active:V,activeNode:j,activeNodeRect:I,activatorEvent:F,collisions:Ee,containerNodeRect:Re,dragOverlay:ne,draggableNodes:D,droppableContainers:T,droppableRects:ee,over:se,measureDroppableContainers:de,scrollableAncestors:ie,scrollableAncestorRects:We,measuringConfiguration:z,measuringScheduled:Se,windowRect:it}),[V,j,I,F,Ee,Re,ne,D,T,ee,se,de,ie,We,z,Se,it]),Rn=c.useMemo(()=>({activatorEvent:F,activators:Tt,active:V,activeNodeRect:I,ariaDescribedById:{draggable:Ce},dispatch:m,draggableNodes:D,over:se,measureDroppableContainers:de}),[F,Tt,V,I,m,Ce,D,se,de]);return P.createElement(Gt.Provider,{value:b},P.createElement(ot.Provider,{value:Rn},P.createElement(dn.Provider,{value:Sn},P.createElement(fn.Provider,{value:Dn},u)),P.createElement(Br,{disabled:s?.restoreFocus===!1})),P.createElement(Xn,{...s,hiddenTextDescribedById:Ce}));function En(){const k=De?.autoScrollEnabled===!1,$=typeof l=="object"?l.enabled===!1:l===!1,X=E&&!k&&!$;return typeof l=="object"?{...l,enabled:X}:{enabled:X}}}),Yr=c.createContext(null),Wt="button",jr="Draggable";function Ur(e){let{id:t,data:n,disabled:r=!1,attributes:o}=e;const i=$e(jr),{activators:a,activatorEvent:s,active:l,activeNodeRect:u,ariaDescribedById:f,draggableNodes:d,over:h}=c.useContext(ot),{role:g=Wt,roleDescription:C="draggable",tabIndex:v=0}=o??{},p=l?.id===t,m=c.useContext(p?fn:Yr),[y,b]=Ke(),[S,R]=Ke(),E=Ir(a,t),x=ke(n);Q(()=>(d.set(t,{id:t,key:i,node:y,activatorNode:S,data:x}),()=>{const A=d.get(t);A&&A.key===i&&d.delete(t)}),[d,t]);const D=c.useMemo(()=>({role:g,tabIndex:v,"aria-disabled":r,"aria-pressed":p&&g===Wt?!0:void 0,"aria-roledescription":C,"aria-describedby":f.draggable}),[r,g,v,p,C,f.draggable]);return{active:l,activatorEvent:s,activeNodeRect:u,attributes:D,isDragging:p,listeners:r?void 0:E,node:y,over:h,setNodeRef:b,setActivatorNodeRef:R,transform:m}}function Wr(){return c.useContext(dn)}const Hr="Droppable",Vr={timeout:25};function qr(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:o}=e;const i=$e(Hr),{active:a,dispatch:s,over:l,measureDroppableContainers:u}=c.useContext(ot),f=c.useRef({disabled:n}),d=c.useRef(!1),h=c.useRef(null),g=c.useRef(null),{disabled:C,updateMeasurementsFor:v,timeout:p}={...Vr,...o},m=ke(v??r),y=c.useCallback(()=>{if(!d.current){d.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{u(Array.isArray(m.current)?m.current:[m.current]),g.current=null},p)},[p]),b=rt({callback:y,disabled:C||!a}),S=c.useCallback((D,A)=>{b&&(A&&(b.unobserve(A),d.current=!1),D&&b.observe(D))},[b]),[R,E]=Ke(S),x=ke(t);return c.useEffect(()=>{!b||!R.current||(b.disconnect(),d.current=!1,b.observe(R.current))},[R,b]),c.useEffect(()=>(s({type:O.RegisterDroppable,element:{id:r,key:i,disabled:n,node:R,rect:h,data:x}}),()=>s({type:O.UnregisterDroppable,key:i,id:r})),[r]),c.useEffect(()=>{n!==f.current.disabled&&(s({type:O.SetDroppableDisabled,id:r,key:i,disabled:n}),f.current.disabled=n)},[r,i,n,s]),{active:a,rect:h,isOver:l?.id===r,node:R,over:l,setNodeRef:E}}function hn(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Gr(e,t){return e.reduce((n,r,o)=>{const i=t.get(r);return i&&(n[o]=i),n},Array(e.length))}function Ve(e){return e!==null&&e>=0}function Jr(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Kr(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const qe={scaleX:1,scaleY:1},vo=e=>{var t;let{rects:n,activeNodeRect:r,activeIndex:o,overIndex:i,index:a}=e;const s=(t=n[o])!=null?t:r;if(!s)return null;const l=_r(n,a,o);if(a===o){const u=n[i];return u?{x:o<i?u.left+u.width-(s.left+s.width):u.left-s.left,y:0,...qe}:null}return a>o&&a<=i?{x:-s.width-l,y:0,...qe}:a<o&&a>=i?{x:s.width+l,y:0,...qe}:{x:0,y:0,...qe}};function _r(e,t,n){const r=e[t],o=e[t-1],i=e[t+1];return!r||!o&&!i?0:n<t?o?r.left-(o.left+o.width):i.left-(r.left+r.width):i?i.left-(r.left+r.width):r.left-(o.left+o.width)}const gn=e=>{let{rects:t,activeIndex:n,overIndex:r,index:o}=e;const i=hn(t,r,n),a=t[o],s=i[o];return!s||!a?null:{x:s.left-a.left,y:s.top-a.top,scaleX:s.width/a.width,scaleY:s.height/a.height}},Ge={scaleX:1,scaleY:1},po=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:o,rects:i,overIndex:a}=e;const s=(t=i[n])!=null?t:r;if(!s)return null;if(o===n){const u=i[a];return u?{x:0,y:n<a?u.top+u.height-(s.top+s.height):u.top-s.top,...Ge}:null}const l=Qr(i,o,n);return o>n&&o<=a?{x:0,y:-s.height-l,...Ge}:o<n&&o>=a?{x:0,y:s.height+l,...Ge}:{x:0,y:0,...Ge}};function Qr(e,t,n){const r=e[t],o=e[t-1],i=e[t+1];return r?n<t?o?r.top-(o.top+o.height):i?i.top-(r.top+r.height):0:i?i.top-(r.top+r.height):o?r.top-(o.top+o.height):0:0}const vn="Sortable",pn=P.createContext({activeIndex:-1,containerId:vn,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:gn,disabled:{draggable:!1,droppable:!1}});function bo(e){let{children:t,id:n,items:r,strategy:o=gn,disabled:i=!1}=e;const{active:a,dragOverlay:s,droppableRects:l,over:u,measureDroppableContainers:f}=Wr(),d=$e(vn,n),h=s.rect!==null,g=c.useMemo(()=>r.map(E=>typeof E=="object"&&"id"in E?E.id:E),[r]),C=a!=null,v=a?g.indexOf(a.id):-1,p=u?g.indexOf(u.id):-1,m=c.useRef(g),y=!Jr(g,m.current),b=p!==-1&&v===-1||y,S=Kr(i);Q(()=>{y&&C&&f(g)},[y,g,C,f]),c.useEffect(()=>{m.current=g},[g]);const R=c.useMemo(()=>({activeIndex:v,containerId:d,disabled:S,disableTransforms:b,items:g,overIndex:p,useDragOverlay:h,sortedRects:Gr(g,l),strategy:o}),[v,d,S.draggable,S.droppable,b,g,p,l,h,o]);return P.createElement(pn.Provider,{value:R},t)}const Zr=e=>{let{id:t,items:n,activeIndex:r,overIndex:o}=e;return hn(n,r,o).indexOf(t)},eo=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:o,items:i,newIndex:a,previousItems:s,previousContainerId:l,transition:u}=e;return!u||!r||s!==i&&o===a?!1:n?!0:a!==o&&t===l},to={duration:200,easing:"ease"},bn="transform",no=_e.Transition.toString({property:bn,duration:0,easing:"linear"}),ro={roleDescription:"sortable"};function oo(e){let{disabled:t,index:n,node:r,rect:o}=e;const[i,a]=c.useState(null),s=c.useRef(n);return Q(()=>{if(!t&&n!==s.current&&r.current){const l=o.current;if(l){const u=xe(r.current,{ignoreTransform:!0}),f={x:l.left-u.left,y:l.top-u.top,scaleX:l.width/u.width,scaleY:l.height/u.height};(f.x||f.y)&&a(f)}}n!==s.current&&(s.current=n)},[t,n,r,o]),c.useEffect(()=>{i&&a(null)},[i]),i}function wo(e){let{animateLayoutChanges:t=eo,attributes:n,disabled:r,data:o,getNewIndex:i=Zr,id:a,strategy:s,resizeObserverConfig:l,transition:u=to}=e;const{items:f,containerId:d,activeIndex:h,disabled:g,disableTransforms:C,sortedRects:v,overIndex:p,useDragOverlay:m,strategy:y}=c.useContext(pn),b=io(r,g),S=f.indexOf(a),R=c.useMemo(()=>({sortable:{containerId:d,index:S,items:f},...o}),[d,o,S,f]),E=c.useMemo(()=>f.slice(f.indexOf(a)),[f,a]),{rect:x,node:D,isOver:A,setNodeRef:T}=qr({id:a,data:R,disabled:b.droppable,resizeObserverConfig:{updateMeasurementsFor:E,...l}}),{active:M,activatorEvent:H,activeNodeRect:V,attributes:G,setNodeRef:De,listeners:Xe,isDragging:F,over:Ye,setActivatorNodeRef:Z,transform:Ce}=Ur({id:a,data:R,attributes:{...ro,...n},disabled:b.draggable}),je=In(T,De),z=!!M,ee=z&&!C&&Ve(h)&&Ve(p),de=!m&&F,Se=de&&ee?Ce:null,Ue=ee?Se??(s??y)({rects:v,activeNodeRect:V,activeIndex:h,overIndex:p,index:S}):null,oe=Ve(h)&&Ve(p)?i({id:a,items:f,activeIndex:h,overIndex:p}):S,te=M?.id,I=c.useRef({activeId:te,items:f,newIndex:oe,containerId:d}),Re=f!==I.current.items,J=t({active:M,containerId:d,isDragging:F,isSorting:z,id:a,index:S,items:f,newIndex:I.current.newIndex,previousItems:I.current.items,previousContainerId:I.current.containerId,transition:u,wasDragging:I.current.activeId!=null}),fe=oo({disabled:!J,index:S,node:D,rect:x});return c.useEffect(()=>{z&&I.current.newIndex!==oe&&(I.current.newIndex=oe),d!==I.current.containerId&&(I.current.containerId=d),f!==I.current.items&&(I.current.items=f)},[z,oe,d,f]),c.useEffect(()=>{if(te===I.current.activeId)return;if(te&&!I.current.activeId){I.current.activeId=te;return}const he=setTimeout(()=>{I.current.activeId=te},50);return()=>clearTimeout(he)},[te]),{active:M,activeIndex:h,attributes:G,data:R,rect:x,index:S,newIndex:oe,items:f,isOver:A,isSorting:z,isDragging:F,listeners:Xe,node:D,overIndex:p,over:Ye,setNodeRef:je,setActivatorNodeRef:Z,setDroppableNodeRef:T,setDraggableNodeRef:De,transform:fe??Ue,transition:ne()};function ne(){if(fe||Re&&I.current.newIndex===S)return no;if(!(de&&!xt(H)||!u)&&(z||J))return _e.Transition.toString({...u,property:bn})}}function io(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e?.draggable)!=null?n:t.draggable,droppable:(r=e?.droppable)!=null?r:t.droppable}}function et(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const so=[w.Down,w.Right,w.Up,w.Left],mo=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:o,droppableContainers:i,over:a,scrollableAncestors:s}}=t;if(so.includes(e.code)){if(e.preventDefault(),!n||!r)return;const l=[];i.getEnabled().forEach(d=>{if(!d||d!=null&&d.disabled)return;const h=o.get(d.id);if(h)switch(e.code){case w.Down:r.top<h.top&&l.push(d);break;case w.Up:r.top>h.top&&l.push(d);break;case w.Left:r.left>h.left&&l.push(d);break;case w.Right:r.left<h.left&&l.push(d);break}});const u=jn({collisionRect:r,droppableRects:o,droppableContainers:l});let f=_t(u,"id");if(f===a?.id&&u.length>1&&(f=u[1].id),f!=null){const d=i.get(n.id),h=i.get(f),g=h?o.get(h.id):null,C=h?.node.current;if(C&&g&&d&&h){const p=nt(C).some((E,x)=>s[x]!==E),m=wn(d,h),y=ao(d,h),b=p||!m?{x:0,y:0}:{x:y?r.width-g.width:0,y:y?r.height-g.height:0},S={x:g.left,y:g.top};return b.x&&b.y?S:ze(S,b)}}}};function wn(e,t){return!et(e)||!et(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function ao(e,t){return!et(e)||!et(t)||!wn(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function co(e){if(typeof window>"u")return null;try{const t=window.localStorage.getItem(e);if(!t)return null;const n=JSON.parse(t);return Array.isArray(n)?n.filter(r=>typeof r=="string"):null}catch{return null}}function ft(e,t){if(!(typeof window>"u"))try{window.localStorage.setItem(e,JSON.stringify(t))}catch{}}function Ht(e,t){if(!e)return t;const n=new Set(t),r=e.filter(i=>n.has(i)),o=t.filter(i=>!r.includes(i));return[...r,...o]}function yo(e,t){const n=c.useMemo(()=>t.join("|"),[t]),[r,o]=c.useState(()=>Ht(co(e),t));c.useEffect(()=>{o(s=>{const l=Ht(s,t);return l.length===s.length&&l.every((f,d)=>f===s[d])?s:(ft(e,l),l)})},[n,t,e]);const i=c.useCallback((s,l)=>{!s||!l||s===l||o(u=>{const f=u.indexOf(s),d=u.indexOf(l);if(f===-1||d===-1)return u;const h=u.slice(),[g]=h.splice(f,1);return h.splice(d,0,g),ft(e,h),h})},[e]),a=c.useCallback(()=>{ft(e,t),o(t)},[e,t]);return{order:r,reorder:i,reset:a}}export{_e as C,go as D,an as K,cn as P,bo as S,yo as a,fo as b,uo as c,ho as d,vo as h,mo as s,wo as u,po as v};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as o}from"./__vite-browser-external-Db9onipF.js";import{h as r,i as t,p as s}from"./react-BnaPNGj8.js";function i(){!r.current&&t();const[e]=o.useState(s.current);return e}export{i as u};
|