tokentracker-cli 0.6.2 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -519,7 +519,7 @@ dashboard.screenshot.title_line2,dashboard,DashboardPage,ScreenshotTitle,title_l
519
519
  dashboard.screenshot.twitter_button,dashboard,DashboardPage,ScreenshotShare,button_label,"Share on X",,active
520
520
  dashboard.screenshot.twitter_label,dashboard,DashboardPage,ScreenshotShare,aria_label,"Share on X",,active
521
521
  dashboard.screenshot.twitter_hint,dashboard,DashboardPage,ScreenshotShare,helper_text,"Auto-copies image to clipboard",,active
522
- dashboard.screenshot.twitter_text,dashboard,DashboardPage,ScreenshotShare,share_text,"{{total_tokens}} tokens on the record.\\n{{model_name}} led with {{model_percent}}%.\\n\\nMy AI usage, unaudited →\\ntoken.rynn.me",,active
522
+ dashboard.screenshot.twitter_text,dashboard,DashboardPage,ScreenshotShare,share_text,"{{total_tokens}} tokens on the record.\\n{{model_name}} led with {{model_percent}}%.\\n\\nMy AI usage, unaudited →\\ntokentracker.cc",,active
523
523
 
524
524
  live_sniffer.log.system,ui,LiveSniffer,LiveSniffer,log,"[SYSTEM] KERNEL_LINK_ESTABLISHED",,active
525
525
  live_sniffer.log.socket,ui,LiveSniffer,LiveSniffer,log,"[SOCKET] LISTENING_ON_LOCAL_CLI_PIPE...",,active
@@ -783,7 +783,7 @@ settings.appearance.language.hint,ui,SettingsPage,SettingsPage,language_hint,Use
783
783
  settings.appearance.language.system,ui,SettingsPage,SettingsPage,language_system,System,,active
784
784
  settings.appearance.language.english,ui,SettingsPage,SettingsPage,language_english,English,,active
785
785
  settings.appearance.language.chinese,ui,SettingsPage,SettingsPage,language_chinese,Simplified Chinese,,active
786
- `,yW={"header.auth.sign_in_aria":"登录","header.auth.user_fallback":"用户","header.cloud_sync.label":"将本地使用情况同步到云端","header.cloud_sync.hint":"运行本地 Token Tracker 同步,将用量上传到云端。关闭后仅保留本地离线使用。","login.back_home":"返回首页","login.cloud_only":"未配置云端登录。请使用 localhost 上的本地仪表盘。","login.title":"登录","login.subtitle":"选择邮箱或已连接账号。","login.dismiss":"关闭","login.verify_email_success":"邮箱已验证。你现在可以登录。","login.verify_email_pending":"请先在邮箱中完成验证,然后再登录。","login.oauth.continue":"使用 {{provider}} 继续","login.divider":"或","login.tab.sign_in":"登录","login.tab.sign_up":"创建账户","login.field.name":"显示名称","login.field.name_placeholder":"可选","login.field.email":"电子邮件","login.field.password":"密码","login.password_hint":"至少 {{min}} 个字符。","login.submit.sign_in":"使用邮箱登录","login.submit.sign_up":"创建账号","auth.callback.processing":"处理中…","auth.callback.success":"登录成功","auth.callback.redirecting":"正在返回 TokenTracker…","auth.callback.failed":"登录未完成,请重试。","auth.callback.close":"关闭此页","login_modal.subtitle":"登录以加入排行榜","login_modal.continue_email":"使用邮箱继续","login_modal.divider_email":"邮箱","shared.placeholder.short":"--","shared.placeholder.anon_mark":"?","shared.unit.percent":"%","shared.unit.thousand_abbrev":"K","shared.unit.million_abbrev":"M","shared.unit.billion_abbrev":"B","shared.button.sign_in":"$ 登录","shared.button.sign_up":"$ 注册","shared.range.simple":"范围:{{range}}","shared.data_source":"数据来源:{{source}}","shared.error.prefix":"错误:{{error}}","shared.status.unsynced":"—","shared.time.now":"刚刚","error.boundary.title":"出了点问题","error.boundary.subtitle":"这个视图渲染失败了","error.boundary.hint":"打开控制台,然后重新加载页面","error.boundary.no_details":"没有错误详细信息","error.boundary.action.reload":"重新加载","shell.header.title":"Token 用量","shell.header.link_active":"LINK_ACTIVE","shell.footer.help":"[F1]帮助","shell.footer.neural_index":"核心索引:0.942.A1","backend.meta.status_label":"状态","backend.meta.host_label":"主机","backend.meta.checked_label":"上次检查","backend.meta.ok_label":"正常","backend.meta.http_label":"http","backend.meta.error_label":"错误","backend.meta.click_refresh":"点击=刷新","status.link.stable":"链接:稳定","status.link.unstable":"链接:弱","status.link.lost":"链接:丢失","boot.ascii_art":"加载中...","boot.prompt":"正在初始化仪表板...","boot.skip_hint":"点击跳过","boot.skip_aria":"跳过启动屏幕","system.header.title_default":"VIBE_OS_v9.0","sparkline.aria_label":"每日 Token 使用迷你图","identity_card.title_default":"身份","identity_card.name_default":"你","identity_card.unknown":"未知","identity_card.decrypt":"显示身份","identity_card.rank_label":"排名","identity_card.streak_label":"活跃天数","identity_card.rank_placeholder":"—","identity_card.streak_value":"{{days}} 天","identity_card.subscriptions_label":"订阅","identity_card.subscription_item":"{{tool}} {{plan}}","identity_panel.badge":"VU","identity_panel.level":"5级","identity_panel.rank_label":"排名","identity_panel.streak_label":"活跃","identity_panel.rank_placeholder":"—","identity_panel.streak_value":"{{days}} 天","usage.panel.title":"Token 使用","usage.summary.total_system_output":"Token 总数","usage.summary.total":"Token 总数","usage.period.day":"日","usage.period.week":"周","usage.period.month":"月","usage.period.total":"总计","usage.period.custom":"自定义","usage.metric.total":"总计","usage.metric.total_cost":"总成本(美元)","usage.metric.input":"输入","usage.metric.output":"输出","usage.metric.cached_input":"缓存输入","usage.metric.reasoning_output":"推理输出","usage.metric.cached_short":"缓存","usage.metric.reasoning_short":"推理","usage.button.loading":"加载中…","usage.button.refresh":"刷新","usage.cost_info.icon":"[ 详情 ]","usage.cost_info.label":"细节","usage.range_label":"范围:{{range}}","usage.overview.tablist_aria":"时间范围","usage.overview.cost_breakdown_aria":"查看成本明细","usage.overview.distribution_aria":"来源占比:{{items}}","usage.overview.distribution_item":"{{label}} {{percent}}%","usage.overview.provider_card_aria":"{{provider}}:{{percent}}%,{{tokens}} Token,{{cost}}。点击{{action}}详情","usage.overview.expand":"展开","usage.overview.collapse":"收起","usage.overview.model_count":"{{count}} 个模型","usage.overview.model_details_aria":"{{provider}} 模型详情","widgets.page.title":"组件","widgets.page.subtitle":"把 Token 用量钉在菜单栏和桌面上。","widgets.cta.open_gallery":"打开小组件库","widgets.cta.download":"下载 Mac 应用","widgets.cta.macos_only":"仅限 macOS","widgets.hero.aria":"使用小组件预览","widgets.hero.annotation":"右键点按桌面 · 编辑小组件 · 搜索“TokenTracker”","widgets.section.more":"还包括","widgets.menubar.name":"菜单栏","widgets.menubar.description":"选择菜单栏图标旁边显示的两个实时信息位。","widgets.menubar.section.title":"菜单栏","widgets.gallery.section.title":"桌面小组件","widgets.summary.name":"使用概览","widgets.summary.description":"今天和近 7 天的用量,以及紧凑趋势线。","widgets.heatmap.name":"热力图","widgets.heatmap.description":"像 GitHub 一样,一眼看清活跃和空闲的日子。","widgets.topModels.name":"热门模型","widgets.topModels.description":"你最常用的模型,按 Token 占比排序。","widgets.limits.name":"使用限制","widgets.limits.description":"Claude、Codex、Cursor、Gemini 等的实时速率限制进度。","daily.table.aria_label":"每日总计表","daily.sort.date.label":"日期","daily.sort.date.title":"按日期排序","daily.sort.total.label":"总计","daily.sort.total.title":"按总计排序","daily.sort.input.label":"输入","daily.sort.input.title":"按输入排序","daily.sort.output.label":"输出","daily.sort.output.title":"按输出排序","daily.sort.cached.label":"缓存","daily.sort.cached.title":"按缓存输入排序","daily.sort.reasoning.label":"推理","daily.sort.reasoning.title":"按推理输出排序","daily.sort.conversations.label":"对话数","daily.sort.conversations.title":"按对话排序","details.pagination.prev":"上一页","details.pagination.next":"下一页","details.pagination.page":"页{{page}}/{{total}}","limits.copilot.otelHint.title":"跟踪 Copilot Token 使用情况","limits.copilot.otelHint.body":"限额信息通过你的 GitHub OAuth 令牌读取。如果还想记录逐 Token 用量,请启用 Copilot 的 OpenTelemetry 导出,把下面这段加到你的 shell 配置文件(~/.zshrc 或 ~/.bashrc):","limits.copilot.otelHint.copy":"复制","limits.copilot.otelHint.copied":"已复制","limits.panel.title":"使用限制","limits.label.cursor_plan":"套餐","limits.label.cursor_auto":"自动","limits.label.cursor_api":"API","limits.label.kiro_month":"月度","limits.label.kiro_bonus":"奖励","limits.label.kimi_weekly":"周","limits.label.kimi_5h":"5h","limits.label.kimi_total":"总量","limits.label.kimi_parallel":"并发:{{count}}","limits.label.copilot_premium":"高级","limits.label.copilot_chat":"对话","limits.status.not_connected":"未连接","limits.status.no_data":"未返回实时限额数据","limits.status.all_hidden":"所有限额提供商都已隐藏。请打开显示设置重新显示。","live_sniffer.log.system":"[系统]KERNEL_LINK_ESTABLISHED","live_sniffer.log.socket":"[套接字]正在监听_LOCAL_CLI_PIPE...","live_sniffer.event.intercepted":"> 拦截:AI_COMPLETION_EVENT","live_sniffer.event.quantifying":"> 量化:+64 NEURAL_TOKENS","live_sniffer.event.analysis":"> 分析:HIGH_VIBE_FLOW_DETECTED","live_sniffer.event.sync":"> 同步:上传到核心中继","live_sniffer.event.batch":"[状态] BATCH_TRANSMISSION_COMPLETE","live_sniffer.event.hooking":"> 挂钩:AI_CLI_PIPE_LINK","live_sniffer.event.capture":"> 捕获:+128 NEURAL_TOKENS","nav.usage":"用量","nav.limits":"限额","nav.widgets":"小组件","nav.skills":"Skills","nav.leaderboard":"排行榜","nav.collapse":"折叠侧边栏","nav.expand":"展开侧边栏","nav.menu":"打开导航菜单","nav.close_menu":"关闭导航菜单","nav.aside_label":"主导航","nav.nav_label":"导航","limits.page.subtitle":"AI 工具的速率限制和配额使用情况。","limits.settings.title":"显示设置","limits.settings.subtitle":"选择要显示的提供商及其顺序。","limits.settings.move_up":"向上移动","limits.settings.move_down":"下移","limits.settings.toggle_visible":"切换可见性","limits.page.openSettings":"显示设置","nav.group.general":"常规","nav.group.tools":"工具","nav.group.account":"账户","nav.settings":"设置","header.auth.open_settings":"打开设置","settings.page.title":"设置","settings.page.subtitle":"管理你的账户、外观和显示偏好。","settings.section.appearance":"外观","settings.section.account":"账户","settings.section.limits":"限制显示","settings.section.limitsSubtitle":"重新排序提供商并选择哪些出现在“限制”页面上。","settings.appearance.theme.label":"主题","settings.appearance.theme.hint":"选择 Token Tracker 在仪表盘中的显示方式。","settings.appearance.theme.light":"浅色","settings.appearance.theme.dark":"深色","settings.appearance.theme.system":"系统","settings.account.displayName":"显示名称","settings.account.edit":"编辑","settings.account.save":"保存","settings.account.saving":"保存...","settings.account.cancel":"取消","settings.account.cloudSync":"云同步","settings.account.cloudSyncHint":"将本地用量上传到你的 Token Tracker 云端账号。","settings.account.publicProfile":"公开主页","settings.account.publicProfileHint":"在公开排行榜中展示你的用量。","settings.account.anonymous":"匿名","settings.account.anonymousHint":"在排行榜中隐藏你的名字和头像。","settings.account.displayNameAnonymousHint":"匿名状态下,排行榜会隐藏你的名字和头像","settings.account.displayNameDisabledWhileAnon":"请先关闭匿名,再编辑名字","settings.account.githubUrl":"GitHub 主页","settings.account.githubUrlHint":"在排行榜名字旁显示 GitHub 链接。","settings.account.githubUrlPlaceholder":"用户名或 https://github.com/用户名","settings.account.githubUrlInvalid":"请输入 GitHub 用户名,或 https://github.com/用户名","leaderboard.github.aria":"打开 GitHub 主页","leaderboard.github.tooltipAction":"点击查看 GitHub 主页","leaderboard.github.tooltipPrefix":"可在","leaderboard.github.tooltipSettingsLink":"设置","leaderboard.github.tooltipSuffix":"中配置你的主页","settings.account.signOut":"退出登录","settings.account.signIn":"登录","settings.account.signedOutHint":"登录后可管理云同步和排行榜偏好。","settings.section.menubar":"菜单栏应用","settings.section.menubarSubtitle":"macOS 菜单栏应用的偏好设置,与右键菜单保持一致。","settings.menubar.showStats":"在菜单栏中显示统计信息","settings.menubar.showStatsHint":"在菜单栏图标旁边显示今天的Token 数量和成本。","settings.menubar.animatedIcon":"动画图标","settings.menubar.animatedIconHint":"闪烁 Clawd 角色并在菜单栏中播放同步动画。","settings.menubar.launchAtLogin":"登录时启动","settings.menubar.launchAtLoginHint":"登录 macOS 时自动启动 TokenTrackerBar。","settings.menubar.syncNow":"立即同步","settings.menubar.syncNowHint":"触发本地AI工具日志立即解析并上传。","settings.menubar.syncing":"正在同步...","settings.menubar.updates":"更新","settings.menubar.updatesHint":"检查 GitHub 上是否有新版本。","settings.menubar.checkUpdates":"检查更新","menubar.preview.icon_only":"仅显示图标","menubar.slot.primary":"第一个位置","menubar.slot.secondary":"第二个位置","menubar.native_only":"打开 macOS 版 TokenTrackerBar 后可编辑菜单栏显示。","menubar.metric.today_tokens":"今日 Token","menubar.metric.today_cost":"今日成本","menubar.metric.last_7d_tokens":"近 7 天 Token","menubar.metric.total_tokens":"总 Token","menubar.metric.total_cost":"总成本","menubar.metric.claude_5h":"Claude 5 小时限额","menubar.metric.claude_7d":"Claude 7 天限额","menubar.metric.codex_5h":"Codex 5 小时限额","menubar.metric.codex_7d":"Codex 7 天限额","nav.ip_check":"Claude IP 检查","skills.page.title":"Skills","skills.tab.my":"我的","skills.tab.browse":"发现","skills.action.refresh":"刷新","skills.action.view":"详情","skills.action.install":"安装","skills.action.install_to":"安装到 {{count}} 个 Agents","skills.action.choose_targets":"选择目标","skills.target.menu_label":"安装到","skills.target.none":"未选目标","skills.toast.installed":"已把 {{name}} 安装到 {{targets}}。","skills.action.remove":"移除","skills.action.search":"搜索","skills.card.installed":"已安装","skills.my.count":"{{count}} 个技能","skills.target.toggle_aria":"切换 {{target}}","skills.target.sync_title":"在 {{target}} 启用","skills.target.remove_title":"在 {{target}} 停用","skills.card.installs":"{{count}} 次安装","skills.source.label":"来源","skills.source.all":"全部仓库","skills.source.skillssh":"skills.sh(搜索)","skills.mode.repo":"仓库","skills.mode.skillssh":"skills.sh","skills.browse.placeholder_all":"在已启用的仓库里搜索…","skills.browse.placeholder_repo":"在 {{repo}} 中搜索…","skills.browse.placeholder_skillssh":"在 skills.sh 仓库中搜索…","skills.browse.empty_sources":"添加一个 GitHub 仓库以开始浏览技能。","skills.browse.sources_summary":"已启用 {{count}} 个来源","skills.browse.sources_none":"还没有来源","skills.browse.manage_sources":"管理来源","skills.browse.hint_skillssh":"至少输入 2 个字符以搜索 skills.sh。","skills.browse.loading_hint":"正在从 GitHub 拉取 skill 信息,首次加载可能需要一分钟,结果会缓存。","skills.error.generic":"Skill 操作失败。","skills.confirm.remove_title":"要移除 {{name}} 吗?","skills.confirm.remove_managed":"这个 skill 将从所有已连接的 AI 工具中移除,几秒内可以撤销。","skills.confirm.remove_local":"将从所有 AI 工具目录中删除该 skill 文件夹。此操作无法撤销。","skills.toast.removed":"已移除 {{name}}。","shared.action.undo":"撤销","shared.action.cancel":"取消","skills.empty.my":"还没有 skill。去「发现」搜索或安装。","skills.empty.my_cta":"去发现","skills.empty.browse":"这个来源下没有找到技能。","skills.empty.search":"没有结果,换个关键词试试。","skills.repo.add_title":"添加仓库","skills.repo.placeholder":"owner/repository","skills.repo.add":"添加仓库","skills.repo.invalid":"请输入 owner/repository 或 GitHub 仓库 URL。","skills.repo.list_title":"已启用仓库","skills.repo.remove":"移除仓库","settings.appearance.language.label":"语言","settings.appearance.language.hint":"使用“系统”时会默认跟随本机语言。","settings.appearance.language.system":"系统","settings.appearance.language.english":"英语","settings.appearance.language.chinese":"简体中文"},vW={"stats.period.today":"今日","stats.period.week":"本周","stats.period.month":"本月","stats.period.all":"全部","stats.period.convs":"对话","dashboard.core_index.collapse_label":"▾","dashboard.core_index.expand_label":"▸","dashboard.core_index.collapse_aria":"折叠模型分解","dashboard.core_index.expand_aria":"展开模型细分","dashboard.rolling.title":"最近的活动","dashboard.rolling.last_7d":"过去 7 天","dashboard.rolling.last_30d":"过去 30 天","dashboard.rolling.avg_active_day":"日平均","dashboard.model_breakdown.title":"模型拆解","dashboard.model_breakdown.footer":"多引擎负载均衡 // 活跃会话","dashboard.model_breakdown.usage_label":"用量:{{value}}","dashboard.top_models.title":"热门模型","dashboard.top_models.subtitle":"按 Token 使用情况","dashboard.projects.title":"项目用量","dashboard.projects.subtitle":"你最活跃的仓库","dashboard.projects.tokens_label":"Token","dashboard.projects.stars_label":"星标","dashboard.projects.limit_label":"展示","dashboard.projects.limit_aria":"选择仓库显示数量","dashboard.projects.limit_top_3":"前 3 名","dashboard.projects.limit_top_6":"前 6 名","dashboard.projects.limit_top_10":"前 10 名","dashboard.projects.empty":"没有公开仓库","dashboard.upgrade_alert.title":"可用更新","dashboard.upgrade_alert.subtitle":"TokenTracker v{{required}} 现已推出。","dashboard.upgrade_alert.subtitle_generic":"新版本的 TokenTracker 现已推出。","dashboard.upgrade_alert.prompt":"$","dashboard.upgrade_alert.sparkle":"✨","dashboard.upgrade_alert.install_command":"npx --yes tokentracker-cli init","dashboard.upgrade_alert.copy":"[ 复制 ]","dashboard.upgrade_alert.copied":"[已复制]","dashboard.upgrade_alert.ignore":"忽略","dashboard.widgets.title":"桌面小组件","dashboard.widgets.hint":"右键点按桌面 → 编辑小组件 → 搜索“TokenTracker”","dashboard.widgets.dismiss_aria":"关闭小组件介绍","dashboard.cost_breakdown.title":"成本明细","dashboard.cost_breakdown.total_label":"预计总成本","dashboard.cost_breakdown.calc_prefix":"计算:","dashboard.cost_breakdown.calc_dynamic":"动态","dashboard.cost_breakdown.close":"关闭","dashboard.cost_breakdown.footer":"根据公开定价估算","trend.chart.unit_label":"TKNS","trend.chart.left_label":"T-24H","trend.chart.right_label":"实时流","trend.chart.empty":"没有趋势数据。","trend.chart.peak":"峰值:{{value}} {{unit}}","trend.monitor.label":"使用趋势","trend.monitor.max_label":"最大值:{{value}}","trend.monitor.avg_label":"平均值:{{value}}","trend.monitor.now_label":"现在","trend.monitor.fallback.hour_00":"00:00","trend.monitor.fallback.hour_06":"06:00","trend.monitor.fallback.hour_12":"12:00","trend.monitor.fallback.hour_18":"18:00","trend.monitor.fallback.hour_23":"23:00","trend.monitor.fallback.tminus_24":"-24小时","trend.monitor.fallback.tminus_18":"-18小时","trend.monitor.fallback.tminus_12":"-12小时","trend.monitor.fallback.tminus_6":"-6小时","trend.monitor.tooltip.utc":"UTC","trend.monitor.tooltip.tokens":"Token","trend.monitor.tooltip.hour":"{{date}} {{hour}}:00 {{tz}}","trend.monitor.tooltip.day":"{{date}} {{tz}}","trend.monitor.tooltip.month":"{{date}} {{tz}}","trend.monitor.tooltip.hour_no_tz":"{{date}} {{hour}}:00","trend.monitor.tooltip.day_no_tz":"{{date}}","trend.monitor.tooltip.month_no_tz":"{{date}}","trend.monitor.tooltip.value":"{{value}} {{unit}}","trend.monitor.month.jan":"1月","trend.monitor.month.feb":"2月","trend.monitor.month.mar":"3月","trend.monitor.month.apr":"4月","trend.monitor.month.may":"5月","trend.monitor.month.jun":"6月","trend.monitor.month.jul":"7月","trend.monitor.month.aug":"8月","trend.monitor.month.sep":"9月","trend.monitor.month.oct":"10月","trend.monitor.month.nov":"11月","trend.monitor.month.dec":"12月","heatmap.title":"热力图","heatmap.subtitle":"你过去一年的 AI 用量","heatmap.aria_label":"热力图","heatmap.empty":"尚无活动数据。","heatmap.legend.less":"少","heatmap.legend.more":"多","heatmap.legend.utc":"UTC","heatmap.tooltip":"{{day}} • {{value}} {{unit}} • {{tz}}","heatmap.unit.tokens":"Token","heatmap.month.jan":"1月","heatmap.month.feb":"2月","heatmap.month.mar":"3月","heatmap.month.apr":"4月","heatmap.month.may":"5月","heatmap.month.jun":"6月","heatmap.month.jul":"7月","heatmap.month.aug":"8月","heatmap.month.sep":"9月","heatmap.month.oct":"10月","heatmap.month.nov":"11月","heatmap.month.dec":"12月","heatmap.day.sun":"日","heatmap.day.mon":"一","heatmap.day.tue":"二","heatmap.day.wed":"三","heatmap.day.thu":"四","heatmap.day.fri":"五","heatmap.day.sat":"六","dashboard.sign_out":"登出","dashboard.not_signed_in":"未登录","dashboard.footer.active":"{{range}} • 点击“刷新”重新加载","dashboard.footer.auth":"登录查看使用情况","dashboard.footer.right":"Token Tracker 仪表盘","dashboard.auth_required.title":"需要身份验证","dashboard.auth_required.subtitle":"登录以继续","dashboard.auth_required.body":"登录或注册即可查看你每日的 token 用量(UTC)。","dashboard.session_expired.title":"会话已过期","dashboard.session_expired.subtitle":"重新登录","dashboard.session_expired.body":"你的会话已过期。","dashboard.session_expired.body_tail":"请重新登录,以刷新你的私有用量数据。","dashboard.session_expired.copy_label":"运行 npx --yes tokentracker-cli init","dashboard.session_expired.copied":"已复制","dashboard.auth_optional.title":"连接你的账号","dashboard.auth_optional.subtitle":"跨设备同步使用情况","dashboard.auth_optional.body":"登录或注册以同步真实用量。","dashboard.install.title":"安装","dashboard.install.subtitle":"命令行工具","dashboard.install.prompt":"安装 Node.js 18+ 然后运行:","dashboard.install.cmd.init":"npx --yes tokentracker-cli init","dashboard.install.cmd.init_link_code":"npx --yes tokentracker-cli init --link-code {{link_code}}","dashboard.install.copy":"复制安装命令","dashboard.install.copy_base":"复制初始化命令","dashboard.install.copied":"已复制到剪贴板","dashboard.install.link_code.loading":"正在生成专属代码...","dashboard.install.link_code.failed":"专属代码不可用","dashboard.install.cmd.sync":"npx --yes tokentracker-cli sync","dashboard.public_view.title":"公开主页","dashboard.public_view.status.enabled":"开启","dashboard.public_view.status.disabled":"关闭","dashboard.public_view.action.copy":"复制分享链接","dashboard.public_view.action.copied":"已复制","dashboard.public_view.action.enable":"开启公开主页","dashboard.public_view.action.disable":"关闭公开主页","dashboard.public_view.invalid.title":"链接无效","dashboard.public_view.invalid.body":"此公共链接无效或已被撤销。","dashboard.activity.title":"活动","dashboard.activity.subtitle":"过去 52 周 · 本地数据","dashboard.daily.title":"每日细目","dashboard.daily.subtitle":"查看每天的用量","dashboard.daily.empty":"还没有数据。先使用 AI CLI,再运行 {{cmd}}。","dashboard.identity.title":"你的个人资料","dashboard.identity.subtitle":"记录你的编码之旅","dashboard.identity.fallback":"匿名用户","dashboard.version.label":"版本","dashboard.screenshot.title_line1":"AI 编程助手","dashboard.screenshot.title_line2":"2025 年度回顾","dashboard.screenshot.twitter_button":"分享到 X","dashboard.screenshot.twitter_label":"分享到 X","dashboard.screenshot.twitter_hint":"自动将图像复制到剪贴板","dashboard.screenshot.twitter_text":"记录中的 {{total_tokens}} Token。\\n{{model_name}} 以 {{model_percent}}% 领先。\\n\\n我的 AI 使用情况,未经审计 →\\ntoken.rynn.me"},xW={"landing.handle.default":"VIBE_USER","landing.handle.special":"伏特","landing.hero.title_primary":"实时追踪你的","landing.hero.title_secondary":"AI Token","landing.hero.tagline":"统一的用量仪表板","landing.hero.subtagline":"自动监控 Claude Code、Cursor、Codex 等工具的 Token 用量。本地优先、注重隐私、零配置。","landing.screenshot.alt":"TokenTracker 仪表板截图","landing.nav.login":"登录","landing.nav.signup":"注册","landing.nav.login_signup":"登录 / 注册","landing.seo.title":"面向 AI Coding CLI 的安全 Token 用量追踪","landing.seo.summary":"自动监控 Claude Code、Cursor、Codex 等工具的 Token 用量。本地优先、注重隐私、零配置。","landing.install.title":"一行命令即可安装","landing.install.prompt":"在终端里运行:","landing.install.command":"npx --yes tokentracker-cli","landing.install.helper":"然后连接你的账号,开始同步用量。","landing.install.action.copy":"复制命令","landing.install.action.copied":"已复制","landing.ai_agent.title":"让 AI 帮你安装","landing.ai_agent.description":"复制下面的指南,粘贴给 ChatGPT、Claude 或任意 AI 助手——它会自动帮你装好 TokenTracker。","landing.ai_agent.command":"https://github.com/mm7894215/TokenTracker/blob/main/docs/AI_AGENT_INSTALL.md","landing.ai_agent.copy_label":"复制指南链接","landing.ai_agent.helper":"或点击直接打开指南手动复制。","landing.ai_agent.guide_url":"https://github.com/mm7894215/TokenTracker/blob/main/docs/AI_AGENT_INSTALL.md","landing.meta.title":"Token Tracker —— AI Coding CLI 的 Token 用量追踪器","landing.meta.description":"自动监控 Claude Code、Cursor、Codex 等工具的 Token 用量。本地优先、注重隐私、零配置。","landing.meta.og_site_name":"Token Tracker","landing.meta.og_type":"website","landing.meta.og_image":"https://www.tokentracker.cc/og-image.jpg","landing.meta.og_url":"https://www.tokentracker.cc/","landing.meta.twitter_card":"summary_large_image","share.meta.title":"Token Tracker 分享","share.meta.description":"分享你的 Token Tracker 仪表板快照,包含跨模型、项目和时间窗口的用量洞察。","share.meta.og_site_name":"Token Tracker","share.meta.og_type":"website","share.meta.og_image":"https://www.tokentracker.cc/share-dashboard.jpg","share.meta.og_url":"https://www.tokentracker.cc/share","share.meta.twitter_card":"summary_large_image","landing.seo.point1":"自动追踪 AI CLI 的 Token 用量,零手动操作。","landing.seo.point2":"矩阵式界面,关键信号一目了然。","landing.seo.point3":"通用 AI CLI 排行榜,对比用量与排名。","landing.seo.roadmap":"原生支持 Codex、Claude Code 与 Gemini CLI。","landing.signal.identity_probe":"身份探测","landing.signal.live_sniffer":"实时嗅探","landing.handle.label":"设置 Handle","landing.handle.placeholder":"试试 “{{handle}}”","landing.rank.expectation":"预期排名:{{rank}}","landing.rank.singularity":"登顶","landing.rank.unranked":"未上榜","landing.cta.initialize":"进入仪表板","landing.cta.subtext":"连接 GitHub","landing.cta.primary":"进入仪表板","landing.cta.secondary":"查看 GitHub 源码","landing.cta.login_signup":"进入仪表板","landing.footer.link.manifesto":"宣言","landing.footer.link.docs":"文档","landing.footer.link.security":"安全","landing.footer.system_ready":"System_Ready // 2026 TokenTracker OS","landing.v2.hero.title_line1":"追踪你所有的","landing.v2.hero.title_line2":"AI Token","landing.v2.hero.subtitle":"统一的用量仪表板","landing.v2.install.btn_copy":"复制命令","landing.v2.install.mac_cta":"Mac 应用 (DMG)","landing.v2.models.title":"支持的 AI CLI 工具","landing.v2.compare.kicker":"无缝追踪","landing.v2.compare.title":"别再瞎猜你的 AI 用量。","landing.v2.compare.subtitle":"AI CLI 把用量数据藏在零散的本地文件里。TokenTracker 把它们实时聚合到一个清晰的仪表板里。","landing.v2.distill.body":"100% 本地处理,不上传任何 prompt 或代码。","landing.v2.compare.with.title":"用 Token Tracker","landing.v2.compare.with.p1":"集中式用量仪表板","landing.v2.compare.with.p2":"实时 Token 指标","landing.v2.compare.with.p3":"100% 本地,隐私无忧","landing.v2.compare.without.title":"不用","landing.v2.compare.without.p1":"散落的 JSON 日志文件","landing.v2.compare.without.p2":"对 Token 消耗一无所知","landing.v2.compare.without.p3":"突如其来的 API 账单","landing.v2.footer.line":"Token Tracker —— 开发者打造,服务开发者。","landing.v2.nav.github":"GitHub","landing.v2.models.agent.codex":"Codex","landing.v2.models.agent.claude_code":"Claude Code","landing.v2.models.agent.cursor":"Cursor","landing.v2.models.agent.gemini":"Gemini","landing.v2.models.agent.opencode":"OpenCode","landing.v2.models.agent.openclaw":"OpenClaw","landing.v2.cta.primary":"进入仪表板","landing.v2.hero.subtagline":"自动监控 Claude Code、Cursor、Codex 等工具的 Token 用量。本地优先、注重隐私、零配置。","signalbox.title_default":"关联","archive.title":"档案网格","archive.footer.left":"年度网格","leaderboard.nav.open":"$ 排行榜","leaderboard.nav.back":"$ 仪表板","leaderboard.profile.nav.back":"$ 排行榜","leaderboard.title":"排行榜","leaderboard.range":"UTC {{period}} · {{from}} – {{to}}","leaderboard.range_loading":"UTC {{period}} · …","leaderboard.range.total":"全部时间","leaderboard.generated_at":"更新于 {{ts}}","leaderboard.period.week":"周","leaderboard.period.month":"月","leaderboard.period.total":"全部","leaderboard.metric.all":"全部","leaderboard.metric.gpt":"GPT","leaderboard.metric.claude":"Claude","leaderboard.me_label":"你","leaderboard.anon_label":"匿名","leaderboard.public_profile.label":"公开主页","leaderboard.public_profile.status.enabled":"已开启","leaderboard.public_profile.status.disabled":"已关闭","leaderboard.error.unknown":"未知错误","leaderboard.me_card.title":"我的排名","leaderboard.me_card.subtitle":"本周","leaderboard.profile.card.title":"个人主页","leaderboard.profile.card.subtitle":"{{period}}","leaderboard.top10.title":"前 10 名","leaderboard.top10.subtitle":"前 9 名加上你","leaderboard.table.title":"完整榜单","leaderboard.table.subtitle":"分页显示","leaderboard.loading":"加载中…","leaderboard.empty":"暂无数据","leaderboard.column.rank":"排名","leaderboard.column.user":"用户","leaderboard.column.total":"总计","leaderboard.column.codex":"Codex","leaderboard.column.claude":"Claude","leaderboard.column.gemini":"Gemini","leaderboard.column.cursor":"Cursor","leaderboard.column.opencode":"OpenCode","leaderboard.column.openclaw":"OpenClaw","leaderboard.column.hermes":"Hermes","leaderboard.column.kiro":"Kiro","leaderboard.column.copilot":"Copilot","leaderboard.column.kimi":"Kimi","leaderboard.column.supplemental":"其他","leaderboard.column.est_cost":"预估花费","leaderboard.signin_prompt":"登录后即可上榜","leaderboard.signin_button":"登录","leaderboard.sync_prompt":"开启云同步即可参与排名","leaderboard.sync_button.idle":"开启并同步","leaderboard.sync_button.busy":"同步中…","leaderboard.pagination.page_size_label":"每页显示","landing.oauth.google":"使用 Google 继续","landing.oauth.github":"使用 GitHub 继续","leaderboard.pagination.prev":"上一页","leaderboard.pagination.next":"下一页","leaderboard.pagination.ellipsis":"……","leaderboard.pagination.page_unknown":"第 {{page}} 页","share.modal.title":"分享你的数据","share.modal.subtitle":"生成海报卡片,随处分享。","share.modal.close":"关闭","share.modal.action.x":"分享到 X","share.modal.action.download":"下载","share.modal.action.copy":"复制图片","share.modal.hint.x":"把图片粘贴到推文里","share.modal.hint.copy":"到剪贴板","share.modal.name_label":"显示名称","share.modal.name_placeholder":"输入你的名字","share.modal.style_label":"样式","share.modal.footer":"数据始终保留在本地——图片在你的浏览器内生成,绝不上传。","share.button.label":"分享","share.button.aria":"打开分享卡片","share.toast.copied":"图片已复制到剪贴板","share.toast.downloaded":"图片已保存","share.toast.failed":"图片生成失败","share.toast.working":"生成中…","share.variant.neon":"霓虹","share.variant.broadsheet":"特刊","share.date.month_year":"{{year}} 年 {{month}}","share.issue.all_time":"总计","share.month_short.jan":"1 月","share.month_short.feb":"2 月","share.month_short.mar":"3 月","share.month_short.apr":"4 月","share.month_short.may":"5 月","share.month_short.jun":"6 月","share.month_short.jul":"7 月","share.month_short.aug":"8 月","share.month_short.sep":"9 月","share.month_short.oct":"10 月","share.month_short.nov":"11 月","share.month_short.dec":"12 月","share.hook.top_loyal":"{{name}} 占了 {{percent}}% 的用量。","share.hook.days_record":"共记录 {{days}} 天。","share.hook.top_led":"{{name}} 领跑,占比 {{percent}}%。","share.hook.multi_models":"{{days}} 天里用了 {{count}} 个模型。","share.hook.days_with_model":"{{name}} 陪你跑了 {{days}} 天。","share.hook.new_chapter":"新的记录,从这里开始。","share.card.broadsheet.issue":"期号","share.card.broadsheet.by":"分享者","share.card.broadsheet.tracked_since":"追踪起始","share.card.broadsheet.total_tokens":"总 Token 数","share.card.broadsheet.estimated_spend":"预估花费","share.card.broadsheet.billable_days":"{{days}} 个活跃日","share.card.broadsheet.heatmap_title":"年度热图","share.card.broadsheet.heatmap_days_on_record":"{{active}} / {{total}} 天有记录","share.card.broadsheet.roster_title":"模型榜","share.card.broadsheet.roster_subtitle":"常用模型轮换","share.card.broadsheet.empty":"这一周很安静,还没有模型数据。","share.card.broadsheet.global_rank":"全站排名","share.card.broadsheet.active_days":"活跃","share.card.broadsheet.days_count":"{{days}} 天","share.card.broadsheet.track_yours":"追踪你自己的","share.card.annual.report_title":"用量报告","share.card.annual.less":"少","share.card.annual.more":"多","share.card.annual.heatmap_title":"Token 热图","share.card.annual.total_tokens":"总 Token 数","share.card.annual.estimated_cost":"预估成本","share.card.annual.longest_streak":"最长连击","share.card.annual.days_count":"{{days}} 天","share.card.annual.top_model":"热门模型"};function b3(){return typeof window>"u"?null:window.localStorage||null}function _3(){return typeof navigator>"u"?null:navigator.clipboard||null}function bW(){return typeof window>"u"?null:window.ClipboardItem||null}function _W(t,{storage:e}={}){const n=e??b3();if(!n||typeof n.getItem!="function")return null;try{return n.getItem(t)}catch{return null}}function wW(t,e,{storage:n}={}){const r=n??b3();if(!r||typeof r.setItem!="function")return!1;try{return r.setItem(t,e),!0}catch{return!1}}async function Fw(t,{clipboard:e}={}){const n=e??_3();if(!n||typeof n.writeText!="function")return!1;try{return await n.writeText(t),!0}catch{return!1}}async function Uw(t,{clipboard:e}={}){const n=e??_3(),r=bW();if(!t||!n||typeof n.write!="function"||!r)return!1;try{const i=t.type||"image/png",a=t.type&&t.type!==i?t.slice(0,t.size,i):t.type?t:t.slice(0,t.size,i),s=new r({[i]:a});return await n.write([s]),!0}catch{return!1}}const w3="tokentracker-locale",Xc="system",Kh="en",jy="zh-CN";function S3(t){return typeof t!="string"?Kh:/^zh(?:[-_]|$)/i.test(t.trim())?jy:Kh}function By(t){return t===Xc?Xc:S3(t)}function SW(){return typeof navigator>"u"?[]:Array.isArray(navigator.languages)&&navigator.languages.length?navigator.languages.filter(t=>typeof t=="string"):typeof navigator.language=="string"?[navigator.language]:[]}function H0(t,e=SW()){const n=By(t);if(n!==Xc)return n;const r=e.map(i=>typeof i=="string"?i.trim():"").find(i=>i.length>0);return r&&/^zh(?:[-_]|$)/i.test(r)?jy:Kh}function wk(){return By(_W(w3)||Xc)}function kW(t){return wW(w3,By(t))}const EW=["key","module","page","component","slot","text"],MW={[jy]:{...yW,...vW,...xW}};let wb=null,k3=H0(wk());function TW(t){const e=[];let n=[],r="",i=!1;for(let a=0;a<t.length;a+=1){const s=t[a];if(i){s==='"'?t[a+1]==='"'?(r+='"',a+=1):i=!1:r+=s;continue}if(s==='"'){i=!0;continue}if(s===","){n.push(r),r="";continue}if(s===`
786
+ `,yW={"header.auth.sign_in_aria":"登录","header.auth.user_fallback":"用户","header.cloud_sync.label":"将本地使用情况同步到云端","header.cloud_sync.hint":"运行本地 Token Tracker 同步,将用量上传到云端。关闭后仅保留本地离线使用。","login.back_home":"返回首页","login.cloud_only":"未配置云端登录。请使用 localhost 上的本地仪表盘。","login.title":"登录","login.subtitle":"选择邮箱或已连接账号。","login.dismiss":"关闭","login.verify_email_success":"邮箱已验证。你现在可以登录。","login.verify_email_pending":"请先在邮箱中完成验证,然后再登录。","login.oauth.continue":"使用 {{provider}} 继续","login.divider":"或","login.tab.sign_in":"登录","login.tab.sign_up":"创建账户","login.field.name":"显示名称","login.field.name_placeholder":"可选","login.field.email":"电子邮件","login.field.password":"密码","login.password_hint":"至少 {{min}} 个字符。","login.submit.sign_in":"使用邮箱登录","login.submit.sign_up":"创建账号","auth.callback.processing":"处理中…","auth.callback.success":"登录成功","auth.callback.redirecting":"正在返回 TokenTracker…","auth.callback.failed":"登录未完成,请重试。","auth.callback.close":"关闭此页","login_modal.subtitle":"登录以加入排行榜","login_modal.continue_email":"使用邮箱继续","login_modal.divider_email":"邮箱","shared.placeholder.short":"--","shared.placeholder.anon_mark":"?","shared.unit.percent":"%","shared.unit.thousand_abbrev":"K","shared.unit.million_abbrev":"M","shared.unit.billion_abbrev":"B","shared.button.sign_in":"$ 登录","shared.button.sign_up":"$ 注册","shared.range.simple":"范围:{{range}}","shared.data_source":"数据来源:{{source}}","shared.error.prefix":"错误:{{error}}","shared.status.unsynced":"—","shared.time.now":"刚刚","error.boundary.title":"出了点问题","error.boundary.subtitle":"这个视图渲染失败了","error.boundary.hint":"打开控制台,然后重新加载页面","error.boundary.no_details":"没有错误详细信息","error.boundary.action.reload":"重新加载","shell.header.title":"Token 用量","shell.header.link_active":"LINK_ACTIVE","shell.footer.help":"[F1]帮助","shell.footer.neural_index":"核心索引:0.942.A1","backend.meta.status_label":"状态","backend.meta.host_label":"主机","backend.meta.checked_label":"上次检查","backend.meta.ok_label":"正常","backend.meta.http_label":"http","backend.meta.error_label":"错误","backend.meta.click_refresh":"点击=刷新","status.link.stable":"链接:稳定","status.link.unstable":"链接:弱","status.link.lost":"链接:丢失","boot.ascii_art":"加载中...","boot.prompt":"正在初始化仪表板...","boot.skip_hint":"点击跳过","boot.skip_aria":"跳过启动屏幕","system.header.title_default":"VIBE_OS_v9.0","sparkline.aria_label":"每日 Token 使用迷你图","identity_card.title_default":"身份","identity_card.name_default":"你","identity_card.unknown":"未知","identity_card.decrypt":"显示身份","identity_card.rank_label":"排名","identity_card.streak_label":"活跃天数","identity_card.rank_placeholder":"—","identity_card.streak_value":"{{days}} 天","identity_card.subscriptions_label":"订阅","identity_card.subscription_item":"{{tool}} {{plan}}","identity_panel.badge":"VU","identity_panel.level":"5级","identity_panel.rank_label":"排名","identity_panel.streak_label":"活跃","identity_panel.rank_placeholder":"—","identity_panel.streak_value":"{{days}} 天","usage.panel.title":"Token 使用","usage.summary.total_system_output":"Token 总数","usage.summary.total":"Token 总数","usage.period.day":"日","usage.period.week":"周","usage.period.month":"月","usage.period.total":"总计","usage.period.custom":"自定义","usage.metric.total":"总计","usage.metric.total_cost":"总成本(美元)","usage.metric.input":"输入","usage.metric.output":"输出","usage.metric.cached_input":"缓存输入","usage.metric.reasoning_output":"推理输出","usage.metric.cached_short":"缓存","usage.metric.reasoning_short":"推理","usage.button.loading":"加载中…","usage.button.refresh":"刷新","usage.cost_info.icon":"[ 详情 ]","usage.cost_info.label":"细节","usage.range_label":"范围:{{range}}","usage.overview.tablist_aria":"时间范围","usage.overview.cost_breakdown_aria":"查看成本明细","usage.overview.distribution_aria":"来源占比:{{items}}","usage.overview.distribution_item":"{{label}} {{percent}}%","usage.overview.provider_card_aria":"{{provider}}:{{percent}}%,{{tokens}} Token,{{cost}}。点击{{action}}详情","usage.overview.expand":"展开","usage.overview.collapse":"收起","usage.overview.model_count":"{{count}} 个模型","usage.overview.model_details_aria":"{{provider}} 模型详情","widgets.page.title":"组件","widgets.page.subtitle":"把 Token 用量钉在菜单栏和桌面上。","widgets.cta.open_gallery":"打开小组件库","widgets.cta.download":"下载 Mac 应用","widgets.cta.macos_only":"仅限 macOS","widgets.hero.aria":"使用小组件预览","widgets.hero.annotation":"右键点按桌面 · 编辑小组件 · 搜索“TokenTracker”","widgets.section.more":"还包括","widgets.menubar.name":"菜单栏","widgets.menubar.description":"选择菜单栏图标旁边显示的两个实时信息位。","widgets.menubar.section.title":"菜单栏","widgets.gallery.section.title":"桌面小组件","widgets.summary.name":"使用概览","widgets.summary.description":"今天和近 7 天的用量,以及紧凑趋势线。","widgets.heatmap.name":"热力图","widgets.heatmap.description":"像 GitHub 一样,一眼看清活跃和空闲的日子。","widgets.topModels.name":"热门模型","widgets.topModels.description":"你最常用的模型,按 Token 占比排序。","widgets.limits.name":"使用限制","widgets.limits.description":"Claude、Codex、Cursor、Gemini 等的实时速率限制进度。","daily.table.aria_label":"每日总计表","daily.sort.date.label":"日期","daily.sort.date.title":"按日期排序","daily.sort.total.label":"总计","daily.sort.total.title":"按总计排序","daily.sort.input.label":"输入","daily.sort.input.title":"按输入排序","daily.sort.output.label":"输出","daily.sort.output.title":"按输出排序","daily.sort.cached.label":"缓存","daily.sort.cached.title":"按缓存输入排序","daily.sort.reasoning.label":"推理","daily.sort.reasoning.title":"按推理输出排序","daily.sort.conversations.label":"对话数","daily.sort.conversations.title":"按对话排序","details.pagination.prev":"上一页","details.pagination.next":"下一页","details.pagination.page":"页{{page}}/{{total}}","limits.copilot.otelHint.title":"跟踪 Copilot Token 使用情况","limits.copilot.otelHint.body":"限额信息通过你的 GitHub OAuth 令牌读取。如果还想记录逐 Token 用量,请启用 Copilot 的 OpenTelemetry 导出,把下面这段加到你的 shell 配置文件(~/.zshrc 或 ~/.bashrc):","limits.copilot.otelHint.copy":"复制","limits.copilot.otelHint.copied":"已复制","limits.panel.title":"使用限制","limits.label.cursor_plan":"套餐","limits.label.cursor_auto":"自动","limits.label.cursor_api":"API","limits.label.kiro_month":"月度","limits.label.kiro_bonus":"奖励","limits.label.kimi_weekly":"周","limits.label.kimi_5h":"5h","limits.label.kimi_total":"总量","limits.label.kimi_parallel":"并发:{{count}}","limits.label.copilot_premium":"高级","limits.label.copilot_chat":"对话","limits.status.not_connected":"未连接","limits.status.no_data":"未返回实时限额数据","limits.status.all_hidden":"所有限额提供商都已隐藏。请打开显示设置重新显示。","live_sniffer.log.system":"[系统]KERNEL_LINK_ESTABLISHED","live_sniffer.log.socket":"[套接字]正在监听_LOCAL_CLI_PIPE...","live_sniffer.event.intercepted":"> 拦截:AI_COMPLETION_EVENT","live_sniffer.event.quantifying":"> 量化:+64 NEURAL_TOKENS","live_sniffer.event.analysis":"> 分析:HIGH_VIBE_FLOW_DETECTED","live_sniffer.event.sync":"> 同步:上传到核心中继","live_sniffer.event.batch":"[状态] BATCH_TRANSMISSION_COMPLETE","live_sniffer.event.hooking":"> 挂钩:AI_CLI_PIPE_LINK","live_sniffer.event.capture":"> 捕获:+128 NEURAL_TOKENS","nav.usage":"用量","nav.limits":"限额","nav.widgets":"小组件","nav.skills":"Skills","nav.leaderboard":"排行榜","nav.collapse":"折叠侧边栏","nav.expand":"展开侧边栏","nav.menu":"打开导航菜单","nav.close_menu":"关闭导航菜单","nav.aside_label":"主导航","nav.nav_label":"导航","limits.page.subtitle":"AI 工具的速率限制和配额使用情况。","limits.settings.title":"显示设置","limits.settings.subtitle":"选择要显示的提供商及其顺序。","limits.settings.move_up":"向上移动","limits.settings.move_down":"下移","limits.settings.toggle_visible":"切换可见性","limits.page.openSettings":"显示设置","nav.group.general":"常规","nav.group.tools":"工具","nav.group.account":"账户","nav.settings":"设置","header.auth.open_settings":"打开设置","settings.page.title":"设置","settings.page.subtitle":"管理你的账户、外观和显示偏好。","settings.section.appearance":"外观","settings.section.account":"账户","settings.section.limits":"限制显示","settings.section.limitsSubtitle":"重新排序提供商并选择哪些出现在“限制”页面上。","settings.appearance.theme.label":"主题","settings.appearance.theme.hint":"选择 Token Tracker 在仪表盘中的显示方式。","settings.appearance.theme.light":"浅色","settings.appearance.theme.dark":"深色","settings.appearance.theme.system":"系统","settings.account.displayName":"显示名称","settings.account.edit":"编辑","settings.account.save":"保存","settings.account.saving":"保存...","settings.account.cancel":"取消","settings.account.cloudSync":"云同步","settings.account.cloudSyncHint":"将本地用量上传到你的 Token Tracker 云端账号。","settings.account.publicProfile":"公开主页","settings.account.publicProfileHint":"在公开排行榜中展示你的用量。","settings.account.anonymous":"匿名","settings.account.anonymousHint":"在排行榜中隐藏你的名字和头像。","settings.account.displayNameAnonymousHint":"匿名状态下,排行榜会隐藏你的名字和头像","settings.account.displayNameDisabledWhileAnon":"请先关闭匿名,再编辑名字","settings.account.githubUrl":"GitHub 主页","settings.account.githubUrlHint":"在排行榜名字旁显示 GitHub 链接。","settings.account.githubUrlPlaceholder":"用户名或 https://github.com/用户名","settings.account.githubUrlInvalid":"请输入 GitHub 用户名,或 https://github.com/用户名","leaderboard.github.aria":"打开 GitHub 主页","leaderboard.github.tooltipAction":"点击查看 GitHub 主页","leaderboard.github.tooltipPrefix":"可在","leaderboard.github.tooltipSettingsLink":"设置","leaderboard.github.tooltipSuffix":"中配置你的主页","settings.account.signOut":"退出登录","settings.account.signIn":"登录","settings.account.signedOutHint":"登录后可管理云同步和排行榜偏好。","settings.section.menubar":"菜单栏应用","settings.section.menubarSubtitle":"macOS 菜单栏应用的偏好设置,与右键菜单保持一致。","settings.menubar.showStats":"在菜单栏中显示统计信息","settings.menubar.showStatsHint":"在菜单栏图标旁边显示今天的Token 数量和成本。","settings.menubar.animatedIcon":"动画图标","settings.menubar.animatedIconHint":"闪烁 Clawd 角色并在菜单栏中播放同步动画。","settings.menubar.launchAtLogin":"登录时启动","settings.menubar.launchAtLoginHint":"登录 macOS 时自动启动 TokenTrackerBar。","settings.menubar.syncNow":"立即同步","settings.menubar.syncNowHint":"触发本地AI工具日志立即解析并上传。","settings.menubar.syncing":"正在同步...","settings.menubar.updates":"更新","settings.menubar.updatesHint":"检查 GitHub 上是否有新版本。","settings.menubar.checkUpdates":"检查更新","menubar.preview.icon_only":"仅显示图标","menubar.slot.primary":"第一个位置","menubar.slot.secondary":"第二个位置","menubar.native_only":"打开 macOS 版 TokenTrackerBar 后可编辑菜单栏显示。","menubar.metric.today_tokens":"今日 Token","menubar.metric.today_cost":"今日成本","menubar.metric.last_7d_tokens":"近 7 天 Token","menubar.metric.total_tokens":"总 Token","menubar.metric.total_cost":"总成本","menubar.metric.claude_5h":"Claude 5 小时限额","menubar.metric.claude_7d":"Claude 7 天限额","menubar.metric.codex_5h":"Codex 5 小时限额","menubar.metric.codex_7d":"Codex 7 天限额","nav.ip_check":"Claude IP 检查","skills.page.title":"Skills","skills.tab.my":"我的","skills.tab.browse":"发现","skills.action.refresh":"刷新","skills.action.view":"详情","skills.action.install":"安装","skills.action.install_to":"安装到 {{count}} 个 Agents","skills.action.choose_targets":"选择目标","skills.target.menu_label":"安装到","skills.target.none":"未选目标","skills.toast.installed":"已把 {{name}} 安装到 {{targets}}。","skills.action.remove":"移除","skills.action.search":"搜索","skills.card.installed":"已安装","skills.my.count":"{{count}} 个技能","skills.target.toggle_aria":"切换 {{target}}","skills.target.sync_title":"在 {{target}} 启用","skills.target.remove_title":"在 {{target}} 停用","skills.card.installs":"{{count}} 次安装","skills.source.label":"来源","skills.source.all":"全部仓库","skills.source.skillssh":"skills.sh(搜索)","skills.mode.repo":"仓库","skills.mode.skillssh":"skills.sh","skills.browse.placeholder_all":"在已启用的仓库里搜索…","skills.browse.placeholder_repo":"在 {{repo}} 中搜索…","skills.browse.placeholder_skillssh":"在 skills.sh 仓库中搜索…","skills.browse.empty_sources":"添加一个 GitHub 仓库以开始浏览技能。","skills.browse.sources_summary":"已启用 {{count}} 个来源","skills.browse.sources_none":"还没有来源","skills.browse.manage_sources":"管理来源","skills.browse.hint_skillssh":"至少输入 2 个字符以搜索 skills.sh。","skills.browse.loading_hint":"正在从 GitHub 拉取 skill 信息,首次加载可能需要一分钟,结果会缓存。","skills.error.generic":"Skill 操作失败。","skills.confirm.remove_title":"要移除 {{name}} 吗?","skills.confirm.remove_managed":"这个 skill 将从所有已连接的 AI 工具中移除,几秒内可以撤销。","skills.confirm.remove_local":"将从所有 AI 工具目录中删除该 skill 文件夹。此操作无法撤销。","skills.toast.removed":"已移除 {{name}}。","shared.action.undo":"撤销","shared.action.cancel":"取消","skills.empty.my":"还没有 skill。去「发现」搜索或安装。","skills.empty.my_cta":"去发现","skills.empty.browse":"这个来源下没有找到技能。","skills.empty.search":"没有结果,换个关键词试试。","skills.repo.add_title":"添加仓库","skills.repo.placeholder":"owner/repository","skills.repo.add":"添加仓库","skills.repo.invalid":"请输入 owner/repository 或 GitHub 仓库 URL。","skills.repo.list_title":"已启用仓库","skills.repo.remove":"移除仓库","settings.appearance.language.label":"语言","settings.appearance.language.hint":"使用“系统”时会默认跟随本机语言。","settings.appearance.language.system":"系统","settings.appearance.language.english":"英语","settings.appearance.language.chinese":"简体中文"},vW={"stats.period.today":"今日","stats.period.week":"本周","stats.period.month":"本月","stats.period.all":"全部","stats.period.convs":"对话","dashboard.core_index.collapse_label":"▾","dashboard.core_index.expand_label":"▸","dashboard.core_index.collapse_aria":"折叠模型分解","dashboard.core_index.expand_aria":"展开模型细分","dashboard.rolling.title":"最近的活动","dashboard.rolling.last_7d":"过去 7 天","dashboard.rolling.last_30d":"过去 30 天","dashboard.rolling.avg_active_day":"日平均","dashboard.model_breakdown.title":"模型拆解","dashboard.model_breakdown.footer":"多引擎负载均衡 // 活跃会话","dashboard.model_breakdown.usage_label":"用量:{{value}}","dashboard.top_models.title":"热门模型","dashboard.top_models.subtitle":"按 Token 使用情况","dashboard.projects.title":"项目用量","dashboard.projects.subtitle":"你最活跃的仓库","dashboard.projects.tokens_label":"Token","dashboard.projects.stars_label":"星标","dashboard.projects.limit_label":"展示","dashboard.projects.limit_aria":"选择仓库显示数量","dashboard.projects.limit_top_3":"前 3 名","dashboard.projects.limit_top_6":"前 6 名","dashboard.projects.limit_top_10":"前 10 名","dashboard.projects.empty":"没有公开仓库","dashboard.upgrade_alert.title":"可用更新","dashboard.upgrade_alert.subtitle":"TokenTracker v{{required}} 现已推出。","dashboard.upgrade_alert.subtitle_generic":"新版本的 TokenTracker 现已推出。","dashboard.upgrade_alert.prompt":"$","dashboard.upgrade_alert.sparkle":"✨","dashboard.upgrade_alert.install_command":"npx --yes tokentracker-cli init","dashboard.upgrade_alert.copy":"[ 复制 ]","dashboard.upgrade_alert.copied":"[已复制]","dashboard.upgrade_alert.ignore":"忽略","dashboard.widgets.title":"桌面小组件","dashboard.widgets.hint":"右键点按桌面 → 编辑小组件 → 搜索“TokenTracker”","dashboard.widgets.dismiss_aria":"关闭小组件介绍","dashboard.cost_breakdown.title":"成本明细","dashboard.cost_breakdown.total_label":"预计总成本","dashboard.cost_breakdown.calc_prefix":"计算:","dashboard.cost_breakdown.calc_dynamic":"动态","dashboard.cost_breakdown.close":"关闭","dashboard.cost_breakdown.footer":"根据公开定价估算","trend.chart.unit_label":"TKNS","trend.chart.left_label":"T-24H","trend.chart.right_label":"实时流","trend.chart.empty":"没有趋势数据。","trend.chart.peak":"峰值:{{value}} {{unit}}","trend.monitor.label":"使用趋势","trend.monitor.max_label":"最大值:{{value}}","trend.monitor.avg_label":"平均值:{{value}}","trend.monitor.now_label":"现在","trend.monitor.fallback.hour_00":"00:00","trend.monitor.fallback.hour_06":"06:00","trend.monitor.fallback.hour_12":"12:00","trend.monitor.fallback.hour_18":"18:00","trend.monitor.fallback.hour_23":"23:00","trend.monitor.fallback.tminus_24":"-24小时","trend.monitor.fallback.tminus_18":"-18小时","trend.monitor.fallback.tminus_12":"-12小时","trend.monitor.fallback.tminus_6":"-6小时","trend.monitor.tooltip.utc":"UTC","trend.monitor.tooltip.tokens":"Token","trend.monitor.tooltip.hour":"{{date}} {{hour}}:00 {{tz}}","trend.monitor.tooltip.day":"{{date}} {{tz}}","trend.monitor.tooltip.month":"{{date}} {{tz}}","trend.monitor.tooltip.hour_no_tz":"{{date}} {{hour}}:00","trend.monitor.tooltip.day_no_tz":"{{date}}","trend.monitor.tooltip.month_no_tz":"{{date}}","trend.monitor.tooltip.value":"{{value}} {{unit}}","trend.monitor.month.jan":"1月","trend.monitor.month.feb":"2月","trend.monitor.month.mar":"3月","trend.monitor.month.apr":"4月","trend.monitor.month.may":"5月","trend.monitor.month.jun":"6月","trend.monitor.month.jul":"7月","trend.monitor.month.aug":"8月","trend.monitor.month.sep":"9月","trend.monitor.month.oct":"10月","trend.monitor.month.nov":"11月","trend.monitor.month.dec":"12月","heatmap.title":"热力图","heatmap.subtitle":"你过去一年的 AI 用量","heatmap.aria_label":"热力图","heatmap.empty":"尚无活动数据。","heatmap.legend.less":"少","heatmap.legend.more":"多","heatmap.legend.utc":"UTC","heatmap.tooltip":"{{day}} • {{value}} {{unit}} • {{tz}}","heatmap.unit.tokens":"Token","heatmap.month.jan":"1月","heatmap.month.feb":"2月","heatmap.month.mar":"3月","heatmap.month.apr":"4月","heatmap.month.may":"5月","heatmap.month.jun":"6月","heatmap.month.jul":"7月","heatmap.month.aug":"8月","heatmap.month.sep":"9月","heatmap.month.oct":"10月","heatmap.month.nov":"11月","heatmap.month.dec":"12月","heatmap.day.sun":"日","heatmap.day.mon":"一","heatmap.day.tue":"二","heatmap.day.wed":"三","heatmap.day.thu":"四","heatmap.day.fri":"五","heatmap.day.sat":"六","dashboard.sign_out":"登出","dashboard.not_signed_in":"未登录","dashboard.footer.active":"{{range}} • 点击“刷新”重新加载","dashboard.footer.auth":"登录查看使用情况","dashboard.footer.right":"Token Tracker 仪表盘","dashboard.auth_required.title":"需要身份验证","dashboard.auth_required.subtitle":"登录以继续","dashboard.auth_required.body":"登录或注册即可查看你每日的 token 用量(UTC)。","dashboard.session_expired.title":"会话已过期","dashboard.session_expired.subtitle":"重新登录","dashboard.session_expired.body":"你的会话已过期。","dashboard.session_expired.body_tail":"请重新登录,以刷新你的私有用量数据。","dashboard.session_expired.copy_label":"运行 npx --yes tokentracker-cli init","dashboard.session_expired.copied":"已复制","dashboard.auth_optional.title":"连接你的账号","dashboard.auth_optional.subtitle":"跨设备同步使用情况","dashboard.auth_optional.body":"登录或注册以同步真实用量。","dashboard.install.title":"安装","dashboard.install.subtitle":"命令行工具","dashboard.install.prompt":"安装 Node.js 18+ 然后运行:","dashboard.install.cmd.init":"npx --yes tokentracker-cli init","dashboard.install.cmd.init_link_code":"npx --yes tokentracker-cli init --link-code {{link_code}}","dashboard.install.copy":"复制安装命令","dashboard.install.copy_base":"复制初始化命令","dashboard.install.copied":"已复制到剪贴板","dashboard.install.link_code.loading":"正在生成专属代码...","dashboard.install.link_code.failed":"专属代码不可用","dashboard.install.cmd.sync":"npx --yes tokentracker-cli sync","dashboard.public_view.title":"公开主页","dashboard.public_view.status.enabled":"开启","dashboard.public_view.status.disabled":"关闭","dashboard.public_view.action.copy":"复制分享链接","dashboard.public_view.action.copied":"已复制","dashboard.public_view.action.enable":"开启公开主页","dashboard.public_view.action.disable":"关闭公开主页","dashboard.public_view.invalid.title":"链接无效","dashboard.public_view.invalid.body":"此公共链接无效或已被撤销。","dashboard.activity.title":"活动","dashboard.activity.subtitle":"过去 52 周 · 本地数据","dashboard.daily.title":"每日细目","dashboard.daily.subtitle":"查看每天的用量","dashboard.daily.empty":"还没有数据。先使用 AI CLI,再运行 {{cmd}}。","dashboard.identity.title":"你的个人资料","dashboard.identity.subtitle":"记录你的编码之旅","dashboard.identity.fallback":"匿名用户","dashboard.version.label":"版本","dashboard.screenshot.title_line1":"AI 编程助手","dashboard.screenshot.title_line2":"2025 年度回顾","dashboard.screenshot.twitter_button":"分享到 X","dashboard.screenshot.twitter_label":"分享到 X","dashboard.screenshot.twitter_hint":"自动将图像复制到剪贴板","dashboard.screenshot.twitter_text":"记录中的 {{total_tokens}} Token。\\n{{model_name}} 以 {{model_percent}}% 领先。\\n\\n我的 AI 使用情况,未经审计 →\\ntokentracker.cc"},xW={"landing.handle.default":"VIBE_USER","landing.handle.special":"伏特","landing.hero.title_primary":"实时追踪你的","landing.hero.title_secondary":"AI Token","landing.hero.tagline":"统一的用量仪表板","landing.hero.subtagline":"自动监控 Claude Code、Cursor、Codex 等工具的 Token 用量。本地优先、注重隐私、零配置。","landing.screenshot.alt":"TokenTracker 仪表板截图","landing.nav.login":"登录","landing.nav.signup":"注册","landing.nav.login_signup":"登录 / 注册","landing.seo.title":"面向 AI Coding CLI 的安全 Token 用量追踪","landing.seo.summary":"自动监控 Claude Code、Cursor、Codex 等工具的 Token 用量。本地优先、注重隐私、零配置。","landing.install.title":"一行命令即可安装","landing.install.prompt":"在终端里运行:","landing.install.command":"npx --yes tokentracker-cli","landing.install.helper":"然后连接你的账号,开始同步用量。","landing.install.action.copy":"复制命令","landing.install.action.copied":"已复制","landing.ai_agent.title":"让 AI 帮你安装","landing.ai_agent.description":"复制下面的指南,粘贴给 ChatGPT、Claude 或任意 AI 助手——它会自动帮你装好 TokenTracker。","landing.ai_agent.command":"https://github.com/mm7894215/TokenTracker/blob/main/docs/AI_AGENT_INSTALL.md","landing.ai_agent.copy_label":"复制指南链接","landing.ai_agent.helper":"或点击直接打开指南手动复制。","landing.ai_agent.guide_url":"https://github.com/mm7894215/TokenTracker/blob/main/docs/AI_AGENT_INSTALL.md","landing.meta.title":"Token Tracker —— AI Coding CLI 的 Token 用量追踪器","landing.meta.description":"自动监控 Claude Code、Cursor、Codex 等工具的 Token 用量。本地优先、注重隐私、零配置。","landing.meta.og_site_name":"Token Tracker","landing.meta.og_type":"website","landing.meta.og_image":"https://www.tokentracker.cc/og-image.jpg","landing.meta.og_url":"https://www.tokentracker.cc/","landing.meta.twitter_card":"summary_large_image","share.meta.title":"Token Tracker 分享","share.meta.description":"分享你的 Token Tracker 仪表板快照,包含跨模型、项目和时间窗口的用量洞察。","share.meta.og_site_name":"Token Tracker","share.meta.og_type":"website","share.meta.og_image":"https://www.tokentracker.cc/share-dashboard.jpg","share.meta.og_url":"https://www.tokentracker.cc/share","share.meta.twitter_card":"summary_large_image","landing.seo.point1":"自动追踪 AI CLI 的 Token 用量,零手动操作。","landing.seo.point2":"矩阵式界面,关键信号一目了然。","landing.seo.point3":"通用 AI CLI 排行榜,对比用量与排名。","landing.seo.roadmap":"原生支持 Codex、Claude Code 与 Gemini CLI。","landing.signal.identity_probe":"身份探测","landing.signal.live_sniffer":"实时嗅探","landing.handle.label":"设置 Handle","landing.handle.placeholder":"试试 “{{handle}}”","landing.rank.expectation":"预期排名:{{rank}}","landing.rank.singularity":"登顶","landing.rank.unranked":"未上榜","landing.cta.initialize":"进入仪表板","landing.cta.subtext":"连接 GitHub","landing.cta.primary":"进入仪表板","landing.cta.secondary":"查看 GitHub 源码","landing.cta.login_signup":"进入仪表板","landing.footer.link.manifesto":"宣言","landing.footer.link.docs":"文档","landing.footer.link.security":"安全","landing.footer.system_ready":"System_Ready // 2026 TokenTracker OS","landing.v2.hero.title_line1":"追踪你所有的","landing.v2.hero.title_line2":"AI Token","landing.v2.hero.subtitle":"统一的用量仪表板","landing.v2.install.btn_copy":"复制命令","landing.v2.install.mac_cta":"Mac 应用 (DMG)","landing.v2.models.title":"支持的 AI CLI 工具","landing.v2.compare.kicker":"无缝追踪","landing.v2.compare.title":"别再瞎猜你的 AI 用量。","landing.v2.compare.subtitle":"AI CLI 把用量数据藏在零散的本地文件里。TokenTracker 把它们实时聚合到一个清晰的仪表板里。","landing.v2.distill.body":"100% 本地处理,不上传任何 prompt 或代码。","landing.v2.compare.with.title":"用 Token Tracker","landing.v2.compare.with.p1":"集中式用量仪表板","landing.v2.compare.with.p2":"实时 Token 指标","landing.v2.compare.with.p3":"100% 本地,隐私无忧","landing.v2.compare.without.title":"不用","landing.v2.compare.without.p1":"散落的 JSON 日志文件","landing.v2.compare.without.p2":"对 Token 消耗一无所知","landing.v2.compare.without.p3":"突如其来的 API 账单","landing.v2.footer.line":"Token Tracker —— 开发者打造,服务开发者。","landing.v2.nav.github":"GitHub","landing.v2.models.agent.codex":"Codex","landing.v2.models.agent.claude_code":"Claude Code","landing.v2.models.agent.cursor":"Cursor","landing.v2.models.agent.gemini":"Gemini","landing.v2.models.agent.opencode":"OpenCode","landing.v2.models.agent.openclaw":"OpenClaw","landing.v2.cta.primary":"进入仪表板","landing.v2.hero.subtagline":"自动监控 Claude Code、Cursor、Codex 等工具的 Token 用量。本地优先、注重隐私、零配置。","signalbox.title_default":"关联","archive.title":"档案网格","archive.footer.left":"年度网格","leaderboard.nav.open":"$ 排行榜","leaderboard.nav.back":"$ 仪表板","leaderboard.profile.nav.back":"$ 排行榜","leaderboard.title":"排行榜","leaderboard.range":"UTC {{period}} · {{from}} – {{to}}","leaderboard.range_loading":"UTC {{period}} · …","leaderboard.range.total":"全部时间","leaderboard.generated_at":"更新于 {{ts}}","leaderboard.period.week":"周","leaderboard.period.month":"月","leaderboard.period.total":"全部","leaderboard.metric.all":"全部","leaderboard.metric.gpt":"GPT","leaderboard.metric.claude":"Claude","leaderboard.me_label":"你","leaderboard.anon_label":"匿名","leaderboard.public_profile.label":"公开主页","leaderboard.public_profile.status.enabled":"已开启","leaderboard.public_profile.status.disabled":"已关闭","leaderboard.error.unknown":"未知错误","leaderboard.me_card.title":"我的排名","leaderboard.me_card.subtitle":"本周","leaderboard.profile.card.title":"个人主页","leaderboard.profile.card.subtitle":"{{period}}","leaderboard.top10.title":"前 10 名","leaderboard.top10.subtitle":"前 9 名加上你","leaderboard.table.title":"完整榜单","leaderboard.table.subtitle":"分页显示","leaderboard.loading":"加载中…","leaderboard.empty":"暂无数据","leaderboard.column.rank":"排名","leaderboard.column.user":"用户","leaderboard.column.total":"总计","leaderboard.column.codex":"Codex","leaderboard.column.claude":"Claude","leaderboard.column.gemini":"Gemini","leaderboard.column.cursor":"Cursor","leaderboard.column.opencode":"OpenCode","leaderboard.column.openclaw":"OpenClaw","leaderboard.column.hermes":"Hermes","leaderboard.column.kiro":"Kiro","leaderboard.column.copilot":"Copilot","leaderboard.column.kimi":"Kimi","leaderboard.column.supplemental":"其他","leaderboard.column.est_cost":"预估花费","leaderboard.signin_prompt":"登录后即可上榜","leaderboard.signin_button":"登录","leaderboard.sync_prompt":"开启云同步即可参与排名","leaderboard.sync_button.idle":"开启并同步","leaderboard.sync_button.busy":"同步中…","leaderboard.pagination.page_size_label":"每页显示","landing.oauth.google":"使用 Google 继续","landing.oauth.github":"使用 GitHub 继续","leaderboard.pagination.prev":"上一页","leaderboard.pagination.next":"下一页","leaderboard.pagination.ellipsis":"……","leaderboard.pagination.page_unknown":"第 {{page}} 页","share.modal.title":"分享你的数据","share.modal.subtitle":"生成海报卡片,随处分享。","share.modal.close":"关闭","share.modal.action.x":"分享到 X","share.modal.action.download":"下载","share.modal.action.copy":"复制图片","share.modal.hint.x":"把图片粘贴到推文里","share.modal.hint.copy":"到剪贴板","share.modal.name_label":"显示名称","share.modal.name_placeholder":"输入你的名字","share.modal.style_label":"样式","share.modal.footer":"数据始终保留在本地——图片在你的浏览器内生成,绝不上传。","share.button.label":"分享","share.button.aria":"打开分享卡片","share.toast.copied":"图片已复制到剪贴板","share.toast.downloaded":"图片已保存","share.toast.failed":"图片生成失败","share.toast.working":"生成中…","share.variant.neon":"霓虹","share.variant.broadsheet":"特刊","share.date.month_year":"{{year}} 年 {{month}}","share.issue.all_time":"总计","share.month_short.jan":"1 月","share.month_short.feb":"2 月","share.month_short.mar":"3 月","share.month_short.apr":"4 月","share.month_short.may":"5 月","share.month_short.jun":"6 月","share.month_short.jul":"7 月","share.month_short.aug":"8 月","share.month_short.sep":"9 月","share.month_short.oct":"10 月","share.month_short.nov":"11 月","share.month_short.dec":"12 月","share.hook.top_loyal":"{{name}} 占了 {{percent}}% 的用量。","share.hook.days_record":"共记录 {{days}} 天。","share.hook.top_led":"{{name}} 领跑,占比 {{percent}}%。","share.hook.multi_models":"{{days}} 天里用了 {{count}} 个模型。","share.hook.days_with_model":"{{name}} 陪你跑了 {{days}} 天。","share.hook.new_chapter":"新的记录,从这里开始。","share.card.broadsheet.issue":"期号","share.card.broadsheet.by":"分享者","share.card.broadsheet.tracked_since":"追踪起始","share.card.broadsheet.total_tokens":"总 Token 数","share.card.broadsheet.estimated_spend":"预估花费","share.card.broadsheet.billable_days":"{{days}} 个活跃日","share.card.broadsheet.heatmap_title":"年度热图","share.card.broadsheet.heatmap_days_on_record":"{{active}} / {{total}} 天有记录","share.card.broadsheet.roster_title":"模型榜","share.card.broadsheet.roster_subtitle":"常用模型轮换","share.card.broadsheet.empty":"这一周很安静,还没有模型数据。","share.card.broadsheet.global_rank":"全站排名","share.card.broadsheet.active_days":"活跃","share.card.broadsheet.days_count":"{{days}} 天","share.card.broadsheet.track_yours":"追踪你自己的","share.card.annual.report_title":"用量报告","share.card.annual.less":"少","share.card.annual.more":"多","share.card.annual.heatmap_title":"Token 热图","share.card.annual.total_tokens":"总 Token 数","share.card.annual.estimated_cost":"预估成本","share.card.annual.longest_streak":"最长连击","share.card.annual.days_count":"{{days}} 天","share.card.annual.top_model":"热门模型"};function b3(){return typeof window>"u"?null:window.localStorage||null}function _3(){return typeof navigator>"u"?null:navigator.clipboard||null}function bW(){return typeof window>"u"?null:window.ClipboardItem||null}function _W(t,{storage:e}={}){const n=e??b3();if(!n||typeof n.getItem!="function")return null;try{return n.getItem(t)}catch{return null}}function wW(t,e,{storage:n}={}){const r=n??b3();if(!r||typeof r.setItem!="function")return!1;try{return r.setItem(t,e),!0}catch{return!1}}async function Fw(t,{clipboard:e}={}){const n=e??_3();if(!n||typeof n.writeText!="function")return!1;try{return await n.writeText(t),!0}catch{return!1}}async function Uw(t,{clipboard:e}={}){const n=e??_3(),r=bW();if(!t||!n||typeof n.write!="function"||!r)return!1;try{const i=t.type||"image/png",a=t.type&&t.type!==i?t.slice(0,t.size,i):t.type?t:t.slice(0,t.size,i),s=new r({[i]:a});return await n.write([s]),!0}catch{return!1}}const w3="tokentracker-locale",Xc="system",Kh="en",jy="zh-CN";function S3(t){return typeof t!="string"?Kh:/^zh(?:[-_]|$)/i.test(t.trim())?jy:Kh}function By(t){return t===Xc?Xc:S3(t)}function SW(){return typeof navigator>"u"?[]:Array.isArray(navigator.languages)&&navigator.languages.length?navigator.languages.filter(t=>typeof t=="string"):typeof navigator.language=="string"?[navigator.language]:[]}function H0(t,e=SW()){const n=By(t);if(n!==Xc)return n;const r=e.map(i=>typeof i=="string"?i.trim():"").find(i=>i.length>0);return r&&/^zh(?:[-_]|$)/i.test(r)?jy:Kh}function wk(){return By(_W(w3)||Xc)}function kW(t){return wW(w3,By(t))}const EW=["key","module","page","component","slot","text"],MW={[jy]:{...yW,...vW,...xW}};let wb=null,k3=H0(wk());function TW(t){const e=[];let n=[],r="",i=!1;for(let a=0;a<t.length;a+=1){const s=t[a];if(i){s==='"'?t[a+1]==='"'?(r+='"',a+=1):i=!1:r+=s;continue}if(s==='"'){i=!0;continue}if(s===","){n.push(r),r="";continue}if(s===`
787
787
  `){n.push(r),r="",n.every(o=>o.trim()==="")||e.push(n),n=[];continue}s!=="\r"&&(r+=s)}return n.push(r),n.every(a=>a.trim()==="")||e.push(n),e}function CW(t){const e=TW(t);if(!e.length)return{map:new Map,rows:[]};const n=e[0].map(o=>String(o).trim());if(EW.filter(o=>!n.includes(o)).length)return{map:new Map,rows:[]};const i=Object.fromEntries(n.map((o,c)=>[o,c])),a=[],s=new Map;return e.slice(1).forEach((o,c)=>{const u={key:String(o[i.key]||"").trim(),module:String(o[i.module]||"").trim(),page:String(o[i.page]||"").trim(),component:String(o[i.component]||"").trim(),slot:String(o[i.slot]||"").trim(),text:String(o[i.text]??"").trim()};u.key&&(s.has(u.key),s.set(u.key,u),a.push(u))}),{map:s,rows:a}}function AW(){return wb||(wb=CW(gW)),wb}function RW(){return MW[k3]||{}}function PW(t){const e=RW()[String(t)];return typeof e=="string"&&e.trim()?e:null}function NW(t,e){return e?t.replace(/\{\{(\w+)\}\}/g,(n,r)=>e[r]==null?n:String(e[r])):t}function DW(t){return String(t).replace(/\\n/g,`
788
788
  `)}function LW(t,e){return PW(e)||t?.text||e}function IW(t){k3=S3(t)}function F(t,e){const r=AW().map.get(t);return NW(DW(LW(r,t)),e)}const P2="tokentracker_native_app";let E3=null;const jw=new Set;typeof window<"u"&&window.addEventListener("native:systemAppearanceChanged",t=>{const e=t?.detail?.isDark;if(typeof e=="boolean"){E3=e;try{const n=document.documentElement;e?n.classList.add("dark"):n.classList.remove("dark")}catch{}jw.forEach(n=>{try{n(e)}catch{}})}});function N2(){return E3}function OW(t){return jw.add(t),()=>jw.delete(t)}function Sk(){if(typeof window>"u")return!1;try{if(new URLSearchParams(window.location.search).get("app")==="1"){try{window.localStorage.setItem(P2,"1")}catch{}return!0}return window.localStorage.getItem(P2)==="1"}catch{return!1}}function Za(){return typeof window>"u"?!1:!!window.webkit?.messageHandlers?.nativeBridge}function M3(){return typeof window>"u"?null:window.webkit?.messageHandlers?.nativeBridge??null}function FW(){return!!M3()}function kp(t){const e=M3();if(!e)return!1;try{return e.postMessage(t),!0}catch(n){return console.warn("[tokentracker] nativeBridge post failed:",n),!1}}function D2(){return kp({type:"getSettings"})}function Bw(t,e){return kp({type:"setSetting",key:t,value:e})}function T3(t){return kp({type:"action",name:t})}function UW(){return kp({type:"getSystemAppearance"})}function jW(t,e){if(!Za())return;kp({type:"setChromeAppearance",isDark:t==="dark",theme:e??"system"})}function BW(t){if(typeof window>"u")return()=>{};const e=n=>{n&&n.detail&&typeof n.detail=="object"&&t(n.detail)};return window.addEventListener("native:settings",e),()=>window.removeEventListener("native:settings",e)}const C3=x.createContext(null);function zW(){return H0(wk())}function VW(t){typeof document>"u"||(document.documentElement.lang=t)}function L2(t,e){IW(t),e(n=>n===t?n:t)}function HW({children:t}){const[e,n]=x.useState(wk),[r,i]=x.useState(zW);x.useLayoutEffect(()=>{VW(r)},[r]),x.useLayoutEffect(()=>{Za()&&Bw("locale",e)},[e]),x.useLayoutEffect(()=>{if(e!==Xc||typeof window>"u")return;const o=()=>L2(H0(Xc),i);return window.addEventListener("languagechange",o),()=>window.removeEventListener("languagechange",o)},[e]);const a=x.useCallback(o=>{const c=By(o);L2(H0(c),i),n(c),kW(c),Za()&&Bw("locale",c)},[]),s=x.useMemo(()=>({locale:e,setLocale:a,resolvedLocale:r}),[e,r,a]);return m.jsx(C3.Provider,{value:s,children:t})}var W0={},WW=()=>{window.va||(window.va=function(...e){window.vaq||(window.vaq=[]),window.vaq.push(e)})},GW="@vercel/analytics",$W="2.0.1";function A3(){return typeof window<"u"}function R3(){try{const t="production"}catch{}return"production"}function YW(t="auto"){if(t==="auto"){window.vam=R3();return}window.vam=t}function qW(){return(A3()?window.vam:R3())||"production"}function kk(){return qW()==="development"}function XW(t){return t.scriptSrc?xd(t.scriptSrc):kk()?"https://va.vercel-scripts.com/v1/script.debug.js":t.basePath?xd(`${t.basePath}/insights/script.js`):"/_vercel/insights/script.js"}function KW(t,e){var n;let r=t;if(e)try{r={...(n=JSON.parse(e))==null?void 0:n.analytics,...t}}catch{}YW(r.mode);const i={sdkn:GW+(r.framework?`/${r.framework}`:""),sdkv:$W};return r.disableAutoTrack&&(i.disableAutoTrack="1"),r.viewEndpoint&&(i.viewEndpoint=xd(r.viewEndpoint)),r.eventEndpoint&&(i.eventEndpoint=xd(r.eventEndpoint)),r.sessionEndpoint&&(i.sessionEndpoint=xd(r.sessionEndpoint)),kk()&&r.debug===!1&&(i.debug="false"),r.dsn&&(i.dsn=r.dsn),r.endpoint?i.endpoint=r.endpoint:r.basePath&&(i.endpoint=xd(`${r.basePath}/insights`)),{beforeSend:r.beforeSend,src:XW(r),dataset:i}}function xd(t){return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("/")?t:`/${t}`}function ZW(t={debug:!0},e){var n;if(!A3())return;const{beforeSend:r,src:i,dataset:a}=KW(t,e);if(WW(),r&&((n=window.va)==null||n.call(window,"beforeSend",r)),document.head.querySelector(`script[src*="${i}"]`))return;const s=document.createElement("script");s.src=i;for(const[o,c]of Object.entries(a))s.dataset[o]=c;s.defer=!0,s.onerror=()=>{const o=kk()?"Please check if any ad blockers are enabled and try again.":"Be sure to enable Web Analytics for your project and deploy again. See https://vercel.com/docs/analytics/quickstart for more information.";console.log(`[Vercel Web Analytics] Failed to load script from ${i}. ${o}`)},document.head.appendChild(s)}function JW({route:t,path:e}){var n;(n=window.va)==null||n.call(window,"pageview",{route:t,path:e})}function QW(){if(!(typeof process>"u"||typeof W0>"u"))return W0.REACT_APP_VERCEL_OBSERVABILITY_BASEPATH}function e7(){if(!(typeof process>"u"||typeof W0>"u"))return W0.REACT_APP_VERCEL_OBSERVABILITY_CLIENT_CONFIG}function t7(t){return x.useEffect(()=>{var e;t.beforeSend&&((e=window.va)==null||e.call(window,"beforeSend",t.beforeSend))},[t.beforeSend]),x.useEffect(()=>{ZW({framework:t.framework||"react",basePath:t.basePath??QW(),...t.route!==void 0&&{disableAutoTrack:!0},...t},t.configString??e7())},[]),x.useEffect(()=>{t.route&&t.path&&JW({route:t.route,path:t.path})},[t.route,t.path]),null}var G0={},n7=()=>{window.si||(window.si=function(...e){window.siq=window.siq||[],window.siq.push(e)})},r7="@vercel/speed-insights",i7="2.0.0";function a7(){return typeof window<"u"}function s7(){try{const t="production"}catch{}return"production"}function P3(){return s7()==="development"}function o7(t){return t.scriptSrc?$0(t.scriptSrc):P3()?"https://va.vercel-scripts.com/v1/speed-insights/script.debug.js":t.dsn?"https://va.vercel-scripts.com/v1/speed-insights/script.js":t.basePath?$0(`${t.basePath}/speed-insights/script.js`):"/_vercel/speed-insights/script.js"}function l7(t,e){var n;let r=t;if(e)try{r={...(n=JSON.parse(e))==null?void 0:n.speedInsights,...t}}catch{}const i={sdkn:r7+(r.framework?`/${r.framework}`:""),sdkv:i7};return r.sampleRate&&(i.sampleRate=r.sampleRate.toString()),r.route&&(i.route=r.route),P3()&&r.debug===!1&&(i.debug="false"),r.dsn&&(i.dsn=r.dsn),r.endpoint?i.endpoint=$0(r.endpoint):r.basePath&&(i.endpoint=$0(`${r.basePath}/speed-insights/vitals`)),{src:o7(r),beforeSend:r.beforeSend,dataset:i}}function $0(t){return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("/")?t:`/${t}`}function c7(t={},e){var n;if(!a7()||t.route===null)return null;n7();const{beforeSend:r,src:i,dataset:a}=l7(t,e);if(document.head.querySelector(`script[src*="${i}"]`))return null;r&&((n=window.si)==null||n.call(window,"beforeSend",r));const s=document.createElement("script");s.src=i,s.defer=!0;for(const[o,c]of Object.entries(a))s.dataset[o]=c;return s.onerror=()=>{console.log(`[Vercel Speed Insights] Failed to load script from ${i}. Please check if any content blockers are enabled and try again.`)},document.head.appendChild(s),{setRoute:o=>{s.dataset.route=o??void 0}}}function u7(){if(!(typeof process>"u"||typeof G0>"u"))return G0.REACT_APP_VERCEL_OBSERVABILITY_BASEPATH}function d7(){if(!(typeof process>"u"||typeof G0>"u"))return G0.REACT_APP_VERCEL_OBSERVABILITY_CLIENT_CONFIG}function f7(t){x.useEffect(()=>{var n;t.beforeSend&&((n=window.si)==null||n.call(window,"beforeSend",t.beforeSend))},[t.beforeSend]);const e=x.useRef(null);return x.useEffect(()=>{if(!e.current){const n=c7({framework:t.framework??"react",basePath:t.basePath??u7(),...t},t.configString??d7());n&&(e.current=n.setRoute)}},[t]),x.useEffect(()=>{e.current&&t.route&&e.current(t.route)},[t.route]),null}const N3=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim();const h7=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const p7=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase());const I2=t=>{const e=p7(t);return e.charAt(0).toUpperCase()+e.slice(1)};var Sb={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const m7=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0;return!1},g7=x.createContext({}),y7=()=>x.useContext(g7),v7=x.forwardRef(({color:t,size:e,strokeWidth:n,absoluteStrokeWidth:r,className:i="",children:a,iconNode:s,...o},c)=>{const{size:u=24,strokeWidth:f=2,absoluteStrokeWidth:h=!1,color:p="currentColor",className:y=""}=y7()??{},v=r??h?Number(n??f)*24/Number(e??u):n??f;return x.createElement("svg",{ref:c,...Sb,width:e??u??Sb.width,height:e??u??Sb.height,stroke:t??p,strokeWidth:v,className:N3("lucide",y,i),...!a&&!m7(o)&&{"aria-hidden":"true"},...o},[...s.map(([w,b])=>x.createElement(w,b)),...Array.isArray(a)?a:[a]])});const $n=(t,e)=>{const n=x.forwardRef(({className:r,...i},a)=>x.createElement(v7,{ref:a,iconNode:e,className:N3(`lucide-${h7(I2(t))}`,`lucide-${t}`,r),...i}));return n.displayName=I2(t),n};const x7=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],b7=$n("arrow-up-right",x7);const _7=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],w7=$n("chart-column",_7);const S7=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Ph=$n("check",S7);const k7=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],zy=$n("chevron-down",k7);const E7=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],Ek=$n("download",E7);const M7=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],T7=$n("external-link",M7);const C7=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],A7=$n("gauge",C7);const R7=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],P7=$n("globe",R7);const N7=[["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"}]],D7=$n("grip-vertical",N7);const L7=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],I7=$n("info",L7);const O7=[["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"}]],O2=$n("languages",O7);const F7=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],U7=$n("layout-grid",F7);const j7=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],El=$n("loader-circle",j7);const B7=[["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"}]],z7=$n("log-out",B7);const V7=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],H7=$n("mail",V7);const W7=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],G7=$n("menu",W7);const $7=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],Vy=$n("monitor",$7);const Y7=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],Mk=$n("moon",Y7);const q7=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],X7=$n("pencil",q7);const K7=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],D3=$n("plus",K7);const Z7=[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]],J7=$n("puzzle",Z7);const Q7=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Tk=$n("refresh-cw",Q7);const eG=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],F2=$n("search",eG);const tG=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],L3=$n("settings",tG);const nG=[["path",{d:"M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6",key:"y09zxi"}],["path",{d:"m21 3-9 9",key:"mpx6sq"}],["path",{d:"M15 3h6v6",key:"1q9fwt"}]],rG=$n("square-arrow-out-up-right",nG);const iG=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],Ck=$n("sun",iG);const aG=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],I3=$n("trash-2",aG);const sG=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],oG=$n("triangle-alert",sG);const lG=[["path",{d:"M10 14.66v1.626a2 2 0 0 1-.976 1.696A5 5 0 0 0 7 21.978",key:"1n3hpd"}],["path",{d:"M14 14.66v1.626a2 2 0 0 0 .976 1.696A5 5 0 0 1 17 21.978",key:"rfe1zi"}],["path",{d:"M18 9h1.5a1 1 0 0 0 0-5H18",key:"7xy6bh"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M6 9a6 6 0 0 0 12 0V3a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1z",key:"1mhfuq"}],["path",{d:"M6 9H4.5a1 1 0 0 1 0-5H6",key:"tex48p"}]],cG=$n("trophy",lG);const uG=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ak=$n("x",uG);function Ui({children:t,variant:e="primary",size:n="md",onClick:r,disabled:i=!1,className:a="",as:s="button",...o}){const c="inline-flex items-center justify-center font-medium transition-all duration-200 rounded-md focus:outline-none focus:ring-2 focus:ring-oai-blue/30 active:scale-[0.98] active:duration-100",u={primary:"bg-oai-black dark:bg-oai-white text-white dark:text-oai-black border border-transparent hover:bg-oai-gray-800 dark:hover:bg-oai-gray-200 active:bg-oai-gray-900 dark:active:bg-oai-gray-300 disabled:bg-oai-gray-300 dark:disabled:bg-oai-gray-700 disabled:text-oai-gray-500 dark:disabled:text-oai-gray-400 focus:ring-oai-brand/30 transition-colors duration-200",secondary:"bg-oai-white dark:bg-oai-gray-900 text-oai-black dark:text-oai-white border border-oai-gray-300 dark:border-oai-gray-700 hover:border-oai-brand hover:text-oai-brand active:bg-oai-gray-50 dark:active:bg-oai-gray-800 active:border-oai-brand-dark disabled:text-oai-gray-400 dark:disabled:text-oai-gray-500 disabled:border-oai-gray-200 dark:disabled:border-oai-gray-700 focus:ring-oai-brand/30 transition-colors duration-200",ghost:"bg-transparent text-oai-gray-600 dark:text-oai-gray-300 border border-transparent hover:text-oai-brand hover:bg-oai-brand-50/50 dark:hover:bg-oai-brand-950/30 active:bg-oai-brand-50 dark:active:bg-oai-brand-900/50 disabled:text-oai-gray-400 dark:disabled:text-oai-gray-500 focus:ring-oai-brand/30 transition-colors duration-200"},f={sm:"h-8 px-3 text-sm",md:"h-10 px-4 text-sm",lg:"h-12 px-6 text-base"},h=i?"cursor-not-allowed opacity-60":"cursor-pointer",p=`${c} ${u[e]} ${f[n]} ${h} ${a}`;return m.jsx(s,{className:p,onClick:r,disabled:i,...o,children:t})}class dG extends ot.Component{constructor(e){super(e),this.state={error:null},this.handleReload=this.handleReload.bind(this)}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,n){console.error("ErrorBoundary caught an error:",e)}handleReload(){typeof window>"u"||window.location.reload()}render(){const{error:e}=this.state;if(!e)return this.props.children;const n=String(e?.message||e||""),r=n?F("shared.error.prefix",{error:n}):F("error.boundary.no_details");return m.jsx("div",{className:"flex min-h-screen items-center justify-center bg-oai-white p-6 font-oai text-oai-black antialiased dark:bg-oai-gray-950 dark:text-oai-white",children:m.jsxs("div",{className:"w-full max-w-lg rounded-xl border border-oai-gray-200 bg-white p-6 text-center shadow-sm dark:border-oai-gray-800 dark:bg-oai-gray-900",children:[m.jsx("div",{className:"mx-auto flex h-10 w-10 items-center justify-center rounded-full bg-amber-50 text-amber-600 dark:bg-amber-950/30 dark:text-amber-300",children:m.jsx(oG,{className:"h-5 w-5","aria-hidden":!0})}),m.jsx("div",{className:"mt-4 text-xs font-medium uppercase text-oai-gray-500 dark:text-oai-gray-400",children:F("error.boundary.title")}),m.jsx("h1",{className:"mt-2 text-xl font-semibold text-oai-black dark:text-white",children:F("error.boundary.subtitle")}),m.jsx("p",{className:"mt-2 text-sm text-oai-gray-500 dark:text-oai-gray-400",children:F("error.boundary.hint")}),m.jsx("div",{className:"mt-4 max-h-32 overflow-auto rounded-lg border border-oai-gray-200 bg-oai-gray-50 px-3 py-2 text-left text-xs leading-5 text-oai-gray-600 dark:border-oai-gray-800 dark:bg-oai-gray-950 dark:text-oai-gray-300",children:r}),m.jsxs(Ui,{type:"button",size:"md",onClick:this.handleReload,className:"mt-5",children:[m.jsx(Tk,{className:"mr-2 h-4 w-4","aria-hidden":!0}),F("error.boundary.action.reload")]})]})})}}function su(){const t=x.useContext(C3);if(t===null)throw new Error("useLocale must be used within a LocaleProvider");return t}const zw="tokentracker-theme",O3=x.createContext(null);function fG(){if(typeof window>"u")return"system";try{const t=localStorage.getItem(zw);if(t==="light"||t==="dark"||t==="system")return t}catch{}return"system"}function sg(){return typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function hG(t){if(typeof document>"u")return;const e=document.documentElement;t==="dark"?e.classList.add("dark"):e.classList.remove("dark")}function pG({children:t}){const[e,n]=x.useState(fG),[r,i]=x.useState(()=>{if(e!=="system")return e;if(Za()){const u=N2();if(typeof u=="boolean")return u?"dark":"light"}return sg()}),a=x.useRef(e);x.useEffect(()=>{a.current=e},[e]),x.useEffect(()=>{hG(r)},[r]),x.useLayoutEffect(()=>{if(e==="system"){if(Za()){const u=N2();i(typeof u=="boolean"?u?"dark":"light":sg()),UW();return}i(sg())}else i(e)},[e]),x.useEffect(()=>Za()?OW(f=>{a.current==="system"&&i(f?"dark":"light")}):void 0,[]),x.useEffect(()=>{if(typeof window>"u"||e!=="system"||Za())return;const u=window.matchMedia("(prefers-color-scheme: dark)"),f=h=>{const p=h.matches?"dark":"light";i(p)};return u.addEventListener?(u.addEventListener("change",f),()=>u.removeEventListener("change",f)):(u.addListener(f),()=>u.removeListener(f))},[e]),x.useEffect(()=>{const u=e==="system"&&!Za()?sg():r;jW(u,e)},[r,e]);const s=x.useCallback(u=>{if(n(u),typeof window<"u")try{localStorage.setItem(zw,u)}catch{}},[]),o=x.useCallback(()=>{s(u=>{const f=u==="dark"?"light":"dark";if(typeof window<"u")try{localStorage.setItem(zw,f)}catch{}return f})},[]),c=x.useMemo(()=>({theme:e,setTheme:s,toggleTheme:o,resolvedTheme:r}),[e,s,o,r]);return m.jsx(O3.Provider,{value:c,children:t})}const F3=x.createContext({isOpen:!1,openLoginModal:()=>{},closeLoginModal:()=>{}});function mG({children:t}){const[e,n]=x.useState(!1),r=x.useCallback(()=>n(!0),[]),i=x.useCallback(()=>n(!1),[]);return m.jsx(F3.Provider,{value:{isOpen:e,openLoginModal:r,closeLoginModal:i},children:t})}function Ep(){return x.useContext(F3)}const Zh=x.createContext({});function Mp(t){const e=x.useRef(null);return e.current===null&&(e.current=t()),e.current}const gG=typeof window<"u",Hy=gG?x.useLayoutEffect:x.useEffect,Wy=x.createContext(null);function Rk(t,e){t.indexOf(e)===-1&&t.push(e)}function Y0(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const Vs=(t,e,n)=>n>e?e:n<t?t:n;let Pk=()=>{};const Dl={},U3=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function j3(t){return typeof t=="object"&&t!==null}const B3=t=>/^0[^.\s]+$/u.test(t);function z3(t){let e;return()=>(e===void 0&&(e=t()),e)}const Ca=t=>t,yG=(t,e)=>n=>e(t(n)),Tp=(...t)=>t.reduce(yG),Jh=(t,e,n)=>{const r=e-t;return r===0?1:(n-t)/r};class Nk{constructor(){this.subscriptions=[]}add(e){return Rk(this.subscriptions,e),()=>Y0(this.subscriptions,e)}notify(e,n,r){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](e,n,r);else for(let a=0;a<i;a++){const s=this.subscriptions[a];s&&s(e,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const oa=t=>t*1e3,Ma=t=>t/1e3;function V3(t,e){return e?t*(1e3/e):0}const H3=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,vG=1e-7,xG=12;function bG(t,e,n,r,i){let a,s,o=0;do s=e+(n-e)/2,a=H3(s,r,i)-t,a>0?n=s:e=s;while(Math.abs(a)>vG&&++o<xG);return s}function Cp(t,e,n,r){if(t===e&&n===r)return Ca;const i=a=>bG(a,0,1,t,n);return a=>a===0||a===1?a:H3(i(a),e,r)}const W3=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,G3=t=>e=>1-t(1-e),$3=Cp(.33,1.53,.69,.99),Dk=G3($3),Y3=W3(Dk),q3=t=>t>=1?1:(t*=2)<1?.5*Dk(t):.5*(2-Math.pow(2,-10*(t-1))),Lk=t=>1-Math.sin(Math.acos(t)),X3=G3(Lk),K3=W3(Lk),_G=Cp(.42,0,1,1),wG=Cp(0,0,.58,1),Z3=Cp(.42,0,.58,1),SG=t=>Array.isArray(t)&&typeof t[0]!="number",J3=t=>Array.isArray(t)&&typeof t[0]=="number",kG={linear:Ca,easeIn:_G,easeInOut:Z3,easeOut:wG,circIn:Lk,circInOut:K3,circOut:X3,backIn:Dk,backInOut:Y3,backOut:$3,anticipate:q3},EG=t=>typeof t=="string",U2=t=>{if(J3(t)){Pk(t.length===4);const[e,n,r,i]=t;return Cp(e,n,r,i)}else if(EG(t))return kG[t];return t},og=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function MG(t,e){let n=new Set,r=new Set,i=!1,a=!1;const s=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function c(f){s.has(f)&&(u.schedule(f),t()),f(o)}const u={schedule:(f,h=!1,p=!1)=>{const v=p&&i?n:r;return h&&s.add(f),v.add(f),f},cancel:f=>{r.delete(f),s.delete(f)},process:f=>{if(o=f,i){a=!0;return}i=!0;const h=n;n=r,r=h,n.forEach(c),n.clear(),i=!1,a&&(a=!1,u.process(f))}};return u}const TG=40;function Q3(t,e){let n=!1,r=!0;const i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,s=og.reduce((M,T)=>(M[T]=MG(a),M),{}),{setup:o,read:c,resolveKeyframes:u,preUpdate:f,update:h,preRender:p,render:y,postRender:v}=s,w=()=>{const M=Dl.useManualTiming,T=M?i.timestamp:performance.now();n=!1,M||(i.delta=r?1e3/60:Math.max(Math.min(T-i.timestamp,TG),1)),i.timestamp=T,i.isProcessing=!0,o.process(i),c.process(i),u.process(i),f.process(i),h.process(i),p.process(i),y.process(i),v.process(i),i.isProcessing=!1,n&&e&&(r=!1,t(w))},b=()=>{n=!0,r=!0,i.isProcessing||t(w)};return{schedule:og.reduce((M,T)=>{const R=s[T];return M[T]=(A,P=!1,k=!1)=>(n||b(),R.schedule(A,P,k)),M},{}),cancel:M=>{for(let T=0;T<og.length;T++)s[og[T]].cancel(M)},state:i,steps:s}}const{schedule:Wn,cancel:Po,state:Qr,steps:kb}=Q3(typeof requestAnimationFrame<"u"?requestAnimationFrame:Ca,!0);let c0;function CG(){c0=void 0}const Si={now:()=>(c0===void 0&&Si.set(Qr.isProcessing||Dl.useManualTiming?Qr.timestamp:performance.now()),c0),set:t=>{c0=t,queueMicrotask(CG)}},eI=t=>e=>typeof e=="string"&&e.startsWith(t),tI=eI("--"),AG=eI("var(--"),Ik=t=>AG(t)?RG.test(t.split("/*")[0].trim()):!1,RG=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function j2(t){return typeof t!="string"?!1:t.split("/*")[0].includes("var(--")}const tf={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},Qh={...tf,transform:t=>Vs(0,1,t)},lg={...tf,default:1},Nh=t=>Math.round(t*1e5)/1e5,Ok=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function PG(t){return t==null}const NG=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Fk=(t,e)=>n=>!!(typeof n=="string"&&NG.test(n)&&n.startsWith(t)||e&&!PG(n)&&Object.prototype.hasOwnProperty.call(n,e)),nI=(t,e,n)=>r=>{if(typeof r!="string")return r;const[i,a,s,o]=r.match(Ok);return{[t]:parseFloat(i),[e]:parseFloat(a),[n]:parseFloat(s),alpha:o!==void 0?parseFloat(o):1}},DG=t=>Vs(0,255,t),Eb={...tf,transform:t=>Math.round(DG(t))},Ac={test:Fk("rgb","red"),parse:nI("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+Eb.transform(t)+", "+Eb.transform(e)+", "+Eb.transform(n)+", "+Nh(Qh.transform(r))+")"};function LG(t){let e="",n="",r="",i="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),r=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),r=t.substring(3,4),i=t.substring(4,5),e+=e,n+=n,r+=r,i+=i),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}const Vw={test:Fk("#"),parse:LG,transform:Ac.transform},Ap=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),hl=Ap("deg"),Ls=Ap("%"),Ot=Ap("px"),IG=Ap("vh"),OG=Ap("vw"),B2={...Ls,parse:t=>Ls.parse(t)/100,transform:t=>Ls.transform(t*100)},bd={test:Fk("hsl","hue"),parse:nI("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+Ls.transform(Nh(e))+", "+Ls.transform(Nh(n))+", "+Nh(Qh.transform(r))+")"},Tr={test:t=>Ac.test(t)||Vw.test(t)||bd.test(t),parse:t=>Ac.test(t)?Ac.parse(t):bd.test(t)?bd.parse(t):Vw.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?Ac.transform(t):bd.transform(t),getAnimatableNone:t=>{const e=Tr.parse(t);return e.alpha=0,Tr.transform(e)}},FG=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function UG(t){return isNaN(t)&&typeof t=="string"&&(t.match(Ok)?.length||0)+(t.match(FG)?.length||0)>0}const rI="number",iI="color",jG="var",BG="var(",z2="${}",zG=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Fd(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},i=[];let a=0;const o=e.replace(zG,c=>(Tr.test(c)?(r.color.push(a),i.push(iI),n.push(Tr.parse(c))):c.startsWith(BG)?(r.var.push(a),i.push(jG),n.push(c)):(r.number.push(a),i.push(rI),n.push(parseFloat(c))),++a,z2)).split(z2);return{values:n,split:o,indexes:r,types:i}}function VG(t){return Fd(t).values}function aI({split:t,types:e}){const n=t.length;return r=>{let i="";for(let a=0;a<n;a++)if(i+=t[a],r[a]!==void 0){const s=e[a];s===rI?i+=Nh(r[a]):s===iI?i+=Tr.transform(r[a]):i+=r[a]}return i}}function HG(t){return aI(Fd(t))}const WG=t=>typeof t=="number"?0:Tr.test(t)?Tr.getAnimatableNone(t):t,GG=(t,e)=>typeof t=="number"?e?.trim().endsWith("/")?t:0:WG(t);function $G(t){const e=Fd(t);return aI(e)(e.values.map((r,i)=>GG(r,e.split[i])))}const rs={test:UG,parse:VG,createTransformer:HG,getAnimatableNone:$G};function Mb(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function YG({hue:t,saturation:e,lightness:n,alpha:r}){t/=360,e/=100,n/=100;let i=0,a=0,s=0;if(!e)i=a=s=n;else{const o=n<.5?n*(1+e):n+e-n*e,c=2*n-o;i=Mb(c,o,t+1/3),a=Mb(c,o,t),s=Mb(c,o,t-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(s*255),alpha:r}}function q0(t,e){return n=>n>0?e:t}const ar=(t,e,n)=>t+(e-t)*n,Tb=(t,e,n)=>{const r=t*t,i=n*(e*e-r)+r;return i<0?0:Math.sqrt(i)},qG=[Vw,Ac,bd],XG=t=>qG.find(e=>e.test(t));function V2(t){const e=XG(t);if(!e)return!1;let n=e.parse(t);return e===bd&&(n=YG(n)),n}const H2=(t,e)=>{const n=V2(t),r=V2(e);if(!n||!r)return q0(t,e);const i={...n};return a=>(i.red=Tb(n.red,r.red,a),i.green=Tb(n.green,r.green,a),i.blue=Tb(n.blue,r.blue,a),i.alpha=ar(n.alpha,r.alpha,a),Ac.transform(i))},Hw=new Set(["none","hidden"]);function KG(t,e){return Hw.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function ZG(t,e){return n=>ar(t,e,n)}function Uk(t){return typeof t=="number"?ZG:typeof t=="string"?Ik(t)?q0:Tr.test(t)?H2:e$:Array.isArray(t)?sI:typeof t=="object"?Tr.test(t)?H2:JG:q0}function sI(t,e){const n=[...t],r=n.length,i=t.map((a,s)=>Uk(a)(a,e[s]));return a=>{for(let s=0;s<r;s++)n[s]=i[s](a);return n}}function JG(t,e){const n={...t,...e},r={};for(const i in n)t[i]!==void 0&&e[i]!==void 0&&(r[i]=Uk(t[i])(t[i],e[i]));return i=>{for(const a in r)n[a]=r[a](i);return n}}function QG(t,e){const n=[],r={color:0,var:0,number:0};for(let i=0;i<e.values.length;i++){const a=e.types[i],s=t.indexes[a][r[a]],o=t.values[s]??0;n[i]=o,r[a]++}return n}const e$=(t,e)=>{const n=rs.createTransformer(e),r=Fd(t),i=Fd(e);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?Hw.has(t)&&!i.values.length||Hw.has(e)&&!r.values.length?KG(t,e):Tp(sI(QG(r,i),i.values),n):q0(t,e)};function oI(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?ar(t,e,n):Uk(t)(t,e)}const t$=t=>{const e=({timestamp:n})=>t(n);return{start:(n=!0)=>Wn.update(e,n),stop:()=>Po(e),now:()=>Qr.isProcessing?Qr.timestamp:Si.now()}},lI=(t,e,n=10)=>{let r="";const i=Math.max(Math.round(e/n),2);for(let a=0;a<i;a++)r+=Math.round(t(a/(i-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},X0=2e4;function jk(t){let e=0;const n=50;let r=t.next(e);for(;!r.done&&e<X0;)e+=n,r=t.next(e);return e>=X0?1/0:e}function n$(t,e=100,n){const r=n({...t,keyframes:[0,e]}),i=Math.min(jk(r),X0);return{type:"keyframes",ease:a=>r.next(i*a).value/e,duration:Ma(i)}}const gr={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function Ww(t,e){return t*Math.sqrt(1-e*e)}const r$=12;function i$(t,e,n){let r=n;for(let i=1;i<r$;i++)r=r-t(r)/e(r);return r}const Cb=.001;function a$({duration:t=gr.duration,bounce:e=gr.bounce,velocity:n=gr.velocity,mass:r=gr.mass}){let i,a,s=1-e;s=Vs(gr.minDamping,gr.maxDamping,s),t=Vs(gr.minDuration,gr.maxDuration,Ma(t)),s<1?(i=u=>{const f=u*s,h=f*t,p=f-n,y=Ww(u,s),v=Math.exp(-h);return Cb-p/y*v},a=u=>{const h=u*s*t,p=h*n+n,y=Math.pow(s,2)*Math.pow(u,2)*t,v=Math.exp(-h),w=Ww(Math.pow(u,2),s);return(-i(u)+Cb>0?-1:1)*((p-y)*v)/w}):(i=u=>{const f=Math.exp(-u*t),h=(u-n)*t+1;return-Cb+f*h},a=u=>{const f=Math.exp(-u*t),h=(n-u)*(t*t);return f*h});const o=5/t,c=i$(i,a,o);if(t=oa(t),isNaN(c))return{stiffness:gr.stiffness,damping:gr.damping,duration:t};{const u=Math.pow(c,2)*r;return{stiffness:u,damping:s*2*Math.sqrt(r*u),duration:t}}}const s$=["duration","bounce"],o$=["stiffness","damping","mass"];function W2(t,e){return e.some(n=>t[n]!==void 0)}function l$(t){let e={velocity:gr.velocity,stiffness:gr.stiffness,damping:gr.damping,mass:gr.mass,isResolvedFromDuration:!1,...t};if(!W2(t,o$)&&W2(t,s$))if(e.velocity=0,t.visualDuration){const n=t.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,a=2*Vs(.05,1,1-(t.bounce||0))*Math.sqrt(i);e={...e,mass:gr.mass,stiffness:i,damping:a}}else{const n=a$({...t,velocity:0});e={...e,...n,mass:gr.mass},e.isResolvedFromDuration=!0}return e}function K0(t=gr.visualDuration,e=gr.bounce){const n=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:r,restDelta:i}=n;const a=n.keyframes[0],s=n.keyframes[n.keyframes.length-1],o={done:!1,value:a},{stiffness:c,damping:u,mass:f,duration:h,velocity:p,isResolvedFromDuration:y}=l$({...n,velocity:-Ma(n.velocity||0)}),v=p||0,w=u/(2*Math.sqrt(c*f)),b=s-a,_=Ma(Math.sqrt(c/f)),E=Math.abs(b)<5;r||(r=E?gr.restSpeed.granular:gr.restSpeed.default),i||(i=E?gr.restDelta.granular:gr.restDelta.default);let M,T,R,A,P,k;if(w<1)R=Ww(_,w),A=(v+w*_*b)/R,M=j=>{const L=Math.exp(-w*_*j);return s-L*(A*Math.sin(R*j)+b*Math.cos(R*j))},P=w*_*A+b*R,k=w*_*b-A*R,T=j=>Math.exp(-w*_*j)*(P*Math.sin(R*j)+k*Math.cos(R*j));else if(w===1){M=L=>s-Math.exp(-_*L)*(b+(v+_*b)*L);const j=v+_*b;T=L=>Math.exp(-_*L)*(_*j*L-v)}else{const j=_*Math.sqrt(w*w-1);M=V=>{const W=Math.exp(-w*_*V),K=Math.min(j*V,300);return s-W*((v+w*_*b)*Math.sinh(K)+j*b*Math.cosh(K))/j};const L=(v+w*_*b)/j,z=w*_*L-b*j,U=w*_*b-L*j;T=V=>{const W=Math.exp(-w*_*V),K=Math.min(j*V,300);return W*(z*Math.sinh(K)+U*Math.cosh(K))}}const N={calculatedDuration:y&&h||null,velocity:j=>oa(T(j)),next:j=>{if(!y&&w<1){const z=Math.exp(-w*_*j),U=Math.sin(R*j),V=Math.cos(R*j),W=s-z*(A*U+b*V),K=oa(z*(P*U+k*V));return o.done=Math.abs(K)<=r&&Math.abs(s-W)<=i,o.value=o.done?s:W,o}const L=M(j);if(y)o.done=j>=h;else{const z=oa(T(j));o.done=Math.abs(z)<=r&&Math.abs(s-L)<=i}return o.value=o.done?s:L,o},toString:()=>{const j=Math.min(jk(N),X0),L=lI(z=>N.next(j*z).value,j,30);return j+"ms "+L},toTransition:()=>{}};return N}K0.applyToOptions=t=>{const e=n$(t,100,K0);return t.ease=e.ease,t.duration=oa(e.duration),t.type="keyframes",t};const c$=5;function cI(t,e,n){const r=Math.max(e-c$,0);return V3(n-t(r),e-r)}function Gw({keyframes:t,velocity:e=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:s,min:o,max:c,restDelta:u=.5,restSpeed:f}){const h=t[0],p={done:!1,value:h},y=k=>o!==void 0&&k<o||c!==void 0&&k>c,v=k=>o===void 0?c:c===void 0||Math.abs(o-k)<Math.abs(c-k)?o:c;let w=n*e;const b=h+w,_=s===void 0?b:s(b);_!==b&&(w=_-h);const E=k=>-w*Math.exp(-k/r),M=k=>_+E(k),T=k=>{const N=E(k),j=M(k);p.done=Math.abs(N)<=u,p.value=p.done?_:j};let R,A;const P=k=>{y(p.value)&&(R=k,A=K0({keyframes:[p.value,v(p.value)],velocity:cI(M,k,p.value),damping:i,stiffness:a,restDelta:u,restSpeed:f}))};return P(0),{calculatedDuration:null,next:k=>{let N=!1;return!A&&R===void 0&&(N=!0,T(k),P(k)),R!==void 0&&k>=R?A.next(k-R):(!N&&T(k),p)}}}function u$(t,e,n){const r=[],i=n||Dl.mix||oI,a=t.length-1;for(let s=0;s<a;s++){let o=i(t[s],t[s+1]);if(e){const c=Array.isArray(e)?e[s]||Ca:e;o=Tp(c,o)}r.push(o)}return r}function uI(t,e,{clamp:n=!0,ease:r,mixer:i}={}){const a=t.length;if(Pk(a===e.length),a===1)return()=>e[0];if(a===2&&e[0]===e[1])return()=>e[1];const s=t[0]===t[1];t[0]>t[a-1]&&(t=[...t].reverse(),e=[...e].reverse());const o=u$(e,r,i),c=o.length,u=f=>{if(s&&f<t[0])return e[0];let h=0;if(c>1)for(;h<t.length-2&&!(f<t[h+1]);h++);const p=Jh(t[h],t[h+1],f);return o[h](p)};return n?f=>u(Vs(t[0],t[a-1],f)):u}function d$(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const i=Jh(0,e,r);t.push(ar(n,1,i))}}function f$(t){const e=[0];return d$(e,t.length-1),e}function h$(t,e){return t.map(n=>n*e)}function p$(t,e){return t.map(()=>e||Z3).splice(0,t.length-1)}function Dh({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const i=SG(r)?r.map(U2):U2(r),a={done:!1,value:e[0]},s=h$(n&&n.length===e.length?n:f$(e),t),o=uI(s,e,{ease:Array.isArray(i)?i:p$(e,i)});return{calculatedDuration:t,next:c=>(a.value=o(c),a.done=c>=t,a)}}const m$=t=>t!==null;function Gy(t,{repeat:e,repeatType:n="loop"},r,i=1){const a=t.filter(m$),o=i<0||e&&n!=="loop"&&e%2===1?0:a.length-1;return!o||r===void 0?a[o]:r}const g$={decay:Gw,inertia:Gw,tween:Dh,keyframes:Dh,spring:K0};function dI(t){typeof t.type=="string"&&(t.type=g$[t.type])}class Bk{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,n){return this.finished.then(e,n)}}const y$=t=>t/100;class ep extends Bk{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{const{motionValue:n}=this.options;n&&n.updatedAt!==Si.now()&&this.tick(Si.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;dI(e);const{type:n=Dh,repeat:r=0,repeatDelay:i=0,repeatType:a,velocity:s=0}=e;let{keyframes:o}=e;const c=n||Dh;c!==Dh&&typeof o[0]!="number"&&(this.mixKeyframes=Tp(y$,oI(o[0],o[1])),o=[0,100]);const u=c({...e,keyframes:o});a==="mirror"&&(this.mirroredGenerator=c({...e,keyframes:[...o].reverse(),velocity:-s})),u.calculatedDuration===null&&(u.calculatedDuration=jk(u));const{calculatedDuration:f}=u;this.calculatedDuration=f,this.resolvedDuration=f+i,this.totalDuration=this.resolvedDuration*(r+1)-i,this.generator=u}updateTime(e){const n=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(e,n=!1){const{generator:r,totalDuration:i,mixKeyframes:a,mirroredGenerator:s,resolvedDuration:o,calculatedDuration:c}=this;if(this.startTime===null)return r.next(0);const{delay:u=0,keyframes:f,repeat:h,repeatType:p,repeatDelay:y,type:v,onUpdate:w,finalKeyframe:b}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-i/this.speed,this.startTime)),n?this.currentTime=e:this.updateTime(e);const _=this.currentTime-u*(this.playbackSpeed>=0?1:-1),E=this.playbackSpeed>=0?_<0:_>i;this.currentTime=Math.max(_,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=i);let M=this.currentTime,T=r;if(h){const k=Math.min(this.currentTime,i)/o;let N=Math.floor(k),j=k%1;!j&&k>=1&&(j=1),j===1&&N--,N=Math.min(N,h+1),N%2&&(p==="reverse"?(j=1-j,y&&(j-=y/o)):p==="mirror"&&(T=s)),M=Vs(0,1,j)*o}let R;E?(this.delayState.value=f[0],R=this.delayState):R=T.next(M),a&&!E&&(R.value=a(R.value));let{done:A}=R;!E&&c!==null&&(A=this.playbackSpeed>=0?this.currentTime>=i:this.currentTime<=0);const P=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&A);return P&&v!==Gw&&(R.value=Gy(f,this.options,b,this.speed)),w&&w(R.value),P&&this.finish(),R}then(e,n){return this.finished.then(e,n)}get duration(){return Ma(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Ma(e)}get time(){return Ma(this.currentTime)}set time(e){e=oa(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=e,this.tick(e))}getGeneratorVelocity(){const e=this.currentTime;if(e<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(e);const n=this.generator.next(e).value;return cI(r=>this.generator.next(r).value,e,n)}get speed(){return this.playbackSpeed}set speed(e){const n=this.playbackSpeed!==e;n&&this.driver&&this.updateTime(Si.now()),this.playbackSpeed=e,n&&this.driver&&(this.time=Ma(this.currentTime))}play(){if(this.isStopped)return;const{driver:e=t$,startTime:n}=this.options;this.driver||(this.driver=e(i=>this.tick(i))),this.options.onPlay?.();const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=n??r),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(Si.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),e.observe(this)}}function v$(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const Rc=t=>t*180/Math.PI,$w=t=>{const e=Rc(Math.atan2(t[1],t[0]));return Yw(e)},x$={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:$w,rotateZ:$w,skewX:t=>Rc(Math.atan(t[1])),skewY:t=>Rc(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},Yw=t=>(t=t%360,t<0&&(t+=360),t),G2=$w,$2=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),Y2=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),b$={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:$2,scaleY:Y2,scale:t=>($2(t)+Y2(t))/2,rotateX:t=>Yw(Rc(Math.atan2(t[6],t[5]))),rotateY:t=>Yw(Rc(Math.atan2(-t[2],t[0]))),rotateZ:G2,rotate:G2,skewX:t=>Rc(Math.atan(t[4])),skewY:t=>Rc(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function qw(t){return t.includes("scale")?1:0}function Xw(t,e){if(!t||t==="none")return qw(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,i;if(n)r=b$,i=n;else{const o=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=x$,i=o}if(!i)return qw(e);const a=r[e],s=i[1].split(",").map(w$);return typeof a=="function"?a(s):s[a]}const _$=(t,e)=>{const{transform:n="none"}=getComputedStyle(t);return Xw(n,e)};function w$(t){return parseFloat(t.trim())}const nf=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],rf=new Set(nf),q2=t=>t===tf||t===Ot,S$=new Set(["x","y","z"]),k$=nf.filter(t=>!S$.has(t));function E$(t){const e=[];return k$.forEach(n=>{const r=t.getValue(n);r!==void 0&&(e.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),e}const _l={width:({x:t},{paddingLeft:e="0",paddingRight:n="0",boxSizing:r})=>{const i=t.max-t.min;return r==="border-box"?i:i-parseFloat(e)-parseFloat(n)},height:({y:t},{paddingTop:e="0",paddingBottom:n="0",boxSizing:r})=>{const i=t.max-t.min;return r==="border-box"?i:i-parseFloat(e)-parseFloat(n)},top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>Xw(e,"x"),y:(t,{transform:e})=>Xw(e,"y")};_l.translateX=_l.x;_l.translateY=_l.y;const Fc=new Set;let Kw=!1,Zw=!1,Jw=!1;function fI(){if(Zw){const t=Array.from(Fc).filter(r=>r.needsMeasurement),e=new Set(t.map(r=>r.element)),n=new Map;e.forEach(r=>{const i=E$(r);i.length&&(n.set(r,i),r.render())}),t.forEach(r=>r.measureInitialState()),e.forEach(r=>{r.render();const i=n.get(r);i&&i.forEach(([a,s])=>{r.getValue(a)?.set(s)})}),t.forEach(r=>r.measureEndState()),t.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}Zw=!1,Kw=!1,Fc.forEach(t=>t.complete(Jw)),Fc.clear()}function hI(){Fc.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Zw=!0)})}function M$(){Jw=!0,hI(),fI(),Jw=!1}class zk{constructor(e,n,r,i,a,s=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=n,this.name=r,this.motionValue=i,this.element=a,this.isAsync=s}scheduleResolve(){this.state="scheduled",this.isAsync?(Fc.add(this),Kw||(Kw=!0,Wn.read(hI),Wn.resolveKeyframes(fI))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:n,element:r,motionValue:i}=this;if(e[0]===null){const a=i?.get(),s=e[e.length-1];if(a!==void 0)e[0]=a;else if(r&&n){const o=r.readValue(n,s);o!=null&&(e[0]=o)}e[0]===void 0&&(e[0]=s),i&&a===void 0&&i.set(e[0])}v$(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),Fc.delete(this)}cancel(){this.state==="scheduled"&&(Fc.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const T$=t=>t.startsWith("--");function pI(t,e,n){T$(e)?t.style.setProperty(e,n):t.style[e]=n}const C$={};function mI(t,e){const n=z3(t);return()=>C$[e]??n()}const A$=mI(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),gI=mI(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),kh=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,X2={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:kh([0,.65,.55,1]),circOut:kh([.55,0,1,.45]),backIn:kh([.31,.01,.66,-.59]),backOut:kh([.33,1.53,.69,.99])};function yI(t,e){if(t)return typeof t=="function"?gI()?lI(t,e):"ease-out":J3(t)?kh(t):Array.isArray(t)?t.map(n=>yI(n,e)||X2.easeOut):X2[t]}function R$(t,e,n,{delay:r=0,duration:i=300,repeat:a=0,repeatType:s="loop",ease:o="easeOut",times:c}={},u=void 0){const f={[e]:n};c&&(f.offset=c);const h=yI(o,i);Array.isArray(h)&&(f.easing=h);const p={delay:r,duration:i,easing:Array.isArray(h)?"linear":h,fill:"both",iterations:a+1,direction:s==="reverse"?"alternate":"normal"};return u&&(p.pseudoElement=u),t.animate(f,p)}function vI(t){return typeof t=="function"&&"applyToOptions"in t}function P$({type:t,...e}){return vI(t)&&gI()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class xI extends Bk{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:n,name:r,keyframes:i,pseudoElement:a,allowFlatten:s=!1,finalKeyframe:o,onComplete:c}=e;this.isPseudoElement=!!a,this.allowFlatten=s,this.options=e,Pk(typeof e.type!="string");const u=P$(e);this.animation=R$(n,r,i,u,a),u.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!a){const f=Gy(i,this.options,o,this.speed);this.updateMotionValue&&this.updateMotionValue(f),pI(n,r,f),this.animation.cancel()}c?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){const e=this.options?.element;!this.isPseudoElement&&e?.isConnected&&this.animation.commitStyles?.()}get duration(){const e=this.animation.effect?.getComputedTiming?.().duration||0;return Ma(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Ma(e)}get time(){return Ma(Number(this.animation.currentTime)||0)}set time(e){const n=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=oa(e),n&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,rangeStart:n,rangeEnd:r,observe:i}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,e&&A$()?(this.animation.timeline=e,n&&(this.animation.rangeStart=n),r&&(this.animation.rangeEnd=r),Ca):i(this)}}const bI={anticipate:q3,backInOut:Y3,circInOut:K3};function N$(t){return t in bI}function D$(t){typeof t.ease=="string"&&N$(t.ease)&&(t.ease=bI[t.ease])}const Ab=10;class L$ extends xI{constructor(e){D$(e),dI(e),super(e),e.startTime!==void 0&&e.autoplay!==!1&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:n,onUpdate:r,onComplete:i,element:a,...s}=this.options;if(!n)return;if(e!==void 0){n.set(e);return}const o=new ep({...s,autoplay:!1}),c=Math.max(Ab,Si.now()-this.startTime),u=Vs(0,Ab,c-Ab),f=o.sample(c).value,{name:h}=this.options;a&&h&&pI(a,h,f),n.setWithVelocity(o.sample(Math.max(0,c-u)).value,f,u),o.stop()}}const K2=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(rs.test(t)||t==="0")&&!t.startsWith("url("));function I$(t){const e=t[0];if(t.length===1)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}function O$(t,e,n,r){const i=t[0];if(i===null)return!1;if(e==="display"||e==="visibility")return!0;const a=t[t.length-1],s=K2(i,e),o=K2(a,e);return!s||!o?!1:I$(t)||(n==="spring"||vI(n))&&r}function Qw(t){t.duration=0,t.type="keyframes"}const _I=new Set(["opacity","clipPath","filter","transform"]),F$=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function U$(t){for(let e=0;e<t.length;e++)if(typeof t[e]=="string"&&F$.test(t[e]))return!0;return!1}const j$=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),B$=z3(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function z$(t){const{motionValue:e,name:n,repeatDelay:r,repeatType:i,damping:a,type:s,keyframes:o}=t;if(!(e?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:u,transformTemplate:f}=e.owner.getProps();return B$()&&n&&(_I.has(n)||j$.has(n)&&U$(o))&&(n!=="transform"||!f)&&!u&&!r&&i!=="mirror"&&a!==0&&s!=="inertia"}const V$=40;class H$ extends Bk{constructor({autoplay:e=!0,delay:n=0,type:r="keyframes",repeat:i=0,repeatDelay:a=0,repeatType:s="loop",keyframes:o,name:c,motionValue:u,element:f,...h}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=Si.now();const p={autoplay:e,delay:n,type:r,repeat:i,repeatDelay:a,repeatType:s,name:c,motionValue:u,element:f,...h},y=f?.KeyframeResolver||zk;this.keyframeResolver=new y(o,(v,w,b)=>this.onKeyframesResolved(v,w,p,!b),c,u,f),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,n,r,i){this.keyframeResolver=void 0;const{name:a,type:s,velocity:o,delay:c,isHandoff:u,onUpdate:f}=r;this.resolvedAt=Si.now();let h=!0;O$(e,a,s,o)||(h=!1,(Dl.instantAnimations||!c)&&f?.(Gy(e,r,n)),e[0]=e[e.length-1],Qw(r),r.repeat=0);const y={startTime:i?this.resolvedAt?this.resolvedAt-this.createdAt>V$?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:e},v=h&&!u&&z$(y),w=y.motionValue?.owner?.current;let b;if(v)try{b=new L$({...y,element:w})}catch{b=new ep(y)}else b=new ep(y);b.finished.then(()=>{this.notifyFinished()}).catch(Ca),this.pendingTimeline&&(this.stopTimeline=b.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=b}get finished(){return this._animation?this.animation.finished:this._finished}then(e,n){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),M$()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}function wI(t,e,n,r=0,i=1){const a=Array.from(t).sort((u,f)=>u.sortNodePosition(f)).indexOf(e),s=t.size,o=(s-1)*r;return typeof n=="function"?n(a,s):i===1?a*r:o-a*r}const W$=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function G$(t){const e=W$.exec(t);if(!e)return[,];const[,n,r,i]=e;return[`--${n??r}`,i]}function SI(t,e,n=1){const[r,i]=G$(t);if(!r)return;const a=window.getComputedStyle(e).getPropertyValue(r);if(a){const s=a.trim();return U3(s)?parseFloat(s):s}return Ik(i)?SI(i,e,n+1):i}const $$={type:"spring",stiffness:500,damping:25,restSpeed:10},Y$=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),q$={type:"keyframes",duration:.8},X$={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},K$=(t,{keyframes:e})=>e.length>2?q$:rf.has(t)?t.startsWith("scale")?Y$(e[1]):$$:X$;function kI(t,e){if(t?.inherit&&e){const{inherit:n,...r}=t;return{...e,...r}}return t}function Vk(t,e){const n=t?.[e]??t?.default??t;return n!==t?kI(n,t):n}const Z$=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function J$(t){for(const e in t)if(!Z$.has(e))return!0;return!1}const Hk=(t,e,n,r={},i,a)=>s=>{const o=Vk(r,t)||{},c=o.delay||r.delay||0;let{elapsed:u=0}=r;u=u-oa(c);const f={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...o,delay:-u,onUpdate:p=>{e.set(p),o.onUpdate&&o.onUpdate(p)},onComplete:()=>{s(),o.onComplete&&o.onComplete()},name:t,motionValue:e,element:a?void 0:i};J$(o)||Object.assign(f,K$(t,f)),f.duration&&(f.duration=oa(f.duration)),f.repeatDelay&&(f.repeatDelay=oa(f.repeatDelay)),f.from!==void 0&&(f.keyframes[0]=f.from);let h=!1;if((f.type===!1||f.duration===0&&!f.repeatDelay)&&(Qw(f),f.delay===0&&(h=!0)),(Dl.instantAnimations||Dl.skipAnimations||i?.shouldSkipAnimations)&&(h=!0,Qw(f),f.delay=0),f.allowFlatten=!o.type&&!o.ease,h&&!a&&e.get()!==void 0){const p=Gy(f.keyframes,o);if(p!==void 0){Wn.update(()=>{f.onUpdate(p),f.onComplete()});return}}return o.isSync?new ep(f):new H$(f)};function Z2(t){const e=[{},{}];return t?.values.forEach((n,r)=>{e[0][r]=n.get(),e[1][r]=n.getVelocity()}),e}function Wk(t,e,n,r){if(typeof e=="function"){const[i,a]=Z2(r);e=e(n!==void 0?n:t.custom,i,a)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[i,a]=Z2(r);e=e(n!==void 0?n:t.custom,i,a)}return e}function Uc(t,e,n){const r=t.getProps();return Wk(r,e,n!==void 0?n:r.custom,t)}const EI=new Set(["width","height","top","left","right","bottom",...nf]),J2=30,Q$=t=>!isNaN(parseFloat(t)),Lh={current:void 0};class eY{constructor(e,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{const i=Si.now();if(this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const a of this.dependents)a.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=n.owner}setCurrent(e){this.current=e,this.updatedAt=Si.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=Q$(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,n){this.events[e]||(this.events[e]=new Nk);const r=this.events[e].add(n);return e==="change"?()=>{r(),Wn.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,n){this.passiveEffect=e,this.stopPassiveEffect=n}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-r}jump(e,n=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return Lh.current&&Lh.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const e=Si.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>J2)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,J2);return V3(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(e){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=e(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Kc(t,e){return new eY(t,e)}const e1=t=>Array.isArray(t);function tY(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Kc(n))}function nY(t){return e1(t)?t[t.length-1]||0:t}function rY(t,e){const n=Uc(t,e);let{transitionEnd:r={},transition:i={},...a}=n||{};a={...a,...r};for(const s in a){const o=nY(a[s]);tY(t,s,o)}}const Br=t=>!!(t&&t.getVelocity);function iY(t){return!!(Br(t)&&t.add)}function t1(t,e){const n=t.getValue("willChange");if(iY(n))return n.add(e);if(!n&&Dl.WillChange){const r=new Dl.WillChange("auto");t.addValue("willChange",r),r.add(e)}}function Gk(t){return t.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}const aY="framerAppearId",MI="data-"+Gk(aY);function TI(t){return t.props[MI]}function sY({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,r}function CI(t,e,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:a,transitionEnd:s,...o}=e;const c=t.getDefaultTransition();a=a?kI(a,c):c;const u=a?.reduceMotion;r&&(a=r);const f=[],h=i&&t.animationState&&t.animationState.getState()[i];for(const p in o){const y=t.getValue(p,t.latestValues[p]??null),v=o[p];if(v===void 0||h&&sY(h,p))continue;const w={delay:n,...Vk(a||{},p)},b=y.get();if(b!==void 0&&!y.isAnimating()&&!Array.isArray(v)&&v===b&&!w.velocity){Wn.update(()=>y.set(v));continue}let _=!1;if(window.MotionHandoffAnimation){const T=TI(t);if(T){const R=window.MotionHandoffAnimation(T,p,Wn);R!==null&&(w.startTime=R,_=!0)}}t1(t,p);const E=u??t.shouldReduceMotion;y.start(Hk(p,y,v,E&&EI.has(p)?{type:!1}:w,t,_));const M=y.animation;M&&f.push(M)}if(s){const p=()=>Wn.update(()=>{s&&rY(t,s)});f.length?Promise.all(f).then(p):p()}return f}function n1(t,e,n={}){const r=Uc(t,e,n.type==="exit"?t.presenceContext?.custom:void 0);let{transition:i=t.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);const a=r?()=>Promise.all(CI(t,r,n)):()=>Promise.resolve(),s=t.variantChildren&&t.variantChildren.size?(c=0)=>{const{delayChildren:u=0,staggerChildren:f,staggerDirection:h}=i;return oY(t,e,c,u,f,h,n)}:()=>Promise.resolve(),{when:o}=i;if(o){const[c,u]=o==="beforeChildren"?[a,s]:[s,a];return c().then(()=>u())}else return Promise.all([a(),s(n.delay)])}function oY(t,e,n=0,r=0,i=0,a=1,s){const o=[];for(const c of t.variantChildren)c.notify("AnimationStart",e),o.push(n1(c,e,{...s,delay:n+(typeof r=="function"?0:r)+wI(t.variantChildren,c,r,i,a)}).then(()=>c.notify("AnimationComplete",e)));return Promise.all(o)}function lY(t,e,n={}){t.notify("AnimationStart",e);let r;if(Array.isArray(e)){const i=e.map(a=>n1(t,a,n));r=Promise.all(i)}else if(typeof e=="string")r=n1(t,e,n);else{const i=typeof e=="function"?Uc(t,e,n.custom):e;r=Promise.all(CI(t,i,n))}return r.then(()=>{t.notify("AnimationComplete",e)})}const cY={test:t=>t==="auto",parse:t=>t},AI=t=>e=>e.test(t),RI=[tf,Ot,Ls,hl,OG,IG,cY],Q2=t=>RI.find(AI(t));function uY(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||B3(t):!0}const dY=new Set(["brightness","contrast","saturate","opacity"]);function fY(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[r]=n.match(Ok)||[];if(!r)return t;const i=n.replace(r,"");let a=dY.has(e)?1:0;return r!==n&&(a*=100),e+"("+a+i+")"}const hY=/\b([a-z-]*)\(.*?\)/gu,r1={...rs,getAnimatableNone:t=>{const e=t.match(hY);return e?e.map(fY).join(" "):t}},i1={...rs,getAnimatableNone:t=>{const e=rs.parse(t);return rs.createTransformer(t)(e.map(r=>typeof r=="number"?0:typeof r=="object"?{...r,alpha:1}:r))}},eA={...tf,transform:Math.round},pY={rotate:hl,rotateX:hl,rotateY:hl,rotateZ:hl,scale:lg,scaleX:lg,scaleY:lg,scaleZ:lg,skew:hl,skewX:hl,skewY:hl,distance:Ot,translateX:Ot,translateY:Ot,translateZ:Ot,x:Ot,y:Ot,z:Ot,perspective:Ot,transformPerspective:Ot,opacity:Qh,originX:B2,originY:B2,originZ:Ot},$k={borderWidth:Ot,borderTopWidth:Ot,borderRightWidth:Ot,borderBottomWidth:Ot,borderLeftWidth:Ot,borderRadius:Ot,borderTopLeftRadius:Ot,borderTopRightRadius:Ot,borderBottomRightRadius:Ot,borderBottomLeftRadius:Ot,width:Ot,maxWidth:Ot,height:Ot,maxHeight:Ot,top:Ot,right:Ot,bottom:Ot,left:Ot,inset:Ot,insetBlock:Ot,insetBlockStart:Ot,insetBlockEnd:Ot,insetInline:Ot,insetInlineStart:Ot,insetInlineEnd:Ot,padding:Ot,paddingTop:Ot,paddingRight:Ot,paddingBottom:Ot,paddingLeft:Ot,paddingBlock:Ot,paddingBlockStart:Ot,paddingBlockEnd:Ot,paddingInline:Ot,paddingInlineStart:Ot,paddingInlineEnd:Ot,margin:Ot,marginTop:Ot,marginRight:Ot,marginBottom:Ot,marginLeft:Ot,marginBlock:Ot,marginBlockStart:Ot,marginBlockEnd:Ot,marginInline:Ot,marginInlineStart:Ot,marginInlineEnd:Ot,fontSize:Ot,backgroundPositionX:Ot,backgroundPositionY:Ot,...pY,zIndex:eA,fillOpacity:Qh,strokeOpacity:Qh,numOctaves:eA},mY={...$k,color:Tr,backgroundColor:Tr,outlineColor:Tr,fill:Tr,stroke:Tr,borderColor:Tr,borderTopColor:Tr,borderRightColor:Tr,borderBottomColor:Tr,borderLeftColor:Tr,filter:r1,WebkitFilter:r1,mask:i1,WebkitMask:i1},PI=t=>mY[t],gY=new Set([r1,i1]);function NI(t,e){let n=PI(t);return gY.has(n)||(n=rs),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const yY=new Set(["auto","none","0"]);function vY(t,e,n){let r=0,i;for(;r<t.length&&!i;){const a=t[r];typeof a=="string"&&!yY.has(a)&&Fd(a).values.length&&(i=t[r]),r++}if(i&&n)for(const a of e)t[a]=NI(n,i)}class xY extends zk{constructor(e,n,r,i,a){super(e,n,r,i,a,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let f=0;f<e.length;f++){let h=e[f];if(typeof h=="string"&&(h=h.trim(),Ik(h))){const p=SI(h,n.current);p!==void 0&&(e[f]=p),f===e.length-1&&(this.finalKeyframe=h)}}if(this.resolveNoneKeyframes(),!EI.has(r)||e.length!==2)return;const[i,a]=e,s=Q2(i),o=Q2(a),c=j2(i),u=j2(a);if(c!==u&&_l[r]){this.needsMeasurement=!0;return}if(s!==o)if(q2(s)&&q2(o))for(let f=0;f<e.length;f++){const h=e[f];typeof h=="string"&&(e[f]=parseFloat(h))}else _l[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:n}=this,r=[];for(let i=0;i<e.length;i++)(e[i]===null||uY(e[i]))&&r.push(i);r.length&&vY(e,r,n)}measureInitialState(){const{element:e,unresolvedKeyframes:n,name:r}=this;if(!e||!e.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=_l[r](e.measureViewportBox(),window.getComputedStyle(e.current)),n[0]=this.measuredOrigin;const i=n[n.length-1];i!==void 0&&e.getValue(r,i).jump(i,!1)}measureEndState(){const{element:e,name:n,unresolvedKeyframes:r}=this;if(!e||!e.current)return;const i=e.getValue(n);i&&i.jump(this.measuredOrigin,!1);const a=r.length-1,s=r[a];r[a]=_l[n](e.measureViewportBox(),window.getComputedStyle(e.current)),s!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=s),this.removedTransforms?.length&&this.removedTransforms.forEach(([o,c])=>{e.getValue(o).set(c)}),this.resolveNoneKeyframes()}}function DI(t,e,n){if(t==null)return[];if(t instanceof EventTarget)return[t];if(typeof t=="string"){let r=document;const i=n?.[t]??r.querySelectorAll(t);return i?Array.from(i):[]}return Array.from(t).filter(r=>r!=null)}const LI=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function u0(t){return j3(t)&&"offsetHeight"in t&&!("ownerSVGElement"in t)}const{schedule:Yk}=Q3(queueMicrotask,!1),Ya={x:!1,y:!1};function II(){return Ya.x||Ya.y}function bY(t){return t==="x"||t==="y"?Ya[t]?null:(Ya[t]=!0,()=>{Ya[t]=!1}):Ya.x||Ya.y?null:(Ya.x=Ya.y=!0,()=>{Ya.x=Ya.y=!1})}function OI(t,e){const n=DI(t),r=new AbortController,i={passive:!0,...e,signal:r.signal};return[n,i,()=>r.abort()]}function _Y(t){return!(t.pointerType==="touch"||II())}function wY(t,e,n={}){const[r,i,a]=OI(t,n);return r.forEach(s=>{let o=!1,c=!1,u;const f=()=>{s.removeEventListener("pointerleave",v)},h=b=>{u&&(u(b),u=void 0),f()},p=b=>{o=!1,window.removeEventListener("pointerup",p),window.removeEventListener("pointercancel",p),c&&(c=!1,h(b))},y=()=>{o=!0,window.addEventListener("pointerup",p,i),window.addEventListener("pointercancel",p,i)},v=b=>{if(b.pointerType!=="touch"){if(o){c=!0;return}h(b)}},w=b=>{if(!_Y(b))return;c=!1;const _=e(s,b);typeof _=="function"&&(u=_,s.addEventListener("pointerleave",v,i))};s.addEventListener("pointerenter",w,i),s.addEventListener("pointerdown",y,i)}),a}const FI=(t,e)=>e?t===e?!0:FI(t,e.parentElement):!1,qk=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,SY=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function kY(t){return SY.has(t.tagName)||t.isContentEditable===!0}const EY=new Set(["INPUT","SELECT","TEXTAREA"]);function MY(t){return EY.has(t.tagName)||t.isContentEditable===!0}const d0=new WeakSet;function tA(t){return e=>{e.key==="Enter"&&t(e)}}function Rb(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const TY=(t,e)=>{const n=t.currentTarget;if(!n)return;const r=tA(()=>{if(d0.has(n))return;Rb(n,"down");const i=tA(()=>{Rb(n,"up")}),a=()=>Rb(n,"cancel");n.addEventListener("keyup",i,e),n.addEventListener("blur",a,e)});n.addEventListener("keydown",r,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),e)};function nA(t){return qk(t)&&!II()}const rA=new WeakSet;function CY(t,e,n={}){const[r,i,a]=OI(t,n),s=o=>{const c=o.currentTarget;if(!nA(o)||rA.has(o))return;d0.add(c),n.stopPropagation&&rA.add(o);const u=e(c,o),f=(y,v)=>{window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",p),d0.has(c)&&d0.delete(c),nA(y)&&typeof u=="function"&&u(y,{success:v})},h=y=>{f(y,c===window||c===document||n.useGlobalTarget||FI(c,y.target))},p=y=>{f(y,!1)};window.addEventListener("pointerup",h,i),window.addEventListener("pointercancel",p,i)};return r.forEach(o=>{(n.useGlobalTarget?window:o).addEventListener("pointerdown",s,i),u0(o)&&(o.addEventListener("focus",u=>TY(u,i)),!kY(o)&&!o.hasAttribute("tabindex")&&(o.tabIndex=0))}),a}function Xk(t){return j3(t)&&"ownerSVGElement"in t}const f0=new WeakMap;let h0;const UI=(t,e,n)=>(r,i)=>i&&i[0]?i[0][t+"Size"]:Xk(r)&&"getBBox"in r?r.getBBox()[e]:r[n],AY=UI("inline","width","offsetWidth"),RY=UI("block","height","offsetHeight");function PY({target:t,borderBoxSize:e}){f0.get(t)?.forEach(n=>{n(t,{get width(){return AY(t,e)},get height(){return RY(t,e)}})})}function NY(t){t.forEach(PY)}function DY(){typeof ResizeObserver>"u"||(h0=new ResizeObserver(NY))}function LY(t,e){h0||DY();const n=DI(t);return n.forEach(r=>{let i=f0.get(r);i||(i=new Set,f0.set(r,i)),i.add(e),h0?.observe(r)}),()=>{n.forEach(r=>{const i=f0.get(r);i?.delete(e),i?.size||h0?.unobserve(r)})}}const p0=new Set;let _d;function IY(){_d=()=>{const t={get width(){return window.innerWidth},get height(){return window.innerHeight}};p0.forEach(e=>e(t))},window.addEventListener("resize",_d)}function OY(t){return p0.add(t),_d||IY(),()=>{p0.delete(t),!p0.size&&typeof _d=="function"&&(window.removeEventListener("resize",_d),_d=void 0)}}function iA(t,e){return typeof t=="function"?OY(t):LY(t,e)}function FY(t){return Xk(t)&&t.tagName==="svg"}function UY(...t){const e=!Array.isArray(t[0]),n=e?0:-1,r=t[0+n],i=t[1+n],a=t[2+n],s=t[3+n],o=uI(i,a,s);return e?o(r):o}function jY(t,e,n={}){const r=t.get();let i=null,a=r,s;const o=typeof r=="string"?r.replace(/[\d.-]/g,""):void 0,c=()=>{i&&(i.stop(),i=null),t.animation=void 0},u=()=>{const h=aA(t.get()),p=aA(a);if(h===p){c();return}const y=i?i.getGeneratorVelocity():t.getVelocity();c(),i=new ep({keyframes:[h,p],velocity:y,type:"spring",restDelta:.001,restSpeed:.01,...n,onUpdate:s})},f=()=>{u(),t.animation=i??void 0,t.events.animationStart?.notify(),i?.then(()=>{t.animation=void 0,t.events.animationComplete?.notify()})};if(t.attach((h,p)=>{a=h,s=y=>p(Pb(y,o)),Wn.postRender(f)},c),Br(e)){let h=n.skipInitialAnimation===!0;const p=e.on("change",v=>{h?(h=!1,t.jump(Pb(v,o),!1)):t.set(Pb(v,o))}),y=t.on("destroy",p);return()=>{p(),y()}}return c}function Pb(t,e){return e?t+e:t}function aA(t){return typeof t=="number"?t:parseFloat(t)}const BY=[...RI,Tr,rs],zY=t=>BY.find(AI(t)),sA=()=>({translate:0,scale:1,origin:0,originPoint:0}),wd=()=>({x:sA(),y:sA()}),oA=()=>({min:0,max:0}),Fr=()=>({x:oA(),y:oA()}),VY=new WeakMap;function $y(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function tp(t){return typeof t=="string"||Array.isArray(t)}const Kk=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Zk=["initial",...Kk];function Yy(t){return $y(t.animate)||Zk.some(e=>tp(t[e]))}function jI(t){return!!(Yy(t)||t.variants)}function HY(t,e,n){for(const r in e){const i=e[r],a=n[r];if(Br(i))t.addValue(r,i);else if(Br(a))t.addValue(r,Kc(i,{owner:t}));else if(a!==i)if(t.hasValue(r)){const s=t.getValue(r);s.liveStyle===!0?s.jump(i):s.hasAnimated||s.set(i)}else{const s=t.getStaticValue(r);t.addValue(r,Kc(s!==void 0?s:i,{owner:t}))}}for(const r in n)e[r]===void 0&&t.removeValue(r);return e}const Z0={current:null},Jk={current:!1},WY=typeof window<"u";function BI(){if(Jk.current=!0,!!WY)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Z0.current=t.matches;t.addEventListener("change",e),e()}else Z0.current=!1}const lA=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let J0={};function zI(t){J0=t}function GY(){return J0}class $Y{scrapeMotionValuesFromProps(e,n,r){return{}}constructor({parent:e,props:n,presenceContext:r,reducedMotionConfig:i,skipAnimations:a,blockInitialAnimation:s,visualState:o},c={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=zk,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const y=Si.now();this.renderScheduledAt<y&&(this.renderScheduledAt=y,Wn.render(this.render,!1,!0))};const{latestValues:u,renderState:f}=o;this.latestValues=u,this.baseTarget={...u},this.initialValues=n.initial?{...u}:{},this.renderState=f,this.parent=e,this.props=n,this.presenceContext=r,this.depth=e?e.depth+1:0,this.reducedMotionConfig=i,this.skipAnimationsConfig=a,this.options=c,this.blockInitialAnimation=!!s,this.isControllingVariants=Yy(n),this.isVariantNode=jI(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:h,...p}=this.scrapeMotionValuesFromProps(n,{},this);for(const y in p){const v=p[y];u[y]!==void 0&&Br(v)&&v.set(u[y])}}mount(e){if(this.hasBeenMounted)for(const n in this.initialValues)this.values.get(n)?.jump(this.initialValues[n]),this.latestValues[n]=this.initialValues[n];this.current=e,VY.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,r)=>this.bindToMotionValue(r,n)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(Jk.current||BI(),this.shouldReduceMotion=Z0.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),Po(this.notifyUpdate),Po(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const n=this.features[e];n&&(n.unmount(),n.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,n){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),n.accelerate&&_I.has(e)&&this.current instanceof HTMLElement){const{factory:s,keyframes:o,times:c,ease:u,duration:f}=n.accelerate,h=new xI({element:this.current,name:e,keyframes:o,times:c,ease:u,duration:oa(f)}),p=s(h);this.valueSubscriptions.set(e,()=>{p(),h.cancel()});return}const r=rf.has(e);r&&this.onBindTransform&&this.onBindTransform();const i=n.on("change",s=>{this.latestValues[e]=s,this.props.onUpdate&&Wn.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let a;typeof window<"u"&&window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,e,n)),this.valueSubscriptions.set(e,()=>{i(),a&&a(),n.owner&&n.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in J0){const n=J0[e];if(!n)continue;const{isEnabled:r,Feature:i}=n;if(!this.features[e]&&i&&r(this.props)&&(this.features[e]=new i(this)),this.features[e]){const a=this.features[e];a.isMounted?a.update():(a.mount(),a.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Fr()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;r<lA.length;r++){const i=lA[r];this.propEventSubscriptions[i]&&(this.propEventSubscriptions[i](),delete this.propEventSubscriptions[i]);const a="on"+i,s=e[a];s&&(this.propEventSubscriptions[i]=this.on(i,s))}this.prevMotionValues=HY(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(e),()=>n.variantChildren.delete(e)}addValue(e,n){const r=this.values.get(e);n!==r&&(r&&this.removeValue(e),this.bindToMotionValue(e,n),this.values.set(e,n),this.latestValues[e]=n.get())}removeValue(e){this.values.delete(e);const n=this.valueSubscriptions.get(e);n&&(n(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,n){if(this.props.values&&this.props.values[e])return this.props.values[e];let r=this.values.get(e);return r===void 0&&n!==void 0&&(r=Kc(n===null?void 0:n,{owner:this}),this.addValue(e,r)),r}readValue(e,n){let r=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return r!=null&&(typeof r=="string"&&(U3(r)||B3(r))?r=parseFloat(r):!zY(r)&&rs.test(n)&&(r=NI(e,n)),this.setBaseTarget(e,Br(r)?r.get():r)),Br(r)?r.get():r}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){const{initial:n}=this.props;let r;if(typeof n=="string"||typeof n=="object"){const a=Wk(this.props,n,this.presenceContext?.custom);a&&(r=a[e])}if(n&&r!==void 0)return r;const i=this.getBaseTargetFromProps(this.props,e);return i!==void 0&&!Br(i)?i:this.initialValues[e]!==void 0&&r===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new Nk),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}scheduleRenderMicrotask(){Yk.render(this.render)}}class VI extends $Y{constructor(){super(...arguments),this.KeyframeResolver=xY}sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){const r=e.style;return r?r[n]:void 0}removeValueFromRenderState(e,{vars:n,style:r}){delete n[e],delete r[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Br(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}class Fl{constructor(e){this.isMounted=!1,this.node=e}update(){}}function HI({top:t,left:e,right:n,bottom:r}){return{x:{min:e,max:n},y:{min:t,max:r}}}function YY({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function qY(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),r=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function Nb(t){return t===void 0||t===1}function a1({scale:t,scaleX:e,scaleY:n}){return!Nb(t)||!Nb(e)||!Nb(n)}function _c(t){return a1(t)||WI(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function WI(t){return cA(t.x)||cA(t.y)}function cA(t){return t&&t!=="0%"}function Q0(t,e,n){const r=t-n,i=e*r;return n+i}function uA(t,e,n,r,i){return i!==void 0&&(t=Q0(t,i,r)),Q0(t,n,r)+e}function s1(t,e=0,n=1,r,i){t.min=uA(t.min,e,n,r,i),t.max=uA(t.max,e,n,r,i)}function GI(t,{x:e,y:n}){s1(t.x,e.translate,e.scale,e.originPoint),s1(t.y,n.translate,n.scale,n.originPoint)}const dA=.999999999999,fA=1.0000000000001;function XY(t,e,n,r=!1){const i=n.length;if(!i)return;e.x=e.y=1;let a,s;for(let o=0;o<i;o++){a=n[o],s=a.projectionDelta;const{visualElement:c}=a.options;c&&c.props.style&&c.props.style.display==="contents"||(r&&a.options.layoutScroll&&a.scroll&&a!==a.root&&(ks(t.x,-a.scroll.offset.x),ks(t.y,-a.scroll.offset.y)),s&&(e.x*=s.x.scale,e.y*=s.y.scale,GI(t,s)),r&&_c(a.latestValues)&&m0(t,a.latestValues,a.layout?.layoutBox))}e.x<fA&&e.x>dA&&(e.x=1),e.y<fA&&e.y>dA&&(e.y=1)}function ks(t,e){t.min+=e,t.max+=e}function hA(t,e,n,r,i=.5){const a=ar(t.min,t.max,i);s1(t,e,n,a,r)}function pA(t,e){return typeof t=="string"?parseFloat(t)/100*(e.max-e.min):t}function m0(t,e,n){const r=n??t;hA(t.x,pA(e.x,r.x),e.scaleX,e.scale,e.originX),hA(t.y,pA(e.y,r.y),e.scaleY,e.scale,e.originY)}function $I(t,e){return HI(qY(t.getBoundingClientRect(),e))}function KY(t,e,n){const r=$I(t,n),{scroll:i}=e;return i&&(ks(r.x,i.offset.x),ks(r.y,i.offset.y)),r}const ZY={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},JY=nf.length;function QY(t,e,n){let r="",i=!0;for(let a=0;a<JY;a++){const s=nf[a],o=t[s];if(o===void 0)continue;let c=!0;if(typeof o=="number")c=o===(s.startsWith("scale")?1:0);else{const u=parseFloat(o);c=s.startsWith("scale")?u===1:u===0}if(!c||n){const u=LI(o,$k[s]);if(!c){i=!1;const f=ZY[s]||s;r+=`${f}(${u}) `}n&&(e[s]=u)}}return r=r.trim(),n?r=n(e,i?"":r):i&&(r="none"),r}function Qk(t,e,n){const{style:r,vars:i,transformOrigin:a}=t;let s=!1,o=!1;for(const c in e){const u=e[c];if(rf.has(c)){s=!0;continue}else if(tI(c)){i[c]=u;continue}else{const f=LI(u,$k[c]);c.startsWith("origin")?(o=!0,a[c]=f):r[c]=f}}if(e.transform||(s||n?r.transform=QY(e,t.transform,n):r.transform&&(r.transform="none")),o){const{originX:c="50%",originY:u="50%",originZ:f=0}=a;r.transformOrigin=`${c} ${u} ${f}`}}function YI(t,{style:e,vars:n},r,i){const a=t.style;let s;for(s in e)a[s]=e[s];i?.applyProjectionStyles(a,r);for(s in n)a.setProperty(s,n[s])}function mA(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const ih={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(Ot.test(t))t=parseFloat(t);else return t;const n=mA(t,e.target.x),r=mA(t,e.target.y);return`${n}% ${r}%`}},eq={correct:(t,{treeScale:e,projectionDelta:n})=>{const r=t,i=rs.parse(t);if(i.length>5)return r;const a=rs.createTransformer(t),s=typeof i[0]!="number"?1:0,o=n.x.scale*e.x,c=n.y.scale*e.y;i[0+s]/=o,i[1+s]/=c;const u=ar(o,c,.5);return typeof i[2+s]=="number"&&(i[2+s]/=u),typeof i[3+s]=="number"&&(i[3+s]/=u),a(i)}},o1={borderRadius:{...ih,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:ih,borderTopRightRadius:ih,borderBottomLeftRadius:ih,borderBottomRightRadius:ih,boxShadow:eq};function qI(t,{layout:e,layoutId:n}){return rf.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!o1[t]||t==="opacity")}function eE(t,e,n){const r=t.style,i=e?.style,a={};if(!r)return a;for(const s in r)(Br(r[s])||i&&Br(i[s])||qI(s,t)||n?.getValue(s)?.liveStyle!==void 0)&&(a[s]=r[s]);return a}function tq(t){return window.getComputedStyle(t)}class nq extends VI{constructor(){super(...arguments),this.type="html",this.renderInstance=YI}readValueFromInstance(e,n){if(rf.has(n))return this.projection?.isProjecting?qw(n):_$(e,n);{const r=tq(e),i=(tI(n)?r.getPropertyValue(n):r[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:n}){return $I(e,n)}build(e,n,r){Qk(e,n,r.transformTemplate)}scrapeMotionValuesFromProps(e,n,r){return eE(e,n,r)}}const rq={offset:"stroke-dashoffset",array:"stroke-dasharray"},iq={offset:"strokeDashoffset",array:"strokeDasharray"};function aq(t,e,n=1,r=0,i=!0){t.pathLength=1;const a=i?rq:iq;t[a.offset]=`${-r}`,t[a.array]=`${e} ${n}`}const sq=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function XI(t,{attrX:e,attrY:n,attrScale:r,pathLength:i,pathSpacing:a=1,pathOffset:s=0,...o},c,u,f){if(Qk(t,o,u),c){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:h,style:p}=t;h.transform&&(p.transform=h.transform,delete h.transform),(p.transform||h.transformOrigin)&&(p.transformOrigin=h.transformOrigin??"50% 50%",delete h.transformOrigin),p.transform&&(p.transformBox=f?.transformBox??"fill-box",delete h.transformBox);for(const y of sq)h[y]!==void 0&&(p[y]=h[y],delete h[y]);e!==void 0&&(h.x=e),n!==void 0&&(h.y=n),r!==void 0&&(h.scale=r),i!==void 0&&aq(h,i,a,s,!1)}const KI=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),ZI=t=>typeof t=="string"&&t.toLowerCase()==="svg";function oq(t,e,n,r){YI(t,e,void 0,r);for(const i in e.attrs)t.setAttribute(KI.has(i)?i:Gk(i),e.attrs[i])}function JI(t,e,n){const r=eE(t,e,n);for(const i in t)if(Br(t[i])||Br(e[i])){const a=nf.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;r[a]=t[i]}return r}class lq extends VI{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Fr}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(rf.has(n)){const r=PI(n);return r&&r.default||0}return n=KI.has(n)?n:Gk(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,r){return JI(e,n,r)}build(e,n,r){XI(e,n,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(e,n,r,i){oq(e,n,r,i)}mount(e){this.isSVGTag=ZI(e.tagName),super.mount(e)}}const cq=Zk.length;function QI(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?QI(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;n<cq;n++){const r=Zk[n],i=t.props[r];(tp(i)||i===!1)&&(e[r]=i)}return e}function eO(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}const uq=[...Kk].reverse(),dq=Kk.length;function fq(t){return e=>Promise.all(e.map(({animation:n,options:r})=>lY(t,n,r)))}function hq(t){let e=fq(t),n=gA(),r=!0,i=!1;const a=u=>(f,h)=>{const p=Uc(t,h,u==="exit"?t.presenceContext?.custom:void 0);if(p){const{transition:y,transitionEnd:v,...w}=p;f={...f,...w,...v}}return f};function s(u){e=u(t)}function o(u){const{props:f}=t,h=QI(t.parent)||{},p=[],y=new Set;let v={},w=1/0;for(let _=0;_<dq;_++){const E=uq[_],M=n[E],T=f[E]!==void 0?f[E]:h[E],R=tp(T),A=E===u?M.isActive:null;A===!1&&(w=_);let P=T===h[E]&&T!==f[E]&&R;if(P&&(r||i)&&t.manuallyAnimateOnMount&&(P=!1),M.protectedKeys={...v},!M.isActive&&A===null||!T&&!M.prevProp||$y(T)||typeof T=="boolean")continue;if(E==="exit"&&M.isActive&&A!==!0){M.prevResolvedValues&&(v={...v,...M.prevResolvedValues});continue}const k=pq(M.prevProp,T);let N=k||E===u&&M.isActive&&!P&&R||_>w&&R,j=!1;const L=Array.isArray(T)?T:[T];let z=L.reduce(a(E),{});A===!1&&(z={});const{prevResolvedValues:U={}}=M,V={...U,...z},W=O=>{N=!0,y.has(O)&&(j=!0,y.delete(O)),M.needsAnimating[O]=!0;const G=t.getValue(O);G&&(G.liveStyle=!1)};for(const O in V){const G=z[O],Y=U[O];if(v.hasOwnProperty(O))continue;let H=!1;e1(G)&&e1(Y)?H=!eO(G,Y):H=G!==Y,H?G!=null?W(O):y.add(O):G!==void 0&&y.has(O)?W(O):M.protectedKeys[O]=!0}M.prevProp=T,M.prevResolvedValues=z,M.isActive&&(v={...v,...z}),(r||i)&&t.blockInitialAnimation&&(N=!1);const K=P&&k;N&&(!K||j)&&p.push(...L.map(O=>{const G={type:E};if(typeof O=="string"&&(r||i)&&!K&&t.manuallyAnimateOnMount&&t.parent){const{parent:Y}=t,H=Uc(Y,O);if(Y.enteringChildren&&H){const{delayChildren:te}=H.transition||{};G.delay=wI(Y.enteringChildren,t,te)}}return{animation:O,options:G}}))}if(y.size){const _={};if(typeof f.initial!="boolean"){const E=Uc(t,Array.isArray(f.initial)?f.initial[0]:f.initial);E&&E.transition&&(_.transition=E.transition)}y.forEach(E=>{const M=t.getBaseTarget(E),T=t.getValue(E);T&&(T.liveStyle=!0),_[E]=M??null}),p.push({animation:_})}let b=!!p.length;return r&&(f.initial===!1||f.initial===f.animate)&&!t.manuallyAnimateOnMount&&(b=!1),r=!1,i=!1,b?e(p):Promise.resolve()}function c(u,f){if(n[u].isActive===f)return Promise.resolve();t.variantChildren?.forEach(p=>p.animationState?.setActive(u,f)),n[u].isActive=f;const h=o(u);for(const p in n)n[p].protectedKeys={};return h}return{animateChanges:o,setActive:c,setAnimateFunction:s,getState:()=>n,reset:()=>{n=gA(),i=!0}}}function pq(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!eO(e,t):!1}function cc(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function gA(){return{animate:cc(!0),whileInView:cc(),whileHover:cc(),whileTap:cc(),whileDrag:cc(),whileFocus:cc(),exit:cc()}}function l1(t,e){t.min=e.min,t.max=e.max}function za(t,e){l1(t.x,e.x),l1(t.y,e.y)}function yA(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}const tO=1e-4,mq=1-tO,gq=1+tO,nO=.01,yq=0-nO,vq=0+nO;function ki(t){return t.max-t.min}function xq(t,e,n){return Math.abs(t-e)<=n}function vA(t,e,n,r=.5){t.origin=r,t.originPoint=ar(e.min,e.max,t.origin),t.scale=ki(n)/ki(e),t.translate=ar(n.min,n.max,t.origin)-t.originPoint,(t.scale>=mq&&t.scale<=gq||isNaN(t.scale))&&(t.scale=1),(t.translate>=yq&&t.translate<=vq||isNaN(t.translate))&&(t.translate=0)}function Ih(t,e,n,r){vA(t.x,e.x,n.x,r?r.originX:void 0),vA(t.y,e.y,n.y,r?r.originY:void 0)}function xA(t,e,n,r=0){const i=r?ar(n.min,n.max,r):n.min;t.min=i+e.min,t.max=t.min+ki(e)}function bq(t,e,n,r){xA(t.x,e.x,n.x,r?.x),xA(t.y,e.y,n.y,r?.y)}function bA(t,e,n,r=0){const i=r?ar(n.min,n.max,r):n.min;t.min=e.min-i,t.max=t.min+ki(e)}function ey(t,e,n,r){bA(t.x,e.x,n.x,r?.x),bA(t.y,e.y,n.y,r?.y)}function _A(t,e,n,r,i){return t-=e,t=Q0(t,1/n,r),i!==void 0&&(t=Q0(t,1/i,r)),t}function _q(t,e=0,n=1,r=.5,i,a=t,s=t){if(Ls.test(e)&&(e=parseFloat(e),e=ar(s.min,s.max,e/100)-s.min),typeof e!="number")return;let o=ar(a.min,a.max,r);t===a&&(o-=e),t.min=_A(t.min,e,n,o,i),t.max=_A(t.max,e,n,o,i)}function wA(t,e,[n,r,i],a,s){_q(t,e[n],e[r],e[i],e.scale,a,s)}const wq=["x","scaleX","originX"],Sq=["y","scaleY","originY"];function SA(t,e,n,r){wA(t.x,e,wq,n?n.x:void 0,r?r.x:void 0),wA(t.y,e,Sq,n?n.y:void 0,r?r.y:void 0)}function kA(t){return t.translate===0&&t.scale===1}function rO(t){return kA(t.x)&&kA(t.y)}function EA(t,e){return t.min===e.min&&t.max===e.max}function kq(t,e){return EA(t.x,e.x)&&EA(t.y,e.y)}function MA(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function iO(t,e){return MA(t.x,e.x)&&MA(t.y,e.y)}function TA(t){return ki(t.x)/ki(t.y)}function CA(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}function ws(t){return[t("x"),t("y")]}function Eq(t,e,n){let r="";const i=t.x.translate/e.x,a=t.y.translate/e.y,s=n?.z||0;if((i||a||s)&&(r=`translate3d(${i}px, ${a}px, ${s}px) `),(e.x!==1||e.y!==1)&&(r+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:u,rotate:f,rotateX:h,rotateY:p,skewX:y,skewY:v}=n;u&&(r=`perspective(${u}px) ${r}`),f&&(r+=`rotate(${f}deg) `),h&&(r+=`rotateX(${h}deg) `),p&&(r+=`rotateY(${p}deg) `),y&&(r+=`skewX(${y}deg) `),v&&(r+=`skewY(${v}deg) `)}const o=t.x.scale*e.x,c=t.y.scale*e.y;return(o!==1||c!==1)&&(r+=`scale(${o}, ${c})`),r||"none"}const aO=["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"],Mq=aO.length,AA=t=>typeof t=="string"?parseFloat(t):t,RA=t=>typeof t=="number"||Ot.test(t);function Tq(t,e,n,r,i,a){i?(t.opacity=ar(0,n.opacity??1,Cq(r)),t.opacityExit=ar(e.opacity??1,0,Aq(r))):a&&(t.opacity=ar(e.opacity??1,n.opacity??1,r));for(let s=0;s<Mq;s++){const o=aO[s];let c=PA(e,o),u=PA(n,o);if(c===void 0&&u===void 0)continue;c||(c=0),u||(u=0),c===0||u===0||RA(c)===RA(u)?(t[o]=Math.max(ar(AA(c),AA(u),r),0),(Ls.test(u)||Ls.test(c))&&(t[o]+="%")):t[o]=u}(e.rotate||n.rotate)&&(t.rotate=ar(e.rotate||0,n.rotate||0,r))}function PA(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const Cq=sO(0,.5,X3),Aq=sO(.5,.95,Ca);function sO(t,e,n){return r=>r<t?0:r>e?1:n(Jh(t,e,r))}function Rq(t,e,n){const r=Br(t)?t:Kc(t);return r.start(Hk("",r,e,n)),r.animation}function np(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}const Pq=(t,e)=>t.depth-e.depth;class Nq{constructor(){this.children=[],this.isDirty=!1}add(e){Rk(this.children,e),this.isDirty=!0}remove(e){Y0(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Pq),this.isDirty=!1,this.children.forEach(e)}}function Dq(t,e){const n=Si.now(),r=({timestamp:i})=>{const a=i-n;a>=e&&(Po(r),t(a-e))};return Wn.setup(r,!0),()=>Po(r)}function g0(t){return Br(t)?t.get():t}class Lq{constructor(){this.members=[]}add(e){Rk(this.members,e);for(let n=this.members.length-1;n>=0;n--){const r=this.members[n];if(r===e||r===this.lead||r===this.prevLead)continue;const i=r.instance;(!i||i.isConnected===!1)&&!r.snapshot&&(Y0(this.members,r),r.unmount())}e.scheduleRender()}remove(e){if(Y0(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(e){for(let n=this.members.indexOf(e)-1;n>=0;n--){const r=this.members[n];if(r.isPresent!==!1&&r.instance?.isConnected!==!1)return this.promote(r),!0}return!1}promote(e,n){const r=this.lead;if(e!==r&&(this.prevLead=r,this.lead=e,e.show(),r)){r.updateSnapshot(),e.scheduleRender();const{layoutDependency:i}=r.options,{layoutDependency:a}=e.options;(i===void 0||i!==a)&&(e.resumeFrom=r,n&&(r.preserveOpacity=!0),r.snapshot&&(e.snapshot=r.snapshot,e.snapshot.latestValues=r.animationValues||r.latestValues),e.root?.isUpdating&&(e.isLayoutDirty=!0)),e.options.crossfade===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(e=>{e.options.onExitComplete?.(),e.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}}const y0={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Db=["","X","Y","Z"],Iq=1e3;let Oq=0;function Lb(t,e,n,r){const{latestValues:i}=e;i[t]&&(n[t]=i[t],e.setStaticValue(t,0),r&&(r[t]=0))}function oO(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=TI(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:i,layoutId:a}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",Wn,!(i||a))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&oO(r)}function lO({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(s={},o=e?.()){this.id=Oq++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(jq),this.nodes.forEach(Gq),this.nodes.forEach($q),this.nodes.forEach(Bq)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=s,this.root=o?o.root||o:this,this.path=o?[...o.path,o]:[],this.parent=o,this.depth=o?o.depth+1:0;for(let c=0;c<this.path.length;c++)this.path[c].shouldResetTransform=!0;this.root===this&&(this.nodes=new Nq)}addEventListener(s,o){return this.eventHandlers.has(s)||this.eventHandlers.set(s,new Nk),this.eventHandlers.get(s).add(o)}notifyListeners(s,...o){const c=this.eventHandlers.get(s);c&&c.notify(...o)}hasListeners(s){return this.eventHandlers.has(s)}mount(s){if(this.instance)return;this.isSVG=Xk(s)&&!FY(s),this.instance=s;const{layoutId:o,layout:c,visualElement:u}=this.options;if(u&&!u.current&&u.mount(s),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(c||o)&&(this.isLayoutDirty=!0),t){let f,h=0;const p=()=>this.root.updateBlockedByResize=!1;Wn.read(()=>{h=window.innerWidth}),t(s,()=>{const y=window.innerWidth;y!==h&&(h=y,this.root.updateBlockedByResize=!0,f&&f(),f=Dq(p,250),y0.hasAnimatedSinceResize&&(y0.hasAnimatedSinceResize=!1,this.nodes.forEach(LA)))})}o&&this.root.registerSharedNode(o,this),this.options.animate!==!1&&u&&(o||c)&&this.addEventListener("didUpdate",({delta:f,hasLayoutChanged:h,hasRelativeLayoutChanged:p,layout:y})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const v=this.options.transition||u.getDefaultTransition()||Zq,{onLayoutAnimationStart:w,onLayoutAnimationComplete:b}=u.getProps(),_=!this.targetLayout||!iO(this.targetLayout,y),E=!h&&p;if(this.options.layoutRoot||this.resumeFrom||E||h&&(_||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const M={...Vk(v,"layout"),onPlay:w,onComplete:b};(u.shouldReduceMotion||this.options.layoutRoot)&&(M.delay=0,M.type=!1),this.startAnimation(M),this.setAnimationOrigin(f,E)}else h||LA(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=y})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const s=this.getStack();s&&s.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Po(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(Yq),this.animationId++)}getTransformTemplate(){const{visualElement:s}=this.options;return s&&s.getProps().transformTemplate}willUpdate(s=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&oO(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let f=0;f<this.path.length;f++){const h=this.path[f];h.shouldResetTransform=!0,(typeof h.latestValues.x=="string"||typeof h.latestValues.y=="string")&&(h.isLayoutDirty=!0),h.updateScroll("snapshot"),h.options.layoutRoot&&h.willUpdate(!1)}const{layoutId:o,layout:c}=this.options;if(o===void 0&&!c)return;const u=this.getTransformTemplate();this.prevTransformTemplateValue=u?u(this.latestValues,""):void 0,this.updateSnapshot(),s&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){const c=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),c&&this.nodes.forEach(Vq),this.nodes.forEach(NA);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(DA);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(Hq),this.nodes.forEach(Wq),this.nodes.forEach(Fq),this.nodes.forEach(Uq)):this.nodes.forEach(DA),this.clearAllSnapshots();const o=Si.now();Qr.delta=Vs(0,1e3/60,o-Qr.timestamp),Qr.timestamp=o,Qr.isProcessing=!0,kb.update.process(Qr),kb.preRender.process(Qr),kb.render.process(Qr),Qr.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Yk.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(zq),this.sharedNodes.forEach(qq)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Wn.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Wn.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!ki(this.snapshot.measuredBox.x)&&!ki(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c<this.path.length;c++)this.path[c].updateScroll();const s=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected=Fr()),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:o}=this.options;o&&o.notify("LayoutMeasure",this.layout.layoutBox,s?s.layoutBox:void 0)}updateScroll(s="measure"){let o=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===s&&(o=!1),o&&this.instance){const c=r(this.instance);this.scroll={animationId:this.root.animationId,phase:s,isRoot:c,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:c}}}resetTransform(){if(!i)return;const s=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,o=this.projectionDelta&&!rO(this.projectionDelta),c=this.getTransformTemplate(),u=c?c(this.latestValues,""):void 0,f=u!==this.prevTransformTemplateValue;s&&this.instance&&(o||_c(this.latestValues)||f)&&(i(this.instance,u),this.shouldResetTransform=!1,this.scheduleRender())}measure(s=!0){const o=this.measurePageBox();let c=this.removeElementScroll(o);return s&&(c=this.removeTransform(c)),Jq(c),{animationId:this.root.animationId,measuredBox:o,layoutBox:c,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:s}=this.options;if(!s)return Fr();const o=s.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(Qq))){const{scroll:u}=this.root;u&&(ks(o.x,u.offset.x),ks(o.y,u.offset.y))}return o}removeElementScroll(s){const o=Fr();if(za(o,s),this.scroll?.wasRoot)return o;for(let c=0;c<this.path.length;c++){const u=this.path[c],{scroll:f,options:h}=u;u!==this.root&&f&&h.layoutScroll&&(f.wasRoot&&za(o,s),ks(o.x,f.offset.x),ks(o.y,f.offset.y))}return o}applyTransform(s,o=!1,c){const u=c||Fr();za(u,s);for(let f=0;f<this.path.length;f++){const h=this.path[f];!o&&h.options.layoutScroll&&h.scroll&&h!==h.root&&(ks(u.x,-h.scroll.offset.x),ks(u.y,-h.scroll.offset.y)),_c(h.latestValues)&&m0(u,h.latestValues,h.layout?.layoutBox)}return _c(this.latestValues)&&m0(u,this.latestValues,this.layout?.layoutBox),u}removeTransform(s){const o=Fr();za(o,s);for(let c=0;c<this.path.length;c++){const u=this.path[c];if(!_c(u.latestValues))continue;let f;u.instance&&(a1(u.latestValues)&&u.updateSnapshot(),f=Fr(),za(f,u.measurePageBox())),SA(o,u.latestValues,u.snapshot?.layoutBox,f)}return _c(this.latestValues)&&SA(o,this.latestValues),o}setTargetDelta(s){this.targetDelta=s,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(s){this.options={...this.options,...s,crossfade:s.crossfade!==void 0?s.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Qr.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(s=!1){const o=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=o.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=o.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=o.isSharedProjectionDirty);const c=!!this.resumingFrom||this!==o;if(!(s||c&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:f,layoutId:h}=this.options;if(!this.layout||!(f||h))return;this.resolvedRelativeTargetAt=Qr.timestamp;const p=this.getClosestProjectingParent();p&&this.linkedParentVersion!==p.layoutVersion&&!p.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&p&&p.layout?this.createRelativeTarget(p,this.layout.layoutBox,p.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=Fr(),this.targetWithTransforms=Fr()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),bq(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):za(this.target,this.layout.layoutBox),GI(this.target,this.targetDelta)):za(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&p&&!!p.resumingFrom==!!this.resumingFrom&&!p.options.layoutScroll&&p.target&&this.animationProgress!==1?this.createRelativeTarget(p,this.target,p.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||a1(this.parent.latestValues)||WI(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(s,o,c){this.relativeParent=s,this.linkedParentVersion=s.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Fr(),this.relativeTargetOrigin=Fr(),ey(this.relativeTargetOrigin,o,c,this.options.layoutAnchor||void 0),za(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const s=this.getLead(),o=!!this.resumingFrom||this!==s;let c=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(c=!1),o&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(c=!1),this.resolvedRelativeTargetAt===Qr.timestamp&&(c=!1),c)return;const{layout:u,layoutId:f}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(u||f))return;za(this.layoutCorrected,this.layout.layoutBox);const h=this.treeScale.x,p=this.treeScale.y;XY(this.layoutCorrected,this.treeScale,this.path,o),s.layout&&!s.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(s.target=s.layout.layoutBox,s.targetWithTransforms=Fr());const{target:y}=s;if(!y){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(yA(this.prevProjectionDelta.x,this.projectionDelta.x),yA(this.prevProjectionDelta.y,this.projectionDelta.y)),Ih(this.projectionDelta,this.layoutCorrected,y,this.latestValues),(this.treeScale.x!==h||this.treeScale.y!==p||!CA(this.projectionDelta.x,this.prevProjectionDelta.x)||!CA(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",y))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(s=!0){if(this.options.visualElement?.scheduleRender(),s){const o=this.getStack();o&&o.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=wd(),this.projectionDelta=wd(),this.projectionDeltaWithTransform=wd()}setAnimationOrigin(s,o=!1){const c=this.snapshot,u=c?c.latestValues:{},f={...this.latestValues},h=wd();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!o;const p=Fr(),y=c?c.source:void 0,v=this.layout?this.layout.source:void 0,w=y!==v,b=this.getStack(),_=!b||b.members.length<=1,E=!!(w&&!_&&this.options.crossfade===!0&&!this.path.some(Kq));this.animationProgress=0;let M;this.mixTargetDelta=T=>{const R=T/1e3;IA(h.x,s.x,R),IA(h.y,s.y,R),this.setTargetDelta(h),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(ey(p,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),Xq(this.relativeTarget,this.relativeTargetOrigin,p,R),M&&kq(this.relativeTarget,M)&&(this.isProjectionDirty=!1),M||(M=Fr()),za(M,this.relativeTarget)),w&&(this.animationValues=f,Tq(f,u,this.latestValues,R,E,_)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=R},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(s){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(Po(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Wn.update(()=>{y0.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Kc(0)),this.motionValue.jump(0,!1),this.currentAnimation=Rq(this.motionValue,[0,1e3],{...s,velocity:0,isSync:!0,onUpdate:o=>{this.mixTargetDelta(o),s.onUpdate&&s.onUpdate(o)},onStop:()=>{},onComplete:()=>{s.onComplete&&s.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const s=this.getStack();s&&s.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(Iq),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const s=this.getLead();let{targetWithTransforms:o,target:c,layout:u,latestValues:f}=s;if(!(!o||!c||!u)){if(this!==s&&this.layout&&u&&cO(this.options.animationType,this.layout.layoutBox,u.layoutBox)){c=this.target||Fr();const h=ki(this.layout.layoutBox.x);c.x.min=s.target.x.min,c.x.max=c.x.min+h;const p=ki(this.layout.layoutBox.y);c.y.min=s.target.y.min,c.y.max=c.y.min+p}za(o,c),m0(o,f),Ih(this.projectionDeltaWithTransform,this.layoutCorrected,o,f)}}registerSharedNode(s,o){this.sharedNodes.has(s)||this.sharedNodes.set(s,new Lq),this.sharedNodes.get(s).add(o);const u=o.options.initialPromotionConfig;o.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(o):void 0})}isLead(){const s=this.getStack();return s?s.lead===this:!0}getLead(){const{layoutId:s}=this.options;return s?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:s}=this.options;return s?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:s}=this.options;if(s)return this.root.sharedNodes.get(s)}promote({needsReset:s,transition:o,preserveFollowOpacity:c}={}){const u=this.getStack();u&&u.promote(this,c),s&&(this.projectionDelta=void 0,this.needsReset=!0),o&&this.setOptions({transition:o})}relegate(){const s=this.getStack();return s?s.relegate(this):!1}resetSkewAndRotation(){const{visualElement:s}=this.options;if(!s)return;let o=!1;const{latestValues:c}=s;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(o=!0),!o)return;const u={};c.z&&Lb("z",s,u,this.animationValues);for(let f=0;f<Db.length;f++)Lb(`rotate${Db[f]}`,s,u,this.animationValues),Lb(`skew${Db[f]}`,s,u,this.animationValues);s.render();for(const f in u)s.setStaticValue(f,u[f]),this.animationValues&&(this.animationValues[f]=u[f]);s.scheduleRender()}applyProjectionStyles(s,o){if(!this.instance||this.isSVG)return;if(!this.isVisible){s.visibility="hidden";return}const c=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,s.visibility="",s.opacity="",s.pointerEvents=g0(o?.pointerEvents)||"",s.transform=c?c(this.latestValues,""):"none";return}const u=this.getLead();if(!this.projectionDelta||!this.layout||!u.target){this.options.layoutId&&(s.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,s.pointerEvents=g0(o?.pointerEvents)||""),this.hasProjected&&!_c(this.latestValues)&&(s.transform=c?c({},""):"none",this.hasProjected=!1);return}s.visibility="";const f=u.animationValues||u.latestValues;this.applyTransformsToTarget();let h=Eq(this.projectionDeltaWithTransform,this.treeScale,f);c&&(h=c(f,h)),s.transform=h;const{x:p,y}=this.projectionDelta;s.transformOrigin=`${p.origin*100}% ${y.origin*100}% 0`,u.animationValues?s.opacity=u===this?f.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:f.opacityExit:s.opacity=u===this?f.opacity!==void 0?f.opacity:"":f.opacityExit!==void 0?f.opacityExit:0;for(const v in o1){if(f[v]===void 0)continue;const{correct:w,applyTo:b,isCSSVariable:_}=o1[v],E=h==="none"?f[v]:w(f[v],u);if(b){const M=b.length;for(let T=0;T<M;T++)s[b[T]]=E}else _?this.options.visualElement.renderState.vars[v]=E:s[v]=E}this.options.layoutId&&(s.pointerEvents=u===this?g0(o?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(s=>s.currentAnimation?.stop()),this.root.nodes.forEach(NA),this.root.sharedNodes.clear()}}}function Fq(t){t.updateLayout()}function Uq(t){const e=t.resumeFrom?.snapshot||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:r}=t.layout,{animationType:i}=t.options,a=e.source!==t.layout.source;if(i==="size")ws(f=>{const h=a?e.measuredBox[f]:e.layoutBox[f],p=ki(h);h.min=n[f].min,h.max=h.min+p});else if(i==="x"||i==="y"){const f=i==="x"?"y":"x";l1(a?e.measuredBox[f]:e.layoutBox[f],n[f])}else cO(i,e.layoutBox,n)&&ws(f=>{const h=a?e.measuredBox[f]:e.layoutBox[f],p=ki(n[f]);h.max=h.min+p,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[f].max=t.relativeTarget[f].min+p)});const s=wd();Ih(s,n,e.layoutBox);const o=wd();a?Ih(o,t.applyTransform(r,!0),e.measuredBox):Ih(o,n,e.layoutBox);const c=!rO(s);let u=!1;if(!t.resumeFrom){const f=t.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:h,layout:p}=f;if(h&&p){const y=t.options.layoutAnchor||void 0,v=Fr();ey(v,e.layoutBox,h.layoutBox,y);const w=Fr();ey(w,n,p.layoutBox,y),iO(v,w)||(u=!0),f.options.layoutRoot&&(t.relativeTarget=w,t.relativeTargetOrigin=v,t.relativeParent=f)}}}t.notifyListeners("didUpdate",{layout:n,snapshot:e,delta:o,layoutDelta:s,hasLayoutChanged:c,hasRelativeLayoutChanged:u})}else if(t.isLead()){const{onExitComplete:n}=t.options;n&&n()}t.options.transition=void 0}function jq(t){t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function Bq(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function zq(t){t.clearSnapshot()}function NA(t){t.clearMeasurements()}function Vq(t){t.isLayoutDirty=!0,t.updateLayout()}function DA(t){t.isLayoutDirty=!1}function Hq(t){t.isAnimationBlocked&&t.layout&&!t.isLayoutDirty&&(t.snapshot=t.layout,t.isLayoutDirty=!0)}function Wq(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function LA(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function Gq(t){t.resolveTargetDelta()}function $q(t){t.calcProjection()}function Yq(t){t.resetSkewAndRotation()}function qq(t){t.removeLeadSnapshot()}function IA(t,e,n){t.translate=ar(e.translate,0,n),t.scale=ar(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function OA(t,e,n,r){t.min=ar(e.min,n.min,r),t.max=ar(e.max,n.max,r)}function Xq(t,e,n,r){OA(t.x,e.x,n.x,r),OA(t.y,e.y,n.y,r)}function Kq(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const Zq={duration:.45,ease:[.4,0,.1,1]},FA=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),UA=FA("applewebkit/")&&!FA("chrome/")?Math.round:Ca;function jA(t){t.min=UA(t.min),t.max=UA(t.max)}function Jq(t){jA(t.x),jA(t.y)}function cO(t,e,n){return t==="position"||t==="preserve-aspect"&&!xq(TA(e),TA(n),.2)}function Qq(t){return t!==t.root&&t.scroll?.wasRoot}const eX=lO({attachResizeListener:(t,e)=>np(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),tX=t=>!t.isLayoutDirty&&t.willUpdate(!1);function BA(){const t=new Set,e=new WeakMap,n=()=>t.forEach(tX);return{add:r=>{t.add(r),e.set(r,r.addEventListener("willUpdate",n))},remove:r=>{t.delete(r);const i=e.get(r);i&&(i(),e.delete(r)),n()},dirty:n}}const Ib={current:void 0},uO=lO({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!Ib.current){const t=new eX({});t.mount(window),t.setOptions({layoutScroll:!0}),Ib.current=t}return Ib.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),Rp=x.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function zA(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function nX(...t){return e=>{let n=!1;const r=t.map(i=>{const a=zA(i,e);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let i=0;i<r.length;i++){const a=r[i];typeof a=="function"?a():zA(t[i],null)}}}}function rX(...t){return x.useCallback(nX(...t),t)}class iX extends x.Component{getSnapshotBeforeUpdate(e){const n=this.props.childRef.current;if(u0(n)&&e.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const r=n.offsetParent,i=u0(r)&&r.offsetWidth||0,a=u0(r)&&r.offsetHeight||0,s=getComputedStyle(n),o=this.props.sizeRef.current;o.height=parseFloat(s.height),o.width=parseFloat(s.width),o.top=n.offsetTop,o.left=n.offsetLeft,o.right=i-o.width-o.left,o.bottom=a-o.height-o.top}return null}componentDidUpdate(){}render(){return this.props.children}}function aX({children:t,isPresent:e,anchorX:n,anchorY:r,root:i,pop:a}){const s=x.useId(),o=x.useRef(null),c=x.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0}),{nonce:u}=x.useContext(Rp),f=t.props?.ref??t?.ref,h=rX(o,f);return x.useInsertionEffect(()=>{const{width:p,height:y,top:v,left:w,right:b,bottom:_}=c.current;if(e||a===!1||!o.current||!p||!y)return;const E=n==="left"?`left: ${w}`:`right: ${b}`,M=r==="bottom"?`bottom: ${_}`:`top: ${v}`;o.current.dataset.motionPopId=s;const T=document.createElement("style");u&&(T.nonce=u);const R=i??document.head;return R.appendChild(T),T.sheet&&T.sheet.insertRule(`
789
789
  [data-motion-pop-id="${s}"] {
@@ -804,7 +804,7 @@ settings.appearance.language.chinese,ui,SettingsPage,SettingsPage,language_chine
804
804
  ${s.right}px ${s.bottom}px,
805
805
  ${s.right}px ${s.top}px,
806
806
  ${s.left}px ${s.top}px
807
- )`}return m.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...i,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:a}})});function hy(t,e){t&&Object.assign(t.style,e)}const Cne={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},Ane={position:"fixed"},Rne=x.forwardRef(function(e,n){const{anchor:r,positionMethod:i="absolute",className:a,render:s,side:o="bottom",align:c="center",sideOffset:u=0,alignOffset:f=0,collisionBoundary:h="clipping-ancestors",collisionPadding:p,arrowPadding:y=5,sticky:v=!1,disableAnchorTracking:w,alignItemWithTrigger:b=!0,collisionAvoidance:_=NJ,...E}=e,{store:M,listRef:T,labelsRef:R,alignItemWithTriggerActiveRef:A,selectedItemTextRef:P,valuesRef:k,initialValueRef:N,popupRef:j,setValue:L}=Vl(),z=sF(),U=mn(M,fn.open),V=mn(M,fn.mounted),W=mn(M,fn.modal),K=mn(M,fn.value),Q=mn(M,fn.openMethod),O=mn(M,fn.positionerElement),G=mn(M,fn.triggerElement),Y=mn(M,fn.isItemEqualToValue),H=x.useRef(null),te=x.useRef(null),[re,ue]=x.useState(b),ce=V&&re&&Q!=="touch";!V&&re!==b&&ue(b),Yt(()=>{V||(fn.scrollUpArrowVisible(M.state)&&M.set("scrollUpArrowVisible",!1),fn.scrollDownArrowVisible(M.state)&&M.set("scrollDownArrowVisible",!1))},[M,V]),x.useImperativeHandle(A,()=>ce),RE((ce||W)&&U&&Q!=="touch",G);const ee=gF({anchor:r,floatingRootContext:z,positionMethod:i,mounted:V,side:o,sideOffset:u,align:c,alignOffset:f,arrowPadding:y,collisionBoundary:h,collisionPadding:p,sticky:v,disableAnchorTracking:w??ce,collisionAvoidance:_,keepMounted:!0}),le=ce?"none":ee.side,ve=ce?Ane:ee.positionerStyles,Pe=x.useMemo(()=>{const _e={};return U||(_e.pointerEvents="none"),{role:"presentation",hidden:!V,style:{...ve,..._e}}},[U,V,ve]),be=x.useMemo(()=>({open:U,side:le,align:ee.align,anchorHidden:ee.anchorHidden}),[U,le,ee.align,ee.anchorHidden]),Ye=jt(_e=>{M.set("positionerElement",_e)}),he=Xr("div",e,{ref:[n,Ye],state:be,stateAttributesMapping:du,props:[Pe,E]}),Ue=x.useRef(0),je=jt(_e=>{if(_e.size===0&&Ue.current===0||k.current.length===0)return;const oe=Ue.current;if(Ue.current=_e.size,_e.size===oe)return;const J=Mn(nv);if(oe!==0&&!M.state.multiple&&K!==null&&M1(k.current,K,Y)===-1){const Ne=N.current,Le=Ne!=null&&f_(k.current,Ne,Y)?Ne:null;L(Le,J),Le===null&&(M.set("selectedIndex",null),P.current=null)}if(oe!==0&&M.state.multiple&&Array.isArray(K)){const ze=K.filter(Ne=>f_(k.current,Ne,Y));(ze.length!==K.length||ze.some(Ne=>!f_(K,Ne,Y)))&&(L(ze,J),ze.length===0&&(M.set("selectedIndex",null),P.current=null))}if(U&&ce){M.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const ze={height:""};hy(O,ze),hy(j.current,ze)}}),et=x.useMemo(()=>({...ee,side:le,alignItemWithTriggerActive:ce,setControlledAlignItemWithTrigger:ue,scrollUpArrowRef:H,scrollDownArrowRef:te}),[ee,le,ce,ue]);return m.jsx(yne,{elementsRef:T,labelsRef:R,onMapChange:je,children:m.jsxs(yF.Provider,{value:et,children:[V&&W&&m.jsx(PE,{inert:AE(!U),cutout:G}),he]})})});function vF(t){const e=t.currentTarget.getBoundingClientRect();return e.top+1<=t.clientY&&t.clientY<=e.bottom-1&&e.left+1<=t.clientX&&t.clientX<=e.right-1}const Sg="base-ui-disable-scrollbar",eP={className:Sg,getElement(t){return m.jsx("style",{nonce:t,href:Sg,precedence:"base-ui:low",children:`.${Sg}{scrollbar-width:none}.${Sg}::-webkit-scrollbar{display:none}`})}},Pne=x.createContext(void 0);function xF(t){return x.useContext(Pne)}const bF="ArrowUp",_F="ArrowDown",wF="ArrowLeft",SF="ArrowRight",kF="Home",EF="End",Nne=new Set([wF,SF]),Dne=new Set([bF,_F]),Lne=new Set([...Nne,...Dne]);[...Lne];const NE=new Set([bF,_F,wF,SF,kF,EF]);function DE(t){return t==="starting"?PJ:ei}function Ine(t,e=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(e,Math.min(t,n))}const One=x.createContext(void 0),Fne={disableStyleElements:!1};function Une(){return x.useContext(One)??Fne}const jne={...du,...lf},Bne=x.forwardRef(function(e,n){const{render:r,className:i,...a}=e,{store:s,popupRef:o,onOpenChangeComplete:c,setOpen:u,valueRef:f,selectedItemTextRef:h,keyboardActiveRef:p,multiple:y,handleScrollArrowVisibility:v,scrollHandlerRef:w,highlightItemOnHover:b}=Vl(),{side:_,align:E,alignItemWithTriggerActive:M,setControlledAlignItemWithTrigger:T,scrollDownArrowRef:R,scrollUpArrowRef:A}=Tne(),P=xF()!=null,k=sF(),{nonce:N,disableStyleElements:j}=Une(),L=ji(),z=mn(s,fn.id),U=mn(s,fn.open),V=mn(s,fn.mounted),W=mn(s,fn.popupProps),K=mn(s,fn.transitionStatus),Q=mn(s,fn.triggerElement),O=mn(s,fn.positionerElement),G=mn(s,fn.listElement),Y=x.useRef(0),H=x.useRef(!1),te=x.useRef(0),re=x.useRef(!1),ue=x.useRef({}),ce=tv(),ee=jt(be=>{if(!O||!o.current||!re.current)return;if(H.current||!M){v();return}const Ye=O.style.top==="0px",he=O.style.bottom==="0px",Ue=O.getBoundingClientRect().height,je=Hs(O),et=getComputedStyle(O),_e=parseFloat(et.marginTop),oe=parseFloat(et.marginBottom),J=tP(getComputedStyle(o.current)),ze=je.documentElement.clientHeight-_e-oe,Ne=be.scrollTop,De=be.scrollHeight,Le=be.clientHeight,$=De-Le;let I=0,Z=null,pe=!1;if(Ye){const Se=$-Ne,xe=Ue+Se,Ie=Math.min(xe,ze);I=Ie,Ie!==ze?Z=$:pe=!0}else if(he){const Se=Ne-0,xe=Ue+Se,Ie=Math.min(xe,ze),He=xe-ze;I=Ie,Ie!==ze?Z=0:(pe=!0,Ne<$&&(Z=Ne-(Se-He)))}I!==0&&(O.style.height=`${I}px`),Z!=null&&(be.scrollTop=Z),(pe||I>=J)&&(H.current=!0),v()});x.useImperativeHandle(w,()=>ee,[ee]),cf({open:U,ref:o,onComplete(){U&&c?.(!0)}});const le=x.useMemo(()=>({open:U,transitionStatus:K,side:_,align:E}),[U,K,_,E]);Yt(()=>{!O||!o.current||Object.keys(ue.current).length||(ue.current={top:O.style.top||"0",left:O.style.left||"0",right:O.style.right,height:O.style.height,bottom:O.style.bottom,minHeight:O.style.minHeight,maxHeight:O.style.maxHeight,marginTop:O.style.marginTop,marginBottom:O.style.marginBottom})},[o,O]),Yt(()=>{U||M||(re.current=!1,H.current=!1,Y.current=0,te.current=0,hy(O,ue.current))},[U,M,O,o]),Yt(()=>{const be=o.current;if(!(!U||!Q||!O||!be||s.state.transitionStatus==="ending")){if(!M){re.current=!0,ce.request(v),be.style.removeProperty("--transform-origin");return}queueMicrotask(()=>{const Ye=Vne(be);be.style.removeProperty("--transform-origin");try{const he=getComputedStyle(O),Ue=getComputedStyle(be),je=Hs(Q),et=Pr(O),_e=Q.getBoundingClientRect(),oe=O.getBoundingClientRect(),J=_e.left,ze=_e.height,Ne=G||be,De=Ne.scrollHeight,Le=parseFloat(Ue.borderBottomWidth),$=parseFloat(he.marginTop)||10,I=parseFloat(he.marginBottom)||10,Z=parseFloat(he.minHeight)||100,pe=tP(Ue),Se=5,xe=5,Ie=20,He=je.documentElement.clientHeight-$-I,qe=je.documentElement.clientWidth,ft=He-_e.bottom+ze,We=h.current,Xe=f.current;let nt,ct=0,Ke=0;if(We&&Xe){const St=Xe.getBoundingClientRect();nt=We.getBoundingClientRect();const Rt=St.left-J,hn=nt.left-oe.left,xn=St.top-_e.top+St.height/2,ie=nt.top-oe.top+nt.height/2;ct=Rt-hn,Ke=ie-xn}const gt=ft+Ke+I+Le;let ne=Math.min(He,gt);const Be=He-$-I,ke=gt-ne,Ae=Math.max(Se,J+ct),Ve=qe-xe,ge=Math.max(0,Ae+oe.width-Ve);O.style.left=`${Ae-ge}px`,O.style.height=`${ne}px`,O.style.maxHeight="auto",O.style.marginTop=`${$}px`,O.style.marginBottom=`${I}px`,be.style.height="100%";const ht=Ne.scrollHeight-Ne.clientHeight,bt=ke>=ht;bt&&(ne=Math.min(He,oe.height)-(ke-ht));const Kt=_e.top<Ie||_e.bottom>He-Ie||ne<Math.min(De,Z),Bt=(et.visualViewport?.scale??1)!==1&&f4;if(Kt||Bt){re.current=!0,hy(O,ue.current),gi.flushSync(()=>T(!1));return}if(bt){const St=Math.max(0,He-gt);O.style.top=oe.height>=Be?"0":`${St}px`,O.style.height=`${ne}px`,Ne.scrollTop=Ne.scrollHeight-Ne.clientHeight,Y.current=Math.max(Z,ne)}else O.style.bottom="0",Y.current=Math.max(Z,ne),Ne.scrollTop=ke;if(nt){const St=oe.top,Rt=oe.height,hn=nt.top+nt.height/2,xn=Rt>0?(hn-St)/Rt*100:50,ie=Ine(xn,0,100);be.style.setProperty("--transform-origin",`50% ${ie}%`)}(Y.current===He||ne>=pe)&&(H.current=!0),v(),setTimeout(()=>{re.current=!0})}finally{Ye()}})}},[s,U,O,Q,f,h,o,v,M,T,ce,R,A,G]),x.useEffect(()=>{if(!M||!O||!U)return;const be=Pr(O);function Ye(he){u(!1,Mn(pee,he))}return be.addEventListener("resize",Ye),()=>{be.removeEventListener("resize",Ye)}},[u,M,O,U]);const ve={...G?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":y||void 0,id:`${z}-list`},onKeyDown(be){p.current=!0,P&&NE.has(be.key)&&be.stopPropagation()},onMouseMove(){p.current=!1},onPointerLeave(be){if(!b||vF(be)||be.pointerType==="touch")return;const Ye=be.currentTarget;L.start(0,()=>{s.set("activeIndex",null),Ye.focus({preventScroll:!0})})},onScroll(be){G||w.current?.(be.currentTarget)},...M&&{style:G?{height:"100%"}:Cne}},Pe=Xr("div",e,{ref:[n,o],state:le,stateAttributesMapping:jne,props:[W,ve,DE(K),{className:!G&&M?eP.className:void 0},a]});return m.jsxs(x.Fragment,{children:[!j&&eP.getElement(N),m.jsx(wE,{context:k,modal:!1,disabled:!V,restoreFocus:!0,children:Pe})]})});function tP(t){const e=t.maxHeight||"";return e.endsWith("px")&&parseFloat(e)||1/0}const nP={transform:"none",scale:"1",translate:"0 0"};function zne(t,e,n){n?t.setProperty(e,n):t.removeProperty(e)}function Vne(t){const{style:e}=t,n={},r=Object.keys(nP);for(const i of r)n[i]=e.getPropertyValue(i),e.setProperty(i,nP[i]);return()=>{for(const i of r)zne(e,i,n[i])}}let MF=(function(t){return t[t.None=0]="None",t[t.GuessFromOrder=1]="GuessFromOrder",t})({});function Hne(t={}){const{label:e,metadata:n,textRef:r,indexGuessBehavior:i,index:a}=t,{register:s,unregister:o,subscribeMapChange:c,elementsRef:u,labelsRef:f,nextIndexRef:h}=gne(),p=x.useRef(-1),[y,v]=x.useState(a??(i===MF.GuessFromOrder?()=>{if(p.current===-1){const _=h.current;h.current+=1,p.current=_}return p.current}:-1)),w=x.useRef(null),b=x.useCallback(_=>{if(w.current=_,y!==-1&&_!==null&&(u.current[y]=_,f)){const E=e!==void 0;f.current[y]=E?e:r?.current?.textContent??_.textContent}},[y,u,f,e,r]);return Yt(()=>{if(a!=null)return;const _=w.current;if(_)return s(_,n),()=>{o(_)}},[a,s,o,n]),Yt(()=>{if(a==null)return c(_=>{const E=w.current?_.get(w.current)?.index:null;E!=null&&v(E)})},[a,c,v]),x.useMemo(()=>({ref:b,index:y}),[y,b])}const TF=x.createContext(void 0);function LE(){const t=x.useContext(TF);if(!t)throw new Error(Wi(57));return t}const rP=x.memo(x.forwardRef(function(e,n){const{render:r,className:i,value:a=null,label:s,disabled:o=!1,nativeButton:c=!1,...u}=e,f=x.useRef(null),h=Hne({label:s,textRef:f,indexGuessBehavior:MF.GuessFromOrder}),{store:p,getItemProps:y,setOpen:v,setValue:w,selectionRef:b,typingRef:_,valuesRef:E,keyboardActiveRef:M,multiple:T,highlightItemOnHover:R}=Vl(),A=ji(),P=mn(p,fn.isActive,h.index),k=mn(p,fn.isSelected,h.index,a),N=mn(p,fn.isSelectedByFocus,h.index),j=mn(p,fn.isItemEqualToValue),L=h.index,z=L!==-1,U=x.useRef(null),V=jr(L);Yt(()=>{if(!z)return;const ee=E.current;return ee[L]=a,()=>{delete ee[L]}},[z,L,a,E]),Yt(()=>{if(!z)return;const ee=p.state.value;let le=ee;T&&Array.isArray(ee)&&ee.length>0&&(le=ee[ee.length-1]),le!==void 0&&Hd(le,a,j)&&p.set("selectedIndex",L)},[z,L,T,j,p,a]);const W=x.useMemo(()=>({disabled:o,selected:k,highlighted:P}),[o,k,P]),K=y({active:P,selected:k});K.onFocus=void 0,K.id=void 0;const Q=x.useRef(null),O=x.useRef("mouse"),G=x.useRef(!1),{getButtonProps:Y,buttonRef:H}=ev({disabled:o,focusableWhenDisabled:!0,native:c});function te(ee){const le=p.state.value;if(T){const ve=Array.isArray(le)?le:[],Pe=k?Bte(ve,a,j):[...ve,a];w(Pe,Mn(r_,ee))}else w(a,Mn(r_,ee)),v(!1,Mn(r_,ee))}const re={role:"option","aria-selected":k,tabIndex:P?0:-1,onFocus(){p.set("activeIndex",L)},onMouseEnter(){!M.current&&p.state.selectedIndex===null&&p.set("activeIndex",L)},onMouseMove(){R&&p.set("activeIndex",L)},onMouseLeave(ee){!R||M.current||vF(ee)||A.start(0,()=>{p.state.activeIndex===L&&p.set("activeIndex",null)})},onTouchStart(){b.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}},onKeyDown(ee){Q.current=ee.key,p.set("activeIndex",L)},onClick(ee){G.current=!1,!(ee.type==="keydown"&&Q.current===null)&&(o||Q.current===" "&&_.current||O.current!=="touch"&&!P||(Q.current=null,te(ee.nativeEvent)))},onPointerEnter(ee){O.current=ee.pointerType},onPointerDown(ee){O.current=ee.pointerType,G.current=!0},onMouseUp(ee){if(o)return;if(G.current){G.current=!1;return}const le=!b.current.allowSelectedMouseUp&&k,ve=!b.current.allowUnselectedMouseUp&&!k;le||ve||O.current!=="touch"&&!P||te(ee.nativeEvent)}},ue=Xr("div",e,{ref:[H,n,h.ref,U],state:W,props:[K,re,u,Y]}),ce=x.useMemo(()=>({selected:k,indexRef:V,textRef:f,selectedByFocus:N,hasRegistered:z}),[k,V,f,N,z]);return m.jsx(TF.Provider,{value:ce,children:ue})})),iP=x.forwardRef(function(e,n){const r=e.keepMounted??!1,{selected:i}=LE();return r||i?m.jsx(Wne,{...e,ref:n}):null}),Wne=x.memo(x.forwardRef((t,e)=>{const{render:n,className:r,keepMounted:i,...a}=t,{selected:s}=LE(),o=x.useRef(null),{transitionStatus:c,setMounted:u}=ME(s),f=x.useMemo(()=>({selected:s,transitionStatus:c}),[s,c]),h=Xr("span",t,{ref:[e,o],state:f,props:[{"aria-hidden":!0,children:"✔️"},a],stateAttributesMapping:lf});return cf({open:s,ref:o,onComplete(){s||u(!1)}}),h})),aP=x.memo(x.forwardRef(function(e,n){const{indexRef:r,textRef:i,selectedByFocus:a,hasRegistered:s}=LE(),{selectedItemTextRef:o}=Vl(),{className:c,render:u,...f}=e,h=x.useCallback(y=>{if(!y||!s)return;const v=o.current===null||!o.current.isConnected;(a||v&&r.current===0)&&(o.current=y)},[o,r,a,s]);return Xr("div",e,{ref:[h,n,i],props:f})}));function CF({prefersReducedMotion:t,screenshotCapture:e}){return!(e||t)}function fu({children:t,title:e,subtitle:n,className:r="",bodyClassName:i=""}){return m.jsxs("div",{className:`rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 transition-colors duration-200 ${r}`,children:[(e||n)&&m.jsxs("div",{className:"px-5 py-4 border-b border-oai-gray-200 dark:border-oai-gray-800 transition-colors duration-200",children:[e&&m.jsx("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide transition-colors duration-200",children:e}),n&&m.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-300 mt-1 transition-colors duration-200",children:n})]}),m.jsx("div",{className:`p-5 ${i}`,children:t})]})}function Gne(){return m.jsxs(Ei,{to:"/landing",className:"flex items-center gap-2.5 no-underline hover:opacity-80 transition-opacity",children:[m.jsx("img",{src:"/app-icon.png",alt:"Token Tracker",width:28,height:28,className:"rounded-md"}),m.jsx("span",{className:"text-base font-semibold text-oai-black dark:text-oai-white leading-tight",children:"Token Tracker"})]})}function $ne({children:t,header:e,footer:n,className:r="",hideHeader:i=!1,hideFooter:a=!1,bare:s=!1}){return s?m.jsxs("div",{className:`flex flex-col flex-1 min-h-0 ${r}`,children:[m.jsx("main",{className:"flex-1 px-6 py-6",children:t}),!a&&n&&m.jsx("footer",{className:"border-t border-oai-gray-200 dark:border-oai-gray-800 px-6 py-4 mt-auto transition-colors duration-200",children:n})]}):m.jsxs("div",{className:`min-h-screen bg-oai-white dark:bg-oai-gray-950 text-oai-black dark:text-oai-white font-sans flex flex-col transition-colors duration-200 ${r}`,children:[!i&&m.jsxs("header",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800 px-6 py-4 flex items-center justify-between transition-colors duration-200",children:[m.jsx(Gne,{}),m.jsx("div",{className:"flex-1 flex justify-center",children:e})]}),m.jsx("main",{className:"flex-1 px-6 py-6",children:t}),!a&&n&&m.jsx("footer",{className:"border-t border-oai-gray-200 dark:border-oai-gray-800 px-6 py-4 mt-auto transition-colors duration-200",children:n})]})}function Yne(t){if(!t||typeof t!="object")return null;const e=t.user_metadata&&typeof t.user_metadata=="object"?t.user_metadata:{},n=t.profile&&typeof t.profile=="object"?t.profile:{},r=e.avatar_url||e.picture||n.avatar_url||t.avatar_url;return typeof r=="string"&&r.trim()?r.trim():null}function sP(t){const e=String(t||"").trim();if(!e)return"?";const n=e.split(/\s+/).filter(Boolean);return n.length>=2?(n[0][0]+n[n.length-1][0]).toUpperCase():e.slice(0,2).toUpperCase()}function py({className:t,variant:e="header",collapsed:n=!1,onAfterAction:r}){su();const i=e==="sidebar",{enabled:a,loading:s,signedIn:o,user:c,displayName:u}=ss(),{openLoginModal:f}=Ep(),h=Jd(),p=x.useMemo(()=>Yne(c),[c]);if(!a)return null;if(s)return m.jsx("div",{className:yt("h-9 w-9 shrink-0 rounded-full bg-oai-gray-200 dark:bg-oai-gray-800 animate-pulse",t),"aria-hidden":!0});if(!o)return i?m.jsxs("button",{type:"button",onClick:()=>{f(),r?.()},className:yt("flex items-center gap-2 rounded-md px-2 py-1.5 text-[13px] font-medium text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-200/60 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 min-w-0",n?"h-8 w-8 justify-center px-0":"w-full",t),"aria-label":F("header.auth.sign_in_aria"),title:n?F("header.auth.sign_in_aria"):void 0,children:[m.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center",children:m.jsx("img",{src:"/app-icon.png",alt:"",width:18,height:18,className:"h-[18px] w-[18px] rounded"})}),!n&&m.jsx("span",{className:"truncate flex-1 text-left",children:F("header.auth.sign_in_aria")})]}):m.jsx("button",{type:"button",onClick:f,className:yt("shrink-0 inline-flex h-9 items-center justify-center gap-1.5 rounded-full px-5 text-sm font-medium transition-colors duration-200 ease-out shadow-sm ring-1 ring-oai-gray-200 dark:ring-white/10 bg-oai-gray-900 text-white hover:bg-oai-gray-800 active:bg-oai-gray-950 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100 dark:active:bg-oai-gray-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 focus-visible:ring-offset-2 dark:focus-visible:ring-offset-oai-gray-950",t),"aria-label":F("header.auth.sign_in_aria"),children:F("header.auth.sign_in_aria")});const y=()=>{h("/settings"),r?.()};return m.jsx("div",{className:yt(i?"relative flex w-full shrink-0 items-center":"relative flex shrink-0 items-center",t),children:m.jsxs("button",{type:"button",onClick:y,className:yt(i?yt("flex w-full items-center gap-2 rounded-md px-2 py-1.5 hover:bg-oai-gray-200/60 dark:hover:bg-oai-gray-800 transition-colors min-w-0",n&&"justify-center px-0 py-0 h-9 w-9"):"flex items-center gap-2 rounded-full pl-1 pr-2 py-1 border border-transparent hover:bg-oai-gray-100 dark:hover:bg-oai-gray-900/80 hover:border-oai-gray-200 dark:hover:border-oai-gray-800 transition-colors"),"aria-label":F("header.auth.open_settings"),title:i&&n?u:void 0,children:[i?m.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center",children:p?m.jsx("img",{src:p,alt:"",width:20,height:20,className:"h-5 w-5 rounded-full object-cover ring-1 ring-oai-gray-300 dark:ring-oai-gray-700",referrerPolicy:"no-referrer"}):m.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-oai-brand-600 text-[9px] font-semibold text-white ring-1 ring-oai-brand-500/50",children:sP(u)})}):p?m.jsx("img",{src:p,alt:"",width:32,height:32,className:"h-8 w-8 rounded-full object-cover ring-1 ring-oai-gray-300 dark:ring-oai-gray-700 shrink-0",referrerPolicy:"no-referrer"}):m.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-oai-brand-600 text-xs font-semibold text-white ring-1 ring-oai-brand-500/50",children:sP(u)}),i?!n&&m.jsx("span",{className:"truncate text-[13px] font-medium text-oai-gray-900 dark:text-oai-gray-200 flex-1 text-left min-w-0",children:u}):m.jsx("span",{className:"hidden sm:inline truncate text-sm font-medium text-oai-gray-900 dark:text-oai-gray-200 max-w-[120px]",children:u})]})})}const A1="tt.sidebarCollapsed";function qne(){return[{id:"general",label:F("nav.group.general"),items:[{id:"usage",to:"/dashboard",icon:w7,label:F("nav.usage")},{id:"limits",to:"/limits",icon:A7,label:F("nav.limits")},{id:"leaderboard",to:"/leaderboard",icon:cG,label:F("nav.leaderboard")}]},{id:"tools",label:F("nav.group.tools"),items:[{id:"widgets",to:"/widgets",icon:U7,label:F("nav.widgets")},{id:"skills",to:"/skills",icon:J7,label:F("nav.skills")},{id:"ip-check",to:"/ip-check",icon:P7,label:F("nav.ip_check")}]},{id:"account",label:F("nav.group.account"),items:[{id:"settings",to:"/settings",icon:L3,label:F("nav.settings")}]}]}function Xne(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(A1)==="1"}catch{return!1}}function Kne(){const[t,e]=x.useState(Xne),n=x.useCallback(()=>{e(r=>{const i=!r;try{typeof window<"u"&&window.localStorage.setItem(A1,i?"1":"0")}catch{}return i})},[]);return x.useEffect(()=>{if(typeof window>"u")return;const r=i=>{i.key===A1&&e(i.newValue==="1")};return window.addEventListener("storage",r),()=>window.removeEventListener("storage",r)},[]),{collapsed:t,toggle:n}}function Zne(t,e){const n=t.replace(/\/+$/,"")||"/";return e==="/dashboard"?n==="/dashboard"||n==="/":e==="/leaderboard"?n==="/leaderboard"||n.startsWith("/leaderboard/"):n===e}function Jne({label:t,collapsed:e,first:n}){return e?n?null:m.jsx("div",{className:"mx-2 my-2 h-px bg-oai-gray-200/70 dark:bg-oai-gray-800/70","aria-hidden":!0}):m.jsx("div",{className:yt("px-3 pb-1 text-[10px] uppercase tracking-wider text-oai-gray-500 dark:text-oai-gray-500",n?"pt-2":"pt-4"),children:t})}function Qne({item:t,collapsed:e,active:n,onClick:r}){const i=t.icon;return m.jsxs(Ei,{to:t.to,onClick:r,title:e?t.label:void 0,"aria-current":n?"page":void 0,className:yt("flex items-center gap-2 rounded-md px-2 py-1.5 text-[13px] no-underline transition-colors",e&&"justify-center px-0 py-2",n?"bg-oai-gray-200/70 text-oai-black font-medium dark:bg-oai-gray-800 dark:text-white":"text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-200/50 hover:text-oai-black dark:hover:bg-oai-gray-800/60 dark:hover:text-white"),children:[m.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center",children:m.jsx(i,{className:"h-[15px] w-[15px]","aria-hidden":!0})}),!e&&m.jsx("span",{className:"truncate",children:t.label})]})}function ere({as:t="button",title:e,onClick:n,href:r,children:i,className:a,...s}){const o=yt("flex h-10 w-10 items-center justify-center rounded-lg text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-200/60 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white transition-colors no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",a);return t==="a"?m.jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer",title:e,"aria-label":e,className:o,...s,children:i}):m.jsx("button",{type:"button",title:e,"aria-label":e,onClick:n,className:o,...s,children:i})}function tre({repo:t="mm7894215/TokenTracker",glassChrome:e=!1}){const[n,r]=x.useState(null);return x.useEffect(()=>{if(typeof window>"u")return;const i=typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;CF({prefersReducedMotion:i,screenshotCapture:!1})&&fetch(`https://api.github.com/repos/${t}`).then(a=>a.json()).then(a=>{a&&typeof a.stargazers_count=="number"&&r(a.stargazers_count)}).catch(()=>{})},[t]),m.jsxs("a",{href:`https://github.com/${t}`,target:"_blank",rel:"noopener noreferrer","aria-label":n!==null?`Star on GitHub (${n})`:"Star on GitHub",className:yt("inline-flex h-7 items-center gap-1.5 rounded-full px-2.5 text-xs font-medium transition-colors no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",e?"border border-gray-500/20 dark:border-gray-500/30 bg-gray-500/[0.04] dark:bg-gray-500/[0.06] backdrop-blur-[2px] text-oai-gray-700 dark:text-oai-gray-300 hover:bg-gray-500/10 dark:hover:bg-gray-500/12 hover:border-gray-500/30 dark:hover:border-gray-500/40 hover:text-oai-black dark:hover:text-white":"border border-oai-gray-200 dark:border-oai-gray-700 text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-200/60 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white hover:border-oai-gray-300 dark:hover:border-oai-gray-600"),children:[m.jsx("svg",{height:"12",viewBox:"0 0 16 16",width:"12",className:"shrink-0 fill-current",children:m.jsx("path",{d:"M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"})}),m.jsx("span",{children:"Star"}),n!==null&&m.jsx("span",{className:"text-[10px] text-oai-gray-500 dark:text-oai-gray-500 tabular-nums",children:n})]})}const nre=[{value:"light",label:"Light",Icon:Ck},{value:"dark",label:"Dark",Icon:Mk},{value:"system",label:"System",Icon:Vy}];function rre({theme:t,resolvedTheme:e,onSetTheme:n,glassChrome:r=!1}){const[i,a]=x.useState(!1),s=x.useRef(null),o=e==="dark"?Mk:Ck;return x.useEffect(()=>{if(!i)return;const c=f=>{s.current&&!s.current.contains(f.target)&&a(!1)},u=f=>{f.key==="Escape"&&a(!1)};return document.addEventListener("mousedown",c),document.addEventListener("keydown",u),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",u)}},[i]),m.jsxs("div",{ref:s,className:"relative",children:[m.jsx("button",{type:"button","aria-label":"Theme","aria-expanded":i,"aria-haspopup":"menu",title:"Theme",onClick:()=>a(c=>!c),className:yt("inline-flex h-7 w-7 items-center justify-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",r?"border border-gray-500/20 dark:border-gray-500/30 bg-gray-500/[0.04] dark:bg-gray-500/[0.06] backdrop-blur-[2px] text-oai-gray-700 dark:text-oai-gray-300 hover:bg-gray-500/10 dark:hover:bg-gray-500/12 hover:border-gray-500/30 dark:hover:border-gray-500/40 hover:text-oai-black dark:hover:text-white":"border border-oai-gray-200 dark:border-oai-gray-700 text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-200/60 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white hover:border-oai-gray-300 dark:hover:border-oai-gray-600"),children:m.jsx(o,{className:"h-3.5 w-3.5","aria-hidden":!0})}),i&&m.jsx("div",{role:"menu",className:"absolute bottom-full left-0 mb-2 z-50 min-w-[140px] py-1 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 shadow-lg",children:nre.map(({value:c,label:u,Icon:f})=>{const h=t===c;return m.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{n(c),a(!1)},className:yt("flex w-full items-center gap-2.5 px-3 py-1.5 text-[13px] transition-colors",h?"text-oai-black dark:text-white bg-oai-gray-100 dark:bg-oai-gray-800":"text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/60 hover:text-oai-black dark:hover:text-white"),children:[m.jsx(f,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),m.jsx("span",{children:u})]},c)})})]})}function AF({collapsed:t,onToggleCollapsed:e,onItemClick:n,showCloseButton:r=!1,onClose:i,glassChrome:a=!1}){const o=Hi()?.pathname||"/",{theme:c,resolvedTheme:u,setTheme:f}=Dp(),{resolvedLocale:h}=su(),p=x.useMemo(()=>qne(),[h]);return m.jsxs(m.Fragment,{children:[m.jsx("div",{className:yt("px-2 pt-2 pb-2",t&&"flex justify-center"),children:r?m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("div",{className:"flex-1 min-w-0",children:m.jsx(py,{variant:"sidebar",collapsed:t,onAfterAction:n})}),m.jsx("button",{type:"button",onClick:i,"aria-label":F("nav.close_menu"),title:F("nav.close_menu"),className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-oai-gray-500 dark:text-oai-gray-500 hover:bg-oai-gray-200/60 dark:hover:bg-oai-gray-800 hover:text-oai-gray-900 dark:hover:text-oai-gray-200 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",children:m.jsx(Ak,{className:"h-4 w-4",strokeWidth:1.75,"aria-hidden":!0})})]}):m.jsx(py,{variant:"sidebar",collapsed:t,onAfterAction:n})}),m.jsx("nav",{"aria-label":F("nav.nav_label"),className:"flex-1 px-2 pb-2 flex flex-col overflow-y-auto",children:p.map((y,v)=>m.jsxs("div",{className:"flex flex-col",children:[m.jsx(Jne,{label:y.label,collapsed:t,first:v===0}),m.jsx("div",{className:"flex flex-col gap-0.5",children:y.items.map(w=>m.jsx(Qne,{item:w,collapsed:t,active:Zne(o,w.to),onClick:n},w.id))})]},y.id))}),m.jsxs("div",{className:yt("flex items-center px-2 py-3",t?"flex-col justify-center gap-2":"justify-between gap-2"),children:[m.jsx(rre,{theme:c,resolvedTheme:u,onSetTheme:f,glassChrome:a}),m.jsx("div",{className:"flex items-center gap-1.5",children:!t&&m.jsx(tre,{glassChrome:a})})]})]})}function ire({collapsed:t,onToggleCollapsed:e}){const n=x.useMemo(()=>typeof window>"u"?!1:Za()||Sk(),[]);return m.jsx("aside",{"aria-label":F("nav.aside_label"),className:yt("hidden lg:flex flex-col shrink-0 h-full min-h-0 transition-[width] duration-200",t?"w-[72px]":"w-[220px]"),children:m.jsx(AF,{collapsed:t,onToggleCollapsed:e,glassChrome:n})})}function are({open:t,onClose:e}){return x.useEffect(()=>{if(!t)return;const n=r=>{r.key==="Escape"&&e()};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},[t,e]),x.useEffect(()=>{if(!t)return;const n=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=n}},[t]),t?m.jsxs("div",{className:"lg:hidden fixed inset-0 z-[80] flex",children:[m.jsx("div",{className:"absolute inset-0 bg-black/40 backdrop-blur-sm",onClick:e,"aria-hidden":!0}),m.jsx("aside",{"aria-label":F("nav.aside_label"),className:"relative w-[260px] max-w-[80vw] flex flex-col bg-oai-white dark:bg-oai-gray-900 border-r border-oai-gray-200 dark:border-oai-gray-800 shadow-2xl",children:m.jsx(AF,{collapsed:!1,showCloseButton:!0,onClose:e,onItemClick:e})})]}):null}function sre({onOpenDrawer:t}){return m.jsxs("div",{className:"lg:hidden flex items-center justify-between gap-2 px-3 h-14 border-b border-oai-gray-200 dark:border-oai-gray-800",children:[m.jsx(ere,{title:F("nav.menu"),onClick:t,children:m.jsx(G7,{className:"h-5 w-5","aria-hidden":!0})}),m.jsxs(Ei,{to:"/landing",className:"flex items-center gap-2 no-underline hover:opacity-80 transition-opacity","aria-label":"Token Tracker",children:[m.jsx("img",{src:"/app-icon.png",alt:"",width:24,height:24,className:"rounded-md"}),m.jsx("span",{className:"text-sm font-semibold text-oai-black dark:text-oai-white",children:"Token Tracker"})]}),m.jsx("div",{className:"w-10 shrink-0","aria-hidden":!0})]})}function ore({children:t}){const{collapsed:e,toggle:n}=Kne(),[r,i]=x.useState(!1),a=x.useCallback(()=>i(!0),[]),s=x.useCallback(()=>i(!1),[]),o=x.useMemo(()=>typeof window>"u"?!1:Za()||Sk(),[]);return m.jsxs("div",{className:yt("fixed inset-0 flex flex-col text-oai-black dark:text-oai-white font-sans overflow-hidden",o?"bg-transparent":"bg-oai-gray-100 dark:bg-oai-gray-950"),children:[o&&m.jsx("div",{className:"h-7 shrink-0",style:{WebkitAppRegion:"drag"},"aria-hidden":!0}),m.jsxs("div",{className:"flex-1 min-h-0 flex",children:[m.jsx(ire,{collapsed:e,onToggleCollapsed:n}),m.jsx(are,{open:r,onClose:s}),m.jsx("div",{className:"flex-1 min-w-0 min-h-0 p-2 lg:pl-0 lg:pr-3 lg:pb-3 flex flex-col",children:m.jsxs("div",{className:yt("flex-1 min-h-0 flex flex-col bg-oai-white dark:bg-oai-gray-900 border border-oai-gray-200 dark:border-oai-gray-800 overflow-hidden",o?"tt-native-main-card":"rounded-2xl",!o&&"shadow-sm"),children:[m.jsx(sre,{onOpenDrawer:a}),m.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:t})]})})]})]})}function lre({children:t,variant:e="info",size:n="md",className:r=""}){const i="inline-flex items-center font-medium",a={success:"bg-oai-brand-100 dark:bg-oai-brand-900/30 text-oai-brand-700 dark:text-oai-brand-400 rounded-full",warning:"bg-oai-amber-50 dark:bg-oai-amber-900/30 text-oai-amber-dark dark:text-oai-amber-400 rounded-full",error:"bg-red-50 dark:bg-red-900/30 text-red-600 dark:text-red-400 rounded-full",info:"bg-oai-gray-100 dark:bg-oai-gray-800 text-oai-gray-600 dark:text-oai-gray-300 rounded-full",secondary:"bg-oai-gray-100 dark:bg-oai-gray-800 text-oai-gray-500 dark:text-oai-gray-300 rounded-md"},s={sm:"px-2 py-0.5 text-xs",md:"px-2.5 py-1 text-sm"},o=`${i} ${a[e]} ${s[n]} ${r}`.trim();return m.jsx("span",{className:o,children:t})}const RF=x.createContext(void 0);function Hl(t){const e=x.useContext(RF);if(t===!1&&e===void 0)throw new Error(Wi(27));return e}const cre={...du,...lf},PF=x.forwardRef(function(e,n){const{render:r,className:i,forceRender:a=!1,...s}=e,{store:o}=Hl(),c=o.useState("open"),u=o.useState("nested"),f=o.useState("mounted"),h=o.useState("transitionStatus"),p=x.useMemo(()=>({open:c,transitionStatus:h}),[c,h]);return Xr("div",e,{state:p,ref:[o.context.backdropRef,n],stateAttributesMapping:cre,props:[{role:"presentation",hidden:!f,style:{userSelect:"none",WebkitUserSelect:"none"}},s],enabled:a||!u})}),ure=x.forwardRef(function(e,n){const{render:r,className:i,disabled:a=!1,nativeButton:s=!0,...o}=e,{store:c}=Hl(),u=c.useState("open");function f(v){u&&c.setOpen(!1,Mn(fee,v.nativeEvent))}const{getButtonProps:h,buttonRef:p}=ev({disabled:a,native:s}),y=x.useMemo(()=>({disabled:a}),[a]);return Xr("button",e,{state:y,ref:[n,p],props:[{onClick:f},o,h]})}),dre=x.forwardRef(function(e,n){const{render:r,className:i,id:a,...s}=e,{store:o}=Hl(),c=ov(a);return o.useSyncedValueWithCleanup("descriptionElementId",c),Xr("p",e,{ref:n,props:[{id:c},s]})});let fre=(function(t){return t.nestedDialogs="--nested-dialogs",t})({}),hre=(function(t){return t[t.open=Ja.open]="open",t[t.closed=Ja.closed]="closed",t[t.startingStyle=Ja.startingStyle]="startingStyle",t[t.endingStyle=Ja.endingStyle]="endingStyle",t.nested="data-nested",t.nestedDialogOpen="data-nested-dialog-open",t})({});const NF=x.createContext(void 0);function DF(){const t=x.useContext(NF);if(t===void 0)throw new Error(Wi(26));return t}const pre={...du,...lf,nestedDialogOpen(t){return t?{[hre.nestedDialogOpen]:""}:null}},LF=x.forwardRef(function(e,n){const{className:r,finalFocus:i,initialFocus:a,render:s,...o}=e,{store:c}=Hl(),u=c.useState("descriptionElementId"),f=c.useState("disablePointerDismissal"),h=c.useState("floatingRootContext"),p=c.useState("popupProps"),y=c.useState("modal"),v=c.useState("mounted"),w=c.useState("nested"),b=c.useState("nestedOpenDialogCount"),_=c.useState("open"),E=c.useState("openMethod"),M=c.useState("titleElementId"),T=c.useState("transitionStatus"),R=c.useState("role");DF(),cf({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});function A(L){return L==="touch"?c.context.popupRef.current:!0}const P=a===void 0?A:a,k=b>0,N=x.useMemo(()=>({open:_,nested:w,transitionStatus:T,nestedDialogOpen:k}),[_,w,T,k]),j=Xr("div",e,{state:N,props:[p,{"aria-labelledby":M??void 0,"aria-describedby":u??void 0,role:R,tabIndex:-1,hidden:!v,onKeyDown(L){NE.has(L.key)&&L.stopPropagation()},style:{[fre.nestedDialogs]:b}},o],ref:[n,c.context.popupRef,c.useStateSetter("popupElement")],stateAttributesMapping:pre});return m.jsx(wE,{context:h,openInteractionType:E,disabled:!v,closeOnFocusOut:!f,initialFocus:P,returnFocus:i,modal:y!==!1,restoreFocus:"popup",children:j})}),IF=x.forwardRef(function(e,n){const{keepMounted:r=!1,...i}=e,{store:a}=Hl(),s=a.useState("mounted"),o=a.useState("modal"),c=a.useState("open");return s||r?m.jsx(NF.Provider,{value:r,children:m.jsxs(bE,{ref:n,...i,children:[s&&o===!0&&m.jsx(PE,{ref:a.context.internalBackdropRef,inert:AE(!c)}),e.children]})}):null});function mre(t){const{store:e,parentContext:n,actionsRef:r}=t,i=e.useState("open"),a=e.useState("disablePointerDismissal"),s=e.useState("modal"),o=e.useState("popupElement"),{openMethod:c,triggerProps:u,reset:f}=CE(i);K4(e);const{forceUnmount:h}=Z4(i,e,()=>{f()}),p=jt(j=>{const L=Mn(j);return L.preventUnmountOnClose=()=>{e.set("preventUnmountingOnClose",!0)},L}),y=x.useCallback(()=>{e.setOpen(!1,p(O4))},[e,p]);x.useImperativeHandle(r,()=>({unmount:h,close:y}),[h,y]);const v=tF({popupStore:e,onOpenChange:e.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[w,b]=x.useState(0),_=w===0,E=rF(v),M=kE(v,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?"intentional":{mouse:s==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(j){if("button"in j&&j.button!==0||"touches"in j&&j.touches.length!==1)return!1;const L=Fi(j);if(_&&!a){const z=L;return s&&(e.context.internalBackdropRef.current||e.context.backdropRef.current)?e.context.internalBackdropRef.current===z||e.context.backdropRef.current===z||On(z,o)&&!z?.hasAttribute("data-base-ui-portal"):!0}return!1},escapeKey:_});RE(i&&s===!0,o);const{getReferenceProps:T,getFloatingProps:R,getTriggerProps:A}=av([E,M]);e.useContextCallback("onNestedDialogOpen",j=>{b(j+1)}),e.useContextCallback("onNestedDialogClose",()=>{b(0)}),x.useEffect(()=>(n?.onNestedDialogOpen&&i&&n.onNestedDialogOpen(w),n?.onNestedDialogClose&&!i&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&i&&n.onNestedDialogClose()}),[i,n,w]);const P=x.useMemo(()=>T(u),[T,u]),k=x.useMemo(()=>A(u),[A,u]),N=x.useMemo(()=>R(),[R]);e.useSyncedValues({openMethod:c,activeTriggerProps:P,inactiveTriggerProps:k,popupProps:N,floatingRootContext:v,nestedOpenDialogCount:w})}const gre={...Q4,modal:At(t=>t.modal),nested:At(t=>t.nested),nestedOpenDialogCount:At(t=>t.nestedOpenDialogCount),disablePointerDismissal:At(t=>t.disablePointerDismissal),openMethod:At(t=>t.openMethod),descriptionElementId:At(t=>t.descriptionElementId),titleElementId:At(t=>t.titleElementId),viewportElement:At(t=>t.viewportElement),role:At(t=>t.role)};class yre extends fE{constructor(e){super(vre(e),{popupRef:x.createRef(),backdropRef:x.createRef(),internalBackdropRef:x.createRef(),triggerElements:new iv,onOpenChange:void 0,onOpenChangeComplete:void 0},gre)}setOpen=(e,n)=>{if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!e&&n.trigger==null&&this.state.activeTriggerId!=null&&(n.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,n),n.isCanceled)return;const r={open:e,nativeEvent:n.event,reason:n.reason,nested:this.state.nested};this.state.floatingRootContext.context.events?.emit("openchange",r);const i={open:e},a=n.trigger?.id??null;(a||e)&&(i.activeTriggerId=a,i.activeTriggerElement=n.trigger??null),this.update(i)}}function vre(t={}){return{...J4(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:"dialog",...t}}function OF(t){const{children:e,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,disablePointerDismissal:s=!1,modal:o=!0,actionsRef:c,handle:u,triggerId:f,defaultTriggerId:h=null}=t,p=Hl(!0),y=!!p,v=Vi(()=>u?.store??new yre({open:n??r,activeTriggerId:f!==void 0?f:h,modal:o,disablePointerDismissal:s,nested:y})).current;v.useControlledProp("open",n,r),v.useControlledProp("activeTriggerId",f,h),v.useSyncedValues({disablePointerDismissal:s,nested:y,modal:o}),v.useContextCallback("onOpenChange",i),v.useContextCallback("onOpenChangeComplete",a);const w=v.useState("payload");mre({store:v,actionsRef:c,parentContext:p?.store.context});const b=x.useMemo(()=>({store:v}),[v]);return m.jsx(RF.Provider,{value:b,children:typeof e=="function"?e({payload:w}):e})}let oP=(function(t){return t[t.open=Ja.open]="open",t[t.closed=Ja.closed]="closed",t[t.startingStyle=Ja.startingStyle]="startingStyle",t[t.endingStyle=Ja.endingStyle]="endingStyle",t.nested="data-nested",t.nestedDialogOpen="data-nested-dialog-open",t})({});const xre={...du,...lf,nested(t){return t?{[oP.nested]:""}:null},nestedDialogOpen(t){return t?{[oP.nestedDialogOpen]:""}:null}},FF=x.forwardRef(function(e,n){const{className:r,render:i,children:a,...s}=e,o=DF(),{store:c}=Hl(),u=c.useState("open"),f=c.useState("nested"),h=c.useState("transitionStatus"),p=c.useState("nestedOpenDialogCount"),y=c.useState("mounted"),v=p>0,w=x.useMemo(()=>({open:u,nested:f,transitionStatus:h,nestedDialogOpen:v}),[u,f,h,v]);return Xr("div",e,{enabled:o||y,state:w,ref:[n,c.useStateSetter("viewportElement")],stateAttributesMapping:xre,props:[{role:"presentation",hidden:!y,children:a},s]})}),UF=x.forwardRef(function(e,n){const{render:r,className:i,id:a,...s}=e,{store:o}=Hl(),c=ov(a);return o.useSyncedValueWithCleanup("titleElementId",c),Xr("h2",e,{ref:n,props:[{id:c},s]})});function bre({open:t,title:e,description:n,confirmLabel:r,cancelLabel:i,destructive:a=!1,busy:s=!1,onConfirm:o,onCancel:c}){return m.jsx(OF,{open:t,onOpenChange:u=>{!u&&!s&&c?.()},children:m.jsxs(IF,{children:[m.jsx(PF,{className:"fixed inset-0 z-[100] bg-black/40 backdrop-blur-[2px] transition-opacity duration-200 ease-out data-[ending-style]:opacity-0 data-[starting-style]:opacity-0"}),m.jsx(FF,{className:"fixed inset-0 z-[101] flex items-center justify-center p-4",children:m.jsxs(LF,{className:"relative w-full max-w-md rounded-2xl bg-white p-6 shadow-[0_20px_60px_-20px_rgba(0,0,0,0.25)] ring-1 ring-oai-gray-200 transition-[opacity,transform] duration-[220ms] ease-[cubic-bezier(0.16,1,0.3,1)] data-[ending-style]:translate-y-2 data-[ending-style]:scale-[0.96] data-[ending-style]:opacity-0 data-[starting-style]:translate-y-2 data-[starting-style]:scale-[0.96] data-[starting-style]:opacity-0 dark:bg-oai-gray-950 dark:shadow-[0_20px_60px_-10px_rgba(0,0,0,0.65)] dark:ring-oai-gray-800",children:[m.jsx(UF,{className:"text-base font-semibold text-oai-black dark:text-white",children:e}),n?m.jsx(dre,{className:"mt-2 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:n}):null,m.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[m.jsx(Ui,{type:"button",variant:"secondary",size:"sm",disabled:s,onClick:()=>c?.(),children:i}),m.jsx(Ui,{type:"button",size:"sm",disabled:s,onClick:()=>o?.(),className:yt(a&&"!bg-red-600 hover:!bg-red-700 focus-visible:!outline-red-600 dark:!bg-red-600 dark:hover:!bg-red-500"),children:r})]})]})})]})})}function jF({value:t,onChange:e,placeholder:n,disabled:r=!1,type:i="text",label:a,error:s,className:o="",...c}){const p=`w-full bg-oai-white dark:bg-oai-gray-900 border border-oai-gray-300 dark:border-oai-gray-700 rounded-md text-oai-black dark:text-oai-white placeholder-oai-gray-400 dark:placeholder-oai-gray-500 transition-all duration-200 focus:outline-none focus:border-oai-brand dark:focus:border-oai-brand focus:ring-1 focus:ring-oai-brand/30 ${r?"bg-oai-gray-50 dark:bg-oai-gray-800 text-oai-gray-400 dark:text-oai-gray-400 cursor-not-allowed":""} ${s?"border-oai-error focus:border-oai-error focus:ring-oai-error/30":""} h-10 px-3 text-sm ${o}`;return m.jsxs("div",{className:"w-full",children:[a&&m.jsx("label",{className:"block text-sm font-medium text-oai-gray-700 dark:text-oai-gray-300 mb-1.5 transition-colors duration-200",children:a}),m.jsx("input",{type:i,value:t,onChange:e,placeholder:n,disabled:r,className:p,...c}),s&&m.jsx("p",{className:"mt-1.5 text-sm text-oai-error",children:s})]})}var _re={};function wre(t,e){return t==="."?{width:"0.34ch",justifyContent:"center",marginInline:"-0.04ch"}:t===","?{width:"0.08ch",justifyContent:"center",marginInline:"-0.30ch"}:{width:"0.72ch",justifyContent:"flex-start",paddingLeft:"0.04ch",height:e}}function Sre({mv:t,digit:e,height:n}){const r=MO(t,i=>{const a=(i%10+10)%10,s=(10+e-a)%10;let o=s*n;return s>5&&(o-=10*n),o});return m.jsx(fr.span,{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",y:r},children:e})}function kre(t){const e=Math.round(t),n=1e-9*Math.max(1,Math.abs(t));return Math.abs(t-e)<n?e:t}function Ere(t,e){const n=t/e;return Math.floor(kre(n))}function Mre(t){const e=String(t??""),n=Array.from(e),r=n.indexOf(".");let i=n.filter((o,c)=>/\d/.test(o)&&(r===-1||c<r)).length,a=0,s=!1;return n.map(o=>{if(!/\d/.test(o))return o==="."&&(s=!0),o;if(!s){const c=10**Math.max(i-1,0);return i-=1,c}return a+=1,10**-a})}function Tre({place:t,value:e,height:n,digitStyle:r,shouldReduceMotion:i}){if(typeof t!="number"){const c=wre(t,n);return m.jsx("span",{"data-counter-token":"static",className:"relative inline-flex items-center justify-center",style:{height:n,...c,...r},children:t})}const a=Ere(e,t),s=rE(0),o=wK(s,{stiffness:220,damping:26,mass:.8});return x.useEffect(()=>{s.set(a)},[s,a]),i?m.jsx("span",{"data-counter-token":"digit",className:"relative inline-flex items-center justify-center overflow-hidden",style:{height:n,position:"relative",width:"0.9ch",fontVariantNumeric:"tabular-nums",...r},children:Math.abs(a)%10}):m.jsx("span",{"data-counter-token":"digit",className:"relative inline-flex overflow-hidden",style:{height:n,position:"relative",width:"0.9ch",fontVariantNumeric:"tabular-nums",...r},children:Array.from({length:10},(c,u)=>m.jsx(Sre,{mv:o,digit:u,height:n},u))})}function Cre({value:t,displayValue:e,fontSize:n=72,padding:r=0,places:i,gap:a=6,borderRadius:s=4,horizontalPadding:o=0,textColor:c="inherit",fontWeight:u="inherit",containerStyle:f,counterStyle:h,digitStyle:p,gradientHeight:y=14,gradientFrom:v="rgba(255,255,255,0.95)",gradientTo:w="rgba(255,255,255,0)",topGradientStyle:b,bottomGradientStyle:_}){const E=String(e??t??""),M=x.useMemo(()=>Array.isArray(i)&&i.length?i:Mre(E),[i,E]),T=typeof navigator<"u"&&/jsdom/i.test(navigator.userAgent||"")||typeof process<"u"&&_re?.VITEST==="true",R=ou()||T,A=Number.isFinite(Number(t))?Math.abs(Number(t)):0,P=n+r;return R?m.jsx("span",{"data-counter-root":"true",style:{display:"inline-flex",alignItems:"center",color:c,fontSize:n,fontWeight:u,lineHeight:1,...f,...h},children:E}):m.jsxs("span",{"data-counter-root":"true",style:{position:"relative",display:"inline-block",...f},children:[m.jsx("span",{style:{fontSize:n,display:"flex",gap:a,overflow:"hidden",borderRadius:s,paddingLeft:o,paddingRight:o,lineHeight:1,color:c,fontWeight:u,...h},children:M.map((k,N)=>m.jsx(Tre,{place:k,value:A,height:P,digitStyle:p,shouldReduceMotion:R},`${String(k)}-${N}`))}),m.jsxs("span",{style:{pointerEvents:"none",position:"absolute",inset:0,display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[m.jsx("span",{style:b??{height:y,background:`linear-gradient(to bottom, ${v}, ${w})`}}),m.jsx("span",{style:_??{height:y,background:`linear-gradient(to top, ${v}, ${w})`}})]})]})}function Are(t){if(!Number.isFinite(t))return F("shared.placeholder.short");const e=Oy(t.toFixed(2),{decimals:2});return e==="-"?F("shared.placeholder.short"):e}function lP(t){return!Number.isFinite(t)||t<=0?null:t<.01?"<$0.01":Oy(t.toFixed(2),{decimals:2})}function cP(t){const e=Number(t);return!Number.isFinite(e)||e<=0?null:Iy(e,{decimals:1})}const Rre=ot.memo(function({isOpen:e,onClose:n,fleetData:r=[]}){const i=x.useMemo(()=>(Array.isArray(r)?r:[]).map(s=>{const o=ti(s?.usd)??0,c=ti(s?.usage)??0,u=Array.isArray(s?.models)?s.models:[];return{label:s?.label?String(s.label):"",usdValue:o,usdLabel:lP(o),tokensLabel:cP(c),models:u.map(f=>{const h=ti(f?.usage)??0,p=ti(f?.cost)??0;return{id:f?.id?String(f.id):"",name:f?.name?String(f.name):"",tokensLabel:cP(h),costLabel:lP(p),sortCost:p}}).filter(f=>f.costLabel||f.tokensLabel).sort((f,h)=>h.sortCost-f.sortCost)}}).filter(s=>s.usdValue>0||s.models.length>0).sort((s,o)=>o.usdValue-s.usdValue),[r]),a=x.useMemo(()=>{const s=i.reduce((o,c)=>o+c.usdValue,0);return Are(s)},[i]);return m.jsx(OF,{open:e,onOpenChange:s=>{s||n?.()},children:m.jsxs(IF,{children:[m.jsx(PF,{className:"cost-modal-backdrop","data-cost-analysis-backdrop":"true"}),m.jsx(FF,{className:"fixed inset-0 z-[101] flex items-center justify-center p-4",children:m.jsxs(LF,{className:"cost-modal-popup relative w-full max-w-[460px] max-h-[calc(100vh-2rem)] flex flex-col rounded-2xl bg-white dark:bg-oai-gray-950 shadow-[0_20px_60px_-20px_rgba(0,0,0,0.25)] dark:shadow-[0_20px_60px_-10px_rgba(0,0,0,0.65)] ring-1 ring-oai-gray-200 dark:ring-oai-gray-800 overflow-hidden",children:[m.jsx(UF,{render:m.jsx("h2",{className:"sr-only"}),children:F("dashboard.cost_breakdown.title")}),m.jsx(ure,{type:"button",className:"absolute top-3 right-3 flex h-9 w-9 items-center justify-center rounded-md text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-800 dark:hover:text-oai-gray-100 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand/50 transition-colors z-10","aria-label":F("dashboard.cost_breakdown.close"),children:m.jsx(Ak,{size:16,strokeWidth:2,"aria-hidden":!0})}),m.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto oai-scrollbar",children:m.jsxs("div",{className:"px-3 py-6",children:[m.jsx("p",{className:"text-label uppercase tracking-[0.12em] text-oai-gray-500 dark:text-oai-gray-400 mb-2",children:F("dashboard.cost_breakdown.total_label")}),m.jsx("p",{className:"font-bold text-oai-brand tabular-nums tracking-tight leading-none mb-6",style:{fontSize:"clamp(24px, 6.5vw, 32px)"},children:a}),i.length===0?m.jsx("p",{className:"text-body-sm text-oai-gray-500 dark:text-oai-gray-400",children:"No spend recorded."}):m.jsxs("div",{role:"table","aria-label":F("dashboard.cost_breakdown.title"),children:[m.jsxs("div",{role:"row",className:"flex items-center justify-between gap-4 py-2 mb-2 border-b border-oai-gray-200 dark:border-oai-gray-800 text-label uppercase text-oai-gray-500 dark:text-oai-gray-400",children:[m.jsx("span",{role:"columnheader",children:"Model"}),m.jsx("span",{role:"columnheader",children:"Cost"})]}),i.map((s,o)=>{const c=`fleet-${o}`;return m.jsxs("div",{role:"rowgroup","aria-labelledby":c,className:o>0?"mt-5":"mt-2",children:[m.jsxs("div",{role:"row",className:"flex items-center justify-between gap-4 py-2",children:[m.jsx("span",{id:c,role:"rowheader",className:"flex-1 min-w-0 text-body-sm font-semibold text-oai-black dark:text-oai-white truncate leading-none",children:s.label}),m.jsx("span",{role:"cell",className:"shrink-0 text-body-sm font-semibold text-oai-black dark:text-oai-white tabular-nums leading-none",children:s.usdLabel||"—"})]}),s.models.map((u,f)=>m.jsxs("div",{role:"row",className:"flex items-center justify-between gap-4 py-[5px]",children:[m.jsx("span",{role:"cell",className:"flex-1 min-w-0 text-caption text-oai-gray-500 dark:text-oai-gray-400 truncate leading-none",title:u.name,children:u.name}),m.jsx("span",{role:"cell",className:"shrink-0 text-caption text-oai-gray-700 dark:text-oai-gray-300 tabular-nums leading-none",children:u.costLabel||""})]},u.id||`${u.name}-${f}`))]},`${s.label}-${o}`)})]})]})})]})})]})})});function Pre({projectEntries:t=[],projectLimit:e=3,onProjectLimitChange:n,copy:r,hasDetailsActual:i,dailyEmptyPrefix:a,installSyncCmd:s,dailyEmptySuffix:o,detailsColumns:c,ariaSortFor:u,toggleSort:f,sortIconFor:h,pagedDetails:p,dailyBreakdownRows:y=[],dailyBreakdownColumns:v=[],dailyBreakdownAriaSortFor:w,dailyBreakdownSortIconFor:b,dailyBreakdownDateKey:_="day",detailsDateKey:E,renderDetailDate:M,renderDailyBreakdownDate:T,renderDetailCell:R,DETAILS_PAGED_PERIODS:A,period:P,detailsPageCount:k,detailsPage:N,setDetailsPage:j}){const[L,z]=x.useState("daily");return m.jsxs(fu,{children:[m.jsxs("div",{className:"flex items-center justify-between gap-3 mb-4",children:[m.jsxs("div",{role:"tablist","aria-label":"Data view",className:"flex gap-1",children:[m.jsx("button",{role:"tab","aria-selected":L==="daily",type:"button",onClick:()=>z("daily"),className:`text-xs font-medium px-3 py-1.5 rounded transition-colors ${L==="daily"?"text-oai-black dark:text-oai-white bg-oai-gray-100 dark:bg-oai-gray-800":"text-oai-gray-500 dark:text-oai-gray-300 hover:text-oai-black dark:hover:text-oai-white hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/50"}`,children:r("dashboard.daily.title")}),m.jsx("button",{role:"tab","aria-selected":L==="projects",type:"button",onClick:()=>z("projects"),className:`text-xs font-medium px-3 py-1.5 rounded transition-colors ${L==="projects"?"text-oai-black dark:text-oai-white bg-oai-gray-100 dark:bg-oai-gray-800":"text-oai-gray-500 dark:text-oai-gray-300 hover:text-oai-black dark:hover:text-oai-white hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/50"}`,children:r("dashboard.projects.title")})]}),L==="projects"&&m.jsxs("select",{"aria-label":"Number of projects to display",value:e,onChange:U=>n?.(Number(U.target.value)),className:"text-xs text-oai-gray-600 dark:text-oai-gray-300 bg-white dark:bg-oai-gray-900 border border-oai-gray-200 dark:border-oai-gray-700 rounded px-2 py-1 hover:border-oai-gray-300 dark:hover:border-oai-gray-600 focus:border-oai-brand dark:focus:border-oai-brand focus:outline-none transition-colors",children:[m.jsx("option",{value:3,children:r("dashboard.projects.limit_top_3")}),m.jsx("option",{value:6,children:r("dashboard.projects.limit_top_6")}),m.jsx("option",{value:10,children:r("dashboard.projects.limit_top_10")})]})]}),L==="projects"&&m.jsx("div",{className:"space-y-1",children:t.slice(0,e).map(U=>m.jsxs("a",{href:U?.project_ref||"#",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-3 p-2 rounded-lg hover:oai-bg-elevated transition-colors",children:[m.jsx("div",{className:"w-8 h-8 rounded-md oai-bg-elevated flex items-center justify-center oai-text-caption font-medium text-oai-gray-500 dark:text-oai-gray-300",children:(U?.project_key?.[0]||"?").toUpperCase()}),m.jsx("div",{className:"min-w-0 flex-1",children:m.jsx("div",{className:"oai-text-body-sm font-medium text-oai-black dark:text-oai-white truncate",children:U?.project_key||U?.project_ref?.split("/")?.pop()||"—"})}),m.jsx("div",{className:"oai-text-body-sm font-medium text-oai-black dark:text-oai-white tabular-nums",children:U?.billable_total_tokens?.toLocaleString?.()||U?.total_tokens?.toLocaleString?.()||"—"})]},U?.project_key||U?.project_ref))}),L==="daily"&&m.jsxs("div",{children:[y?.length===0?m.jsxs("div",{className:"oai-text-body-sm text-oai-gray-500 dark:text-oai-gray-300 mb-4",children:[a,m.jsx("code",{className:"mx-1 rounded border border-oai-gray-300 dark:border-oai-gray-700 oai-bg-elevated px-1.5 py-0.5 font-mono oai-text-caption",children:s}),o]}):m.jsx("div",{className:"overflow-auto max-h-[384px] -mx-4 oai-scrollbar",children:m.jsxs("table",{className:"w-full border-collapse",children:[m.jsx("thead",{className:"sticky top-0 z-10",children:m.jsx("tr",{className:"border-b border-oai-gray-200 dark:border-oai-gray-700",children:v.map(U=>m.jsx("th",{"aria-sort":w?.(U.key)||"none",className:"text-left p-0 bg-white dark:bg-oai-gray-900",children:m.jsx("button",{type:"button",onClick:()=>f(U.key),className:"flex w-full items-center justify-start px-4 py-2 text-left oai-text-caption font-semibold text-oai-gray-600 dark:text-oai-gray-300 hover:text-oai-black dark:hover:text-oai-white transition-colors",children:m.jsxs("span",{className:"inline-flex items-center gap-1",children:[m.jsx("span",{children:U.label}),m.jsx("span",{className:"text-oai-gray-400 dark:text-oai-gray-400",children:b?.(U.key)||""})]})})},U.key))})}),m.jsx("tbody",{children:y.map(U=>m.jsxs("tr",{className:`border-b border-oai-gray-100 dark:border-oai-gray-800 last:border-b-0 hover:bg-oai-gray-50/50 dark:hover:bg-oai-gray-800/50 transition-colors ${U.missing?"text-oai-gray-400 dark:text-oai-gray-400":U.future?"text-oai-gray-300 dark:text-oai-gray-600":"text-oai-black dark:text-oai-white"}`,children:[m.jsx("td",{className:"px-4 py-2 oai-text-body-sm text-oai-gray-500 dark:text-oai-gray-300",children:T?T(U):M(U)}),m.jsx("td",{className:"px-4 py-2 oai-text-body-sm font-medium text-oai-black dark:text-oai-white tabular-nums",children:R(U,"total_tokens")}),m.jsx("td",{className:"px-4 py-2 oai-text-body-sm text-oai-gray-600 dark:text-oai-gray-300 tabular-nums",children:R(U,"input_tokens")}),m.jsx("td",{className:"px-4 py-2 oai-text-body-sm text-oai-gray-600 dark:text-oai-gray-300 tabular-nums",children:R(U,"output_tokens")}),m.jsx("td",{className:"px-4 py-2 oai-text-body-sm text-oai-gray-600 dark:text-oai-gray-300 tabular-nums",children:R(U,"cached_input_tokens")}),m.jsx("td",{className:"px-4 py-2 oai-text-body-sm text-oai-gray-600 dark:text-oai-gray-300 tabular-nums",children:R(U,"reasoning_output_tokens")}),m.jsx("td",{className:"px-4 py-2 oai-text-body-sm text-oai-gray-600 dark:text-oai-gray-300 tabular-nums",children:R(U,"conversation_count")})]},String(U?.[_]||U?.day||U?.hour||U?.month||"")))})]})}),L!=="daily"&&A.has(P)&&k>1?m.jsxs("div",{className:"mt-3 flex items-center justify-between oai-text-caption",children:[m.jsx("button",{type:"button",onClick:()=>j(U=>Math.max(0,U-1)),disabled:N===0,className:"px-3 py-1.5 text-oai-gray-600 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 rounded-md disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:r("details.pagination.prev")}),m.jsxs("span",{className:"oai-text-muted",children:[N+1," / ",k]}),m.jsx("button",{type:"button",onClick:()=>j(U=>Math.min(k-1,U+1)),disabled:N+1>=k,className:"px-3 py-1.5 text-oai-gray-600 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 rounded-md disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:r("details.pagination.next")})]}):null]})]})}function Rl({children:t,delay:e=0,duration:n=.4,y:r=20,className:i="",once:a=!0}){return ou()?m.jsx("div",{className:i,children:t}):m.jsx(fr.div,{initial:{opacity:0,y:r},animate:{opacity:1,y:0},transition:{duration:n,delay:e,ease:[.25,.1,.25,1]},className:i,children:t})}function Nre({children:t,staggerDelay:e=.1,initialDelay:n=0,className:r=""}){return ou()?m.jsx("div",{className:r,children:t}):m.jsx(fr.div,{initial:"hidden",animate:"visible",variants:{hidden:{},visible:{transition:{staggerChildren:e,delayChildren:n}}},className:r,children:t})}function Dre({children:t,className:e="",y:n=20}){return ou()?m.jsx("div",{className:e,children:t}):m.jsx(fr.div,{variants:{hidden:{opacity:0,y:n},visible:{opacity:1,y:0,transition:{duration:.4,ease:[.25,.1,.25,1]}}},className:e,children:t})}function _0(t){return typeof t!="string"?"":t.trim()}function uP(t){const e=_0(t);return e?e.split(/[_\-\s]+/).filter(Boolean).map(n=>n.slice(0,1).toUpperCase()+n.slice(1).toLowerCase()).join(" "):""}function Lre(t){if(!Array.isArray(t))return[];const e=new Map;for(const n of t){if(!n||typeof n!="object")continue;const r=_0(n.tool),i=_0(n.planType)||_0(n.plan_type);if(!r||!i)continue;const a=uP(r)||r,s=uP(i)||i;e.set(`${r.toLowerCase()}::${i.toLowerCase()}`,{tool:a,plan:s})}return Array.from(e.values())}function Ire({period:t="month",rankLabel:e,streakDays:n,subscriptions:r=[],periodConversations:i,rolling:a,topModels:s=[],className:o=""}){const c=F("shared.placeholder.short"),u=F("shared.unit.percent"),f=e??F("identity_card.rank_placeholder"),h=Number.isFinite(Number(n))?Number(n):0,p=h?F("identity_card.streak_value",{days:h}):F("identity_card.rank_placeholder"),y=Lre(r),v={thousandSuffix:F("shared.unit.thousand_abbrev"),millionSuffix:F("shared.unit.million_abbrev"),billionSuffix:F("shared.unit.billion_abbrev")},w=E=>{if(E==null)return c;const M=Iy(E,v);return M==="-"?c:M},b=(()=>{switch(t){case"day":return F("stats.period.today");case"week":return F("stats.period.week");case"month":return F("stats.period.month");case"total":return F("stats.period.all");default:return F("stats.period.convs")}})(),_=s.slice(0,3);return m.jsx(Rl,{delay:.1,children:m.jsxs(fu,{className:`h-full ${o}`,children:[m.jsxs("div",{className:"grid grid-cols-4 gap-2",children:[m.jsxs("div",{className:"flex flex-col items-center justify-center px-2 py-2 bg-oai-gray-50 dark:bg-oai-gray-800 rounded-lg",children:[m.jsx("span",{className:"text-sm font-semibold text-oai-black dark:text-oai-white tabular-nums",children:w(a?.last_7d?.totals?.billable_total_tokens)}),m.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-400 mt-0.5 whitespace-nowrap",children:"7d"})]}),m.jsxs("div",{className:"flex flex-col items-center justify-center px-2 py-2 bg-oai-gray-50 dark:bg-oai-gray-800 rounded-lg",children:[m.jsx("span",{className:"text-sm font-semibold text-oai-black dark:text-oai-white tabular-nums",children:w(a?.last_30d?.totals?.billable_total_tokens)}),m.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-400 mt-0.5 whitespace-nowrap",children:"30d"})]}),m.jsxs("div",{className:"flex flex-col items-center justify-center px-2 py-2 bg-oai-gray-50 dark:bg-oai-gray-800 rounded-lg",children:[m.jsx("span",{className:"text-sm font-semibold text-oai-black dark:text-oai-white tabular-nums",children:w(a?.last_30d?.avg_per_active_day)}),m.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-400 mt-0.5 whitespace-nowrap",children:"avg"})]}),m.jsxs("div",{className:"flex flex-col items-center justify-center px-2 py-2 bg-oai-gray-50 dark:bg-oai-gray-800 rounded-lg",children:[m.jsx("span",{className:"text-sm font-semibold text-oai-black dark:text-oai-white tabular-nums",children:w(i)}),m.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-400 mt-0.5 whitespace-nowrap",children:b})]})]}),_.length>0&&m.jsx("div",{className:"mt-4 pt-3 border-t border-oai-gray-100 dark:border-oai-gray-800",children:_.map((E,M)=>{const T=E?.name?String(E.name):c,R=E?.percent?String(E.percent):"",A=M===_.length-1,P=M+1;return m.jsxs("div",{className:`flex items-center py-2 ${A?"":"border-b border-oai-gray-50 dark:border-oai-gray-800"}`,children:[m.jsx("span",{className:"w-5 h-5 flex items-center justify-center rounded-full bg-oai-gray-100 dark:bg-oai-gray-800 text-[10px] font-semibold text-oai-gray-500 dark:text-oai-gray-300 flex-shrink-0",children:P}),m.jsx("span",{className:"flex-1 text-sm text-oai-gray-700 dark:text-oai-gray-300 truncate px-2.5",title:T,children:T}),m.jsxs("span",{className:"text-sm font-semibold text-oai-black dark:text-oai-white tabular-nums flex-shrink-0",children:[R,u]})]},E.id||T)})}),y.length>0&&m.jsx("div",{className:"mt-3 pt-3 border-t border-oai-gray-100 dark:border-oai-gray-800 flex flex-wrap gap-1.5",children:y.map((E,M)=>m.jsxs(lre,{variant:"secondary",size:"sm",children:[E.tool," ",E.plan]},`${E.tool}:${E.plan}:${M}`))}),m.jsxs("div",{className:"mt-4 pt-3 border-t border-oai-gray-100 dark:border-oai-gray-800 flex items-center justify-between text-xs text-oai-gray-400 dark:text-oai-gray-400",children:[m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx("span",{children:F("identity_card.rank_label")}),m.jsx("span",{className:"text-oai-gray-500 dark:text-oai-gray-300 tabular-nums",children:f})]}),m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsx("span",{children:F("identity_card.streak_label")}),m.jsx("span",{className:"text-oai-gray-500 dark:text-oai-gray-300 tabular-nums",children:p})]})]})]})})}const BF=x.createContext(void 0);function Op(t){const e=x.useContext(BF);if(e===void 0&&!t)throw new Error(Wi(47));return e}function Ore(){return{...J4(),disabled:!1,modal:!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 Fre={...Q4,disabled:At(t=>t.disabled),instantType:At(t=>t.instantType),openMethod:At(t=>t.openMethod),openChangeReason:At(t=>t.openChangeReason),modal:At(t=>t.modal),stickIfOpen:At(t=>t.stickIfOpen),titleElementId:At(t=>t.titleElementId),descriptionElementId:At(t=>t.descriptionElementId),openOnHover:At(t=>t.openOnHover),closeDelay:At(t=>t.closeDelay),hasViewport:At(t=>t.hasViewport)};class IE extends fE{constructor(e){const n={...Ore(),...e};n.open&&e?.mounted===void 0&&(n.mounted=!0),super(n,{popupRef:x.createRef(),backdropRef:x.createRef(),internalBackdropRef:x.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:x.createRef(),beforeContentFocusGuardRef:x.createRef(),stickIfOpenTimeout:new Ll,triggerElements:new iv},Fre)}setOpen=(e,n)=>{const r=n.reason===aa,i=n.reason===Al&&n.event.detail===0,a=!e&&(n.reason===I4||n.reason==null);if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.(e,n),n.isCanceled)return;const s={open:e,nativeEvent:n.event,reason:n.reason,nested:this.state.nested,triggerElement:n.trigger};this.state.floatingRootContext.context.events?.emit("openchange",s);const c=()=>{const u={open:e,openChangeReason:n.reason},f=n.trigger?.id??null;(f||e)&&(u.activeTriggerId=f,u.activeTriggerElement=n.trigger??null),this.update(u)};r?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(RJ,()=>{this.set("stickIfOpen",!1)}),gi.flushSync(c)):c(),i||a?this.set("instantType",i?"click":"dismiss"):n.reason===Zc?this.set("instantType","focus"):this.set("instantType",void 0)};static useStore(e,n){const r=Vi(()=>new IE(n)).current,i=e??r;return hE(r.disposeEffect),i}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()}function dP({props:t}){const{children:e,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,modal:s=!1,handle:o,triggerId:c,defaultTriggerId:u=null}=t,f=IE.useStore(o?.store,{open:n??r,modal:s,activeTriggerId:c!==void 0?c:u});f.useControlledProp("open",n,r),f.useControlledProp("activeTriggerId",c,u);const h=f.useState("open"),p=f.useState("positionerElement"),y=f.useState("payload"),v=f.useState("openChangeReason");f.useContextCallback("onOpenChange",i),f.useContextCallback("onOpenChangeComplete",a);const{openMethod:w,triggerProps:b,reset:_}=CE(h);K4(f);const{forceUnmount:E}=Z4(h,f,()=>{f.update({stickIfOpen:!0,openChangeReason:null}),_()});RE(h&&s===!0&&v!==aa&&w!=="touch",p),x.useEffect(()=>{h||f.context.stickIfOpenTimeout.clear()},[f,h]);const M=x.useCallback(W=>{const K=Mn(W);return K.preventUnmountOnClose=()=>{f.set("preventUnmountingOnClose",!0)},K},[f]),T=x.useCallback(()=>{f.setOpen(!1,M(O4))},[f,M]);x.useImperativeHandle(t.actionsRef,()=>({unmount:E,close:T}),[E,T]);const R=tF({popupStore:f,onOpenChange:f.setOpen}),A=kE(R,{outsidePressEvent:{mouse:s==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),P=rF(R),{getReferenceProps:k,getFloatingProps:N,getTriggerProps:j}=av([A,P]),L=x.useMemo(()=>k(b),[k,b]),z=x.useMemo(()=>j(b),[j,b]),U=x.useMemo(()=>N(),[N]);f.useSyncedValues({modal:s,openMethod:w,activeTriggerProps:L,inactiveTriggerProps:z,popupProps:U,floatingRootContext:R,nested:zl()!=null});const V=x.useMemo(()=>({store:f}),[f]);return m.jsx(BF.Provider,{value:V,children:typeof e=="function"?e({payload:y}):e})}function zF(t){return Op(!0)?m.jsx(dP,{props:t}):m.jsx(dee,{children:m.jsx(dP,{props:t})})}const Ure=300,VF=x.forwardRef(function(e,n){const{render:r,className:i,disabled:a=!1,nativeButton:s=!0,handle:o,payload:c,openOnHover:u=!1,delay:f=Ure,closeDelay:h=0,id:p,...y}=e,v=Op(!0),w=o?.store??v?.store;if(!w)throw new Error(Wi(74));const b=ov(p),_=w.useState("isTriggerActive",b),E=w.useState("floatingRootContext"),M=w.useState("isOpenedByTrigger",b),T=x.useRef(null),{registerTrigger:R,isMountedByThisTrigger:A}=yte(b,T,w,{payload:c,disabled:a,openOnHover:u,closeDelay:h}),P=w.useState("openChangeReason"),k=w.useState("stickIfOpen"),N=w.useState("openMethod"),j=Mte(E,{enabled:E!=null&&u&&(N!=="touch"||P!==Al),mouseOnly:!0,move:!1,handleClose:Lte(),restMs:f,delay:{close:h},triggerElementRef:T,isActiveTrigger:_}),L=B4(E,{enabled:E!=null,stickIfOpen:k}),z=av([L]),U=w.useState("triggerProps",A),V=x.useMemo(()=>({disabled:a,open:M}),[a,M]),{getButtonProps:W,buttonRef:K}=ev({disabled:a,native:s}),Q=x.useMemo(()=>({open(te){return te&&P===Al?hF.open(te):fF.open(te)}}),[P]),O=Xr("button",e,{state:V,ref:[K,n,R,T],props:[z.getReferenceProps(),j,U,{[i4]:"",id:b},y,W],stateAttributesMapping:Q}),G=x.useRef(null),Y=jt(te=>{gi.flushSync(()=>{w.setOpen(!1,Mn(Zc,te.nativeEvent,te.currentTarget))}),iee(G.current)?.focus()}),H=jt(te=>{const re=w.select("positionerElement");if(re&&Td(te,re))w.context.beforeContentFocusGuardRef.current?.focus();else{gi.flushSync(()=>{w.setOpen(!1,Mn(Zc,te.nativeEvent,te.currentTarget))});let ue=ree(w.context.triggerFocusTargetRef.current||T.current);for(;ue!==null&&On(re,ue);){const ce=ue;if(ue=vE(ue),ue===ce)break}ue?.focus()}});return _?m.jsxs(x.Fragment,{children:[m.jsx(Vd,{ref:G,onFocus:Y}),m.jsx(x.Fragment,{children:O},b),m.jsx(Vd,{ref:w.context.triggerFocusTargetRef,onFocus:H})]}):m.jsx(x.Fragment,{children:O},b)}),HF=x.createContext(void 0);function jre(){const t=x.useContext(HF);if(t===void 0)throw new Error(Wi(45));return t}const WF=x.forwardRef(function(e,n){const{keepMounted:r=!1,...i}=e,{store:a}=Op();return a.useState("mounted")||r?m.jsx(HF.Provider,{value:r,children:m.jsx(bE,{ref:n,...i,renderGuards:!1})}):null}),GF=x.createContext(void 0);function Bre(){const t=x.useContext(GF);if(!t)throw new Error(Wi(46));return t}const $F=x.forwardRef(function(e,n){const{render:r,className:i,anchor:a,positionMethod:s="absolute",side:o="bottom",align:c="center",sideOffset:u=0,alignOffset:f=0,collisionBoundary:h="clipping-ancestors",collisionPadding:p=5,arrowPadding:y=5,sticky:v=!1,disableAnchorTracking:w=!1,collisionAvoidance:b=DJ,..._}=e,{store:E}=Op(),M=jre(),T=cee(),R=E.useState("floatingRootContext"),A=E.useState("mounted"),P=E.useState("open"),k=E.useState("openChangeReason"),N=E.useState("activeTriggerElement"),j=E.useState("modal"),L=E.useState("positionerElement"),z=E.useState("instantType"),U=E.useState("transitionStatus"),V=E.useState("hasViewport"),W=x.useRef(null),K=X4(L,!1,!1),Q=gF({anchor:a,floatingRootContext:R,positionMethod:s,mounted:A,side:o,sideOffset:u,align:c,alignOffset:f,arrowPadding:y,collisionBoundary:h,collisionPadding:p,sticky:v,disableAnchorTracking:w,keepMounted:M,nodeId:T,collisionAvoidance:b,adaptiveOrigin:V?Mne:void 0}),O=x.useMemo(()=>{const ue={};return P||(ue.pointerEvents="none"),{role:"presentation",hidden:!A,style:{...Q.positionerStyles,...ue}}},[P,A,Q.positionerStyles]),G=x.useMemo(()=>({props:O,...Q}),[O,Q]),Y=R?.select("domReferenceElement");Yt(()=>{const ue=Y,ce=W.current;if(ue&&(W.current=ue),ce&&ue&&ue!==ce){E.set("instantType",void 0);const ee=new AbortController;return K(()=>{E.set("instantType","trigger-change")},ee.signal),()=>{ee.abort()}}},[Y,K,E]);const H=x.useMemo(()=>({open:P,side:G.side,align:G.align,anchorHidden:G.anchorHidden,instant:z}),[P,G.side,G.align,G.anchorHidden,z]),te=x.useCallback(ue=>{E.set("positionerElement",ue)},[E]),re=Xr("div",e,{state:H,props:[G.props,DE(U),_],ref:[n,te],stateAttributesMapping:du});return m.jsxs(GF.Provider,{value:G,children:[A&&j===!0&&k!==aa&&m.jsx(PE,{ref:E.context.internalBackdropRef,inert:AE(!P),cutout:N}),m.jsx(uee,{id:T,children:re})]})}),zre={...du,...lf},YF=x.forwardRef(function(e,n){const{className:r,render:i,initialFocus:a,finalFocus:s,...o}=e,{store:c}=Op(),u=Bre(),f=xF()!=null,h=c.useState("open"),p=c.useState("openMethod"),y=c.useState("instantType"),v=c.useState("transitionStatus"),w=c.useState("popupProps"),b=c.useState("titleElementId"),_=c.useState("descriptionElementId"),E=c.useState("modal"),M=c.useState("mounted"),T=c.useState("openChangeReason"),R=c.useState("activeTriggerElement"),A=c.useState("floatingRootContext");cf({open:h,ref:c.context.popupRef,onComplete(){h&&c.context.onOpenChangeComplete?.(!0)}});const P=c.useState("disabled"),k=c.useState("openOnHover"),N=c.useState("closeDelay");Ste(A,{enabled:k&&!P,closeDelay:N});function j(W){return W==="touch"?c.context.popupRef.current:!0}const L=a===void 0?j:a,z=x.useMemo(()=>({open:h,side:u.side,align:u.align,instant:y,transitionStatus:v}),[h,u.side,u.align,y,v]),U=x.useCallback(W=>{c.set("popupElement",W)},[c]),V=Xr("div",e,{state:z,ref:[n,c.context.popupRef,U],props:[w,{"aria-labelledby":b,"aria-describedby":_,onKeyDown(W){f&&NE.has(W.key)&&W.stopPropagation()}},DE(v),o],stateAttributesMapping:zre});return m.jsx(wE,{context:A,openInteractionType:p,modal:E==="trap-focus",disabled:!M||T===aa,initialFocus:L,returnFocus:s,restoreFocus:"popup",previousFocusableElement:Ar(R)?R:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:V})});function Vre(t,e,n="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:t,timeZoneName:n}).format(e).split(/\s/g).slice(2).join(" ")}const Hre={},Mh={};function Pc(t,e){try{const r=(Hre[t]||=new Intl.DateTimeFormat("en-US",{timeZone:t,timeZoneName:"longOffset"}).format)(e).split("GMT")[1];return r in Mh?Mh[r]:fP(r,r.split(":"))}catch{if(t in Mh)return Mh[t];const n=t?.match(Wre);return n?fP(t,n.slice(1)):NaN}}const Wre=/([+-]\d\d):?(\d\d)?/;function fP(t,e){const n=+(e[0]||0),r=+(e[1]||0),i=+(e[2]||0)/60;return Mh[t]=n*60+r>0?n*60+r+i:n*60-r-i}class As extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]=="string"&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(Pc(this.timeZone,this))?this.setTime(NaN):e.length?typeof e[0]=="number"&&(e.length===1||e.length===2&&typeof e[1]!="number")?this.setTime(e[0]):typeof e[0]=="string"?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),qF(this),R1(this)):this.setTime(Date.now())}static tz(e,...n){return n.length?new As(...n,e):new As(Date.now(),e)}withTimeZone(e){return new As(+this,e)}getTimezoneOffset(){const e=-Pc(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),R1(this),+this}[Symbol.for("constructDateFrom")](e){return new As(+new Date(e),this.timeZone)}}const hP=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(t=>{if(!hP.test(t))return;const e=t.replace(hP,"$1UTC");As.prototype[e]&&(t.startsWith("get")?As.prototype[t]=function(){return this.internal[e]()}:(As.prototype[t]=function(){return Date.prototype[e].apply(this.internal,arguments),Gre(this),+this},As.prototype[e]=function(){return Date.prototype[e].apply(this,arguments),R1(this),+this}))});function R1(t){t.internal.setTime(+t),t.internal.setUTCSeconds(t.internal.getUTCSeconds()-Math.round(-Pc(t.timeZone,t)*60))}function Gre(t){Date.prototype.setFullYear.call(t,t.internal.getUTCFullYear(),t.internal.getUTCMonth(),t.internal.getUTCDate()),Date.prototype.setHours.call(t,t.internal.getUTCHours(),t.internal.getUTCMinutes(),t.internal.getUTCSeconds(),t.internal.getUTCMilliseconds()),qF(t)}function qF(t){const e=Pc(t.timeZone,t),n=e>0?Math.floor(e):Math.ceil(e),r=new Date(+t);r.setUTCHours(r.getUTCHours()-1);const i=-new Date(+t).getTimezoneOffset(),a=-new Date(+r).getTimezoneOffset(),s=i-a,o=Date.prototype.getHours.apply(t)!==t.internal.getUTCHours();s&&o&&t.internal.setUTCMinutes(t.internal.getUTCMinutes()+s);const c=i-n;c&&Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+c);const u=new Date(+t);u.setUTCSeconds(0);const f=i>0?u.getSeconds():(u.getSeconds()-60)%60,h=Math.round(-(Pc(t.timeZone,t)*60))%60;(h||f)&&(t.internal.setUTCSeconds(t.internal.getUTCSeconds()+h),Date.prototype.setUTCSeconds.call(t,Date.prototype.getUTCSeconds.call(t)+h+f));const p=Pc(t.timeZone,t),y=p>0?Math.floor(p):Math.ceil(p),w=-new Date(+t).getTimezoneOffset()-y,b=y!==n,_=w-c;if(b&&_){Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+_);const E=Pc(t.timeZone,t),M=E>0?Math.floor(E):Math.ceil(E),T=y-M;T&&(t.internal.setUTCMinutes(t.internal.getUTCMinutes()+T),Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+T))}}class mi extends As{static tz(e,...n){return n.length?new mi(...n,e):new mi(Date.now(),e)}toISOString(){const[e,n,r]=this.tzComponents(),i=`${e}${n}:${r}`;return this.internal.toISOString().slice(0,-1)+i}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[e,n,r,i]=this.internal.toUTCString().split(" ");return`${e?.slice(0,-1)} ${r} ${n} ${i}`}toTimeString(){const e=this.internal.toUTCString().split(" ")[4],[n,r,i]=this.tzComponents();return`${e} GMT${n}${r}${i} (${Vre(this.timeZone,this)})`}toLocaleString(e,n){return Date.prototype.toLocaleString.call(this,e,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleDateString(e,n){return Date.prototype.toLocaleDateString.call(this,e,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleTimeString(e,n){return Date.prototype.toLocaleTimeString.call(this,e,{...n,timeZone:n?.timeZone||this.timeZone})}tzComponents(){const e=this.getTimezoneOffset(),n=e>0?"-":"+",r=String(Math.floor(Math.abs(e)/60)).padStart(2,"0"),i=String(Math.abs(e)%60).padStart(2,"0");return[n,r,i]}withTimeZone(e){return new mi(+this,e)}[Symbol.for("constructDateFrom")](e){return new mi(+new Date(e),this.timeZone)}}const XF=6048e5,$re=864e5,pP=Symbol.for("constructDateFrom");function Dr(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&pP in t?t[pP](e):t instanceof Date?new t.constructor(e):new Date(e)}function Jn(t,e){return Dr(e||t,t)}function KF(t,e,n){const r=Jn(t,n?.in);return isNaN(e)?Dr(t,NaN):(e&&r.setDate(r.getDate()+e),r)}function ZF(t,e,n){const r=Jn(t,n?.in);if(isNaN(e))return Dr(t,NaN);if(!e)return r;const i=r.getDate(),a=Dr(t,r.getTime());a.setMonth(r.getMonth()+e+1,0);const s=a.getDate();return i>=s?a:(r.setFullYear(a.getFullYear(),a.getMonth(),i),r)}let Yre={};function Fp(){return Yre}function Wd(t,e){const n=Fp(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=Jn(t,e?.in),a=i.getDay(),s=(a<r?7:0)+a-r;return i.setDate(i.getDate()-s),i.setHours(0,0,0,0),i}function sp(t,e){return Wd(t,{...e,weekStartsOn:1})}function JF(t,e){const n=Jn(t,e?.in),r=n.getFullYear(),i=Dr(n,0);i.setFullYear(r+1,0,4),i.setHours(0,0,0,0);const a=sp(i),s=Dr(n,0);s.setFullYear(r,0,4),s.setHours(0,0,0,0);const o=sp(s);return n.getTime()>=a.getTime()?r+1:n.getTime()>=o.getTime()?r:r-1}function mP(t){const e=Jn(t),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+t-+n}function uf(t,...e){const n=Dr.bind(null,e.find(r=>typeof r=="object"));return e.map(n)}function op(t,e){const n=Jn(t,e?.in);return n.setHours(0,0,0,0),n}function OE(t,e,n){const[r,i]=uf(n?.in,t,e),a=op(r),s=op(i),o=+a-mP(a),c=+s-mP(s);return Math.round((o-c)/$re)}function qre(t,e){const n=JF(t,e),r=Dr(t,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),sp(r)}function Xre(t,e,n){return KF(t,e*7,n)}function Kre(t,e,n){return ZF(t,e*12,n)}function Zre(t,e){let n,r=e?.in;return t.forEach(i=>{!r&&typeof i=="object"&&(r=Dr.bind(null,i));const a=Jn(i,r);(!n||n<a||isNaN(+a))&&(n=a)}),Dr(r,n||NaN)}function Jre(t,e){let n,r=e?.in;return t.forEach(i=>{!r&&typeof i=="object"&&(r=Dr.bind(null,i));const a=Jn(i,r);(!n||n>a||isNaN(+a))&&(n=a)}),Dr(r,n||NaN)}function Qre(t,e,n){const[r,i]=uf(n?.in,t,e);return+op(r)==+op(i)}function QF(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function eie(t){return!(!QF(t)&&typeof t!="number"||isNaN(+Jn(t)))}function e5(t,e,n){const[r,i]=uf(n?.in,t,e),a=r.getFullYear()-i.getFullYear(),s=r.getMonth()-i.getMonth();return a*12+s}function tie(t,e){const n=Jn(t,e?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function t5(t,e){const[n,r]=uf(t,e.start,e.end);return{start:n,end:r}}function nie(t,e){const{start:n,end:r}=t5(e?.in,t);let i=+n>+r;const a=i?+n:+r,s=i?r:n;s.setHours(0,0,0,0),s.setDate(1);let o=1;const c=[];for(;+s<=a;)c.push(Dr(n,s)),s.setMonth(s.getMonth()+o);return i?c.reverse():c}function rie(t,e){const n=Jn(t,e?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function iie(t,e){const n=Jn(t,e?.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}function n5(t,e){const n=Jn(t,e?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function aie(t,e){const{start:n,end:r}=t5(e?.in,t);let i=+n>+r;const a=i?+n:+r,s=i?r:n;s.setHours(0,0,0,0),s.setMonth(0,1);let o=1;const c=[];for(;+s<=a;)c.push(Dr(n,s)),s.setFullYear(s.getFullYear()+o);return i?c.reverse():c}function r5(t,e){const n=Fp(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=Jn(t,e?.in),a=i.getDay(),s=(a<r?-7:0)+6-(a-r);return i.setDate(i.getDate()+s),i.setHours(23,59,59,999),i}function sie(t,e){return r5(t,{...e,weekStartsOn:1})}const oie={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},lie=(t,e,n)=>{let r;const i=oie[t];return typeof i=="string"?r=i:e===1?r=i.one:r=i.other.replace("{{count}}",e.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function h_(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const cie={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},uie={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},die={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},fie={date:h_({formats:cie,defaultWidth:"full"}),time:h_({formats:uie,defaultWidth:"full"}),dateTime:h_({formats:die,defaultWidth:"full"})},hie={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},pie=(t,e,n,r)=>hie[t];function lh(t){return(e,n)=>{const r=n?.context?String(n.context):"standalone";let i;if(r==="formatting"&&t.formattingValues){const s=t.defaultFormattingWidth||t.defaultWidth,o=n?.width?String(n.width):s;i=t.formattingValues[o]||t.formattingValues[s]}else{const s=t.defaultWidth,o=n?.width?String(n.width):t.defaultWidth;i=t.values[o]||t.values[s]}const a=t.argumentCallback?t.argumentCallback(e):e;return i[a]}}const mie={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},gie={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},yie={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},vie={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},xie={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},bie={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},_ie=(t,e)=>{const n=Number(t),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},wie={ordinalNumber:_ie,era:lh({values:mie,defaultWidth:"wide"}),quarter:lh({values:gie,defaultWidth:"wide",argumentCallback:t=>t-1}),month:lh({values:yie,defaultWidth:"wide"}),day:lh({values:vie,defaultWidth:"wide"}),dayPeriod:lh({values:xie,defaultWidth:"wide",formattingValues:bie,defaultFormattingWidth:"wide"})};function ch(t){return(e,n={})=>{const r=n.width,i=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],a=e.match(i);if(!a)return null;const s=a[0],o=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],c=Array.isArray(o)?kie(o,h=>h.test(s)):Sie(o,h=>h.test(s));let u;u=t.valueCallback?t.valueCallback(c):c,u=n.valueCallback?n.valueCallback(u):u;const f=e.slice(s.length);return{value:u,rest:f}}}function Sie(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function kie(t,e){for(let n=0;n<t.length;n++)if(e(t[n]))return n}function Eie(t){return(e,n={})=>{const r=e.match(t.matchPattern);if(!r)return null;const i=r[0],a=e.match(t.parsePattern);if(!a)return null;let s=t.valueCallback?t.valueCallback(a[0]):a[0];s=n.valueCallback?n.valueCallback(s):s;const o=e.slice(i.length);return{value:s,rest:o}}}const Mie=/^(\d+)(th|st|nd|rd)?/i,Tie=/\d+/i,Cie={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Aie={any:[/^b/i,/^(a|c)/i]},Rie={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Pie={any:[/1/i,/2/i,/3/i,/4/i]},Nie={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Die={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Lie={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Iie={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Oie={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Fie={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Uie={ordinalNumber:Eie({matchPattern:Mie,parsePattern:Tie,valueCallback:t=>parseInt(t,10)}),era:ch({matchPatterns:Cie,defaultMatchWidth:"wide",parsePatterns:Aie,defaultParseWidth:"any"}),quarter:ch({matchPatterns:Rie,defaultMatchWidth:"wide",parsePatterns:Pie,defaultParseWidth:"any",valueCallback:t=>t+1}),month:ch({matchPatterns:Nie,defaultMatchWidth:"wide",parsePatterns:Die,defaultParseWidth:"any"}),day:ch({matchPatterns:Lie,defaultMatchWidth:"wide",parsePatterns:Iie,defaultParseWidth:"any"}),dayPeriod:ch({matchPatterns:Oie,defaultMatchWidth:"any",parsePatterns:Fie,defaultParseWidth:"any"})},gd={code:"en-US",formatDistance:lie,formatLong:fie,formatRelative:pie,localize:wie,match:Uie,options:{weekStartsOn:0,firstWeekContainsDate:1}};function jie(t,e){const n=Jn(t,e?.in);return OE(n,n5(n))+1}function FE(t,e){const n=Jn(t,e?.in),r=+sp(n)-+qre(n);return Math.round(r/XF)+1}function i5(t,e){const n=Jn(t,e?.in),r=n.getFullYear(),i=Fp(),a=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,s=Dr(e?.in||t,0);s.setFullYear(r+1,0,a),s.setHours(0,0,0,0);const o=Wd(s,e),c=Dr(e?.in||t,0);c.setFullYear(r,0,a),c.setHours(0,0,0,0);const u=Wd(c,e);return+n>=+o?r+1:+n>=+u?r:r-1}function Bie(t,e){const n=Fp(),r=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=i5(t,e),a=Dr(e?.in||t,0);return a.setFullYear(i,0,r),a.setHours(0,0,0,0),Wd(a,e)}function UE(t,e){const n=Jn(t,e?.in),r=+Wd(n,e)-+Bie(n,e);return Math.round(r/XF)+1}function Xn(t,e){const n=t<0?"-":"",r=Math.abs(t).toString().padStart(e,"0");return n+r}const il={y(t,e){const n=t.getFullYear(),r=n>0?n:1-n;return Xn(e==="yy"?r%100:r,e.length)},M(t,e){const n=t.getMonth();return e==="M"?String(n+1):Xn(n+1,2)},d(t,e){return Xn(t.getDate(),e.length)},a(t,e){const n=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return n==="am"?"a.m.":"p.m."}},h(t,e){return Xn(t.getHours()%12||12,e.length)},H(t,e){return Xn(t.getHours(),e.length)},m(t,e){return Xn(t.getMinutes(),e.length)},s(t,e){return Xn(t.getSeconds(),e.length)},S(t,e){const n=e.length,r=t.getMilliseconds(),i=Math.trunc(r*Math.pow(10,n-3));return Xn(i,e.length)}},Xu={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},gP={G:function(t,e,n){const r=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});default:return n.era(r,{width:"wide"})}},y:function(t,e,n){if(e==="yo"){const r=t.getFullYear(),i=r>0?r:1-r;return n.ordinalNumber(i,{unit:"year"})}return il.y(t,e)},Y:function(t,e,n,r){const i=i5(t,r),a=i>0?i:1-i;if(e==="YY"){const s=a%100;return Xn(s,2)}return e==="Yo"?n.ordinalNumber(a,{unit:"year"}):Xn(a,e.length)},R:function(t,e){const n=JF(t);return Xn(n,e.length)},u:function(t,e){const n=t.getFullYear();return Xn(n,e.length)},Q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(r);case"QQ":return Xn(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(r);case"qq":return Xn(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(t,e,n){const r=t.getMonth();switch(e){case"M":case"MM":return il.M(t,e);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(t,e,n){const r=t.getMonth();switch(e){case"L":return String(r+1);case"LL":return Xn(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(t,e,n,r){const i=UE(t,r);return e==="wo"?n.ordinalNumber(i,{unit:"week"}):Xn(i,e.length)},I:function(t,e,n){const r=FE(t);return e==="Io"?n.ordinalNumber(r,{unit:"week"}):Xn(r,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):il.d(t,e)},D:function(t,e,n){const r=jie(t);return e==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):Xn(r,e.length)},E:function(t,e,n){const r=t.getDay();switch(e){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(t,e,n,r){const i=t.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(e){case"e":return String(a);case"ee":return Xn(a,2);case"eo":return n.ordinalNumber(a,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(t,e,n,r){const i=t.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(e){case"c":return String(a);case"cc":return Xn(a,e.length);case"co":return n.ordinalNumber(a,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(t,e,n){const r=t.getDay(),i=r===0?7:r;switch(e){case"i":return String(i);case"ii":return Xn(i,e.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(t,e,n){const i=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(t,e,n){const r=t.getHours();let i;switch(r===12?i=Xu.noon:r===0?i=Xu.midnight:i=r/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(t,e,n){const r=t.getHours();let i;switch(r>=17?i=Xu.evening:r>=12?i=Xu.afternoon:r>=4?i=Xu.morning:i=Xu.night,e){case"B":case"BB":case"BBB":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(t,e,n){if(e==="ho"){let r=t.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return il.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):il.H(t,e)},K:function(t,e,n){const r=t.getHours()%12;return e==="Ko"?n.ordinalNumber(r,{unit:"hour"}):Xn(r,e.length)},k:function(t,e,n){let r=t.getHours();return r===0&&(r=24),e==="ko"?n.ordinalNumber(r,{unit:"hour"}):Xn(r,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):il.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):il.s(t,e)},S:function(t,e){return il.S(t,e)},X:function(t,e,n){const r=t.getTimezoneOffset();if(r===0)return"Z";switch(e){case"X":return vP(r);case"XXXX":case"XX":return wc(r);default:return wc(r,":")}},x:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"x":return vP(r);case"xxxx":case"xx":return wc(r);default:return wc(r,":")}},O:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+yP(r,":");default:return"GMT"+wc(r,":")}},z:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+yP(r,":");default:return"GMT"+wc(r,":")}},t:function(t,e,n){const r=Math.trunc(+t/1e3);return Xn(r,e.length)},T:function(t,e,n){return Xn(+t,e.length)}};function yP(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),i=Math.trunc(r/60),a=r%60;return a===0?n+String(i):n+String(i)+e+Xn(a,2)}function vP(t,e){return t%60===0?(t>0?"-":"+")+Xn(Math.abs(t)/60,2):wc(t,e)}function wc(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),i=Xn(Math.trunc(r/60),2),a=Xn(r%60,2);return n+i+e+a}const xP=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});default:return e.date({width:"full"})}},a5=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});default:return e.time({width:"full"})}},zie=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return xP(t,e);let a;switch(r){case"P":a=e.dateTime({width:"short"});break;case"PP":a=e.dateTime({width:"medium"});break;case"PPP":a=e.dateTime({width:"long"});break;default:a=e.dateTime({width:"full"});break}return a.replace("{{date}}",xP(r,e)).replace("{{time}}",a5(i,e))},Vie={p:a5,P:zie},Hie=/^D+$/,Wie=/^Y+$/,Gie=["D","DD","YY","YYYY"];function $ie(t){return Hie.test(t)}function Yie(t){return Wie.test(t)}function qie(t,e,n){const r=Xie(t,e,n);if(console.warn(r),Gie.includes(t))throw new RangeError(r)}function Xie(t,e,n){const r=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const Kie=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Zie=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Jie=/^'([^]*?)'?$/,Qie=/''/g,eae=/[a-zA-Z]/;function Rs(t,e,n){const r=Fp(),i=n?.locale??r.locale??gd,a=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,s=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,o=Jn(t,n?.in);if(!eie(o))throw new RangeError("Invalid time value");let c=e.match(Zie).map(f=>{const h=f[0];if(h==="p"||h==="P"){const p=Vie[h];return p(f,i.formatLong)}return f}).join("").match(Kie).map(f=>{if(f==="''")return{isToken:!1,value:"'"};const h=f[0];if(h==="'")return{isToken:!1,value:tae(f)};if(gP[h])return{isToken:!0,value:f};if(h.match(eae))throw new RangeError("Format string contains an unescaped latin alphabet character `"+h+"`");return{isToken:!1,value:f}});i.localize.preprocessor&&(c=i.localize.preprocessor(o,c));const u={firstWeekContainsDate:a,weekStartsOn:s,locale:i};return c.map(f=>{if(!f.isToken)return f.value;const h=f.value;(!n?.useAdditionalWeekYearTokens&&Yie(h)||!n?.useAdditionalDayOfYearTokens&&$ie(h))&&qie(h,e,String(t));const p=gP[h[0]];return p(o,h,i.localize,u)}).join("")}function tae(t){const e=t.match(Jie);return e?e[1].replace(Qie,"'"):t}function nae(t,e){const n=Jn(t,e?.in),r=n.getFullYear(),i=n.getMonth(),a=Dr(n,0);return a.setFullYear(r,i+1,0),a.setHours(0,0,0,0),a.getDate()}function rae(t,e){return Jn(t,e?.in).getMonth()}function iae(t,e){return Jn(t,e?.in).getFullYear()}function aae(t,e){return+Jn(t)>+Jn(e)}function sae(t,e){return+Jn(t)<+Jn(e)}function oae(t,e,n){const[r,i]=uf(n?.in,t,e);return r.getFullYear()===i.getFullYear()&&r.getMonth()===i.getMonth()}function lae(t,e,n){const[r,i]=uf(n?.in,t,e);return r.getFullYear()===i.getFullYear()}function cae(t,e,n){const r=Jn(t,n?.in),i=r.getFullYear(),a=r.getDate(),s=Dr(t,0);s.setFullYear(i,e,15),s.setHours(0,0,0,0);const o=nae(s);return r.setMonth(e,Math.min(a,o)),r}function uae(t,e,n){const r=Jn(t,n?.in);return isNaN(+r)?Dr(t,NaN):(r.setFullYear(e),r)}const bP=5,dae=4;function fae(t,e){const n=e.startOfMonth(t),r=n.getDay()>0?n.getDay():7,i=e.addDays(t,-r+1),a=e.addDays(i,bP*7-1);return e.getMonth(t)===e.getMonth(a)?bP:dae}function s5(t,e){const n=e.startOfMonth(t),r=n.getDay();return r===1?n:r===0?e.addDays(n,-6):e.addDays(n,-1*(r-1))}function hae(t,e){const n=s5(t,e),r=fae(t,e);return e.addDays(n,r*7-1)}const o5={...gd,labels:{labelDayButton:(t,e,n,r)=>{let i;r&&typeof r.format=="function"?i=r.format.bind(r):i=(s,o)=>Rs(s,o,{locale:gd,...n});let a=i(t,"PPPP");return e.today&&(a=`Today, ${a}`),e.selected&&(a=`${a}, selected`),a},labelMonthDropdown:"Choose the Month",labelNext:"Go to the Next Month",labelPrevious:"Go to the Previous Month",labelWeekNumber:t=>`Week ${t}`,labelYearDropdown:"Choose the Year",labelGrid:(t,e,n)=>{let r;return n&&typeof n.format=="function"?r=n.format.bind(n):r=(i,a)=>Rs(i,a,{locale:gd,...e}),r(t,"LLLL yyyy")},labelGridcell:(t,e,n,r)=>{let i;r&&typeof r.format=="function"?i=r.format.bind(r):i=(s,o)=>Rs(s,o,{locale:gd,...n});let a=i(t,"PPPP");return e?.today&&(a=`Today, ${a}`),a},labelNav:"Navigation bar",labelWeekNumberHeader:"Week Number",labelWeekday:(t,e,n)=>{let r;return n&&typeof n.format=="function"?r=n.format.bind(n):r=(i,a)=>Rs(i,a,{locale:gd,...e}),r(t,"cccc")}}};class ua{constructor(e,n){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?mi.tz(this.options.timeZone):new this.Date,this.newDate=(r,i,a)=>this.overrides?.newDate?this.overrides.newDate(r,i,a):this.options.timeZone?new mi(r,i,a,this.options.timeZone):new Date(r,i,a),this.addDays=(r,i)=>this.overrides?.addDays?this.overrides.addDays(r,i):KF(r,i),this.addMonths=(r,i)=>this.overrides?.addMonths?this.overrides.addMonths(r,i):ZF(r,i),this.addWeeks=(r,i)=>this.overrides?.addWeeks?this.overrides.addWeeks(r,i):Xre(r,i),this.addYears=(r,i)=>this.overrides?.addYears?this.overrides.addYears(r,i):Kre(r,i),this.differenceInCalendarDays=(r,i)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(r,i):OE(r,i),this.differenceInCalendarMonths=(r,i)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(r,i):e5(r,i),this.eachMonthOfInterval=r=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(r):nie(r),this.eachYearOfInterval=r=>{const i=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(r):aie(r),a=new Set(i.map(o=>this.getYear(o)));if(a.size===i.length)return i;const s=[];return a.forEach(o=>{s.push(new Date(o,0,1))}),s},this.endOfBroadcastWeek=r=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(r):hae(r,this),this.endOfISOWeek=r=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(r):sie(r),this.endOfMonth=r=>this.overrides?.endOfMonth?this.overrides.endOfMonth(r):tie(r),this.endOfWeek=(r,i)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(r,i):r5(r,this.options),this.endOfYear=r=>this.overrides?.endOfYear?this.overrides.endOfYear(r):iie(r),this.format=(r,i,a)=>{const s=this.overrides?.format?this.overrides.format(r,i,this.options):Rs(r,i,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(s):s},this.getISOWeek=r=>this.overrides?.getISOWeek?this.overrides.getISOWeek(r):FE(r),this.getMonth=(r,i)=>this.overrides?.getMonth?this.overrides.getMonth(r,this.options):rae(r,this.options),this.getYear=(r,i)=>this.overrides?.getYear?this.overrides.getYear(r,this.options):iae(r,this.options),this.getWeek=(r,i)=>this.overrides?.getWeek?this.overrides.getWeek(r,this.options):UE(r,this.options),this.isAfter=(r,i)=>this.overrides?.isAfter?this.overrides.isAfter(r,i):aae(r,i),this.isBefore=(r,i)=>this.overrides?.isBefore?this.overrides.isBefore(r,i):sae(r,i),this.isDate=r=>this.overrides?.isDate?this.overrides.isDate(r):QF(r),this.isSameDay=(r,i)=>this.overrides?.isSameDay?this.overrides.isSameDay(r,i):Qre(r,i),this.isSameMonth=(r,i)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(r,i):oae(r,i),this.isSameYear=(r,i)=>this.overrides?.isSameYear?this.overrides.isSameYear(r,i):lae(r,i),this.max=r=>this.overrides?.max?this.overrides.max(r):Zre(r),this.min=r=>this.overrides?.min?this.overrides.min(r):Jre(r),this.setMonth=(r,i)=>this.overrides?.setMonth?this.overrides.setMonth(r,i):cae(r,i),this.setYear=(r,i)=>this.overrides?.setYear?this.overrides.setYear(r,i):uae(r,i),this.startOfBroadcastWeek=(r,i)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(r,this):s5(r,this),this.startOfDay=r=>this.overrides?.startOfDay?this.overrides.startOfDay(r):op(r),this.startOfISOWeek=r=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(r):sp(r),this.startOfMonth=r=>this.overrides?.startOfMonth?this.overrides.startOfMonth(r):rie(r),this.startOfWeek=(r,i)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(r,this.options):Wd(r,this.options),this.startOfYear=r=>this.overrides?.startOfYear?this.overrides.startOfYear(r):n5(r),this.options={locale:o5,...e},this.overrides=n}getDigitMap(){const{numerals:e="latn"}=this.options,n=new Intl.NumberFormat("en-US",{numberingSystem:e}),r={};for(let i=0;i<10;i++)r[i.toString()]=n.format(i);return r}replaceDigits(e){const n=this.getDigitMap();return e.replace(/\d/g,r=>n[r]||r)}formatNumber(e){return this.replaceDigits(e.toString())}getMonthYearOrder(){const e=this.options.locale?.code;return e&&ua.yearFirstLocales.has(e)?"year-first":"month-first"}formatMonthYear(e){const{locale:n,timeZone:r,numerals:i}=this.options,a=n?.code;if(a&&ua.yearFirstLocales.has(a))try{return new Intl.DateTimeFormat(a,{month:"long",year:"numeric",timeZone:r,numberingSystem:i}).format(e)}catch{}const s=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(e,s)}}ua.yearFirstLocales=new Set(["eu","hu","ja","ja-Hira","ja-JP","ko","ko-KR","lt","lt-LT","lv","lv-LV","mn","mn-MN","zh","zh-CN","zh-HK","zh-TW"]);const Zs=new ua;class l5{constructor(e,n,r=Zs){this.date=e,this.displayMonth=n,this.outside=!!(n&&!r.isSameMonth(e,n)),this.dateLib=r,this.isoDate=r.format(e,"yyyy-MM-dd"),this.displayMonthId=r.format(n,"yyyy-MM"),this.dateMonthId=r.format(e,"yyyy-MM")}isEqualTo(e){return this.dateLib.isSameDay(e.date,this.date)&&this.dateLib.isSameMonth(e.displayMonth,this.displayMonth)}}class pae{constructor(e,n){this.date=e,this.weeks=n}}class mae{constructor(e,n){this.days=n,this.weekNumber=e}}function gae(t){return ot.createElement("button",{...t})}function yae(t){return ot.createElement("span",{...t})}function vae(t){const{size:e=24,orientation:n="left",className:r}=t;return ot.createElement("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24"},n==="up"&&ot.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),n==="down"&&ot.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),n==="left"&&ot.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),n==="right"&&ot.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function xae(t){const{day:e,modifiers:n,...r}=t;return ot.createElement("td",{...r})}function bae(t){const{day:e,modifiers:n,...r}=t,i=ot.useRef(null);return ot.useEffect(()=>{n.focused&&i.current?.focus()},[n.focused]),ot.createElement("button",{ref:i,...r})}var Zt;(function(t){t.Root="root",t.Chevron="chevron",t.Day="day",t.DayButton="day_button",t.CaptionLabel="caption_label",t.Dropdowns="dropdowns",t.Dropdown="dropdown",t.DropdownRoot="dropdown_root",t.Footer="footer",t.MonthGrid="month_grid",t.MonthCaption="month_caption",t.MonthsDropdown="months_dropdown",t.Month="month",t.Months="months",t.Nav="nav",t.NextMonthButton="button_next",t.PreviousMonthButton="button_previous",t.Week="week",t.Weeks="weeks",t.Weekday="weekday",t.Weekdays="weekdays",t.WeekNumber="week_number",t.WeekNumberHeader="week_number_header",t.YearsDropdown="years_dropdown"})(Zt||(Zt={}));var dr;(function(t){t.disabled="disabled",t.hidden="hidden",t.outside="outside",t.focused="focused",t.today="today"})(dr||(dr={}));var Qa;(function(t){t.range_end="range_end",t.range_middle="range_middle",t.range_start="range_start",t.selected="selected"})(Qa||(Qa={}));var na;(function(t){t.weeks_before_enter="weeks_before_enter",t.weeks_before_exit="weeks_before_exit",t.weeks_after_enter="weeks_after_enter",t.weeks_after_exit="weeks_after_exit",t.caption_after_enter="caption_after_enter",t.caption_after_exit="caption_after_exit",t.caption_before_enter="caption_before_enter",t.caption_before_exit="caption_before_exit"})(na||(na={}));function _ae(t){const{options:e,className:n,components:r,classNames:i,...a}=t,s=[i[Zt.Dropdown],n].join(" "),o=e?.find(({value:c})=>c===a.value);return ot.createElement("span",{"data-disabled":a.disabled,className:i[Zt.DropdownRoot]},ot.createElement(r.Select,{className:s,...a},e?.map(({value:c,label:u,disabled:f})=>ot.createElement(r.Option,{key:c,value:c,disabled:f},u))),ot.createElement("span",{className:i[Zt.CaptionLabel],"aria-hidden":!0},o?.label,ot.createElement(r.Chevron,{orientation:"down",size:18,className:i[Zt.Chevron]})))}function wae(t){return ot.createElement("div",{...t})}function Sae(t){return ot.createElement("div",{...t})}function kae(t){const{calendarMonth:e,displayIndex:n,...r}=t;return ot.createElement("div",{...r},t.children)}function Eae(t){const{calendarMonth:e,displayIndex:n,...r}=t;return ot.createElement("div",{...r})}function Mae(t){return ot.createElement("table",{...t})}function Tae(t){return ot.createElement("div",{...t})}const c5=x.createContext(void 0);function Up(){const t=x.useContext(c5);if(t===void 0)throw new Error("useDayPicker() must be used within a custom component.");return t}function Cae(t){const{components:e}=Up();return ot.createElement(e.Dropdown,{...t})}function Aae(t){const{onPreviousClick:e,onNextClick:n,previousMonth:r,nextMonth:i,...a}=t,{components:s,classNames:o,labels:{labelPrevious:c,labelNext:u}}=Up(),f=x.useCallback(p=>{i&&n?.(p)},[i,n]),h=x.useCallback(p=>{r&&e?.(p)},[r,e]);return ot.createElement("nav",{...a},ot.createElement(s.PreviousMonthButton,{type:"button",className:o[Zt.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":c(r),onClick:h},ot.createElement(s.Chevron,{disabled:r?void 0:!0,className:o[Zt.Chevron],orientation:"left"})),ot.createElement(s.NextMonthButton,{type:"button",className:o[Zt.NextMonthButton],tabIndex:i?void 0:-1,"aria-disabled":i?void 0:!0,"aria-label":u(i),onClick:f},ot.createElement(s.Chevron,{disabled:i?void 0:!0,orientation:"right",className:o[Zt.Chevron]})))}function Rae(t){const{components:e}=Up();return ot.createElement(e.Button,{...t})}function Pae(t){return ot.createElement("option",{...t})}function Nae(t){const{components:e}=Up();return ot.createElement(e.Button,{...t})}function Dae(t){const{rootRef:e,...n}=t;return ot.createElement("div",{...n,ref:e})}function Lae(t){return ot.createElement("select",{...t})}function Iae(t){const{week:e,...n}=t;return ot.createElement("tr",{...n})}function Oae(t){return ot.createElement("th",{...t})}function Fae(t){return ot.createElement("thead",{"aria-hidden":!0},ot.createElement("tr",{...t}))}function Uae(t){const{week:e,...n}=t;return ot.createElement("th",{...n})}function jae(t){return ot.createElement("th",{...t})}function Bae(t){return ot.createElement("tbody",{...t})}function zae(t){const{components:e}=Up();return ot.createElement(e.Dropdown,{...t})}const Vae=Object.freeze(Object.defineProperty({__proto__:null,Button:gae,CaptionLabel:yae,Chevron:vae,Day:xae,DayButton:bae,Dropdown:_ae,DropdownNav:wae,Footer:Sae,Month:kae,MonthCaption:Eae,MonthGrid:Mae,Months:Tae,MonthsDropdown:Cae,Nav:Aae,NextMonthButton:Rae,Option:Pae,PreviousMonthButton:Nae,Root:Dae,Select:Lae,Week:Iae,WeekNumber:Uae,WeekNumberHeader:jae,Weekday:Oae,Weekdays:Fae,Weeks:Bae,YearsDropdown:zae},Symbol.toStringTag,{value:"Module"}));function _o(t,e,n=!1,r=Zs){let{from:i,to:a}=t;const{differenceInCalendarDays:s,isSameDay:o}=r;return i&&a?(s(a,i)<0&&([i,a]=[a,i]),s(e,i)>=(n?1:0)&&s(a,e)>=(n?1:0)):!n&&a?o(a,e):!n&&i?o(i,e):!1}function jE(t){return!!(t&&typeof t=="object"&&"before"in t&&"after"in t)}function lv(t){return!!(t&&typeof t=="object"&&"from"in t)}function BE(t){return!!(t&&typeof t=="object"&&"after"in t)}function zE(t){return!!(t&&typeof t=="object"&&"before"in t)}function u5(t){return!!(t&&typeof t=="object"&&"dayOfWeek"in t)}function d5(t,e){return Array.isArray(t)&&t.every(e.isDate)}function wo(t,e,n=Zs){const r=Array.isArray(e)?e:[e],{isSameDay:i,differenceInCalendarDays:a,isAfter:s}=n;return r.some(o=>{if(typeof o=="boolean")return o;if(n.isDate(o))return i(t,o);if(d5(o,n))return o.some(c=>i(t,c));if(lv(o))return _o(o,t,!1,n);if(u5(o))return Array.isArray(o.dayOfWeek)?o.dayOfWeek.includes(t.getDay()):o.dayOfWeek===t.getDay();if(jE(o)){const c=a(o.before,t),u=a(o.after,t),f=c>0,h=u<0;return s(o.before,o.after)?h&&f:f||h}return BE(o)?a(t,o.after)>0:zE(o)?a(o.before,t)>0:typeof o=="function"?o(t):!1})}function Hae(t,e,n,r,i){const{disabled:a,hidden:s,modifiers:o,showOutsideDays:c,broadcastCalendar:u,today:f=i.today()}=e,{isSameDay:h,isSameMonth:p,startOfMonth:y,isBefore:v,endOfMonth:w,isAfter:b}=i,_=n&&y(n),E=r&&w(r),M={[dr.focused]:[],[dr.outside]:[],[dr.disabled]:[],[dr.hidden]:[],[dr.today]:[]},T={};for(const R of t){const{date:A,displayMonth:P}=R,k=!!(P&&!p(A,P)),N=!!(_&&v(A,_)),j=!!(E&&b(A,E)),L=!!(a&&wo(A,a,i)),z=!!(s&&wo(A,s,i))||N||j||!u&&!c&&k||u&&c===!1&&k,U=h(A,f);k&&M.outside.push(R),L&&M.disabled.push(R),z&&M.hidden.push(R),U&&M.today.push(R),o&&Object.keys(o).forEach(V=>{const W=o?.[V];W&&wo(A,W,i)&&(T[V]?T[V].push(R):T[V]=[R])})}return R=>{const A={[dr.focused]:!1,[dr.disabled]:!1,[dr.hidden]:!1,[dr.outside]:!1,[dr.today]:!1},P={};for(const k in M){const N=M[k];A[k]=N.some(j=>j===R)}for(const k in T)P[k]=T[k].some(N=>N===R);return{...A,...P}}}function Wae(t,e,n={}){return Object.entries(t).filter(([,i])=>i===!0).reduce((i,[a])=>(n[a]?i.push(n[a]):e[dr[a]]?i.push(e[dr[a]]):e[Qa[a]]&&i.push(e[Qa[a]]),i),[e[Zt.Day]])}function Gae(t){return{...Vae,...t}}function $ae(t){const e={"data-mode":t.mode??void 0,"data-required":"required"in t?t.required:void 0,"data-multiple-months":t.numberOfMonths&&t.numberOfMonths>1||void 0,"data-week-numbers":t.showWeekNumber||void 0,"data-broadcast-calendar":t.broadcastCalendar||void 0,"data-nav-layout":t.navLayout||void 0};return Object.entries(t).forEach(([n,r])=>{n.startsWith("data-")&&(e[n]=r)}),e}function Yae(){const t={};for(const e in Zt)t[Zt[e]]=`rdp-${Zt[e]}`;for(const e in dr)t[dr[e]]=`rdp-${dr[e]}`;for(const e in Qa)t[Qa[e]]=`rdp-${Qa[e]}`;for(const e in na)t[na[e]]=`rdp-${na[e]}`;return t}function f5(t,e,n){return(n??new ua(e)).formatMonthYear(t)}const qae=f5;function Xae(t,e,n){return(n??new ua(e)).format(t,"d")}function Kae(t,e=Zs){return e.format(t,"LLLL")}function Zae(t,e,n){return(n??new ua(e)).format(t,"cccccc")}function Jae(t,e=Zs){return t<10?e.formatNumber(`0${t.toLocaleString()}`):e.formatNumber(`${t.toLocaleString()}`)}function Qae(){return""}function h5(t,e=Zs){return e.format(t,"yyyy")}const ese=h5,tse=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:f5,formatDay:Xae,formatMonthCaption:qae,formatMonthDropdown:Kae,formatWeekNumber:Jae,formatWeekNumberHeader:Qae,formatWeekdayName:Zae,formatYearCaption:ese,formatYearDropdown:h5},Symbol.toStringTag,{value:"Module"}));function nse(t){return t?.formatMonthCaption&&!t.formatCaption&&(t.formatCaption=t.formatMonthCaption),t?.formatYearCaption&&!t.formatYearDropdown&&(t.formatYearDropdown=t.formatYearCaption),{...tse,...t}}function VE(t,e,n,r){let i=(r??new ua(n)).format(t,"PPPP");return e.today&&(i=`Today, ${i}`),e.selected&&(i=`${i}, selected`),i}const rse=VE;function HE(t,e,n){return(n??new ua(e)).formatMonthYear(t)}const ise=HE;function p5(t,e,n,r){let i=(r??new ua(n)).format(t,"PPPP");return e?.today&&(i=`Today, ${i}`),i}function m5(t){return"Choose the Month"}function g5(){return""}const ase="Go to the Next Month";function y5(t,e){return ase}function v5(t){return"Go to the Previous Month"}function x5(t,e,n){return(n??new ua(e)).format(t,"cccc")}function b5(t,e){return`Week ${t}`}function _5(t){return"Week Number"}function w5(t){return"Choose the Year"}const sse=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:ise,labelDay:rse,labelDayButton:VE,labelGrid:HE,labelGridcell:p5,labelMonthDropdown:m5,labelNav:g5,labelNext:y5,labelPrevious:v5,labelWeekNumber:b5,labelWeekNumberHeader:_5,labelWeekday:x5,labelYearDropdown:w5},Symbol.toStringTag,{value:"Module"})),Ha=(t,e,n)=>e||(n?typeof n=="function"?n:(...r)=>n:t);function ose(t,e){const n=e.locale?.labels??{};return{...sse,...t??{},labelDayButton:Ha(VE,t?.labelDayButton,n.labelDayButton),labelMonthDropdown:Ha(m5,t?.labelMonthDropdown,n.labelMonthDropdown),labelNext:Ha(y5,t?.labelNext,n.labelNext),labelPrevious:Ha(v5,t?.labelPrevious,n.labelPrevious),labelWeekNumber:Ha(b5,t?.labelWeekNumber,n.labelWeekNumber),labelYearDropdown:Ha(w5,t?.labelYearDropdown,n.labelYearDropdown),labelGrid:Ha(HE,t?.labelGrid,n.labelGrid),labelGridcell:Ha(p5,t?.labelGridcell,n.labelGridcell),labelNav:Ha(g5,t?.labelNav,n.labelNav),labelWeekNumberHeader:Ha(_5,t?.labelWeekNumberHeader,n.labelWeekNumberHeader),labelWeekday:Ha(x5,t?.labelWeekday,n.labelWeekday)}}function lse(t,e,n,r,i){const{startOfMonth:a,startOfYear:s,endOfYear:o,eachMonthOfInterval:c,getMonth:u}=i;return c({start:s(t),end:o(t)}).map(p=>{const y=r.formatMonthDropdown(p,i),v=u(p),w=e&&p<a(e)||n&&p>a(n)||!1;return{value:v,label:y,disabled:w}})}function cse(t,e={},n={}){let r={...e?.[Zt.Day]};return Object.entries(t).filter(([,i])=>i===!0).forEach(([i])=>{r={...r,...n?.[i]}}),r}function use(t,e,n,r){const i=r??t.today(),a=n?t.startOfBroadcastWeek(i,t):e?t.startOfISOWeek(i):t.startOfWeek(i),s=[];for(let o=0;o<7;o++){const c=t.addDays(a,o);s.push(c)}return s}function dse(t,e,n,r,i=!1){if(!t||!e)return;const{startOfYear:a,endOfYear:s,eachYearOfInterval:o,getYear:c}=r,u=a(t),f=s(e),h=o({start:u,end:f});return i&&h.reverse(),h.map(p=>{const y=n.formatYearDropdown(p,r);return{value:c(p),label:y,disabled:!1}})}function fse(t,e={}){const{weekStartsOn:n,locale:r}=e,i=n??r?.options?.weekStartsOn??0,a=o=>{const c=typeof o=="number"||typeof o=="string"?new Date(o):o;return new mi(c.getFullYear(),c.getMonth(),c.getDate(),12,0,0,t)},s=o=>{const c=a(o);return new Date(c.getFullYear(),c.getMonth(),c.getDate(),0,0,0,0)};return{today:()=>a(mi.tz(t)),newDate:(o,c,u)=>new mi(o,c,u,12,0,0,t),startOfDay:o=>a(o),startOfWeek:(o,c)=>{const u=a(o),f=c?.weekStartsOn??i,h=(u.getDay()-f+7)%7;return u.setDate(u.getDate()-h),u},startOfISOWeek:o=>{const c=a(o),u=(c.getDay()-1+7)%7;return c.setDate(c.getDate()-u),c},startOfMonth:o=>{const c=a(o);return c.setDate(1),c},startOfYear:o=>{const c=a(o);return c.setMonth(0,1),c},endOfWeek:(o,c)=>{const u=a(o),p=(((c?.weekStartsOn??i)+6)%7-u.getDay()+7)%7;return u.setDate(u.getDate()+p),u},endOfISOWeek:o=>{const c=a(o),u=(7-c.getDay())%7;return c.setDate(c.getDate()+u),c},endOfMonth:o=>{const c=a(o);return c.setMonth(c.getMonth()+1,0),c},endOfYear:o=>{const c=a(o);return c.setMonth(11,31),c},eachMonthOfInterval:o=>{const c=a(o.start),u=a(o.end),f=[],h=new mi(c.getFullYear(),c.getMonth(),1,12,0,0,t),p=u.getFullYear()*12+u.getMonth();for(;h.getFullYear()*12+h.getMonth()<=p;)f.push(new mi(h,t)),h.setMonth(h.getMonth()+1,1);return f},addDays:(o,c)=>{const u=a(o);return u.setDate(u.getDate()+c),u},addWeeks:(o,c)=>{const u=a(o);return u.setDate(u.getDate()+c*7),u},addMonths:(o,c)=>{const u=a(o);return u.setMonth(u.getMonth()+c),u},addYears:(o,c)=>{const u=a(o);return u.setFullYear(u.getFullYear()+c),u},eachYearOfInterval:o=>{const c=a(o.start),u=a(o.end),f=[],h=new mi(c.getFullYear(),0,1,12,0,0,t);for(;h.getFullYear()<=u.getFullYear();)f.push(new mi(h,t)),h.setFullYear(h.getFullYear()+1,0,1);return f},getWeek:(o,c)=>{const u=s(o);return UE(u,{weekStartsOn:c?.weekStartsOn??i,firstWeekContainsDate:c?.firstWeekContainsDate??r?.options?.firstWeekContainsDate??1})},getISOWeek:o=>{const c=s(o);return FE(c)},differenceInCalendarDays:(o,c)=>{const u=s(o),f=s(c);return OE(u,f)},differenceInCalendarMonths:(o,c)=>{const u=s(o),f=s(c);return e5(u,f)}}}const jp=t=>t instanceof HTMLElement?t:null,p_=t=>[...t.querySelectorAll("[data-animated-month]")??[]],hse=t=>jp(t.querySelector("[data-animated-month]")),m_=t=>jp(t.querySelector("[data-animated-caption]")),g_=t=>jp(t.querySelector("[data-animated-weeks]")),pse=t=>jp(t.querySelector("[data-animated-nav]")),mse=t=>jp(t.querySelector("[data-animated-weekdays]"));function gse(t,e,{classNames:n,months:r,focused:i,dateLib:a}){const s=x.useRef(null),o=x.useRef(r),c=x.useRef(!1);x.useLayoutEffect(()=>{const u=o.current;if(o.current=r,!e||!t.current||!(t.current instanceof HTMLElement)||r.length===0||u.length===0||r.length!==u.length)return;const f=a.isSameMonth(r[0].date,u[0].date),h=a.isAfter(r[0].date,u[0].date),p=h?n[na.caption_after_enter]:n[na.caption_before_enter],y=h?n[na.weeks_after_enter]:n[na.weeks_before_enter],v=s.current,w=t.current.cloneNode(!0);if(w instanceof HTMLElement?(p_(w).forEach(M=>{if(!(M instanceof HTMLElement))return;const T=hse(M);T&&M.contains(T)&&M.removeChild(T);const R=m_(M);R&&R.classList.remove(p);const A=g_(M);A&&A.classList.remove(y)}),s.current=w):s.current=null,c.current||f||i)return;const b=v instanceof HTMLElement?p_(v):[],_=p_(t.current);if(_?.every(E=>E instanceof HTMLElement)&&b&&b.every(E=>E instanceof HTMLElement)){c.current=!0,t.current.style.isolation="isolate";const E=pse(t.current);E&&(E.style.zIndex="1"),_.forEach((M,T)=>{const R=b[T];if(!R)return;M.style.position="relative",M.style.overflow="hidden";const A=m_(M);A&&A.classList.add(p);const P=g_(M);P&&P.classList.add(y);const k=()=>{c.current=!1,t.current&&(t.current.style.isolation=""),E&&(E.style.zIndex=""),A&&A.classList.remove(p),P&&P.classList.remove(y),M.style.position="",M.style.overflow="",M.contains(R)&&M.removeChild(R)};R.style.pointerEvents="none",R.style.position="absolute",R.style.overflow="hidden",R.setAttribute("aria-hidden","true");const N=mse(R);N&&(N.style.opacity="0");const j=m_(R);j&&(j.classList.add(h?n[na.caption_before_exit]:n[na.caption_after_exit]),j.addEventListener("animationend",k));const L=g_(R);L&&L.classList.add(h?n[na.weeks_before_exit]:n[na.weeks_after_exit]),M.insertBefore(R,M.firstChild)})}})}function yse(t,e,n,r){const i=t[0],a=t[t.length-1],{ISOWeek:s,fixedWeeks:o,broadcastCalendar:c}=n??{},{addDays:u,differenceInCalendarDays:f,differenceInCalendarMonths:h,endOfBroadcastWeek:p,endOfISOWeek:y,endOfMonth:v,endOfWeek:w,isAfter:b,startOfBroadcastWeek:_,startOfISOWeek:E,startOfWeek:M}=r,T=c?_(i,r):s?E(i):M(i),R=c?p(a):s?y(v(a)):w(v(a)),A=e&&(c?p(e):s?y(e):w(e)),P=A&&b(R,A)?A:R,k=f(P,T),N=h(a,i)+1,j=[];for(let U=0;U<=k;U++){const V=u(T,U);j.push(V)}const z=(c?35:42)*N;if(o&&j.length<z){const U=z-j.length;for(let V=0;V<U;V++){const W=u(j[j.length-1],1);j.push(W)}}return j}function vse(t){const e=[];return t.reduce((n,r)=>{const i=r.weeks.reduce((a,s)=>a.concat(s.days.slice()),e.slice());return n.concat(i.slice())},e.slice())}function xse(t,e,n,r){const{numberOfMonths:i=1}=n,a=[];for(let s=0;s<i;s++){const o=r.addMonths(t,s);if(e&&o>e)break;a.push(o)}return a}function _P(t,e,n,r){const{month:i,defaultMonth:a,today:s=r.today(),numberOfMonths:o=1}=t;let c=i||a||s;const{differenceInCalendarMonths:u,addMonths:f,startOfMonth:h}=r;if(n&&u(n,c)<o-1){const p=-1*(o-1);c=f(n,p)}return e&&u(c,e)<0&&(c=e),h(c)}function bse(t,e,n,r){const{addDays:i,endOfBroadcastWeek:a,endOfISOWeek:s,endOfMonth:o,endOfWeek:c,getISOWeek:u,getWeek:f,startOfBroadcastWeek:h,startOfISOWeek:p,startOfWeek:y}=r,v=t.reduce((w,b)=>{const _=n.broadcastCalendar?h(b,r):n.ISOWeek?p(b):y(b),E=n.broadcastCalendar?a(b):n.ISOWeek?s(o(b)):c(o(b)),M=e.filter(P=>P>=_&&P<=E),T=n.broadcastCalendar?35:42;if(n.fixedWeeks&&M.length<T){const P=e.filter(k=>{const N=T-M.length;return k>E&&k<=i(E,N)});M.push(...P)}const R=M.reduce((P,k)=>{const N=n.ISOWeek?u(k):f(k),j=P.find(z=>z.weekNumber===N),L=new l5(k,b,r);return j?j.days.push(L):P.push(new mae(N,[L])),P},[]),A=new pae(b,R);return w.push(A),w},[]);return n.reverseMonths?v.reverse():v}function _se(t,e){let{startMonth:n,endMonth:r}=t;const{startOfYear:i,startOfDay:a,startOfMonth:s,endOfMonth:o,addYears:c,endOfYear:u,newDate:f,today:h}=e,{fromYear:p,toYear:y,fromMonth:v,toMonth:w}=t;!n&&v&&(n=v),!n&&p&&(n=e.newDate(p,0,1)),!r&&w&&(r=w),!r&&y&&(r=f(y,11,31));const b=t.captionLayout==="dropdown"||t.captionLayout==="dropdown-years";return n?n=s(n):p?n=f(p,0,1):!n&&b&&(n=i(c(t.today??h(),-100))),r?r=o(r):y?r=f(y,11,31):!r&&b&&(r=u(t.today??h())),[n&&a(n),r&&a(r)]}function wse(t,e,n,r){if(n.disableNavigation)return;const{pagedNavigation:i,numberOfMonths:a=1}=n,{startOfMonth:s,addMonths:o,differenceInCalendarMonths:c}=r,u=i?a:1,f=s(t);if(!e)return o(f,u);if(!(c(e,t)<a))return o(f,u)}function Sse(t,e,n,r){if(n.disableNavigation)return;const{pagedNavigation:i,numberOfMonths:a}=n,{startOfMonth:s,addMonths:o,differenceInCalendarMonths:c}=r,u=i?a??1:1,f=s(t);if(!e)return o(f,-u);if(!(c(f,e)<=0))return o(f,-u)}function kse(t){const e=[];return t.reduce((n,r)=>n.concat(r.weeks.slice()),e.slice())}function cv(t,e){const[n,r]=x.useState(t);return[e===void 0?n:e,r]}function Ese(t,e){const[n,r]=_se(t,e),{startOfMonth:i,endOfMonth:a}=e,s=_P(t,n,r,e),[o,c]=cv(s,t.month?s:void 0);x.useEffect(()=>{const T=_P(t,n,r,e);c(T)},[t.timeZone]);const{months:u,weeks:f,days:h,previousMonth:p,nextMonth:y}=x.useMemo(()=>{const T=xse(o,r,{numberOfMonths:t.numberOfMonths},e),R=yse(T,t.endMonth?a(t.endMonth):void 0,{ISOWeek:t.ISOWeek,fixedWeeks:t.fixedWeeks,broadcastCalendar:t.broadcastCalendar},e),A=bse(T,R,{broadcastCalendar:t.broadcastCalendar,fixedWeeks:t.fixedWeeks,ISOWeek:t.ISOWeek,reverseMonths:t.reverseMonths},e),P=kse(A),k=vse(A),N=Sse(o,n,t,e),j=wse(o,r,t,e);return{months:A,weeks:P,days:k,previousMonth:N,nextMonth:j}},[e,o.getTime(),r?.getTime(),n?.getTime(),t.disableNavigation,t.broadcastCalendar,t.endMonth?.getTime(),t.fixedWeeks,t.ISOWeek,t.numberOfMonths,t.pagedNavigation,t.reverseMonths]),{disableNavigation:v,onMonthChange:w}=t,b=T=>f.some(R=>R.days.some(A=>A.isEqualTo(T))),_=T=>{if(v)return;let R=i(T);n&&R<i(n)&&(R=i(n)),r&&R>i(r)&&(R=i(r)),c(R),w?.(R)};return{months:u,weeks:f,days:h,navStart:n,navEnd:r,previousMonth:p,nextMonth:y,goToMonth:_,goToDay:T=>{b(T)||_(T.date)}}}var Ss;(function(t){t[t.Today=0]="Today",t[t.Selected=1]="Selected",t[t.LastFocused=2]="LastFocused",t[t.FocusedModifier=3]="FocusedModifier"})(Ss||(Ss={}));function wP(t){return!t[dr.disabled]&&!t[dr.hidden]&&!t[dr.outside]}function Mse(t,e,n,r){let i,a=-1;for(const s of t){const o=e(s);wP(o)&&(o[dr.focused]&&a<Ss.FocusedModifier?(i=s,a=Ss.FocusedModifier):r?.isEqualTo(s)&&a<Ss.LastFocused?(i=s,a=Ss.LastFocused):n(s.date)&&a<Ss.Selected?(i=s,a=Ss.Selected):o[dr.today]&&a<Ss.Today&&(i=s,a=Ss.Today))}return i||(i=t.find(s=>wP(e(s)))),i}function Tse(t,e,n,r,i,a,s){const{ISOWeek:o,broadcastCalendar:c}=a,{addDays:u,addMonths:f,addWeeks:h,addYears:p,endOfBroadcastWeek:y,endOfISOWeek:v,endOfWeek:w,max:b,min:_,startOfBroadcastWeek:E,startOfISOWeek:M,startOfWeek:T}=s;let A={day:u,week:h,month:f,year:p,startOfWeek:P=>c?E(P,s):o?M(P):T(P),endOfWeek:P=>c?y(P):o?v(P):w(P)}[t](n,e==="after"?1:-1);return e==="before"&&r?A=b([r,A]):e==="after"&&i&&(A=_([i,A])),A}function S5(t,e,n,r,i,a,s,o=0){if(o>365)return;const c=Tse(t,e,n.date,r,i,a,s),u=!!(a.disabled&&wo(c,a.disabled,s)),f=!!(a.hidden&&wo(c,a.hidden,s)),h=c,p=new l5(c,h,s);return!u&&!f?p:S5(t,e,p,r,i,a,s,o+1)}function Cse(t,e,n,r,i){const{autoFocus:a}=t,[s,o]=x.useState(),c=Mse(e.days,n,r||(()=>!1),s),[u,f]=x.useState(a?c:void 0);return{isFocusTarget:w=>!!c?.isEqualTo(w),setFocused:f,focused:u,blur:()=>{o(u),f(void 0)},moveFocus:(w,b)=>{if(!u)return;const _=S5(w,b,u,e.navStart,e.navEnd,t,i);_&&(t.disableNavigation&&!e.days.some(M=>M.isEqualTo(_))||(e.goToDay(_),f(_)))}}}function Ase(t,e){const{selected:n,required:r,onSelect:i}=t,[a,s]=cv(n,i?n:void 0),o=i?n:a,{isSameDay:c}=e,u=y=>o?.some(v=>c(v,y))??!1,{min:f,max:h}=t;return{selected:o,select:(y,v,w)=>{let b=[...o??[]];if(u(y)){if(o?.length===f||r&&o?.length===1)return;b=o?.filter(_=>!c(_,y))}else o?.length===h?b=[y]:b=[...b,y];return i||s(b),i?.(b,y,v,w),b},isSelected:u}}function Rse(t,e,n=0,r=0,i=!1,a=Zs){const{from:s,to:o}=e||{},{isSameDay:c,isAfter:u,isBefore:f}=a;let h;if(!s&&!o)h={from:t,to:n>0?void 0:t};else if(s&&!o)c(s,t)?n===0?h={from:s,to:t}:i?h={from:s,to:void 0}:h=void 0:f(t,s)?h={from:t,to:s}:h={from:s,to:t};else if(s&&o)if(c(s,t)&&c(o,t))i?h={from:s,to:o}:h=void 0;else if(c(s,t))h={from:s,to:n>0?void 0:t};else if(c(o,t))h={from:t,to:n>0?void 0:t};else if(f(t,s))h={from:t,to:o};else if(u(t,s))h={from:s,to:t};else if(u(t,o))h={from:s,to:t};else throw new Error("Invalid range");if(h?.from&&h?.to){const p=a.differenceInCalendarDays(h.to,h.from);r>0&&p>r?h={from:t,to:void 0}:n>1&&p<n&&(h={from:t,to:void 0})}return h}function Pse(t,e,n=Zs){const r=Array.isArray(e)?e:[e];let i=t.from;const a=n.differenceInCalendarDays(t.to,t.from),s=Math.min(a,6);for(let o=0;o<=s;o++){if(r.includes(i.getDay()))return!0;i=n.addDays(i,1)}return!1}function SP(t,e,n=Zs){return _o(t,e.from,!1,n)||_o(t,e.to,!1,n)||_o(e,t.from,!1,n)||_o(e,t.to,!1,n)}function Nse(t,e,n=Zs){const r=Array.isArray(e)?e:[e];if(r.filter(o=>typeof o!="function").some(o=>typeof o=="boolean"?o:n.isDate(o)?_o(t,o,!1,n):d5(o,n)?o.some(c=>_o(t,c,!1,n)):lv(o)?o.from&&o.to?SP(t,{from:o.from,to:o.to},n):!1:u5(o)?Pse(t,o.dayOfWeek,n):jE(o)?n.isAfter(o.before,o.after)?SP(t,{from:n.addDays(o.after,1),to:n.addDays(o.before,-1)},n):wo(t.from,o,n)||wo(t.to,o,n):BE(o)||zE(o)?wo(t.from,o,n)||wo(t.to,o,n):!1))return!0;const s=r.filter(o=>typeof o=="function");if(s.length){let o=t.from;const c=n.differenceInCalendarDays(t.to,t.from);for(let u=0;u<=c;u++){if(s.some(f=>f(o)))return!0;o=n.addDays(o,1)}}return!1}function Dse(t,e){const{disabled:n,excludeDisabled:r,resetOnSelect:i,selected:a,required:s,onSelect:o}=t,[c,u]=cv(a,o?a:void 0),f=o?a:c;return{selected:f,select:(y,v,w)=>{const{min:b,max:_}=t;let E;if(y){const M=f?.from,T=f?.to,R=!!M&&!!T,A=!!M&&!!T&&e.isSameDay(M,T)&&e.isSameDay(y,M);i&&(R||!f?.from)?!s&&A?E=void 0:E={from:y,to:void 0}:E=Rse(y,f,b,_,s,e)}return r&&n&&E?.from&&E.to&&Nse({from:E.from,to:E.to},n,e)&&(E.from=y,E.to=void 0),o||u(E),o?.(E,y,v,w),E},isSelected:y=>f&&_o(f,y,!1,e)}}function Lse(t,e){const{selected:n,required:r,onSelect:i}=t,[a,s]=cv(n,i?n:void 0),o=i?n:a,{isSameDay:c}=e;return{selected:o,select:(h,p,y)=>{let v=h;return!r&&o&&o&&c(h,o)&&(v=void 0),i||s(v),i?.(v,h,p,y),v},isSelected:h=>o?c(o,h):!1}}function Ise(t,e){const n=Lse(t,e),r=Ase(t,e),i=Dse(t,e);switch(t.mode){case"single":return n;case"multiple":return r;case"range":return i;default:return}}function ba(t,e){return t instanceof mi&&t.timeZone===e?t:new mi(t,e)}function Ku(t,e,n){return ba(t,e)}function kP(t,e,n){return typeof t=="boolean"||typeof t=="function"?t:t instanceof Date?Ku(t,e):Array.isArray(t)?t.map(r=>r instanceof Date?Ku(r,e):r):lv(t)?{...t,from:t.from?ba(t.from,e):t.from,to:t.to?ba(t.to,e):t.to}:jE(t)?{before:Ku(t.before,e),after:Ku(t.after,e)}:BE(t)?{after:Ku(t.after,e)}:zE(t)?{before:Ku(t.before,e)}:t}function y_(t,e,n){return t&&(Array.isArray(t)?t.map(r=>kP(r,e)):kP(t,e))}function Ose(t){let e=t;const n=e.timeZone;if(n&&(e={...t,timeZone:n},e.today&&(e.today=ba(e.today,n)),e.month&&(e.month=ba(e.month,n)),e.defaultMonth&&(e.defaultMonth=ba(e.defaultMonth,n)),e.startMonth&&(e.startMonth=ba(e.startMonth,n)),e.endMonth&&(e.endMonth=ba(e.endMonth,n)),e.mode==="single"&&e.selected?e.selected=ba(e.selected,n):e.mode==="multiple"&&e.selected?e.selected=e.selected?.map(ne=>ba(ne,n)):e.mode==="range"&&e.selected&&(e.selected={from:e.selected.from?ba(e.selected.from,n):e.selected.from,to:e.selected.to?ba(e.selected.to,n):e.selected.to}),e.disabled!==void 0&&(e.disabled=y_(e.disabled,n)),e.hidden!==void 0&&(e.hidden=y_(e.hidden,n)),e.modifiers)){const ne={};Object.keys(e.modifiers).forEach(Be=>{ne[Be]=y_(e.modifiers?.[Be],n)}),e.modifiers=ne}const{components:r,formatters:i,labels:a,dateLib:s,locale:o,classNames:c}=x.useMemo(()=>{const ne={...o5,...e.locale},Be=e.broadcastCalendar?1:e.weekStartsOn,ke=e.noonSafe&&e.timeZone?fse(e.timeZone,{weekStartsOn:Be,locale:ne}):void 0,Ae=e.dateLib&&ke?{...ke,...e.dateLib}:e.dateLib??ke,Ve=new ua({locale:ne,weekStartsOn:Be,firstWeekContainsDate:e.firstWeekContainsDate,useAdditionalWeekYearTokens:e.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:e.useAdditionalDayOfYearTokens,timeZone:e.timeZone,numerals:e.numerals},Ae);return{dateLib:Ve,components:Gae(e.components),formatters:nse(e.formatters),labels:ose(e.labels,Ve.options),locale:ne,classNames:{...Yae(),...e.classNames}}},[e.locale,e.broadcastCalendar,e.weekStartsOn,e.firstWeekContainsDate,e.useAdditionalWeekYearTokens,e.useAdditionalDayOfYearTokens,e.timeZone,e.numerals,e.dateLib,e.noonSafe,e.components,e.formatters,e.labels,e.classNames]);e.today||(e={...e,today:s.today()});const{captionLayout:u,mode:f,navLayout:h,numberOfMonths:p=1,onDayBlur:y,onDayClick:v,onDayFocus:w,onDayKeyDown:b,onDayMouseEnter:_,onDayMouseLeave:E,onNextClick:M,onPrevClick:T,showWeekNumber:R,styles:A}=e,{formatCaption:P,formatDay:k,formatMonthDropdown:N,formatWeekNumber:j,formatWeekNumberHeader:L,formatWeekdayName:z,formatYearDropdown:U}=i,V=Ese(e,s),{days:W,months:K,navStart:Q,navEnd:O,previousMonth:G,nextMonth:Y,goToMonth:H}=V,te=Hae(W,e,Q,O,s),{isSelected:re,select:ue,selected:ce}=Ise(e,s)??{},{blur:ee,focused:le,isFocusTarget:ve,moveFocus:Pe,setFocused:be}=Cse(e,V,te,re??(()=>!1),s),{labelDayButton:Ye,labelGridcell:he,labelGrid:Ue,labelMonthDropdown:je,labelNav:et,labelPrevious:_e,labelNext:oe,labelWeekday:J,labelWeekNumber:ze,labelWeekNumberHeader:Ne,labelYearDropdown:De}=a,Le=x.useMemo(()=>use(s,e.ISOWeek,e.broadcastCalendar,e.today),[s,e.ISOWeek,e.broadcastCalendar,e.today]),$=f!==void 0||v!==void 0,I=x.useCallback(()=>{G&&(H(G),T?.(G))},[G,H,T]),Z=x.useCallback(()=>{Y&&(H(Y),M?.(Y))},[H,Y,M]),pe=x.useCallback((ne,Be)=>ke=>{ke.preventDefault(),ke.stopPropagation(),be(ne),!Be.disabled&&(ue?.(ne.date,Be,ke),v?.(ne.date,Be,ke))},[ue,v,be]),Se=x.useCallback((ne,Be)=>ke=>{be(ne),w?.(ne.date,Be,ke)},[w,be]),xe=x.useCallback((ne,Be)=>ke=>{ee(),y?.(ne.date,Be,ke)},[ee,y]),Ie=x.useCallback((ne,Be)=>ke=>{const Ae={ArrowLeft:[ke.shiftKey?"month":"day",e.dir==="rtl"?"after":"before"],ArrowRight:[ke.shiftKey?"month":"day",e.dir==="rtl"?"before":"after"],ArrowDown:[ke.shiftKey?"year":"week","after"],ArrowUp:[ke.shiftKey?"year":"week","before"],PageUp:[ke.shiftKey?"year":"month","before"],PageDown:[ke.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(Ae[ke.key]){ke.preventDefault(),ke.stopPropagation();const[Ve,ge]=Ae[ke.key];Pe(Ve,ge)}b?.(ne.date,Be,ke)},[Pe,b,e.dir]),He=x.useCallback((ne,Be)=>ke=>{_?.(ne.date,Be,ke)},[_]),qe=x.useCallback((ne,Be)=>ke=>{E?.(ne.date,Be,ke)},[E]),ft=x.useCallback(ne=>Be=>{const ke=Number(Be.target.value),Ae=s.setMonth(s.startOfMonth(ne),ke);H(Ae)},[s,H]),We=x.useCallback(ne=>Be=>{const ke=Number(Be.target.value),Ae=s.setYear(s.startOfMonth(ne),ke);H(Ae)},[s,H]),{className:Xe,style:nt}=x.useMemo(()=>({className:[c[Zt.Root],e.className].filter(Boolean).join(" "),style:{...A?.[Zt.Root],...e.style}}),[c,e.className,e.style,A]),ct=$ae(e),Ke=x.useRef(null);gse(Ke,!!e.animate,{classNames:c,months:K,focused:le,dateLib:s});const gt={dayPickerProps:e,selected:ce,select:ue,isSelected:re,months:K,nextMonth:Y,previousMonth:G,goToMonth:H,getModifiers:te,components:r,classNames:c,styles:A,labels:a,formatters:i};return ot.createElement(c5.Provider,{value:gt},ot.createElement(r.Root,{rootRef:e.animate?Ke:void 0,className:Xe,style:nt,dir:e.dir,id:e.id,lang:e.lang??o.code,nonce:e.nonce,title:e.title,role:e.role,"aria-label":e["aria-label"],"aria-labelledby":e["aria-labelledby"],...ct},ot.createElement(r.Months,{className:c[Zt.Months],style:A?.[Zt.Months]},!e.hideNavigation&&!h&&ot.createElement(r.Nav,{"data-animated-nav":e.animate?"true":void 0,className:c[Zt.Nav],style:A?.[Zt.Nav],"aria-label":et(),onPreviousClick:I,onNextClick:Z,previousMonth:G,nextMonth:Y}),K.map((ne,Be)=>ot.createElement(r.Month,{"data-animated-month":e.animate?"true":void 0,className:c[Zt.Month],style:A?.[Zt.Month],key:Be,displayIndex:Be,calendarMonth:ne},h==="around"&&!e.hideNavigation&&Be===0&&ot.createElement(r.PreviousMonthButton,{type:"button",className:c[Zt.PreviousMonthButton],tabIndex:G?void 0:-1,"aria-disabled":G?void 0:!0,"aria-label":_e(G),onClick:I,"data-animated-button":e.animate?"true":void 0},ot.createElement(r.Chevron,{disabled:G?void 0:!0,className:c[Zt.Chevron],orientation:e.dir==="rtl"?"right":"left"})),ot.createElement(r.MonthCaption,{"data-animated-caption":e.animate?"true":void 0,className:c[Zt.MonthCaption],style:A?.[Zt.MonthCaption],calendarMonth:ne,displayIndex:Be},u?.startsWith("dropdown")?ot.createElement(r.DropdownNav,{className:c[Zt.Dropdowns],style:A?.[Zt.Dropdowns]},(()=>{const ke=u==="dropdown"||u==="dropdown-months"?ot.createElement(r.MonthsDropdown,{key:"month",className:c[Zt.MonthsDropdown],"aria-label":je(),classNames:c,components:r,disabled:!!e.disableNavigation,onChange:ft(ne.date),options:lse(ne.date,Q,O,i,s),style:A?.[Zt.Dropdown],value:s.getMonth(ne.date)}):ot.createElement("span",{key:"month"},N(ne.date,s)),Ae=u==="dropdown"||u==="dropdown-years"?ot.createElement(r.YearsDropdown,{key:"year",className:c[Zt.YearsDropdown],"aria-label":De(s.options),classNames:c,components:r,disabled:!!e.disableNavigation,onChange:We(ne.date),options:dse(Q,O,i,s,!!e.reverseYears),style:A?.[Zt.Dropdown],value:s.getYear(ne.date)}):ot.createElement("span",{key:"year"},U(ne.date,s));return s.getMonthYearOrder()==="year-first"?[Ae,ke]:[ke,Ae]})(),ot.createElement("span",{role:"status","aria-live":"polite",style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}},P(ne.date,s.options,s))):ot.createElement(r.CaptionLabel,{className:c[Zt.CaptionLabel],role:"status","aria-live":"polite"},P(ne.date,s.options,s))),h==="around"&&!e.hideNavigation&&Be===p-1&&ot.createElement(r.NextMonthButton,{type:"button",className:c[Zt.NextMonthButton],tabIndex:Y?void 0:-1,"aria-disabled":Y?void 0:!0,"aria-label":oe(Y),onClick:Z,"data-animated-button":e.animate?"true":void 0},ot.createElement(r.Chevron,{disabled:Y?void 0:!0,className:c[Zt.Chevron],orientation:e.dir==="rtl"?"left":"right"})),Be===p-1&&h==="after"&&!e.hideNavigation&&ot.createElement(r.Nav,{"data-animated-nav":e.animate?"true":void 0,className:c[Zt.Nav],style:A?.[Zt.Nav],"aria-label":et(),onPreviousClick:I,onNextClick:Z,previousMonth:G,nextMonth:Y}),ot.createElement(r.MonthGrid,{role:"grid","aria-multiselectable":f==="multiple"||f==="range","aria-label":Ue(ne.date,s.options,s)||void 0,className:c[Zt.MonthGrid],style:A?.[Zt.MonthGrid]},!e.hideWeekdays&&ot.createElement(r.Weekdays,{"data-animated-weekdays":e.animate?"true":void 0,className:c[Zt.Weekdays],style:A?.[Zt.Weekdays]},R&&ot.createElement(r.WeekNumberHeader,{"aria-label":Ne(s.options),className:c[Zt.WeekNumberHeader],style:A?.[Zt.WeekNumberHeader],scope:"col"},L()),Le.map(ke=>ot.createElement(r.Weekday,{"aria-label":J(ke,s.options,s),className:c[Zt.Weekday],key:String(ke),style:A?.[Zt.Weekday],scope:"col"},z(ke,s.options,s)))),ot.createElement(r.Weeks,{"data-animated-weeks":e.animate?"true":void 0,className:c[Zt.Weeks],style:A?.[Zt.Weeks]},ne.weeks.map(ke=>ot.createElement(r.Week,{className:c[Zt.Week],key:ke.weekNumber,style:A?.[Zt.Week],week:ke},R&&ot.createElement(r.WeekNumber,{week:ke,style:A?.[Zt.WeekNumber],"aria-label":ze(ke.weekNumber,{locale:o}),className:c[Zt.WeekNumber],scope:"row",role:"rowheader"},j(ke.weekNumber,s)),ke.days.map(Ae=>{const{date:Ve}=Ae,ge=te(Ae);if(ge[dr.focused]=!ge.hidden&&!!le?.isEqualTo(Ae),ge[Qa.selected]=re?.(Ve)||ge.selected,lv(ce)){const{from:Bt,to:St}=ce;ge[Qa.range_start]=!!(Bt&&St&&s.isSameDay(Ve,Bt)),ge[Qa.range_end]=!!(Bt&&St&&s.isSameDay(Ve,St)),ge[Qa.range_middle]=_o(ce,Ve,!0,s)}const ht=cse(ge,A,e.modifiersStyles),bt=Wae(ge,c,e.modifiersClassNames),Kt=!$&&!ge.hidden?he(Ve,ge,s.options,s):void 0;return ot.createElement(r.Day,{key:`${Ae.isoDate}_${Ae.displayMonthId}`,day:Ae,modifiers:ge,className:bt.join(" "),style:ht,role:"gridcell","aria-selected":ge.selected||void 0,"aria-label":Kt,"data-day":Ae.isoDate,"data-month":Ae.outside?Ae.dateMonthId:void 0,"data-selected":ge.selected||void 0,"data-disabled":ge.disabled||void 0,"data-hidden":ge.hidden||void 0,"data-outside":Ae.outside||void 0,"data-focused":ge.focused||void 0,"data-today":ge.today||void 0},!ge.hidden&&$?ot.createElement(r.DayButton,{className:c[Zt.DayButton],style:A?.[Zt.DayButton],type:"button",day:Ae,modifiers:ge,disabled:!ge.focused&&ge.disabled||void 0,"aria-disabled":ge.focused&&ge.disabled||void 0,tabIndex:ve(Ae)?0:-1,"aria-label":Ye(Ve,ge,s.options,s),onClick:pe(Ae,ge),onBlur:xe(Ae,ge),onFocus:Se(Ae,ge),onKeyDown:Ie(Ae,ge),onMouseEnter:He(Ae,ge),onMouseLeave:qe(Ae,ge)},k(Ve,s.options,s)):!ge.hidden&&k(Ae.date,s.options,s))})))))))),e.footer&&ot.createElement(r.Footer,{className:c[Zt.Footer],style:A?.[Zt.Footer],role:"status","aria-live":"polite"},e.footer)))}function EP(t){if(!t)return"";const e=t.split("-");if(e.length!==3)return t;const n=new Date(Number(e[0]),Number(e[1])-1,Number(e[2]));return Number.isFinite(n.getTime())?Rs(n,"MMM d"):t}function Fse({from:t,to:e,onApply:n,onCancel:r}){const i=x.useMemo(()=>{const u={from:void 0,to:void 0};if(t){const f=t.split("-");u.from=new Date(Number(f[0]),Number(f[1])-1,Number(f[2]))}if(e){const f=e.split("-");u.to=new Date(Number(f[0]),Number(f[1])-1,Number(f[2]))}return u},[t,e]),[a,s]=x.useState(i),o=()=>{if(!a?.from)return;const u=Rs(a.from,"yyyy-MM-dd"),f=a.to?Rs(a.to,"yyyy-MM-dd"):u;n?.(u,f)},c=!!a?.from;return m.jsxs("div",{className:"p-4",children:[m.jsx(Ose,{mode:"range",selected:a,onSelect:s,numberOfMonths:2,showOutsideDays:!1,classNames:{root:"rdp-oai",months:"flex gap-4",month:"space-y-3",month_caption:"flex justify-center items-center h-8",caption_label:"text-sm font-medium text-oai-black dark:text-oai-white",nav:"flex items-center justify-between absolute inset-x-0 top-0 px-2",button_previous:"inline-flex items-center justify-center w-7 h-7 rounded-md text-oai-gray-500 hover:text-oai-black dark:text-oai-gray-400 dark:hover:text-oai-white hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors",button_next:"inline-flex items-center justify-center w-7 h-7 rounded-md text-oai-gray-500 hover:text-oai-black dark:text-oai-gray-400 dark:hover:text-oai-white hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors",chevron:"w-4 h-4",month_grid:"border-collapse",weekdays:"flex",weekday:"w-9 text-center text-xs font-medium text-oai-gray-400 dark:text-oai-gray-500 py-1",week:"flex",day:"w-9 h-9 text-center text-sm p-0 relative",day_button:"w-full h-full inline-flex items-center justify-center rounded-md transition-colors hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 text-oai-black dark:text-oai-white cursor-pointer rdp-day-btn",today:"font-bold",selected:"rdp-selected",range_start:"rdp-selected rdp-range-start",range_end:"rdp-selected rdp-range-end",range_middle:"rdp-range-mid",outside:"text-oai-gray-300 dark:text-oai-gray-600",disabled:"text-oai-gray-300 dark:text-oai-gray-600 cursor-not-allowed",hidden:"invisible"},styles:{months:{position:"relative"}}}),m.jsxs("div",{className:"flex items-center justify-end gap-2 mt-4 pt-3 border-t border-oai-gray-200 dark:border-oai-gray-700",children:[c&&a.from&&m.jsxs("span",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 mr-auto",children:[Rs(a.from,"MMM d, yyyy"),a.to&&a.to.getTime()!==a.from.getTime()?` — ${Rs(a.to,"MMM d, yyyy")}`:""]}),m.jsx(Ui,{variant:"secondary",size:"sm",onClick:r,children:"Cancel"}),m.jsx(Ui,{variant:"primary",size:"sm",onClick:o,disabled:!c,children:"Apply"})]})]})}function Use({size:t=16,className:e=""}){return m.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:e,children:m.jsx("path",{d:"M4.709 15.955l4.72-2.647.08-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0 11.784l.055-.352.48-.321.686.06 1.52.103 2.278.158 1.652.097 2.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686 1.908 1.476 2.491 1.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97 2.97 0 01-.104-.729L6.283.134 6.696 0l.996.134.42.364.62 1.414 1.002 2.229 1.555 3.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.376-.91.747-.492.584.28.48.685-.067.444-.286 1.851-.559 2.903-.364 1.942h.212l.243-.242.985-1.306 1.652-2.064.73-.82.85-.904.547-.431h1.033l.76 1.129-.34 1.166-1.064 1.347-.881 1.142-1.264 1.7-.79 1.36.073.11.188-.02 2.856-.606 1.543-.28 1.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.049.061 1.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093 1.068 2.006 1.81 2.509 2.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649 2.345 3.521.122 1.08-.17.353-.608.213-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674 7.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434 1.967-2.18 2.945-1.726 1.845-.414.164-.717-.37.067-.662.401-.589 2.388-3.036 1.44-1.882.93-1.086-.006-.158h-.055L4.132 18.56l-1.13.146-.487-.456.061-.746.231-.243 1.908-1.312-.006.006z"})})}function jse({size:t=16,className:e=""}){return m.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",className:e,children:m.jsx("path",{d:"M8.086.457a6.105 6.105 0 013.046-.415c1.333.153 2.521.72 3.564 1.7a.117.117 0 00.107.029c1.408-.346 2.762-.224 4.061.366l.063.03.154.076c1.357.703 2.33 1.77 2.918 3.198.278.679.418 1.388.421 2.126a5.655 5.655 0 01-.18 1.631.167.167 0 00.04.155 5.982 5.982 0 011.578 2.891c.385 1.901-.01 3.615-1.183 5.14l-.182.22a6.063 6.063 0 01-2.934 1.851.162.162 0 00-.108.102c-.255.736-.511 1.364-.987 1.992-1.199 1.582-2.962 2.462-4.948 2.451-1.583-.008-2.986-.587-4.21-1.736a.145.145 0 00-.14-.032c-.518.167-1.04.191-1.604.185a5.924 5.924 0 01-2.595-.622 6.058 6.058 0 01-2.146-1.781c-.203-.269-.404-.522-.551-.821a7.74 7.74 0 01-.495-1.283 6.11 6.11 0 01-.017-3.064.166.166 0 00.008-.074.115.115 0 00-.037-.064 5.958 5.958 0 01-1.38-2.202 5.196 5.196 0 01-.333-1.589 6.915 6.915 0 01.188-2.132c.45-1.484 1.309-2.648 2.577-3.493.282-.188.55-.334.802-.438.286-.12.573-.22.861-.304a.129.129 0 00.087-.087A6.016 6.016 0 015.635 2.31C6.315 1.464 7.132.846 8.086.457zm-.804 7.85a.848.848 0 00-1.473.842l1.694 2.965-1.688 2.848a.849.849 0 001.46.864l1.94-3.272a.849.849 0 00.007-.854l-1.94-3.393zm5.446 6.24a.849.849 0 000 1.695h4.848a.849.849 0 000-1.696h-4.848z"})})}function Bse({size:t=16,className:e=""}){return m.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:e,children:m.jsx("path",{d:"M22.106 5.68L12.5.135a.998.998 0 00-.998 0L1.893 5.68a.84.84 0 00-.419.726v11.186c0 .3.16.577.42.727l9.607 5.547a.999.999 0 00.998 0l9.608-5.547a.84.84 0 00.42-.727V6.407a.84.84 0 00-.42-.726zm-.603 1.176L12.228 22.92c-.063.108-.228.064-.228-.061V12.34a.59.59 0 00-.295-.51l-9.11-5.26c-.107-.062-.063-.228.062-.228h18.55c.264 0 .428.286.296.514z"})})}function zse({size:t=16,className:e=""}){return m.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:e,children:m.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z"})})}function Vse({size:t=16,className:e=""}){return m.jsx("svg",{width:t,height:t,viewBox:"0 -1 22 28",fill:"currentColor",fillRule:"evenodd",className:e,children:m.jsx("path",{d:"M4.125 20.149c-2.69 5.959 3.036 7.453 7.26 3.966 1.24 3.91 5.898.993 7.569-2.036 3.682-6.678 2.195-13.49 1.813-14.895-2.617-9.582-15.699-9.592-17.95.049-.526 1.687-.535 3.606-.833 5.598-.15 1.005-.256 1.646-.645 2.703-.223.607-.53 1.147-1.014 2.056-.75 1.412-.434 4.138 3.434 2.724v.001ZM11.895 11.332c-1.073 0-1.234-1.283-1.234-2.048 0-.69.124-1.239.358-1.586a1 1 0 0 1 .876-.462c.375 0 .697.158.924.47.259.354.395.9.395 1.578 0 1.283-.493 2.048-1.319 2.048Zm4.416 0c-1.073 0-1.234-1.283-1.234-2.048 0-.69.124-1.239.358-1.586a1 1 0 0 1 .876-.462c.375 0 .697.158.924.47.259.354.396.9.396 1.578 0 1.283-.494 2.048-1.32 2.048Z"})})}function Hse({size:t=16,className:e=""}){return m.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:e,children:m.jsx("path",{d:"M16 6H8v12h8V6zm4 16H4V2h16v20z"})})}function Wse({size:t=16,className:e=""}){return m.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:e,children:[m.jsx("path",{d:"M21.846 0a1.923 1.923 0 110 3.846H20.15a.226.226 0 01-.227-.226V1.923C19.923.861 20.784 0 21.846 0z"}),m.jsx("path",{d:"M11.065 11.199l7.257-7.2c.137-.136.06-.41-.116-.41H14.3a.164.164 0 00-.117.051l-7.82 7.756c-.122.12-.302.013-.302-.179V3.82c0-.127-.083-.23-.185-.23H3.186c-.103 0-.186.103-.186.23V19.77c0 .128.083.23.186.23h2.69c.103 0 .186-.102.186-.23v-3.25c0-.069.025-.135.069-.178l2.424-2.406a.158.158 0 01.205-.023l6.484 4.772a7.677 7.677 0 003.453 1.283c.108.012.2-.095.2-.23v-3.06c0-.117-.07-.212-.164-.227a5.028 5.028 0 01-2.027-.807l-5.613-4.064c-.117-.078-.132-.279-.028-.381z"})]})}function Gse({size:t=16,className:e=""}){return m.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:e,children:m.jsx("path",{d:"M19.245 5.364c1.322 1.36 1.877 3.216 2.11 5.817.622 0 1.2.135 1.592.654l.73.964c.21.278.323.61.323.955v2.62c0 .339-.173.669-.453.868C20.239 19.602 16.157 21.5 12 21.5c-4.6 0-9.205-2.583-11.547-4.258-.28-.2-.452-.53-.453-.868v-2.62c0-.345.113-.679.321-.956l.73-.963c.392-.517.974-.654 1.593-.654l.029-.297c.25-2.446.81-4.213 2.082-5.52 2.461-2.54 5.71-2.851 7.146-2.864h.198c1.436.013 4.685.323 7.146 2.864zm-7.244 4.328c-.284 0-.613.016-.962.05-.123.447-.305.85-.57 1.108-1.05 1.023-2.316 1.18-2.994 1.18-.638 0-1.306-.13-1.851-.464-.516.165-1.012.403-1.044.996a65.882 65.882 0 00-.063 2.884l-.002.48c-.002.563-.005 1.126-.013 1.69.002.326.204.63.51.765 2.482 1.102 4.83 1.657 6.99 1.657 2.156 0 4.504-.555 6.985-1.657a.854.854 0 00.51-.766c.03-1.682.006-3.372-.076-5.053-.031-.596-.528-.83-1.046-.996-.546.333-1.212.464-1.85.464-.677 0-1.942-.157-2.993-1.18-.266-.258-.447-.661-.57-1.108-.32-.032-.64-.049-.96-.05zm-2.525 4.013c.539 0 .976.426.976.95v1.753c0 .525-.437.95-.976.95a.964.964 0 01-.976-.95v-1.752c0-.525.437-.951.976-.951zm5 0c.539 0 .976.426.976.95v1.753c0 .525-.437.95-.976.95a.964.964 0 01-.976-.95v-1.752c0-.525.437-.951.976-.951zM7.635 5.087c-1.05.102-1.935.438-2.385.906-.975 1.037-.765 3.668-.21 4.224.405.394 1.17.657 1.995.657h.09c.649-.013 1.785-.176 2.73-1.11.435-.41.705-1.433.675-2.47-.03-.834-.27-1.52-.63-1.813-.39-.336-1.275-.482-2.265-.394zm6.465.394c-.36.292-.6.98-.63 1.813-.03 1.037.24 2.06.675 2.47.968.957 2.136 1.104 2.776 1.11h.044c.825 0 1.59-.263 1.995-.657.555-.556.765-3.187-.21-4.224-.45-.468-1.335-.804-2.385-.906-.99-.088-1.875.058-2.265.394zM12 7.615c-.24 0-.525.015-.84.044.03.16.045.336.06.526l-.001.159a2.94 2.94 0 01-.014.25c.225-.022.425-.027.612-.028h.366c.187 0 .387.006.612.028-.015-.146-.015-.277-.015-.409.015-.19.03-.365.06-.526a9.29 9.29 0 00-.84-.044z"})})}function $se({size:t=16,className:e=""}){return m.jsxs("svg",{width:t,height:t,viewBox:"0 0 64 60",fill:"none",className:e,"aria-hidden":"true",children:[m.jsx("path",{fill:"currentColor",d:"M37.2114 3.75318C37.6821 3.33106 37.7106 3.31457 38.0558 3.29385C38.6149 3.2531 39.1272 3.52199 39.9989 4.31564C42.0356 6.16652 44.8714 9.97183 46.6346 13.2212L47.3163 14.4819L48.2782 14.9605C49.2072 15.4299 50.7308 16.3923 51.3672 16.9085C51.655 17.1464 51.6956 17.1508 51.9947 17.0344C53.3454 16.5084 55.2803 17.206 56.9869 18.8432C58.5231 20.3155 59.9943 22.8312 60.558 24.9308C60.6403 25.2687 60.7493 25.9952 60.7891 26.5362C60.9177 28.4358 60.3092 29.9532 59.1362 30.64C58.8965 30.7784 58.8801 30.8158 58.8868 31.4132C58.9409 34.2583 58.1741 37.0985 56.6335 39.8679C54.8946 42.9773 51.7981 46.1938 47.6074 49.2243C45.357 50.8619 40.0323 53.964 37.6248 55.0532C31.8578 57.6496 27.2346 58.646 23.2188 58.154C20.8236 57.8638 18.1124 56.9287 16.5082 55.8433C16.086 55.5515 16.0191 55.5329 15.6966 55.6251C13.9793 56.1185 11.73 55.1053 9.81931 52.9844C9.05725 52.1366 7.82714 50.0548 7.42839 48.9409C6.50606 46.3339 6.68976 43.9816 7.91836 42.5767C8.23573 42.2149 8.2453 42.1995 8.17598 41.5912C8.06148 40.5951 8.00971 39.1206 8.06202 38.1692L8.10361 37.2803L6.76977 34.9212C4.70378 31.2451 3.3912 28.1582 2.88489 25.7998C2.61762 24.5066 2.63385 23.9324 2.96214 23.5078C3.16198 23.2515 3.81796 22.9866 4.60785 22.8407C6.59665 22.4917 10.9334 22.8076 15.7581 23.6595L16.259 23.7458L17.3608 22.7713C19.1891 21.1519 20.4038 20.244 22.6429 18.8478C24.9768 17.3876 27.6108 16.1858 30.577 15.2346L31.5295 14.9294L32.0526 13.5561C33.9257 8.61146 35.8437 4.96584 37.2114 3.75318ZM21.5208 29.0919C19.404 30.314 18.3453 30.9251 17.5676 31.6099C14.4179 34.3835 13.2414 38.777 14.5823 42.7537C14.9135 43.7357 15.5247 44.7942 16.7469 46.9111C17.9691 49.0279 18.5801 50.0865 19.2649 50.8643C22.0385 54.014 26.4316 55.1918 30.4084 53.8509C31.3904 53.5198 32.4489 52.9085 34.5657 51.6863L46.7442 44.6551C48.8613 43.4328 49.9205 42.8214 50.6983 42.1365C53.8479 39.363 55.0245 34.9695 53.6835 30.9927C53.3524 30.0107 52.7412 28.9522 51.519 26.8354C50.2968 24.7185 49.6858 23.66 49.0009 22.8822C46.2274 19.7325 41.8342 18.5547 37.8575 19.8956C36.8754 20.2267 35.8163 20.8383 33.6993 22.0606L21.5208 29.0919Z"}),m.jsx("g",{transform:"rotate(-30 22.6953 37.6011)",children:m.jsx("rect",{x:"22.6953",y:"37.6011",width:"4.81084",height:"9.99175",rx:"2.40542",fill:"currentColor"})}),m.jsx("g",{transform:"rotate(-30 35.6748 30.1074)",children:m.jsx("rect",{x:"35.6748",y:"30.1074",width:"4.81084",height:"9.99175",rx:"2.40542",fill:"currentColor"})})]})}function Yse({size:t=16,className:e=""}){return m.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",className:e,children:m.jsx("path",{d:"M7 2h10a5 5 0 015 5v10a5 5 0 01-5 5H7a5 5 0 01-5-5V7a5 5 0 015-5zm0 4.5v11h2.35v-4.55h5.3V17.5H17v-11h-2.35v4.1h-5.3V6.5H7z"})})}function qse({size:t=16,className:e=""}){return m.jsx("svg",{width:t,height:t,viewBox:"0 0 16 16",fill:"currentColor",className:e,children:m.jsx("path",{d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8z"})})}function Xse({size:t=16,className:e=""}){return m.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",className:e,"aria-hidden":"true",children:[m.jsx("rect",{x:"2",y:"2",width:"20",height:"20",rx:"5",stroke:"currentColor",strokeWidth:"1.6"}),m.jsx("path",{d:"M7.2 16.8l4.4-4.4M14.5 9.5l1.8-1.8a1.4 1.4 0 0 1 2 2l-1.8 1.8M9 17.5l-1.5 1.5a1.06 1.06 0 0 1-1.5-1.5L7.5 16M11.6 12.4l3.5-3.5",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"}),m.jsx("circle",{cx:"17",cy:"13",r:"1.2",fill:"currentColor"})]})}function Kse({size:t=16,className:e=""}){return m.jsxs("svg",{width:t,height:t,viewBox:"0 0 120 90",fill:"currentColor",className:e,children:[m.jsx("rect",{x:"10",y:"8",width:"100",height:"12",rx:"2"}),m.jsx("rect",{x:"25",y:"20",width:"12",height:"62",rx:"2"}),m.jsx("rect",{x:"75",y:"20",width:"12",height:"45",rx:"2"}),m.jsx("rect",{x:"71",y:"55",width:"20",height:"16",rx:"3"}),m.jsx("rect",{x:"76",y:"71",width:"3",height:"8",rx:"1"}),m.jsx("rect",{x:"82",y:"71",width:"3",height:"8",rx:"1"})]})}const Zse={CLAUDE:Use,CODEBUDDY:$se,CODEX:jse,COPILOT:Gse,CRAFT:Xse,CURSOR:Bse,GEMINI:zse,GITHUB:qse,HERMES:Yse,KIMI:Wse,KIRO:Vse,OPENCODE:Hse,OMP:Kse},Jse={ANTIGRAVITY:"/brand-logos/antigravity.svg",CLAUDE:"/brand-logos/claude-code.svg",CODEX:"/brand-logos/codex.svg",GEMINI:"/brand-logos/gemini.svg",HERMES:"/brand-logos/hermes.svg",OPENCLAW:"/brand-logos/openclaw.svg",OPENCODE:"/brand-logos/opencode.svg"};function Qc({provider:t,size:e=16,color:n,className:r=""}){const i=t?.toUpperCase?.()||"",a=Jse[i];if(a)return m.jsx("img",{src:a,alt:"",width:e,height:e,className:r,style:{width:e,height:e,objectFit:"contain"},"aria-hidden":!0});const s=Zse[i];return s?m.jsx(s,{size:e,className:r}):m.jsx("div",{className:"rounded-full shrink-0",style:{width:e*.5,height:e*.5,backgroundColor:n}})}function MP(t){if(!Number.isFinite(Number(t)))return null;const e=Number(t);return e<=0?null:Iy(e,{decimals:1})}function TP(t){const e=Number(t);return!Number.isFinite(e)||e<=0?null:e<.01?"<$0.01":Oy(e.toFixed(2),{decimals:2})}function Qse(t){return Array.isArray(t)?t.map(e=>typeof e=="string"?{key:e,label:CP(e)}:{key:e.key,label:e.label||CP(e.key)}):[]}function eoe(t){if(typeof t!="string")return null;const e=t.replace(/,/g,"").match(/-?\d+(?:\.\d+)?/);if(!e)return null;const n=Number(e[0]);return Number.isFinite(n)?n:null}const toe={CODEX:"#10b981",CLAUDE:"#8b5cf6",OPENCODE:"#f59e0b",GEMINI:"#3b82f6",KIMI:"#a78bfa"};function v_(t,e){const n=t?.toUpperCase?.()||"";return toe[n]||`hsl(${150+e*40}, 60%, 45%)`}const noe={day:"usage.period.day",week:"usage.period.week",month:"usage.period.month",total:"usage.period.total",custom:"usage.period.custom"};function CP(t){const e=noe[t];return e?F(e):String(t).toUpperCase()}function roe({loading:t,onClick:e}){const n=ou();return m.jsx(Ui,{variant:"secondary",size:"sm",disabled:t,onClick:e,"aria-label":F("usage.button.refresh"),className:"w-8 p-0",children:m.jsx(fr.span,{"aria-hidden":"true",animate:t?{rotate:360}:{rotate:0},transition:t&&!n?{duration:1,repeat:1/0,ease:"linear"}:{duration:.3},style:{display:"inline-block"},children:"↻"})})}function ioe({period:t,periods:e,onPeriodChange:n,summaryValue:r,summaryLabel:i,summaryCostValue:a,onCostInfo:s,fleetData:o=[],onRefresh:c,loading:u,className:f="",customFrom:h,customTo:p,onCustomRangeApply:y,customRangeOpen:v,onCustomRangeOpenChange:w,onOpenShare:b}){const _=Qse(e),E=eoe(String(r??"")),M=E!=null,[T,R]=x.useState(null),{resolvedTheme:A}=Dp(),P=A==="dark",k=P?"rgba(10,10,10,0.98)":"rgba(255,255,255,0.96)",N=P?"rgba(10,10,10,0)":"rgba(255,255,255,0)",j=o.filter(L=>L.models?.length>0);return m.jsx(Rl,{delay:.2,children:m.jsxs(fu,{className:f,children:[m.jsxs("div",{className:"flex items-center justify-between gap-3 mb-6",children:[m.jsx("div",{role:"tablist","aria-label":F("usage.overview.tablist_aria"),className:"flex gap-1",children:_.map(L=>{const z=t===L.key,U=`text-xs font-medium px-3 py-1.5 rounded-md transition-colors ${z?"text-oai-black dark:text-oai-white bg-oai-gray-100 dark:bg-oai-gray-800":"text-oai-gray-500 dark:text-oai-gray-300 hover:text-oai-black dark:hover:text-oai-white hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800"}`;if(L.key==="custom"){const V=z&&h&&p?`${EP(h)} — ${EP(p)}`:L.label;return m.jsxs(zF,{open:v,onOpenChange:W=>{W?n?.("custom"):w?.(W)},children:[m.jsx(VF,{render:m.jsx("button",{role:"tab","aria-selected":z,type:"button",className:U}),children:V}),m.jsx(WF,{children:m.jsx($F,{sideOffset:8,side:"bottom",align:"start",className:"!z-[9999]",children:m.jsx(YF,{className:"bg-white dark:bg-oai-gray-900 border border-oai-gray-200 dark:border-oai-gray-700 rounded-xl shadow-lg",children:m.jsx(Fse,{from:h,to:p,onApply:y,onCancel:()=>w?.(!1)})})})})]},"custom")}return m.jsx("button",{role:"tab","aria-selected":z,type:"button",className:U,onClick:()=>n?.(L.key),children:L.label},L.key)})}),m.jsxs("div",{className:"flex items-center gap-1.5",children:[b?m.jsxs("button",{type:"button",onClick:b,"aria-label":F("share.button.aria"),className:"inline-flex items-center justify-center gap-1.5 h-8 px-3 text-xs font-medium rounded-md border border-oai-gray-300 dark:border-oai-gray-700 bg-oai-white dark:bg-oai-gray-900 text-oai-black dark:text-oai-white hover:border-oai-brand hover:text-oai-brand transition-colors duration-200",children:[m.jsx(rG,{className:"h-3.5 w-3.5",strokeWidth:2}),F("share.button.label")]}):null,c&&m.jsx(roe,{loading:u,onClick:c})]})]}),m.jsxs("div",{className:"text-center mb-8",children:[m.jsx("div",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wider mb-3",children:i}),m.jsx("div",{className:"text-6xl md:text-7xl font-bold text-oai-black dark:text-oai-white tracking-tight tabular-nums",children:M?m.jsx(Cre,{value:E,displayValue:r,fontSize:72,padding:6,gap:1,textColor:"var(--oai-black, #111827)",fontWeight:700,gradientHeight:P?0:8,gradientFrom:k,gradientTo:N,counterStyle:{paddingLeft:0,paddingRight:0,gap:0},digitStyle:{width:"0.88ch"}}):r}),a&&m.jsx("div",{className:"flex items-center justify-center gap-2 mt-4",children:s?m.jsxs("button",{type:"button",onClick:s,className:"inline-flex items-center gap-1.5 text-xl font-bold text-oai-brand hover:text-oai-brand-dark dark:hover:text-oai-brand-light transition-colors cursor-pointer","aria-label":F("usage.overview.cost_breakdown_aria"),children:[a,m.jsx(I7,{size:16,strokeWidth:2,className:"opacity-80"})]}):m.jsx("span",{className:"text-xl font-bold text-oai-brand",children:a})})]}),j.length>0&&m.jsxs("div",{className:"space-y-6",children:[m.jsx("div",{role:"img","aria-label":F("usage.overview.distribution_aria",{items:j.map(L=>F("usage.overview.distribution_item",{label:L.label,percent:L.totalPercent})).join(",")}),className:"h-1.5 w-full bg-oai-gray-100 dark:bg-oai-gray-800 rounded-full overflow-hidden flex",children:j.map((L,z)=>{const U=v_(L.label,z);return m.jsx(fr.div,{initial:{width:0},animate:{width:`${L.totalPercent}%`},transition:{duration:.6,delay:.3+z*.1},className:"h-full",style:{backgroundColor:U},title:`${L.label}: ${L.totalPercent}%`},L.label)})}),m.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 xl:grid-cols-5 gap-3",children:j.map((L,z)=>{const U=v_(L.label,z),V=T===L.label;return m.jsxs("button",{"aria-expanded":V,"aria-controls":`provider-details-${L.label}`,"aria-label":F("usage.overview.provider_card_aria",{provider:L.label,percent:L.totalPercent,tokens:MP(L.usage)||"0",cost:TP(L.usd)||"$0",action:F(V?"usage.overview.collapse":"usage.overview.expand")}),onClick:()=>R(V?null:L.label),className:`min-w-0 text-left p-3 rounded-lg border transition-colors duration-200 ${V?"border-oai-gray-300 dark:border-oai-gray-600 bg-oai-gray-50 dark:bg-oai-gray-800":"border-oai-gray-200 dark:border-oai-gray-700 hover:border-oai-gray-300 dark:hover:border-oai-gray-600"}`,children:[m.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[m.jsx(Qc,{provider:L.label,size:15,color:U,className:"text-oai-gray-700 dark:text-oai-gray-300 shrink-0"}),m.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-oai-white",children:L.label})]}),m.jsxs("div",{className:"text-lg font-semibold text-oai-black dark:text-oai-white tabular-nums",children:[L.totalPercent,"%"]}),m.jsx("div",{className:"mt-0.5 text-[11px] text-oai-gray-400 dark:text-oai-gray-400 tabular-nums",children:F("usage.overview.model_count",{count:L.models.length})})]},L.label)})}),T&&m.jsx("div",{id:`provider-details-${T}`,role:"region","aria-label":F("usage.overview.model_details_aria",{provider:T}),className:"mt-2",children:j.filter(L=>L.label===T).map(L=>{const z=v_(L.label,0),U=[...L.models].sort((V,W)=>(W.share||0)-(V.share||0));return m.jsxs("div",{children:[m.jsxs("div",{className:"flex items-center gap-1.5 mb-3",children:[m.jsx(Qc,{provider:L.label,size:14,color:z,className:"shrink-0"}),m.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-oai-white",children:L.label})]}),m.jsx("div",{className:"space-y-3",children:U.map(V=>{const W=MP(V.usage),K=TP(V.cost),Q=Math.max(0,Math.min(100,Number(V.share)||0));return m.jsxs("div",{children:[m.jsxs("div",{className:"flex items-baseline gap-4 mb-1.5",children:[m.jsx("span",{className:"flex-1 min-w-0 text-sm text-oai-gray-700 dark:text-oai-gray-300 truncate",title:V.name,children:V.name}),m.jsx("span",{className:"shrink-0 w-16 text-right text-sm text-oai-gray-500 dark:text-oai-gray-400 tabular-nums",children:W}),m.jsx("span",{className:"shrink-0 w-16 text-right text-sm text-oai-gray-500 dark:text-oai-gray-400 tabular-nums",children:K}),m.jsxs("span",{className:"shrink-0 w-12 text-right text-sm text-oai-black dark:text-oai-white tabular-nums",children:[V.share,"%"]})]}),m.jsx("div",{className:"h-[3px] bg-oai-gray-100 dark:bg-oai-gray-800 rounded-full overflow-hidden",role:"progressbar","aria-valuenow":Q,"aria-valuemin":0,"aria-valuemax":100,children:m.jsx("div",{className:"h-full transition-[width] duration-500 ease-out",style:{width:`${Q}%`,backgroundColor:z,opacity:.45}})})]},V.id||V.name)})})]},L.label)})})]})]})})}function AP(t,e){if(!Array.isArray(t)||t.length===0)return 0;if(t.length===1)return t[0];const n=(t.length-1)*e,r=Math.floor(n),i=Math.ceil(n);if(r===i)return t[r];const a=n-r;return t[r]+(t[i]-t[r])*a}function aoe(t){const e=Array.isArray(t)?t.filter(i=>Number.isFinite(i)&&i>0).sort((i,a)=>i-a):[];if(e.length===0)return{rawMax:0,effectiveMax:1,clippedValues:Array.isArray(t)?t.map(()=>0):[]};const n=e.at(-1)??0;let r=n;if(e.length>=4){const i=AP(e,.25),a=AP(e,.75),s=Math.max(a-i,0),o=a+s*1.5;n>o&&(r=Math.max(o,a,1))}return{rawMax:n,effectiveMax:Math.max(r,1),clippedValues:Array.isArray(t)?t.map(i=>!Number.isFinite(i)||i<=0?0:Math.min(i,Math.max(r,1))):[]}}function soe({value:t,displayValue:e,scale:n,index:r,row:i,totalBars:a}){const s=ou(),o=n.effectiveMax>0?e/n.effectiveMax*100:0,c=`${Math.max(o,2)}%`,u=i?.missing,f=i?.future,h=a<=7?"6px":a<=14?"4px":"3px";return m.jsx(fr.div,{className:"group relative flex-1 self-stretch",initial:{opacity:0,scaleY:0},animate:{opacity:1,scaleY:1},transition:{duration:s?0:.3,delay:s?0:r*.02,ease:[.25,.1,.25,1]},style:{originY:1},children:m.jsxs("div",{className:"absolute inset-x-0 bottom-0",style:{height:c},children:[m.jsx("div",{"data-trend-bar":"true",className:"h-full w-full cursor-pointer transition-all duration-200 group-hover:brightness-110",style:{minHeight:t>0?"4px":"2px",opacity:u||f?.2:1,borderRadius:`${h} ${h} 0 0`,background:t>0?"#10b981":"var(--oai-gray-100)"},title:`${t.toLocaleString()}`}),m.jsx("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 bg-oai-black text-white text-xs rounded opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none whitespace-nowrap z-20",children:t.toLocaleString()})]})})}function ooe({rows:t,from:e,to:n,period:r,timeZoneLabel:i,showTimeZoneLabel:a=!0,className:s=""}){const o=Array.isArray(t)&&t.length?t:[],c=o.map(f=>{if(f?.missing||f?.future)return 0;const h=f?.billable_total_tokens??f?.total_tokens??f?.value;if(h==null)return 0;const p=Number(h);return Number.isFinite(p)?p:0}),u=aoe(c);return m.jsxs("div",{className:`rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-5 ${s}`,children:[m.jsxs("div",{className:"mb-3",children:[m.jsx("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:F("trend.monitor.label")}),a&&i&&m.jsx("p",{className:"text-xs text-oai-gray-400 dark:text-oai-gray-400 mt-0.5",children:i})]}),m.jsxs("div",{className:"space-y-3",children:[m.jsxs("div",{className:"relative",children:[m.jsx("div",{className:"absolute inset-0 flex flex-col justify-between pointer-events-none",children:[0,25,50,75,100].map(f=>m.jsx("div",{className:"w-full border-t border-oai-gray-100 dark:border-oai-gray-800",style:{top:`${100-f}%`}},f))}),m.jsx("div",{className:"h-40 flex items-end gap-1 relative z-0",children:c.length>0?c.map((f,h)=>m.jsx(soe,{value:f,displayValue:u.clippedValues[h]??0,scale:u,index:h,row:o[h],totalBars:c.length},h)):m.jsx("div",{className:"flex-1 h-full flex items-center justify-center",children:m.jsx("p",{className:"text-sm text-oai-gray-400 dark:text-oai-gray-400",children:"No data yet"})})})]}),e&&n&&m.jsxs("div",{className:"flex justify-between text-xs text-oai-gray-500 dark:text-oai-gray-300 font-medium pt-2 border-t border-oai-gray-100 dark:border-oai-gray-800",children:[m.jsx("span",{children:e}),m.jsx("span",{children:n})]})]})]})}const RP={"idle-living":"idle/living.svg","idle-doze":"idle/doze.svg","idle-follow":"idle/follow.svg","idle-look":"idle/look.svg","idle-yawn":"idle/yawn.svg","idle-collapse":"idle/collapse.svg","working-building":"working/building.svg","working-carrying":"working/carrying.svg","working-conducting":"working/conducting.svg","working-confused":"working/confused.svg","working-debugger":"working/debugger.svg","working-juggling":"working/juggling.svg","working-overheated":"working/overheated.svg","working-pushing":"working/pushing.svg","working-sweeping":"working/sweeping.svg","working-thinking":"working/thinking.svg","working-typing":"working/typing.svg","working-ultrathink":"working/ultrathink.svg","working-wizard":"working/wizard.svg","mini-alert":"mini/alert.svg","mini-crabwalk":"mini/crabwalk.svg","mini-enter":"mini/enter.svg","mini-enter-sleep":"mini/enter-sleep.svg","mini-happy":"mini/happy.svg","mini-idle":"mini/idle.svg","mini-peek":"mini/peek.svg","mini-sleep":"mini/sleep.svg","react-double":"react/double.svg","react-drag":"react/drag.svg","react-left":"react/left.svg","react-right":"react/right.svg","collapse-sleep":"sleep/collapse-sleep.svg",sleeping:"sleep/sleeping.svg",wake:"sleep/wake.svg",disconnected:"status/disconnected.svg",error:"status/error.svg",notification:"status/notification.svg",happy:"happy.svg","static-base":"static-base.svg"},x_=new Map;async function loe(t){if(x_.has(t))return x_.get(t);const e=await fetch(`/clawd/${t}`);if(!e.ok)return null;const r=(await e.text()).replace(/<svg([^>]*)>/,(i,a)=>`<svg${a.replace(/\s+width="[^"]*"/g,"").replace(/\s+height="[^"]*"/g,"")} width="100%" height="100%">`);return x_.set(t,r),r}function coe({state:t="idle-living",size:e=48,className:n=""}){const[r,i]=x.useState(""),a=x.useRef(null),o=uoe()?"static-base":t,c=RP[o]||RP["static-base"];return x.useEffect(()=>{let u=!1;return loe(c).then(f=>{!u&&f&&i(f)}),()=>{u=!0}},[c]),x.useEffect(()=>{const u=a.current?.querySelector("svg");if(u)try{const f=u.getBBox();f.width>0&&f.height>0&&u.setAttribute("viewBox",`${f.x-2} ${f.y-2} ${f.width+4} ${f.height+4}`)}catch{}},[r]),m.jsx("div",{ref:a,className:`clawd-animated ${n}`,style:{width:e,height:e,display:"inline-flex",alignItems:"center",justifyContent:"center",overflow:"hidden"},dangerouslySetInnerHTML:{__html:r}})}function uoe(){const[t,e]=x.useState(()=>typeof window>"u"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches);return x.useEffect(()=>{const n=window.matchMedia("(prefers-reduced-motion: reduce)"),r=i=>e(i.matches);return n.addEventListener("change",r),()=>n.removeEventListener("change",r)},[]),t}function doe({todayTokens:t=0,isSyncing:e=!1,hasError:n=!1,isDisconnected:r=!1}={}){return x.useMemo(()=>n?"error":r?"disconnected":e?"working-typing":t===0?"sleeping":t<5e4?"idle-living":t<2e5?"idle-look":t<5e5?"working-ultrathink":t<2e6?"working-typing":"working-ultrathink",[t,e,n,r])}const PP="macAppBannerDismissed",foe="leaderboardBannerDismissed",hoe="https://github.com/mm7894215/TokenTracker/releases/latest",NP="tokentracker_native_app",kg=(()=>{try{return new URLSearchParams(window.location.search).get("app")==="1"?(localStorage.setItem(NP,"1"),!0):localStorage.getItem(NP)==="1"}catch{return!1}})();function poe({todayTokens:t=0,isSyncing:e=!1}){const{openLoginModal:n}=Ep(),{signedIn:r}=ss(),i=doe({todayTokens:t,isSyncing:e}),a=kg?foe:PP,[s,o]=x.useState(()=>{try{return localStorage.getItem(a)==="1"?!0:!kg&&new URLSearchParams(window.location.search).get("from")==="menubar"?(localStorage.setItem(PP,"1"),!0):!1}catch{return!1}}),c=x.useCallback(()=>{o(!0);try{localStorage.setItem(a,"1")}catch{}},[a]);if(s)return null;let u,f,h,p,y,v;kg&&r?(u="View the Leaderboard",f="Compare your usage globally",h="Leaderboard",p=m.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"opacity-70",children:m.jsx("path",{d:"M2 8.5V10h8V8.5M6 1.5v6m0 0L3.5 5M6 7.5l2.5-2.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round",transform:"rotate(180 6 6)"})}),y=()=>{window.location.pathname="/leaderboard"}):kg?(u="Join the Leaderboard",f="Log in to compare your usage with others",h="Log In",p=m.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"opacity-70",children:m.jsx("path",{d:"M6.5 1.5h3a1 1 0 011 1v7a1 1 0 01-1 1h-3M5 8.5L7.5 6 5 3.5M7.5 6H1.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})}),y=n):(u="Try the Menu Bar App",f="Always-on stats with Clawd companion",h="Download",p=m.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"opacity-70",children:m.jsx("path",{d:"M6 2v6m0 0L3.5 5.5M6 8l2.5-2.5M2 10h8",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})}),v=hoe);const w=v?fr.a:fr.button,b=v?{href:v,target:"_blank",rel:"noopener noreferrer"}:{onClick:y};return m.jsx(Pp,{children:m.jsx(fr.div,{initial:{opacity:0,y:-8},animate:{opacity:1,y:0},exit:{opacity:0,y:-8},transition:{duration:.3},className:"rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-4",children:m.jsxs("div",{className:"flex items-center gap-3",children:[m.jsx("div",{className:"flex-shrink-0",children:m.jsx(coe,{state:i,size:56})}),m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsx("div",{className:"text-sm font-medium text-oai-gray-900 dark:text-oai-white",children:u}),m.jsx("div",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 mt-0.5",children:f})]}),m.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[m.jsxs(w,{...b,whileHover:{scale:1.03},whileTap:{scale:.97},className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-white bg-oai-gray-900 dark:bg-oai-white dark:text-oai-gray-900 rounded-md hover:opacity-90 transition-opacity",children:[h,p]}),m.jsx("button",{onClick:c,className:"p-1 text-oai-gray-400 hover:text-oai-gray-600 dark:hover:text-oai-gray-300 transition-colors","aria-label":"Dismiss",children:m.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:m.jsx("path",{d:"M4 4l6 6m0-6L4 10",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})})})]})]})})})}const DP="widgetOnboardingDismissed",LP="tokentracker_native_app",moe=(()=>{try{return new URLSearchParams(window.location.search).get("app")==="1"?(localStorage.setItem(LP,"1"),!0):localStorage.getItem(LP)==="1"}catch{return!1}})();function goe(){const[t,e]=x.useState(()=>{try{return localStorage.getItem(DP)==="1"}catch{return!1}}),n=x.useCallback(()=>{e(!0);try{localStorage.setItem(DP,"1")}catch{}},[]);return moe?m.jsx(Pp,{initial:!1,children:!t&&m.jsxs(fr.div,{initial:{opacity:0,y:-8},animate:{opacity:1,y:0},exit:{opacity:0,y:-8,transition:{duration:.2,ease:[.4,0,.2,1]}},transition:{duration:.3,ease:[.16,1,.3,1]},className:"relative rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-4",children:[m.jsx("button",{type:"button",onClick:n,"aria-label":F("dashboard.widgets.dismiss_aria"),className:"absolute top-2.5 right-2.5 z-10 inline-flex items-center justify-center w-7 h-7 rounded-md text-oai-gray-400 hover:text-oai-gray-700 dark:hover:text-oai-gray-200 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-gray-300 dark:focus-visible:ring-oai-gray-600 transition-colors",children:m.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:m.jsx("path",{d:"M4 4l6 6m0-6L4 10",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})})}),m.jsx("div",{className:"rounded-lg overflow-hidden ring-1 ring-black/5 dark:ring-white/10 shadow-sm",children:m.jsx("img",{src:"/widgets-overview.png",alt:F("dashboard.widgets.title"),width:734,height:552,className:"w-full h-auto block",loading:"lazy",decoding:"async"})}),m.jsxs("div",{className:"mt-4",children:[m.jsx("div",{className:"text-sm font-medium tracking-tight text-oai-gray-900 dark:text-oai-white",children:F("dashboard.widgets.title")}),m.jsx("div",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 mt-1 leading-snug",children:F("dashboard.widgets.hint")})]})]},"widget-onboarding-card")}):null}function yoe(t){const{copy:e,onOpenShare:n,screenshotMode:r,showExpiredGate:i,showAuthGate:a,screenshotTitleLine1:s,screenshotTitleLine2:o,identityDisplayName:c,identityStartDate:u,activeDays:f,identitySubscriptions:h,identityScrambleDurationMs:p,projectUsageEntries:y,projectUsageLimit:v,setProjectUsageLimit:w,topModels:b,signedIn:_,publicMode:E,isLocalMode:M,shouldShowInstall:T,installPrompt:R,handleCopyInstall:A,installCopied:P,installInitCmdDisplay:k,trendRowsForDisplay:N,trendFromForDisplay:j,trendToForDisplay:L,period:z,trendTimeZoneLabel:U,activityHeatmapBlock:V,isCapturing:W,handleShareToX:K,screenshotTwitterButton:Q,screenshotTwitterHint:O,periodsForDisplay:G,setSelectedPeriod:Y,customFrom:H,customTo:te,onCustomRangeApply:re,customRangeOpen:ue,onCustomRangeOpenChange:ce,summaryLabel:ee,summaryValue:le,summaryTotalTokensRaw:ve,summaryCostValue:Pe,summaryConversationsValue:be,rollingUsage:Ye,costInfoEnabled:he,openCostModal:Ue,costModalOpen:je,closeCostModal:et,allowBreakdownToggle:_e,refreshAll:oe,usageLoadingState:J,fleetData:ze,hasDetailsActual:Ne,dailyEmptyPrefix:De,installSyncCmd:Le,dailyEmptySuffix:$,detailsColumns:I,ariaSortFor:Z,toggleSort:pe,sortIconFor:Se,pagedDetails:xe,dailyBreakdownRows:Ie,dailyBreakdownColumns:He,dailyBreakdownAriaSortFor:qe,dailyBreakdownSortIconFor:ft,dailyBreakdownDateKey:We,detailsDateKey:Xe,renderDetailDate:nt,renderDailyBreakdownDate:ct,renderDetailCell:Ke,DETAILS_PAGED_PERIODS:gt,detailsPageCount:ne,detailsPage:Be,setDetailsPage:ke}=t;return m.jsxs(m.Fragment,{children:[m.jsx($ne,{bare:!r,hideHeader:r,header:null,footer:r?null:null,className:r?"screenshot-mode":"",children:i||a?null:m.jsx(m.Fragment,{children:m.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-4",children:[m.jsxs("div",{className:"lg:col-span-4 flex flex-col gap-4 min-w-0 order-2 lg:order-1",children:[r?m.jsx("div",{className:"flex items-start justify-between gap-4",children:m.jsxs("div",{className:"flex flex-col gap-1",children:[m.jsx("span",{className:"text-3xl md:text-4xl font-semibold text-oai-black dark:text-oai-white tracking-tight leading-none",children:s}),m.jsx("span",{className:"text-2xl md:text-3xl font-semibold text-oai-black dark:text-oai-white tracking-tight leading-none",children:o})]})}):null,M?m.jsx(poe,{todayTokens:ve,isSyncing:J}):null,m.jsx(Ire,{title:e("dashboard.identity.title"),subtitle:e("dashboard.identity.subtitle"),period:z,rankLabel:u??e("identity_card.rank_placeholder"),streakDays:f,subscriptions:h,periodConversations:be,rolling:Ye,topModels:b}),M?m.jsx(goe,{}):null,T?m.jsx(Rl,{delay:.25,children:m.jsxs("div",{className:"rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-3",children:[m.jsx("div",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-300 mb-1.5",children:R}),m.jsxs(fr.button,{onClick:A,whileHover:{scale:1.01},whileTap:{scale:.99},className:"w-full flex items-center justify-between px-3 py-2 bg-oai-gray-50 dark:bg-oai-gray-800 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-700 rounded-lg transition-colors",children:[m.jsx("code",{className:"text-xs font-mono text-oai-gray-700 dark:text-oai-gray-300",children:k}),m.jsx(fr.span,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},className:"text-xs text-oai-brand",children:P?"Copied ✓":"Copy"},P?"copied":"copy")]})]})}):null,V&&m.jsx(Rl,{delay:.4,children:V}),r?null:m.jsx(ooe,{rows:N,from:j,to:L,period:z,timeZoneLabel:U,showTimeZoneLabel:!1}),r?m.jsxs("div",{className:"mt-4 flex flex-col items-center gap-2","data-screenshot-exclude":"true",style:W?{display:"none"}:void 0,children:[m.jsx(Ui,{type:"button",onClick:K,variant:"primary",size:"lg",disabled:W,children:Q}),m.jsx("span",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-300",children:O})]}):null]}),m.jsxs("div",{className:"lg:col-span-8 flex flex-col gap-4 min-w-0 order-1 lg:order-2",children:[m.jsx(ioe,{period:z,periods:G,onPeriodChange:Y,summaryLabel:ee,summaryValue:le,summaryCostValue:Pe,onCostInfo:he?Ue:null,fleetData:ze,onRefresh:r?null:oe,loading:J,onOpenShare:r?null:n,customFrom:H,customTo:te,onCustomRangeApply:re,customRangeOpen:ue,onCustomRangeOpenChange:ce}),r?null:m.jsx(Rl,{delay:.5,children:m.jsx(Pre,{projectEntries:y,projectLimit:v,onProjectLimitChange:w,copy:e,hasDetailsActual:Ne,dailyEmptyPrefix:De,installSyncCmd:Le,dailyEmptySuffix:$,detailsColumns:I,ariaSortFor:Z,toggleSort:pe,sortIconFor:Se,pagedDetails:xe,dailyBreakdownRows:Ie,dailyBreakdownColumns:He,dailyBreakdownAriaSortFor:qe,dailyBreakdownSortIconFor:ft,dailyBreakdownDateKey:We,detailsDateKey:Xe,renderDetailDate:nt,renderDailyBreakdownDate:ct,renderDetailCell:Ke,DETAILS_PAGED_PERIODS:gt,period:z,detailsPageCount:ne,detailsPage:Be,setDetailsPage:ke})})]})]})})}),m.jsx(Rre,{isOpen:je,onClose:et,fleetData:ze})]})}function k5(){return typeof window>"u"?!1:!!window?.webkit?.messageHandlers?.nativeBridge}const Nc=new Map,Dc=new Map;function E5(){typeof window>"u"||window.__tokentrackerNativeSaveListener||(window.__tokentrackerNativeSaveListener=!0,window.addEventListener("native:saveImageResult",t=>{const e=t?.detail||{},n=typeof e.requestId=="string"?e.requestId:null;if(!n||!Nc.has(n))return;const r=Nc.get(n);Nc.delete(n),r({ok:!!e.ok,path:typeof e.path=="string"?e.path:void 0,error:typeof e.error=="string"?e.error:void 0})}),window.addEventListener("native:copyImageResult",t=>{const e=t?.detail||{},n=typeof e.requestId=="string"?e.requestId:null;if(!n||!Dc.has(n))return;const r=Dc.get(n);Dc.delete(n),r({ok:!!e.ok,error:typeof e.error=="string"?e.error:void 0})}))}async function voe(t){if(!k5()||typeof window>"u")return{ok:!1,error:"native bridge unavailable"};const e=window?.webkit?.messageHandlers?.nativeBridge;if(!e)return{ok:!1,error:"native bridge unavailable"};E5();const n=`copy_${Date.now()}_${Math.random().toString(36).slice(2,8)}`;return new Promise(r=>{const i=window.setTimeout(()=>{Dc.has(n)&&(Dc.delete(n),r({ok:!1,error:"timeout"}))},8e3);Dc.set(n,a=>{window.clearTimeout(i),r(a)});try{e.postMessage({type:"action",name:"copyImageToClipboard",requestId:n,dataUrl:t})}catch(a){Dc.delete(n),window.clearTimeout(i),r({ok:!1,error:a?.message||String(a)})}})}async function IP(t,e){if(!k5()||typeof window>"u")return{ok:!1,error:"native bridge unavailable"};const n=window?.webkit?.messageHandlers?.nativeBridge;if(!n)return{ok:!1,error:"native bridge unavailable"};E5();const r=`save_${Date.now()}_${Math.random().toString(36).slice(2,8)}`;return new Promise(i=>{const a=window.setTimeout(()=>{Nc.has(r)&&(Nc.delete(r),i({ok:!1,error:"timeout"}))},8e3);Nc.set(r,s=>{window.clearTimeout(a),i(s)});try{n.postMessage({type:"action",name:"saveImageToDownloads",requestId:r,filename:e,dataUrl:t})}catch(s){Nc.delete(r),window.clearTimeout(a),i({ok:!1,error:s?.message||String(s)})}})}const M5=1200,T5=1630,C5={broadsheet:{width:1200,height:1630},"annual-report":{width:1080,height:1865}},xoe="https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Inter+Tight:wght@400;500;600;700&family=IBM+Plex+Serif:ital,wght@0,400;0,500;0,600;1,400&family=IBM+Plex+Mono:wght@400;500&family=Space+Grotesk:wght@500;600;700&display=swap";let b_=!1;function boe(){if(typeof document>"u"||b_)return;if(document.querySelector('link[data-share-card-fonts="true"]')){b_=!0;return}const e=document.createElement("link");e.rel="stylesheet",e.href=xoe,e.dataset.shareCardFonts="true",e.crossOrigin="anonymous",document.head.appendChild(e),b_=!0}async function _oe(){if(typeof document>"u")return;const t=document.fonts;if(!(!t||typeof t.ready?.then!="function"))try{await t.ready}catch{}}async function woe(t,e={}){if(typeof window>"u"||!t)return null;boe(),await _oe(),await new Promise(c=>requestAnimationFrame(()=>c(null)));const{toBlob:n,toPng:r}=await $O(async()=>{const{toBlob:c,toPng:u}=await import("./index-BeoRn2gJ.js");return{toBlob:c,toPng:u}},[]),i=e.pixelRatio??2,a=t.offsetWidth||M5,s=t.offsetHeight||T5,o={pixelRatio:i,cacheBust:!0,width:a,height:s,style:{width:`${a}px`,height:`${s}px`},skipFonts:!1,filter:c=>!(c instanceof HTMLElement)||c.dataset?.screenshotExclude!=="true"};try{const c=await n(t,o);if(c)return c}catch{}try{const c=await r(t,o);return c?await(await fetch(c)).blob():null}catch{return null}}async function __(t){return new Promise(e=>{const n=new FileReader;n.onload=()=>{const r=typeof n.result=="string"?n.result:null;e(r)},n.onerror=()=>e(null),n.readAsDataURL(t)})}function OP(t,e){if(typeof window>"u"||!t)return!1;try{const n=URL.createObjectURL(t),r=document.createElement("a");return r.href=n,r.download=e,document.body.appendChild(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(n),1e3),!0}catch{return!1}}function P1(t){const e=ti(t);return Number.isFinite(e)?e:0}function Soe(t){return t?P1(t.billable_total_tokens??t.total_tokens):0}function koe(t){const e=Array.isArray(t?.weeks)?t.weeks:[];if(!e.length)return{weeks:[],totalDays:0,activeDays:0};let n=0,r=0;return{weeks:e.map(a=>(Array.isArray(a)?a:[]).slice(0,7).map(o=>{const c=!!o?.future,u=Number.isFinite(o?.level)?Math.max(0,Math.min(4,Math.round(o.level))):0;o?.day&&!c&&(n+=1,u>0&&(r+=1));const f=o?.billable_total_tokens??o?.total_tokens??o?.value??0,h=Number.isFinite(f)?Math.max(0,f):0;return{day:typeof o?.day=="string"?o.day:"",level:u,value:h,future:c}})),totalDays:n,activeDays:r}}function Eoe(t){const{handle:e,startDate:n,activeDays:r,summary:i,topModels:a,rank:s,period:o,periodFrom:c,periodTo:u,heatmap:f,capturedAt:h}=t,p=Soe(i),y=P1(i?.total_cost_usd),v=Array.isArray(a)?a.slice(0,3).map(b=>({id:b?.id??null,name:typeof b?.name=="string"&&b.name?b.name:"—",tokens:P1(b?.tokens),percent:typeof b?.percent=="string"&&b.percent?b.percent:"0.0"})):[],w=koe(f);return{handle:e||"—",startDate:n||null,activeDays:Number.isFinite(r)&&r>0?Math.floor(r):0,totalTokens:p,totalCost:y,period:o,periodFrom:c,periodTo:u,topModels:v,rank:typeof s=="number"&&Number.isFinite(s)&&s>0?Math.floor(s):null,heatmapWeeks:w.weeks,heatmapTotalDays:w.totalDays,heatmapActiveDays:w.activeDays,capturedAt:h||new Date().toISOString()}}const Moe=["share.month_short.jan","share.month_short.feb","share.month_short.mar","share.month_short.apr","share.month_short.may","share.month_short.jun","share.month_short.jul","share.month_short.aug","share.month_short.sep","share.month_short.oct","share.month_short.nov","share.month_short.dec"];function Toe(t){const e=Moe[t];return e?F(e):"—"}function A5(t,e){return F("share.date.month_year",{month:Toe(t),year:e})}function Coe(t){if(!t)return"—";const e=t.split("-");if(e.length!==3)return t;const[n,r]=e,i=Number(r)-1;return i<0||i>11?t:A5(i,n)}function Aoe(t){if(t.period==="total")return F("share.issue.all_time");if(t.period==="day"&&t.periodTo)return t.periodTo.replace(/-/g,".");if(t.period==="custom"&&t.periodFrom&&t.periodTo)return`${t.periodFrom.replace(/-/g,".")} — ${t.periodTo.replace(/-/g,".")}`;if(t.periodTo){const e=new Date(`${t.periodTo}T00:00:00Z`);if(!Number.isNaN(e.getTime()))return A5(e.getUTCMonth(),e.getUTCFullYear())}return F(`usage.period.${t.period}`)}function N1(t){return Number.isFinite(t)?Math.round(t).toLocaleString("en-US"):"—"}function R5(t){return!Number.isFinite(t)||t<=0?"$0.00":t>=1e3?`$${Math.round(t).toLocaleString("en-US")}`:`$${t.toFixed(2)}`}function Roe(t){const e=t.topModels[0];if(e){const n=parseFloat(e.percent);return Number.isFinite(n)&&n>=60?F("share.hook.top_loyal",{percent:Math.round(n),name:e.name}):t.activeDays>=60?F("share.hook.days_record",{days:t.activeDays}):Number.isFinite(n)&&n>=30?F("share.hook.top_led",{name:e.name,percent:Math.round(n)}):t.topModels.length>1?F("share.hook.multi_models",{count:t.topModels.length,days:t.activeDays}):F("share.hook.days_with_model",{days:t.activeDays,name:e.name})}return t.activeDays>0?F("share.hook.days_record",{days:t.activeDays}):F("share.hook.new_chapter")}function Poe(t,e){const n=(t||"").length;if(n<=e.baseChars)return e.baseSize;const r=e.baseSize-(n-e.baseChars)*e.shrinkPerChar;return Math.max(e.minSize,r)}function Noe(t){if(!t||t.future)return null;const e=typeof t.level=="number"?t.level:0;return e<0?0:e>4?4:Math.round(e)}function Doe({weeks:t,palette:e,width:n,gap:r=3,radius:i=2,emptyColor:a}){if(!Array.isArray(t)||t.length===0||!n||n<=0)return null;const s=e||["#eee","#ccc","#999","#666","#333"],o=a||s[0],c=t.length,u=(c-1)*r,f=Math.max(4,(n-u)/c),h=7*f+6*r;return m.jsx("svg",{width:n,height:h,viewBox:`0 0 ${n} ${h}`,xmlns:"http://www.w3.org/2000/svg","aria-hidden":!0,style:{display:"block"},children:t.map((p,y)=>(Array.isArray(p)?p:[]).map((w,b)=>{if(b>=7)return null;const _=Noe(w),E=y*(f+r),M=b*(f+r),T=_===null?o:s[_];return m.jsx("rect",{x:E,y:M,width:f,height:f,rx:i,ry:i,fill:T},`${y}-${b}`)}))})}const Loe="oklch(0.97 0.01 85)",Ji="oklch(0.18 0.02 85)",al="oklch(0.38 0.015 85)",FP="oklch(0.55 0.012 85)",hc="oklch(0.55 0.22 25)",pc='"Instrument Serif", "Times New Roman", Georgia, serif',Ioe='"Inter Tight", "Helvetica Neue", Arial, sans-serif',Ooe=["oklch(0.93 0.013 80)","oklch(0.87 0.04 55)","oklch(0.78 0.09 45)","oklch(0.67 0.16 35)","oklch(0.55 0.22 25)"];function P5({data:t}){const e=Aoe(t),n=N1(t.totalTokens),r=R5(t.totalCost),i=Coe(t.startDate),a=Poe(n,{baseSize:188,baseChars:9,shrinkPerChar:14,minSize:104}),s=Roe(t),o=Array.isArray(t.heatmapWeeks)&&t.heatmapWeeks.length>0;return m.jsxs("div",{style:{width:"100%",height:"100%",background:Loe,color:Ji,fontFamily:Ioe,padding:"80px 88px 68px 88px",boxSizing:"border-box",display:"flex",flexDirection:"column",position:"relative"},children:[m.jsxs("header",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:24,paddingBottom:14,borderBottom:`1px solid ${FP}`},children:[m.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14,fontSize:14,fontWeight:500,letterSpacing:"0.22em",textTransform:"uppercase",color:Ji},children:[m.jsx("div",{style:{width:10,height:10,borderRadius:"50%",background:hc}}),"The Token Tracker"]}),m.jsxs("div",{style:{fontSize:12,letterSpacing:"0.22em",textTransform:"uppercase",color:al,textAlign:"right"},children:[F("share.card.broadsheet.issue")," № ",e]})]}),m.jsxs("div",{style:{marginTop:24,display:"flex",justifyContent:"space-between",alignItems:"flex-end",gap:24},children:[m.jsxs("div",{children:[m.jsx("div",{style:{fontSize:12,letterSpacing:"0.2em",textTransform:"uppercase",color:al,marginBottom:6},children:F("share.card.broadsheet.by")}),m.jsx("div",{style:{fontFamily:pc,fontSize:52,fontStyle:"italic",lineHeight:1,color:Ji,letterSpacing:"-0.01em"},children:t.handle})]}),m.jsxs("div",{style:{fontSize:12,letterSpacing:"0.18em",textTransform:"uppercase",color:al,textAlign:"right",lineHeight:1.6},children:[F("share.card.broadsheet.tracked_since"),m.jsx("br",{}),m.jsx("span",{style:{color:Ji},children:i})]})]}),m.jsxs("div",{style:{marginTop:40,display:"flex",flexDirection:"column"},children:[m.jsx("div",{style:{fontSize:13,letterSpacing:"0.3em",textTransform:"uppercase",color:hc,marginBottom:10},children:F("share.card.broadsheet.total_tokens")}),m.jsx("div",{style:{fontFamily:pc,fontSize:a,fontWeight:400,lineHeight:.86,letterSpacing:"-0.032em",color:Ji,fontFeatureSettings:'"lnum" 1, "tnum" 1',whiteSpace:"nowrap",overflow:"hidden"},children:n}),m.jsxs("div",{style:{marginTop:14,fontFamily:pc,fontStyle:"italic",fontSize:34,lineHeight:1.15,color:Ji,letterSpacing:"-0.005em",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:["“",s,"”"]}),m.jsx("div",{style:{marginTop:14,height:1,background:hc,width:"100%"}}),m.jsxs("div",{style:{marginTop:10,display:"flex",justifyContent:"space-between",fontSize:13,letterSpacing:"0.16em",textTransform:"uppercase",color:al},children:[m.jsxs("span",{children:[F("share.card.broadsheet.estimated_spend")," · ",r]}),m.jsx("span",{children:F("share.card.broadsheet.billable_days",{days:t.activeDays})})]})]}),o?m.jsxs("section",{style:{marginTop:40},children:[m.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",marginBottom:12},children:[m.jsx("div",{style:{fontSize:12,letterSpacing:"0.3em",textTransform:"uppercase",color:Ji,fontWeight:600},children:F("share.card.broadsheet.heatmap_title")}),m.jsx("div",{style:{fontSize:11,letterSpacing:"0.18em",textTransform:"uppercase",color:al},children:F("share.card.broadsheet.heatmap_days_on_record",{active:t.heatmapActiveDays,total:t.heatmapTotalDays})})]}),m.jsx(Doe,{weeks:t.heatmapWeeks,palette:Ooe,width:1024,gap:3,radius:2})]}):null,m.jsxs("section",{style:{marginTop:30,flex:1},children:[m.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",borderBottom:`1px solid ${Ji}`,paddingBottom:10,marginBottom:6},children:[m.jsx("div",{style:{fontSize:12,letterSpacing:"0.3em",textTransform:"uppercase",color:Ji,fontWeight:600},children:F("share.card.broadsheet.roster_title")}),m.jsx("div",{style:{fontSize:11,letterSpacing:"0.18em",textTransform:"uppercase",color:al},children:F("share.card.broadsheet.roster_subtitle")})]}),t.topModels.length===0?m.jsx("div",{style:{fontFamily:pc,fontStyle:"italic",fontSize:26,color:al,paddingTop:14},children:F("share.card.broadsheet.empty")}):t.topModels.map((c,u)=>m.jsxs("div",{style:{display:"grid",gridTemplateColumns:"52px 1fr auto 68px",alignItems:"baseline",gap:16,padding:"13px 0",borderBottom:`1px solid ${FP}`},children:[m.jsx("div",{style:{fontFamily:pc,fontSize:34,fontStyle:"italic",color:hc,lineHeight:1},children:String(u+1).padStart(2,"0")}),m.jsx("div",{style:{fontFamily:pc,fontSize:32,color:Ji,lineHeight:1.1,letterSpacing:"-0.01em",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:c.name}),m.jsx("div",{style:{fontFamily:pc,fontSize:28,color:Ji,fontFeatureSettings:'"lnum" 1, "tnum" 1',whiteSpace:"nowrap"},children:N1(c.tokens)}),m.jsxs("div",{style:{fontSize:13,letterSpacing:"0.1em",color:al,textAlign:"right",fontFeatureSettings:'"tnum" 1'},children:[c.percent,"%"]})]},c.id||c.name))]}),m.jsxs("footer",{style:{marginTop:18,paddingTop:12,borderTop:`1px solid ${Ji}`,display:"flex",justifyContent:"space-between",alignItems:"center",fontSize:12,letterSpacing:"0.22em",textTransform:"uppercase",color:Ji},children:[m.jsxs("div",{style:{display:"flex",gap:28},children:[m.jsxs("span",{children:[F("share.card.broadsheet.global_rank")," ",m.jsxs("span",{style:{color:hc},children:["№ ",t.rank!=null?t.rank:"—"]})]}),m.jsxs("span",{children:[F("share.card.broadsheet.active_days")," ",m.jsx("span",{style:{color:hc},children:F("share.card.broadsheet.days_count",{days:t.activeDays})})]})]}),m.jsxs("div",{children:[F("share.card.broadsheet.track_yours")," ",m.jsx("span",{style:{color:hc},children:"→ token.rynn.me"})]})]})]})}const Foe=C5["annual-report"].width,Uoe="#0a0820",sl="#ffffffee",Sc="rgba(255,255,255,0.45)",w_="#a78bfa",joe={background:"rgba(20,15,50,0.38)",backdropFilter:"blur(40px)",WebkitBackdropFilter:"blur(40px)",border:"1px solid rgba(255,255,255,0.05)",boxShadow:["0 39px 56px -36px rgba(255,255,255,0.10) inset","0 7px 11px -4px rgba(255,255,255,0.06) inset","0 -82px 68px -64px rgba(101,67,149,0.08) inset","0 98px 100px -48px rgba(208,171,255,0.06) inset","0 4px 18px 0 rgba(156,146,215,0.06) inset","0 1px 40px 0 rgba(228,222,255,0.04) inset"].join(", ")},Eg={background:"rgba(20,15,50,0.38)",backdropFilter:"blur(32px)",WebkitBackdropFilter:"blur(32px)",border:"1px solid rgba(255,255,255,0.06)",boxShadow:"0 1px 8px 0 rgba(228,222,255,0.06) inset"},D1='"Space Grotesk", "Inter Tight", sans-serif',S_='"Inter Tight", sans-serif',Boe="rgba(255,255,255,0.06)",N5=[Boe,"#4a3d8f","#6b5cbe","#9060e0","#d946ef"],D5=48,L5=28,my=4,I5=20,zoe=Foe-D5*2-L5*2,Voe=(zoe-I5*2)/3,L1=Math.min(Math.floor((Voe-my*6)/7),40),Hoe=L1*7+my*6;function Woe(t){if(!Array.isArray(t))return t;const e=[];for(const o of t)if(Array.isArray(o))for(const c of o)c?.day&&!c.future&&c.value>0&&e.push(c.value);if(!e.length)return t;e.sort((o,c)=>o-c);const n=o=>{const c=e.length,u=(c-1)*o,f=Math.floor(u);return Math.round((e[f]??0)+((e[Math.min(c-1,f+1)]??0)-(e[f]??0))*(u-f))},r=n(.5),i=n(.75),a=n(.9),s=o=>!o||o<=0?0:o<=r?1:o<=i?2:o<=a?3:4;return t.map(o=>Array.isArray(o)?o.map(c=>c?.day&&!c.future&&typeof c.value=="number"?{...c,level:s(c.value)}:c):o)}function Goe(t){if(!Array.isArray(t))return[];const e={},n=Woe(t);for(const r of n)if(Array.isArray(r))for(const i of r){if(!i?.day||i.future)continue;const a=i.day.split("-");if(a.length<2)continue;const s=`${a[0]}-${a[1]}`;(e[s]??=[]).push(i)}return Object.entries(e).sort(([r],[i])=>r.localeCompare(i)).slice(-12).map(([r,i])=>({month:parseInt(r.split("-")[1],10),cells:i}))}function $oe(t){if(!t.length)return[];const e=[...t].sort((s,o)=>s.day.localeCompare(o.day));let n=new Date(`${e[0].day}T00:00:00Z`).getUTCDay();const r=Array(n).fill(null).concat(e),i=[];for(let s=0;s<r.length;s+=7)i.push(r.slice(s,s+7));const a=i[i.length-1];for(;a&&a.length<7;)a.push(null);return i.slice(0,6)}const Yoe=["","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function qoe(t){if(!Array.isArray(t))return 0;const e=[];for(const i of t)if(Array.isArray(i))for(const a of i)a?.day&&!a.future&&e.push(a);e.sort((i,a)=>i.day.localeCompare(a.day));let n=0,r=0;for(const i of e)(i.level||0)>0?(r++,r>n&&(n=r)):r=0;return n}function UP(t){const[e,n]=x.useState(null);return x.useEffect(()=>{if(!t){n(null);return}let r=!1;const i=new Image;return i.crossOrigin="anonymous",i.onload=()=>{if(!r)try{const a=document.createElement("canvas");a.width=i.naturalWidth,a.height=i.naturalHeight,a.getContext("2d").drawImage(i,0,0),n(a.toDataURL("image/png"))}catch{n(null)}},i.onerror=()=>{r||n(null)},i.src=t,()=>{r=!0}},[t]),e}function Xoe({data:t}){const e=$oe(t.cells);return m.jsxs("div",{children:[m.jsx("div",{style:{fontSize:16,fontWeight:600,color:Sc,fontFamily:D1,marginBottom:4},children:Yoe[t.month]}),m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:my},children:e.map((n,r)=>m.jsx("div",{style:{display:"flex",gap:my},children:n.map((i,a)=>{const s=i?Math.min(4,Math.max(0,i.level||0)):-1;return m.jsx("div",{style:{width:L1,height:L1,borderRadius:4,background:s<0?"transparent":N5[s]}},a)})},r))})]})}function Koe({data:t}){const e=Goe(t.heatmapWeeks),n=qoe(t.heatmapWeeks),r=t.topModels[0],i=t.avatarUrl||null,a=UP(i),s=UP("/neon_bg.png"),o=(t.handle||"?")[0].toUpperCase(),c=16;return m.jsxs("div",{style:{width:"100%",height:"100%",background:Uoe,fontFamily:D1,position:"relative",overflow:"hidden",boxSizing:"border-box"},children:[m.jsx("img",{src:s||"/neon_bg.png",alt:"",style:{position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"cover",pointerEvents:"none"}}),m.jsxs("div",{style:{position:"relative",zIndex:1,display:"flex",flexDirection:"column",height:"100%",padding:D5,boxSizing:"border-box"},children:[m.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:c*3},children:[m.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[m.jsx("img",{src:"/app-icon.png",alt:"",width:64,height:64,style:{width:64,height:64,borderRadius:16,display:"block"}}),m.jsxs("div",{children:[m.jsx("div",{style:{fontSize:20,fontWeight:500,color:Sc,lineHeight:1.2},children:"Token Tracker"}),m.jsx("div",{style:{fontSize:36,fontWeight:700,lineHeight:1.15,color:sl},children:F("share.card.annual.report_title")})]})]}),m.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[m.jsx("div",{style:{width:48,height:48,borderRadius:"50%",background:"linear-gradient(135deg,#4c1d95,#7c3aed)",display:"flex",alignItems:"center",justifyContent:"center",border:"2px solid rgba(255,255,255,0.15)",overflow:"hidden",flexShrink:0},children:a?m.jsx("img",{src:a,alt:"",width:48,height:48,style:{width:48,height:48,objectFit:"cover",display:"block"},crossOrigin:"anonymous",referrerPolicy:"no-referrer"}):m.jsx("span",{style:{fontSize:20,fontWeight:700,color:sl},children:o})}),m.jsx("div",{style:{fontSize:32,fontWeight:700,color:sl},children:t.handle})]})]}),m.jsxs("div",{style:{...joe,borderRadius:22,padding:L5,marginBottom:c},children:[m.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:12},children:[m.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:14,color:Sc},children:[m.jsx("span",{children:F("share.card.annual.less")}),N5.map((u,f)=>m.jsx("div",{style:{width:16,height:16,borderRadius:3,background:u}},f)),m.jsx("span",{children:F("share.card.annual.more")})]}),m.jsx("div",{style:{fontSize:16,fontWeight:700,letterSpacing:"0.14em",color:"rgba(255,255,255,0.22)",textTransform:"uppercase"},children:F("share.card.annual.heatmap_title")})]}),m.jsx("div",{style:{display:"grid",gridTemplateColumns:`repeat(3,${Hoe}px)`,gap:`8px ${I5}px`,justifyContent:"center"},children:e.map(u=>m.jsx(Xoe,{data:u},u.month))})]}),m.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:c,marginBottom:c},children:[m.jsxs("div",{style:{...Eg,borderRadius:22,padding:"28px 16px",textAlign:"center"},children:[m.jsx("div",{style:{fontFamily:S_,fontSize:52,fontWeight:700,color:sl,letterSpacing:"-0.02em",lineHeight:1},children:N1(t.totalTokens)}),m.jsx("div",{style:{fontSize:22,color:Sc,marginTop:12},children:F("share.card.annual.total_tokens")})]}),m.jsxs("div",{style:{...Eg,borderRadius:22,padding:"28px 16px",textAlign:"center"},children:[m.jsx("div",{style:{fontFamily:S_,fontSize:52,fontWeight:700,color:sl,letterSpacing:"-0.02em",lineHeight:1},children:R5(t.totalCost)}),m.jsx("div",{style:{fontSize:22,color:Sc,marginTop:12},children:F("share.card.annual.estimated_cost")})]})]}),m.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:c},children:[m.jsxs("div",{style:{...Eg,borderRadius:22,padding:"18px 24px",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[m.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[m.jsxs("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:w_,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[m.jsx("path",{d:"M12 2v4m0 12v4M4.93 4.93l2.83 2.83m8.48 8.48 2.83 2.83M2 12h4m12 0h4M4.93 19.07l2.83-2.83m8.48-8.48 2.83-2.83"}),m.jsx("circle",{cx:"12",cy:"12",r:"4"})]}),m.jsx("span",{style:{fontSize:20,color:Sc},children:F("share.card.annual.longest_streak")})]}),m.jsx("span",{style:{fontFamily:S_,fontSize:28,fontWeight:700,color:sl},children:F("share.card.annual.days_count",{days:n})})]}),m.jsxs("div",{style:{...Eg,borderRadius:22,padding:"18px 24px",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[m.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[m.jsxs("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:w_,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[m.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"}),m.jsx("circle",{cx:"12",cy:"12",r:"4"})]}),m.jsx("span",{style:{fontSize:20,color:Sc},children:F("share.card.annual.top_model")})]}),m.jsx("span",{style:{fontFamily:D1,fontSize:28,fontWeight:700,color:sl},children:r?r.name:"—"})]})]}),m.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:"auto"},children:[m.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[m.jsx("img",{src:"/app-icon.png",alt:"",width:44,height:44,style:{width:44,height:44,borderRadius:8,display:"block"}}),m.jsx("span",{style:{fontSize:22,fontWeight:600,color:sl},children:"Token Tracker"})]}),m.jsx("span",{style:{fontSize:22,fontWeight:600,color:w_},children:"token.rynn.me"})]})]})]})}const O5=[{id:"annual-report",labelKey:"share.variant.neon"},{id:"broadsheet",labelKey:"share.variant.broadsheet"}],Zoe={broadsheet:P5,"annual-report":Koe};function F5(t){return C5[t]||{width:M5,height:T5}}function Joe(t){const e=O5.find(n=>n.id===t);return e?.labelKey?F(e.labelKey):t}const jP=x.forwardRef(function({data:e,variant:n},r){const i=Zoe[n]||P5,{width:a,height:s}=F5(n);return m.jsx("div",{ref:r,"data-share-card":"true",style:{width:a,height:s,position:"relative",overflow:"hidden",boxSizing:"border-box"},children:m.jsx(i,{data:e})})});function Mg(){return typeof window>"u"?!1:!!window?.webkit?.messageHandlers?.nativeBridge}const Qoe=440;function ele(){const[t,e]=x.useState(null),n=x.useRef(null),r=x.useCallback((i,a="info")=>{n.current&&window.clearTimeout(n.current),e({id:Date.now(),kind:a,text:i}),n.current=window.setTimeout(()=>e(null),2800)},[]);return x.useEffect(()=>()=>{n.current&&window.clearTimeout(n.current)},[]),{toast:t,push:r}}function k_({onClick:t,disabled:e,children:n,emphasis:r,ariaLabel:i}){return m.jsx("button",{type:"button",onClick:t,disabled:e,"aria-label":i,className:["group relative flex items-center justify-between gap-3 w-full px-4 py-3 text-left","rounded-lg border transition-colors",r?"border-oai-black dark:border-oai-white bg-oai-black dark:bg-oai-white text-oai-white dark:text-oai-black hover:opacity-90":"border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 text-oai-black dark:text-oai-white hover:border-oai-gray-400 dark:hover:border-oai-gray-600",e?"opacity-60 cursor-not-allowed":"cursor-pointer"].join(" "),children:n})}function tle({open:t,onClose:e,data:n,twitterText:r}){const[i,a]=x.useState(null),[s,o]=x.useState(""),[c,u]=x.useState("annual-report"),f=x.useRef(null),{toast:h,push:p}=ele(),y=ss(),v=x.useMemo(()=>{const k=y?.user;if(!k||typeof k!="object")return null;const N=k.user_metadata||{},j=k.profile||{},L=N.avatar_url||N.picture||j.avatar_url||k.avatar_url;return typeof L=="string"&&L.trim()?L.trim():null},[y?.user]);x.useEffect(()=>{t&&(a(null),o(n?.handle||""))},[t,n?.handle]);const w=n&&{...n,handle:s||n.handle,avatarUrl:v},{width:b,height:_}=F5(c),E=Qoe/b;x.useEffect(()=>{if(!t)return;const k=N=>{N.key==="Escape"&&e?.()};return window.addEventListener("keydown",k),()=>window.removeEventListener("keydown",k)},[t,e]);const M=x.useCallback(async()=>{const k=f.current;if(!k)return null;try{return await woe(k)}catch(N){return console.warn("[share] capture failed",N),null}},[]),T=x.useCallback(async()=>{if(i)return;a("copy");const k=await M();if(!k){p(F("share.toast.failed"),"error"),a(null);return}let N=!1;if(Mg()){const j=await __(k);j&&(N=(await voe(j)).ok)}else N=await Uw(k);p(F(N?"share.toast.copied":"share.toast.failed"),N?"success":"error"),a(null)},[i,M,p]),R=x.useCallback(()=>`tokentracker-share-${Date.now()}.png`,[]),A=x.useCallback(async()=>{if(i)return;a("download");const k=await M();if(!k){p(F("share.toast.failed"),"error"),a(null);return}if(Mg()){const j=await __(k);if(j&&(await IP(j,R())).ok){p(F("share.toast.downloaded"),"success"),a(null);return}}const N=OP(k,R());p(F(N?"share.toast.downloaded":"share.toast.failed"),N?"success":"error"),a(null)},[i,M,R,p]),P=x.useCallback(async()=>{if(i)return;a("x");const k=await M();if(!k){p(F("share.toast.failed"),"error"),a(null);return}if(Mg()){const j=await __(k);j&&(await IP(j,R()),p(F("share.toast.downloaded"),"success"))}else await Uw(k)?p(F("share.toast.copied"),"success"):OP(k,R());const N=new URL("https://twitter.com/intent/tweet");if(r&&N.searchParams.set("text",r),Mg())try{window.webkit?.messageHandlers?.nativeBridge?.postMessage({type:"action",name:"openURL",value:N.toString()})}catch{window.open(N.toString(),"_blank","noopener,noreferrer")}else window.open(N.toString(),"_blank","noopener,noreferrer");a(null)},[i,M,p,r,R]);return t?m.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":F("share.modal.title"),"data-screenshot-exclude":"true",className:"fixed inset-0 z-[9999] flex items-center justify-center p-4 sm:p-6",style:{background:"rgba(10,10,10,0.72)"},onClick:k=>{k.target===k.currentTarget&&e?.()},children:[m.jsx("div",{"aria-hidden":!0,style:{position:"fixed",left:0,top:0,width:b,height:_,pointerEvents:"none",opacity:0,zIndex:-1,clip:"rect(0,0,0,0)",overflow:"hidden"},children:m.jsx(jP,{ref:f,data:w,variant:c})}),m.jsxs(fr.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},exit:{opacity:0,y:12},transition:{duration:.18,ease:[.2,.8,.2,1]},className:"relative w-full max-w-[1040px] max-h-[92vh] overflow-hidden rounded-2xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-black shadow-oai-lg",children:[m.jsxs("div",{className:"flex flex-col lg:flex-row max-h-[92vh]",children:[m.jsx("div",{className:"flex-1 min-w-0 p-4 sm:p-7 bg-oai-gray-50 dark:bg-oai-gray-950 flex items-center justify-center overflow-auto",children:m.jsxs("div",{style:{width:b*E,height:_*E,flexShrink:0,position:"relative"},className:"rounded-xl overflow-hidden shadow-oai-md ring-1 ring-black/5",children:[i?m.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-white/70 dark:bg-black/50",children:m.jsxs("svg",{className:"animate-spin h-6 w-6 text-oai-gray-500",viewBox:"0 0 24 24",fill:"none",children:[m.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3"}),m.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]})}):null,m.jsx("div",{style:{width:b,height:_,transform:`scale(${E})`,transformOrigin:"top left"},children:m.jsx(jP,{data:w,variant:c})})]})}),m.jsxs("div",{className:"w-full lg:w-[340px] flex-shrink-0 border-t lg:border-t-0 lg:border-l border-oai-gray-200 dark:border-oai-gray-800 p-5 sm:p-6 flex flex-col gap-5 overflow-y-auto",children:[m.jsxs("div",{className:"flex items-start justify-between gap-2",children:[m.jsxs("div",{children:[m.jsx("h2",{className:"text-lg font-semibold text-oai-black dark:text-oai-white",children:F("share.modal.title")}),m.jsx("p",{className:"mt-1 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:F("share.modal.subtitle")})]}),m.jsx("button",{type:"button",onClick:e,"aria-label":F("share.modal.close"),className:"p-1.5 -mt-1 -mr-1 rounded-md text-oai-gray-500 hover:text-oai-black dark:hover:text-oai-white hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors",children:m.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:m.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})})]}),m.jsxs("div",{children:[m.jsx("label",{htmlFor:"share-handle",className:"text-[11px] tracking-[0.18em] uppercase text-oai-gray-500 dark:text-oai-gray-400 mb-1.5 block",children:F("share.modal.name_label")}),m.jsx("input",{id:"share-handle",type:"text",value:s,onChange:k=>o(k.target.value),placeholder:F("share.modal.name_placeholder"),className:"w-full px-3 py-2 text-sm rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 text-oai-black dark:text-oai-white placeholder:text-oai-gray-400 dark:placeholder:text-oai-gray-600 focus:outline-none focus:ring-1 focus:ring-inset focus:ring-oai-brand transition-colors"})]}),m.jsxs("div",{children:[m.jsx("label",{className:"text-[11px] tracking-[0.18em] uppercase text-oai-gray-500 dark:text-oai-gray-400 mb-1.5 block",children:F("share.modal.style_label")}),m.jsx("div",{className:"flex gap-2",children:O5.map(k=>m.jsx("button",{type:"button",onClick:()=>u(k.id),className:["flex-1 px-3 py-2 text-sm rounded-lg border transition-colors",c===k.id?"border-oai-black dark:border-oai-white bg-white dark:bg-oai-gray-900 text-oai-black dark:text-oai-white font-medium":"border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 text-oai-gray-500 dark:text-oai-gray-400 hover:border-oai-gray-400 dark:hover:border-oai-gray-600"].join(" "),children:Joe(k.id)},k.id))})]}),m.jsxs("div",{className:"grid grid-cols-1 gap-2",children:[m.jsxs(k_,{onClick:P,disabled:!!i,emphasis:!0,children:[m.jsxs("span",{className:"flex items-center gap-3",children:[m.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:m.jsx("path",{d:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"})}),m.jsx("span",{className:"font-medium text-sm",children:F("share.modal.action.x")})]}),m.jsx("span",{className:"text-[11px] opacity-70",children:F(i==="x"?"share.toast.working":"share.modal.hint.x")})]}),m.jsxs(k_,{onClick:A,disabled:!!i,children:[m.jsxs("span",{className:"flex items-center gap-3",children:[m.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[m.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),m.jsx("polyline",{points:"7 10 12 15 17 10"}),m.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]}),m.jsx("span",{className:"font-medium text-sm",children:F("share.modal.action.download")})]}),m.jsx("span",{className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400",children:"PNG"})]}),m.jsxs(k_,{onClick:T,disabled:!!i,children:[m.jsxs("span",{className:"flex items-center gap-3",children:[m.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[m.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),m.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),m.jsx("span",{className:"font-medium text-sm",children:F("share.modal.action.copy")})]}),m.jsx("span",{className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400",children:F("share.modal.hint.copy")})]})]}),m.jsx("div",{className:"mt-auto pt-4 border-t border-oai-gray-200 dark:border-oai-gray-800",children:m.jsx("p",{className:"text-[11px] leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:F("share.modal.footer")})})]})]}),m.jsx(Pp,{children:h?m.jsx(fr.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:8},className:"pointer-events-none absolute left-1/2 bottom-4 -translate-x-1/2",children:m.jsx("div",{className:["px-4 py-2 rounded-full text-xs font-medium shadow-oai-md",h.kind==="error"?"bg-red-600 text-white":h.kind==="success"?"bg-oai-black dark:bg-oai-white text-oai-white dark:text-oai-black":"bg-oai-gray-800 text-white"].join(" "),children:h.text})},h.id):null})]})]}):null}function nle(t){const{enabled:e,handle:n,startDate:r,activeDays:i,summary:a,topModels:s,period:o,periodFrom:c,periodTo:u,heatmap:f,accessToken:h,userId:p}=t,[y,v]=x.useState(null);return x.useEffect(()=>{if(!e||!p&&!wr())return;let w=!1;return(async()=>{try{const _=await v3({accessToken:h,userId:p,period:o==="day"||o==="custom"?"week":o,metric:"all",limit:100,offset:0});if(w)return;const M=(Array.isArray(_?.entries)?_.entries:Array.isArray(_)?_:[]).find(R=>R?.is_me===!0),T=typeof M?.rank=="number"?M.rank:null;v(T)}catch{w||v(null)}})(),()=>{w=!0}},[e,h,p,o]),x.useMemo(()=>Eoe({handle:n,startDate:r,activeDays:i,summary:a,topModels:s,rank:y,period:o,periodFrom:c,periodTo:u,heatmap:f}),[n,r,i,a,s,y,o,c,u,f])}const rle=["day","week","month","total","custom"],E_=new Set(["day","hour","month"]),uh=new Set(["day","total","custom"]);function M_(t,e){if(typeof e=="number"&&e>0)return!0;if(typeof t=="bigint")return t>0n;if(typeof t=="number")return Number.isFinite(t)&&t>0;if(typeof t=="string"){const n=t.trim();if(!n)return!1;if(/^[0-9]+$/.test(n))try{return BigInt(n)>0n}catch{return!1}const r=Number(n);return Number.isFinite(r)&&r>0}return!1}function Tg(t){return t?t?.billable_total_tokens??t?.total_tokens:null}function BP(t){return t?t?.billable_total_tokens??t?.value??t?.total_tokens:null}function ile(t){if(typeof t!="string"||!t)return null;const e=t.split("-");if(e.length!==3)return null;const n=Number(e[0]),r=Number(e[1])-1,i=Number(e[2]);if(!Number.isFinite(n)||!Number.isFinite(r)||!Number.isFinite(i))return null;const a=new Date(Date.UTC(n,r,i));return Number.isFinite(a.getTime())?a:null}function ale(t,e){return new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()+e))}function sle(t){return t?t==="token.rynn.me":!1}function ole(){if(typeof window>"u")return!1;const t=new URLSearchParams(window.location.search),e=String(t.get("force_install")||"").toLowerCase();return e!=="1"&&e!=="true"?!1:!sle(window.location.hostname)}function lle({baseUrl:t,auth:e,signedIn:n,sessionSoftExpired:r,signOut:i,publicMode:a=!1,publicToken:s=null,signInUrl:o="/sign-in",signUpUrl:c="/sign-up"}){const{resolvedLocale:u}=su(),[f,h]=x.useState(!1),[p,y]=x.useState(null),[v,w]=x.useState(null),[b,_]=x.useState(!1),[E,M]=x.useState(null),[T,R]=x.useState(0),[A,P]=x.useState(0),[k,N]=x.useState(null),[j,L]=x.useState(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(max-width: 640px)").matches),z=x.useMemo(()=>typeof window>"u"?!1:sE(window.location.search),[]),U=x.useMemo(()=>ole(),[]),[V,W]=x.useState(!1),[K,Q]=x.useState(!1),O=2200,[G,Y]=x.useState(!0),[H,te]=x.useState(!1),[re,ue]=x.useState(!1),[ce,ee]=x.useState(!1),le=wr(),ve=n&&!r,Pe=x.useMemo(()=>ve&&(typeof e=="function"||typeof e=="string"||e&&typeof e=="object")?e:null,[e,ve]),be=ve?Pe:null,Ye=a?xo(s):be,he=n||le||a,Ue=ve&&Ol(be),je=n&&r&&!a;x.useEffect(()=>{if(!n||le){y(null),w(null),_(!1),M(null);return}if(a)return;if(!Ue){y(null),w(null),_(!1),M(null);return}let Ge=!0;const Wt=()=>{y(null),w(null),_(!1),M(null)};return _(!0),M(null),(async()=>{let Xt=null;try{Xt=await Nl(be)}catch{Xt=null}if(Ge){if(!Xt){Wt();return}try{const tn={link_code:null,expires_at:null};if(!Ge)return;y(typeof tn?.link_code=="string"?tn.link_code:null),w(typeof tn?.expires_at=="string"?tn.expires_at:null)}catch(tn){if(!Ge)return;y(null),w(null),M(tn?.message||"Failed to load link code")}finally{if(!Ge)return;_(!1)}}})(),()=>{Ge=!1}},[t,le,n,a,Ue,be,A]);const et=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");x.useEffect(()=>{if(!et&&(!n||le||a)){N(null);return}if(!et&&!Ue){N(null);return}let Ge=!0;return(async()=>{let Wt=null;try{Wt=await Nl(be)}catch{Wt=null}if(Ge){if(!Wt&&!et){N(null);return}try{const Xt=await lW({baseUrl:t,accessToken:Wt});if(!Ge)return;N(Xt&&typeof Xt=="object"?Xt:null)}catch{if(!Ge)return;N(null)}}})(),()=>{Ge=!1}},[Ue,t,be,le,a,n]);const _e=x.useMemo(()=>{if(!v)return!1;const Ge=Date.parse(v);if(!Number.isFinite(Ge))return!1;const Wt=T||Date.now();return Ge<=Wt},[v,T]);x.useEffect(()=>{!n||le||a||!v||!_e||b||(y(null),w(null),M(null),P(Ge=>Ge+1))},[_e,v,b,le,n]),x.useEffect(()=>{if(!v||a)return;const Ge=Date.parse(v);if(!Number.isFinite(Ge))return;const Wt=Date.now();if(R(Wt),Ge<=Wt)return;const Xt=window.setTimeout(()=>R(Date.now()),Ge-Wt),tn=()=>{typeof document>"u"||document.visibilityState==="visible"&&R(Date.now())};return typeof document<"u"&&document.addEventListener("visibilitychange",tn),window.addEventListener("focus",tn),()=>{window.clearTimeout(Xt),typeof document<"u"&&document.removeEventListener("visibilitychange",tn),window.removeEventListener("focus",tn)}},[v]),x.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const Ge=window.matchMedia("(max-width: 640px)"),Wt=()=>L(Ge.matches);return Wt(),Ge.addEventListener?(Ge.addEventListener("change",Wt),()=>Ge.removeEventListener("change",Wt)):(Ge.addListener(Wt),()=>Ge.removeListener(Wt))},[]);const oe=x.useMemo(()=>MH(),[]),J=x.useMemo(()=>TH(),[]),ze=x.useMemo(()=>BH(),[]),Ne=a?null:e?.userId||e?.email||"default",[De,Le]=x.useState("month"),[$,I]=x.useState(null),[Z,pe]=x.useState(null),[Se,xe]=x.useState(!1),Ie=z?"total":De,He=x.useMemo(()=>Ie==="custom"&&$&&Z?{from:$,to:Z}:p3(Ie,{timeZone:oe,offsetMinutes:J,now:ze}),[ze,Ie,oe,J,$,Z]),qe=He.from,ft=He.to,We=x.useMemo(()=>CH({timeZone:oe,offsetMinutes:J}),[oe,J]),Xe=x.useMemo(()=>AH({timeZone:oe,offsetMinutes:J}),[oe,J]),nt=x.useMemo(()=>`Local time (${Xe})`,[Xe]),ct=oe,Ke=J,gt=We,ne=x.useMemo(()=>vk({timeZone:oe,offsetMinutes:J,date:ze||new Date}),[ze,oe,J]),Be=x.useMemo(()=>{const Ge=ile(ne)||new Date,Wt=ale(Ge,-29);return{from:Hn(Wt),to:Hn(Ge)}},[ne]),{daily:ke,summary:Ae,rolling:Ve,source:ge,loading:ht,error:bt,refresh:Kt}=fR({baseUrl:t,accessToken:Ye,guestAllowed:je,from:qe,to:ft,includeDaily:Ie!=="total",cacheKey:Ne,timeZone:oe,tzOffsetMinutes:J,now:ze}),{daily:Bt,loading:St,refresh:Rt}=fR({baseUrl:t,accessToken:Ye,guestAllowed:je,from:Be.from,to:Be.to,includeDaily:!0,cacheKey:Ne?`${Ne}.daily-breakdown`:"daily-breakdown",timeZone:oe,tzOffsetMinutes:J,now:ze}),{breakdown:hn,loading:xn,refresh:ie}=zZ({baseUrl:t,accessToken:Ye,guestAllowed:je,from:qe,to:ft,cacheKey:Ne,timeZone:oe,tzOffsetMinutes:J}),[fe,Te]=x.useState(3),{entries:$e,loading:Ze,refresh:Ct}=NZ({baseUrl:t,accessToken:Ye,limit:fe,from:qe,to:ft,timeZone:oe,tzOffsetMinutes:J}),_t=Ie==="week"||Ie==="month",Pt=Ie==="week"||Ie==="month",vt=x.useMemo(()=>ke.filter(Ge=>Ge?.future?!1:!Ge?.day||!ne?!0:String(Ge.day)<=String(ne)),[ke,ne]),{rows:Mt,from:qt,to:zt,loading:En,refresh:yn}=LZ({baseUrl:t,accessToken:Ye,guestAllowed:je,period:Ie,from:qe,to:ft,months:24,cacheKey:Ne,timeZone:ct,tzOffsetMinutes:Ke,now:ze,sharedRows:_t?ke:null,sharedRange:_t?{from:qe,to:ft}:null}),{daily:Cn,heatmap:In,loading:hr,refresh:An}=PZ({baseUrl:t,accessToken:Ye,guestAllowed:je,weeks:52,cacheKey:Ne,timeZone:oe,tzOffsetMinutes:J,now:ze}),{refresh:X}=qO(),me=x.useMemo(()=>Ie==="day"?"hour":Ie==="total"?"month":"day",[Ie]),Re=x.useMemo(()=>pR(me),[me]),Ee="day",we=x.useMemo(()=>pR(Ee),[]),[st,mt]=x.useState(()=>({key:"day",dir:"desc"}));x.useEffect(()=>{mt(Ge=>!E_.has(Ge.key)||Ge.key===me?Ge:{key:me,dir:Ge.dir})},[me]);const it=x.useMemo(()=>E_.has(st.key)&&st.key!==me?{...st,key:me}:st,[me,st]),pt=x.useMemo(()=>{if(Ie==="day")return Array.isArray(Mt)?Mt.filter(Xt=>Xt?.hour&&!Xt?.future):[];if(Ie==="total"){const Xt=Array.isArray(Mt)?Mt.filter(tn=>tn?.month&&!tn?.future):[];return eJ(Xt)}const Ge=vt;return!Ge.some(Xt=>!Xt?.missing&&!Xt?.future)&&ke.length>0?ke.filter(Xt=>!Xt?.future).slice(-30).filter(Xt=>Xt?.day):Ge},[Ie,Mt,vt,ke]),kt=x.useMemo(()=>mR(pt,it),[pt,it]),ut=x.useMemo(()=>pt.some(Ge=>!Ge?.missing&&!Ge?.future),[pt]),Vt=x.useMemo(()=>{if(!uh.has(Ie))return 1;const Ge=Math.ceil(kt.length/ry);return Ge>0?Ge:1},[Ie,kt.length]),[Tt,un]=x.useState(0);x.useEffect(()=>{if(!uh.has(Ie)){un(0);return}un(Ge=>Math.min(Ge,Vt-1))},[Vt,Ie]),x.useEffect(()=>{uh.has(Ie)&&un(0)},[Ie,st.dir,st.key]);const en=x.useMemo(()=>uh.has(Ie)?tJ(kt,Tt,ry):kt,[Tt,Ie,kt]),Rn=x.useMemo(()=>Bt.filter(Ge=>!Ge?.future&&Ge?.day).slice(-30),[Bt]),cn=x.useMemo(()=>E_.has(st.key)?{...st,key:Ee}:st,[st]),tr=x.useMemo(()=>mR(Rn,cn),[Rn,cn]),Ft=x.useMemo(()=>Pt?ke:Ie==="day"?Array.isArray(Mt)?Mt.filter(Ge=>Ge?.hour):[]:Mt,[ke,Ie,Mt,Pt]),Kr=Pt?qe:qt,wn=Pt?ft:zt;function ri(Ge,Wt){return Ge?.future?"—":Ge?.missing?F("shared.status.unsynced"):Oi(Wt==="total_tokens"?Tg(Ge):Ge?.[Wt])}function ii(Ge){const Wt=Ge?.[me];if(Wt==null)return"";const Xt=String(Wt);if(me==="hour"){const[tn,pr]=Xt.split("T");if(tn&&pr)return`${tn} ${pr.slice(0,5)}`}return Xt}function xi(Ge){const Wt=Ge?.[Ee];return Wt==null?"":String(Wt)}function os(Ge){mt(Wt=>Wt.key===Ge?{key:Ge,dir:Wt.dir==="asc"?"desc":"asc"}:{key:Ge,dir:"desc"})}function Fn(Ge){return it.key!==Ge?"none":it.dir==="asc"?"ascending":"descending"}function nn(Ge){return it.key!==Ge?"":it.dir==="asc"?"▲":"▼"}function $i(Ge){return cn.key!==Ge?"none":cn.dir==="asc"?"ascending":"descending"}function lr(Ge){return cn.key!==Ge?"":cn.dir==="asc"?"▲":"▼"}const ai=x.useMemo(()=>{if(!n&&!le&&!a&&!et)return 0;const Ge=Number(In?.active_days);if(Number.isFinite(Ge))return Ge;let Wt=0;const Xt=new Set,tn=(Yn,nr,Qn)=>{typeof Yn!="string"||!Yn||Xt.has(Yn)||M_(nr,Qn)&&(Xt.add(Yn),Wt+=1)};if(Array.isArray(Cn))for(const Yn of Cn)tn(Yn?.day,Tg(Yn));const pr=Array.isArray(In?.weeks)?In.weeks:[];for(const Yn of pr)for(const nr of Array.isArray(Yn)?Yn:[]){const Qn=BP(nr);tn(nr?.day,Qn,nr?.level)}return Wt},[n,le,In?.active_days,In?.weeks,Cn]),[da,jo]=x.useState("month"),Yp=x.useCallback(Ge=>{Ge==="custom"?(jo(Wt=>Wt==="custom"?"month":Wt),Le(Wt=>$&&Z?"custom":Wt),xe(!0)):(Le(Ge),jo(Ge),xe(!1))},[$,Z]),vf=x.useCallback((Ge,Wt)=>{I(Ge),pe(Wt),Le("custom"),xe(!1)},[]),hu=x.useCallback(Ge=>{xe(Ge),!Ge&&De==="custom"&&!$&&Le(da)},[De,$,da]),Da=x.useCallback(async()=>{await Promise.all([Kt(),An(),yn(),ie(),Ct(),Rt(),X()])},[Rt,An,ie,Ct,yn,Kt,X]),ls=x.useCallback(async()=>{ee(!0);try{et&&await cW(),await Da()}catch(Ge){console.error("[DashboardPage] Refresh failed:",Ge)}finally{ee(!1)}},[et,Da]),cs=ce||ht||St||hr||En||xn||Ze,Gl=x.useMemo(()=>F("shared.data_source",{source:String(ge||"edge").toUpperCase()}),[ge,u]),us=x.useMemo(()=>typeof e?.name!="string"?"":e.name.trim(),[e?.name]),ds="",qp=x.useMemo(()=>!us||us.includes("@")?F("dashboard.identity.fallback"):us,[us]),xf=x.useMemo(()=>qp.replace(/[^a-zA-Z0-9._-]/g,"_"),[qp]),Bo=x.useMemo(()=>a?F("dashboard.identity.fallback"):xf,[xf,ds,a]),Xp=x.useMemo(()=>{let Ge=null;const Wt=tn=>{typeof tn!="string"||!tn||(!Ge||tn<Ge)&&(Ge=tn)};if(Array.isArray(Cn))for(const tn of Cn)tn?.day&&M_(Tg(tn))&&Wt(tn.day);const Xt=Array.isArray(In?.weeks)?In.weeks:[];for(const tn of Xt)for(const pr of Array.isArray(tn)?tn:[]){if(!pr?.day)continue;const Yn=BP(pr),nr=pr?.level;M_(Yn,nr)&&Wt(pr.day)}return Ge},[In?.weeks,Cn]),Kp=x.useMemo(()=>a?[]:(Array.isArray(k?.subscriptions?.items)?k.subscriptions.items:[]).map(Xt=>{const tn=typeof Xt?.tool=="string"?Xt.tool.trim():"",Yn=(typeof Xt?.plan_type=="string"?Xt.plan_type:typeof Xt?.planType=="string"?Xt.planType:"").trim();return!tn||!Yn?null:{tool:tn,planType:Yn,provider:typeof Xt?.provider=="string"?Xt.provider.trim():"",product:typeof Xt?.product=="string"?Xt.product.trim():"",rateLimitTier:typeof Xt?.rate_limit_tier=="string"?Xt.rate_limit_tier.trim():typeof Xt?.rateLimitTier=="string"?Xt.rateLimitTier.trim():""}}).filter(Boolean).slice(0,6),[a,k]),pu=m.jsx($J,{heatmap:In,timeZoneLabel:We,timeZoneShortLabel:Xe,hideLegend:z,defaultToLatestMonth:z}),Zp=x.useMemo(()=>`${qe}..${ft}`,[qe,Ie,ft]),_v=F("usage.summary.total"),Yi=Tg(Ae),zo=F("shared.unit.thousand_abbrev"),Qs=F("shared.unit.million_abbrev"),$l=F("shared.unit.billion_abbrev"),mu=ti(Yi),Jp=j&&mu!=null&&Math.abs(mu)>=1e9,bf=x.useMemo(()=>Jp?Iy(mu,{thousandSuffix:zo,millionSuffix:Qs,billionSuffix:$l,decimals:1}):Oi(Yi),[$l,Qs,Yi,mu,zo,Jp]),gu=F("dashboard.core_index.collapse_label"),_f=F("dashboard.core_index.expand_label"),Qp=F("dashboard.core_index.collapse_aria"),fs=F("dashboard.core_index.expand_aria"),wf=!z,yu=F("dashboard.screenshot.title_line1"),em=F("dashboard.screenshot.title_line2"),vu=F("dashboard.screenshot.twitter_label"),xu=F("dashboard.screenshot.twitter_button"),tm=F("dashboard.screenshot.twitter_hint"),Sr=F("shared.placeholder.short"),hs=x.useMemo(()=>{const Ge=Array.isArray(hn?.sources)?hn.sources:[];let Wt=null,Xt=0;for(const nr of Ge){const Qn=ti(nr?.totals?.billable_total_tokens??nr?.totals?.total_tokens);!Number.isFinite(Qn)||Qn<=0||Qn>Xt&&(Xt=Qn,Wt=nr)}let tn=Sr,pr=Sr,Yn="0.0";if(Wt&&Xt>0){tn=Wt?.source?String(Wt.source).toUpperCase():Sr;const nr=Array.isArray(Wt?.models)?Wt.models:[];let Qn=0;for(const La of nr){const Kl=ti(La?.totals?.billable_total_tokens??La?.totals?.total_tokens);!Number.isFinite(Kl)||Kl<=0||Kl>Qn&&(Qn=Kl,pr=La?.model?String(La.model):Sr)}Qn>0&&(Yn=(Qn/Xt*100).toFixed(1))}return{agentName:tn,modelName:pr,modelPercent:Yn}},[hn,Sr]),bu=Oi(Yi),Sf=F("dashboard.screenshot.twitter_text",{total_tokens:bu==="-"?Sr:bu,agent_name:hs.agentName,model_name:hs.modelName,model_percent:hs.modelPercent}),Yl=x.useMemo(()=>{if(typeof window>"u")return"";const Ge=new URL("https://twitter.com/intent/tweet");return Ge.searchParams.set("text",Sf),Ge.toString()},[Sf]),wu=x.useCallback(async()=>{if(typeof window>"u")return null;const Ge=async()=>{const nr=performance.now();for(;performance.now()-nr<2e3;){const Qn=document.querySelector("[data-heatmap-scroll='true']");if(!Qn||Qn.dataset.latestMonthReady==="true")return;await new Promise(La=>requestAnimationFrame(La))}},Wt=document.querySelector("#root")||document.body,Xt=document.documentElement,{scrollWidth:tn,scrollHeight:pr}=document.documentElement;Xt?.classList.add("screenshot-capture"),document.body?.classList.add("screenshot-capture"),await new Promise(Yn=>requestAnimationFrame(Yn)),await Ge();try{const{toBlob:Yn,toPng:nr}=await $O(async()=>{const{toBlob:eo,toPng:sm}=await import("./index-BeoRn2gJ.js");return{toBlob:eo,toPng:sm}},[]),Qn=await Yn(Wt,{backgroundColor:"#050505",pixelRatio:2,cacheBust:!0,width:tn,height:pr,style:{width:`${tn}px`,height:`${pr}px`},filter:eo=>!(eo instanceof HTMLElement)||eo.dataset?.screenshotExclude!=="true"});if(Qn)return Qn;const La=await nr(Wt,{backgroundColor:"#050505",pixelRatio:2,cacheBust:!0,width:tn,height:pr,style:{width:`${tn}px`,height:`${pr}px`},filter:eo=>!(eo instanceof HTMLElement)||eo.dataset?.screenshotExclude!=="true"});return La?await(await fetch(La)).blob():null}finally{Xt?.classList.remove("screenshot-capture"),document.body?.classList.remove("screenshot-capture")}},[]),ql=x.useCallback(async()=>{if(typeof window>"u"||V)return;W(!0);const Ge=navigator?.userAgent||"",Wt=/iP(hone|od|ad)/i.test(Ge),Xt=/Safari/i.test(Ge)&&!/Chrome|Chromium|Edg|OPR|CriOS|FxiOS/i.test(Ge),tn=typeof navigator<"u"&&!!navigator.clipboard?.write&&typeof window<"u"&&!!window.ClipboardItem;let Yn=!tn||Wt||Xt;try{const nr=await wu();nr&&tn&&(typeof document<"u"&&!document.hasFocus()&&window.focus?.(),Yn=await Uw(nr))}catch(nr){console.error("Failed to capture screenshot",nr)}finally{if(W(!1),!Yn){console.warn("Failed to write screenshot to clipboard.");return}Yl&&(window.location.href=Yl)}},[wu,V,Yl]),Su=x.useMemo(()=>z?[]:rle,[z]),nm=x.useMemo(()=>[{label:F("usage.metric.total"),value:Oi(Yi),valueClassName:"text-white"},{label:F("usage.metric.input"),value:Oi(Ae?.input_tokens)},{label:F("usage.metric.output"),value:Oi(Ae?.output_tokens)},{label:F("usage.metric.cached_input"),value:Oi(Ae?.cached_input_tokens)},{label:F("usage.metric.reasoning_output"),value:Oi(Ae?.reasoning_output_tokens)}],[Ae?.cached_input_tokens,Ae?.input_tokens,Ae?.output_tokens,Ae?.reasoning_output_tokens,Yi]),kf=x.useMemo(()=>{const Ge=Oy(Ae?.total_cost_usd);return!Ge||Ge==="-"||Ge.startsWith("$")?Ge:`$${Ge}`},[Ae?.total_cost_usd]),wv=x.useMemo(()=>Ae?.conversation_count??null,[Ae?.conversation_count]),rm=x.useMemo(()=>iJ(hn,{copyFn:F}),[hn]),ku=x.useMemo(()=>aJ(hn,{limit:3,copyFn:F}),[hn]),Sv=nle({enabled:K,handle:Bo,startDate:Xp,activeDays:ai,summary:Ae,topModels:ku,period:Ie,periodFrom:qe,periodTo:ft,heatmap:In,accessToken:typeof Ye=="string"?Ye:null,userId:e?.userId||null}),kv=x.useCallback(()=>Q(!0),[]),Ev=x.useCallback(()=>Q(!1),[]),Mv=x.useCallback(()=>h(!0),[]),Tv=x.useCallback(()=>h(!1),[]),im=kf&&kf!=="-"&&rm.length>0,Xl=F("dashboard.install.cmd.init"),Ef=_e?null:p,Mf=Ef?F("dashboard.install.cmd.init_link_code",{link_code:Ef}):Xl,Cv=Xl,Tf=F("dashboard.install.cmd.sync"),Av=F(Ef?"dashboard.install.copy":"dashboard.install.copy_base"),Rv=F("dashboard.install.copied");F("dashboard.session_expired.copy_label"),F("dashboard.session_expired.copied");const Pv=!!(k?.install?.has_active_device_token??k?.install?.hasActiveDeviceToken),am=nJ({publicMode:a,screenshotMode:z,forceInstall:U,accessEnabled:he,heatmapLoading:hr,activeDays:ai,hasActiveDeviceToken:Pv}),Nv=F("dashboard.install.prompt"),Dv=x.useCallback(async()=>{!Mf||!await Fw(Mf)||(te(!0),window.setTimeout(()=>te(!1),2e3))},[Mf]);x.useCallback(async()=>{!Xl||!await Fw(Xl)||(ue(!0),window.setTimeout(()=>ue(!1),2e3))},[Xl]);const Cf=x.useMemo(()=>F("dashboard.daily.empty",{cmd:"{{cmd}}"}),[u]),[Lv,Iv]=x.useMemo(()=>{const Ge=Cf.split("{{cmd}}");return Ge.length===1?[Cf,""]:[Ge[0],Ge.slice(1).join("{{cmd}}")]},[Cf]),Ov=r&&!a,Af=!n&&!le&&!r&&!et&&!a;return m.jsxs(m.Fragment,{children:[m.jsx(yoe,{copy:F,onOpenShare:kv,screenshotMode:z,showExpiredGate:Ov,showAuthGate:Af,screenshotTitleLine1:yu,screenshotTitleLine2:em,identityDisplayName:Bo,identityStartDate:Xp,activeDays:ai,identitySubscriptions:Kp,identityScrambleDurationMs:O,projectUsageEntries:$e,projectUsageLimit:fe,setProjectUsageLimit:Te,topModels:ku,signedIn:n,publicMode:a,isLocalMode:et,shouldShowInstall:am,installPrompt:Nv,handleCopyInstall:Dv,installCopied:H,installCopiedLabel:Rv,installCopyLabel:Av,installInitCmdDisplay:Cv,linkCodeLoading:b,linkCodeError:E,trendRowsForDisplay:Ft,trendFromForDisplay:Kr,trendToForDisplay:wn,period:Ie,trendTimeZoneLabel:gt,activityHeatmapBlock:pu,isCapturing:V,handleShareToX:ql,screenshotTwitterLabel:vu,screenshotTwitterButton:xu,screenshotTwitterHint:tm,periodsForDisplay:Su,setSelectedPeriod:Yp,customFrom:$,customTo:Z,onCustomRangeApply:vf,customRangeOpen:Se,onCustomRangeOpenChange:hu,metricsRows:nm,summaryLabel:_v,summaryValue:bf,summaryTotalTokensRaw:ti(Yi)||0,summaryCostValue:kf,summaryConversationsValue:wv,rollingUsage:Ve,costInfoEnabled:im,openCostModal:Mv,allowBreakdownToggle:wf,coreIndexCollapsed:G,setCoreIndexCollapsed:Y,coreIndexCollapseLabel:gu,coreIndexExpandLabel:_f,coreIndexCollapseAria:Qp,coreIndexExpandAria:fs,refreshAll:ls,usageLoadingState:cs,usageError:bt,rangeLabel:Zp,timeZoneRangeLabel:nt,usageSourceLabel:Gl,fleetData:rm,hasDetailsActual:ut,dailyEmptyPrefix:Lv,installSyncCmd:Tf,dailyEmptySuffix:Iv,detailsColumns:Re,ariaSortFor:Fn,toggleSort:os,sortIconFor:nn,pagedDetails:en,dailyBreakdownRows:tr,dailyBreakdownColumns:we,dailyBreakdownAriaSortFor:$i,dailyBreakdownSortIconFor:lr,dailyBreakdownDateKey:Ee,detailsDateKey:me,renderDetailDate:ii,renderDailyBreakdownDate:xi,renderDetailCell:ri,DETAILS_PAGED_PERIODS:uh,detailsPageCount:Vt,detailsPage:Tt,setDetailsPage:un,costModalOpen:f,closeCostModal:Tv}),m.jsx(tle,{open:K,onClose:Ev,data:Sv,twitterText:Sf})]})}function cle(){const[t,e]=x.useState(!1);return m.jsxs("div",{className:"h-full relative dark:bg-[#050505]",children:[!t&&m.jsxs("div",{className:"absolute inset-0 p-6 space-y-5 animate-pulse",children:[m.jsx("div",{className:"flex gap-4 justify-center",children:Array.from({length:6}).map((n,r)=>m.jsx("div",{className:"h-4 w-20 rounded bg-oai-gray-200 dark:bg-oai-gray-800"},r))}),m.jsxs("div",{className:"space-y-2 pt-2",children:[m.jsx("div",{className:"h-7 w-72 rounded bg-oai-gray-200 dark:bg-oai-gray-800"}),m.jsx("div",{className:"h-4 w-96 rounded bg-oai-gray-200 dark:bg-oai-gray-800"})]}),m.jsx("div",{className:"grid grid-cols-3 gap-4",children:Array.from({length:3}).map((n,r)=>m.jsx("div",{className:"h-24 rounded-xl bg-oai-gray-200 dark:bg-oai-gray-800"},r))}),m.jsx("div",{className:"grid grid-cols-3 gap-4",children:Array.from({length:3}).map((n,r)=>m.jsx("div",{className:"h-40 rounded-xl bg-oai-gray-200 dark:bg-oai-gray-800"},r))}),m.jsx("div",{className:"grid grid-cols-3 gap-4",children:Array.from({length:3}).map((n,r)=>m.jsx("div",{className:"h-32 rounded-xl bg-oai-gray-200 dark:bg-oai-gray-800"},r))})]}),m.jsx("iframe",{src:"https://ip.net.coffee/claude/",title:"Cloud AI IP Check",className:`w-full h-full dark:invert dark:hue-rotate-180 transition-opacity duration-300 ${t?"opacity-100":"opacity-0"}`,style:{border:"none"},onLoad:()=>e(!0)})]})}function ule(){if(typeof window>"u")return!1;const t=window.location.hostname;return t==="localhost"||t==="127.0.0.1"||t==="::1"}function dle(){return ule()?"/":"/dashboard"}function U5({repo:t="mm7894215/TokenTracker"}){const[e,n]=x.useState(null);return x.useEffect(()=>{if(typeof window>"u")return;const r=typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,i=typeof document<"u"&&(document.documentElement?.classList.contains("screenshot-capture")||document.body?.classList.contains("screenshot-capture"));CF({prefersReducedMotion:r,screenshotCapture:i})&&fetch(`https://api.github.com/repos/${t}`).then(a=>a.json()).then(a=>{a&&typeof a.stargazers_count=="number"&&n(a.stargazers_count)}).catch(()=>{})},[t]),m.jsxs("a",{href:`https://github.com/${t}`,target:"_blank",rel:"noopener noreferrer",className:"inline-flex shrink-0 items-center gap-2 px-3 py-1.5 rounded-md border border-oai-gray-200 dark:border-oai-gray-700 bg-oai-gray-50 dark:bg-oai-gray-800 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-700 transition-colors no-underline",children:[m.jsx("svg",{height:"16",viewBox:"0 0 16 16",width:"16",className:"shrink-0 fill-oai-gray-700 dark:fill-oai-gray-300",children:m.jsx("path",{d:"M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"})}),m.jsx("span",{className:"text-xs font-medium text-oai-gray-700 dark:text-oai-gray-300 whitespace-nowrap",children:"Star"}),e!==null&&m.jsx("span",{className:"text-xs font-semibold text-oai-gray-900 dark:text-oai-white tabular-nums whitespace-nowrap",children:e})]})}const WE="183",fle=0,zP=1,hle=2,w0=1,ple=2,Th=3,Il=0,zi=1,bo=2,To=0,Bc=1,VP=2,HP=3,WP=4,mle=5,Ec=100,gle=101,yle=102,vle=103,xle=104,ble=200,_le=201,wle=202,Sle=203,I1=204,O1=205,kle=206,Ele=207,Mle=208,Tle=209,Cle=210,Ale=211,Rle=212,Ple=213,Nle=214,F1=0,U1=1,j1=2,Gd=3,B1=4,z1=5,V1=6,H1=7,j5=0,Dle=1,Lle=2,Os=0,B5=1,z5=2,V5=3,H5=4,W5=5,G5=6,$5=7,Y5=300,eu=301,$d=302,T_=303,C_=304,uv=306,W1=1e3,So=1001,G1=1002,ni=1003,Ile=1004,Cg=1005,yi=1006,A_=1007,Lc=1008,Ea=1009,q5=1010,X5=1011,lp=1012,GE=1013,Ws=1014,Ps=1015,Lo=1016,$E=1017,YE=1018,cp=1020,K5=35902,Z5=35899,J5=1021,Q5=1022,es=1023,Io=1026,Ic=1027,eU=1028,qE=1029,Yd=1030,XE=1031,KE=1033,S0=33776,k0=33777,E0=33778,M0=33779,$1=35840,Y1=35841,q1=35842,X1=35843,K1=36196,Z1=37492,J1=37496,Q1=37488,eS=37489,tS=37490,nS=37491,rS=37808,iS=37809,aS=37810,sS=37811,oS=37812,lS=37813,cS=37814,uS=37815,dS=37816,fS=37817,hS=37818,pS=37819,mS=37820,gS=37821,yS=36492,vS=36494,xS=36495,bS=36283,_S=36284,wS=36285,SS=36286,Ole=3200,Fle=0,Ule=1,xl="",wa="srgb",tu="srgb-linear",gy="linear",qn="srgb",Zu=7680,GP=519,jle=512,Ble=513,zle=514,ZE=515,Vle=516,Hle=517,JE=518,Wle=519,$P=35044,YP="300 es",Ns=2e3,yy=2001;function Gle(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}function vy(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function $le(){const t=vy("canvas");return t.style.display="block",t}const qP={};function XP(...t){const e="THREE."+t.shift();console.log(e,...t)}function tU(t){const e=t[0];if(typeof e=="string"&&e.startsWith("TSL:")){const n=t[1];n&&n.isStackTrace?t[0]+=" "+n.getLocation():t[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return t}function ln(...t){t=tU(t);const e="THREE."+t.shift();{const n=t[0];n&&n.isStackTrace?console.warn(n.getError(e)):console.warn(e,...t)}}function Vn(...t){t=tU(t);const e="THREE."+t.shift();{const n=t[0];n&&n.isStackTrace?console.error(n.getError(e)):console.error(e,...t)}}function xy(...t){const e=t.join(" ");e in qP||(qP[e]=!0,ln(...t))}function Yle(t,e,n){return new Promise(function(r,i){function a(){switch(t.clientWaitSync(e,t.SYNC_FLUSH_COMMANDS_BIT,0)){case t.WAIT_FAILED:i();break;case t.TIMEOUT_EXPIRED:setTimeout(a,n);break;default:r()}}setTimeout(a,n)})}const qle={[F1]:U1,[j1]:V1,[B1]:H1,[Gd]:z1,[U1]:F1,[V1]:j1,[H1]:B1,[z1]:Gd};class df{addEventListener(e,n){this._listeners===void 0&&(this._listeners={});const r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(n)===-1&&r[e].push(n)}hasEventListener(e,n){const r=this._listeners;return r===void 0?!1:r[e]!==void 0&&r[e].indexOf(n)!==-1}removeEventListener(e,n){const r=this._listeners;if(r===void 0)return;const i=r[e];if(i!==void 0){const a=i.indexOf(n);a!==-1&&i.splice(a,1)}}dispatchEvent(e){const n=this._listeners;if(n===void 0)return;const r=n[e.type];if(r!==void 0){e.target=this;const i=r.slice(0);for(let a=0,s=i.length;a<s;a++)i[a].call(this,e);e.target=null}}}const ui=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],R_=Math.PI/180,kS=180/Math.PI;function Bp(){const t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(ui[t&255]+ui[t>>8&255]+ui[t>>16&255]+ui[t>>24&255]+"-"+ui[e&255]+ui[e>>8&255]+"-"+ui[e>>16&15|64]+ui[e>>24&255]+"-"+ui[n&63|128]+ui[n>>8&255]+"-"+ui[n>>16&255]+ui[n>>24&255]+ui[r&255]+ui[r>>8&255]+ui[r>>16&255]+ui[r>>24&255]).toLowerCase()}function Dn(t,e,n){return Math.max(e,Math.min(n,t))}function Xle(t,e){return(t%e+e)%e}function P_(t,e,n){return(1-n)*t+n*e}function dh(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function Ii(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(t*4294967295);case Uint16Array:return Math.round(t*65535);case Uint8Array:return Math.round(t*255);case Int32Array:return Math.round(t*2147483647);case Int16Array:return Math.round(t*32767);case Int8Array:return Math.round(t*127);default:throw new Error("Invalid component type.")}}class Gn{constructor(e=0,n=0){Gn.prototype.isVector2=!0,this.x=e,this.y=n}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,n){return this.x=e,this.y=n,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const n=this.x,r=this.y,i=e.elements;return this.x=i[0]*n+i[3]*r+i[6],this.y=i[1]*n+i[4]*r+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,n){return this.x=Dn(this.x,e.x,n.x),this.y=Dn(this.y,e.y,n.y),this}clampScalar(e,n){return this.x=Dn(this.x,e,n),this.y=Dn(this.y,e,n),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Dn(r,e,n))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const r=this.dot(e)/n;return Math.acos(Dn(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,r=this.y-e.y;return n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this}lerpVectors(e,n,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this}rotateAround(e,n){const r=Math.cos(n),i=Math.sin(n),a=this.x-e.x,s=this.y-e.y;return this.x=a*r-s*i+e.x,this.y=a*i+s*r+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class ff{constructor(e=0,n=0,r=0,i=1){this.isQuaternion=!0,this._x=e,this._y=n,this._z=r,this._w=i}static slerpFlat(e,n,r,i,a,s,o){let c=r[i+0],u=r[i+1],f=r[i+2],h=r[i+3],p=a[s+0],y=a[s+1],v=a[s+2],w=a[s+3];if(h!==w||c!==p||u!==y||f!==v){let b=c*p+u*y+f*v+h*w;b<0&&(p=-p,y=-y,v=-v,w=-w,b=-b);let _=1-o;if(b<.9995){const E=Math.acos(b),M=Math.sin(E);_=Math.sin(_*E)/M,o=Math.sin(o*E)/M,c=c*_+p*o,u=u*_+y*o,f=f*_+v*o,h=h*_+w*o}else{c=c*_+p*o,u=u*_+y*o,f=f*_+v*o,h=h*_+w*o;const E=1/Math.sqrt(c*c+u*u+f*f+h*h);c*=E,u*=E,f*=E,h*=E}}e[n]=c,e[n+1]=u,e[n+2]=f,e[n+3]=h}static multiplyQuaternionsFlat(e,n,r,i,a,s){const o=r[i],c=r[i+1],u=r[i+2],f=r[i+3],h=a[s],p=a[s+1],y=a[s+2],v=a[s+3];return e[n]=o*v+f*h+c*y-u*p,e[n+1]=c*v+f*p+u*h-o*y,e[n+2]=u*v+f*y+o*p-c*h,e[n+3]=f*v-o*h-c*p-u*y,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,n,r,i){return this._x=e,this._y=n,this._z=r,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,n=!0){const r=e._x,i=e._y,a=e._z,s=e._order,o=Math.cos,c=Math.sin,u=o(r/2),f=o(i/2),h=o(a/2),p=c(r/2),y=c(i/2),v=c(a/2);switch(s){case"XYZ":this._x=p*f*h+u*y*v,this._y=u*y*h-p*f*v,this._z=u*f*v+p*y*h,this._w=u*f*h-p*y*v;break;case"YXZ":this._x=p*f*h+u*y*v,this._y=u*y*h-p*f*v,this._z=u*f*v-p*y*h,this._w=u*f*h+p*y*v;break;case"ZXY":this._x=p*f*h-u*y*v,this._y=u*y*h+p*f*v,this._z=u*f*v+p*y*h,this._w=u*f*h-p*y*v;break;case"ZYX":this._x=p*f*h-u*y*v,this._y=u*y*h+p*f*v,this._z=u*f*v-p*y*h,this._w=u*f*h+p*y*v;break;case"YZX":this._x=p*f*h+u*y*v,this._y=u*y*h+p*f*v,this._z=u*f*v-p*y*h,this._w=u*f*h-p*y*v;break;case"XZY":this._x=p*f*h-u*y*v,this._y=u*y*h-p*f*v,this._z=u*f*v+p*y*h,this._w=u*f*h+p*y*v;break;default:ln("Quaternion: .setFromEuler() encountered an unknown order: "+s)}return n===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,n){const r=n/2,i=Math.sin(r);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(r),this._onChangeCallback(),this}setFromRotationMatrix(e){const n=e.elements,r=n[0],i=n[4],a=n[8],s=n[1],o=n[5],c=n[9],u=n[2],f=n[6],h=n[10],p=r+o+h;if(p>0){const y=.5/Math.sqrt(p+1);this._w=.25/y,this._x=(f-c)*y,this._y=(a-u)*y,this._z=(s-i)*y}else if(r>o&&r>h){const y=2*Math.sqrt(1+r-o-h);this._w=(f-c)/y,this._x=.25*y,this._y=(i+s)/y,this._z=(a+u)/y}else if(o>h){const y=2*Math.sqrt(1+o-r-h);this._w=(a-u)/y,this._x=(i+s)/y,this._y=.25*y,this._z=(c+f)/y}else{const y=2*Math.sqrt(1+h-r-o);this._w=(s-i)/y,this._x=(a+u)/y,this._y=(c+f)/y,this._z=.25*y}return this._onChangeCallback(),this}setFromUnitVectors(e,n){let r=e.dot(n)+1;return r<1e-8?(r=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(this._x=e.y*n.z-e.z*n.y,this._y=e.z*n.x-e.x*n.z,this._z=e.x*n.y-e.y*n.x,this._w=r),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Dn(this.dot(e),-1,1)))}rotateTowards(e,n){const r=this.angleTo(e);if(r===0)return this;const i=Math.min(1,n/r);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,n){const r=e._x,i=e._y,a=e._z,s=e._w,o=n._x,c=n._y,u=n._z,f=n._w;return this._x=r*f+s*o+i*u-a*c,this._y=i*f+s*c+a*o-r*u,this._z=a*f+s*u+r*c-i*o,this._w=s*f-r*o-i*c-a*u,this._onChangeCallback(),this}slerp(e,n){let r=e._x,i=e._y,a=e._z,s=e._w,o=this.dot(e);o<0&&(r=-r,i=-i,a=-a,s=-s,o=-o);let c=1-n;if(o<.9995){const u=Math.acos(o),f=Math.sin(u);c=Math.sin(c*u)/f,n=Math.sin(n*u)/f,this._x=this._x*c+r*n,this._y=this._y*c+i*n,this._z=this._z*c+a*n,this._w=this._w*c+s*n,this._onChangeCallback()}else this._x=this._x*c+r*n,this._y=this._y*c+i*n,this._z=this._z*c+a*n,this._w=this._w*c+s*n,this.normalize();return this}slerpQuaternions(e,n,r){return this.copy(e).slerp(n,r)}random(){const e=2*Math.PI*Math.random(),n=2*Math.PI*Math.random(),r=Math.random(),i=Math.sqrt(1-r),a=Math.sqrt(r);return this.set(i*Math.sin(e),i*Math.cos(e),a*Math.sin(n),a*Math.cos(n))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,n=0){return this._x=e[n],this._y=e[n+1],this._z=e[n+2],this._w=e[n+3],this._onChangeCallback(),this}toArray(e=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+3]=this._w,e}fromBufferAttribute(e,n){return this._x=e.getX(n),this._y=e.getY(n),this._z=e.getZ(n),this._w=e.getW(n),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class Oe{constructor(e=0,n=0,r=0){Oe.prototype.isVector3=!0,this.x=e,this.y=n,this.z=r}set(e,n,r){return r===void 0&&(r=this.z),this.x=e,this.y=n,this.z=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,n){return this.x=e.x*n.x,this.y=e.y*n.y,this.z=e.z*n.z,this}applyEuler(e){return this.applyQuaternion(KP.setFromEuler(e))}applyAxisAngle(e,n){return this.applyQuaternion(KP.setFromAxisAngle(e,n))}applyMatrix3(e){const n=this.x,r=this.y,i=this.z,a=e.elements;return this.x=a[0]*n+a[3]*r+a[6]*i,this.y=a[1]*n+a[4]*r+a[7]*i,this.z=a[2]*n+a[5]*r+a[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const n=this.x,r=this.y,i=this.z,a=e.elements,s=1/(a[3]*n+a[7]*r+a[11]*i+a[15]);return this.x=(a[0]*n+a[4]*r+a[8]*i+a[12])*s,this.y=(a[1]*n+a[5]*r+a[9]*i+a[13])*s,this.z=(a[2]*n+a[6]*r+a[10]*i+a[14])*s,this}applyQuaternion(e){const n=this.x,r=this.y,i=this.z,a=e.x,s=e.y,o=e.z,c=e.w,u=2*(s*i-o*r),f=2*(o*n-a*i),h=2*(a*r-s*n);return this.x=n+c*u+s*h-o*f,this.y=r+c*f+o*u-a*h,this.z=i+c*h+a*f-s*u,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const n=this.x,r=this.y,i=this.z,a=e.elements;return this.x=a[0]*n+a[4]*r+a[8]*i,this.y=a[1]*n+a[5]*r+a[9]*i,this.z=a[2]*n+a[6]*r+a[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,n){return this.x=Dn(this.x,e.x,n.x),this.y=Dn(this.y,e.y,n.y),this.z=Dn(this.z,e.z,n.z),this}clampScalar(e,n){return this.x=Dn(this.x,e,n),this.y=Dn(this.y,e,n),this.z=Dn(this.z,e,n),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Dn(r,e,n))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this}lerpVectors(e,n,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,this.z=e.z+(n.z-e.z)*r,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,n){const r=e.x,i=e.y,a=e.z,s=n.x,o=n.y,c=n.z;return this.x=i*c-a*o,this.y=a*s-r*c,this.z=r*o-i*s,this}projectOnVector(e){const n=e.lengthSq();if(n===0)return this.set(0,0,0);const r=e.dot(this)/n;return this.copy(e).multiplyScalar(r)}projectOnPlane(e){return N_.copy(this).projectOnVector(e),this.sub(N_)}reflect(e){return this.sub(N_.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const r=this.dot(e)/n;return Math.acos(Dn(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,r=this.y-e.y,i=this.z-e.z;return n*n+r*r+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,n,r){const i=Math.sin(n)*e;return this.x=i*Math.sin(r),this.y=Math.cos(n)*e,this.z=i*Math.cos(r),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,n,r){return this.x=e*Math.sin(n),this.y=r,this.z=e*Math.cos(n),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this}setFromMatrixScale(e){const n=this.setFromMatrixColumn(e,0).length(),r=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=n,this.y=r,this.z=i,this}setFromMatrixColumn(e,n){return this.fromArray(e.elements,n*4)}setFromMatrix3Column(e,n){return this.fromArray(e.elements,n*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,n=Math.random()*2-1,r=Math.sqrt(1-n*n);return this.x=r*Math.cos(e),this.y=n,this.z=r*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const N_=new Oe,KP=new ff;class pn{constructor(e,n,r,i,a,s,o,c,u){pn.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,n,r,i,a,s,o,c,u)}set(e,n,r,i,a,s,o,c,u){const f=this.elements;return f[0]=e,f[1]=i,f[2]=o,f[3]=n,f[4]=a,f[5]=c,f[6]=r,f[7]=s,f[8]=u,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const n=this.elements,r=e.elements;return n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3],n[4]=r[4],n[5]=r[5],n[6]=r[6],n[7]=r[7],n[8]=r[8],this}extractBasis(e,n,r){return e.setFromMatrix3Column(this,0),n.setFromMatrix3Column(this,1),r.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const n=e.elements;return this.set(n[0],n[4],n[8],n[1],n[5],n[9],n[2],n[6],n[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const r=e.elements,i=n.elements,a=this.elements,s=r[0],o=r[3],c=r[6],u=r[1],f=r[4],h=r[7],p=r[2],y=r[5],v=r[8],w=i[0],b=i[3],_=i[6],E=i[1],M=i[4],T=i[7],R=i[2],A=i[5],P=i[8];return a[0]=s*w+o*E+c*R,a[3]=s*b+o*M+c*A,a[6]=s*_+o*T+c*P,a[1]=u*w+f*E+h*R,a[4]=u*b+f*M+h*A,a[7]=u*_+f*T+h*P,a[2]=p*w+y*E+v*R,a[5]=p*b+y*M+v*A,a[8]=p*_+y*T+v*P,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=e,n[4]*=e,n[7]*=e,n[2]*=e,n[5]*=e,n[8]*=e,this}determinant(){const e=this.elements,n=e[0],r=e[1],i=e[2],a=e[3],s=e[4],o=e[5],c=e[6],u=e[7],f=e[8];return n*s*f-n*o*u-r*a*f+r*o*c+i*a*u-i*s*c}invert(){const e=this.elements,n=e[0],r=e[1],i=e[2],a=e[3],s=e[4],o=e[5],c=e[6],u=e[7],f=e[8],h=f*s-o*u,p=o*c-f*a,y=u*a-s*c,v=n*h+r*p+i*y;if(v===0)return this.set(0,0,0,0,0,0,0,0,0);const w=1/v;return e[0]=h*w,e[1]=(i*u-f*r)*w,e[2]=(o*r-i*s)*w,e[3]=p*w,e[4]=(f*n-i*c)*w,e[5]=(i*a-o*n)*w,e[6]=y*w,e[7]=(r*c-u*n)*w,e[8]=(s*n-r*a)*w,this}transpose(){let e;const n=this.elements;return e=n[1],n[1]=n[3],n[3]=e,e=n[2],n[2]=n[6],n[6]=e,e=n[5],n[5]=n[7],n[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const n=this.elements;return e[0]=n[0],e[1]=n[3],e[2]=n[6],e[3]=n[1],e[4]=n[4],e[5]=n[7],e[6]=n[2],e[7]=n[5],e[8]=n[8],this}setUvTransform(e,n,r,i,a,s,o){const c=Math.cos(a),u=Math.sin(a);return this.set(r*c,r*u,-r*(c*s+u*o)+s+e,-i*u,i*c,-i*(-u*s+c*o)+o+n,0,0,1),this}scale(e,n){return this.premultiply(D_.makeScale(e,n)),this}rotate(e){return this.premultiply(D_.makeRotation(-e)),this}translate(e,n){return this.premultiply(D_.makeTranslation(e,n)),this}makeTranslation(e,n){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,n,0,0,1),this}makeRotation(e){const n=Math.cos(e),r=Math.sin(e);return this.set(n,-r,0,r,n,0,0,0,1),this}makeScale(e,n){return this.set(e,0,0,0,n,0,0,0,1),this}equals(e){const n=this.elements,r=e.elements;for(let i=0;i<9;i++)if(n[i]!==r[i])return!1;return!0}fromArray(e,n=0){for(let r=0;r<9;r++)this.elements[r]=e[r+n];return this}toArray(e=[],n=0){const r=this.elements;return e[n]=r[0],e[n+1]=r[1],e[n+2]=r[2],e[n+3]=r[3],e[n+4]=r[4],e[n+5]=r[5],e[n+6]=r[6],e[n+7]=r[7],e[n+8]=r[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const D_=new pn,ZP=new pn().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),JP=new pn().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Kle(){const t={enabled:!0,workingColorSpace:tu,spaces:{},convert:function(i,a,s){return this.enabled===!1||a===s||!a||!s||(this.spaces[a].transfer===qn&&(i.r=Co(i.r),i.g=Co(i.g),i.b=Co(i.b)),this.spaces[a].primaries!==this.spaces[s].primaries&&(i.applyMatrix3(this.spaces[a].toXYZ),i.applyMatrix3(this.spaces[s].fromXYZ)),this.spaces[s].transfer===qn&&(i.r=Rd(i.r),i.g=Rd(i.g),i.b=Rd(i.b))),i},workingToColorSpace:function(i,a){return this.convert(i,this.workingColorSpace,a)},colorSpaceToWorking:function(i,a){return this.convert(i,a,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===xl?gy:this.spaces[i].transfer},getToneMappingMode:function(i){return this.spaces[i].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(i,a=this.workingColorSpace){return i.fromArray(this.spaces[a].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,a,s){return i.copy(this.spaces[a].toXYZ).multiply(this.spaces[s].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,a){return xy("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),t.workingToColorSpace(i,a)},toWorkingColorSpace:function(i,a){return xy("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),t.colorSpaceToWorking(i,a)}},e=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],r=[.3127,.329];return t.define({[tu]:{primaries:e,whitePoint:r,transfer:gy,toXYZ:ZP,fromXYZ:JP,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:wa},outputColorSpaceConfig:{drawingBufferColorSpace:wa}},[wa]:{primaries:e,whitePoint:r,transfer:qn,toXYZ:ZP,fromXYZ:JP,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:wa}}}),t}const jn=Kle();function Co(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function Rd(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}let Ju;class Zle{static getDataURL(e,n="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let r;if(e instanceof HTMLCanvasElement)r=e;else{Ju===void 0&&(Ju=vy("canvas")),Ju.width=e.width,Ju.height=e.height;const i=Ju.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),r=Ju}return r.toDataURL(n)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const n=vy("canvas");n.width=e.width,n.height=e.height;const r=n.getContext("2d");r.drawImage(e,0,0,e.width,e.height);const i=r.getImageData(0,0,e.width,e.height),a=i.data;for(let s=0;s<a.length;s++)a[s]=Co(a[s]/255)*255;return r.putImageData(i,0,0),n}else if(e.data){const n=e.data.slice(0);for(let r=0;r<n.length;r++)n instanceof Uint8Array||n instanceof Uint8ClampedArray?n[r]=Math.floor(Co(n[r]/255)*255):n[r]=Co(n[r]);return{data:n,width:e.width,height:e.height}}else return ln("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let Jle=0;class QE{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Jle++}),this.uuid=Bp(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const n=this.data;return typeof HTMLVideoElement<"u"&&n instanceof HTMLVideoElement?e.set(n.videoWidth,n.videoHeight,0):typeof VideoFrame<"u"&&n instanceof VideoFrame?e.set(n.displayHeight,n.displayWidth,0):n!==null?e.set(n.width,n.height,n.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const n=e===void 0||typeof e=="string";if(!n&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const r={uuid:this.uuid,url:""},i=this.data;if(i!==null){let a;if(Array.isArray(i)){a=[];for(let s=0,o=i.length;s<o;s++)i[s].isDataTexture?a.push(L_(i[s].image)):a.push(L_(i[s]))}else a=L_(i);r.url=a}return n||(e.images[this.uuid]=r),r}}function L_(t){return typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap?Zle.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(ln("Texture: Unable to serialize Texture."),{})}let Qle=0;const I_=new Oe;class Ti extends df{constructor(e=Ti.DEFAULT_IMAGE,n=Ti.DEFAULT_MAPPING,r=So,i=So,a=yi,s=Lc,o=es,c=Ea,u=Ti.DEFAULT_ANISOTROPY,f=xl){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Qle++}),this.uuid=Bp(),this.name="",this.source=new QE(e),this.mipmaps=[],this.mapping=n,this.channel=0,this.wrapS=r,this.wrapT=i,this.magFilter=a,this.minFilter=s,this.anisotropy=u,this.format=o,this.internalFormat=null,this.type=c,this.offset=new Gn(0,0),this.repeat=new Gn(1,1),this.center=new Gn(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new pn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=f,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(I_).x}get height(){return this.source.getSize(I_).y}get depth(){return this.source.getSize(I_).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,n){this.updateRanges.push({start:e,count:n})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const n in e){const r=e[n];if(r===void 0){ln(`Texture.setValues(): parameter '${n}' has value of undefined.`);continue}const i=this[n];if(i===void 0){ln(`Texture.setValues(): property '${n}' does not exist.`);continue}i&&r&&i.isVector2&&r.isVector2||i&&r&&i.isVector3&&r.isVector3||i&&r&&i.isMatrix3&&r.isMatrix3?i.copy(r):this[n]=r}}toJSON(e){const n=e===void 0||typeof e=="string";if(!n&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const r={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(r.userData=this.userData),n||(e.textures[this.uuid]=r),r}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Y5)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case W1:e.x=e.x-Math.floor(e.x);break;case So:e.x=e.x<0?0:1;break;case G1:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case W1:e.y=e.y-Math.floor(e.y);break;case So:e.y=e.y<0?0:1;break;case G1:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}Ti.DEFAULT_IMAGE=null;Ti.DEFAULT_MAPPING=Y5;Ti.DEFAULT_ANISOTROPY=1;class yr{constructor(e=0,n=0,r=0,i=1){yr.prototype.isVector4=!0,this.x=e,this.y=n,this.z=r,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,n,r,i){return this.x=e,this.y=n,this.z=r,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;case 3:this.w=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this.w=e.w+n.w,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,this.w+=e.w*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.z,this.w=e.w-n.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const n=this.x,r=this.y,i=this.z,a=this.w,s=e.elements;return this.x=s[0]*n+s[4]*r+s[8]*i+s[12]*a,this.y=s[1]*n+s[5]*r+s[9]*i+s[13]*a,this.z=s[2]*n+s[6]*r+s[10]*i+s[14]*a,this.w=s[3]*n+s[7]*r+s[11]*i+s[15]*a,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const n=Math.sqrt(1-e.w*e.w);return n<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/n,this.y=e.y/n,this.z=e.z/n),this}setAxisAngleFromRotationMatrix(e){let n,r,i,a;const c=e.elements,u=c[0],f=c[4],h=c[8],p=c[1],y=c[5],v=c[9],w=c[2],b=c[6],_=c[10];if(Math.abs(f-p)<.01&&Math.abs(h-w)<.01&&Math.abs(v-b)<.01){if(Math.abs(f+p)<.1&&Math.abs(h+w)<.1&&Math.abs(v+b)<.1&&Math.abs(u+y+_-3)<.1)return this.set(1,0,0,0),this;n=Math.PI;const M=(u+1)/2,T=(y+1)/2,R=(_+1)/2,A=(f+p)/4,P=(h+w)/4,k=(v+b)/4;return M>T&&M>R?M<.01?(r=0,i=.707106781,a=.707106781):(r=Math.sqrt(M),i=A/r,a=P/r):T>R?T<.01?(r=.707106781,i=0,a=.707106781):(i=Math.sqrt(T),r=A/i,a=k/i):R<.01?(r=.707106781,i=.707106781,a=0):(a=Math.sqrt(R),r=P/a,i=k/a),this.set(r,i,a,n),this}let E=Math.sqrt((b-v)*(b-v)+(h-w)*(h-w)+(p-f)*(p-f));return Math.abs(E)<.001&&(E=1),this.x=(b-v)/E,this.y=(h-w)/E,this.z=(p-f)/E,this.w=Math.acos((u+y+_-1)/2),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this.w=n[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,n){return this.x=Dn(this.x,e.x,n.x),this.y=Dn(this.y,e.y,n.y),this.z=Dn(this.z,e.z,n.z),this.w=Dn(this.w,e.w,n.w),this}clampScalar(e,n){return this.x=Dn(this.x,e,n),this.y=Dn(this.y,e,n),this.z=Dn(this.z,e,n),this.w=Dn(this.w,e,n),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Dn(r,e,n))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this.w+=(e.w-this.w)*n,this}lerpVectors(e,n,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,this.z=e.z+(n.z-e.z)*r,this.w=e.w+(n.w-e.w)*r,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this.w=e[n+3],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e[n+3]=this.w,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this.w=e.getW(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class ece extends df{constructor(e=1,n=1,r={}){super(),r=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:yi,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},r),this.isRenderTarget=!0,this.width=e,this.height=n,this.depth=r.depth,this.scissor=new yr(0,0,e,n),this.scissorTest=!1,this.viewport=new yr(0,0,e,n),this.textures=[];const i={width:e,height:n,depth:r.depth},a=new Ti(i),s=r.count;for(let o=0;o<s;o++)this.textures[o]=a.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this._setTextureOptions(r),this.depthBuffer=r.depthBuffer,this.stencilBuffer=r.stencilBuffer,this.resolveDepthBuffer=r.resolveDepthBuffer,this.resolveStencilBuffer=r.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=r.depthTexture,this.samples=r.samples,this.multiview=r.multiview}_setTextureOptions(e={}){const n={minFilter:yi,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(n.mapping=e.mapping),e.wrapS!==void 0&&(n.wrapS=e.wrapS),e.wrapT!==void 0&&(n.wrapT=e.wrapT),e.wrapR!==void 0&&(n.wrapR=e.wrapR),e.magFilter!==void 0&&(n.magFilter=e.magFilter),e.minFilter!==void 0&&(n.minFilter=e.minFilter),e.format!==void 0&&(n.format=e.format),e.type!==void 0&&(n.type=e.type),e.anisotropy!==void 0&&(n.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(n.colorSpace=e.colorSpace),e.flipY!==void 0&&(n.flipY=e.flipY),e.generateMipmaps!==void 0&&(n.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(n.internalFormat=e.internalFormat);for(let r=0;r<this.textures.length;r++)this.textures[r].setValues(n)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,n,r=1){if(this.width!==e||this.height!==n||this.depth!==r){this.width=e,this.height=n,this.depth=r;for(let i=0,a=this.textures.length;i<a;i++)this.textures[i].image.width=e,this.textures[i].image.height=n,this.textures[i].image.depth=r,this.textures[i].isData3DTexture!==!0&&(this.textures[i].isArrayTexture=this.textures[i].image.depth>1);this.dispose()}this.viewport.set(0,0,e,n),this.scissor.set(0,0,e,n)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let n=0,r=e.textures.length;n<r;n++){this.textures[n]=e.textures[n].clone(),this.textures[n].isRenderTargetTexture=!0,this.textures[n].renderTarget=this;const i=Object.assign({},e.textures[n].image);this.textures[n].source=new QE(i)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Fs extends ece{constructor(e=1,n=1,r={}){super(e,n,r),this.isWebGLRenderTarget=!0}}class nU extends Ti{constructor(e=null,n=1,r=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:n,height:r,depth:i},this.magFilter=ni,this.minFilter=ni,this.wrapR=So,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class tce extends Ti{constructor(e=null,n=1,r=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:n,height:r,depth:i},this.magFilter=ni,this.minFilter=ni,this.wrapR=So,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Nr{constructor(e,n,r,i,a,s,o,c,u,f,h,p,y,v,w,b){Nr.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,n,r,i,a,s,o,c,u,f,h,p,y,v,w,b)}set(e,n,r,i,a,s,o,c,u,f,h,p,y,v,w,b){const _=this.elements;return _[0]=e,_[4]=n,_[8]=r,_[12]=i,_[1]=a,_[5]=s,_[9]=o,_[13]=c,_[2]=u,_[6]=f,_[10]=h,_[14]=p,_[3]=y,_[7]=v,_[11]=w,_[15]=b,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Nr().fromArray(this.elements)}copy(e){const n=this.elements,r=e.elements;return n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3],n[4]=r[4],n[5]=r[5],n[6]=r[6],n[7]=r[7],n[8]=r[8],n[9]=r[9],n[10]=r[10],n[11]=r[11],n[12]=r[12],n[13]=r[13],n[14]=r[14],n[15]=r[15],this}copyPosition(e){const n=this.elements,r=e.elements;return n[12]=r[12],n[13]=r[13],n[14]=r[14],this}setFromMatrix3(e){const n=e.elements;return this.set(n[0],n[3],n[6],0,n[1],n[4],n[7],0,n[2],n[5],n[8],0,0,0,0,1),this}extractBasis(e,n,r){return this.determinant()===0?(e.set(1,0,0),n.set(0,1,0),r.set(0,0,1),this):(e.setFromMatrixColumn(this,0),n.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this)}makeBasis(e,n,r){return this.set(e.x,n.x,r.x,0,e.y,n.y,r.y,0,e.z,n.z,r.z,0,0,0,0,1),this}extractRotation(e){if(e.determinant()===0)return this.identity();const n=this.elements,r=e.elements,i=1/Qu.setFromMatrixColumn(e,0).length(),a=1/Qu.setFromMatrixColumn(e,1).length(),s=1/Qu.setFromMatrixColumn(e,2).length();return n[0]=r[0]*i,n[1]=r[1]*i,n[2]=r[2]*i,n[3]=0,n[4]=r[4]*a,n[5]=r[5]*a,n[6]=r[6]*a,n[7]=0,n[8]=r[8]*s,n[9]=r[9]*s,n[10]=r[10]*s,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromEuler(e){const n=this.elements,r=e.x,i=e.y,a=e.z,s=Math.cos(r),o=Math.sin(r),c=Math.cos(i),u=Math.sin(i),f=Math.cos(a),h=Math.sin(a);if(e.order==="XYZ"){const p=s*f,y=s*h,v=o*f,w=o*h;n[0]=c*f,n[4]=-c*h,n[8]=u,n[1]=y+v*u,n[5]=p-w*u,n[9]=-o*c,n[2]=w-p*u,n[6]=v+y*u,n[10]=s*c}else if(e.order==="YXZ"){const p=c*f,y=c*h,v=u*f,w=u*h;n[0]=p+w*o,n[4]=v*o-y,n[8]=s*u,n[1]=s*h,n[5]=s*f,n[9]=-o,n[2]=y*o-v,n[6]=w+p*o,n[10]=s*c}else if(e.order==="ZXY"){const p=c*f,y=c*h,v=u*f,w=u*h;n[0]=p-w*o,n[4]=-s*h,n[8]=v+y*o,n[1]=y+v*o,n[5]=s*f,n[9]=w-p*o,n[2]=-s*u,n[6]=o,n[10]=s*c}else if(e.order==="ZYX"){const p=s*f,y=s*h,v=o*f,w=o*h;n[0]=c*f,n[4]=v*u-y,n[8]=p*u+w,n[1]=c*h,n[5]=w*u+p,n[9]=y*u-v,n[2]=-u,n[6]=o*c,n[10]=s*c}else if(e.order==="YZX"){const p=s*c,y=s*u,v=o*c,w=o*u;n[0]=c*f,n[4]=w-p*h,n[8]=v*h+y,n[1]=h,n[5]=s*f,n[9]=-o*f,n[2]=-u*f,n[6]=y*h+v,n[10]=p-w*h}else if(e.order==="XZY"){const p=s*c,y=s*u,v=o*c,w=o*u;n[0]=c*f,n[4]=-h,n[8]=u*f,n[1]=p*h+w,n[5]=s*f,n[9]=y*h-v,n[2]=v*h-y,n[6]=o*f,n[10]=w*h+p}return n[3]=0,n[7]=0,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromQuaternion(e){return this.compose(nce,e,rce)}lookAt(e,n,r){const i=this.elements;return Qi.subVectors(e,n),Qi.lengthSq()===0&&(Qi.z=1),Qi.normalize(),ol.crossVectors(r,Qi),ol.lengthSq()===0&&(Math.abs(r.z)===1?Qi.x+=1e-4:Qi.z+=1e-4,Qi.normalize(),ol.crossVectors(r,Qi)),ol.normalize(),Ag.crossVectors(Qi,ol),i[0]=ol.x,i[4]=Ag.x,i[8]=Qi.x,i[1]=ol.y,i[5]=Ag.y,i[9]=Qi.y,i[2]=ol.z,i[6]=Ag.z,i[10]=Qi.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const r=e.elements,i=n.elements,a=this.elements,s=r[0],o=r[4],c=r[8],u=r[12],f=r[1],h=r[5],p=r[9],y=r[13],v=r[2],w=r[6],b=r[10],_=r[14],E=r[3],M=r[7],T=r[11],R=r[15],A=i[0],P=i[4],k=i[8],N=i[12],j=i[1],L=i[5],z=i[9],U=i[13],V=i[2],W=i[6],K=i[10],Q=i[14],O=i[3],G=i[7],Y=i[11],H=i[15];return a[0]=s*A+o*j+c*V+u*O,a[4]=s*P+o*L+c*W+u*G,a[8]=s*k+o*z+c*K+u*Y,a[12]=s*N+o*U+c*Q+u*H,a[1]=f*A+h*j+p*V+y*O,a[5]=f*P+h*L+p*W+y*G,a[9]=f*k+h*z+p*K+y*Y,a[13]=f*N+h*U+p*Q+y*H,a[2]=v*A+w*j+b*V+_*O,a[6]=v*P+w*L+b*W+_*G,a[10]=v*k+w*z+b*K+_*Y,a[14]=v*N+w*U+b*Q+_*H,a[3]=E*A+M*j+T*V+R*O,a[7]=E*P+M*L+T*W+R*G,a[11]=E*k+M*z+T*K+R*Y,a[15]=E*N+M*U+T*Q+R*H,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[4]*=e,n[8]*=e,n[12]*=e,n[1]*=e,n[5]*=e,n[9]*=e,n[13]*=e,n[2]*=e,n[6]*=e,n[10]*=e,n[14]*=e,n[3]*=e,n[7]*=e,n[11]*=e,n[15]*=e,this}determinant(){const e=this.elements,n=e[0],r=e[4],i=e[8],a=e[12],s=e[1],o=e[5],c=e[9],u=e[13],f=e[2],h=e[6],p=e[10],y=e[14],v=e[3],w=e[7],b=e[11],_=e[15],E=c*y-u*p,M=o*y-u*h,T=o*p-c*h,R=s*y-u*f,A=s*p-c*f,P=s*h-o*f;return n*(w*E-b*M+_*T)-r*(v*E-b*R+_*A)+i*(v*M-w*R+_*P)-a*(v*T-w*A+b*P)}transpose(){const e=this.elements;let n;return n=e[1],e[1]=e[4],e[4]=n,n=e[2],e[2]=e[8],e[8]=n,n=e[6],e[6]=e[9],e[9]=n,n=e[3],e[3]=e[12],e[12]=n,n=e[7],e[7]=e[13],e[13]=n,n=e[11],e[11]=e[14],e[14]=n,this}setPosition(e,n,r){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=n,i[14]=r),this}invert(){const e=this.elements,n=e[0],r=e[1],i=e[2],a=e[3],s=e[4],o=e[5],c=e[6],u=e[7],f=e[8],h=e[9],p=e[10],y=e[11],v=e[12],w=e[13],b=e[14],_=e[15],E=n*o-r*s,M=n*c-i*s,T=n*u-a*s,R=r*c-i*o,A=r*u-a*o,P=i*u-a*c,k=f*w-h*v,N=f*b-p*v,j=f*_-y*v,L=h*b-p*w,z=h*_-y*w,U=p*_-y*b,V=E*U-M*z+T*L+R*j-A*N+P*k;if(V===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const W=1/V;return e[0]=(o*U-c*z+u*L)*W,e[1]=(i*z-r*U-a*L)*W,e[2]=(w*P-b*A+_*R)*W,e[3]=(p*A-h*P-y*R)*W,e[4]=(c*j-s*U-u*N)*W,e[5]=(n*U-i*j+a*N)*W,e[6]=(b*T-v*P-_*M)*W,e[7]=(f*P-p*T+y*M)*W,e[8]=(s*z-o*j+u*k)*W,e[9]=(r*j-n*z-a*k)*W,e[10]=(v*A-w*T+_*E)*W,e[11]=(h*T-f*A-y*E)*W,e[12]=(o*N-s*L-c*k)*W,e[13]=(n*L-r*N+i*k)*W,e[14]=(w*M-v*R-b*E)*W,e[15]=(f*R-h*M+p*E)*W,this}scale(e){const n=this.elements,r=e.x,i=e.y,a=e.z;return n[0]*=r,n[4]*=i,n[8]*=a,n[1]*=r,n[5]*=i,n[9]*=a,n[2]*=r,n[6]*=i,n[10]*=a,n[3]*=r,n[7]*=i,n[11]*=a,this}getMaxScaleOnAxis(){const e=this.elements,n=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(n,r,i))}makeTranslation(e,n,r){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,n,0,0,1,r,0,0,0,1),this}makeRotationX(e){const n=Math.cos(e),r=Math.sin(e);return this.set(1,0,0,0,0,n,-r,0,0,r,n,0,0,0,0,1),this}makeRotationY(e){const n=Math.cos(e),r=Math.sin(e);return this.set(n,0,r,0,0,1,0,0,-r,0,n,0,0,0,0,1),this}makeRotationZ(e){const n=Math.cos(e),r=Math.sin(e);return this.set(n,-r,0,0,r,n,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,n){const r=Math.cos(n),i=Math.sin(n),a=1-r,s=e.x,o=e.y,c=e.z,u=a*s,f=a*o;return this.set(u*s+r,u*o-i*c,u*c+i*o,0,u*o+i*c,f*o+r,f*c-i*s,0,u*c-i*o,f*c+i*s,a*c*c+r,0,0,0,0,1),this}makeScale(e,n,r){return this.set(e,0,0,0,0,n,0,0,0,0,r,0,0,0,0,1),this}makeShear(e,n,r,i,a,s){return this.set(1,r,a,0,e,1,s,0,n,i,1,0,0,0,0,1),this}compose(e,n,r){const i=this.elements,a=n._x,s=n._y,o=n._z,c=n._w,u=a+a,f=s+s,h=o+o,p=a*u,y=a*f,v=a*h,w=s*f,b=s*h,_=o*h,E=c*u,M=c*f,T=c*h,R=r.x,A=r.y,P=r.z;return i[0]=(1-(w+_))*R,i[1]=(y+T)*R,i[2]=(v-M)*R,i[3]=0,i[4]=(y-T)*A,i[5]=(1-(p+_))*A,i[6]=(b+E)*A,i[7]=0,i[8]=(v+M)*P,i[9]=(b-E)*P,i[10]=(1-(p+w))*P,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,n,r){const i=this.elements;e.x=i[12],e.y=i[13],e.z=i[14];const a=this.determinant();if(a===0)return r.set(1,1,1),n.identity(),this;let s=Qu.set(i[0],i[1],i[2]).length();const o=Qu.set(i[4],i[5],i[6]).length(),c=Qu.set(i[8],i[9],i[10]).length();a<0&&(s=-s),Wa.copy(this);const u=1/s,f=1/o,h=1/c;return Wa.elements[0]*=u,Wa.elements[1]*=u,Wa.elements[2]*=u,Wa.elements[4]*=f,Wa.elements[5]*=f,Wa.elements[6]*=f,Wa.elements[8]*=h,Wa.elements[9]*=h,Wa.elements[10]*=h,n.setFromRotationMatrix(Wa),r.x=s,r.y=o,r.z=c,this}makePerspective(e,n,r,i,a,s,o=Ns,c=!1){const u=this.elements,f=2*a/(n-e),h=2*a/(r-i),p=(n+e)/(n-e),y=(r+i)/(r-i);let v,w;if(c)v=a/(s-a),w=s*a/(s-a);else if(o===Ns)v=-(s+a)/(s-a),w=-2*s*a/(s-a);else if(o===yy)v=-s/(s-a),w=-s*a/(s-a);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return u[0]=f,u[4]=0,u[8]=p,u[12]=0,u[1]=0,u[5]=h,u[9]=y,u[13]=0,u[2]=0,u[6]=0,u[10]=v,u[14]=w,u[3]=0,u[7]=0,u[11]=-1,u[15]=0,this}makeOrthographic(e,n,r,i,a,s,o=Ns,c=!1){const u=this.elements,f=2/(n-e),h=2/(r-i),p=-(n+e)/(n-e),y=-(r+i)/(r-i);let v,w;if(c)v=1/(s-a),w=s/(s-a);else if(o===Ns)v=-2/(s-a),w=-(s+a)/(s-a);else if(o===yy)v=-1/(s-a),w=-a/(s-a);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return u[0]=f,u[4]=0,u[8]=0,u[12]=p,u[1]=0,u[5]=h,u[9]=0,u[13]=y,u[2]=0,u[6]=0,u[10]=v,u[14]=w,u[3]=0,u[7]=0,u[11]=0,u[15]=1,this}equals(e){const n=this.elements,r=e.elements;for(let i=0;i<16;i++)if(n[i]!==r[i])return!1;return!0}fromArray(e,n=0){for(let r=0;r<16;r++)this.elements[r]=e[r+n];return this}toArray(e=[],n=0){const r=this.elements;return e[n]=r[0],e[n+1]=r[1],e[n+2]=r[2],e[n+3]=r[3],e[n+4]=r[4],e[n+5]=r[5],e[n+6]=r[6],e[n+7]=r[7],e[n+8]=r[8],e[n+9]=r[9],e[n+10]=r[10],e[n+11]=r[11],e[n+12]=r[12],e[n+13]=r[13],e[n+14]=r[14],e[n+15]=r[15],e}}const Qu=new Oe,Wa=new Nr,nce=new Oe(0,0,0),rce=new Oe(1,1,1),ol=new Oe,Ag=new Oe,Qi=new Oe,QP=new Nr,eN=new ff;let nu=class rU{constructor(e=0,n=0,r=0,i=rU.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=n,this._z=r,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,n,r,i=this._order){return this._x=e,this._y=n,this._z=r,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,n=this._order,r=!0){const i=e.elements,a=i[0],s=i[4],o=i[8],c=i[1],u=i[5],f=i[9],h=i[2],p=i[6],y=i[10];switch(n){case"XYZ":this._y=Math.asin(Dn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-f,y),this._z=Math.atan2(-s,a)):(this._x=Math.atan2(p,u),this._z=0);break;case"YXZ":this._x=Math.asin(-Dn(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(o,y),this._z=Math.atan2(c,u)):(this._y=Math.atan2(-h,a),this._z=0);break;case"ZXY":this._x=Math.asin(Dn(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-h,y),this._z=Math.atan2(-s,u)):(this._y=0,this._z=Math.atan2(c,a));break;case"ZYX":this._y=Math.asin(-Dn(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(p,y),this._z=Math.atan2(c,a)):(this._x=0,this._z=Math.atan2(-s,u));break;case"YZX":this._z=Math.asin(Dn(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-f,u),this._y=Math.atan2(-h,a)):(this._x=0,this._y=Math.atan2(o,y));break;case"XZY":this._z=Math.asin(-Dn(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(p,u),this._y=Math.atan2(o,a)):(this._x=Math.atan2(-f,y),this._y=0);break;default:ln("Euler: .setFromRotationMatrix() encountered an unknown order: "+n)}return this._order=n,r===!0&&this._onChangeCallback(),this}setFromQuaternion(e,n,r){return QP.makeRotationFromQuaternion(e),this.setFromRotationMatrix(QP,n,r)}setFromVector3(e,n=this._order){return this.set(e.x,e.y,e.z,n)}reorder(e){return eN.setFromEuler(this),this.setFromQuaternion(eN,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};nu.DEFAULT_ORDER="XYZ";class iU{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let ice=0;const tN=new Oe,ed=new ff,uo=new Nr,Rg=new Oe,fh=new Oe,ace=new Oe,sce=new ff,nN=new Oe(1,0,0),rN=new Oe(0,1,0),iN=new Oe(0,0,1),aN={type:"added"},oce={type:"removed"},td={type:"childadded",child:null},O_={type:"childremoved",child:null};class la extends df{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:ice++}),this.uuid=Bp(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=la.DEFAULT_UP.clone();const e=new Oe,n=new nu,r=new ff,i=new Oe(1,1,1);function a(){r.setFromEuler(n,!1)}function s(){n.setFromQuaternion(r,void 0,!1)}n._onChange(a),r._onChange(s),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:n},quaternion:{configurable:!0,enumerable:!0,value:r},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Nr},normalMatrix:{value:new pn}}),this.matrix=new Nr,this.matrixWorld=new Nr,this.matrixAutoUpdate=la.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=la.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new iU,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,n){this.quaternion.setFromAxisAngle(e,n)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,n){return ed.setFromAxisAngle(e,n),this.quaternion.multiply(ed),this}rotateOnWorldAxis(e,n){return ed.setFromAxisAngle(e,n),this.quaternion.premultiply(ed),this}rotateX(e){return this.rotateOnAxis(nN,e)}rotateY(e){return this.rotateOnAxis(rN,e)}rotateZ(e){return this.rotateOnAxis(iN,e)}translateOnAxis(e,n){return tN.copy(e).applyQuaternion(this.quaternion),this.position.add(tN.multiplyScalar(n)),this}translateX(e){return this.translateOnAxis(nN,e)}translateY(e){return this.translateOnAxis(rN,e)}translateZ(e){return this.translateOnAxis(iN,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(uo.copy(this.matrixWorld).invert())}lookAt(e,n,r){e.isVector3?Rg.copy(e):Rg.set(e,n,r);const i=this.parent;this.updateWorldMatrix(!0,!1),fh.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?uo.lookAt(fh,Rg,this.up):uo.lookAt(Rg,fh,this.up),this.quaternion.setFromRotationMatrix(uo),i&&(uo.extractRotation(i.matrixWorld),ed.setFromRotationMatrix(uo),this.quaternion.premultiply(ed.invert()))}add(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.add(arguments[n]);return this}return e===this?(Vn("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(aN),td.child=e,this.dispatchEvent(td),td.child=null):Vn("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let r=0;r<arguments.length;r++)this.remove(arguments[r]);return this}const n=this.children.indexOf(e);return n!==-1&&(e.parent=null,this.children.splice(n,1),e.dispatchEvent(oce),O_.child=e,this.dispatchEvent(O_),O_.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),uo.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),uo.multiply(e.parent.matrixWorld)),e.applyMatrix4(uo),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(aN),td.child=e,this.dispatchEvent(td),td.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,n){if(this[e]===n)return this;for(let r=0,i=this.children.length;r<i;r++){const s=this.children[r].getObjectByProperty(e,n);if(s!==void 0)return s}}getObjectsByProperty(e,n,r=[]){this[e]===n&&r.push(this);const i=this.children;for(let a=0,s=i.length;a<s;a++)i[a].getObjectsByProperty(e,n,r);return r}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(fh,e,ace),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(fh,sce,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const n=this.matrixWorld.elements;return e.set(n[8],n[9],n[10]).normalize()}raycast(){}traverse(e){e(this);const n=this.children;for(let r=0,i=n.length;r<i;r++)n[r].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const n=this.children;for(let r=0,i=n.length;r<i;r++)n[r].traverseVisible(e)}traverseAncestors(e){const n=this.parent;n!==null&&(e(n),n.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);const e=this.pivot;if(e!==null){const n=e.x,r=e.y,i=e.z,a=this.matrix.elements;a[12]+=n-a[0]*n-a[4]*r-a[8]*i,a[13]+=r-a[1]*n-a[5]*r-a[9]*i,a[14]+=i-a[2]*n-a[6]*r-a[10]*i}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const n=this.children;for(let r=0,i=n.length;r<i;r++)n[r].updateMatrixWorld(e)}updateWorldMatrix(e,n){const r=this.parent;if(e===!0&&r!==null&&r.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),n===!0){const i=this.children;for(let a=0,s=i.length;a<s;a++)i[a].updateWorldMatrix(!1,!0)}}toJSON(e){const n=e===void 0||typeof e=="string",r={};n&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},r.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),this.static!==!1&&(i.static=this.static),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.pivot!==null&&(i.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(i.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(i.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(o=>({...o})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function a(o,c){return o[c.uuid]===void 0&&(o[c.uuid]=c.toJSON(e)),c.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=a(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const c=o.shapes;if(Array.isArray(c))for(let u=0,f=c.length;u<f;u++){const h=c[u];a(e.shapes,h)}else a(e.shapes,c)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(a(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let c=0,u=this.material.length;c<u;c++)o.push(a(e.materials,this.material[c]));i.material=o}else i.material=a(e.materials,this.material);if(this.children.length>0){i.children=[];for(let o=0;o<this.children.length;o++)i.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let o=0;o<this.animations.length;o++){const c=this.animations[o];i.animations.push(a(e.animations,c))}}if(n){const o=s(e.geometries),c=s(e.materials),u=s(e.textures),f=s(e.images),h=s(e.shapes),p=s(e.skeletons),y=s(e.animations),v=s(e.nodes);o.length>0&&(r.geometries=o),c.length>0&&(r.materials=c),u.length>0&&(r.textures=u),f.length>0&&(r.images=f),h.length>0&&(r.shapes=h),p.length>0&&(r.skeletons=p),y.length>0&&(r.animations=y),v.length>0&&(r.nodes=v)}return r.object=i,r;function s(o){const c=[];for(const u in o){const f=o[u];delete f.metadata,c.push(f)}return c}}clone(e){return new this.constructor().copy(this,e)}copy(e,n=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),e.pivot!==null&&(this.pivot=e.pivot.clone()),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),n===!0)for(let r=0;r<e.children.length;r++){const i=e.children[r];this.add(i.clone())}return this}}la.DEFAULT_UP=new Oe(0,1,0);la.DEFAULT_MATRIX_AUTO_UPDATE=!0;la.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class Pg extends la{constructor(){super(),this.isGroup=!0,this.type="Group"}}const lce={type:"move"};class F_{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Pg,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Pg,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Oe,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Oe),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Pg,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Oe,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Oe),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const n=this._hand;if(n)for(const r of e.hand.values())this._getHandJoint(n,r)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,n,r){let i=null,a=null,s=null;const o=this._targetRay,c=this._grip,u=this._hand;if(e&&n.session.visibilityState!=="visible-blurred"){if(u&&e.hand){s=!0;for(const w of e.hand.values()){const b=n.getJointPose(w,r),_=this._getHandJoint(u,w);b!==null&&(_.matrix.fromArray(b.transform.matrix),_.matrix.decompose(_.position,_.rotation,_.scale),_.matrixWorldNeedsUpdate=!0,_.jointRadius=b.radius),_.visible=b!==null}const f=u.joints["index-finger-tip"],h=u.joints["thumb-tip"],p=f.position.distanceTo(h.position),y=.02,v=.005;u.inputState.pinching&&p>y+v?(u.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!u.inputState.pinching&&p<=y-v&&(u.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else c!==null&&e.gripSpace&&(a=n.getPose(e.gripSpace,r),a!==null&&(c.matrix.fromArray(a.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,a.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(a.linearVelocity)):c.hasLinearVelocity=!1,a.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(a.angularVelocity)):c.hasAngularVelocity=!1));o!==null&&(i=n.getPose(e.targetRaySpace,r),i===null&&a!==null&&(i=a),i!==null&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(lce)))}return o!==null&&(o.visible=i!==null),c!==null&&(c.visible=a!==null),u!==null&&(u.visible=s!==null),this}_getHandJoint(e,n){if(e.joints[n.jointName]===void 0){const r=new Pg;r.matrixAutoUpdate=!1,r.visible=!1,e.joints[n.jointName]=r,e.add(r)}return e.joints[n.jointName]}}const aU={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},ll={h:0,s:0,l:0},Ng={h:0,s:0,l:0};function U_(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*6*(2/3-n):t}class Zn{constructor(e,n,r){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,n,r)}set(e,n,r){if(n===void 0&&r===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,n,r);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,n=wa){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,jn.colorSpaceToWorking(this,n),this}setRGB(e,n,r,i=jn.workingColorSpace){return this.r=e,this.g=n,this.b=r,jn.colorSpaceToWorking(this,i),this}setHSL(e,n,r,i=jn.workingColorSpace){if(e=Xle(e,1),n=Dn(n,0,1),r=Dn(r,0,1),n===0)this.r=this.g=this.b=r;else{const a=r<=.5?r*(1+n):r+n-r*n,s=2*r-a;this.r=U_(s,a,e+1/3),this.g=U_(s,a,e),this.b=U_(s,a,e-1/3)}return jn.colorSpaceToWorking(this,i),this}setStyle(e,n=wa){function r(a){a!==void 0&&parseFloat(a)<1&&ln("Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let a;const s=i[1],o=i[2];switch(s){case"rgb":case"rgba":if(a=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return r(a[4]),this.setRGB(Math.min(255,parseInt(a[1],10))/255,Math.min(255,parseInt(a[2],10))/255,Math.min(255,parseInt(a[3],10))/255,n);if(a=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return r(a[4]),this.setRGB(Math.min(100,parseInt(a[1],10))/100,Math.min(100,parseInt(a[2],10))/100,Math.min(100,parseInt(a[3],10))/100,n);break;case"hsl":case"hsla":if(a=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return r(a[4]),this.setHSL(parseFloat(a[1])/360,parseFloat(a[2])/100,parseFloat(a[3])/100,n);break;default:ln("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const a=i[1],s=a.length;if(s===3)return this.setRGB(parseInt(a.charAt(0),16)/15,parseInt(a.charAt(1),16)/15,parseInt(a.charAt(2),16)/15,n);if(s===6)return this.setHex(parseInt(a,16),n);ln("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}setColorName(e,n=wa){const r=aU[e.toLowerCase()];return r!==void 0?this.setHex(r,n):ln("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Co(e.r),this.g=Co(e.g),this.b=Co(e.b),this}copyLinearToSRGB(e){return this.r=Rd(e.r),this.g=Rd(e.g),this.b=Rd(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=wa){return jn.workingToColorSpace(di.copy(this),e),Math.round(Dn(di.r*255,0,255))*65536+Math.round(Dn(di.g*255,0,255))*256+Math.round(Dn(di.b*255,0,255))}getHexString(e=wa){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,n=jn.workingColorSpace){jn.workingToColorSpace(di.copy(this),n);const r=di.r,i=di.g,a=di.b,s=Math.max(r,i,a),o=Math.min(r,i,a);let c,u;const f=(o+s)/2;if(o===s)c=0,u=0;else{const h=s-o;switch(u=f<=.5?h/(s+o):h/(2-s-o),s){case r:c=(i-a)/h+(i<a?6:0);break;case i:c=(a-r)/h+2;break;case a:c=(r-i)/h+4;break}c/=6}return e.h=c,e.s=u,e.l=f,e}getRGB(e,n=jn.workingColorSpace){return jn.workingToColorSpace(di.copy(this),n),e.r=di.r,e.g=di.g,e.b=di.b,e}getStyle(e=wa){jn.workingToColorSpace(di.copy(this),e);const n=di.r,r=di.g,i=di.b;return e!==wa?`color(${e} ${n.toFixed(3)} ${r.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(n*255)},${Math.round(r*255)},${Math.round(i*255)})`}offsetHSL(e,n,r){return this.getHSL(ll),this.setHSL(ll.h+e,ll.s+n,ll.l+r)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,n){return this.r=e.r+n.r,this.g=e.g+n.g,this.b=e.b+n.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,n){return this.r+=(e.r-this.r)*n,this.g+=(e.g-this.g)*n,this.b+=(e.b-this.b)*n,this}lerpColors(e,n,r){return this.r=e.r+(n.r-e.r)*r,this.g=e.g+(n.g-e.g)*r,this.b=e.b+(n.b-e.b)*r,this}lerpHSL(e,n){this.getHSL(ll),e.getHSL(Ng);const r=P_(ll.h,Ng.h,n),i=P_(ll.s,Ng.s,n),a=P_(ll.l,Ng.l,n);return this.setHSL(r,i,a),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const n=this.r,r=this.g,i=this.b,a=e.elements;return this.r=a[0]*n+a[3]*r+a[6]*i,this.g=a[1]*n+a[4]*r+a[7]*i,this.b=a[2]*n+a[5]*r+a[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,n=0){return this.r=e[n],this.g=e[n+1],this.b=e[n+2],this}toArray(e=[],n=0){return e[n]=this.r,e[n+1]=this.g,e[n+2]=this.b,e}fromBufferAttribute(e,n){return this.r=e.getX(n),this.g=e.getY(n),this.b=e.getZ(n),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const di=new Zn;Zn.NAMES=aU;class cce extends la{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new nu,this.environmentIntensity=1,this.environmentRotation=new nu,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,n){return super.copy(e,n),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const n=super.toJSON(e);return this.fog!==null&&(n.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(n.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(n.object.backgroundIntensity=this.backgroundIntensity),n.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(n.object.environmentIntensity=this.environmentIntensity),n.object.environmentRotation=this.environmentRotation.toArray(),n}}const Ga=new Oe,fo=new Oe,j_=new Oe,ho=new Oe,nd=new Oe,rd=new Oe,sN=new Oe,B_=new Oe,z_=new Oe,V_=new Oe,H_=new yr,W_=new yr,G_=new yr;let hh=class yd{constructor(e=new Oe,n=new Oe,r=new Oe){this.a=e,this.b=n,this.c=r}static getNormal(e,n,r,i){i.subVectors(r,n),Ga.subVectors(e,n),i.cross(Ga);const a=i.lengthSq();return a>0?i.multiplyScalar(1/Math.sqrt(a)):i.set(0,0,0)}static getBarycoord(e,n,r,i,a){Ga.subVectors(i,n),fo.subVectors(r,n),j_.subVectors(e,n);const s=Ga.dot(Ga),o=Ga.dot(fo),c=Ga.dot(j_),u=fo.dot(fo),f=fo.dot(j_),h=s*u-o*o;if(h===0)return a.set(0,0,0),null;const p=1/h,y=(u*c-o*f)*p,v=(s*f-o*c)*p;return a.set(1-y-v,v,y)}static containsPoint(e,n,r,i){return this.getBarycoord(e,n,r,i,ho)===null?!1:ho.x>=0&&ho.y>=0&&ho.x+ho.y<=1}static getInterpolation(e,n,r,i,a,s,o,c){return this.getBarycoord(e,n,r,i,ho)===null?(c.x=0,c.y=0,"z"in c&&(c.z=0),"w"in c&&(c.w=0),null):(c.setScalar(0),c.addScaledVector(a,ho.x),c.addScaledVector(s,ho.y),c.addScaledVector(o,ho.z),c)}static getInterpolatedAttribute(e,n,r,i,a,s){return H_.setScalar(0),W_.setScalar(0),G_.setScalar(0),H_.fromBufferAttribute(e,n),W_.fromBufferAttribute(e,r),G_.fromBufferAttribute(e,i),s.setScalar(0),s.addScaledVector(H_,a.x),s.addScaledVector(W_,a.y),s.addScaledVector(G_,a.z),s}static isFrontFacing(e,n,r,i){return Ga.subVectors(r,n),fo.subVectors(e,n),Ga.cross(fo).dot(i)<0}set(e,n,r){return this.a.copy(e),this.b.copy(n),this.c.copy(r),this}setFromPointsAndIndices(e,n,r,i){return this.a.copy(e[n]),this.b.copy(e[r]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,n,r,i){return this.a.fromBufferAttribute(e,n),this.b.fromBufferAttribute(e,r),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Ga.subVectors(this.c,this.b),fo.subVectors(this.a,this.b),Ga.cross(fo).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return yd.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,n){return yd.getBarycoord(e,this.a,this.b,this.c,n)}getInterpolation(e,n,r,i,a){return yd.getInterpolation(e,this.a,this.b,this.c,n,r,i,a)}containsPoint(e){return yd.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return yd.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,n){const r=this.a,i=this.b,a=this.c;let s,o;nd.subVectors(i,r),rd.subVectors(a,r),B_.subVectors(e,r);const c=nd.dot(B_),u=rd.dot(B_);if(c<=0&&u<=0)return n.copy(r);z_.subVectors(e,i);const f=nd.dot(z_),h=rd.dot(z_);if(f>=0&&h<=f)return n.copy(i);const p=c*h-f*u;if(p<=0&&c>=0&&f<=0)return s=c/(c-f),n.copy(r).addScaledVector(nd,s);V_.subVectors(e,a);const y=nd.dot(V_),v=rd.dot(V_);if(v>=0&&y<=v)return n.copy(a);const w=y*u-c*v;if(w<=0&&u>=0&&v<=0)return o=u/(u-v),n.copy(r).addScaledVector(rd,o);const b=f*v-y*h;if(b<=0&&h-f>=0&&y-v>=0)return sN.subVectors(a,i),o=(h-f)/(h-f+(y-v)),n.copy(i).addScaledVector(sN,o);const _=1/(b+w+p);return s=w*_,o=p*_,n.copy(r).addScaledVector(nd,s).addScaledVector(rd,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}};class zp{constructor(e=new Oe(1/0,1/0,1/0),n=new Oe(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=n}set(e,n){return this.min.copy(e),this.max.copy(n),this}setFromArray(e){this.makeEmpty();for(let n=0,r=e.length;n<r;n+=3)this.expandByPoint($a.fromArray(e,n));return this}setFromBufferAttribute(e){this.makeEmpty();for(let n=0,r=e.count;n<r;n++)this.expandByPoint($a.fromBufferAttribute(e,n));return this}setFromPoints(e){this.makeEmpty();for(let n=0,r=e.length;n<r;n++)this.expandByPoint(e[n]);return this}setFromCenterAndSize(e,n){const r=$a.copy(n).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this}setFromObject(e,n=!1){return this.makeEmpty(),this.expandByObject(e,n)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,n=!1){e.updateWorldMatrix(!1,!1);const r=e.geometry;if(r!==void 0){const a=r.getAttribute("position");if(n===!0&&a!==void 0&&e.isInstancedMesh!==!0)for(let s=0,o=a.count;s<o;s++)e.isMesh===!0?e.getVertexPosition(s,$a):$a.fromBufferAttribute(a,s),$a.applyMatrix4(e.matrixWorld),this.expandByPoint($a);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Dg.copy(e.boundingBox)):(r.boundingBox===null&&r.computeBoundingBox(),Dg.copy(r.boundingBox)),Dg.applyMatrix4(e.matrixWorld),this.union(Dg)}const i=e.children;for(let a=0,s=i.length;a<s;a++)this.expandByObject(i[a],n);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,n){return n.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,$a),$a.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let n,r;return e.normal.x>0?(n=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(n=e.normal.x*this.max.x,r=e.normal.x*this.min.x),e.normal.y>0?(n+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(n+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),e.normal.z>0?(n+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(n+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),n<=-e.constant&&r>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(ph),Lg.subVectors(this.max,ph),id.subVectors(e.a,ph),ad.subVectors(e.b,ph),sd.subVectors(e.c,ph),cl.subVectors(ad,id),ul.subVectors(sd,ad),mc.subVectors(id,sd);let n=[0,-cl.z,cl.y,0,-ul.z,ul.y,0,-mc.z,mc.y,cl.z,0,-cl.x,ul.z,0,-ul.x,mc.z,0,-mc.x,-cl.y,cl.x,0,-ul.y,ul.x,0,-mc.y,mc.x,0];return!$_(n,id,ad,sd,Lg)||(n=[1,0,0,0,1,0,0,0,1],!$_(n,id,ad,sd,Lg))?!1:(Ig.crossVectors(cl,ul),n=[Ig.x,Ig.y,Ig.z],$_(n,id,ad,sd,Lg))}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,$a).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize($a).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(po[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),po[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),po[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),po[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),po[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),po[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),po[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),po[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(po),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const po=[new Oe,new Oe,new Oe,new Oe,new Oe,new Oe,new Oe,new Oe],$a=new Oe,Dg=new zp,id=new Oe,ad=new Oe,sd=new Oe,cl=new Oe,ul=new Oe,mc=new Oe,ph=new Oe,Lg=new Oe,Ig=new Oe,gc=new Oe;function $_(t,e,n,r,i){for(let a=0,s=t.length-3;a<=s;a+=3){gc.fromArray(t,a);const o=i.x*Math.abs(gc.x)+i.y*Math.abs(gc.y)+i.z*Math.abs(gc.z),c=e.dot(gc),u=n.dot(gc),f=r.dot(gc);if(Math.max(-Math.max(c,u,f),Math.min(c,u,f))>o)return!1}return!0}const Er=new Oe,Og=new Gn;let uce=0;class is{constructor(e,n,r=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:uce++}),this.name="",this.array=e,this.itemSize=n,this.count=e!==void 0?e.length/n:0,this.normalized=r,this.usage=$P,this.updateRanges=[],this.gpuType=Ps,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,n){this.updateRanges.push({start:e,count:n})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,n,r){e*=this.itemSize,r*=n.itemSize;for(let i=0,a=this.itemSize;i<a;i++)this.array[e+i]=n.array[r+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let n=0,r=this.count;n<r;n++)Og.fromBufferAttribute(this,n),Og.applyMatrix3(e),this.setXY(n,Og.x,Og.y);else if(this.itemSize===3)for(let n=0,r=this.count;n<r;n++)Er.fromBufferAttribute(this,n),Er.applyMatrix3(e),this.setXYZ(n,Er.x,Er.y,Er.z);return this}applyMatrix4(e){for(let n=0,r=this.count;n<r;n++)Er.fromBufferAttribute(this,n),Er.applyMatrix4(e),this.setXYZ(n,Er.x,Er.y,Er.z);return this}applyNormalMatrix(e){for(let n=0,r=this.count;n<r;n++)Er.fromBufferAttribute(this,n),Er.applyNormalMatrix(e),this.setXYZ(n,Er.x,Er.y,Er.z);return this}transformDirection(e){for(let n=0,r=this.count;n<r;n++)Er.fromBufferAttribute(this,n),Er.transformDirection(e),this.setXYZ(n,Er.x,Er.y,Er.z);return this}set(e,n=0){return this.array.set(e,n),this}getComponent(e,n){let r=this.array[e*this.itemSize+n];return this.normalized&&(r=dh(r,this.array)),r}setComponent(e,n,r){return this.normalized&&(r=Ii(r,this.array)),this.array[e*this.itemSize+n]=r,this}getX(e){let n=this.array[e*this.itemSize];return this.normalized&&(n=dh(n,this.array)),n}setX(e,n){return this.normalized&&(n=Ii(n,this.array)),this.array[e*this.itemSize]=n,this}getY(e){let n=this.array[e*this.itemSize+1];return this.normalized&&(n=dh(n,this.array)),n}setY(e,n){return this.normalized&&(n=Ii(n,this.array)),this.array[e*this.itemSize+1]=n,this}getZ(e){let n=this.array[e*this.itemSize+2];return this.normalized&&(n=dh(n,this.array)),n}setZ(e,n){return this.normalized&&(n=Ii(n,this.array)),this.array[e*this.itemSize+2]=n,this}getW(e){let n=this.array[e*this.itemSize+3];return this.normalized&&(n=dh(n,this.array)),n}setW(e,n){return this.normalized&&(n=Ii(n,this.array)),this.array[e*this.itemSize+3]=n,this}setXY(e,n,r){return e*=this.itemSize,this.normalized&&(n=Ii(n,this.array),r=Ii(r,this.array)),this.array[e+0]=n,this.array[e+1]=r,this}setXYZ(e,n,r,i){return e*=this.itemSize,this.normalized&&(n=Ii(n,this.array),r=Ii(r,this.array),i=Ii(i,this.array)),this.array[e+0]=n,this.array[e+1]=r,this.array[e+2]=i,this}setXYZW(e,n,r,i,a){return e*=this.itemSize,this.normalized&&(n=Ii(n,this.array),r=Ii(r,this.array),i=Ii(i,this.array),a=Ii(a,this.array)),this.array[e+0]=n,this.array[e+1]=r,this.array[e+2]=i,this.array[e+3]=a,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==$P&&(e.usage=this.usage),e}}class sU extends is{constructor(e,n,r){super(new Uint16Array(e),n,r)}}class oU extends is{constructor(e,n,r){super(new Uint32Array(e),n,r)}}class Ao extends is{constructor(e,n,r){super(new Float32Array(e),n,r)}}const dce=new zp,mh=new Oe,Y_=new Oe;class eM{constructor(e=new Oe,n=-1){this.isSphere=!0,this.center=e,this.radius=n}set(e,n){return this.center.copy(e),this.radius=n,this}setFromPoints(e,n){const r=this.center;n!==void 0?r.copy(n):dce.setFromPoints(e).getCenter(r);let i=0;for(let a=0,s=e.length;a<s;a++)i=Math.max(i,r.distanceToSquared(e[a]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const n=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=n*n}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,n){const r=this.center.distanceToSquared(e);return n.copy(e),r>this.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;mh.subVectors(e,this.center);const n=mh.lengthSq();if(n>this.radius*this.radius){const r=Math.sqrt(n),i=(r-this.radius)*.5;this.center.addScaledVector(mh,i/r),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Y_.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(mh.copy(e.center).add(Y_)),this.expandByPoint(mh.copy(e.center).sub(Y_))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}let fce=0;const va=new Nr,q_=new la,od=new Oe,ea=new zp,gh=new zp,Yr=new Oe;class Js extends df{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:fce++}),this.uuid=Bp(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(Gle(e)?oU:sU)(e,1):this.index=e,this}setIndirect(e,n=0){return this.indirect=e,this.indirectOffset=n,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,n){return this.attributes[e]=n,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,n,r=0){this.groups.push({start:e,count:n,materialIndex:r})}clearGroups(){this.groups=[]}setDrawRange(e,n){this.drawRange.start=e,this.drawRange.count=n}applyMatrix4(e){const n=this.attributes.position;n!==void 0&&(n.applyMatrix4(e),n.needsUpdate=!0);const r=this.attributes.normal;if(r!==void 0){const a=new pn().getNormalMatrix(e);r.applyNormalMatrix(a),r.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return va.makeRotationFromQuaternion(e),this.applyMatrix4(va),this}rotateX(e){return va.makeRotationX(e),this.applyMatrix4(va),this}rotateY(e){return va.makeRotationY(e),this.applyMatrix4(va),this}rotateZ(e){return va.makeRotationZ(e),this.applyMatrix4(va),this}translate(e,n,r){return va.makeTranslation(e,n,r),this.applyMatrix4(va),this}scale(e,n,r){return va.makeScale(e,n,r),this.applyMatrix4(va),this}lookAt(e){return q_.lookAt(e),q_.updateMatrix(),this.applyMatrix4(q_.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(od).negate(),this.translate(od.x,od.y,od.z),this}setFromPoints(e){const n=this.getAttribute("position");if(n===void 0){const r=[];for(let i=0,a=e.length;i<a;i++){const s=e[i];r.push(s.x,s.y,s.z||0)}this.setAttribute("position",new Ao(r,3))}else{const r=Math.min(e.length,n.count);for(let i=0;i<r;i++){const a=e[i];n.setXYZ(i,a.x,a.y,a.z||0)}e.length>n.count&&ln("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),n.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new zp);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Vn("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new Oe(-1/0,-1/0,-1/0),new Oe(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),n)for(let r=0,i=n.length;r<i;r++){const a=n[r];ea.setFromBufferAttribute(a),this.morphTargetsRelative?(Yr.addVectors(this.boundingBox.min,ea.min),this.boundingBox.expandByPoint(Yr),Yr.addVectors(this.boundingBox.max,ea.max),this.boundingBox.expandByPoint(Yr)):(this.boundingBox.expandByPoint(ea.min),this.boundingBox.expandByPoint(ea.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Vn('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new eM);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Vn("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new Oe,1/0);return}if(e){const r=this.boundingSphere.center;if(ea.setFromBufferAttribute(e),n)for(let a=0,s=n.length;a<s;a++){const o=n[a];gh.setFromBufferAttribute(o),this.morphTargetsRelative?(Yr.addVectors(ea.min,gh.min),ea.expandByPoint(Yr),Yr.addVectors(ea.max,gh.max),ea.expandByPoint(Yr)):(ea.expandByPoint(gh.min),ea.expandByPoint(gh.max))}ea.getCenter(r);let i=0;for(let a=0,s=e.count;a<s;a++)Yr.fromBufferAttribute(e,a),i=Math.max(i,r.distanceToSquared(Yr));if(n)for(let a=0,s=n.length;a<s;a++){const o=n[a],c=this.morphTargetsRelative;for(let u=0,f=o.count;u<f;u++)Yr.fromBufferAttribute(o,u),c&&(od.fromBufferAttribute(e,u),Yr.add(od)),i=Math.max(i,r.distanceToSquared(Yr))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&Vn('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,n=this.attributes;if(e===null||n.position===void 0||n.normal===void 0||n.uv===void 0){Vn("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const r=n.position,i=n.normal,a=n.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new is(new Float32Array(4*r.count),4));const s=this.getAttribute("tangent"),o=[],c=[];for(let k=0;k<r.count;k++)o[k]=new Oe,c[k]=new Oe;const u=new Oe,f=new Oe,h=new Oe,p=new Gn,y=new Gn,v=new Gn,w=new Oe,b=new Oe;function _(k,N,j){u.fromBufferAttribute(r,k),f.fromBufferAttribute(r,N),h.fromBufferAttribute(r,j),p.fromBufferAttribute(a,k),y.fromBufferAttribute(a,N),v.fromBufferAttribute(a,j),f.sub(u),h.sub(u),y.sub(p),v.sub(p);const L=1/(y.x*v.y-v.x*y.y);isFinite(L)&&(w.copy(f).multiplyScalar(v.y).addScaledVector(h,-y.y).multiplyScalar(L),b.copy(h).multiplyScalar(y.x).addScaledVector(f,-v.x).multiplyScalar(L),o[k].add(w),o[N].add(w),o[j].add(w),c[k].add(b),c[N].add(b),c[j].add(b))}let E=this.groups;E.length===0&&(E=[{start:0,count:e.count}]);for(let k=0,N=E.length;k<N;++k){const j=E[k],L=j.start,z=j.count;for(let U=L,V=L+z;U<V;U+=3)_(e.getX(U+0),e.getX(U+1),e.getX(U+2))}const M=new Oe,T=new Oe,R=new Oe,A=new Oe;function P(k){R.fromBufferAttribute(i,k),A.copy(R);const N=o[k];M.copy(N),M.sub(R.multiplyScalar(R.dot(N))).normalize(),T.crossVectors(A,N);const L=T.dot(c[k])<0?-1:1;s.setXYZW(k,M.x,M.y,M.z,L)}for(let k=0,N=E.length;k<N;++k){const j=E[k],L=j.start,z=j.count;for(let U=L,V=L+z;U<V;U+=3)P(e.getX(U+0)),P(e.getX(U+1)),P(e.getX(U+2))}}computeVertexNormals(){const e=this.index,n=this.getAttribute("position");if(n!==void 0){let r=this.getAttribute("normal");if(r===void 0)r=new is(new Float32Array(n.count*3),3),this.setAttribute("normal",r);else for(let p=0,y=r.count;p<y;p++)r.setXYZ(p,0,0,0);const i=new Oe,a=new Oe,s=new Oe,o=new Oe,c=new Oe,u=new Oe,f=new Oe,h=new Oe;if(e)for(let p=0,y=e.count;p<y;p+=3){const v=e.getX(p+0),w=e.getX(p+1),b=e.getX(p+2);i.fromBufferAttribute(n,v),a.fromBufferAttribute(n,w),s.fromBufferAttribute(n,b),f.subVectors(s,a),h.subVectors(i,a),f.cross(h),o.fromBufferAttribute(r,v),c.fromBufferAttribute(r,w),u.fromBufferAttribute(r,b),o.add(f),c.add(f),u.add(f),r.setXYZ(v,o.x,o.y,o.z),r.setXYZ(w,c.x,c.y,c.z),r.setXYZ(b,u.x,u.y,u.z)}else for(let p=0,y=n.count;p<y;p+=3)i.fromBufferAttribute(n,p+0),a.fromBufferAttribute(n,p+1),s.fromBufferAttribute(n,p+2),f.subVectors(s,a),h.subVectors(i,a),f.cross(h),r.setXYZ(p+0,f.x,f.y,f.z),r.setXYZ(p+1,f.x,f.y,f.z),r.setXYZ(p+2,f.x,f.y,f.z);this.normalizeNormals(),r.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let n=0,r=e.count;n<r;n++)Yr.fromBufferAttribute(e,n),Yr.normalize(),e.setXYZ(n,Yr.x,Yr.y,Yr.z)}toNonIndexed(){function e(o,c){const u=o.array,f=o.itemSize,h=o.normalized,p=new u.constructor(c.length*f);let y=0,v=0;for(let w=0,b=c.length;w<b;w++){o.isInterleavedBufferAttribute?y=c[w]*o.data.stride+o.offset:y=c[w]*f;for(let _=0;_<f;_++)p[v++]=u[y++]}return new is(p,f,h)}if(this.index===null)return ln("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const n=new Js,r=this.index.array,i=this.attributes;for(const o in i){const c=i[o],u=e(c,r);n.setAttribute(o,u)}const a=this.morphAttributes;for(const o in a){const c=[],u=a[o];for(let f=0,h=u.length;f<h;f++){const p=u[f],y=e(p,r);c.push(y)}n.morphAttributes[o]=c}n.morphTargetsRelative=this.morphTargetsRelative;const s=this.groups;for(let o=0,c=s.length;o<c;o++){const u=s[o];n.addGroup(u.start,u.count,u.materialIndex)}return n}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const c=this.parameters;for(const u in c)c[u]!==void 0&&(e[u]=c[u]);return e}e.data={attributes:{}};const n=this.index;n!==null&&(e.data.index={type:n.array.constructor.name,array:Array.prototype.slice.call(n.array)});const r=this.attributes;for(const c in r){const u=r[c];e.data.attributes[c]=u.toJSON(e.data)}const i={};let a=!1;for(const c in this.morphAttributes){const u=this.morphAttributes[c],f=[];for(let h=0,p=u.length;h<p;h++){const y=u[h];f.push(y.toJSON(e.data))}f.length>0&&(i[c]=f,a=!0)}a&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const s=this.groups;s.length>0&&(e.data.groups=JSON.parse(JSON.stringify(s)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const n={};this.name=e.name;const r=e.index;r!==null&&this.setIndex(r.clone());const i=e.attributes;for(const u in i){const f=i[u];this.setAttribute(u,f.clone(n))}const a=e.morphAttributes;for(const u in a){const f=[],h=a[u];for(let p=0,y=h.length;p<y;p++)f.push(h[p].clone(n));this.morphAttributes[u]=f}this.morphTargetsRelative=e.morphTargetsRelative;const s=e.groups;for(let u=0,f=s.length;u<f;u++){const h=s[u];this.addGroup(h.start,h.count,h.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const c=e.boundingSphere;return c!==null&&(this.boundingSphere=c.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}let hce=0;class dv extends df{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:hce++}),this.uuid=Bp(),this.name="",this.type="Material",this.blending=Bc,this.side=Il,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=I1,this.blendDst=O1,this.blendEquation=Ec,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Zn(0,0,0),this.blendAlpha=0,this.depthFunc=Gd,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=GP,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Zu,this.stencilZFail=Zu,this.stencilZPass=Zu,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const n in e){const r=e[n];if(r===void 0){ln(`Material: parameter '${n}' has value of undefined.`);continue}const i=this[n];if(i===void 0){ln(`Material: '${n}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(r):i&&i.isVector3&&r&&r.isVector3?i.copy(r):this[n]=r}}toJSON(e){const n=e===void 0||typeof e=="string";n&&(e={textures:{},images:{}});const r={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.color&&this.color.isColor&&(r.color=this.color.getHex()),this.roughness!==void 0&&(r.roughness=this.roughness),this.metalness!==void 0&&(r.metalness=this.metalness),this.sheen!==void 0&&(r.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(r.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(r.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(r.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(r.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(r.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(r.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(r.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(r.shininess=this.shininess),this.clearcoat!==void 0&&(r.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(r.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(r.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(r.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,r.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(r.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(r.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(r.dispersion=this.dispersion),this.iridescence!==void 0&&(r.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(r.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(r.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(r.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(r.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(r.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(r.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(r.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(r.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(r.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(e).uuid,r.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(r.aoMap=this.aoMap.toJSON(e).uuid,r.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(e).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(e).uuid,r.normalMapType=this.normalMapType,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(e).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(r.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(r.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(r.combine=this.combine)),this.envMapRotation!==void 0&&(r.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(r.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(r.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(r.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(r.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(r.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(r.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(r.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(r.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(r.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(r.size=this.size),this.shadowSide!==null&&(r.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(r.sizeAttenuation=this.sizeAttenuation),this.blending!==Bc&&(r.blending=this.blending),this.side!==Il&&(r.side=this.side),this.vertexColors===!0&&(r.vertexColors=!0),this.opacity<1&&(r.opacity=this.opacity),this.transparent===!0&&(r.transparent=!0),this.blendSrc!==I1&&(r.blendSrc=this.blendSrc),this.blendDst!==O1&&(r.blendDst=this.blendDst),this.blendEquation!==Ec&&(r.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(r.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(r.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(r.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(r.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(r.blendAlpha=this.blendAlpha),this.depthFunc!==Gd&&(r.depthFunc=this.depthFunc),this.depthTest===!1&&(r.depthTest=this.depthTest),this.depthWrite===!1&&(r.depthWrite=this.depthWrite),this.colorWrite===!1&&(r.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(r.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==GP&&(r.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(r.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(r.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Zu&&(r.stencilFail=this.stencilFail),this.stencilZFail!==Zu&&(r.stencilZFail=this.stencilZFail),this.stencilZPass!==Zu&&(r.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(r.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(r.rotation=this.rotation),this.polygonOffset===!0&&(r.polygonOffset=!0),this.polygonOffsetFactor!==0&&(r.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(r.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(r.linewidth=this.linewidth),this.dashSize!==void 0&&(r.dashSize=this.dashSize),this.gapSize!==void 0&&(r.gapSize=this.gapSize),this.scale!==void 0&&(r.scale=this.scale),this.dithering===!0&&(r.dithering=!0),this.alphaTest>0&&(r.alphaTest=this.alphaTest),this.alphaHash===!0&&(r.alphaHash=!0),this.alphaToCoverage===!0&&(r.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(r.premultipliedAlpha=!0),this.forceSinglePass===!0&&(r.forceSinglePass=!0),this.allowOverride===!1&&(r.allowOverride=!1),this.wireframe===!0&&(r.wireframe=!0),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(r.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(r.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(r.flatShading=!0),this.visible===!1&&(r.visible=!1),this.toneMapped===!1&&(r.toneMapped=!1),this.fog===!1&&(r.fog=!1),Object.keys(this.userData).length>0&&(r.userData=this.userData);function i(a){const s=[];for(const o in a){const c=a[o];delete c.metadata,s.push(c)}return s}if(n){const a=i(e.textures),s=i(e.images);a.length>0&&(r.textures=a),s.length>0&&(r.images=s)}return r}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const n=e.clippingPlanes;let r=null;if(n!==null){const i=n.length;r=new Array(i);for(let a=0;a!==i;++a)r[a]=n[a].clone()}return this.clippingPlanes=r,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}const mo=new Oe,X_=new Oe,Fg=new Oe,dl=new Oe,K_=new Oe,Ug=new Oe,Z_=new Oe;class pce{constructor(e=new Oe,n=new Oe(0,0,-1)){this.origin=e,this.direction=n}set(e,n){return this.origin.copy(e),this.direction.copy(n),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,n){return n.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,mo)),this}closestPointToPoint(e,n){n.subVectors(e,this.origin);const r=n.dot(this.direction);return r<0?n.copy(this.origin):n.copy(this.origin).addScaledVector(this.direction,r)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const n=mo.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(mo.copy(this.origin).addScaledVector(this.direction,n),mo.distanceToSquared(e))}distanceSqToSegment(e,n,r,i){X_.copy(e).add(n).multiplyScalar(.5),Fg.copy(n).sub(e).normalize(),dl.copy(this.origin).sub(X_);const a=e.distanceTo(n)*.5,s=-this.direction.dot(Fg),o=dl.dot(this.direction),c=-dl.dot(Fg),u=dl.lengthSq(),f=Math.abs(1-s*s);let h,p,y,v;if(f>0)if(h=s*c-o,p=s*o-c,v=a*f,h>=0)if(p>=-v)if(p<=v){const w=1/f;h*=w,p*=w,y=h*(h+s*p+2*o)+p*(s*h+p+2*c)+u}else p=a,h=Math.max(0,-(s*p+o)),y=-h*h+p*(p+2*c)+u;else p=-a,h=Math.max(0,-(s*p+o)),y=-h*h+p*(p+2*c)+u;else p<=-v?(h=Math.max(0,-(-s*a+o)),p=h>0?-a:Math.min(Math.max(-a,-c),a),y=-h*h+p*(p+2*c)+u):p<=v?(h=0,p=Math.min(Math.max(-a,-c),a),y=p*(p+2*c)+u):(h=Math.max(0,-(s*a+o)),p=h>0?a:Math.min(Math.max(-a,-c),a),y=-h*h+p*(p+2*c)+u);else p=s>0?-a:a,h=Math.max(0,-(s*p+o)),y=-h*h+p*(p+2*c)+u;return r&&r.copy(this.origin).addScaledVector(this.direction,h),i&&i.copy(X_).addScaledVector(Fg,p),y}intersectSphere(e,n){mo.subVectors(e.center,this.origin);const r=mo.dot(this.direction),i=mo.dot(mo)-r*r,a=e.radius*e.radius;if(i>a)return null;const s=Math.sqrt(a-i),o=r-s,c=r+s;return c<0?null:o<0?this.at(c,n):this.at(o,n)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const n=e.normal.dot(this.direction);if(n===0)return e.distanceToPoint(this.origin)===0?0:null;const r=-(this.origin.dot(e.normal)+e.constant)/n;return r>=0?r:null}intersectPlane(e,n){const r=this.distanceToPlane(e);return r===null?null:this.at(r,n)}intersectsPlane(e){const n=e.distanceToPoint(this.origin);return n===0||e.normal.dot(this.direction)*n<0}intersectBox(e,n){let r,i,a,s,o,c;const u=1/this.direction.x,f=1/this.direction.y,h=1/this.direction.z,p=this.origin;return u>=0?(r=(e.min.x-p.x)*u,i=(e.max.x-p.x)*u):(r=(e.max.x-p.x)*u,i=(e.min.x-p.x)*u),f>=0?(a=(e.min.y-p.y)*f,s=(e.max.y-p.y)*f):(a=(e.max.y-p.y)*f,s=(e.min.y-p.y)*f),r>s||a>i||((a>r||isNaN(r))&&(r=a),(s<i||isNaN(i))&&(i=s),h>=0?(o=(e.min.z-p.z)*h,c=(e.max.z-p.z)*h):(o=(e.max.z-p.z)*h,c=(e.min.z-p.z)*h),r>c||o>i)||((o>r||r!==r)&&(r=o),(c<i||i!==i)&&(i=c),i<0)?null:this.at(r>=0?r:i,n)}intersectsBox(e){return this.intersectBox(e,mo)!==null}intersectTriangle(e,n,r,i,a){K_.subVectors(n,e),Ug.subVectors(r,e),Z_.crossVectors(K_,Ug);let s=this.direction.dot(Z_),o;if(s>0){if(i)return null;o=1}else if(s<0)o=-1,s=-s;else return null;dl.subVectors(this.origin,e);const c=o*this.direction.dot(Ug.crossVectors(dl,Ug));if(c<0)return null;const u=o*this.direction.dot(K_.cross(dl));if(u<0||c+u>s)return null;const f=-o*dl.dot(Z_);return f<0?null:this.at(f/s,a)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class lU extends dv{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Zn(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new nu,this.combine=j5,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const oN=new Nr,yc=new pce,jg=new eM,lN=new Oe,Bg=new Oe,zg=new Oe,Vg=new Oe,J_=new Oe,Hg=new Oe,cN=new Oe,Wg=new Oe;let Gs=class extends la{constructor(e=new Js,n=new lU){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=n,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,n){return super.copy(e,n),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const n=this.geometry.morphAttributes,r=Object.keys(n);if(r.length>0){const i=n[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let a=0,s=i.length;a<s;a++){const o=i[a].name||String(a);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=a}}}}getVertexPosition(e,n){const r=this.geometry,i=r.attributes.position,a=r.morphAttributes.position,s=r.morphTargetsRelative;n.fromBufferAttribute(i,e);const o=this.morphTargetInfluences;if(a&&o){Hg.set(0,0,0);for(let c=0,u=a.length;c<u;c++){const f=o[c],h=a[c];f!==0&&(J_.fromBufferAttribute(h,e),s?Hg.addScaledVector(J_,f):Hg.addScaledVector(J_.sub(n),f))}n.add(Hg)}return n}raycast(e,n){const r=this.geometry,i=this.material,a=this.matrixWorld;i!==void 0&&(r.boundingSphere===null&&r.computeBoundingSphere(),jg.copy(r.boundingSphere),jg.applyMatrix4(a),yc.copy(e.ray).recast(e.near),!(jg.containsPoint(yc.origin)===!1&&(yc.intersectSphere(jg,lN)===null||yc.origin.distanceToSquared(lN)>(e.far-e.near)**2))&&(oN.copy(a).invert(),yc.copy(e.ray).applyMatrix4(oN),!(r.boundingBox!==null&&yc.intersectsBox(r.boundingBox)===!1)&&this._computeIntersections(e,n,yc)))}_computeIntersections(e,n,r){let i;const a=this.geometry,s=this.material,o=a.index,c=a.attributes.position,u=a.attributes.uv,f=a.attributes.uv1,h=a.attributes.normal,p=a.groups,y=a.drawRange;if(o!==null)if(Array.isArray(s))for(let v=0,w=p.length;v<w;v++){const b=p[v],_=s[b.materialIndex],E=Math.max(b.start,y.start),M=Math.min(o.count,Math.min(b.start+b.count,y.start+y.count));for(let T=E,R=M;T<R;T+=3){const A=o.getX(T),P=o.getX(T+1),k=o.getX(T+2);i=Gg(this,_,e,r,u,f,h,A,P,k),i&&(i.faceIndex=Math.floor(T/3),i.face.materialIndex=b.materialIndex,n.push(i))}}else{const v=Math.max(0,y.start),w=Math.min(o.count,y.start+y.count);for(let b=v,_=w;b<_;b+=3){const E=o.getX(b),M=o.getX(b+1),T=o.getX(b+2);i=Gg(this,s,e,r,u,f,h,E,M,T),i&&(i.faceIndex=Math.floor(b/3),n.push(i))}}else if(c!==void 0)if(Array.isArray(s))for(let v=0,w=p.length;v<w;v++){const b=p[v],_=s[b.materialIndex],E=Math.max(b.start,y.start),M=Math.min(c.count,Math.min(b.start+b.count,y.start+y.count));for(let T=E,R=M;T<R;T+=3){const A=T,P=T+1,k=T+2;i=Gg(this,_,e,r,u,f,h,A,P,k),i&&(i.faceIndex=Math.floor(T/3),i.face.materialIndex=b.materialIndex,n.push(i))}}else{const v=Math.max(0,y.start),w=Math.min(c.count,y.start+y.count);for(let b=v,_=w;b<_;b+=3){const E=b,M=b+1,T=b+2;i=Gg(this,s,e,r,u,f,h,E,M,T),i&&(i.faceIndex=Math.floor(b/3),n.push(i))}}}};function mce(t,e,n,r,i,a,s,o){let c;if(e.side===zi?c=r.intersectTriangle(s,a,i,!0,o):c=r.intersectTriangle(i,a,s,e.side===Il,o),c===null)return null;Wg.copy(o),Wg.applyMatrix4(t.matrixWorld);const u=n.ray.origin.distanceTo(Wg);return u<n.near||u>n.far?null:{distance:u,point:Wg.clone(),object:t}}function Gg(t,e,n,r,i,a,s,o,c,u){t.getVertexPosition(o,Bg),t.getVertexPosition(c,zg),t.getVertexPosition(u,Vg);const f=mce(t,e,n,r,Bg,zg,Vg,cN);if(f){const h=new Oe;hh.getBarycoord(cN,Bg,zg,Vg,h),i&&(f.uv=hh.getInterpolatedAttribute(i,o,c,u,h,new Gn)),a&&(f.uv1=hh.getInterpolatedAttribute(a,o,c,u,h,new Gn)),s&&(f.normal=hh.getInterpolatedAttribute(s,o,c,u,h,new Oe),f.normal.dot(r.direction)>0&&f.normal.multiplyScalar(-1));const p={a:o,b:c,c:u,normal:new Oe,materialIndex:0};hh.getNormal(Bg,zg,Vg,p.normal),f.face=p,f.barycoord=h}return f}class gce extends Ti{constructor(e=null,n=1,r=1,i,a,s,o,c,u=ni,f=ni,h,p){super(null,s,o,c,u,f,i,a,h,p),this.isDataTexture=!0,this.image={data:e,width:n,height:r},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const Q_=new Oe,yce=new Oe,vce=new pn;class kc{constructor(e=new Oe(1,0,0),n=0){this.isPlane=!0,this.normal=e,this.constant=n}set(e,n){return this.normal.copy(e),this.constant=n,this}setComponents(e,n,r,i){return this.normal.set(e,n,r),this.constant=i,this}setFromNormalAndCoplanarPoint(e,n){return this.normal.copy(e),this.constant=-n.dot(this.normal),this}setFromCoplanarPoints(e,n,r){const i=Q_.subVectors(r,n).cross(yce.subVectors(e,n)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,n){return n.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,n){const r=e.delta(Q_),i=this.normal.dot(r);if(i===0)return this.distanceToPoint(e.start)===0?n.copy(e.start):null;const a=-(e.start.dot(this.normal)+this.constant)/i;return a<0||a>1?null:n.copy(e.start).addScaledVector(r,a)}intersectsLine(e){const n=this.distanceToPoint(e.start),r=this.distanceToPoint(e.end);return n<0&&r>0||r<0&&n>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,n){const r=n||vce.getNormalMatrix(e),i=this.coplanarPoint(Q_).applyMatrix4(e),a=this.normal.applyMatrix3(r).normalize();return this.constant=-i.dot(a),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const vc=new eM,xce=new Gn(.5,.5),$g=new Oe;class cU{constructor(e=new kc,n=new kc,r=new kc,i=new kc,a=new kc,s=new kc){this.planes=[e,n,r,i,a,s]}set(e,n,r,i,a,s){const o=this.planes;return o[0].copy(e),o[1].copy(n),o[2].copy(r),o[3].copy(i),o[4].copy(a),o[5].copy(s),this}copy(e){const n=this.planes;for(let r=0;r<6;r++)n[r].copy(e.planes[r]);return this}setFromProjectionMatrix(e,n=Ns,r=!1){const i=this.planes,a=e.elements,s=a[0],o=a[1],c=a[2],u=a[3],f=a[4],h=a[5],p=a[6],y=a[7],v=a[8],w=a[9],b=a[10],_=a[11],E=a[12],M=a[13],T=a[14],R=a[15];if(i[0].setComponents(u-s,y-f,_-v,R-E).normalize(),i[1].setComponents(u+s,y+f,_+v,R+E).normalize(),i[2].setComponents(u+o,y+h,_+w,R+M).normalize(),i[3].setComponents(u-o,y-h,_-w,R-M).normalize(),r)i[4].setComponents(c,p,b,T).normalize(),i[5].setComponents(u-c,y-p,_-b,R-T).normalize();else if(i[4].setComponents(u-c,y-p,_-b,R-T).normalize(),n===Ns)i[5].setComponents(u+c,y+p,_+b,R+T).normalize();else if(n===yy)i[5].setComponents(c,p,b,T).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+n);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),vc.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const n=e.geometry;n.boundingSphere===null&&n.computeBoundingSphere(),vc.copy(n.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(vc)}intersectsSprite(e){vc.center.set(0,0,0);const n=xce.distanceTo(e.center);return vc.radius=.7071067811865476+n,vc.applyMatrix4(e.matrixWorld),this.intersectsSphere(vc)}intersectsSphere(e){const n=this.planes,r=e.center,i=-e.radius;for(let a=0;a<6;a++)if(n[a].distanceToPoint(r)<i)return!1;return!0}intersectsBox(e){const n=this.planes;for(let r=0;r<6;r++){const i=n[r];if($g.x=i.normal.x>0?e.max.x:e.min.x,$g.y=i.normal.y>0?e.max.y:e.min.y,$g.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint($g)<0)return!1}return!0}containsPoint(e){const n=this.planes;for(let r=0;r<6;r++)if(n[r].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class uU extends Ti{constructor(e=[],n=eu,r,i,a,s,o,c,u,f){super(e,n,r,i,a,s,o,c,u,f),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class up extends Ti{constructor(e,n,r=Ws,i,a,s,o=ni,c=ni,u,f=Io,h=1){if(f!==Io&&f!==Ic)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const p={width:e,height:n,depth:h};super(p,i,a,s,o,c,f,r,u),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new QE(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const n=super.toJSON(e);return this.compareFunction!==null&&(n.compareFunction=this.compareFunction),n}}class bce extends up{constructor(e,n=Ws,r=eu,i,a,s=ni,o=ni,c,u=Io){const f={width:e,height:e,depth:1},h=[f,f,f,f,f,f];super(e,e,n,r,i,a,s,o,c,u),this.image=h,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class dU extends Ti{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class Vp extends Js{constructor(e=1,n=1,r=1,i=1,a=1,s=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:n,depth:r,widthSegments:i,heightSegments:a,depthSegments:s};const o=this;i=Math.floor(i),a=Math.floor(a),s=Math.floor(s);const c=[],u=[],f=[],h=[];let p=0,y=0;v("z","y","x",-1,-1,r,n,e,s,a,0),v("z","y","x",1,-1,r,n,-e,s,a,1),v("x","z","y",1,1,e,r,n,i,s,2),v("x","z","y",1,-1,e,r,-n,i,s,3),v("x","y","z",1,-1,e,n,r,i,a,4),v("x","y","z",-1,-1,e,n,-r,i,a,5),this.setIndex(c),this.setAttribute("position",new Ao(u,3)),this.setAttribute("normal",new Ao(f,3)),this.setAttribute("uv",new Ao(h,2));function v(w,b,_,E,M,T,R,A,P,k,N){const j=T/P,L=R/k,z=T/2,U=R/2,V=A/2,W=P+1,K=k+1;let Q=0,O=0;const G=new Oe;for(let Y=0;Y<K;Y++){const H=Y*L-U;for(let te=0;te<W;te++){const re=te*j-z;G[w]=re*E,G[b]=H*M,G[_]=V,u.push(G.x,G.y,G.z),G[w]=0,G[b]=0,G[_]=A>0?1:-1,f.push(G.x,G.y,G.z),h.push(te/P),h.push(1-Y/k),Q+=1}}for(let Y=0;Y<k;Y++)for(let H=0;H<P;H++){const te=p+H+W*Y,re=p+H+W*(Y+1),ue=p+(H+1)+W*(Y+1),ce=p+(H+1)+W*Y;c.push(te,re,ce),c.push(re,ue,ce),O+=6}o.addGroup(y,O,N),y+=O,p+=Q}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Vp(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class fv extends Js{constructor(e=1,n=1,r=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:n,widthSegments:r,heightSegments:i};const a=e/2,s=n/2,o=Math.floor(r),c=Math.floor(i),u=o+1,f=c+1,h=e/o,p=n/c,y=[],v=[],w=[],b=[];for(let _=0;_<f;_++){const E=_*p-s;for(let M=0;M<u;M++){const T=M*h-a;v.push(T,-E,0),w.push(0,0,1),b.push(M/o),b.push(1-_/c)}}for(let _=0;_<c;_++)for(let E=0;E<o;E++){const M=E+u*_,T=E+u*(_+1),R=E+1+u*(_+1),A=E+1+u*_;y.push(M,T,A),y.push(T,R,A)}this.setIndex(y),this.setAttribute("position",new Ao(v,3)),this.setAttribute("normal",new Ao(w,3)),this.setAttribute("uv",new Ao(b,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new fv(e.width,e.height,e.widthSegments,e.heightSegments)}}function qd(t){const e={};for(const n in t){e[n]={};for(const r in t[n]){const i=t[n][r];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?i.isRenderTargetTexture?(ln("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[n][r]=null):e[n][r]=i.clone():Array.isArray(i)?e[n][r]=i.slice():e[n][r]=i}}return e}function wi(t){const e={};for(let n=0;n<t.length;n++){const r=qd(t[n]);for(const i in r)e[i]=r[i]}return e}function _ce(t){const e=[];for(let n=0;n<t.length;n++)e.push(t[n].clone());return e}function fU(t){const e=t.getRenderTarget();return e===null?t.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:jn.workingColorSpace}const wce={clone:qd,merge:wi};var Sce=`void main() {
807
+ )`}return m.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...i,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:a}})});function hy(t,e){t&&Object.assign(t.style,e)}const Cne={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},Ane={position:"fixed"},Rne=x.forwardRef(function(e,n){const{anchor:r,positionMethod:i="absolute",className:a,render:s,side:o="bottom",align:c="center",sideOffset:u=0,alignOffset:f=0,collisionBoundary:h="clipping-ancestors",collisionPadding:p,arrowPadding:y=5,sticky:v=!1,disableAnchorTracking:w,alignItemWithTrigger:b=!0,collisionAvoidance:_=NJ,...E}=e,{store:M,listRef:T,labelsRef:R,alignItemWithTriggerActiveRef:A,selectedItemTextRef:P,valuesRef:k,initialValueRef:N,popupRef:j,setValue:L}=Vl(),z=sF(),U=mn(M,fn.open),V=mn(M,fn.mounted),W=mn(M,fn.modal),K=mn(M,fn.value),Q=mn(M,fn.openMethod),O=mn(M,fn.positionerElement),G=mn(M,fn.triggerElement),Y=mn(M,fn.isItemEqualToValue),H=x.useRef(null),te=x.useRef(null),[re,ue]=x.useState(b),ce=V&&re&&Q!=="touch";!V&&re!==b&&ue(b),Yt(()=>{V||(fn.scrollUpArrowVisible(M.state)&&M.set("scrollUpArrowVisible",!1),fn.scrollDownArrowVisible(M.state)&&M.set("scrollDownArrowVisible",!1))},[M,V]),x.useImperativeHandle(A,()=>ce),RE((ce||W)&&U&&Q!=="touch",G);const ee=gF({anchor:r,floatingRootContext:z,positionMethod:i,mounted:V,side:o,sideOffset:u,align:c,alignOffset:f,arrowPadding:y,collisionBoundary:h,collisionPadding:p,sticky:v,disableAnchorTracking:w??ce,collisionAvoidance:_,keepMounted:!0}),le=ce?"none":ee.side,ve=ce?Ane:ee.positionerStyles,Pe=x.useMemo(()=>{const _e={};return U||(_e.pointerEvents="none"),{role:"presentation",hidden:!V,style:{...ve,..._e}}},[U,V,ve]),be=x.useMemo(()=>({open:U,side:le,align:ee.align,anchorHidden:ee.anchorHidden}),[U,le,ee.align,ee.anchorHidden]),Ye=jt(_e=>{M.set("positionerElement",_e)}),he=Xr("div",e,{ref:[n,Ye],state:be,stateAttributesMapping:du,props:[Pe,E]}),Ue=x.useRef(0),je=jt(_e=>{if(_e.size===0&&Ue.current===0||k.current.length===0)return;const oe=Ue.current;if(Ue.current=_e.size,_e.size===oe)return;const J=Mn(nv);if(oe!==0&&!M.state.multiple&&K!==null&&M1(k.current,K,Y)===-1){const Ne=N.current,Le=Ne!=null&&f_(k.current,Ne,Y)?Ne:null;L(Le,J),Le===null&&(M.set("selectedIndex",null),P.current=null)}if(oe!==0&&M.state.multiple&&Array.isArray(K)){const ze=K.filter(Ne=>f_(k.current,Ne,Y));(ze.length!==K.length||ze.some(Ne=>!f_(K,Ne,Y)))&&(L(ze,J),ze.length===0&&(M.set("selectedIndex",null),P.current=null))}if(U&&ce){M.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const ze={height:""};hy(O,ze),hy(j.current,ze)}}),et=x.useMemo(()=>({...ee,side:le,alignItemWithTriggerActive:ce,setControlledAlignItemWithTrigger:ue,scrollUpArrowRef:H,scrollDownArrowRef:te}),[ee,le,ce,ue]);return m.jsx(yne,{elementsRef:T,labelsRef:R,onMapChange:je,children:m.jsxs(yF.Provider,{value:et,children:[V&&W&&m.jsx(PE,{inert:AE(!U),cutout:G}),he]})})});function vF(t){const e=t.currentTarget.getBoundingClientRect();return e.top+1<=t.clientY&&t.clientY<=e.bottom-1&&e.left+1<=t.clientX&&t.clientX<=e.right-1}const Sg="base-ui-disable-scrollbar",eP={className:Sg,getElement(t){return m.jsx("style",{nonce:t,href:Sg,precedence:"base-ui:low",children:`.${Sg}{scrollbar-width:none}.${Sg}::-webkit-scrollbar{display:none}`})}},Pne=x.createContext(void 0);function xF(t){return x.useContext(Pne)}const bF="ArrowUp",_F="ArrowDown",wF="ArrowLeft",SF="ArrowRight",kF="Home",EF="End",Nne=new Set([wF,SF]),Dne=new Set([bF,_F]),Lne=new Set([...Nne,...Dne]);[...Lne];const NE=new Set([bF,_F,wF,SF,kF,EF]);function DE(t){return t==="starting"?PJ:ei}function Ine(t,e=Number.MIN_SAFE_INTEGER,n=Number.MAX_SAFE_INTEGER){return Math.max(e,Math.min(t,n))}const One=x.createContext(void 0),Fne={disableStyleElements:!1};function Une(){return x.useContext(One)??Fne}const jne={...du,...lf},Bne=x.forwardRef(function(e,n){const{render:r,className:i,...a}=e,{store:s,popupRef:o,onOpenChangeComplete:c,setOpen:u,valueRef:f,selectedItemTextRef:h,keyboardActiveRef:p,multiple:y,handleScrollArrowVisibility:v,scrollHandlerRef:w,highlightItemOnHover:b}=Vl(),{side:_,align:E,alignItemWithTriggerActive:M,setControlledAlignItemWithTrigger:T,scrollDownArrowRef:R,scrollUpArrowRef:A}=Tne(),P=xF()!=null,k=sF(),{nonce:N,disableStyleElements:j}=Une(),L=ji(),z=mn(s,fn.id),U=mn(s,fn.open),V=mn(s,fn.mounted),W=mn(s,fn.popupProps),K=mn(s,fn.transitionStatus),Q=mn(s,fn.triggerElement),O=mn(s,fn.positionerElement),G=mn(s,fn.listElement),Y=x.useRef(0),H=x.useRef(!1),te=x.useRef(0),re=x.useRef(!1),ue=x.useRef({}),ce=tv(),ee=jt(be=>{if(!O||!o.current||!re.current)return;if(H.current||!M){v();return}const Ye=O.style.top==="0px",he=O.style.bottom==="0px",Ue=O.getBoundingClientRect().height,je=Hs(O),et=getComputedStyle(O),_e=parseFloat(et.marginTop),oe=parseFloat(et.marginBottom),J=tP(getComputedStyle(o.current)),ze=je.documentElement.clientHeight-_e-oe,Ne=be.scrollTop,De=be.scrollHeight,Le=be.clientHeight,$=De-Le;let I=0,Z=null,pe=!1;if(Ye){const Se=$-Ne,xe=Ue+Se,Ie=Math.min(xe,ze);I=Ie,Ie!==ze?Z=$:pe=!0}else if(he){const Se=Ne-0,xe=Ue+Se,Ie=Math.min(xe,ze),He=xe-ze;I=Ie,Ie!==ze?Z=0:(pe=!0,Ne<$&&(Z=Ne-(Se-He)))}I!==0&&(O.style.height=`${I}px`),Z!=null&&(be.scrollTop=Z),(pe||I>=J)&&(H.current=!0),v()});x.useImperativeHandle(w,()=>ee,[ee]),cf({open:U,ref:o,onComplete(){U&&c?.(!0)}});const le=x.useMemo(()=>({open:U,transitionStatus:K,side:_,align:E}),[U,K,_,E]);Yt(()=>{!O||!o.current||Object.keys(ue.current).length||(ue.current={top:O.style.top||"0",left:O.style.left||"0",right:O.style.right,height:O.style.height,bottom:O.style.bottom,minHeight:O.style.minHeight,maxHeight:O.style.maxHeight,marginTop:O.style.marginTop,marginBottom:O.style.marginBottom})},[o,O]),Yt(()=>{U||M||(re.current=!1,H.current=!1,Y.current=0,te.current=0,hy(O,ue.current))},[U,M,O,o]),Yt(()=>{const be=o.current;if(!(!U||!Q||!O||!be||s.state.transitionStatus==="ending")){if(!M){re.current=!0,ce.request(v),be.style.removeProperty("--transform-origin");return}queueMicrotask(()=>{const Ye=Vne(be);be.style.removeProperty("--transform-origin");try{const he=getComputedStyle(O),Ue=getComputedStyle(be),je=Hs(Q),et=Pr(O),_e=Q.getBoundingClientRect(),oe=O.getBoundingClientRect(),J=_e.left,ze=_e.height,Ne=G||be,De=Ne.scrollHeight,Le=parseFloat(Ue.borderBottomWidth),$=parseFloat(he.marginTop)||10,I=parseFloat(he.marginBottom)||10,Z=parseFloat(he.minHeight)||100,pe=tP(Ue),Se=5,xe=5,Ie=20,He=je.documentElement.clientHeight-$-I,qe=je.documentElement.clientWidth,ft=He-_e.bottom+ze,We=h.current,Xe=f.current;let nt,ct=0,Ke=0;if(We&&Xe){const St=Xe.getBoundingClientRect();nt=We.getBoundingClientRect();const Rt=St.left-J,hn=nt.left-oe.left,xn=St.top-_e.top+St.height/2,ie=nt.top-oe.top+nt.height/2;ct=Rt-hn,Ke=ie-xn}const gt=ft+Ke+I+Le;let ne=Math.min(He,gt);const Be=He-$-I,ke=gt-ne,Ae=Math.max(Se,J+ct),Ve=qe-xe,ge=Math.max(0,Ae+oe.width-Ve);O.style.left=`${Ae-ge}px`,O.style.height=`${ne}px`,O.style.maxHeight="auto",O.style.marginTop=`${$}px`,O.style.marginBottom=`${I}px`,be.style.height="100%";const ht=Ne.scrollHeight-Ne.clientHeight,bt=ke>=ht;bt&&(ne=Math.min(He,oe.height)-(ke-ht));const Kt=_e.top<Ie||_e.bottom>He-Ie||ne<Math.min(De,Z),Bt=(et.visualViewport?.scale??1)!==1&&f4;if(Kt||Bt){re.current=!0,hy(O,ue.current),gi.flushSync(()=>T(!1));return}if(bt){const St=Math.max(0,He-gt);O.style.top=oe.height>=Be?"0":`${St}px`,O.style.height=`${ne}px`,Ne.scrollTop=Ne.scrollHeight-Ne.clientHeight,Y.current=Math.max(Z,ne)}else O.style.bottom="0",Y.current=Math.max(Z,ne),Ne.scrollTop=ke;if(nt){const St=oe.top,Rt=oe.height,hn=nt.top+nt.height/2,xn=Rt>0?(hn-St)/Rt*100:50,ie=Ine(xn,0,100);be.style.setProperty("--transform-origin",`50% ${ie}%`)}(Y.current===He||ne>=pe)&&(H.current=!0),v(),setTimeout(()=>{re.current=!0})}finally{Ye()}})}},[s,U,O,Q,f,h,o,v,M,T,ce,R,A,G]),x.useEffect(()=>{if(!M||!O||!U)return;const be=Pr(O);function Ye(he){u(!1,Mn(pee,he))}return be.addEventListener("resize",Ye),()=>{be.removeEventListener("resize",Ye)}},[u,M,O,U]);const ve={...G?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":y||void 0,id:`${z}-list`},onKeyDown(be){p.current=!0,P&&NE.has(be.key)&&be.stopPropagation()},onMouseMove(){p.current=!1},onPointerLeave(be){if(!b||vF(be)||be.pointerType==="touch")return;const Ye=be.currentTarget;L.start(0,()=>{s.set("activeIndex",null),Ye.focus({preventScroll:!0})})},onScroll(be){G||w.current?.(be.currentTarget)},...M&&{style:G?{height:"100%"}:Cne}},Pe=Xr("div",e,{ref:[n,o],state:le,stateAttributesMapping:jne,props:[W,ve,DE(K),{className:!G&&M?eP.className:void 0},a]});return m.jsxs(x.Fragment,{children:[!j&&eP.getElement(N),m.jsx(wE,{context:k,modal:!1,disabled:!V,restoreFocus:!0,children:Pe})]})});function tP(t){const e=t.maxHeight||"";return e.endsWith("px")&&parseFloat(e)||1/0}const nP={transform:"none",scale:"1",translate:"0 0"};function zne(t,e,n){n?t.setProperty(e,n):t.removeProperty(e)}function Vne(t){const{style:e}=t,n={},r=Object.keys(nP);for(const i of r)n[i]=e.getPropertyValue(i),e.setProperty(i,nP[i]);return()=>{for(const i of r)zne(e,i,n[i])}}let MF=(function(t){return t[t.None=0]="None",t[t.GuessFromOrder=1]="GuessFromOrder",t})({});function Hne(t={}){const{label:e,metadata:n,textRef:r,indexGuessBehavior:i,index:a}=t,{register:s,unregister:o,subscribeMapChange:c,elementsRef:u,labelsRef:f,nextIndexRef:h}=gne(),p=x.useRef(-1),[y,v]=x.useState(a??(i===MF.GuessFromOrder?()=>{if(p.current===-1){const _=h.current;h.current+=1,p.current=_}return p.current}:-1)),w=x.useRef(null),b=x.useCallback(_=>{if(w.current=_,y!==-1&&_!==null&&(u.current[y]=_,f)){const E=e!==void 0;f.current[y]=E?e:r?.current?.textContent??_.textContent}},[y,u,f,e,r]);return Yt(()=>{if(a!=null)return;const _=w.current;if(_)return s(_,n),()=>{o(_)}},[a,s,o,n]),Yt(()=>{if(a==null)return c(_=>{const E=w.current?_.get(w.current)?.index:null;E!=null&&v(E)})},[a,c,v]),x.useMemo(()=>({ref:b,index:y}),[y,b])}const TF=x.createContext(void 0);function LE(){const t=x.useContext(TF);if(!t)throw new Error(Wi(57));return t}const rP=x.memo(x.forwardRef(function(e,n){const{render:r,className:i,value:a=null,label:s,disabled:o=!1,nativeButton:c=!1,...u}=e,f=x.useRef(null),h=Hne({label:s,textRef:f,indexGuessBehavior:MF.GuessFromOrder}),{store:p,getItemProps:y,setOpen:v,setValue:w,selectionRef:b,typingRef:_,valuesRef:E,keyboardActiveRef:M,multiple:T,highlightItemOnHover:R}=Vl(),A=ji(),P=mn(p,fn.isActive,h.index),k=mn(p,fn.isSelected,h.index,a),N=mn(p,fn.isSelectedByFocus,h.index),j=mn(p,fn.isItemEqualToValue),L=h.index,z=L!==-1,U=x.useRef(null),V=jr(L);Yt(()=>{if(!z)return;const ee=E.current;return ee[L]=a,()=>{delete ee[L]}},[z,L,a,E]),Yt(()=>{if(!z)return;const ee=p.state.value;let le=ee;T&&Array.isArray(ee)&&ee.length>0&&(le=ee[ee.length-1]),le!==void 0&&Hd(le,a,j)&&p.set("selectedIndex",L)},[z,L,T,j,p,a]);const W=x.useMemo(()=>({disabled:o,selected:k,highlighted:P}),[o,k,P]),K=y({active:P,selected:k});K.onFocus=void 0,K.id=void 0;const Q=x.useRef(null),O=x.useRef("mouse"),G=x.useRef(!1),{getButtonProps:Y,buttonRef:H}=ev({disabled:o,focusableWhenDisabled:!0,native:c});function te(ee){const le=p.state.value;if(T){const ve=Array.isArray(le)?le:[],Pe=k?Bte(ve,a,j):[...ve,a];w(Pe,Mn(r_,ee))}else w(a,Mn(r_,ee)),v(!1,Mn(r_,ee))}const re={role:"option","aria-selected":k,tabIndex:P?0:-1,onFocus(){p.set("activeIndex",L)},onMouseEnter(){!M.current&&p.state.selectedIndex===null&&p.set("activeIndex",L)},onMouseMove(){R&&p.set("activeIndex",L)},onMouseLeave(ee){!R||M.current||vF(ee)||A.start(0,()=>{p.state.activeIndex===L&&p.set("activeIndex",null)})},onTouchStart(){b.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}},onKeyDown(ee){Q.current=ee.key,p.set("activeIndex",L)},onClick(ee){G.current=!1,!(ee.type==="keydown"&&Q.current===null)&&(o||Q.current===" "&&_.current||O.current!=="touch"&&!P||(Q.current=null,te(ee.nativeEvent)))},onPointerEnter(ee){O.current=ee.pointerType},onPointerDown(ee){O.current=ee.pointerType,G.current=!0},onMouseUp(ee){if(o)return;if(G.current){G.current=!1;return}const le=!b.current.allowSelectedMouseUp&&k,ve=!b.current.allowUnselectedMouseUp&&!k;le||ve||O.current!=="touch"&&!P||te(ee.nativeEvent)}},ue=Xr("div",e,{ref:[H,n,h.ref,U],state:W,props:[K,re,u,Y]}),ce=x.useMemo(()=>({selected:k,indexRef:V,textRef:f,selectedByFocus:N,hasRegistered:z}),[k,V,f,N,z]);return m.jsx(TF.Provider,{value:ce,children:ue})})),iP=x.forwardRef(function(e,n){const r=e.keepMounted??!1,{selected:i}=LE();return r||i?m.jsx(Wne,{...e,ref:n}):null}),Wne=x.memo(x.forwardRef((t,e)=>{const{render:n,className:r,keepMounted:i,...a}=t,{selected:s}=LE(),o=x.useRef(null),{transitionStatus:c,setMounted:u}=ME(s),f=x.useMemo(()=>({selected:s,transitionStatus:c}),[s,c]),h=Xr("span",t,{ref:[e,o],state:f,props:[{"aria-hidden":!0,children:"✔️"},a],stateAttributesMapping:lf});return cf({open:s,ref:o,onComplete(){s||u(!1)}}),h})),aP=x.memo(x.forwardRef(function(e,n){const{indexRef:r,textRef:i,selectedByFocus:a,hasRegistered:s}=LE(),{selectedItemTextRef:o}=Vl(),{className:c,render:u,...f}=e,h=x.useCallback(y=>{if(!y||!s)return;const v=o.current===null||!o.current.isConnected;(a||v&&r.current===0)&&(o.current=y)},[o,r,a,s]);return Xr("div",e,{ref:[h,n,i],props:f})}));function CF({prefersReducedMotion:t,screenshotCapture:e}){return!(e||t)}function fu({children:t,title:e,subtitle:n,className:r="",bodyClassName:i=""}){return m.jsxs("div",{className:`rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 transition-colors duration-200 ${r}`,children:[(e||n)&&m.jsxs("div",{className:"px-5 py-4 border-b border-oai-gray-200 dark:border-oai-gray-800 transition-colors duration-200",children:[e&&m.jsx("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide transition-colors duration-200",children:e}),n&&m.jsx("p",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-300 mt-1 transition-colors duration-200",children:n})]}),m.jsx("div",{className:`p-5 ${i}`,children:t})]})}function Gne(){return m.jsxs(Ei,{to:"/landing",className:"flex items-center gap-2.5 no-underline hover:opacity-80 transition-opacity",children:[m.jsx("img",{src:"/app-icon.png",alt:"Token Tracker",width:28,height:28,className:"rounded-md"}),m.jsx("span",{className:"text-base font-semibold text-oai-black dark:text-oai-white leading-tight",children:"Token Tracker"})]})}function $ne({children:t,header:e,footer:n,className:r="",hideHeader:i=!1,hideFooter:a=!1,bare:s=!1}){return s?m.jsxs("div",{className:`flex flex-col flex-1 min-h-0 ${r}`,children:[m.jsx("main",{className:"flex-1 px-6 py-6",children:t}),!a&&n&&m.jsx("footer",{className:"border-t border-oai-gray-200 dark:border-oai-gray-800 px-6 py-4 mt-auto transition-colors duration-200",children:n})]}):m.jsxs("div",{className:`min-h-screen bg-oai-white dark:bg-oai-gray-950 text-oai-black dark:text-oai-white font-sans flex flex-col transition-colors duration-200 ${r}`,children:[!i&&m.jsxs("header",{className:"border-b border-oai-gray-200 dark:border-oai-gray-800 px-6 py-4 flex items-center justify-between transition-colors duration-200",children:[m.jsx(Gne,{}),m.jsx("div",{className:"flex-1 flex justify-center",children:e})]}),m.jsx("main",{className:"flex-1 px-6 py-6",children:t}),!a&&n&&m.jsx("footer",{className:"border-t border-oai-gray-200 dark:border-oai-gray-800 px-6 py-4 mt-auto transition-colors duration-200",children:n})]})}function Yne(t){if(!t||typeof t!="object")return null;const e=t.user_metadata&&typeof t.user_metadata=="object"?t.user_metadata:{},n=t.profile&&typeof t.profile=="object"?t.profile:{},r=e.avatar_url||e.picture||n.avatar_url||t.avatar_url;return typeof r=="string"&&r.trim()?r.trim():null}function sP(t){const e=String(t||"").trim();if(!e)return"?";const n=e.split(/\s+/).filter(Boolean);return n.length>=2?(n[0][0]+n[n.length-1][0]).toUpperCase():e.slice(0,2).toUpperCase()}function py({className:t,variant:e="header",collapsed:n=!1,onAfterAction:r}){su();const i=e==="sidebar",{enabled:a,loading:s,signedIn:o,user:c,displayName:u}=ss(),{openLoginModal:f}=Ep(),h=Jd(),p=x.useMemo(()=>Yne(c),[c]);if(!a)return null;if(s)return m.jsx("div",{className:yt("h-9 w-9 shrink-0 rounded-full bg-oai-gray-200 dark:bg-oai-gray-800 animate-pulse",t),"aria-hidden":!0});if(!o)return i?m.jsxs("button",{type:"button",onClick:()=>{f(),r?.()},className:yt("flex items-center gap-2 rounded-md px-2 py-1.5 text-[13px] font-medium text-oai-gray-700 dark:text-oai-gray-300 hover:bg-oai-gray-200/60 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 min-w-0",n?"h-8 w-8 justify-center px-0":"w-full",t),"aria-label":F("header.auth.sign_in_aria"),title:n?F("header.auth.sign_in_aria"):void 0,children:[m.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center",children:m.jsx("img",{src:"/app-icon.png",alt:"",width:18,height:18,className:"h-[18px] w-[18px] rounded"})}),!n&&m.jsx("span",{className:"truncate flex-1 text-left",children:F("header.auth.sign_in_aria")})]}):m.jsx("button",{type:"button",onClick:f,className:yt("shrink-0 inline-flex h-9 items-center justify-center gap-1.5 rounded-full px-5 text-sm font-medium transition-colors duration-200 ease-out shadow-sm ring-1 ring-oai-gray-200 dark:ring-white/10 bg-oai-gray-900 text-white hover:bg-oai-gray-800 active:bg-oai-gray-950 dark:bg-white dark:text-oai-gray-900 dark:hover:bg-oai-gray-100 dark:active:bg-oai-gray-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500 focus-visible:ring-offset-2 dark:focus-visible:ring-offset-oai-gray-950",t),"aria-label":F("header.auth.sign_in_aria"),children:F("header.auth.sign_in_aria")});const y=()=>{h("/settings"),r?.()};return m.jsx("div",{className:yt(i?"relative flex w-full shrink-0 items-center":"relative flex shrink-0 items-center",t),children:m.jsxs("button",{type:"button",onClick:y,className:yt(i?yt("flex w-full items-center gap-2 rounded-md px-2 py-1.5 hover:bg-oai-gray-200/60 dark:hover:bg-oai-gray-800 transition-colors min-w-0",n&&"justify-center px-0 py-0 h-9 w-9"):"flex items-center gap-2 rounded-full pl-1 pr-2 py-1 border border-transparent hover:bg-oai-gray-100 dark:hover:bg-oai-gray-900/80 hover:border-oai-gray-200 dark:hover:border-oai-gray-800 transition-colors"),"aria-label":F("header.auth.open_settings"),title:i&&n?u:void 0,children:[i?m.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center",children:p?m.jsx("img",{src:p,alt:"",width:20,height:20,className:"h-5 w-5 rounded-full object-cover ring-1 ring-oai-gray-300 dark:ring-oai-gray-700",referrerPolicy:"no-referrer"}):m.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-oai-brand-600 text-[9px] font-semibold text-white ring-1 ring-oai-brand-500/50",children:sP(u)})}):p?m.jsx("img",{src:p,alt:"",width:32,height:32,className:"h-8 w-8 rounded-full object-cover ring-1 ring-oai-gray-300 dark:ring-oai-gray-700 shrink-0",referrerPolicy:"no-referrer"}):m.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-oai-brand-600 text-xs font-semibold text-white ring-1 ring-oai-brand-500/50",children:sP(u)}),i?!n&&m.jsx("span",{className:"truncate text-[13px] font-medium text-oai-gray-900 dark:text-oai-gray-200 flex-1 text-left min-w-0",children:u}):m.jsx("span",{className:"hidden sm:inline truncate text-sm font-medium text-oai-gray-900 dark:text-oai-gray-200 max-w-[120px]",children:u})]})})}const A1="tt.sidebarCollapsed";function qne(){return[{id:"general",label:F("nav.group.general"),items:[{id:"usage",to:"/dashboard",icon:w7,label:F("nav.usage")},{id:"limits",to:"/limits",icon:A7,label:F("nav.limits")},{id:"leaderboard",to:"/leaderboard",icon:cG,label:F("nav.leaderboard")}]},{id:"tools",label:F("nav.group.tools"),items:[{id:"widgets",to:"/widgets",icon:U7,label:F("nav.widgets")},{id:"skills",to:"/skills",icon:J7,label:F("nav.skills")},{id:"ip-check",to:"/ip-check",icon:P7,label:F("nav.ip_check")}]},{id:"account",label:F("nav.group.account"),items:[{id:"settings",to:"/settings",icon:L3,label:F("nav.settings")}]}]}function Xne(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(A1)==="1"}catch{return!1}}function Kne(){const[t,e]=x.useState(Xne),n=x.useCallback(()=>{e(r=>{const i=!r;try{typeof window<"u"&&window.localStorage.setItem(A1,i?"1":"0")}catch{}return i})},[]);return x.useEffect(()=>{if(typeof window>"u")return;const r=i=>{i.key===A1&&e(i.newValue==="1")};return window.addEventListener("storage",r),()=>window.removeEventListener("storage",r)},[]),{collapsed:t,toggle:n}}function Zne(t,e){const n=t.replace(/\/+$/,"")||"/";return e==="/dashboard"?n==="/dashboard"||n==="/":e==="/leaderboard"?n==="/leaderboard"||n.startsWith("/leaderboard/"):n===e}function Jne({label:t,collapsed:e,first:n}){return e?n?null:m.jsx("div",{className:"mx-2 my-2 h-px bg-oai-gray-200/70 dark:bg-oai-gray-800/70","aria-hidden":!0}):m.jsx("div",{className:yt("px-3 pb-1 text-[10px] uppercase tracking-wider text-oai-gray-500 dark:text-oai-gray-500",n?"pt-2":"pt-4"),children:t})}function Qne({item:t,collapsed:e,active:n,onClick:r}){const i=t.icon;return m.jsxs(Ei,{to:t.to,onClick:r,title:e?t.label:void 0,"aria-current":n?"page":void 0,className:yt("flex items-center gap-2 rounded-md px-2 py-1.5 text-[13px] no-underline transition-colors",e&&"justify-center px-0 py-2",n?"bg-oai-gray-200/70 text-oai-black font-medium dark:bg-oai-gray-800 dark:text-white":"text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-200/50 hover:text-oai-black dark:hover:bg-oai-gray-800/60 dark:hover:text-white"),children:[m.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center",children:m.jsx(i,{className:"h-[15px] w-[15px]","aria-hidden":!0})}),!e&&m.jsx("span",{className:"truncate",children:t.label})]})}function ere({as:t="button",title:e,onClick:n,href:r,children:i,className:a,...s}){const o=yt("flex h-10 w-10 items-center justify-center rounded-lg text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-200/60 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white transition-colors no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",a);return t==="a"?m.jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer",title:e,"aria-label":e,className:o,...s,children:i}):m.jsx("button",{type:"button",title:e,"aria-label":e,onClick:n,className:o,...s,children:i})}function tre({repo:t="mm7894215/TokenTracker",glassChrome:e=!1}){const[n,r]=x.useState(null);return x.useEffect(()=>{if(typeof window>"u")return;const i=typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;CF({prefersReducedMotion:i,screenshotCapture:!1})&&fetch(`https://api.github.com/repos/${t}`).then(a=>a.json()).then(a=>{a&&typeof a.stargazers_count=="number"&&r(a.stargazers_count)}).catch(()=>{})},[t]),m.jsxs("a",{href:`https://github.com/${t}`,target:"_blank",rel:"noopener noreferrer","aria-label":n!==null?`Star on GitHub (${n})`:"Star on GitHub",className:yt("inline-flex h-7 items-center gap-1.5 rounded-full px-2.5 text-xs font-medium transition-colors no-underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",e?"border border-gray-500/20 dark:border-gray-500/30 bg-gray-500/[0.04] dark:bg-gray-500/[0.06] backdrop-blur-[2px] text-oai-gray-700 dark:text-oai-gray-300 hover:bg-gray-500/10 dark:hover:bg-gray-500/12 hover:border-gray-500/30 dark:hover:border-gray-500/40 hover:text-oai-black dark:hover:text-white":"border border-oai-gray-200 dark:border-oai-gray-700 text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-200/60 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white hover:border-oai-gray-300 dark:hover:border-oai-gray-600"),children:[m.jsx("svg",{height:"12",viewBox:"0 0 16 16",width:"12",className:"shrink-0 fill-current",children:m.jsx("path",{d:"M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"})}),m.jsx("span",{children:"Star"}),n!==null&&m.jsx("span",{className:"text-[10px] text-oai-gray-500 dark:text-oai-gray-500 tabular-nums",children:n})]})}const nre=[{value:"light",label:"Light",Icon:Ck},{value:"dark",label:"Dark",Icon:Mk},{value:"system",label:"System",Icon:Vy}];function rre({theme:t,resolvedTheme:e,onSetTheme:n,glassChrome:r=!1}){const[i,a]=x.useState(!1),s=x.useRef(null),o=e==="dark"?Mk:Ck;return x.useEffect(()=>{if(!i)return;const c=f=>{s.current&&!s.current.contains(f.target)&&a(!1)},u=f=>{f.key==="Escape"&&a(!1)};return document.addEventListener("mousedown",c),document.addEventListener("keydown",u),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",u)}},[i]),m.jsxs("div",{ref:s,className:"relative",children:[m.jsx("button",{type:"button","aria-label":"Theme","aria-expanded":i,"aria-haspopup":"menu",title:"Theme",onClick:()=>a(c=>!c),className:yt("inline-flex h-7 w-7 items-center justify-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",r?"border border-gray-500/20 dark:border-gray-500/30 bg-gray-500/[0.04] dark:bg-gray-500/[0.06] backdrop-blur-[2px] text-oai-gray-700 dark:text-oai-gray-300 hover:bg-gray-500/10 dark:hover:bg-gray-500/12 hover:border-gray-500/30 dark:hover:border-gray-500/40 hover:text-oai-black dark:hover:text-white":"border border-oai-gray-200 dark:border-oai-gray-700 text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-200/60 dark:hover:bg-oai-gray-800 hover:text-oai-black dark:hover:text-white hover:border-oai-gray-300 dark:hover:border-oai-gray-600"),children:m.jsx(o,{className:"h-3.5 w-3.5","aria-hidden":!0})}),i&&m.jsx("div",{role:"menu",className:"absolute bottom-full left-0 mb-2 z-50 min-w-[140px] py-1 rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 shadow-lg",children:nre.map(({value:c,label:u,Icon:f})=>{const h=t===c;return m.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{n(c),a(!1)},className:yt("flex w-full items-center gap-2.5 px-3 py-1.5 text-[13px] transition-colors",h?"text-oai-black dark:text-white bg-oai-gray-100 dark:bg-oai-gray-800":"text-oai-gray-600 dark:text-oai-gray-400 hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/60 hover:text-oai-black dark:hover:text-white"),children:[m.jsx(f,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":!0}),m.jsx("span",{children:u})]},c)})})]})}function AF({collapsed:t,onToggleCollapsed:e,onItemClick:n,showCloseButton:r=!1,onClose:i,glassChrome:a=!1}){const o=Hi()?.pathname||"/",{theme:c,resolvedTheme:u,setTheme:f}=Dp(),{resolvedLocale:h}=su(),p=x.useMemo(()=>qne(),[h]);return m.jsxs(m.Fragment,{children:[m.jsx("div",{className:yt("px-2 pt-2 pb-2",t&&"flex justify-center"),children:r?m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("div",{className:"flex-1 min-w-0",children:m.jsx(py,{variant:"sidebar",collapsed:t,onAfterAction:n})}),m.jsx("button",{type:"button",onClick:i,"aria-label":F("nav.close_menu"),title:F("nav.close_menu"),className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-oai-gray-500 dark:text-oai-gray-500 hover:bg-oai-gray-200/60 dark:hover:bg-oai-gray-800 hover:text-oai-gray-900 dark:hover:text-oai-gray-200 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand-500",children:m.jsx(Ak,{className:"h-4 w-4",strokeWidth:1.75,"aria-hidden":!0})})]}):m.jsx(py,{variant:"sidebar",collapsed:t,onAfterAction:n})}),m.jsx("nav",{"aria-label":F("nav.nav_label"),className:"flex-1 px-2 pb-2 flex flex-col overflow-y-auto",children:p.map((y,v)=>m.jsxs("div",{className:"flex flex-col",children:[m.jsx(Jne,{label:y.label,collapsed:t,first:v===0}),m.jsx("div",{className:"flex flex-col gap-0.5",children:y.items.map(w=>m.jsx(Qne,{item:w,collapsed:t,active:Zne(o,w.to),onClick:n},w.id))})]},y.id))}),m.jsxs("div",{className:yt("flex items-center px-2 py-3",t?"flex-col justify-center gap-2":"justify-between gap-2"),children:[m.jsx(rre,{theme:c,resolvedTheme:u,onSetTheme:f,glassChrome:a}),m.jsx("div",{className:"flex items-center gap-1.5",children:!t&&m.jsx(tre,{glassChrome:a})})]})]})}function ire({collapsed:t,onToggleCollapsed:e}){const n=x.useMemo(()=>typeof window>"u"?!1:Za()||Sk(),[]);return m.jsx("aside",{"aria-label":F("nav.aside_label"),className:yt("hidden lg:flex flex-col shrink-0 h-full min-h-0 transition-[width] duration-200",t?"w-[72px]":"w-[220px]"),children:m.jsx(AF,{collapsed:t,onToggleCollapsed:e,glassChrome:n})})}function are({open:t,onClose:e}){return x.useEffect(()=>{if(!t)return;const n=r=>{r.key==="Escape"&&e()};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},[t,e]),x.useEffect(()=>{if(!t)return;const n=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=n}},[t]),t?m.jsxs("div",{className:"lg:hidden fixed inset-0 z-[80] flex",children:[m.jsx("div",{className:"absolute inset-0 bg-black/40 backdrop-blur-sm",onClick:e,"aria-hidden":!0}),m.jsx("aside",{"aria-label":F("nav.aside_label"),className:"relative w-[260px] max-w-[80vw] flex flex-col bg-oai-white dark:bg-oai-gray-900 border-r border-oai-gray-200 dark:border-oai-gray-800 shadow-2xl",children:m.jsx(AF,{collapsed:!1,showCloseButton:!0,onClose:e,onItemClick:e})})]}):null}function sre({onOpenDrawer:t}){return m.jsxs("div",{className:"lg:hidden flex items-center justify-between gap-2 px-3 h-14 border-b border-oai-gray-200 dark:border-oai-gray-800",children:[m.jsx(ere,{title:F("nav.menu"),onClick:t,children:m.jsx(G7,{className:"h-5 w-5","aria-hidden":!0})}),m.jsxs(Ei,{to:"/landing",className:"flex items-center gap-2 no-underline hover:opacity-80 transition-opacity","aria-label":"Token Tracker",children:[m.jsx("img",{src:"/app-icon.png",alt:"",width:24,height:24,className:"rounded-md"}),m.jsx("span",{className:"text-sm font-semibold text-oai-black dark:text-oai-white",children:"Token Tracker"})]}),m.jsx("div",{className:"w-10 shrink-0","aria-hidden":!0})]})}function ore({children:t}){const{collapsed:e,toggle:n}=Kne(),[r,i]=x.useState(!1),a=x.useCallback(()=>i(!0),[]),s=x.useCallback(()=>i(!1),[]),o=x.useMemo(()=>typeof window>"u"?!1:Za()||Sk(),[]);return m.jsxs("div",{className:yt("fixed inset-0 flex flex-col text-oai-black dark:text-oai-white font-sans overflow-hidden",o?"bg-transparent":"bg-oai-gray-100 dark:bg-oai-gray-950"),children:[o&&m.jsx("div",{className:"h-7 shrink-0",style:{WebkitAppRegion:"drag"},"aria-hidden":!0}),m.jsxs("div",{className:"flex-1 min-h-0 flex",children:[m.jsx(ire,{collapsed:e,onToggleCollapsed:n}),m.jsx(are,{open:r,onClose:s}),m.jsx("div",{className:"flex-1 min-w-0 min-h-0 p-2 lg:pl-0 lg:pr-3 lg:pb-3 flex flex-col",children:m.jsxs("div",{className:yt("flex-1 min-h-0 flex flex-col bg-oai-white dark:bg-oai-gray-900 border border-oai-gray-200 dark:border-oai-gray-800 overflow-hidden",o?"tt-native-main-card":"rounded-2xl",!o&&"shadow-sm"),children:[m.jsx(sre,{onOpenDrawer:a}),m.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:t})]})})]})]})}function lre({children:t,variant:e="info",size:n="md",className:r=""}){const i="inline-flex items-center font-medium",a={success:"bg-oai-brand-100 dark:bg-oai-brand-900/30 text-oai-brand-700 dark:text-oai-brand-400 rounded-full",warning:"bg-oai-amber-50 dark:bg-oai-amber-900/30 text-oai-amber-dark dark:text-oai-amber-400 rounded-full",error:"bg-red-50 dark:bg-red-900/30 text-red-600 dark:text-red-400 rounded-full",info:"bg-oai-gray-100 dark:bg-oai-gray-800 text-oai-gray-600 dark:text-oai-gray-300 rounded-full",secondary:"bg-oai-gray-100 dark:bg-oai-gray-800 text-oai-gray-500 dark:text-oai-gray-300 rounded-md"},s={sm:"px-2 py-0.5 text-xs",md:"px-2.5 py-1 text-sm"},o=`${i} ${a[e]} ${s[n]} ${r}`.trim();return m.jsx("span",{className:o,children:t})}const RF=x.createContext(void 0);function Hl(t){const e=x.useContext(RF);if(t===!1&&e===void 0)throw new Error(Wi(27));return e}const cre={...du,...lf},PF=x.forwardRef(function(e,n){const{render:r,className:i,forceRender:a=!1,...s}=e,{store:o}=Hl(),c=o.useState("open"),u=o.useState("nested"),f=o.useState("mounted"),h=o.useState("transitionStatus"),p=x.useMemo(()=>({open:c,transitionStatus:h}),[c,h]);return Xr("div",e,{state:p,ref:[o.context.backdropRef,n],stateAttributesMapping:cre,props:[{role:"presentation",hidden:!f,style:{userSelect:"none",WebkitUserSelect:"none"}},s],enabled:a||!u})}),ure=x.forwardRef(function(e,n){const{render:r,className:i,disabled:a=!1,nativeButton:s=!0,...o}=e,{store:c}=Hl(),u=c.useState("open");function f(v){u&&c.setOpen(!1,Mn(fee,v.nativeEvent))}const{getButtonProps:h,buttonRef:p}=ev({disabled:a,native:s}),y=x.useMemo(()=>({disabled:a}),[a]);return Xr("button",e,{state:y,ref:[n,p],props:[{onClick:f},o,h]})}),dre=x.forwardRef(function(e,n){const{render:r,className:i,id:a,...s}=e,{store:o}=Hl(),c=ov(a);return o.useSyncedValueWithCleanup("descriptionElementId",c),Xr("p",e,{ref:n,props:[{id:c},s]})});let fre=(function(t){return t.nestedDialogs="--nested-dialogs",t})({}),hre=(function(t){return t[t.open=Ja.open]="open",t[t.closed=Ja.closed]="closed",t[t.startingStyle=Ja.startingStyle]="startingStyle",t[t.endingStyle=Ja.endingStyle]="endingStyle",t.nested="data-nested",t.nestedDialogOpen="data-nested-dialog-open",t})({});const NF=x.createContext(void 0);function DF(){const t=x.useContext(NF);if(t===void 0)throw new Error(Wi(26));return t}const pre={...du,...lf,nestedDialogOpen(t){return t?{[hre.nestedDialogOpen]:""}:null}},LF=x.forwardRef(function(e,n){const{className:r,finalFocus:i,initialFocus:a,render:s,...o}=e,{store:c}=Hl(),u=c.useState("descriptionElementId"),f=c.useState("disablePointerDismissal"),h=c.useState("floatingRootContext"),p=c.useState("popupProps"),y=c.useState("modal"),v=c.useState("mounted"),w=c.useState("nested"),b=c.useState("nestedOpenDialogCount"),_=c.useState("open"),E=c.useState("openMethod"),M=c.useState("titleElementId"),T=c.useState("transitionStatus"),R=c.useState("role");DF(),cf({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});function A(L){return L==="touch"?c.context.popupRef.current:!0}const P=a===void 0?A:a,k=b>0,N=x.useMemo(()=>({open:_,nested:w,transitionStatus:T,nestedDialogOpen:k}),[_,w,T,k]),j=Xr("div",e,{state:N,props:[p,{"aria-labelledby":M??void 0,"aria-describedby":u??void 0,role:R,tabIndex:-1,hidden:!v,onKeyDown(L){NE.has(L.key)&&L.stopPropagation()},style:{[fre.nestedDialogs]:b}},o],ref:[n,c.context.popupRef,c.useStateSetter("popupElement")],stateAttributesMapping:pre});return m.jsx(wE,{context:h,openInteractionType:E,disabled:!v,closeOnFocusOut:!f,initialFocus:P,returnFocus:i,modal:y!==!1,restoreFocus:"popup",children:j})}),IF=x.forwardRef(function(e,n){const{keepMounted:r=!1,...i}=e,{store:a}=Hl(),s=a.useState("mounted"),o=a.useState("modal"),c=a.useState("open");return s||r?m.jsx(NF.Provider,{value:r,children:m.jsxs(bE,{ref:n,...i,children:[s&&o===!0&&m.jsx(PE,{ref:a.context.internalBackdropRef,inert:AE(!c)}),e.children]})}):null});function mre(t){const{store:e,parentContext:n,actionsRef:r}=t,i=e.useState("open"),a=e.useState("disablePointerDismissal"),s=e.useState("modal"),o=e.useState("popupElement"),{openMethod:c,triggerProps:u,reset:f}=CE(i);K4(e);const{forceUnmount:h}=Z4(i,e,()=>{f()}),p=jt(j=>{const L=Mn(j);return L.preventUnmountOnClose=()=>{e.set("preventUnmountingOnClose",!0)},L}),y=x.useCallback(()=>{e.setOpen(!1,p(O4))},[e,p]);x.useImperativeHandle(r,()=>({unmount:h,close:y}),[h,y]);const v=tF({popupStore:e,onOpenChange:e.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[w,b]=x.useState(0),_=w===0,E=rF(v),M=kE(v,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?"intentional":{mouse:s==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(j){if("button"in j&&j.button!==0||"touches"in j&&j.touches.length!==1)return!1;const L=Fi(j);if(_&&!a){const z=L;return s&&(e.context.internalBackdropRef.current||e.context.backdropRef.current)?e.context.internalBackdropRef.current===z||e.context.backdropRef.current===z||On(z,o)&&!z?.hasAttribute("data-base-ui-portal"):!0}return!1},escapeKey:_});RE(i&&s===!0,o);const{getReferenceProps:T,getFloatingProps:R,getTriggerProps:A}=av([E,M]);e.useContextCallback("onNestedDialogOpen",j=>{b(j+1)}),e.useContextCallback("onNestedDialogClose",()=>{b(0)}),x.useEffect(()=>(n?.onNestedDialogOpen&&i&&n.onNestedDialogOpen(w),n?.onNestedDialogClose&&!i&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&i&&n.onNestedDialogClose()}),[i,n,w]);const P=x.useMemo(()=>T(u),[T,u]),k=x.useMemo(()=>A(u),[A,u]),N=x.useMemo(()=>R(),[R]);e.useSyncedValues({openMethod:c,activeTriggerProps:P,inactiveTriggerProps:k,popupProps:N,floatingRootContext:v,nestedOpenDialogCount:w})}const gre={...Q4,modal:At(t=>t.modal),nested:At(t=>t.nested),nestedOpenDialogCount:At(t=>t.nestedOpenDialogCount),disablePointerDismissal:At(t=>t.disablePointerDismissal),openMethod:At(t=>t.openMethod),descriptionElementId:At(t=>t.descriptionElementId),titleElementId:At(t=>t.titleElementId),viewportElement:At(t=>t.viewportElement),role:At(t=>t.role)};class yre extends fE{constructor(e){super(vre(e),{popupRef:x.createRef(),backdropRef:x.createRef(),internalBackdropRef:x.createRef(),triggerElements:new iv,onOpenChange:void 0,onOpenChangeComplete:void 0},gre)}setOpen=(e,n)=>{if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!e&&n.trigger==null&&this.state.activeTriggerId!=null&&(n.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,n),n.isCanceled)return;const r={open:e,nativeEvent:n.event,reason:n.reason,nested:this.state.nested};this.state.floatingRootContext.context.events?.emit("openchange",r);const i={open:e},a=n.trigger?.id??null;(a||e)&&(i.activeTriggerId=a,i.activeTriggerElement=n.trigger??null),this.update(i)}}function vre(t={}){return{...J4(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:"dialog",...t}}function OF(t){const{children:e,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,disablePointerDismissal:s=!1,modal:o=!0,actionsRef:c,handle:u,triggerId:f,defaultTriggerId:h=null}=t,p=Hl(!0),y=!!p,v=Vi(()=>u?.store??new yre({open:n??r,activeTriggerId:f!==void 0?f:h,modal:o,disablePointerDismissal:s,nested:y})).current;v.useControlledProp("open",n,r),v.useControlledProp("activeTriggerId",f,h),v.useSyncedValues({disablePointerDismissal:s,nested:y,modal:o}),v.useContextCallback("onOpenChange",i),v.useContextCallback("onOpenChangeComplete",a);const w=v.useState("payload");mre({store:v,actionsRef:c,parentContext:p?.store.context});const b=x.useMemo(()=>({store:v}),[v]);return m.jsx(RF.Provider,{value:b,children:typeof e=="function"?e({payload:w}):e})}let oP=(function(t){return t[t.open=Ja.open]="open",t[t.closed=Ja.closed]="closed",t[t.startingStyle=Ja.startingStyle]="startingStyle",t[t.endingStyle=Ja.endingStyle]="endingStyle",t.nested="data-nested",t.nestedDialogOpen="data-nested-dialog-open",t})({});const xre={...du,...lf,nested(t){return t?{[oP.nested]:""}:null},nestedDialogOpen(t){return t?{[oP.nestedDialogOpen]:""}:null}},FF=x.forwardRef(function(e,n){const{className:r,render:i,children:a,...s}=e,o=DF(),{store:c}=Hl(),u=c.useState("open"),f=c.useState("nested"),h=c.useState("transitionStatus"),p=c.useState("nestedOpenDialogCount"),y=c.useState("mounted"),v=p>0,w=x.useMemo(()=>({open:u,nested:f,transitionStatus:h,nestedDialogOpen:v}),[u,f,h,v]);return Xr("div",e,{enabled:o||y,state:w,ref:[n,c.useStateSetter("viewportElement")],stateAttributesMapping:xre,props:[{role:"presentation",hidden:!y,children:a},s]})}),UF=x.forwardRef(function(e,n){const{render:r,className:i,id:a,...s}=e,{store:o}=Hl(),c=ov(a);return o.useSyncedValueWithCleanup("titleElementId",c),Xr("h2",e,{ref:n,props:[{id:c},s]})});function bre({open:t,title:e,description:n,confirmLabel:r,cancelLabel:i,destructive:a=!1,busy:s=!1,onConfirm:o,onCancel:c}){return m.jsx(OF,{open:t,onOpenChange:u=>{!u&&!s&&c?.()},children:m.jsxs(IF,{children:[m.jsx(PF,{className:"fixed inset-0 z-[100] bg-black/40 backdrop-blur-[2px] transition-opacity duration-200 ease-out data-[ending-style]:opacity-0 data-[starting-style]:opacity-0"}),m.jsx(FF,{className:"fixed inset-0 z-[101] flex items-center justify-center p-4",children:m.jsxs(LF,{className:"relative w-full max-w-md rounded-2xl bg-white p-6 shadow-[0_20px_60px_-20px_rgba(0,0,0,0.25)] ring-1 ring-oai-gray-200 transition-[opacity,transform] duration-[220ms] ease-[cubic-bezier(0.16,1,0.3,1)] data-[ending-style]:translate-y-2 data-[ending-style]:scale-[0.96] data-[ending-style]:opacity-0 data-[starting-style]:translate-y-2 data-[starting-style]:scale-[0.96] data-[starting-style]:opacity-0 dark:bg-oai-gray-950 dark:shadow-[0_20px_60px_-10px_rgba(0,0,0,0.65)] dark:ring-oai-gray-800",children:[m.jsx(UF,{className:"text-base font-semibold text-oai-black dark:text-white",children:e}),n?m.jsx(dre,{className:"mt-2 text-sm leading-6 text-oai-gray-600 dark:text-oai-gray-300",children:n}):null,m.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[m.jsx(Ui,{type:"button",variant:"secondary",size:"sm",disabled:s,onClick:()=>c?.(),children:i}),m.jsx(Ui,{type:"button",size:"sm",disabled:s,onClick:()=>o?.(),className:yt(a&&"!bg-red-600 hover:!bg-red-700 focus-visible:!outline-red-600 dark:!bg-red-600 dark:hover:!bg-red-500"),children:r})]})]})})]})})}function jF({value:t,onChange:e,placeholder:n,disabled:r=!1,type:i="text",label:a,error:s,className:o="",...c}){const p=`w-full bg-oai-white dark:bg-oai-gray-900 border border-oai-gray-300 dark:border-oai-gray-700 rounded-md text-oai-black dark:text-oai-white placeholder-oai-gray-400 dark:placeholder-oai-gray-500 transition-all duration-200 focus:outline-none focus:border-oai-brand dark:focus:border-oai-brand focus:ring-1 focus:ring-oai-brand/30 ${r?"bg-oai-gray-50 dark:bg-oai-gray-800 text-oai-gray-400 dark:text-oai-gray-400 cursor-not-allowed":""} ${s?"border-oai-error focus:border-oai-error focus:ring-oai-error/30":""} h-10 px-3 text-sm ${o}`;return m.jsxs("div",{className:"w-full",children:[a&&m.jsx("label",{className:"block text-sm font-medium text-oai-gray-700 dark:text-oai-gray-300 mb-1.5 transition-colors duration-200",children:a}),m.jsx("input",{type:i,value:t,onChange:e,placeholder:n,disabled:r,className:p,...c}),s&&m.jsx("p",{className:"mt-1.5 text-sm text-oai-error",children:s})]})}var _re={};function wre(t,e){return t==="."?{width:"0.34ch",justifyContent:"center",marginInline:"-0.04ch"}:t===","?{width:"0.08ch",justifyContent:"center",marginInline:"-0.30ch"}:{width:"0.72ch",justifyContent:"flex-start",paddingLeft:"0.04ch",height:e}}function Sre({mv:t,digit:e,height:n}){const r=MO(t,i=>{const a=(i%10+10)%10,s=(10+e-a)%10;let o=s*n;return s>5&&(o-=10*n),o});return m.jsx(fr.span,{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",y:r},children:e})}function kre(t){const e=Math.round(t),n=1e-9*Math.max(1,Math.abs(t));return Math.abs(t-e)<n?e:t}function Ere(t,e){const n=t/e;return Math.floor(kre(n))}function Mre(t){const e=String(t??""),n=Array.from(e),r=n.indexOf(".");let i=n.filter((o,c)=>/\d/.test(o)&&(r===-1||c<r)).length,a=0,s=!1;return n.map(o=>{if(!/\d/.test(o))return o==="."&&(s=!0),o;if(!s){const c=10**Math.max(i-1,0);return i-=1,c}return a+=1,10**-a})}function Tre({place:t,value:e,height:n,digitStyle:r,shouldReduceMotion:i}){if(typeof t!="number"){const c=wre(t,n);return m.jsx("span",{"data-counter-token":"static",className:"relative inline-flex items-center justify-center",style:{height:n,...c,...r},children:t})}const a=Ere(e,t),s=rE(0),o=wK(s,{stiffness:220,damping:26,mass:.8});return x.useEffect(()=>{s.set(a)},[s,a]),i?m.jsx("span",{"data-counter-token":"digit",className:"relative inline-flex items-center justify-center overflow-hidden",style:{height:n,position:"relative",width:"0.9ch",fontVariantNumeric:"tabular-nums",...r},children:Math.abs(a)%10}):m.jsx("span",{"data-counter-token":"digit",className:"relative inline-flex overflow-hidden",style:{height:n,position:"relative",width:"0.9ch",fontVariantNumeric:"tabular-nums",...r},children:Array.from({length:10},(c,u)=>m.jsx(Sre,{mv:o,digit:u,height:n},u))})}function Cre({value:t,displayValue:e,fontSize:n=72,padding:r=0,places:i,gap:a=6,borderRadius:s=4,horizontalPadding:o=0,textColor:c="inherit",fontWeight:u="inherit",containerStyle:f,counterStyle:h,digitStyle:p,gradientHeight:y=14,gradientFrom:v="rgba(255,255,255,0.95)",gradientTo:w="rgba(255,255,255,0)",topGradientStyle:b,bottomGradientStyle:_}){const E=String(e??t??""),M=x.useMemo(()=>Array.isArray(i)&&i.length?i:Mre(E),[i,E]),T=typeof navigator<"u"&&/jsdom/i.test(navigator.userAgent||"")||typeof process<"u"&&_re?.VITEST==="true",R=ou()||T,A=Number.isFinite(Number(t))?Math.abs(Number(t)):0,P=n+r;return R?m.jsx("span",{"data-counter-root":"true",style:{display:"inline-flex",alignItems:"center",color:c,fontSize:n,fontWeight:u,lineHeight:1,...f,...h},children:E}):m.jsxs("span",{"data-counter-root":"true",style:{position:"relative",display:"inline-block",...f},children:[m.jsx("span",{style:{fontSize:n,display:"flex",gap:a,overflow:"hidden",borderRadius:s,paddingLeft:o,paddingRight:o,lineHeight:1,color:c,fontWeight:u,...h},children:M.map((k,N)=>m.jsx(Tre,{place:k,value:A,height:P,digitStyle:p,shouldReduceMotion:R},`${String(k)}-${N}`))}),m.jsxs("span",{style:{pointerEvents:"none",position:"absolute",inset:0,display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[m.jsx("span",{style:b??{height:y,background:`linear-gradient(to bottom, ${v}, ${w})`}}),m.jsx("span",{style:_??{height:y,background:`linear-gradient(to top, ${v}, ${w})`}})]})]})}function Are(t){if(!Number.isFinite(t))return F("shared.placeholder.short");const e=Oy(t.toFixed(2),{decimals:2});return e==="-"?F("shared.placeholder.short"):e}function lP(t){return!Number.isFinite(t)||t<=0?null:t<.01?"<$0.01":Oy(t.toFixed(2),{decimals:2})}function cP(t){const e=Number(t);return!Number.isFinite(e)||e<=0?null:Iy(e,{decimals:1})}const Rre=ot.memo(function({isOpen:e,onClose:n,fleetData:r=[]}){const i=x.useMemo(()=>(Array.isArray(r)?r:[]).map(s=>{const o=ti(s?.usd)??0,c=ti(s?.usage)??0,u=Array.isArray(s?.models)?s.models:[];return{label:s?.label?String(s.label):"",usdValue:o,usdLabel:lP(o),tokensLabel:cP(c),models:u.map(f=>{const h=ti(f?.usage)??0,p=ti(f?.cost)??0;return{id:f?.id?String(f.id):"",name:f?.name?String(f.name):"",tokensLabel:cP(h),costLabel:lP(p),sortCost:p}}).filter(f=>f.costLabel||f.tokensLabel).sort((f,h)=>h.sortCost-f.sortCost)}}).filter(s=>s.usdValue>0||s.models.length>0).sort((s,o)=>o.usdValue-s.usdValue),[r]),a=x.useMemo(()=>{const s=i.reduce((o,c)=>o+c.usdValue,0);return Are(s)},[i]);return m.jsx(OF,{open:e,onOpenChange:s=>{s||n?.()},children:m.jsxs(IF,{children:[m.jsx(PF,{className:"cost-modal-backdrop","data-cost-analysis-backdrop":"true"}),m.jsx(FF,{className:"fixed inset-0 z-[101] flex items-center justify-center p-4",children:m.jsxs(LF,{className:"cost-modal-popup relative w-full max-w-[460px] max-h-[calc(100vh-2rem)] flex flex-col rounded-2xl bg-white dark:bg-oai-gray-950 shadow-[0_20px_60px_-20px_rgba(0,0,0,0.25)] dark:shadow-[0_20px_60px_-10px_rgba(0,0,0,0.65)] ring-1 ring-oai-gray-200 dark:ring-oai-gray-800 overflow-hidden",children:[m.jsx(UF,{render:m.jsx("h2",{className:"sr-only"}),children:F("dashboard.cost_breakdown.title")}),m.jsx(ure,{type:"button",className:"absolute top-3 right-3 flex h-9 w-9 items-center justify-center rounded-md text-oai-gray-500 dark:text-oai-gray-400 hover:text-oai-gray-800 dark:hover:text-oai-gray-100 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-brand/50 transition-colors z-10","aria-label":F("dashboard.cost_breakdown.close"),children:m.jsx(Ak,{size:16,strokeWidth:2,"aria-hidden":!0})}),m.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto oai-scrollbar",children:m.jsxs("div",{className:"px-3 py-6",children:[m.jsx("p",{className:"text-label uppercase tracking-[0.12em] text-oai-gray-500 dark:text-oai-gray-400 mb-2",children:F("dashboard.cost_breakdown.total_label")}),m.jsx("p",{className:"font-bold text-oai-brand tabular-nums tracking-tight leading-none mb-6",style:{fontSize:"clamp(24px, 6.5vw, 32px)"},children:a}),i.length===0?m.jsx("p",{className:"text-body-sm text-oai-gray-500 dark:text-oai-gray-400",children:"No spend recorded."}):m.jsxs("div",{role:"table","aria-label":F("dashboard.cost_breakdown.title"),children:[m.jsxs("div",{role:"row",className:"flex items-center justify-between gap-4 py-2 mb-2 border-b border-oai-gray-200 dark:border-oai-gray-800 text-label uppercase text-oai-gray-500 dark:text-oai-gray-400",children:[m.jsx("span",{role:"columnheader",children:"Model"}),m.jsx("span",{role:"columnheader",children:"Cost"})]}),i.map((s,o)=>{const c=`fleet-${o}`;return m.jsxs("div",{role:"rowgroup","aria-labelledby":c,className:o>0?"mt-5":"mt-2",children:[m.jsxs("div",{role:"row",className:"flex items-center justify-between gap-4 py-2",children:[m.jsx("span",{id:c,role:"rowheader",className:"flex-1 min-w-0 text-body-sm font-semibold text-oai-black dark:text-oai-white truncate leading-none",children:s.label}),m.jsx("span",{role:"cell",className:"shrink-0 text-body-sm font-semibold text-oai-black dark:text-oai-white tabular-nums leading-none",children:s.usdLabel||"—"})]}),s.models.map((u,f)=>m.jsxs("div",{role:"row",className:"flex items-center justify-between gap-4 py-[5px]",children:[m.jsx("span",{role:"cell",className:"flex-1 min-w-0 text-caption text-oai-gray-500 dark:text-oai-gray-400 truncate leading-none",title:u.name,children:u.name}),m.jsx("span",{role:"cell",className:"shrink-0 text-caption text-oai-gray-700 dark:text-oai-gray-300 tabular-nums leading-none",children:u.costLabel||""})]},u.id||`${u.name}-${f}`))]},`${s.label}-${o}`)})]})]})})]})})]})})});function Pre({projectEntries:t=[],projectLimit:e=3,onProjectLimitChange:n,copy:r,hasDetailsActual:i,dailyEmptyPrefix:a,installSyncCmd:s,dailyEmptySuffix:o,detailsColumns:c,ariaSortFor:u,toggleSort:f,sortIconFor:h,pagedDetails:p,dailyBreakdownRows:y=[],dailyBreakdownColumns:v=[],dailyBreakdownAriaSortFor:w,dailyBreakdownSortIconFor:b,dailyBreakdownDateKey:_="day",detailsDateKey:E,renderDetailDate:M,renderDailyBreakdownDate:T,renderDetailCell:R,DETAILS_PAGED_PERIODS:A,period:P,detailsPageCount:k,detailsPage:N,setDetailsPage:j}){const[L,z]=x.useState("daily");return m.jsxs(fu,{children:[m.jsxs("div",{className:"flex items-center justify-between gap-3 mb-4",children:[m.jsxs("div",{role:"tablist","aria-label":"Data view",className:"flex gap-1",children:[m.jsx("button",{role:"tab","aria-selected":L==="daily",type:"button",onClick:()=>z("daily"),className:`text-xs font-medium px-3 py-1.5 rounded transition-colors ${L==="daily"?"text-oai-black dark:text-oai-white bg-oai-gray-100 dark:bg-oai-gray-800":"text-oai-gray-500 dark:text-oai-gray-300 hover:text-oai-black dark:hover:text-oai-white hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/50"}`,children:r("dashboard.daily.title")}),m.jsx("button",{role:"tab","aria-selected":L==="projects",type:"button",onClick:()=>z("projects"),className:`text-xs font-medium px-3 py-1.5 rounded transition-colors ${L==="projects"?"text-oai-black dark:text-oai-white bg-oai-gray-100 dark:bg-oai-gray-800":"text-oai-gray-500 dark:text-oai-gray-300 hover:text-oai-black dark:hover:text-oai-white hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800/50"}`,children:r("dashboard.projects.title")})]}),L==="projects"&&m.jsxs("select",{"aria-label":"Number of projects to display",value:e,onChange:U=>n?.(Number(U.target.value)),className:"text-xs text-oai-gray-600 dark:text-oai-gray-300 bg-white dark:bg-oai-gray-900 border border-oai-gray-200 dark:border-oai-gray-700 rounded px-2 py-1 hover:border-oai-gray-300 dark:hover:border-oai-gray-600 focus:border-oai-brand dark:focus:border-oai-brand focus:outline-none transition-colors",children:[m.jsx("option",{value:3,children:r("dashboard.projects.limit_top_3")}),m.jsx("option",{value:6,children:r("dashboard.projects.limit_top_6")}),m.jsx("option",{value:10,children:r("dashboard.projects.limit_top_10")})]})]}),L==="projects"&&m.jsx("div",{className:"space-y-1",children:t.slice(0,e).map(U=>m.jsxs("a",{href:U?.project_ref||"#",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-3 p-2 rounded-lg hover:oai-bg-elevated transition-colors",children:[m.jsx("div",{className:"w-8 h-8 rounded-md oai-bg-elevated flex items-center justify-center oai-text-caption font-medium text-oai-gray-500 dark:text-oai-gray-300",children:(U?.project_key?.[0]||"?").toUpperCase()}),m.jsx("div",{className:"min-w-0 flex-1",children:m.jsx("div",{className:"oai-text-body-sm font-medium text-oai-black dark:text-oai-white truncate",children:U?.project_key||U?.project_ref?.split("/")?.pop()||"—"})}),m.jsx("div",{className:"oai-text-body-sm font-medium text-oai-black dark:text-oai-white tabular-nums",children:U?.billable_total_tokens?.toLocaleString?.()||U?.total_tokens?.toLocaleString?.()||"—"})]},U?.project_key||U?.project_ref))}),L==="daily"&&m.jsxs("div",{children:[y?.length===0?m.jsxs("div",{className:"oai-text-body-sm text-oai-gray-500 dark:text-oai-gray-300 mb-4",children:[a,m.jsx("code",{className:"mx-1 rounded border border-oai-gray-300 dark:border-oai-gray-700 oai-bg-elevated px-1.5 py-0.5 font-mono oai-text-caption",children:s}),o]}):m.jsx("div",{className:"overflow-auto max-h-[384px] -mx-4 oai-scrollbar",children:m.jsxs("table",{className:"w-full border-collapse",children:[m.jsx("thead",{className:"sticky top-0 z-10",children:m.jsx("tr",{className:"border-b border-oai-gray-200 dark:border-oai-gray-700",children:v.map(U=>m.jsx("th",{"aria-sort":w?.(U.key)||"none",className:"text-left p-0 bg-white dark:bg-oai-gray-900",children:m.jsx("button",{type:"button",onClick:()=>f(U.key),className:"flex w-full items-center justify-start px-4 py-2 text-left oai-text-caption font-semibold text-oai-gray-600 dark:text-oai-gray-300 hover:text-oai-black dark:hover:text-oai-white transition-colors",children:m.jsxs("span",{className:"inline-flex items-center gap-1",children:[m.jsx("span",{children:U.label}),m.jsx("span",{className:"text-oai-gray-400 dark:text-oai-gray-400",children:b?.(U.key)||""})]})})},U.key))})}),m.jsx("tbody",{children:y.map(U=>m.jsxs("tr",{className:`border-b border-oai-gray-100 dark:border-oai-gray-800 last:border-b-0 hover:bg-oai-gray-50/50 dark:hover:bg-oai-gray-800/50 transition-colors ${U.missing?"text-oai-gray-400 dark:text-oai-gray-400":U.future?"text-oai-gray-300 dark:text-oai-gray-600":"text-oai-black dark:text-oai-white"}`,children:[m.jsx("td",{className:"px-4 py-2 oai-text-body-sm text-oai-gray-500 dark:text-oai-gray-300",children:T?T(U):M(U)}),m.jsx("td",{className:"px-4 py-2 oai-text-body-sm font-medium text-oai-black dark:text-oai-white tabular-nums",children:R(U,"total_tokens")}),m.jsx("td",{className:"px-4 py-2 oai-text-body-sm text-oai-gray-600 dark:text-oai-gray-300 tabular-nums",children:R(U,"input_tokens")}),m.jsx("td",{className:"px-4 py-2 oai-text-body-sm text-oai-gray-600 dark:text-oai-gray-300 tabular-nums",children:R(U,"output_tokens")}),m.jsx("td",{className:"px-4 py-2 oai-text-body-sm text-oai-gray-600 dark:text-oai-gray-300 tabular-nums",children:R(U,"cached_input_tokens")}),m.jsx("td",{className:"px-4 py-2 oai-text-body-sm text-oai-gray-600 dark:text-oai-gray-300 tabular-nums",children:R(U,"reasoning_output_tokens")}),m.jsx("td",{className:"px-4 py-2 oai-text-body-sm text-oai-gray-600 dark:text-oai-gray-300 tabular-nums",children:R(U,"conversation_count")})]},String(U?.[_]||U?.day||U?.hour||U?.month||"")))})]})}),L!=="daily"&&A.has(P)&&k>1?m.jsxs("div",{className:"mt-3 flex items-center justify-between oai-text-caption",children:[m.jsx("button",{type:"button",onClick:()=>j(U=>Math.max(0,U-1)),disabled:N===0,className:"px-3 py-1.5 text-oai-gray-600 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 rounded-md disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:r("details.pagination.prev")}),m.jsxs("span",{className:"oai-text-muted",children:[N+1," / ",k]}),m.jsx("button",{type:"button",onClick:()=>j(U=>Math.min(k-1,U+1)),disabled:N+1>=k,className:"px-3 py-1.5 text-oai-gray-600 dark:text-oai-gray-300 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 rounded-md disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:r("details.pagination.next")})]}):null]})]})}function Rl({children:t,delay:e=0,duration:n=.4,y:r=20,className:i="",once:a=!0}){return ou()?m.jsx("div",{className:i,children:t}):m.jsx(fr.div,{initial:{opacity:0,y:r},animate:{opacity:1,y:0},transition:{duration:n,delay:e,ease:[.25,.1,.25,1]},className:i,children:t})}function Nre({children:t,staggerDelay:e=.1,initialDelay:n=0,className:r=""}){return ou()?m.jsx("div",{className:r,children:t}):m.jsx(fr.div,{initial:"hidden",animate:"visible",variants:{hidden:{},visible:{transition:{staggerChildren:e,delayChildren:n}}},className:r,children:t})}function Dre({children:t,className:e="",y:n=20}){return ou()?m.jsx("div",{className:e,children:t}):m.jsx(fr.div,{variants:{hidden:{opacity:0,y:n},visible:{opacity:1,y:0,transition:{duration:.4,ease:[.25,.1,.25,1]}}},className:e,children:t})}function _0(t){return typeof t!="string"?"":t.trim()}function uP(t){const e=_0(t);return e?e.split(/[_\-\s]+/).filter(Boolean).map(n=>n.slice(0,1).toUpperCase()+n.slice(1).toLowerCase()).join(" "):""}function Lre(t){if(!Array.isArray(t))return[];const e=new Map;for(const n of t){if(!n||typeof n!="object")continue;const r=_0(n.tool),i=_0(n.planType)||_0(n.plan_type);if(!r||!i)continue;const a=uP(r)||r,s=uP(i)||i;e.set(`${r.toLowerCase()}::${i.toLowerCase()}`,{tool:a,plan:s})}return Array.from(e.values())}function Ire({period:t="month",rankLabel:e,streakDays:n,subscriptions:r=[],periodConversations:i,rolling:a,topModels:s=[],className:o=""}){const c=F("shared.placeholder.short"),u=F("shared.unit.percent"),f=e??F("identity_card.rank_placeholder"),h=Number.isFinite(Number(n))?Number(n):0,p=h?F("identity_card.streak_value",{days:h}):F("identity_card.rank_placeholder"),y=Lre(r),v={thousandSuffix:F("shared.unit.thousand_abbrev"),millionSuffix:F("shared.unit.million_abbrev"),billionSuffix:F("shared.unit.billion_abbrev")},w=E=>{if(E==null)return c;const M=Iy(E,v);return M==="-"?c:M},b=(()=>{switch(t){case"day":return F("stats.period.today");case"week":return F("stats.period.week");case"month":return F("stats.period.month");case"total":return F("stats.period.all");default:return F("stats.period.convs")}})(),_=s.slice(0,3);return m.jsx(Rl,{delay:.1,children:m.jsxs(fu,{className:`h-full ${o}`,children:[m.jsxs("div",{className:"grid grid-cols-4 gap-2",children:[m.jsxs("div",{className:"flex flex-col items-center justify-center px-2 py-2 bg-oai-gray-50 dark:bg-oai-gray-800 rounded-lg",children:[m.jsx("span",{className:"text-sm font-semibold text-oai-black dark:text-oai-white tabular-nums",children:w(a?.last_7d?.totals?.billable_total_tokens)}),m.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-400 mt-0.5 whitespace-nowrap",children:"7d"})]}),m.jsxs("div",{className:"flex flex-col items-center justify-center px-2 py-2 bg-oai-gray-50 dark:bg-oai-gray-800 rounded-lg",children:[m.jsx("span",{className:"text-sm font-semibold text-oai-black dark:text-oai-white tabular-nums",children:w(a?.last_30d?.totals?.billable_total_tokens)}),m.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-400 mt-0.5 whitespace-nowrap",children:"30d"})]}),m.jsxs("div",{className:"flex flex-col items-center justify-center px-2 py-2 bg-oai-gray-50 dark:bg-oai-gray-800 rounded-lg",children:[m.jsx("span",{className:"text-sm font-semibold text-oai-black dark:text-oai-white tabular-nums",children:w(a?.last_30d?.avg_per_active_day)}),m.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-400 mt-0.5 whitespace-nowrap",children:"avg"})]}),m.jsxs("div",{className:"flex flex-col items-center justify-center px-2 py-2 bg-oai-gray-50 dark:bg-oai-gray-800 rounded-lg",children:[m.jsx("span",{className:"text-sm font-semibold text-oai-black dark:text-oai-white tabular-nums",children:w(i)}),m.jsx("span",{className:"text-[10px] text-oai-gray-400 dark:text-oai-gray-400 mt-0.5 whitespace-nowrap",children:b})]})]}),_.length>0&&m.jsx("div",{className:"mt-4 pt-3 border-t border-oai-gray-100 dark:border-oai-gray-800",children:_.map((E,M)=>{const T=E?.name?String(E.name):c,R=E?.percent?String(E.percent):"",A=M===_.length-1,P=M+1;return m.jsxs("div",{className:`flex items-center py-2 ${A?"":"border-b border-oai-gray-50 dark:border-oai-gray-800"}`,children:[m.jsx("span",{className:"w-5 h-5 flex items-center justify-center rounded-full bg-oai-gray-100 dark:bg-oai-gray-800 text-[10px] font-semibold text-oai-gray-500 dark:text-oai-gray-300 flex-shrink-0",children:P}),m.jsx("span",{className:"flex-1 text-sm text-oai-gray-700 dark:text-oai-gray-300 truncate px-2.5",title:T,children:T}),m.jsxs("span",{className:"text-sm font-semibold text-oai-black dark:text-oai-white tabular-nums flex-shrink-0",children:[R,u]})]},E.id||T)})}),y.length>0&&m.jsx("div",{className:"mt-3 pt-3 border-t border-oai-gray-100 dark:border-oai-gray-800 flex flex-wrap gap-1.5",children:y.map((E,M)=>m.jsxs(lre,{variant:"secondary",size:"sm",children:[E.tool," ",E.plan]},`${E.tool}:${E.plan}:${M}`))}),m.jsxs("div",{className:"mt-4 pt-3 border-t border-oai-gray-100 dark:border-oai-gray-800 flex items-center justify-between text-xs text-oai-gray-400 dark:text-oai-gray-400",children:[m.jsxs("div",{className:"flex items-center gap-1.5",children:[m.jsx("span",{children:F("identity_card.rank_label")}),m.jsx("span",{className:"text-oai-gray-500 dark:text-oai-gray-300 tabular-nums",children:f})]}),m.jsxs("div",{className:"flex items-center gap-1",children:[m.jsx("span",{children:F("identity_card.streak_label")}),m.jsx("span",{className:"text-oai-gray-500 dark:text-oai-gray-300 tabular-nums",children:p})]})]})]})})}const BF=x.createContext(void 0);function Op(t){const e=x.useContext(BF);if(e===void 0&&!t)throw new Error(Wi(47));return e}function Ore(){return{...J4(),disabled:!1,modal:!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 Fre={...Q4,disabled:At(t=>t.disabled),instantType:At(t=>t.instantType),openMethod:At(t=>t.openMethod),openChangeReason:At(t=>t.openChangeReason),modal:At(t=>t.modal),stickIfOpen:At(t=>t.stickIfOpen),titleElementId:At(t=>t.titleElementId),descriptionElementId:At(t=>t.descriptionElementId),openOnHover:At(t=>t.openOnHover),closeDelay:At(t=>t.closeDelay),hasViewport:At(t=>t.hasViewport)};class IE extends fE{constructor(e){const n={...Ore(),...e};n.open&&e?.mounted===void 0&&(n.mounted=!0),super(n,{popupRef:x.createRef(),backdropRef:x.createRef(),internalBackdropRef:x.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:x.createRef(),beforeContentFocusGuardRef:x.createRef(),stickIfOpenTimeout:new Ll,triggerElements:new iv},Fre)}setOpen=(e,n)=>{const r=n.reason===aa,i=n.reason===Al&&n.event.detail===0,a=!e&&(n.reason===I4||n.reason==null);if(n.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.(e,n),n.isCanceled)return;const s={open:e,nativeEvent:n.event,reason:n.reason,nested:this.state.nested,triggerElement:n.trigger};this.state.floatingRootContext.context.events?.emit("openchange",s);const c=()=>{const u={open:e,openChangeReason:n.reason},f=n.trigger?.id??null;(f||e)&&(u.activeTriggerId=f,u.activeTriggerElement=n.trigger??null),this.update(u)};r?(this.set("stickIfOpen",!0),this.context.stickIfOpenTimeout.start(RJ,()=>{this.set("stickIfOpen",!1)}),gi.flushSync(c)):c(),i||a?this.set("instantType",i?"click":"dismiss"):n.reason===Zc?this.set("instantType","focus"):this.set("instantType",void 0)};static useStore(e,n){const r=Vi(()=>new IE(n)).current,i=e??r;return hE(r.disposeEffect),i}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()}function dP({props:t}){const{children:e,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,modal:s=!1,handle:o,triggerId:c,defaultTriggerId:u=null}=t,f=IE.useStore(o?.store,{open:n??r,modal:s,activeTriggerId:c!==void 0?c:u});f.useControlledProp("open",n,r),f.useControlledProp("activeTriggerId",c,u);const h=f.useState("open"),p=f.useState("positionerElement"),y=f.useState("payload"),v=f.useState("openChangeReason");f.useContextCallback("onOpenChange",i),f.useContextCallback("onOpenChangeComplete",a);const{openMethod:w,triggerProps:b,reset:_}=CE(h);K4(f);const{forceUnmount:E}=Z4(h,f,()=>{f.update({stickIfOpen:!0,openChangeReason:null}),_()});RE(h&&s===!0&&v!==aa&&w!=="touch",p),x.useEffect(()=>{h||f.context.stickIfOpenTimeout.clear()},[f,h]);const M=x.useCallback(W=>{const K=Mn(W);return K.preventUnmountOnClose=()=>{f.set("preventUnmountingOnClose",!0)},K},[f]),T=x.useCallback(()=>{f.setOpen(!1,M(O4))},[f,M]);x.useImperativeHandle(t.actionsRef,()=>({unmount:E,close:T}),[E,T]);const R=tF({popupStore:f,onOpenChange:f.setOpen}),A=kE(R,{outsidePressEvent:{mouse:s==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}}),P=rF(R),{getReferenceProps:k,getFloatingProps:N,getTriggerProps:j}=av([A,P]),L=x.useMemo(()=>k(b),[k,b]),z=x.useMemo(()=>j(b),[j,b]),U=x.useMemo(()=>N(),[N]);f.useSyncedValues({modal:s,openMethod:w,activeTriggerProps:L,inactiveTriggerProps:z,popupProps:U,floatingRootContext:R,nested:zl()!=null});const V=x.useMemo(()=>({store:f}),[f]);return m.jsx(BF.Provider,{value:V,children:typeof e=="function"?e({payload:y}):e})}function zF(t){return Op(!0)?m.jsx(dP,{props:t}):m.jsx(dee,{children:m.jsx(dP,{props:t})})}const Ure=300,VF=x.forwardRef(function(e,n){const{render:r,className:i,disabled:a=!1,nativeButton:s=!0,handle:o,payload:c,openOnHover:u=!1,delay:f=Ure,closeDelay:h=0,id:p,...y}=e,v=Op(!0),w=o?.store??v?.store;if(!w)throw new Error(Wi(74));const b=ov(p),_=w.useState("isTriggerActive",b),E=w.useState("floatingRootContext"),M=w.useState("isOpenedByTrigger",b),T=x.useRef(null),{registerTrigger:R,isMountedByThisTrigger:A}=yte(b,T,w,{payload:c,disabled:a,openOnHover:u,closeDelay:h}),P=w.useState("openChangeReason"),k=w.useState("stickIfOpen"),N=w.useState("openMethod"),j=Mte(E,{enabled:E!=null&&u&&(N!=="touch"||P!==Al),mouseOnly:!0,move:!1,handleClose:Lte(),restMs:f,delay:{close:h},triggerElementRef:T,isActiveTrigger:_}),L=B4(E,{enabled:E!=null,stickIfOpen:k}),z=av([L]),U=w.useState("triggerProps",A),V=x.useMemo(()=>({disabled:a,open:M}),[a,M]),{getButtonProps:W,buttonRef:K}=ev({disabled:a,native:s}),Q=x.useMemo(()=>({open(te){return te&&P===Al?hF.open(te):fF.open(te)}}),[P]),O=Xr("button",e,{state:V,ref:[K,n,R,T],props:[z.getReferenceProps(),j,U,{[i4]:"",id:b},y,W],stateAttributesMapping:Q}),G=x.useRef(null),Y=jt(te=>{gi.flushSync(()=>{w.setOpen(!1,Mn(Zc,te.nativeEvent,te.currentTarget))}),iee(G.current)?.focus()}),H=jt(te=>{const re=w.select("positionerElement");if(re&&Td(te,re))w.context.beforeContentFocusGuardRef.current?.focus();else{gi.flushSync(()=>{w.setOpen(!1,Mn(Zc,te.nativeEvent,te.currentTarget))});let ue=ree(w.context.triggerFocusTargetRef.current||T.current);for(;ue!==null&&On(re,ue);){const ce=ue;if(ue=vE(ue),ue===ce)break}ue?.focus()}});return _?m.jsxs(x.Fragment,{children:[m.jsx(Vd,{ref:G,onFocus:Y}),m.jsx(x.Fragment,{children:O},b),m.jsx(Vd,{ref:w.context.triggerFocusTargetRef,onFocus:H})]}):m.jsx(x.Fragment,{children:O},b)}),HF=x.createContext(void 0);function jre(){const t=x.useContext(HF);if(t===void 0)throw new Error(Wi(45));return t}const WF=x.forwardRef(function(e,n){const{keepMounted:r=!1,...i}=e,{store:a}=Op();return a.useState("mounted")||r?m.jsx(HF.Provider,{value:r,children:m.jsx(bE,{ref:n,...i,renderGuards:!1})}):null}),GF=x.createContext(void 0);function Bre(){const t=x.useContext(GF);if(!t)throw new Error(Wi(46));return t}const $F=x.forwardRef(function(e,n){const{render:r,className:i,anchor:a,positionMethod:s="absolute",side:o="bottom",align:c="center",sideOffset:u=0,alignOffset:f=0,collisionBoundary:h="clipping-ancestors",collisionPadding:p=5,arrowPadding:y=5,sticky:v=!1,disableAnchorTracking:w=!1,collisionAvoidance:b=DJ,..._}=e,{store:E}=Op(),M=jre(),T=cee(),R=E.useState("floatingRootContext"),A=E.useState("mounted"),P=E.useState("open"),k=E.useState("openChangeReason"),N=E.useState("activeTriggerElement"),j=E.useState("modal"),L=E.useState("positionerElement"),z=E.useState("instantType"),U=E.useState("transitionStatus"),V=E.useState("hasViewport"),W=x.useRef(null),K=X4(L,!1,!1),Q=gF({anchor:a,floatingRootContext:R,positionMethod:s,mounted:A,side:o,sideOffset:u,align:c,alignOffset:f,arrowPadding:y,collisionBoundary:h,collisionPadding:p,sticky:v,disableAnchorTracking:w,keepMounted:M,nodeId:T,collisionAvoidance:b,adaptiveOrigin:V?Mne:void 0}),O=x.useMemo(()=>{const ue={};return P||(ue.pointerEvents="none"),{role:"presentation",hidden:!A,style:{...Q.positionerStyles,...ue}}},[P,A,Q.positionerStyles]),G=x.useMemo(()=>({props:O,...Q}),[O,Q]),Y=R?.select("domReferenceElement");Yt(()=>{const ue=Y,ce=W.current;if(ue&&(W.current=ue),ce&&ue&&ue!==ce){E.set("instantType",void 0);const ee=new AbortController;return K(()=>{E.set("instantType","trigger-change")},ee.signal),()=>{ee.abort()}}},[Y,K,E]);const H=x.useMemo(()=>({open:P,side:G.side,align:G.align,anchorHidden:G.anchorHidden,instant:z}),[P,G.side,G.align,G.anchorHidden,z]),te=x.useCallback(ue=>{E.set("positionerElement",ue)},[E]),re=Xr("div",e,{state:H,props:[G.props,DE(U),_],ref:[n,te],stateAttributesMapping:du});return m.jsxs(GF.Provider,{value:G,children:[A&&j===!0&&k!==aa&&m.jsx(PE,{ref:E.context.internalBackdropRef,inert:AE(!P),cutout:N}),m.jsx(uee,{id:T,children:re})]})}),zre={...du,...lf},YF=x.forwardRef(function(e,n){const{className:r,render:i,initialFocus:a,finalFocus:s,...o}=e,{store:c}=Op(),u=Bre(),f=xF()!=null,h=c.useState("open"),p=c.useState("openMethod"),y=c.useState("instantType"),v=c.useState("transitionStatus"),w=c.useState("popupProps"),b=c.useState("titleElementId"),_=c.useState("descriptionElementId"),E=c.useState("modal"),M=c.useState("mounted"),T=c.useState("openChangeReason"),R=c.useState("activeTriggerElement"),A=c.useState("floatingRootContext");cf({open:h,ref:c.context.popupRef,onComplete(){h&&c.context.onOpenChangeComplete?.(!0)}});const P=c.useState("disabled"),k=c.useState("openOnHover"),N=c.useState("closeDelay");Ste(A,{enabled:k&&!P,closeDelay:N});function j(W){return W==="touch"?c.context.popupRef.current:!0}const L=a===void 0?j:a,z=x.useMemo(()=>({open:h,side:u.side,align:u.align,instant:y,transitionStatus:v}),[h,u.side,u.align,y,v]),U=x.useCallback(W=>{c.set("popupElement",W)},[c]),V=Xr("div",e,{state:z,ref:[n,c.context.popupRef,U],props:[w,{"aria-labelledby":b,"aria-describedby":_,onKeyDown(W){f&&NE.has(W.key)&&W.stopPropagation()}},DE(v),o],stateAttributesMapping:zre});return m.jsx(wE,{context:A,openInteractionType:p,modal:E==="trap-focus",disabled:!M||T===aa,initialFocus:L,returnFocus:s,restoreFocus:"popup",previousFocusableElement:Ar(R)?R:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:V})});function Vre(t,e,n="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:t,timeZoneName:n}).format(e).split(/\s/g).slice(2).join(" ")}const Hre={},Mh={};function Pc(t,e){try{const r=(Hre[t]||=new Intl.DateTimeFormat("en-US",{timeZone:t,timeZoneName:"longOffset"}).format)(e).split("GMT")[1];return r in Mh?Mh[r]:fP(r,r.split(":"))}catch{if(t in Mh)return Mh[t];const n=t?.match(Wre);return n?fP(t,n.slice(1)):NaN}}const Wre=/([+-]\d\d):?(\d\d)?/;function fP(t,e){const n=+(e[0]||0),r=+(e[1]||0),i=+(e[2]||0)/60;return Mh[t]=n*60+r>0?n*60+r+i:n*60-r-i}class As extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]=="string"&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(Pc(this.timeZone,this))?this.setTime(NaN):e.length?typeof e[0]=="number"&&(e.length===1||e.length===2&&typeof e[1]!="number")?this.setTime(e[0]):typeof e[0]=="string"?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),qF(this),R1(this)):this.setTime(Date.now())}static tz(e,...n){return n.length?new As(...n,e):new As(Date.now(),e)}withTimeZone(e){return new As(+this,e)}getTimezoneOffset(){const e=-Pc(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),R1(this),+this}[Symbol.for("constructDateFrom")](e){return new As(+new Date(e),this.timeZone)}}const hP=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(t=>{if(!hP.test(t))return;const e=t.replace(hP,"$1UTC");As.prototype[e]&&(t.startsWith("get")?As.prototype[t]=function(){return this.internal[e]()}:(As.prototype[t]=function(){return Date.prototype[e].apply(this.internal,arguments),Gre(this),+this},As.prototype[e]=function(){return Date.prototype[e].apply(this,arguments),R1(this),+this}))});function R1(t){t.internal.setTime(+t),t.internal.setUTCSeconds(t.internal.getUTCSeconds()-Math.round(-Pc(t.timeZone,t)*60))}function Gre(t){Date.prototype.setFullYear.call(t,t.internal.getUTCFullYear(),t.internal.getUTCMonth(),t.internal.getUTCDate()),Date.prototype.setHours.call(t,t.internal.getUTCHours(),t.internal.getUTCMinutes(),t.internal.getUTCSeconds(),t.internal.getUTCMilliseconds()),qF(t)}function qF(t){const e=Pc(t.timeZone,t),n=e>0?Math.floor(e):Math.ceil(e),r=new Date(+t);r.setUTCHours(r.getUTCHours()-1);const i=-new Date(+t).getTimezoneOffset(),a=-new Date(+r).getTimezoneOffset(),s=i-a,o=Date.prototype.getHours.apply(t)!==t.internal.getUTCHours();s&&o&&t.internal.setUTCMinutes(t.internal.getUTCMinutes()+s);const c=i-n;c&&Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+c);const u=new Date(+t);u.setUTCSeconds(0);const f=i>0?u.getSeconds():(u.getSeconds()-60)%60,h=Math.round(-(Pc(t.timeZone,t)*60))%60;(h||f)&&(t.internal.setUTCSeconds(t.internal.getUTCSeconds()+h),Date.prototype.setUTCSeconds.call(t,Date.prototype.getUTCSeconds.call(t)+h+f));const p=Pc(t.timeZone,t),y=p>0?Math.floor(p):Math.ceil(p),w=-new Date(+t).getTimezoneOffset()-y,b=y!==n,_=w-c;if(b&&_){Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+_);const E=Pc(t.timeZone,t),M=E>0?Math.floor(E):Math.ceil(E),T=y-M;T&&(t.internal.setUTCMinutes(t.internal.getUTCMinutes()+T),Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+T))}}class mi extends As{static tz(e,...n){return n.length?new mi(...n,e):new mi(Date.now(),e)}toISOString(){const[e,n,r]=this.tzComponents(),i=`${e}${n}:${r}`;return this.internal.toISOString().slice(0,-1)+i}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[e,n,r,i]=this.internal.toUTCString().split(" ");return`${e?.slice(0,-1)} ${r} ${n} ${i}`}toTimeString(){const e=this.internal.toUTCString().split(" ")[4],[n,r,i]=this.tzComponents();return`${e} GMT${n}${r}${i} (${Vre(this.timeZone,this)})`}toLocaleString(e,n){return Date.prototype.toLocaleString.call(this,e,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleDateString(e,n){return Date.prototype.toLocaleDateString.call(this,e,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleTimeString(e,n){return Date.prototype.toLocaleTimeString.call(this,e,{...n,timeZone:n?.timeZone||this.timeZone})}tzComponents(){const e=this.getTimezoneOffset(),n=e>0?"-":"+",r=String(Math.floor(Math.abs(e)/60)).padStart(2,"0"),i=String(Math.abs(e)%60).padStart(2,"0");return[n,r,i]}withTimeZone(e){return new mi(+this,e)}[Symbol.for("constructDateFrom")](e){return new mi(+new Date(e),this.timeZone)}}const XF=6048e5,$re=864e5,pP=Symbol.for("constructDateFrom");function Dr(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&pP in t?t[pP](e):t instanceof Date?new t.constructor(e):new Date(e)}function Jn(t,e){return Dr(e||t,t)}function KF(t,e,n){const r=Jn(t,n?.in);return isNaN(e)?Dr(t,NaN):(e&&r.setDate(r.getDate()+e),r)}function ZF(t,e,n){const r=Jn(t,n?.in);if(isNaN(e))return Dr(t,NaN);if(!e)return r;const i=r.getDate(),a=Dr(t,r.getTime());a.setMonth(r.getMonth()+e+1,0);const s=a.getDate();return i>=s?a:(r.setFullYear(a.getFullYear(),a.getMonth(),i),r)}let Yre={};function Fp(){return Yre}function Wd(t,e){const n=Fp(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=Jn(t,e?.in),a=i.getDay(),s=(a<r?7:0)+a-r;return i.setDate(i.getDate()-s),i.setHours(0,0,0,0),i}function sp(t,e){return Wd(t,{...e,weekStartsOn:1})}function JF(t,e){const n=Jn(t,e?.in),r=n.getFullYear(),i=Dr(n,0);i.setFullYear(r+1,0,4),i.setHours(0,0,0,0);const a=sp(i),s=Dr(n,0);s.setFullYear(r,0,4),s.setHours(0,0,0,0);const o=sp(s);return n.getTime()>=a.getTime()?r+1:n.getTime()>=o.getTime()?r:r-1}function mP(t){const e=Jn(t),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+t-+n}function uf(t,...e){const n=Dr.bind(null,e.find(r=>typeof r=="object"));return e.map(n)}function op(t,e){const n=Jn(t,e?.in);return n.setHours(0,0,0,0),n}function OE(t,e,n){const[r,i]=uf(n?.in,t,e),a=op(r),s=op(i),o=+a-mP(a),c=+s-mP(s);return Math.round((o-c)/$re)}function qre(t,e){const n=JF(t,e),r=Dr(t,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),sp(r)}function Xre(t,e,n){return KF(t,e*7,n)}function Kre(t,e,n){return ZF(t,e*12,n)}function Zre(t,e){let n,r=e?.in;return t.forEach(i=>{!r&&typeof i=="object"&&(r=Dr.bind(null,i));const a=Jn(i,r);(!n||n<a||isNaN(+a))&&(n=a)}),Dr(r,n||NaN)}function Jre(t,e){let n,r=e?.in;return t.forEach(i=>{!r&&typeof i=="object"&&(r=Dr.bind(null,i));const a=Jn(i,r);(!n||n>a||isNaN(+a))&&(n=a)}),Dr(r,n||NaN)}function Qre(t,e,n){const[r,i]=uf(n?.in,t,e);return+op(r)==+op(i)}function QF(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function eie(t){return!(!QF(t)&&typeof t!="number"||isNaN(+Jn(t)))}function e5(t,e,n){const[r,i]=uf(n?.in,t,e),a=r.getFullYear()-i.getFullYear(),s=r.getMonth()-i.getMonth();return a*12+s}function tie(t,e){const n=Jn(t,e?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function t5(t,e){const[n,r]=uf(t,e.start,e.end);return{start:n,end:r}}function nie(t,e){const{start:n,end:r}=t5(e?.in,t);let i=+n>+r;const a=i?+n:+r,s=i?r:n;s.setHours(0,0,0,0),s.setDate(1);let o=1;const c=[];for(;+s<=a;)c.push(Dr(n,s)),s.setMonth(s.getMonth()+o);return i?c.reverse():c}function rie(t,e){const n=Jn(t,e?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function iie(t,e){const n=Jn(t,e?.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}function n5(t,e){const n=Jn(t,e?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function aie(t,e){const{start:n,end:r}=t5(e?.in,t);let i=+n>+r;const a=i?+n:+r,s=i?r:n;s.setHours(0,0,0,0),s.setMonth(0,1);let o=1;const c=[];for(;+s<=a;)c.push(Dr(n,s)),s.setFullYear(s.getFullYear()+o);return i?c.reverse():c}function r5(t,e){const n=Fp(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=Jn(t,e?.in),a=i.getDay(),s=(a<r?-7:0)+6-(a-r);return i.setDate(i.getDate()+s),i.setHours(23,59,59,999),i}function sie(t,e){return r5(t,{...e,weekStartsOn:1})}const oie={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},lie=(t,e,n)=>{let r;const i=oie[t];return typeof i=="string"?r=i:e===1?r=i.one:r=i.other.replace("{{count}}",e.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function h_(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const cie={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},uie={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},die={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},fie={date:h_({formats:cie,defaultWidth:"full"}),time:h_({formats:uie,defaultWidth:"full"}),dateTime:h_({formats:die,defaultWidth:"full"})},hie={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},pie=(t,e,n,r)=>hie[t];function lh(t){return(e,n)=>{const r=n?.context?String(n.context):"standalone";let i;if(r==="formatting"&&t.formattingValues){const s=t.defaultFormattingWidth||t.defaultWidth,o=n?.width?String(n.width):s;i=t.formattingValues[o]||t.formattingValues[s]}else{const s=t.defaultWidth,o=n?.width?String(n.width):t.defaultWidth;i=t.values[o]||t.values[s]}const a=t.argumentCallback?t.argumentCallback(e):e;return i[a]}}const mie={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},gie={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},yie={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},vie={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},xie={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},bie={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},_ie=(t,e)=>{const n=Number(t),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},wie={ordinalNumber:_ie,era:lh({values:mie,defaultWidth:"wide"}),quarter:lh({values:gie,defaultWidth:"wide",argumentCallback:t=>t-1}),month:lh({values:yie,defaultWidth:"wide"}),day:lh({values:vie,defaultWidth:"wide"}),dayPeriod:lh({values:xie,defaultWidth:"wide",formattingValues:bie,defaultFormattingWidth:"wide"})};function ch(t){return(e,n={})=>{const r=n.width,i=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],a=e.match(i);if(!a)return null;const s=a[0],o=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],c=Array.isArray(o)?kie(o,h=>h.test(s)):Sie(o,h=>h.test(s));let u;u=t.valueCallback?t.valueCallback(c):c,u=n.valueCallback?n.valueCallback(u):u;const f=e.slice(s.length);return{value:u,rest:f}}}function Sie(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function kie(t,e){for(let n=0;n<t.length;n++)if(e(t[n]))return n}function Eie(t){return(e,n={})=>{const r=e.match(t.matchPattern);if(!r)return null;const i=r[0],a=e.match(t.parsePattern);if(!a)return null;let s=t.valueCallback?t.valueCallback(a[0]):a[0];s=n.valueCallback?n.valueCallback(s):s;const o=e.slice(i.length);return{value:s,rest:o}}}const Mie=/^(\d+)(th|st|nd|rd)?/i,Tie=/\d+/i,Cie={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Aie={any:[/^b/i,/^(a|c)/i]},Rie={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Pie={any:[/1/i,/2/i,/3/i,/4/i]},Nie={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Die={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Lie={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Iie={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Oie={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Fie={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Uie={ordinalNumber:Eie({matchPattern:Mie,parsePattern:Tie,valueCallback:t=>parseInt(t,10)}),era:ch({matchPatterns:Cie,defaultMatchWidth:"wide",parsePatterns:Aie,defaultParseWidth:"any"}),quarter:ch({matchPatterns:Rie,defaultMatchWidth:"wide",parsePatterns:Pie,defaultParseWidth:"any",valueCallback:t=>t+1}),month:ch({matchPatterns:Nie,defaultMatchWidth:"wide",parsePatterns:Die,defaultParseWidth:"any"}),day:ch({matchPatterns:Lie,defaultMatchWidth:"wide",parsePatterns:Iie,defaultParseWidth:"any"}),dayPeriod:ch({matchPatterns:Oie,defaultMatchWidth:"any",parsePatterns:Fie,defaultParseWidth:"any"})},gd={code:"en-US",formatDistance:lie,formatLong:fie,formatRelative:pie,localize:wie,match:Uie,options:{weekStartsOn:0,firstWeekContainsDate:1}};function jie(t,e){const n=Jn(t,e?.in);return OE(n,n5(n))+1}function FE(t,e){const n=Jn(t,e?.in),r=+sp(n)-+qre(n);return Math.round(r/XF)+1}function i5(t,e){const n=Jn(t,e?.in),r=n.getFullYear(),i=Fp(),a=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,s=Dr(e?.in||t,0);s.setFullYear(r+1,0,a),s.setHours(0,0,0,0);const o=Wd(s,e),c=Dr(e?.in||t,0);c.setFullYear(r,0,a),c.setHours(0,0,0,0);const u=Wd(c,e);return+n>=+o?r+1:+n>=+u?r:r-1}function Bie(t,e){const n=Fp(),r=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=i5(t,e),a=Dr(e?.in||t,0);return a.setFullYear(i,0,r),a.setHours(0,0,0,0),Wd(a,e)}function UE(t,e){const n=Jn(t,e?.in),r=+Wd(n,e)-+Bie(n,e);return Math.round(r/XF)+1}function Xn(t,e){const n=t<0?"-":"",r=Math.abs(t).toString().padStart(e,"0");return n+r}const il={y(t,e){const n=t.getFullYear(),r=n>0?n:1-n;return Xn(e==="yy"?r%100:r,e.length)},M(t,e){const n=t.getMonth();return e==="M"?String(n+1):Xn(n+1,2)},d(t,e){return Xn(t.getDate(),e.length)},a(t,e){const n=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];default:return n==="am"?"a.m.":"p.m."}},h(t,e){return Xn(t.getHours()%12||12,e.length)},H(t,e){return Xn(t.getHours(),e.length)},m(t,e){return Xn(t.getMinutes(),e.length)},s(t,e){return Xn(t.getSeconds(),e.length)},S(t,e){const n=e.length,r=t.getMilliseconds(),i=Math.trunc(r*Math.pow(10,n-3));return Xn(i,e.length)}},Xu={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},gP={G:function(t,e,n){const r=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});default:return n.era(r,{width:"wide"})}},y:function(t,e,n){if(e==="yo"){const r=t.getFullYear(),i=r>0?r:1-r;return n.ordinalNumber(i,{unit:"year"})}return il.y(t,e)},Y:function(t,e,n,r){const i=i5(t,r),a=i>0?i:1-i;if(e==="YY"){const s=a%100;return Xn(s,2)}return e==="Yo"?n.ordinalNumber(a,{unit:"year"}):Xn(a,e.length)},R:function(t,e){const n=JF(t);return Xn(n,e.length)},u:function(t,e){const n=t.getFullYear();return Xn(n,e.length)},Q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(r);case"QQ":return Xn(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(r);case"qq":return Xn(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(t,e,n){const r=t.getMonth();switch(e){case"M":case"MM":return il.M(t,e);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(t,e,n){const r=t.getMonth();switch(e){case"L":return String(r+1);case"LL":return Xn(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(t,e,n,r){const i=UE(t,r);return e==="wo"?n.ordinalNumber(i,{unit:"week"}):Xn(i,e.length)},I:function(t,e,n){const r=FE(t);return e==="Io"?n.ordinalNumber(r,{unit:"week"}):Xn(r,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):il.d(t,e)},D:function(t,e,n){const r=jie(t);return e==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):Xn(r,e.length)},E:function(t,e,n){const r=t.getDay();switch(e){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(t,e,n,r){const i=t.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(e){case"e":return String(a);case"ee":return Xn(a,2);case"eo":return n.ordinalNumber(a,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(t,e,n,r){const i=t.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(e){case"c":return String(a);case"cc":return Xn(a,e.length);case"co":return n.ordinalNumber(a,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(t,e,n){const r=t.getDay(),i=r===0?7:r;switch(e){case"i":return String(i);case"ii":return Xn(i,e.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(t,e,n){const i=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(t,e,n){const r=t.getHours();let i;switch(r===12?i=Xu.noon:r===0?i=Xu.midnight:i=r/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(t,e,n){const r=t.getHours();let i;switch(r>=17?i=Xu.evening:r>=12?i=Xu.afternoon:r>=4?i=Xu.morning:i=Xu.night,e){case"B":case"BB":case"BBB":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(i,{width:"narrow",context:"formatting"});default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(t,e,n){if(e==="ho"){let r=t.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return il.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):il.H(t,e)},K:function(t,e,n){const r=t.getHours()%12;return e==="Ko"?n.ordinalNumber(r,{unit:"hour"}):Xn(r,e.length)},k:function(t,e,n){let r=t.getHours();return r===0&&(r=24),e==="ko"?n.ordinalNumber(r,{unit:"hour"}):Xn(r,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):il.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):il.s(t,e)},S:function(t,e){return il.S(t,e)},X:function(t,e,n){const r=t.getTimezoneOffset();if(r===0)return"Z";switch(e){case"X":return vP(r);case"XXXX":case"XX":return wc(r);default:return wc(r,":")}},x:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"x":return vP(r);case"xxxx":case"xx":return wc(r);default:return wc(r,":")}},O:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+yP(r,":");default:return"GMT"+wc(r,":")}},z:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+yP(r,":");default:return"GMT"+wc(r,":")}},t:function(t,e,n){const r=Math.trunc(+t/1e3);return Xn(r,e.length)},T:function(t,e,n){return Xn(+t,e.length)}};function yP(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),i=Math.trunc(r/60),a=r%60;return a===0?n+String(i):n+String(i)+e+Xn(a,2)}function vP(t,e){return t%60===0?(t>0?"-":"+")+Xn(Math.abs(t)/60,2):wc(t,e)}function wc(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),i=Xn(Math.trunc(r/60),2),a=Xn(r%60,2);return n+i+e+a}const xP=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});default:return e.date({width:"full"})}},a5=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});default:return e.time({width:"full"})}},zie=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return xP(t,e);let a;switch(r){case"P":a=e.dateTime({width:"short"});break;case"PP":a=e.dateTime({width:"medium"});break;case"PPP":a=e.dateTime({width:"long"});break;default:a=e.dateTime({width:"full"});break}return a.replace("{{date}}",xP(r,e)).replace("{{time}}",a5(i,e))},Vie={p:a5,P:zie},Hie=/^D+$/,Wie=/^Y+$/,Gie=["D","DD","YY","YYYY"];function $ie(t){return Hie.test(t)}function Yie(t){return Wie.test(t)}function qie(t,e,n){const r=Xie(t,e,n);if(console.warn(r),Gie.includes(t))throw new RangeError(r)}function Xie(t,e,n){const r=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const Kie=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Zie=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Jie=/^'([^]*?)'?$/,Qie=/''/g,eae=/[a-zA-Z]/;function Rs(t,e,n){const r=Fp(),i=n?.locale??r.locale??gd,a=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,s=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,o=Jn(t,n?.in);if(!eie(o))throw new RangeError("Invalid time value");let c=e.match(Zie).map(f=>{const h=f[0];if(h==="p"||h==="P"){const p=Vie[h];return p(f,i.formatLong)}return f}).join("").match(Kie).map(f=>{if(f==="''")return{isToken:!1,value:"'"};const h=f[0];if(h==="'")return{isToken:!1,value:tae(f)};if(gP[h])return{isToken:!0,value:f};if(h.match(eae))throw new RangeError("Format string contains an unescaped latin alphabet character `"+h+"`");return{isToken:!1,value:f}});i.localize.preprocessor&&(c=i.localize.preprocessor(o,c));const u={firstWeekContainsDate:a,weekStartsOn:s,locale:i};return c.map(f=>{if(!f.isToken)return f.value;const h=f.value;(!n?.useAdditionalWeekYearTokens&&Yie(h)||!n?.useAdditionalDayOfYearTokens&&$ie(h))&&qie(h,e,String(t));const p=gP[h[0]];return p(o,h,i.localize,u)}).join("")}function tae(t){const e=t.match(Jie);return e?e[1].replace(Qie,"'"):t}function nae(t,e){const n=Jn(t,e?.in),r=n.getFullYear(),i=n.getMonth(),a=Dr(n,0);return a.setFullYear(r,i+1,0),a.setHours(0,0,0,0),a.getDate()}function rae(t,e){return Jn(t,e?.in).getMonth()}function iae(t,e){return Jn(t,e?.in).getFullYear()}function aae(t,e){return+Jn(t)>+Jn(e)}function sae(t,e){return+Jn(t)<+Jn(e)}function oae(t,e,n){const[r,i]=uf(n?.in,t,e);return r.getFullYear()===i.getFullYear()&&r.getMonth()===i.getMonth()}function lae(t,e,n){const[r,i]=uf(n?.in,t,e);return r.getFullYear()===i.getFullYear()}function cae(t,e,n){const r=Jn(t,n?.in),i=r.getFullYear(),a=r.getDate(),s=Dr(t,0);s.setFullYear(i,e,15),s.setHours(0,0,0,0);const o=nae(s);return r.setMonth(e,Math.min(a,o)),r}function uae(t,e,n){const r=Jn(t,n?.in);return isNaN(+r)?Dr(t,NaN):(r.setFullYear(e),r)}const bP=5,dae=4;function fae(t,e){const n=e.startOfMonth(t),r=n.getDay()>0?n.getDay():7,i=e.addDays(t,-r+1),a=e.addDays(i,bP*7-1);return e.getMonth(t)===e.getMonth(a)?bP:dae}function s5(t,e){const n=e.startOfMonth(t),r=n.getDay();return r===1?n:r===0?e.addDays(n,-6):e.addDays(n,-1*(r-1))}function hae(t,e){const n=s5(t,e),r=fae(t,e);return e.addDays(n,r*7-1)}const o5={...gd,labels:{labelDayButton:(t,e,n,r)=>{let i;r&&typeof r.format=="function"?i=r.format.bind(r):i=(s,o)=>Rs(s,o,{locale:gd,...n});let a=i(t,"PPPP");return e.today&&(a=`Today, ${a}`),e.selected&&(a=`${a}, selected`),a},labelMonthDropdown:"Choose the Month",labelNext:"Go to the Next Month",labelPrevious:"Go to the Previous Month",labelWeekNumber:t=>`Week ${t}`,labelYearDropdown:"Choose the Year",labelGrid:(t,e,n)=>{let r;return n&&typeof n.format=="function"?r=n.format.bind(n):r=(i,a)=>Rs(i,a,{locale:gd,...e}),r(t,"LLLL yyyy")},labelGridcell:(t,e,n,r)=>{let i;r&&typeof r.format=="function"?i=r.format.bind(r):i=(s,o)=>Rs(s,o,{locale:gd,...n});let a=i(t,"PPPP");return e?.today&&(a=`Today, ${a}`),a},labelNav:"Navigation bar",labelWeekNumberHeader:"Week Number",labelWeekday:(t,e,n)=>{let r;return n&&typeof n.format=="function"?r=n.format.bind(n):r=(i,a)=>Rs(i,a,{locale:gd,...e}),r(t,"cccc")}}};class ua{constructor(e,n){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?mi.tz(this.options.timeZone):new this.Date,this.newDate=(r,i,a)=>this.overrides?.newDate?this.overrides.newDate(r,i,a):this.options.timeZone?new mi(r,i,a,this.options.timeZone):new Date(r,i,a),this.addDays=(r,i)=>this.overrides?.addDays?this.overrides.addDays(r,i):KF(r,i),this.addMonths=(r,i)=>this.overrides?.addMonths?this.overrides.addMonths(r,i):ZF(r,i),this.addWeeks=(r,i)=>this.overrides?.addWeeks?this.overrides.addWeeks(r,i):Xre(r,i),this.addYears=(r,i)=>this.overrides?.addYears?this.overrides.addYears(r,i):Kre(r,i),this.differenceInCalendarDays=(r,i)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(r,i):OE(r,i),this.differenceInCalendarMonths=(r,i)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(r,i):e5(r,i),this.eachMonthOfInterval=r=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(r):nie(r),this.eachYearOfInterval=r=>{const i=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(r):aie(r),a=new Set(i.map(o=>this.getYear(o)));if(a.size===i.length)return i;const s=[];return a.forEach(o=>{s.push(new Date(o,0,1))}),s},this.endOfBroadcastWeek=r=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(r):hae(r,this),this.endOfISOWeek=r=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(r):sie(r),this.endOfMonth=r=>this.overrides?.endOfMonth?this.overrides.endOfMonth(r):tie(r),this.endOfWeek=(r,i)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(r,i):r5(r,this.options),this.endOfYear=r=>this.overrides?.endOfYear?this.overrides.endOfYear(r):iie(r),this.format=(r,i,a)=>{const s=this.overrides?.format?this.overrides.format(r,i,this.options):Rs(r,i,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(s):s},this.getISOWeek=r=>this.overrides?.getISOWeek?this.overrides.getISOWeek(r):FE(r),this.getMonth=(r,i)=>this.overrides?.getMonth?this.overrides.getMonth(r,this.options):rae(r,this.options),this.getYear=(r,i)=>this.overrides?.getYear?this.overrides.getYear(r,this.options):iae(r,this.options),this.getWeek=(r,i)=>this.overrides?.getWeek?this.overrides.getWeek(r,this.options):UE(r,this.options),this.isAfter=(r,i)=>this.overrides?.isAfter?this.overrides.isAfter(r,i):aae(r,i),this.isBefore=(r,i)=>this.overrides?.isBefore?this.overrides.isBefore(r,i):sae(r,i),this.isDate=r=>this.overrides?.isDate?this.overrides.isDate(r):QF(r),this.isSameDay=(r,i)=>this.overrides?.isSameDay?this.overrides.isSameDay(r,i):Qre(r,i),this.isSameMonth=(r,i)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(r,i):oae(r,i),this.isSameYear=(r,i)=>this.overrides?.isSameYear?this.overrides.isSameYear(r,i):lae(r,i),this.max=r=>this.overrides?.max?this.overrides.max(r):Zre(r),this.min=r=>this.overrides?.min?this.overrides.min(r):Jre(r),this.setMonth=(r,i)=>this.overrides?.setMonth?this.overrides.setMonth(r,i):cae(r,i),this.setYear=(r,i)=>this.overrides?.setYear?this.overrides.setYear(r,i):uae(r,i),this.startOfBroadcastWeek=(r,i)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(r,this):s5(r,this),this.startOfDay=r=>this.overrides?.startOfDay?this.overrides.startOfDay(r):op(r),this.startOfISOWeek=r=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(r):sp(r),this.startOfMonth=r=>this.overrides?.startOfMonth?this.overrides.startOfMonth(r):rie(r),this.startOfWeek=(r,i)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(r,this.options):Wd(r,this.options),this.startOfYear=r=>this.overrides?.startOfYear?this.overrides.startOfYear(r):n5(r),this.options={locale:o5,...e},this.overrides=n}getDigitMap(){const{numerals:e="latn"}=this.options,n=new Intl.NumberFormat("en-US",{numberingSystem:e}),r={};for(let i=0;i<10;i++)r[i.toString()]=n.format(i);return r}replaceDigits(e){const n=this.getDigitMap();return e.replace(/\d/g,r=>n[r]||r)}formatNumber(e){return this.replaceDigits(e.toString())}getMonthYearOrder(){const e=this.options.locale?.code;return e&&ua.yearFirstLocales.has(e)?"year-first":"month-first"}formatMonthYear(e){const{locale:n,timeZone:r,numerals:i}=this.options,a=n?.code;if(a&&ua.yearFirstLocales.has(a))try{return new Intl.DateTimeFormat(a,{month:"long",year:"numeric",timeZone:r,numberingSystem:i}).format(e)}catch{}const s=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(e,s)}}ua.yearFirstLocales=new Set(["eu","hu","ja","ja-Hira","ja-JP","ko","ko-KR","lt","lt-LT","lv","lv-LV","mn","mn-MN","zh","zh-CN","zh-HK","zh-TW"]);const Zs=new ua;class l5{constructor(e,n,r=Zs){this.date=e,this.displayMonth=n,this.outside=!!(n&&!r.isSameMonth(e,n)),this.dateLib=r,this.isoDate=r.format(e,"yyyy-MM-dd"),this.displayMonthId=r.format(n,"yyyy-MM"),this.dateMonthId=r.format(e,"yyyy-MM")}isEqualTo(e){return this.dateLib.isSameDay(e.date,this.date)&&this.dateLib.isSameMonth(e.displayMonth,this.displayMonth)}}class pae{constructor(e,n){this.date=e,this.weeks=n}}class mae{constructor(e,n){this.days=n,this.weekNumber=e}}function gae(t){return ot.createElement("button",{...t})}function yae(t){return ot.createElement("span",{...t})}function vae(t){const{size:e=24,orientation:n="left",className:r}=t;return ot.createElement("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24"},n==="up"&&ot.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),n==="down"&&ot.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),n==="left"&&ot.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),n==="right"&&ot.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function xae(t){const{day:e,modifiers:n,...r}=t;return ot.createElement("td",{...r})}function bae(t){const{day:e,modifiers:n,...r}=t,i=ot.useRef(null);return ot.useEffect(()=>{n.focused&&i.current?.focus()},[n.focused]),ot.createElement("button",{ref:i,...r})}var Zt;(function(t){t.Root="root",t.Chevron="chevron",t.Day="day",t.DayButton="day_button",t.CaptionLabel="caption_label",t.Dropdowns="dropdowns",t.Dropdown="dropdown",t.DropdownRoot="dropdown_root",t.Footer="footer",t.MonthGrid="month_grid",t.MonthCaption="month_caption",t.MonthsDropdown="months_dropdown",t.Month="month",t.Months="months",t.Nav="nav",t.NextMonthButton="button_next",t.PreviousMonthButton="button_previous",t.Week="week",t.Weeks="weeks",t.Weekday="weekday",t.Weekdays="weekdays",t.WeekNumber="week_number",t.WeekNumberHeader="week_number_header",t.YearsDropdown="years_dropdown"})(Zt||(Zt={}));var dr;(function(t){t.disabled="disabled",t.hidden="hidden",t.outside="outside",t.focused="focused",t.today="today"})(dr||(dr={}));var Qa;(function(t){t.range_end="range_end",t.range_middle="range_middle",t.range_start="range_start",t.selected="selected"})(Qa||(Qa={}));var na;(function(t){t.weeks_before_enter="weeks_before_enter",t.weeks_before_exit="weeks_before_exit",t.weeks_after_enter="weeks_after_enter",t.weeks_after_exit="weeks_after_exit",t.caption_after_enter="caption_after_enter",t.caption_after_exit="caption_after_exit",t.caption_before_enter="caption_before_enter",t.caption_before_exit="caption_before_exit"})(na||(na={}));function _ae(t){const{options:e,className:n,components:r,classNames:i,...a}=t,s=[i[Zt.Dropdown],n].join(" "),o=e?.find(({value:c})=>c===a.value);return ot.createElement("span",{"data-disabled":a.disabled,className:i[Zt.DropdownRoot]},ot.createElement(r.Select,{className:s,...a},e?.map(({value:c,label:u,disabled:f})=>ot.createElement(r.Option,{key:c,value:c,disabled:f},u))),ot.createElement("span",{className:i[Zt.CaptionLabel],"aria-hidden":!0},o?.label,ot.createElement(r.Chevron,{orientation:"down",size:18,className:i[Zt.Chevron]})))}function wae(t){return ot.createElement("div",{...t})}function Sae(t){return ot.createElement("div",{...t})}function kae(t){const{calendarMonth:e,displayIndex:n,...r}=t;return ot.createElement("div",{...r},t.children)}function Eae(t){const{calendarMonth:e,displayIndex:n,...r}=t;return ot.createElement("div",{...r})}function Mae(t){return ot.createElement("table",{...t})}function Tae(t){return ot.createElement("div",{...t})}const c5=x.createContext(void 0);function Up(){const t=x.useContext(c5);if(t===void 0)throw new Error("useDayPicker() must be used within a custom component.");return t}function Cae(t){const{components:e}=Up();return ot.createElement(e.Dropdown,{...t})}function Aae(t){const{onPreviousClick:e,onNextClick:n,previousMonth:r,nextMonth:i,...a}=t,{components:s,classNames:o,labels:{labelPrevious:c,labelNext:u}}=Up(),f=x.useCallback(p=>{i&&n?.(p)},[i,n]),h=x.useCallback(p=>{r&&e?.(p)},[r,e]);return ot.createElement("nav",{...a},ot.createElement(s.PreviousMonthButton,{type:"button",className:o[Zt.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":c(r),onClick:h},ot.createElement(s.Chevron,{disabled:r?void 0:!0,className:o[Zt.Chevron],orientation:"left"})),ot.createElement(s.NextMonthButton,{type:"button",className:o[Zt.NextMonthButton],tabIndex:i?void 0:-1,"aria-disabled":i?void 0:!0,"aria-label":u(i),onClick:f},ot.createElement(s.Chevron,{disabled:i?void 0:!0,orientation:"right",className:o[Zt.Chevron]})))}function Rae(t){const{components:e}=Up();return ot.createElement(e.Button,{...t})}function Pae(t){return ot.createElement("option",{...t})}function Nae(t){const{components:e}=Up();return ot.createElement(e.Button,{...t})}function Dae(t){const{rootRef:e,...n}=t;return ot.createElement("div",{...n,ref:e})}function Lae(t){return ot.createElement("select",{...t})}function Iae(t){const{week:e,...n}=t;return ot.createElement("tr",{...n})}function Oae(t){return ot.createElement("th",{...t})}function Fae(t){return ot.createElement("thead",{"aria-hidden":!0},ot.createElement("tr",{...t}))}function Uae(t){const{week:e,...n}=t;return ot.createElement("th",{...n})}function jae(t){return ot.createElement("th",{...t})}function Bae(t){return ot.createElement("tbody",{...t})}function zae(t){const{components:e}=Up();return ot.createElement(e.Dropdown,{...t})}const Vae=Object.freeze(Object.defineProperty({__proto__:null,Button:gae,CaptionLabel:yae,Chevron:vae,Day:xae,DayButton:bae,Dropdown:_ae,DropdownNav:wae,Footer:Sae,Month:kae,MonthCaption:Eae,MonthGrid:Mae,Months:Tae,MonthsDropdown:Cae,Nav:Aae,NextMonthButton:Rae,Option:Pae,PreviousMonthButton:Nae,Root:Dae,Select:Lae,Week:Iae,WeekNumber:Uae,WeekNumberHeader:jae,Weekday:Oae,Weekdays:Fae,Weeks:Bae,YearsDropdown:zae},Symbol.toStringTag,{value:"Module"}));function _o(t,e,n=!1,r=Zs){let{from:i,to:a}=t;const{differenceInCalendarDays:s,isSameDay:o}=r;return i&&a?(s(a,i)<0&&([i,a]=[a,i]),s(e,i)>=(n?1:0)&&s(a,e)>=(n?1:0)):!n&&a?o(a,e):!n&&i?o(i,e):!1}function jE(t){return!!(t&&typeof t=="object"&&"before"in t&&"after"in t)}function lv(t){return!!(t&&typeof t=="object"&&"from"in t)}function BE(t){return!!(t&&typeof t=="object"&&"after"in t)}function zE(t){return!!(t&&typeof t=="object"&&"before"in t)}function u5(t){return!!(t&&typeof t=="object"&&"dayOfWeek"in t)}function d5(t,e){return Array.isArray(t)&&t.every(e.isDate)}function wo(t,e,n=Zs){const r=Array.isArray(e)?e:[e],{isSameDay:i,differenceInCalendarDays:a,isAfter:s}=n;return r.some(o=>{if(typeof o=="boolean")return o;if(n.isDate(o))return i(t,o);if(d5(o,n))return o.some(c=>i(t,c));if(lv(o))return _o(o,t,!1,n);if(u5(o))return Array.isArray(o.dayOfWeek)?o.dayOfWeek.includes(t.getDay()):o.dayOfWeek===t.getDay();if(jE(o)){const c=a(o.before,t),u=a(o.after,t),f=c>0,h=u<0;return s(o.before,o.after)?h&&f:f||h}return BE(o)?a(t,o.after)>0:zE(o)?a(o.before,t)>0:typeof o=="function"?o(t):!1})}function Hae(t,e,n,r,i){const{disabled:a,hidden:s,modifiers:o,showOutsideDays:c,broadcastCalendar:u,today:f=i.today()}=e,{isSameDay:h,isSameMonth:p,startOfMonth:y,isBefore:v,endOfMonth:w,isAfter:b}=i,_=n&&y(n),E=r&&w(r),M={[dr.focused]:[],[dr.outside]:[],[dr.disabled]:[],[dr.hidden]:[],[dr.today]:[]},T={};for(const R of t){const{date:A,displayMonth:P}=R,k=!!(P&&!p(A,P)),N=!!(_&&v(A,_)),j=!!(E&&b(A,E)),L=!!(a&&wo(A,a,i)),z=!!(s&&wo(A,s,i))||N||j||!u&&!c&&k||u&&c===!1&&k,U=h(A,f);k&&M.outside.push(R),L&&M.disabled.push(R),z&&M.hidden.push(R),U&&M.today.push(R),o&&Object.keys(o).forEach(V=>{const W=o?.[V];W&&wo(A,W,i)&&(T[V]?T[V].push(R):T[V]=[R])})}return R=>{const A={[dr.focused]:!1,[dr.disabled]:!1,[dr.hidden]:!1,[dr.outside]:!1,[dr.today]:!1},P={};for(const k in M){const N=M[k];A[k]=N.some(j=>j===R)}for(const k in T)P[k]=T[k].some(N=>N===R);return{...A,...P}}}function Wae(t,e,n={}){return Object.entries(t).filter(([,i])=>i===!0).reduce((i,[a])=>(n[a]?i.push(n[a]):e[dr[a]]?i.push(e[dr[a]]):e[Qa[a]]&&i.push(e[Qa[a]]),i),[e[Zt.Day]])}function Gae(t){return{...Vae,...t}}function $ae(t){const e={"data-mode":t.mode??void 0,"data-required":"required"in t?t.required:void 0,"data-multiple-months":t.numberOfMonths&&t.numberOfMonths>1||void 0,"data-week-numbers":t.showWeekNumber||void 0,"data-broadcast-calendar":t.broadcastCalendar||void 0,"data-nav-layout":t.navLayout||void 0};return Object.entries(t).forEach(([n,r])=>{n.startsWith("data-")&&(e[n]=r)}),e}function Yae(){const t={};for(const e in Zt)t[Zt[e]]=`rdp-${Zt[e]}`;for(const e in dr)t[dr[e]]=`rdp-${dr[e]}`;for(const e in Qa)t[Qa[e]]=`rdp-${Qa[e]}`;for(const e in na)t[na[e]]=`rdp-${na[e]}`;return t}function f5(t,e,n){return(n??new ua(e)).formatMonthYear(t)}const qae=f5;function Xae(t,e,n){return(n??new ua(e)).format(t,"d")}function Kae(t,e=Zs){return e.format(t,"LLLL")}function Zae(t,e,n){return(n??new ua(e)).format(t,"cccccc")}function Jae(t,e=Zs){return t<10?e.formatNumber(`0${t.toLocaleString()}`):e.formatNumber(`${t.toLocaleString()}`)}function Qae(){return""}function h5(t,e=Zs){return e.format(t,"yyyy")}const ese=h5,tse=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:f5,formatDay:Xae,formatMonthCaption:qae,formatMonthDropdown:Kae,formatWeekNumber:Jae,formatWeekNumberHeader:Qae,formatWeekdayName:Zae,formatYearCaption:ese,formatYearDropdown:h5},Symbol.toStringTag,{value:"Module"}));function nse(t){return t?.formatMonthCaption&&!t.formatCaption&&(t.formatCaption=t.formatMonthCaption),t?.formatYearCaption&&!t.formatYearDropdown&&(t.formatYearDropdown=t.formatYearCaption),{...tse,...t}}function VE(t,e,n,r){let i=(r??new ua(n)).format(t,"PPPP");return e.today&&(i=`Today, ${i}`),e.selected&&(i=`${i}, selected`),i}const rse=VE;function HE(t,e,n){return(n??new ua(e)).formatMonthYear(t)}const ise=HE;function p5(t,e,n,r){let i=(r??new ua(n)).format(t,"PPPP");return e?.today&&(i=`Today, ${i}`),i}function m5(t){return"Choose the Month"}function g5(){return""}const ase="Go to the Next Month";function y5(t,e){return ase}function v5(t){return"Go to the Previous Month"}function x5(t,e,n){return(n??new ua(e)).format(t,"cccc")}function b5(t,e){return`Week ${t}`}function _5(t){return"Week Number"}function w5(t){return"Choose the Year"}const sse=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:ise,labelDay:rse,labelDayButton:VE,labelGrid:HE,labelGridcell:p5,labelMonthDropdown:m5,labelNav:g5,labelNext:y5,labelPrevious:v5,labelWeekNumber:b5,labelWeekNumberHeader:_5,labelWeekday:x5,labelYearDropdown:w5},Symbol.toStringTag,{value:"Module"})),Ha=(t,e,n)=>e||(n?typeof n=="function"?n:(...r)=>n:t);function ose(t,e){const n=e.locale?.labels??{};return{...sse,...t??{},labelDayButton:Ha(VE,t?.labelDayButton,n.labelDayButton),labelMonthDropdown:Ha(m5,t?.labelMonthDropdown,n.labelMonthDropdown),labelNext:Ha(y5,t?.labelNext,n.labelNext),labelPrevious:Ha(v5,t?.labelPrevious,n.labelPrevious),labelWeekNumber:Ha(b5,t?.labelWeekNumber,n.labelWeekNumber),labelYearDropdown:Ha(w5,t?.labelYearDropdown,n.labelYearDropdown),labelGrid:Ha(HE,t?.labelGrid,n.labelGrid),labelGridcell:Ha(p5,t?.labelGridcell,n.labelGridcell),labelNav:Ha(g5,t?.labelNav,n.labelNav),labelWeekNumberHeader:Ha(_5,t?.labelWeekNumberHeader,n.labelWeekNumberHeader),labelWeekday:Ha(x5,t?.labelWeekday,n.labelWeekday)}}function lse(t,e,n,r,i){const{startOfMonth:a,startOfYear:s,endOfYear:o,eachMonthOfInterval:c,getMonth:u}=i;return c({start:s(t),end:o(t)}).map(p=>{const y=r.formatMonthDropdown(p,i),v=u(p),w=e&&p<a(e)||n&&p>a(n)||!1;return{value:v,label:y,disabled:w}})}function cse(t,e={},n={}){let r={...e?.[Zt.Day]};return Object.entries(t).filter(([,i])=>i===!0).forEach(([i])=>{r={...r,...n?.[i]}}),r}function use(t,e,n,r){const i=r??t.today(),a=n?t.startOfBroadcastWeek(i,t):e?t.startOfISOWeek(i):t.startOfWeek(i),s=[];for(let o=0;o<7;o++){const c=t.addDays(a,o);s.push(c)}return s}function dse(t,e,n,r,i=!1){if(!t||!e)return;const{startOfYear:a,endOfYear:s,eachYearOfInterval:o,getYear:c}=r,u=a(t),f=s(e),h=o({start:u,end:f});return i&&h.reverse(),h.map(p=>{const y=n.formatYearDropdown(p,r);return{value:c(p),label:y,disabled:!1}})}function fse(t,e={}){const{weekStartsOn:n,locale:r}=e,i=n??r?.options?.weekStartsOn??0,a=o=>{const c=typeof o=="number"||typeof o=="string"?new Date(o):o;return new mi(c.getFullYear(),c.getMonth(),c.getDate(),12,0,0,t)},s=o=>{const c=a(o);return new Date(c.getFullYear(),c.getMonth(),c.getDate(),0,0,0,0)};return{today:()=>a(mi.tz(t)),newDate:(o,c,u)=>new mi(o,c,u,12,0,0,t),startOfDay:o=>a(o),startOfWeek:(o,c)=>{const u=a(o),f=c?.weekStartsOn??i,h=(u.getDay()-f+7)%7;return u.setDate(u.getDate()-h),u},startOfISOWeek:o=>{const c=a(o),u=(c.getDay()-1+7)%7;return c.setDate(c.getDate()-u),c},startOfMonth:o=>{const c=a(o);return c.setDate(1),c},startOfYear:o=>{const c=a(o);return c.setMonth(0,1),c},endOfWeek:(o,c)=>{const u=a(o),p=(((c?.weekStartsOn??i)+6)%7-u.getDay()+7)%7;return u.setDate(u.getDate()+p),u},endOfISOWeek:o=>{const c=a(o),u=(7-c.getDay())%7;return c.setDate(c.getDate()+u),c},endOfMonth:o=>{const c=a(o);return c.setMonth(c.getMonth()+1,0),c},endOfYear:o=>{const c=a(o);return c.setMonth(11,31),c},eachMonthOfInterval:o=>{const c=a(o.start),u=a(o.end),f=[],h=new mi(c.getFullYear(),c.getMonth(),1,12,0,0,t),p=u.getFullYear()*12+u.getMonth();for(;h.getFullYear()*12+h.getMonth()<=p;)f.push(new mi(h,t)),h.setMonth(h.getMonth()+1,1);return f},addDays:(o,c)=>{const u=a(o);return u.setDate(u.getDate()+c),u},addWeeks:(o,c)=>{const u=a(o);return u.setDate(u.getDate()+c*7),u},addMonths:(o,c)=>{const u=a(o);return u.setMonth(u.getMonth()+c),u},addYears:(o,c)=>{const u=a(o);return u.setFullYear(u.getFullYear()+c),u},eachYearOfInterval:o=>{const c=a(o.start),u=a(o.end),f=[],h=new mi(c.getFullYear(),0,1,12,0,0,t);for(;h.getFullYear()<=u.getFullYear();)f.push(new mi(h,t)),h.setFullYear(h.getFullYear()+1,0,1);return f},getWeek:(o,c)=>{const u=s(o);return UE(u,{weekStartsOn:c?.weekStartsOn??i,firstWeekContainsDate:c?.firstWeekContainsDate??r?.options?.firstWeekContainsDate??1})},getISOWeek:o=>{const c=s(o);return FE(c)},differenceInCalendarDays:(o,c)=>{const u=s(o),f=s(c);return OE(u,f)},differenceInCalendarMonths:(o,c)=>{const u=s(o),f=s(c);return e5(u,f)}}}const jp=t=>t instanceof HTMLElement?t:null,p_=t=>[...t.querySelectorAll("[data-animated-month]")??[]],hse=t=>jp(t.querySelector("[data-animated-month]")),m_=t=>jp(t.querySelector("[data-animated-caption]")),g_=t=>jp(t.querySelector("[data-animated-weeks]")),pse=t=>jp(t.querySelector("[data-animated-nav]")),mse=t=>jp(t.querySelector("[data-animated-weekdays]"));function gse(t,e,{classNames:n,months:r,focused:i,dateLib:a}){const s=x.useRef(null),o=x.useRef(r),c=x.useRef(!1);x.useLayoutEffect(()=>{const u=o.current;if(o.current=r,!e||!t.current||!(t.current instanceof HTMLElement)||r.length===0||u.length===0||r.length!==u.length)return;const f=a.isSameMonth(r[0].date,u[0].date),h=a.isAfter(r[0].date,u[0].date),p=h?n[na.caption_after_enter]:n[na.caption_before_enter],y=h?n[na.weeks_after_enter]:n[na.weeks_before_enter],v=s.current,w=t.current.cloneNode(!0);if(w instanceof HTMLElement?(p_(w).forEach(M=>{if(!(M instanceof HTMLElement))return;const T=hse(M);T&&M.contains(T)&&M.removeChild(T);const R=m_(M);R&&R.classList.remove(p);const A=g_(M);A&&A.classList.remove(y)}),s.current=w):s.current=null,c.current||f||i)return;const b=v instanceof HTMLElement?p_(v):[],_=p_(t.current);if(_?.every(E=>E instanceof HTMLElement)&&b&&b.every(E=>E instanceof HTMLElement)){c.current=!0,t.current.style.isolation="isolate";const E=pse(t.current);E&&(E.style.zIndex="1"),_.forEach((M,T)=>{const R=b[T];if(!R)return;M.style.position="relative",M.style.overflow="hidden";const A=m_(M);A&&A.classList.add(p);const P=g_(M);P&&P.classList.add(y);const k=()=>{c.current=!1,t.current&&(t.current.style.isolation=""),E&&(E.style.zIndex=""),A&&A.classList.remove(p),P&&P.classList.remove(y),M.style.position="",M.style.overflow="",M.contains(R)&&M.removeChild(R)};R.style.pointerEvents="none",R.style.position="absolute",R.style.overflow="hidden",R.setAttribute("aria-hidden","true");const N=mse(R);N&&(N.style.opacity="0");const j=m_(R);j&&(j.classList.add(h?n[na.caption_before_exit]:n[na.caption_after_exit]),j.addEventListener("animationend",k));const L=g_(R);L&&L.classList.add(h?n[na.weeks_before_exit]:n[na.weeks_after_exit]),M.insertBefore(R,M.firstChild)})}})}function yse(t,e,n,r){const i=t[0],a=t[t.length-1],{ISOWeek:s,fixedWeeks:o,broadcastCalendar:c}=n??{},{addDays:u,differenceInCalendarDays:f,differenceInCalendarMonths:h,endOfBroadcastWeek:p,endOfISOWeek:y,endOfMonth:v,endOfWeek:w,isAfter:b,startOfBroadcastWeek:_,startOfISOWeek:E,startOfWeek:M}=r,T=c?_(i,r):s?E(i):M(i),R=c?p(a):s?y(v(a)):w(v(a)),A=e&&(c?p(e):s?y(e):w(e)),P=A&&b(R,A)?A:R,k=f(P,T),N=h(a,i)+1,j=[];for(let U=0;U<=k;U++){const V=u(T,U);j.push(V)}const z=(c?35:42)*N;if(o&&j.length<z){const U=z-j.length;for(let V=0;V<U;V++){const W=u(j[j.length-1],1);j.push(W)}}return j}function vse(t){const e=[];return t.reduce((n,r)=>{const i=r.weeks.reduce((a,s)=>a.concat(s.days.slice()),e.slice());return n.concat(i.slice())},e.slice())}function xse(t,e,n,r){const{numberOfMonths:i=1}=n,a=[];for(let s=0;s<i;s++){const o=r.addMonths(t,s);if(e&&o>e)break;a.push(o)}return a}function _P(t,e,n,r){const{month:i,defaultMonth:a,today:s=r.today(),numberOfMonths:o=1}=t;let c=i||a||s;const{differenceInCalendarMonths:u,addMonths:f,startOfMonth:h}=r;if(n&&u(n,c)<o-1){const p=-1*(o-1);c=f(n,p)}return e&&u(c,e)<0&&(c=e),h(c)}function bse(t,e,n,r){const{addDays:i,endOfBroadcastWeek:a,endOfISOWeek:s,endOfMonth:o,endOfWeek:c,getISOWeek:u,getWeek:f,startOfBroadcastWeek:h,startOfISOWeek:p,startOfWeek:y}=r,v=t.reduce((w,b)=>{const _=n.broadcastCalendar?h(b,r):n.ISOWeek?p(b):y(b),E=n.broadcastCalendar?a(b):n.ISOWeek?s(o(b)):c(o(b)),M=e.filter(P=>P>=_&&P<=E),T=n.broadcastCalendar?35:42;if(n.fixedWeeks&&M.length<T){const P=e.filter(k=>{const N=T-M.length;return k>E&&k<=i(E,N)});M.push(...P)}const R=M.reduce((P,k)=>{const N=n.ISOWeek?u(k):f(k),j=P.find(z=>z.weekNumber===N),L=new l5(k,b,r);return j?j.days.push(L):P.push(new mae(N,[L])),P},[]),A=new pae(b,R);return w.push(A),w},[]);return n.reverseMonths?v.reverse():v}function _se(t,e){let{startMonth:n,endMonth:r}=t;const{startOfYear:i,startOfDay:a,startOfMonth:s,endOfMonth:o,addYears:c,endOfYear:u,newDate:f,today:h}=e,{fromYear:p,toYear:y,fromMonth:v,toMonth:w}=t;!n&&v&&(n=v),!n&&p&&(n=e.newDate(p,0,1)),!r&&w&&(r=w),!r&&y&&(r=f(y,11,31));const b=t.captionLayout==="dropdown"||t.captionLayout==="dropdown-years";return n?n=s(n):p?n=f(p,0,1):!n&&b&&(n=i(c(t.today??h(),-100))),r?r=o(r):y?r=f(y,11,31):!r&&b&&(r=u(t.today??h())),[n&&a(n),r&&a(r)]}function wse(t,e,n,r){if(n.disableNavigation)return;const{pagedNavigation:i,numberOfMonths:a=1}=n,{startOfMonth:s,addMonths:o,differenceInCalendarMonths:c}=r,u=i?a:1,f=s(t);if(!e)return o(f,u);if(!(c(e,t)<a))return o(f,u)}function Sse(t,e,n,r){if(n.disableNavigation)return;const{pagedNavigation:i,numberOfMonths:a}=n,{startOfMonth:s,addMonths:o,differenceInCalendarMonths:c}=r,u=i?a??1:1,f=s(t);if(!e)return o(f,-u);if(!(c(f,e)<=0))return o(f,-u)}function kse(t){const e=[];return t.reduce((n,r)=>n.concat(r.weeks.slice()),e.slice())}function cv(t,e){const[n,r]=x.useState(t);return[e===void 0?n:e,r]}function Ese(t,e){const[n,r]=_se(t,e),{startOfMonth:i,endOfMonth:a}=e,s=_P(t,n,r,e),[o,c]=cv(s,t.month?s:void 0);x.useEffect(()=>{const T=_P(t,n,r,e);c(T)},[t.timeZone]);const{months:u,weeks:f,days:h,previousMonth:p,nextMonth:y}=x.useMemo(()=>{const T=xse(o,r,{numberOfMonths:t.numberOfMonths},e),R=yse(T,t.endMonth?a(t.endMonth):void 0,{ISOWeek:t.ISOWeek,fixedWeeks:t.fixedWeeks,broadcastCalendar:t.broadcastCalendar},e),A=bse(T,R,{broadcastCalendar:t.broadcastCalendar,fixedWeeks:t.fixedWeeks,ISOWeek:t.ISOWeek,reverseMonths:t.reverseMonths},e),P=kse(A),k=vse(A),N=Sse(o,n,t,e),j=wse(o,r,t,e);return{months:A,weeks:P,days:k,previousMonth:N,nextMonth:j}},[e,o.getTime(),r?.getTime(),n?.getTime(),t.disableNavigation,t.broadcastCalendar,t.endMonth?.getTime(),t.fixedWeeks,t.ISOWeek,t.numberOfMonths,t.pagedNavigation,t.reverseMonths]),{disableNavigation:v,onMonthChange:w}=t,b=T=>f.some(R=>R.days.some(A=>A.isEqualTo(T))),_=T=>{if(v)return;let R=i(T);n&&R<i(n)&&(R=i(n)),r&&R>i(r)&&(R=i(r)),c(R),w?.(R)};return{months:u,weeks:f,days:h,navStart:n,navEnd:r,previousMonth:p,nextMonth:y,goToMonth:_,goToDay:T=>{b(T)||_(T.date)}}}var Ss;(function(t){t[t.Today=0]="Today",t[t.Selected=1]="Selected",t[t.LastFocused=2]="LastFocused",t[t.FocusedModifier=3]="FocusedModifier"})(Ss||(Ss={}));function wP(t){return!t[dr.disabled]&&!t[dr.hidden]&&!t[dr.outside]}function Mse(t,e,n,r){let i,a=-1;for(const s of t){const o=e(s);wP(o)&&(o[dr.focused]&&a<Ss.FocusedModifier?(i=s,a=Ss.FocusedModifier):r?.isEqualTo(s)&&a<Ss.LastFocused?(i=s,a=Ss.LastFocused):n(s.date)&&a<Ss.Selected?(i=s,a=Ss.Selected):o[dr.today]&&a<Ss.Today&&(i=s,a=Ss.Today))}return i||(i=t.find(s=>wP(e(s)))),i}function Tse(t,e,n,r,i,a,s){const{ISOWeek:o,broadcastCalendar:c}=a,{addDays:u,addMonths:f,addWeeks:h,addYears:p,endOfBroadcastWeek:y,endOfISOWeek:v,endOfWeek:w,max:b,min:_,startOfBroadcastWeek:E,startOfISOWeek:M,startOfWeek:T}=s;let A={day:u,week:h,month:f,year:p,startOfWeek:P=>c?E(P,s):o?M(P):T(P),endOfWeek:P=>c?y(P):o?v(P):w(P)}[t](n,e==="after"?1:-1);return e==="before"&&r?A=b([r,A]):e==="after"&&i&&(A=_([i,A])),A}function S5(t,e,n,r,i,a,s,o=0){if(o>365)return;const c=Tse(t,e,n.date,r,i,a,s),u=!!(a.disabled&&wo(c,a.disabled,s)),f=!!(a.hidden&&wo(c,a.hidden,s)),h=c,p=new l5(c,h,s);return!u&&!f?p:S5(t,e,p,r,i,a,s,o+1)}function Cse(t,e,n,r,i){const{autoFocus:a}=t,[s,o]=x.useState(),c=Mse(e.days,n,r||(()=>!1),s),[u,f]=x.useState(a?c:void 0);return{isFocusTarget:w=>!!c?.isEqualTo(w),setFocused:f,focused:u,blur:()=>{o(u),f(void 0)},moveFocus:(w,b)=>{if(!u)return;const _=S5(w,b,u,e.navStart,e.navEnd,t,i);_&&(t.disableNavigation&&!e.days.some(M=>M.isEqualTo(_))||(e.goToDay(_),f(_)))}}}function Ase(t,e){const{selected:n,required:r,onSelect:i}=t,[a,s]=cv(n,i?n:void 0),o=i?n:a,{isSameDay:c}=e,u=y=>o?.some(v=>c(v,y))??!1,{min:f,max:h}=t;return{selected:o,select:(y,v,w)=>{let b=[...o??[]];if(u(y)){if(o?.length===f||r&&o?.length===1)return;b=o?.filter(_=>!c(_,y))}else o?.length===h?b=[y]:b=[...b,y];return i||s(b),i?.(b,y,v,w),b},isSelected:u}}function Rse(t,e,n=0,r=0,i=!1,a=Zs){const{from:s,to:o}=e||{},{isSameDay:c,isAfter:u,isBefore:f}=a;let h;if(!s&&!o)h={from:t,to:n>0?void 0:t};else if(s&&!o)c(s,t)?n===0?h={from:s,to:t}:i?h={from:s,to:void 0}:h=void 0:f(t,s)?h={from:t,to:s}:h={from:s,to:t};else if(s&&o)if(c(s,t)&&c(o,t))i?h={from:s,to:o}:h=void 0;else if(c(s,t))h={from:s,to:n>0?void 0:t};else if(c(o,t))h={from:t,to:n>0?void 0:t};else if(f(t,s))h={from:t,to:o};else if(u(t,s))h={from:s,to:t};else if(u(t,o))h={from:s,to:t};else throw new Error("Invalid range");if(h?.from&&h?.to){const p=a.differenceInCalendarDays(h.to,h.from);r>0&&p>r?h={from:t,to:void 0}:n>1&&p<n&&(h={from:t,to:void 0})}return h}function Pse(t,e,n=Zs){const r=Array.isArray(e)?e:[e];let i=t.from;const a=n.differenceInCalendarDays(t.to,t.from),s=Math.min(a,6);for(let o=0;o<=s;o++){if(r.includes(i.getDay()))return!0;i=n.addDays(i,1)}return!1}function SP(t,e,n=Zs){return _o(t,e.from,!1,n)||_o(t,e.to,!1,n)||_o(e,t.from,!1,n)||_o(e,t.to,!1,n)}function Nse(t,e,n=Zs){const r=Array.isArray(e)?e:[e];if(r.filter(o=>typeof o!="function").some(o=>typeof o=="boolean"?o:n.isDate(o)?_o(t,o,!1,n):d5(o,n)?o.some(c=>_o(t,c,!1,n)):lv(o)?o.from&&o.to?SP(t,{from:o.from,to:o.to},n):!1:u5(o)?Pse(t,o.dayOfWeek,n):jE(o)?n.isAfter(o.before,o.after)?SP(t,{from:n.addDays(o.after,1),to:n.addDays(o.before,-1)},n):wo(t.from,o,n)||wo(t.to,o,n):BE(o)||zE(o)?wo(t.from,o,n)||wo(t.to,o,n):!1))return!0;const s=r.filter(o=>typeof o=="function");if(s.length){let o=t.from;const c=n.differenceInCalendarDays(t.to,t.from);for(let u=0;u<=c;u++){if(s.some(f=>f(o)))return!0;o=n.addDays(o,1)}}return!1}function Dse(t,e){const{disabled:n,excludeDisabled:r,resetOnSelect:i,selected:a,required:s,onSelect:o}=t,[c,u]=cv(a,o?a:void 0),f=o?a:c;return{selected:f,select:(y,v,w)=>{const{min:b,max:_}=t;let E;if(y){const M=f?.from,T=f?.to,R=!!M&&!!T,A=!!M&&!!T&&e.isSameDay(M,T)&&e.isSameDay(y,M);i&&(R||!f?.from)?!s&&A?E=void 0:E={from:y,to:void 0}:E=Rse(y,f,b,_,s,e)}return r&&n&&E?.from&&E.to&&Nse({from:E.from,to:E.to},n,e)&&(E.from=y,E.to=void 0),o||u(E),o?.(E,y,v,w),E},isSelected:y=>f&&_o(f,y,!1,e)}}function Lse(t,e){const{selected:n,required:r,onSelect:i}=t,[a,s]=cv(n,i?n:void 0),o=i?n:a,{isSameDay:c}=e;return{selected:o,select:(h,p,y)=>{let v=h;return!r&&o&&o&&c(h,o)&&(v=void 0),i||s(v),i?.(v,h,p,y),v},isSelected:h=>o?c(o,h):!1}}function Ise(t,e){const n=Lse(t,e),r=Ase(t,e),i=Dse(t,e);switch(t.mode){case"single":return n;case"multiple":return r;case"range":return i;default:return}}function ba(t,e){return t instanceof mi&&t.timeZone===e?t:new mi(t,e)}function Ku(t,e,n){return ba(t,e)}function kP(t,e,n){return typeof t=="boolean"||typeof t=="function"?t:t instanceof Date?Ku(t,e):Array.isArray(t)?t.map(r=>r instanceof Date?Ku(r,e):r):lv(t)?{...t,from:t.from?ba(t.from,e):t.from,to:t.to?ba(t.to,e):t.to}:jE(t)?{before:Ku(t.before,e),after:Ku(t.after,e)}:BE(t)?{after:Ku(t.after,e)}:zE(t)?{before:Ku(t.before,e)}:t}function y_(t,e,n){return t&&(Array.isArray(t)?t.map(r=>kP(r,e)):kP(t,e))}function Ose(t){let e=t;const n=e.timeZone;if(n&&(e={...t,timeZone:n},e.today&&(e.today=ba(e.today,n)),e.month&&(e.month=ba(e.month,n)),e.defaultMonth&&(e.defaultMonth=ba(e.defaultMonth,n)),e.startMonth&&(e.startMonth=ba(e.startMonth,n)),e.endMonth&&(e.endMonth=ba(e.endMonth,n)),e.mode==="single"&&e.selected?e.selected=ba(e.selected,n):e.mode==="multiple"&&e.selected?e.selected=e.selected?.map(ne=>ba(ne,n)):e.mode==="range"&&e.selected&&(e.selected={from:e.selected.from?ba(e.selected.from,n):e.selected.from,to:e.selected.to?ba(e.selected.to,n):e.selected.to}),e.disabled!==void 0&&(e.disabled=y_(e.disabled,n)),e.hidden!==void 0&&(e.hidden=y_(e.hidden,n)),e.modifiers)){const ne={};Object.keys(e.modifiers).forEach(Be=>{ne[Be]=y_(e.modifiers?.[Be],n)}),e.modifiers=ne}const{components:r,formatters:i,labels:a,dateLib:s,locale:o,classNames:c}=x.useMemo(()=>{const ne={...o5,...e.locale},Be=e.broadcastCalendar?1:e.weekStartsOn,ke=e.noonSafe&&e.timeZone?fse(e.timeZone,{weekStartsOn:Be,locale:ne}):void 0,Ae=e.dateLib&&ke?{...ke,...e.dateLib}:e.dateLib??ke,Ve=new ua({locale:ne,weekStartsOn:Be,firstWeekContainsDate:e.firstWeekContainsDate,useAdditionalWeekYearTokens:e.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:e.useAdditionalDayOfYearTokens,timeZone:e.timeZone,numerals:e.numerals},Ae);return{dateLib:Ve,components:Gae(e.components),formatters:nse(e.formatters),labels:ose(e.labels,Ve.options),locale:ne,classNames:{...Yae(),...e.classNames}}},[e.locale,e.broadcastCalendar,e.weekStartsOn,e.firstWeekContainsDate,e.useAdditionalWeekYearTokens,e.useAdditionalDayOfYearTokens,e.timeZone,e.numerals,e.dateLib,e.noonSafe,e.components,e.formatters,e.labels,e.classNames]);e.today||(e={...e,today:s.today()});const{captionLayout:u,mode:f,navLayout:h,numberOfMonths:p=1,onDayBlur:y,onDayClick:v,onDayFocus:w,onDayKeyDown:b,onDayMouseEnter:_,onDayMouseLeave:E,onNextClick:M,onPrevClick:T,showWeekNumber:R,styles:A}=e,{formatCaption:P,formatDay:k,formatMonthDropdown:N,formatWeekNumber:j,formatWeekNumberHeader:L,formatWeekdayName:z,formatYearDropdown:U}=i,V=Ese(e,s),{days:W,months:K,navStart:Q,navEnd:O,previousMonth:G,nextMonth:Y,goToMonth:H}=V,te=Hae(W,e,Q,O,s),{isSelected:re,select:ue,selected:ce}=Ise(e,s)??{},{blur:ee,focused:le,isFocusTarget:ve,moveFocus:Pe,setFocused:be}=Cse(e,V,te,re??(()=>!1),s),{labelDayButton:Ye,labelGridcell:he,labelGrid:Ue,labelMonthDropdown:je,labelNav:et,labelPrevious:_e,labelNext:oe,labelWeekday:J,labelWeekNumber:ze,labelWeekNumberHeader:Ne,labelYearDropdown:De}=a,Le=x.useMemo(()=>use(s,e.ISOWeek,e.broadcastCalendar,e.today),[s,e.ISOWeek,e.broadcastCalendar,e.today]),$=f!==void 0||v!==void 0,I=x.useCallback(()=>{G&&(H(G),T?.(G))},[G,H,T]),Z=x.useCallback(()=>{Y&&(H(Y),M?.(Y))},[H,Y,M]),pe=x.useCallback((ne,Be)=>ke=>{ke.preventDefault(),ke.stopPropagation(),be(ne),!Be.disabled&&(ue?.(ne.date,Be,ke),v?.(ne.date,Be,ke))},[ue,v,be]),Se=x.useCallback((ne,Be)=>ke=>{be(ne),w?.(ne.date,Be,ke)},[w,be]),xe=x.useCallback((ne,Be)=>ke=>{ee(),y?.(ne.date,Be,ke)},[ee,y]),Ie=x.useCallback((ne,Be)=>ke=>{const Ae={ArrowLeft:[ke.shiftKey?"month":"day",e.dir==="rtl"?"after":"before"],ArrowRight:[ke.shiftKey?"month":"day",e.dir==="rtl"?"before":"after"],ArrowDown:[ke.shiftKey?"year":"week","after"],ArrowUp:[ke.shiftKey?"year":"week","before"],PageUp:[ke.shiftKey?"year":"month","before"],PageDown:[ke.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(Ae[ke.key]){ke.preventDefault(),ke.stopPropagation();const[Ve,ge]=Ae[ke.key];Pe(Ve,ge)}b?.(ne.date,Be,ke)},[Pe,b,e.dir]),He=x.useCallback((ne,Be)=>ke=>{_?.(ne.date,Be,ke)},[_]),qe=x.useCallback((ne,Be)=>ke=>{E?.(ne.date,Be,ke)},[E]),ft=x.useCallback(ne=>Be=>{const ke=Number(Be.target.value),Ae=s.setMonth(s.startOfMonth(ne),ke);H(Ae)},[s,H]),We=x.useCallback(ne=>Be=>{const ke=Number(Be.target.value),Ae=s.setYear(s.startOfMonth(ne),ke);H(Ae)},[s,H]),{className:Xe,style:nt}=x.useMemo(()=>({className:[c[Zt.Root],e.className].filter(Boolean).join(" "),style:{...A?.[Zt.Root],...e.style}}),[c,e.className,e.style,A]),ct=$ae(e),Ke=x.useRef(null);gse(Ke,!!e.animate,{classNames:c,months:K,focused:le,dateLib:s});const gt={dayPickerProps:e,selected:ce,select:ue,isSelected:re,months:K,nextMonth:Y,previousMonth:G,goToMonth:H,getModifiers:te,components:r,classNames:c,styles:A,labels:a,formatters:i};return ot.createElement(c5.Provider,{value:gt},ot.createElement(r.Root,{rootRef:e.animate?Ke:void 0,className:Xe,style:nt,dir:e.dir,id:e.id,lang:e.lang??o.code,nonce:e.nonce,title:e.title,role:e.role,"aria-label":e["aria-label"],"aria-labelledby":e["aria-labelledby"],...ct},ot.createElement(r.Months,{className:c[Zt.Months],style:A?.[Zt.Months]},!e.hideNavigation&&!h&&ot.createElement(r.Nav,{"data-animated-nav":e.animate?"true":void 0,className:c[Zt.Nav],style:A?.[Zt.Nav],"aria-label":et(),onPreviousClick:I,onNextClick:Z,previousMonth:G,nextMonth:Y}),K.map((ne,Be)=>ot.createElement(r.Month,{"data-animated-month":e.animate?"true":void 0,className:c[Zt.Month],style:A?.[Zt.Month],key:Be,displayIndex:Be,calendarMonth:ne},h==="around"&&!e.hideNavigation&&Be===0&&ot.createElement(r.PreviousMonthButton,{type:"button",className:c[Zt.PreviousMonthButton],tabIndex:G?void 0:-1,"aria-disabled":G?void 0:!0,"aria-label":_e(G),onClick:I,"data-animated-button":e.animate?"true":void 0},ot.createElement(r.Chevron,{disabled:G?void 0:!0,className:c[Zt.Chevron],orientation:e.dir==="rtl"?"right":"left"})),ot.createElement(r.MonthCaption,{"data-animated-caption":e.animate?"true":void 0,className:c[Zt.MonthCaption],style:A?.[Zt.MonthCaption],calendarMonth:ne,displayIndex:Be},u?.startsWith("dropdown")?ot.createElement(r.DropdownNav,{className:c[Zt.Dropdowns],style:A?.[Zt.Dropdowns]},(()=>{const ke=u==="dropdown"||u==="dropdown-months"?ot.createElement(r.MonthsDropdown,{key:"month",className:c[Zt.MonthsDropdown],"aria-label":je(),classNames:c,components:r,disabled:!!e.disableNavigation,onChange:ft(ne.date),options:lse(ne.date,Q,O,i,s),style:A?.[Zt.Dropdown],value:s.getMonth(ne.date)}):ot.createElement("span",{key:"month"},N(ne.date,s)),Ae=u==="dropdown"||u==="dropdown-years"?ot.createElement(r.YearsDropdown,{key:"year",className:c[Zt.YearsDropdown],"aria-label":De(s.options),classNames:c,components:r,disabled:!!e.disableNavigation,onChange:We(ne.date),options:dse(Q,O,i,s,!!e.reverseYears),style:A?.[Zt.Dropdown],value:s.getYear(ne.date)}):ot.createElement("span",{key:"year"},U(ne.date,s));return s.getMonthYearOrder()==="year-first"?[Ae,ke]:[ke,Ae]})(),ot.createElement("span",{role:"status","aria-live":"polite",style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}},P(ne.date,s.options,s))):ot.createElement(r.CaptionLabel,{className:c[Zt.CaptionLabel],role:"status","aria-live":"polite"},P(ne.date,s.options,s))),h==="around"&&!e.hideNavigation&&Be===p-1&&ot.createElement(r.NextMonthButton,{type:"button",className:c[Zt.NextMonthButton],tabIndex:Y?void 0:-1,"aria-disabled":Y?void 0:!0,"aria-label":oe(Y),onClick:Z,"data-animated-button":e.animate?"true":void 0},ot.createElement(r.Chevron,{disabled:Y?void 0:!0,className:c[Zt.Chevron],orientation:e.dir==="rtl"?"left":"right"})),Be===p-1&&h==="after"&&!e.hideNavigation&&ot.createElement(r.Nav,{"data-animated-nav":e.animate?"true":void 0,className:c[Zt.Nav],style:A?.[Zt.Nav],"aria-label":et(),onPreviousClick:I,onNextClick:Z,previousMonth:G,nextMonth:Y}),ot.createElement(r.MonthGrid,{role:"grid","aria-multiselectable":f==="multiple"||f==="range","aria-label":Ue(ne.date,s.options,s)||void 0,className:c[Zt.MonthGrid],style:A?.[Zt.MonthGrid]},!e.hideWeekdays&&ot.createElement(r.Weekdays,{"data-animated-weekdays":e.animate?"true":void 0,className:c[Zt.Weekdays],style:A?.[Zt.Weekdays]},R&&ot.createElement(r.WeekNumberHeader,{"aria-label":Ne(s.options),className:c[Zt.WeekNumberHeader],style:A?.[Zt.WeekNumberHeader],scope:"col"},L()),Le.map(ke=>ot.createElement(r.Weekday,{"aria-label":J(ke,s.options,s),className:c[Zt.Weekday],key:String(ke),style:A?.[Zt.Weekday],scope:"col"},z(ke,s.options,s)))),ot.createElement(r.Weeks,{"data-animated-weeks":e.animate?"true":void 0,className:c[Zt.Weeks],style:A?.[Zt.Weeks]},ne.weeks.map(ke=>ot.createElement(r.Week,{className:c[Zt.Week],key:ke.weekNumber,style:A?.[Zt.Week],week:ke},R&&ot.createElement(r.WeekNumber,{week:ke,style:A?.[Zt.WeekNumber],"aria-label":ze(ke.weekNumber,{locale:o}),className:c[Zt.WeekNumber],scope:"row",role:"rowheader"},j(ke.weekNumber,s)),ke.days.map(Ae=>{const{date:Ve}=Ae,ge=te(Ae);if(ge[dr.focused]=!ge.hidden&&!!le?.isEqualTo(Ae),ge[Qa.selected]=re?.(Ve)||ge.selected,lv(ce)){const{from:Bt,to:St}=ce;ge[Qa.range_start]=!!(Bt&&St&&s.isSameDay(Ve,Bt)),ge[Qa.range_end]=!!(Bt&&St&&s.isSameDay(Ve,St)),ge[Qa.range_middle]=_o(ce,Ve,!0,s)}const ht=cse(ge,A,e.modifiersStyles),bt=Wae(ge,c,e.modifiersClassNames),Kt=!$&&!ge.hidden?he(Ve,ge,s.options,s):void 0;return ot.createElement(r.Day,{key:`${Ae.isoDate}_${Ae.displayMonthId}`,day:Ae,modifiers:ge,className:bt.join(" "),style:ht,role:"gridcell","aria-selected":ge.selected||void 0,"aria-label":Kt,"data-day":Ae.isoDate,"data-month":Ae.outside?Ae.dateMonthId:void 0,"data-selected":ge.selected||void 0,"data-disabled":ge.disabled||void 0,"data-hidden":ge.hidden||void 0,"data-outside":Ae.outside||void 0,"data-focused":ge.focused||void 0,"data-today":ge.today||void 0},!ge.hidden&&$?ot.createElement(r.DayButton,{className:c[Zt.DayButton],style:A?.[Zt.DayButton],type:"button",day:Ae,modifiers:ge,disabled:!ge.focused&&ge.disabled||void 0,"aria-disabled":ge.focused&&ge.disabled||void 0,tabIndex:ve(Ae)?0:-1,"aria-label":Ye(Ve,ge,s.options,s),onClick:pe(Ae,ge),onBlur:xe(Ae,ge),onFocus:Se(Ae,ge),onKeyDown:Ie(Ae,ge),onMouseEnter:He(Ae,ge),onMouseLeave:qe(Ae,ge)},k(Ve,s.options,s)):!ge.hidden&&k(Ae.date,s.options,s))})))))))),e.footer&&ot.createElement(r.Footer,{className:c[Zt.Footer],style:A?.[Zt.Footer],role:"status","aria-live":"polite"},e.footer)))}function EP(t){if(!t)return"";const e=t.split("-");if(e.length!==3)return t;const n=new Date(Number(e[0]),Number(e[1])-1,Number(e[2]));return Number.isFinite(n.getTime())?Rs(n,"MMM d"):t}function Fse({from:t,to:e,onApply:n,onCancel:r}){const i=x.useMemo(()=>{const u={from:void 0,to:void 0};if(t){const f=t.split("-");u.from=new Date(Number(f[0]),Number(f[1])-1,Number(f[2]))}if(e){const f=e.split("-");u.to=new Date(Number(f[0]),Number(f[1])-1,Number(f[2]))}return u},[t,e]),[a,s]=x.useState(i),o=()=>{if(!a?.from)return;const u=Rs(a.from,"yyyy-MM-dd"),f=a.to?Rs(a.to,"yyyy-MM-dd"):u;n?.(u,f)},c=!!a?.from;return m.jsxs("div",{className:"p-4",children:[m.jsx(Ose,{mode:"range",selected:a,onSelect:s,numberOfMonths:2,showOutsideDays:!1,classNames:{root:"rdp-oai",months:"flex gap-4",month:"space-y-3",month_caption:"flex justify-center items-center h-8",caption_label:"text-sm font-medium text-oai-black dark:text-oai-white",nav:"flex items-center justify-between absolute inset-x-0 top-0 px-2",button_previous:"inline-flex items-center justify-center w-7 h-7 rounded-md text-oai-gray-500 hover:text-oai-black dark:text-oai-gray-400 dark:hover:text-oai-white hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors",button_next:"inline-flex items-center justify-center w-7 h-7 rounded-md text-oai-gray-500 hover:text-oai-black dark:text-oai-gray-400 dark:hover:text-oai-white hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors",chevron:"w-4 h-4",month_grid:"border-collapse",weekdays:"flex",weekday:"w-9 text-center text-xs font-medium text-oai-gray-400 dark:text-oai-gray-500 py-1",week:"flex",day:"w-9 h-9 text-center text-sm p-0 relative",day_button:"w-full h-full inline-flex items-center justify-center rounded-md transition-colors hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 text-oai-black dark:text-oai-white cursor-pointer rdp-day-btn",today:"font-bold",selected:"rdp-selected",range_start:"rdp-selected rdp-range-start",range_end:"rdp-selected rdp-range-end",range_middle:"rdp-range-mid",outside:"text-oai-gray-300 dark:text-oai-gray-600",disabled:"text-oai-gray-300 dark:text-oai-gray-600 cursor-not-allowed",hidden:"invisible"},styles:{months:{position:"relative"}}}),m.jsxs("div",{className:"flex items-center justify-end gap-2 mt-4 pt-3 border-t border-oai-gray-200 dark:border-oai-gray-700",children:[c&&a.from&&m.jsxs("span",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 mr-auto",children:[Rs(a.from,"MMM d, yyyy"),a.to&&a.to.getTime()!==a.from.getTime()?` — ${Rs(a.to,"MMM d, yyyy")}`:""]}),m.jsx(Ui,{variant:"secondary",size:"sm",onClick:r,children:"Cancel"}),m.jsx(Ui,{variant:"primary",size:"sm",onClick:o,disabled:!c,children:"Apply"})]})]})}function Use({size:t=16,className:e=""}){return m.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:e,children:m.jsx("path",{d:"M4.709 15.955l4.72-2.647.08-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0 11.784l.055-.352.48-.321.686.06 1.52.103 2.278.158 1.652.097 2.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686 1.908 1.476 2.491 1.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97 2.97 0 01-.104-.729L6.283.134 6.696 0l.996.134.42.364.62 1.414 1.002 2.229 1.555 3.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.376-.91.747-.492.584.28.48.685-.067.444-.286 1.851-.559 2.903-.364 1.942h.212l.243-.242.985-1.306 1.652-2.064.73-.82.85-.904.547-.431h1.033l.76 1.129-.34 1.166-1.064 1.347-.881 1.142-1.264 1.7-.79 1.36.073.11.188-.02 2.856-.606 1.543-.28 1.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.049.061 1.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093 1.068 2.006 1.81 2.509 2.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649 2.345 3.521.122 1.08-.17.353-.608.213-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674 7.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434 1.967-2.18 2.945-1.726 1.845-.414.164-.717-.37.067-.662.401-.589 2.388-3.036 1.44-1.882.93-1.086-.006-.158h-.055L4.132 18.56l-1.13.146-.487-.456.061-.746.231-.243 1.908-1.312-.006.006z"})})}function jse({size:t=16,className:e=""}){return m.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",className:e,children:m.jsx("path",{d:"M8.086.457a6.105 6.105 0 013.046-.415c1.333.153 2.521.72 3.564 1.7a.117.117 0 00.107.029c1.408-.346 2.762-.224 4.061.366l.063.03.154.076c1.357.703 2.33 1.77 2.918 3.198.278.679.418 1.388.421 2.126a5.655 5.655 0 01-.18 1.631.167.167 0 00.04.155 5.982 5.982 0 011.578 2.891c.385 1.901-.01 3.615-1.183 5.14l-.182.22a6.063 6.063 0 01-2.934 1.851.162.162 0 00-.108.102c-.255.736-.511 1.364-.987 1.992-1.199 1.582-2.962 2.462-4.948 2.451-1.583-.008-2.986-.587-4.21-1.736a.145.145 0 00-.14-.032c-.518.167-1.04.191-1.604.185a5.924 5.924 0 01-2.595-.622 6.058 6.058 0 01-2.146-1.781c-.203-.269-.404-.522-.551-.821a7.74 7.74 0 01-.495-1.283 6.11 6.11 0 01-.017-3.064.166.166 0 00.008-.074.115.115 0 00-.037-.064 5.958 5.958 0 01-1.38-2.202 5.196 5.196 0 01-.333-1.589 6.915 6.915 0 01.188-2.132c.45-1.484 1.309-2.648 2.577-3.493.282-.188.55-.334.802-.438.286-.12.573-.22.861-.304a.129.129 0 00.087-.087A6.016 6.016 0 015.635 2.31C6.315 1.464 7.132.846 8.086.457zm-.804 7.85a.848.848 0 00-1.473.842l1.694 2.965-1.688 2.848a.849.849 0 001.46.864l1.94-3.272a.849.849 0 00.007-.854l-1.94-3.393zm5.446 6.24a.849.849 0 000 1.695h4.848a.849.849 0 000-1.696h-4.848z"})})}function Bse({size:t=16,className:e=""}){return m.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:e,children:m.jsx("path",{d:"M22.106 5.68L12.5.135a.998.998 0 00-.998 0L1.893 5.68a.84.84 0 00-.419.726v11.186c0 .3.16.577.42.727l9.607 5.547a.999.999 0 00.998 0l9.608-5.547a.84.84 0 00.42-.727V6.407a.84.84 0 00-.42-.726zm-.603 1.176L12.228 22.92c-.063.108-.228.064-.228-.061V12.34a.59.59 0 00-.295-.51l-9.11-5.26c-.107-.062-.063-.228.062-.228h18.55c.264 0 .428.286.296.514z"})})}function zse({size:t=16,className:e=""}){return m.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:e,children:m.jsx("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z"})})}function Vse({size:t=16,className:e=""}){return m.jsx("svg",{width:t,height:t,viewBox:"0 -1 22 28",fill:"currentColor",fillRule:"evenodd",className:e,children:m.jsx("path",{d:"M4.125 20.149c-2.69 5.959 3.036 7.453 7.26 3.966 1.24 3.91 5.898.993 7.569-2.036 3.682-6.678 2.195-13.49 1.813-14.895-2.617-9.582-15.699-9.592-17.95.049-.526 1.687-.535 3.606-.833 5.598-.15 1.005-.256 1.646-.645 2.703-.223.607-.53 1.147-1.014 2.056-.75 1.412-.434 4.138 3.434 2.724v.001ZM11.895 11.332c-1.073 0-1.234-1.283-1.234-2.048 0-.69.124-1.239.358-1.586a1 1 0 0 1 .876-.462c.375 0 .697.158.924.47.259.354.395.9.395 1.578 0 1.283-.493 2.048-1.319 2.048Zm4.416 0c-1.073 0-1.234-1.283-1.234-2.048 0-.69.124-1.239.358-1.586a1 1 0 0 1 .876-.462c.375 0 .697.158.924.47.259.354.396.9.396 1.578 0 1.283-.494 2.048-1.32 2.048Z"})})}function Hse({size:t=16,className:e=""}){return m.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:e,children:m.jsx("path",{d:"M16 6H8v12h8V6zm4 16H4V2h16v20z"})})}function Wse({size:t=16,className:e=""}){return m.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:e,children:[m.jsx("path",{d:"M21.846 0a1.923 1.923 0 110 3.846H20.15a.226.226 0 01-.227-.226V1.923C19.923.861 20.784 0 21.846 0z"}),m.jsx("path",{d:"M11.065 11.199l7.257-7.2c.137-.136.06-.41-.116-.41H14.3a.164.164 0 00-.117.051l-7.82 7.756c-.122.12-.302.013-.302-.179V3.82c0-.127-.083-.23-.185-.23H3.186c-.103 0-.186.103-.186.23V19.77c0 .128.083.23.186.23h2.69c.103 0 .186-.102.186-.23v-3.25c0-.069.025-.135.069-.178l2.424-2.406a.158.158 0 01.205-.023l6.484 4.772a7.677 7.677 0 003.453 1.283c.108.012.2-.095.2-.23v-3.06c0-.117-.07-.212-.164-.227a5.028 5.028 0 01-2.027-.807l-5.613-4.064c-.117-.078-.132-.279-.028-.381z"})]})}function Gse({size:t=16,className:e=""}){return m.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",className:e,children:m.jsx("path",{d:"M19.245 5.364c1.322 1.36 1.877 3.216 2.11 5.817.622 0 1.2.135 1.592.654l.73.964c.21.278.323.61.323.955v2.62c0 .339-.173.669-.453.868C20.239 19.602 16.157 21.5 12 21.5c-4.6 0-9.205-2.583-11.547-4.258-.28-.2-.452-.53-.453-.868v-2.62c0-.345.113-.679.321-.956l.73-.963c.392-.517.974-.654 1.593-.654l.029-.297c.25-2.446.81-4.213 2.082-5.52 2.461-2.54 5.71-2.851 7.146-2.864h.198c1.436.013 4.685.323 7.146 2.864zm-7.244 4.328c-.284 0-.613.016-.962.05-.123.447-.305.85-.57 1.108-1.05 1.023-2.316 1.18-2.994 1.18-.638 0-1.306-.13-1.851-.464-.516.165-1.012.403-1.044.996a65.882 65.882 0 00-.063 2.884l-.002.48c-.002.563-.005 1.126-.013 1.69.002.326.204.63.51.765 2.482 1.102 4.83 1.657 6.99 1.657 2.156 0 4.504-.555 6.985-1.657a.854.854 0 00.51-.766c.03-1.682.006-3.372-.076-5.053-.031-.596-.528-.83-1.046-.996-.546.333-1.212.464-1.85.464-.677 0-1.942-.157-2.993-1.18-.266-.258-.447-.661-.57-1.108-.32-.032-.64-.049-.96-.05zm-2.525 4.013c.539 0 .976.426.976.95v1.753c0 .525-.437.95-.976.95a.964.964 0 01-.976-.95v-1.752c0-.525.437-.951.976-.951zm5 0c.539 0 .976.426.976.95v1.753c0 .525-.437.95-.976.95a.964.964 0 01-.976-.95v-1.752c0-.525.437-.951.976-.951zM7.635 5.087c-1.05.102-1.935.438-2.385.906-.975 1.037-.765 3.668-.21 4.224.405.394 1.17.657 1.995.657h.09c.649-.013 1.785-.176 2.73-1.11.435-.41.705-1.433.675-2.47-.03-.834-.27-1.52-.63-1.813-.39-.336-1.275-.482-2.265-.394zm6.465.394c-.36.292-.6.98-.63 1.813-.03 1.037.24 2.06.675 2.47.968.957 2.136 1.104 2.776 1.11h.044c.825 0 1.59-.263 1.995-.657.555-.556.765-3.187-.21-4.224-.45-.468-1.335-.804-2.385-.906-.99-.088-1.875.058-2.265.394zM12 7.615c-.24 0-.525.015-.84.044.03.16.045.336.06.526l-.001.159a2.94 2.94 0 01-.014.25c.225-.022.425-.027.612-.028h.366c.187 0 .387.006.612.028-.015-.146-.015-.277-.015-.409.015-.19.03-.365.06-.526a9.29 9.29 0 00-.84-.044z"})})}function $se({size:t=16,className:e=""}){return m.jsxs("svg",{width:t,height:t,viewBox:"0 0 64 60",fill:"none",className:e,"aria-hidden":"true",children:[m.jsx("path",{fill:"currentColor",d:"M37.2114 3.75318C37.6821 3.33106 37.7106 3.31457 38.0558 3.29385C38.6149 3.2531 39.1272 3.52199 39.9989 4.31564C42.0356 6.16652 44.8714 9.97183 46.6346 13.2212L47.3163 14.4819L48.2782 14.9605C49.2072 15.4299 50.7308 16.3923 51.3672 16.9085C51.655 17.1464 51.6956 17.1508 51.9947 17.0344C53.3454 16.5084 55.2803 17.206 56.9869 18.8432C58.5231 20.3155 59.9943 22.8312 60.558 24.9308C60.6403 25.2687 60.7493 25.9952 60.7891 26.5362C60.9177 28.4358 60.3092 29.9532 59.1362 30.64C58.8965 30.7784 58.8801 30.8158 58.8868 31.4132C58.9409 34.2583 58.1741 37.0985 56.6335 39.8679C54.8946 42.9773 51.7981 46.1938 47.6074 49.2243C45.357 50.8619 40.0323 53.964 37.6248 55.0532C31.8578 57.6496 27.2346 58.646 23.2188 58.154C20.8236 57.8638 18.1124 56.9287 16.5082 55.8433C16.086 55.5515 16.0191 55.5329 15.6966 55.6251C13.9793 56.1185 11.73 55.1053 9.81931 52.9844C9.05725 52.1366 7.82714 50.0548 7.42839 48.9409C6.50606 46.3339 6.68976 43.9816 7.91836 42.5767C8.23573 42.2149 8.2453 42.1995 8.17598 41.5912C8.06148 40.5951 8.00971 39.1206 8.06202 38.1692L8.10361 37.2803L6.76977 34.9212C4.70378 31.2451 3.3912 28.1582 2.88489 25.7998C2.61762 24.5066 2.63385 23.9324 2.96214 23.5078C3.16198 23.2515 3.81796 22.9866 4.60785 22.8407C6.59665 22.4917 10.9334 22.8076 15.7581 23.6595L16.259 23.7458L17.3608 22.7713C19.1891 21.1519 20.4038 20.244 22.6429 18.8478C24.9768 17.3876 27.6108 16.1858 30.577 15.2346L31.5295 14.9294L32.0526 13.5561C33.9257 8.61146 35.8437 4.96584 37.2114 3.75318ZM21.5208 29.0919C19.404 30.314 18.3453 30.9251 17.5676 31.6099C14.4179 34.3835 13.2414 38.777 14.5823 42.7537C14.9135 43.7357 15.5247 44.7942 16.7469 46.9111C17.9691 49.0279 18.5801 50.0865 19.2649 50.8643C22.0385 54.014 26.4316 55.1918 30.4084 53.8509C31.3904 53.5198 32.4489 52.9085 34.5657 51.6863L46.7442 44.6551C48.8613 43.4328 49.9205 42.8214 50.6983 42.1365C53.8479 39.363 55.0245 34.9695 53.6835 30.9927C53.3524 30.0107 52.7412 28.9522 51.519 26.8354C50.2968 24.7185 49.6858 23.66 49.0009 22.8822C46.2274 19.7325 41.8342 18.5547 37.8575 19.8956C36.8754 20.2267 35.8163 20.8383 33.6993 22.0606L21.5208 29.0919Z"}),m.jsx("g",{transform:"rotate(-30 22.6953 37.6011)",children:m.jsx("rect",{x:"22.6953",y:"37.6011",width:"4.81084",height:"9.99175",rx:"2.40542",fill:"currentColor"})}),m.jsx("g",{transform:"rotate(-30 35.6748 30.1074)",children:m.jsx("rect",{x:"35.6748",y:"30.1074",width:"4.81084",height:"9.99175",rx:"2.40542",fill:"currentColor"})})]})}function Yse({size:t=16,className:e=""}){return m.jsx("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",className:e,children:m.jsx("path",{d:"M7 2h10a5 5 0 015 5v10a5 5 0 01-5 5H7a5 5 0 01-5-5V7a5 5 0 015-5zm0 4.5v11h2.35v-4.55h5.3V17.5H17v-11h-2.35v4.1h-5.3V6.5H7z"})})}function qse({size:t=16,className:e=""}){return m.jsx("svg",{width:t,height:t,viewBox:"0 0 16 16",fill:"currentColor",className:e,children:m.jsx("path",{d:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8z"})})}function Xse({size:t=16,className:e=""}){return m.jsxs("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",className:e,"aria-hidden":"true",children:[m.jsx("rect",{x:"2",y:"2",width:"20",height:"20",rx:"5",stroke:"currentColor",strokeWidth:"1.6"}),m.jsx("path",{d:"M7.2 16.8l4.4-4.4M14.5 9.5l1.8-1.8a1.4 1.4 0 0 1 2 2l-1.8 1.8M9 17.5l-1.5 1.5a1.06 1.06 0 0 1-1.5-1.5L7.5 16M11.6 12.4l3.5-3.5",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"}),m.jsx("circle",{cx:"17",cy:"13",r:"1.2",fill:"currentColor"})]})}function Kse({size:t=16,className:e=""}){return m.jsxs("svg",{width:t,height:t,viewBox:"0 0 120 90",fill:"currentColor",className:e,children:[m.jsx("rect",{x:"10",y:"8",width:"100",height:"12",rx:"2"}),m.jsx("rect",{x:"25",y:"20",width:"12",height:"62",rx:"2"}),m.jsx("rect",{x:"75",y:"20",width:"12",height:"45",rx:"2"}),m.jsx("rect",{x:"71",y:"55",width:"20",height:"16",rx:"3"}),m.jsx("rect",{x:"76",y:"71",width:"3",height:"8",rx:"1"}),m.jsx("rect",{x:"82",y:"71",width:"3",height:"8",rx:"1"})]})}const Zse={CLAUDE:Use,CODEBUDDY:$se,CODEX:jse,COPILOT:Gse,CRAFT:Xse,CURSOR:Bse,GEMINI:zse,GITHUB:qse,HERMES:Yse,KIMI:Wse,KIRO:Vse,OPENCODE:Hse,OMP:Kse},Jse={ANTIGRAVITY:"/brand-logos/antigravity.svg",CLAUDE:"/brand-logos/claude-code.svg",CODEX:"/brand-logos/codex.svg",GEMINI:"/brand-logos/gemini.svg",HERMES:"/brand-logos/hermes.svg",OPENCLAW:"/brand-logos/openclaw.svg",OPENCODE:"/brand-logos/opencode.svg"};function Qc({provider:t,size:e=16,color:n,className:r=""}){const i=t?.toUpperCase?.()||"",a=Jse[i];if(a)return m.jsx("img",{src:a,alt:"",width:e,height:e,className:r,style:{width:e,height:e,objectFit:"contain"},"aria-hidden":!0});const s=Zse[i];return s?m.jsx(s,{size:e,className:r}):m.jsx("div",{className:"rounded-full shrink-0",style:{width:e*.5,height:e*.5,backgroundColor:n}})}function MP(t){if(!Number.isFinite(Number(t)))return null;const e=Number(t);return e<=0?null:Iy(e,{decimals:1})}function TP(t){const e=Number(t);return!Number.isFinite(e)||e<=0?null:e<.01?"<$0.01":Oy(e.toFixed(2),{decimals:2})}function Qse(t){return Array.isArray(t)?t.map(e=>typeof e=="string"?{key:e,label:CP(e)}:{key:e.key,label:e.label||CP(e.key)}):[]}function eoe(t){if(typeof t!="string")return null;const e=t.replace(/,/g,"").match(/-?\d+(?:\.\d+)?/);if(!e)return null;const n=Number(e[0]);return Number.isFinite(n)?n:null}const toe={CODEX:"#10b981",CLAUDE:"#8b5cf6",OPENCODE:"#f59e0b",GEMINI:"#3b82f6",KIMI:"#a78bfa"};function v_(t,e){const n=t?.toUpperCase?.()||"";return toe[n]||`hsl(${150+e*40}, 60%, 45%)`}const noe={day:"usage.period.day",week:"usage.period.week",month:"usage.period.month",total:"usage.period.total",custom:"usage.period.custom"};function CP(t){const e=noe[t];return e?F(e):String(t).toUpperCase()}function roe({loading:t,onClick:e}){const n=ou();return m.jsx(Ui,{variant:"secondary",size:"sm",disabled:t,onClick:e,"aria-label":F("usage.button.refresh"),className:"w-8 p-0",children:m.jsx(fr.span,{"aria-hidden":"true",animate:t?{rotate:360}:{rotate:0},transition:t&&!n?{duration:1,repeat:1/0,ease:"linear"}:{duration:.3},style:{display:"inline-block"},children:"↻"})})}function ioe({period:t,periods:e,onPeriodChange:n,summaryValue:r,summaryLabel:i,summaryCostValue:a,onCostInfo:s,fleetData:o=[],onRefresh:c,loading:u,className:f="",customFrom:h,customTo:p,onCustomRangeApply:y,customRangeOpen:v,onCustomRangeOpenChange:w,onOpenShare:b}){const _=Qse(e),E=eoe(String(r??"")),M=E!=null,[T,R]=x.useState(null),{resolvedTheme:A}=Dp(),P=A==="dark",k=P?"rgba(10,10,10,0.98)":"rgba(255,255,255,0.96)",N=P?"rgba(10,10,10,0)":"rgba(255,255,255,0)",j=o.filter(L=>L.models?.length>0);return m.jsx(Rl,{delay:.2,children:m.jsxs(fu,{className:f,children:[m.jsxs("div",{className:"flex items-center justify-between gap-3 mb-6",children:[m.jsx("div",{role:"tablist","aria-label":F("usage.overview.tablist_aria"),className:"flex gap-1",children:_.map(L=>{const z=t===L.key,U=`text-xs font-medium px-3 py-1.5 rounded-md transition-colors ${z?"text-oai-black dark:text-oai-white bg-oai-gray-100 dark:bg-oai-gray-800":"text-oai-gray-500 dark:text-oai-gray-300 hover:text-oai-black dark:hover:text-oai-white hover:bg-oai-gray-50 dark:hover:bg-oai-gray-800"}`;if(L.key==="custom"){const V=z&&h&&p?`${EP(h)} — ${EP(p)}`:L.label;return m.jsxs(zF,{open:v,onOpenChange:W=>{W?n?.("custom"):w?.(W)},children:[m.jsx(VF,{render:m.jsx("button",{role:"tab","aria-selected":z,type:"button",className:U}),children:V}),m.jsx(WF,{children:m.jsx($F,{sideOffset:8,side:"bottom",align:"start",className:"!z-[9999]",children:m.jsx(YF,{className:"bg-white dark:bg-oai-gray-900 border border-oai-gray-200 dark:border-oai-gray-700 rounded-xl shadow-lg",children:m.jsx(Fse,{from:h,to:p,onApply:y,onCancel:()=>w?.(!1)})})})})]},"custom")}return m.jsx("button",{role:"tab","aria-selected":z,type:"button",className:U,onClick:()=>n?.(L.key),children:L.label},L.key)})}),m.jsxs("div",{className:"flex items-center gap-1.5",children:[b?m.jsxs("button",{type:"button",onClick:b,"aria-label":F("share.button.aria"),className:"inline-flex items-center justify-center gap-1.5 h-8 px-3 text-xs font-medium rounded-md border border-oai-gray-300 dark:border-oai-gray-700 bg-oai-white dark:bg-oai-gray-900 text-oai-black dark:text-oai-white hover:border-oai-brand hover:text-oai-brand transition-colors duration-200",children:[m.jsx(rG,{className:"h-3.5 w-3.5",strokeWidth:2}),F("share.button.label")]}):null,c&&m.jsx(roe,{loading:u,onClick:c})]})]}),m.jsxs("div",{className:"text-center mb-8",children:[m.jsx("div",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wider mb-3",children:i}),m.jsx("div",{className:"text-6xl md:text-7xl font-bold text-oai-black dark:text-oai-white tracking-tight tabular-nums",children:M?m.jsx(Cre,{value:E,displayValue:r,fontSize:72,padding:6,gap:1,textColor:"var(--oai-black, #111827)",fontWeight:700,gradientHeight:P?0:8,gradientFrom:k,gradientTo:N,counterStyle:{paddingLeft:0,paddingRight:0,gap:0},digitStyle:{width:"0.88ch"}}):r}),a&&m.jsx("div",{className:"flex items-center justify-center gap-2 mt-4",children:s?m.jsxs("button",{type:"button",onClick:s,className:"inline-flex items-center gap-1.5 text-xl font-bold text-oai-brand hover:text-oai-brand-dark dark:hover:text-oai-brand-light transition-colors cursor-pointer","aria-label":F("usage.overview.cost_breakdown_aria"),children:[a,m.jsx(I7,{size:16,strokeWidth:2,className:"opacity-80"})]}):m.jsx("span",{className:"text-xl font-bold text-oai-brand",children:a})})]}),j.length>0&&m.jsxs("div",{className:"space-y-6",children:[m.jsx("div",{role:"img","aria-label":F("usage.overview.distribution_aria",{items:j.map(L=>F("usage.overview.distribution_item",{label:L.label,percent:L.totalPercent})).join(",")}),className:"h-1.5 w-full bg-oai-gray-100 dark:bg-oai-gray-800 rounded-full overflow-hidden flex",children:j.map((L,z)=>{const U=v_(L.label,z);return m.jsx(fr.div,{initial:{width:0},animate:{width:`${L.totalPercent}%`},transition:{duration:.6,delay:.3+z*.1},className:"h-full",style:{backgroundColor:U},title:`${L.label}: ${L.totalPercent}%`},L.label)})}),m.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 xl:grid-cols-5 gap-3",children:j.map((L,z)=>{const U=v_(L.label,z),V=T===L.label;return m.jsxs("button",{"aria-expanded":V,"aria-controls":`provider-details-${L.label}`,"aria-label":F("usage.overview.provider_card_aria",{provider:L.label,percent:L.totalPercent,tokens:MP(L.usage)||"0",cost:TP(L.usd)||"$0",action:F(V?"usage.overview.collapse":"usage.overview.expand")}),onClick:()=>R(V?null:L.label),className:`min-w-0 text-left p-3 rounded-lg border transition-colors duration-200 ${V?"border-oai-gray-300 dark:border-oai-gray-600 bg-oai-gray-50 dark:bg-oai-gray-800":"border-oai-gray-200 dark:border-oai-gray-700 hover:border-oai-gray-300 dark:hover:border-oai-gray-600"}`,children:[m.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[m.jsx(Qc,{provider:L.label,size:15,color:U,className:"text-oai-gray-700 dark:text-oai-gray-300 shrink-0"}),m.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-oai-white",children:L.label})]}),m.jsxs("div",{className:"text-lg font-semibold text-oai-black dark:text-oai-white tabular-nums",children:[L.totalPercent,"%"]}),m.jsx("div",{className:"mt-0.5 text-[11px] text-oai-gray-400 dark:text-oai-gray-400 tabular-nums",children:F("usage.overview.model_count",{count:L.models.length})})]},L.label)})}),T&&m.jsx("div",{id:`provider-details-${T}`,role:"region","aria-label":F("usage.overview.model_details_aria",{provider:T}),className:"mt-2",children:j.filter(L=>L.label===T).map(L=>{const z=v_(L.label,0),U=[...L.models].sort((V,W)=>(W.share||0)-(V.share||0));return m.jsxs("div",{children:[m.jsxs("div",{className:"flex items-center gap-1.5 mb-3",children:[m.jsx(Qc,{provider:L.label,size:14,color:z,className:"shrink-0"}),m.jsx("span",{className:"text-sm font-medium text-oai-black dark:text-oai-white",children:L.label})]}),m.jsx("div",{className:"space-y-3",children:U.map(V=>{const W=MP(V.usage),K=TP(V.cost),Q=Math.max(0,Math.min(100,Number(V.share)||0));return m.jsxs("div",{children:[m.jsxs("div",{className:"flex items-baseline gap-4 mb-1.5",children:[m.jsx("span",{className:"flex-1 min-w-0 text-sm text-oai-gray-700 dark:text-oai-gray-300 truncate",title:V.name,children:V.name}),m.jsx("span",{className:"shrink-0 w-16 text-right text-sm text-oai-gray-500 dark:text-oai-gray-400 tabular-nums",children:W}),m.jsx("span",{className:"shrink-0 w-16 text-right text-sm text-oai-gray-500 dark:text-oai-gray-400 tabular-nums",children:K}),m.jsxs("span",{className:"shrink-0 w-12 text-right text-sm text-oai-black dark:text-oai-white tabular-nums",children:[V.share,"%"]})]}),m.jsx("div",{className:"h-[3px] bg-oai-gray-100 dark:bg-oai-gray-800 rounded-full overflow-hidden",role:"progressbar","aria-valuenow":Q,"aria-valuemin":0,"aria-valuemax":100,children:m.jsx("div",{className:"h-full transition-[width] duration-500 ease-out",style:{width:`${Q}%`,backgroundColor:z,opacity:.45}})})]},V.id||V.name)})})]},L.label)})})]})]})})}function AP(t,e){if(!Array.isArray(t)||t.length===0)return 0;if(t.length===1)return t[0];const n=(t.length-1)*e,r=Math.floor(n),i=Math.ceil(n);if(r===i)return t[r];const a=n-r;return t[r]+(t[i]-t[r])*a}function aoe(t){const e=Array.isArray(t)?t.filter(i=>Number.isFinite(i)&&i>0).sort((i,a)=>i-a):[];if(e.length===0)return{rawMax:0,effectiveMax:1,clippedValues:Array.isArray(t)?t.map(()=>0):[]};const n=e.at(-1)??0;let r=n;if(e.length>=4){const i=AP(e,.25),a=AP(e,.75),s=Math.max(a-i,0),o=a+s*1.5;n>o&&(r=Math.max(o,a,1))}return{rawMax:n,effectiveMax:Math.max(r,1),clippedValues:Array.isArray(t)?t.map(i=>!Number.isFinite(i)||i<=0?0:Math.min(i,Math.max(r,1))):[]}}function soe({value:t,displayValue:e,scale:n,index:r,row:i,totalBars:a}){const s=ou(),o=n.effectiveMax>0?e/n.effectiveMax*100:0,c=`${Math.max(o,2)}%`,u=i?.missing,f=i?.future,h=a<=7?"6px":a<=14?"4px":"3px";return m.jsx(fr.div,{className:"group relative flex-1 self-stretch",initial:{opacity:0,scaleY:0},animate:{opacity:1,scaleY:1},transition:{duration:s?0:.3,delay:s?0:r*.02,ease:[.25,.1,.25,1]},style:{originY:1},children:m.jsxs("div",{className:"absolute inset-x-0 bottom-0",style:{height:c},children:[m.jsx("div",{"data-trend-bar":"true",className:"h-full w-full cursor-pointer transition-all duration-200 group-hover:brightness-110",style:{minHeight:t>0?"4px":"2px",opacity:u||f?.2:1,borderRadius:`${h} ${h} 0 0`,background:t>0?"#10b981":"var(--oai-gray-100)"},title:`${t.toLocaleString()}`}),m.jsx("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 bg-oai-black text-white text-xs rounded opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none whitespace-nowrap z-20",children:t.toLocaleString()})]})})}function ooe({rows:t,from:e,to:n,period:r,timeZoneLabel:i,showTimeZoneLabel:a=!0,className:s=""}){const o=Array.isArray(t)&&t.length?t:[],c=o.map(f=>{if(f?.missing||f?.future)return 0;const h=f?.billable_total_tokens??f?.total_tokens??f?.value;if(h==null)return 0;const p=Number(h);return Number.isFinite(p)?p:0}),u=aoe(c);return m.jsxs("div",{className:`rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-5 ${s}`,children:[m.jsxs("div",{className:"mb-3",children:[m.jsx("h3",{className:"text-sm font-medium text-oai-gray-500 dark:text-oai-gray-300 uppercase tracking-wide",children:F("trend.monitor.label")}),a&&i&&m.jsx("p",{className:"text-xs text-oai-gray-400 dark:text-oai-gray-400 mt-0.5",children:i})]}),m.jsxs("div",{className:"space-y-3",children:[m.jsxs("div",{className:"relative",children:[m.jsx("div",{className:"absolute inset-0 flex flex-col justify-between pointer-events-none",children:[0,25,50,75,100].map(f=>m.jsx("div",{className:"w-full border-t border-oai-gray-100 dark:border-oai-gray-800",style:{top:`${100-f}%`}},f))}),m.jsx("div",{className:"h-40 flex items-end gap-1 relative z-0",children:c.length>0?c.map((f,h)=>m.jsx(soe,{value:f,displayValue:u.clippedValues[h]??0,scale:u,index:h,row:o[h],totalBars:c.length},h)):m.jsx("div",{className:"flex-1 h-full flex items-center justify-center",children:m.jsx("p",{className:"text-sm text-oai-gray-400 dark:text-oai-gray-400",children:"No data yet"})})})]}),e&&n&&m.jsxs("div",{className:"flex justify-between text-xs text-oai-gray-500 dark:text-oai-gray-300 font-medium pt-2 border-t border-oai-gray-100 dark:border-oai-gray-800",children:[m.jsx("span",{children:e}),m.jsx("span",{children:n})]})]})]})}const RP={"idle-living":"idle/living.svg","idle-doze":"idle/doze.svg","idle-follow":"idle/follow.svg","idle-look":"idle/look.svg","idle-yawn":"idle/yawn.svg","idle-collapse":"idle/collapse.svg","working-building":"working/building.svg","working-carrying":"working/carrying.svg","working-conducting":"working/conducting.svg","working-confused":"working/confused.svg","working-debugger":"working/debugger.svg","working-juggling":"working/juggling.svg","working-overheated":"working/overheated.svg","working-pushing":"working/pushing.svg","working-sweeping":"working/sweeping.svg","working-thinking":"working/thinking.svg","working-typing":"working/typing.svg","working-ultrathink":"working/ultrathink.svg","working-wizard":"working/wizard.svg","mini-alert":"mini/alert.svg","mini-crabwalk":"mini/crabwalk.svg","mini-enter":"mini/enter.svg","mini-enter-sleep":"mini/enter-sleep.svg","mini-happy":"mini/happy.svg","mini-idle":"mini/idle.svg","mini-peek":"mini/peek.svg","mini-sleep":"mini/sleep.svg","react-double":"react/double.svg","react-drag":"react/drag.svg","react-left":"react/left.svg","react-right":"react/right.svg","collapse-sleep":"sleep/collapse-sleep.svg",sleeping:"sleep/sleeping.svg",wake:"sleep/wake.svg",disconnected:"status/disconnected.svg",error:"status/error.svg",notification:"status/notification.svg",happy:"happy.svg","static-base":"static-base.svg"},x_=new Map;async function loe(t){if(x_.has(t))return x_.get(t);const e=await fetch(`/clawd/${t}`);if(!e.ok)return null;const r=(await e.text()).replace(/<svg([^>]*)>/,(i,a)=>`<svg${a.replace(/\s+width="[^"]*"/g,"").replace(/\s+height="[^"]*"/g,"")} width="100%" height="100%">`);return x_.set(t,r),r}function coe({state:t="idle-living",size:e=48,className:n=""}){const[r,i]=x.useState(""),a=x.useRef(null),o=uoe()?"static-base":t,c=RP[o]||RP["static-base"];return x.useEffect(()=>{let u=!1;return loe(c).then(f=>{!u&&f&&i(f)}),()=>{u=!0}},[c]),x.useEffect(()=>{const u=a.current?.querySelector("svg");if(u)try{const f=u.getBBox();f.width>0&&f.height>0&&u.setAttribute("viewBox",`${f.x-2} ${f.y-2} ${f.width+4} ${f.height+4}`)}catch{}},[r]),m.jsx("div",{ref:a,className:`clawd-animated ${n}`,style:{width:e,height:e,display:"inline-flex",alignItems:"center",justifyContent:"center",overflow:"hidden"},dangerouslySetInnerHTML:{__html:r}})}function uoe(){const[t,e]=x.useState(()=>typeof window>"u"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches);return x.useEffect(()=>{const n=window.matchMedia("(prefers-reduced-motion: reduce)"),r=i=>e(i.matches);return n.addEventListener("change",r),()=>n.removeEventListener("change",r)},[]),t}function doe({todayTokens:t=0,isSyncing:e=!1,hasError:n=!1,isDisconnected:r=!1}={}){return x.useMemo(()=>n?"error":r?"disconnected":e?"working-typing":t===0?"sleeping":t<5e4?"idle-living":t<2e5?"idle-look":t<5e5?"working-ultrathink":t<2e6?"working-typing":"working-ultrathink",[t,e,n,r])}const PP="macAppBannerDismissed",foe="leaderboardBannerDismissed",hoe="https://github.com/mm7894215/TokenTracker/releases/latest",NP="tokentracker_native_app",kg=(()=>{try{return new URLSearchParams(window.location.search).get("app")==="1"?(localStorage.setItem(NP,"1"),!0):localStorage.getItem(NP)==="1"}catch{return!1}})();function poe({todayTokens:t=0,isSyncing:e=!1}){const{openLoginModal:n}=Ep(),{signedIn:r}=ss(),i=doe({todayTokens:t,isSyncing:e}),a=kg?foe:PP,[s,o]=x.useState(()=>{try{return localStorage.getItem(a)==="1"?!0:!kg&&new URLSearchParams(window.location.search).get("from")==="menubar"?(localStorage.setItem(PP,"1"),!0):!1}catch{return!1}}),c=x.useCallback(()=>{o(!0);try{localStorage.setItem(a,"1")}catch{}},[a]);if(s)return null;let u,f,h,p,y,v;kg&&r?(u="View the Leaderboard",f="Compare your usage globally",h="Leaderboard",p=m.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"opacity-70",children:m.jsx("path",{d:"M2 8.5V10h8V8.5M6 1.5v6m0 0L3.5 5M6 7.5l2.5-2.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round",transform:"rotate(180 6 6)"})}),y=()=>{window.location.pathname="/leaderboard"}):kg?(u="Join the Leaderboard",f="Log in to compare your usage with others",h="Log In",p=m.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"opacity-70",children:m.jsx("path",{d:"M6.5 1.5h3a1 1 0 011 1v7a1 1 0 01-1 1h-3M5 8.5L7.5 6 5 3.5M7.5 6H1.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})}),y=n):(u="Try the Menu Bar App",f="Always-on stats with Clawd companion",h="Download",p=m.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"opacity-70",children:m.jsx("path",{d:"M6 2v6m0 0L3.5 5.5M6 8l2.5-2.5M2 10h8",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})}),v=hoe);const w=v?fr.a:fr.button,b=v?{href:v,target:"_blank",rel:"noopener noreferrer"}:{onClick:y};return m.jsx(Pp,{children:m.jsx(fr.div,{initial:{opacity:0,y:-8},animate:{opacity:1,y:0},exit:{opacity:0,y:-8},transition:{duration:.3},className:"rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-4",children:m.jsxs("div",{className:"flex items-center gap-3",children:[m.jsx("div",{className:"flex-shrink-0",children:m.jsx(coe,{state:i,size:56})}),m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsx("div",{className:"text-sm font-medium text-oai-gray-900 dark:text-oai-white",children:u}),m.jsx("div",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 mt-0.5",children:f})]}),m.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[m.jsxs(w,{...b,whileHover:{scale:1.03},whileTap:{scale:.97},className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium text-white bg-oai-gray-900 dark:bg-oai-white dark:text-oai-gray-900 rounded-md hover:opacity-90 transition-opacity",children:[h,p]}),m.jsx("button",{onClick:c,className:"p-1 text-oai-gray-400 hover:text-oai-gray-600 dark:hover:text-oai-gray-300 transition-colors","aria-label":"Dismiss",children:m.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:m.jsx("path",{d:"M4 4l6 6m0-6L4 10",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})})})]})]})})})}const DP="widgetOnboardingDismissed",LP="tokentracker_native_app",moe=(()=>{try{return new URLSearchParams(window.location.search).get("app")==="1"?(localStorage.setItem(LP,"1"),!0):localStorage.getItem(LP)==="1"}catch{return!1}})();function goe(){const[t,e]=x.useState(()=>{try{return localStorage.getItem(DP)==="1"}catch{return!1}}),n=x.useCallback(()=>{e(!0);try{localStorage.setItem(DP,"1")}catch{}},[]);return moe?m.jsx(Pp,{initial:!1,children:!t&&m.jsxs(fr.div,{initial:{opacity:0,y:-8},animate:{opacity:1,y:0},exit:{opacity:0,y:-8,transition:{duration:.2,ease:[.4,0,.2,1]}},transition:{duration:.3,ease:[.16,1,.3,1]},className:"relative rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-4",children:[m.jsx("button",{type:"button",onClick:n,"aria-label":F("dashboard.widgets.dismiss_aria"),className:"absolute top-2.5 right-2.5 z-10 inline-flex items-center justify-center w-7 h-7 rounded-md text-oai-gray-400 hover:text-oai-gray-700 dark:hover:text-oai-gray-200 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-oai-gray-300 dark:focus-visible:ring-oai-gray-600 transition-colors",children:m.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",children:m.jsx("path",{d:"M4 4l6 6m0-6L4 10",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})})}),m.jsx("div",{className:"rounded-lg overflow-hidden ring-1 ring-black/5 dark:ring-white/10 shadow-sm",children:m.jsx("img",{src:"/widgets-overview.png",alt:F("dashboard.widgets.title"),width:734,height:552,className:"w-full h-auto block",loading:"lazy",decoding:"async"})}),m.jsxs("div",{className:"mt-4",children:[m.jsx("div",{className:"text-sm font-medium tracking-tight text-oai-gray-900 dark:text-oai-white",children:F("dashboard.widgets.title")}),m.jsx("div",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-400 mt-1 leading-snug",children:F("dashboard.widgets.hint")})]})]},"widget-onboarding-card")}):null}function yoe(t){const{copy:e,onOpenShare:n,screenshotMode:r,showExpiredGate:i,showAuthGate:a,screenshotTitleLine1:s,screenshotTitleLine2:o,identityDisplayName:c,identityStartDate:u,activeDays:f,identitySubscriptions:h,identityScrambleDurationMs:p,projectUsageEntries:y,projectUsageLimit:v,setProjectUsageLimit:w,topModels:b,signedIn:_,publicMode:E,isLocalMode:M,shouldShowInstall:T,installPrompt:R,handleCopyInstall:A,installCopied:P,installInitCmdDisplay:k,trendRowsForDisplay:N,trendFromForDisplay:j,trendToForDisplay:L,period:z,trendTimeZoneLabel:U,activityHeatmapBlock:V,isCapturing:W,handleShareToX:K,screenshotTwitterButton:Q,screenshotTwitterHint:O,periodsForDisplay:G,setSelectedPeriod:Y,customFrom:H,customTo:te,onCustomRangeApply:re,customRangeOpen:ue,onCustomRangeOpenChange:ce,summaryLabel:ee,summaryValue:le,summaryTotalTokensRaw:ve,summaryCostValue:Pe,summaryConversationsValue:be,rollingUsage:Ye,costInfoEnabled:he,openCostModal:Ue,costModalOpen:je,closeCostModal:et,allowBreakdownToggle:_e,refreshAll:oe,usageLoadingState:J,fleetData:ze,hasDetailsActual:Ne,dailyEmptyPrefix:De,installSyncCmd:Le,dailyEmptySuffix:$,detailsColumns:I,ariaSortFor:Z,toggleSort:pe,sortIconFor:Se,pagedDetails:xe,dailyBreakdownRows:Ie,dailyBreakdownColumns:He,dailyBreakdownAriaSortFor:qe,dailyBreakdownSortIconFor:ft,dailyBreakdownDateKey:We,detailsDateKey:Xe,renderDetailDate:nt,renderDailyBreakdownDate:ct,renderDetailCell:Ke,DETAILS_PAGED_PERIODS:gt,detailsPageCount:ne,detailsPage:Be,setDetailsPage:ke}=t;return m.jsxs(m.Fragment,{children:[m.jsx($ne,{bare:!r,hideHeader:r,header:null,footer:r?null:null,className:r?"screenshot-mode":"",children:i||a?null:m.jsx(m.Fragment,{children:m.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-4",children:[m.jsxs("div",{className:"lg:col-span-4 flex flex-col gap-4 min-w-0 order-2 lg:order-1",children:[r?m.jsx("div",{className:"flex items-start justify-between gap-4",children:m.jsxs("div",{className:"flex flex-col gap-1",children:[m.jsx("span",{className:"text-3xl md:text-4xl font-semibold text-oai-black dark:text-oai-white tracking-tight leading-none",children:s}),m.jsx("span",{className:"text-2xl md:text-3xl font-semibold text-oai-black dark:text-oai-white tracking-tight leading-none",children:o})]})}):null,M?m.jsx(poe,{todayTokens:ve,isSyncing:J}):null,m.jsx(Ire,{title:e("dashboard.identity.title"),subtitle:e("dashboard.identity.subtitle"),period:z,rankLabel:u??e("identity_card.rank_placeholder"),streakDays:f,subscriptions:h,periodConversations:be,rolling:Ye,topModels:b}),M?m.jsx(goe,{}):null,T?m.jsx(Rl,{delay:.25,children:m.jsxs("div",{className:"rounded-xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 p-3",children:[m.jsx("div",{className:"text-xs text-oai-gray-500 dark:text-oai-gray-300 mb-1.5",children:R}),m.jsxs(fr.button,{onClick:A,whileHover:{scale:1.01},whileTap:{scale:.99},className:"w-full flex items-center justify-between px-3 py-2 bg-oai-gray-50 dark:bg-oai-gray-800 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-700 rounded-lg transition-colors",children:[m.jsx("code",{className:"text-xs font-mono text-oai-gray-700 dark:text-oai-gray-300",children:k}),m.jsx(fr.span,{initial:{opacity:0,y:-5},animate:{opacity:1,y:0},className:"text-xs text-oai-brand",children:P?"Copied ✓":"Copy"},P?"copied":"copy")]})]})}):null,V&&m.jsx(Rl,{delay:.4,children:V}),r?null:m.jsx(ooe,{rows:N,from:j,to:L,period:z,timeZoneLabel:U,showTimeZoneLabel:!1}),r?m.jsxs("div",{className:"mt-4 flex flex-col items-center gap-2","data-screenshot-exclude":"true",style:W?{display:"none"}:void 0,children:[m.jsx(Ui,{type:"button",onClick:K,variant:"primary",size:"lg",disabled:W,children:Q}),m.jsx("span",{className:"text-sm text-oai-gray-500 dark:text-oai-gray-300",children:O})]}):null]}),m.jsxs("div",{className:"lg:col-span-8 flex flex-col gap-4 min-w-0 order-1 lg:order-2",children:[m.jsx(ioe,{period:z,periods:G,onPeriodChange:Y,summaryLabel:ee,summaryValue:le,summaryCostValue:Pe,onCostInfo:he?Ue:null,fleetData:ze,onRefresh:r?null:oe,loading:J,onOpenShare:r?null:n,customFrom:H,customTo:te,onCustomRangeApply:re,customRangeOpen:ue,onCustomRangeOpenChange:ce}),r?null:m.jsx(Rl,{delay:.5,children:m.jsx(Pre,{projectEntries:y,projectLimit:v,onProjectLimitChange:w,copy:e,hasDetailsActual:Ne,dailyEmptyPrefix:De,installSyncCmd:Le,dailyEmptySuffix:$,detailsColumns:I,ariaSortFor:Z,toggleSort:pe,sortIconFor:Se,pagedDetails:xe,dailyBreakdownRows:Ie,dailyBreakdownColumns:He,dailyBreakdownAriaSortFor:qe,dailyBreakdownSortIconFor:ft,dailyBreakdownDateKey:We,detailsDateKey:Xe,renderDetailDate:nt,renderDailyBreakdownDate:ct,renderDetailCell:Ke,DETAILS_PAGED_PERIODS:gt,period:z,detailsPageCount:ne,detailsPage:Be,setDetailsPage:ke})})]})]})})}),m.jsx(Rre,{isOpen:je,onClose:et,fleetData:ze})]})}function k5(){return typeof window>"u"?!1:!!window?.webkit?.messageHandlers?.nativeBridge}const Nc=new Map,Dc=new Map;function E5(){typeof window>"u"||window.__tokentrackerNativeSaveListener||(window.__tokentrackerNativeSaveListener=!0,window.addEventListener("native:saveImageResult",t=>{const e=t?.detail||{},n=typeof e.requestId=="string"?e.requestId:null;if(!n||!Nc.has(n))return;const r=Nc.get(n);Nc.delete(n),r({ok:!!e.ok,path:typeof e.path=="string"?e.path:void 0,error:typeof e.error=="string"?e.error:void 0})}),window.addEventListener("native:copyImageResult",t=>{const e=t?.detail||{},n=typeof e.requestId=="string"?e.requestId:null;if(!n||!Dc.has(n))return;const r=Dc.get(n);Dc.delete(n),r({ok:!!e.ok,error:typeof e.error=="string"?e.error:void 0})}))}async function voe(t){if(!k5()||typeof window>"u")return{ok:!1,error:"native bridge unavailable"};const e=window?.webkit?.messageHandlers?.nativeBridge;if(!e)return{ok:!1,error:"native bridge unavailable"};E5();const n=`copy_${Date.now()}_${Math.random().toString(36).slice(2,8)}`;return new Promise(r=>{const i=window.setTimeout(()=>{Dc.has(n)&&(Dc.delete(n),r({ok:!1,error:"timeout"}))},8e3);Dc.set(n,a=>{window.clearTimeout(i),r(a)});try{e.postMessage({type:"action",name:"copyImageToClipboard",requestId:n,dataUrl:t})}catch(a){Dc.delete(n),window.clearTimeout(i),r({ok:!1,error:a?.message||String(a)})}})}async function IP(t,e){if(!k5()||typeof window>"u")return{ok:!1,error:"native bridge unavailable"};const n=window?.webkit?.messageHandlers?.nativeBridge;if(!n)return{ok:!1,error:"native bridge unavailable"};E5();const r=`save_${Date.now()}_${Math.random().toString(36).slice(2,8)}`;return new Promise(i=>{const a=window.setTimeout(()=>{Nc.has(r)&&(Nc.delete(r),i({ok:!1,error:"timeout"}))},8e3);Nc.set(r,s=>{window.clearTimeout(a),i(s)});try{n.postMessage({type:"action",name:"saveImageToDownloads",requestId:r,filename:e,dataUrl:t})}catch(s){Nc.delete(r),window.clearTimeout(a),i({ok:!1,error:s?.message||String(s)})}})}const M5=1200,T5=1630,C5={broadsheet:{width:1200,height:1630},"annual-report":{width:1080,height:1865}},xoe="https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Inter+Tight:wght@400;500;600;700&family=IBM+Plex+Serif:ital,wght@0,400;0,500;0,600;1,400&family=IBM+Plex+Mono:wght@400;500&family=Space+Grotesk:wght@500;600;700&display=swap";let b_=!1;function boe(){if(typeof document>"u"||b_)return;if(document.querySelector('link[data-share-card-fonts="true"]')){b_=!0;return}const e=document.createElement("link");e.rel="stylesheet",e.href=xoe,e.dataset.shareCardFonts="true",e.crossOrigin="anonymous",document.head.appendChild(e),b_=!0}async function _oe(){if(typeof document>"u")return;const t=document.fonts;if(!(!t||typeof t.ready?.then!="function"))try{await t.ready}catch{}}async function woe(t,e={}){if(typeof window>"u"||!t)return null;boe(),await _oe(),await new Promise(c=>requestAnimationFrame(()=>c(null)));const{toBlob:n,toPng:r}=await $O(async()=>{const{toBlob:c,toPng:u}=await import("./index-BeoRn2gJ.js");return{toBlob:c,toPng:u}},[]),i=e.pixelRatio??2,a=t.offsetWidth||M5,s=t.offsetHeight||T5,o={pixelRatio:i,cacheBust:!0,width:a,height:s,style:{width:`${a}px`,height:`${s}px`},skipFonts:!1,filter:c=>!(c instanceof HTMLElement)||c.dataset?.screenshotExclude!=="true"};try{const c=await n(t,o);if(c)return c}catch{}try{const c=await r(t,o);return c?await(await fetch(c)).blob():null}catch{return null}}async function __(t){return new Promise(e=>{const n=new FileReader;n.onload=()=>{const r=typeof n.result=="string"?n.result:null;e(r)},n.onerror=()=>e(null),n.readAsDataURL(t)})}function OP(t,e){if(typeof window>"u"||!t)return!1;try{const n=URL.createObjectURL(t),r=document.createElement("a");return r.href=n,r.download=e,document.body.appendChild(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(n),1e3),!0}catch{return!1}}function P1(t){const e=ti(t);return Number.isFinite(e)?e:0}function Soe(t){return t?P1(t.billable_total_tokens??t.total_tokens):0}function koe(t){const e=Array.isArray(t?.weeks)?t.weeks:[];if(!e.length)return{weeks:[],totalDays:0,activeDays:0};let n=0,r=0;return{weeks:e.map(a=>(Array.isArray(a)?a:[]).slice(0,7).map(o=>{const c=!!o?.future,u=Number.isFinite(o?.level)?Math.max(0,Math.min(4,Math.round(o.level))):0;o?.day&&!c&&(n+=1,u>0&&(r+=1));const f=o?.billable_total_tokens??o?.total_tokens??o?.value??0,h=Number.isFinite(f)?Math.max(0,f):0;return{day:typeof o?.day=="string"?o.day:"",level:u,value:h,future:c}})),totalDays:n,activeDays:r}}function Eoe(t){const{handle:e,startDate:n,activeDays:r,summary:i,topModels:a,rank:s,period:o,periodFrom:c,periodTo:u,heatmap:f,capturedAt:h}=t,p=Soe(i),y=P1(i?.total_cost_usd),v=Array.isArray(a)?a.slice(0,3).map(b=>({id:b?.id??null,name:typeof b?.name=="string"&&b.name?b.name:"—",tokens:P1(b?.tokens),percent:typeof b?.percent=="string"&&b.percent?b.percent:"0.0"})):[],w=koe(f);return{handle:e||"—",startDate:n||null,activeDays:Number.isFinite(r)&&r>0?Math.floor(r):0,totalTokens:p,totalCost:y,period:o,periodFrom:c,periodTo:u,topModels:v,rank:typeof s=="number"&&Number.isFinite(s)&&s>0?Math.floor(s):null,heatmapWeeks:w.weeks,heatmapTotalDays:w.totalDays,heatmapActiveDays:w.activeDays,capturedAt:h||new Date().toISOString()}}const Moe=["share.month_short.jan","share.month_short.feb","share.month_short.mar","share.month_short.apr","share.month_short.may","share.month_short.jun","share.month_short.jul","share.month_short.aug","share.month_short.sep","share.month_short.oct","share.month_short.nov","share.month_short.dec"];function Toe(t){const e=Moe[t];return e?F(e):"—"}function A5(t,e){return F("share.date.month_year",{month:Toe(t),year:e})}function Coe(t){if(!t)return"—";const e=t.split("-");if(e.length!==3)return t;const[n,r]=e,i=Number(r)-1;return i<0||i>11?t:A5(i,n)}function Aoe(t){if(t.period==="total")return F("share.issue.all_time");if(t.period==="day"&&t.periodTo)return t.periodTo.replace(/-/g,".");if(t.period==="custom"&&t.periodFrom&&t.periodTo)return`${t.periodFrom.replace(/-/g,".")} — ${t.periodTo.replace(/-/g,".")}`;if(t.periodTo){const e=new Date(`${t.periodTo}T00:00:00Z`);if(!Number.isNaN(e.getTime()))return A5(e.getUTCMonth(),e.getUTCFullYear())}return F(`usage.period.${t.period}`)}function N1(t){return Number.isFinite(t)?Math.round(t).toLocaleString("en-US"):"—"}function R5(t){return!Number.isFinite(t)||t<=0?"$0.00":t>=1e3?`$${Math.round(t).toLocaleString("en-US")}`:`$${t.toFixed(2)}`}function Roe(t){const e=t.topModels[0];if(e){const n=parseFloat(e.percent);return Number.isFinite(n)&&n>=60?F("share.hook.top_loyal",{percent:Math.round(n),name:e.name}):t.activeDays>=60?F("share.hook.days_record",{days:t.activeDays}):Number.isFinite(n)&&n>=30?F("share.hook.top_led",{name:e.name,percent:Math.round(n)}):t.topModels.length>1?F("share.hook.multi_models",{count:t.topModels.length,days:t.activeDays}):F("share.hook.days_with_model",{days:t.activeDays,name:e.name})}return t.activeDays>0?F("share.hook.days_record",{days:t.activeDays}):F("share.hook.new_chapter")}function Poe(t,e){const n=(t||"").length;if(n<=e.baseChars)return e.baseSize;const r=e.baseSize-(n-e.baseChars)*e.shrinkPerChar;return Math.max(e.minSize,r)}function Noe(t){if(!t||t.future)return null;const e=typeof t.level=="number"?t.level:0;return e<0?0:e>4?4:Math.round(e)}function Doe({weeks:t,palette:e,width:n,gap:r=3,radius:i=2,emptyColor:a}){if(!Array.isArray(t)||t.length===0||!n||n<=0)return null;const s=e||["#eee","#ccc","#999","#666","#333"],o=a||s[0],c=t.length,u=(c-1)*r,f=Math.max(4,(n-u)/c),h=7*f+6*r;return m.jsx("svg",{width:n,height:h,viewBox:`0 0 ${n} ${h}`,xmlns:"http://www.w3.org/2000/svg","aria-hidden":!0,style:{display:"block"},children:t.map((p,y)=>(Array.isArray(p)?p:[]).map((w,b)=>{if(b>=7)return null;const _=Noe(w),E=y*(f+r),M=b*(f+r),T=_===null?o:s[_];return m.jsx("rect",{x:E,y:M,width:f,height:f,rx:i,ry:i,fill:T},`${y}-${b}`)}))})}const Loe="oklch(0.97 0.01 85)",Ji="oklch(0.18 0.02 85)",al="oklch(0.38 0.015 85)",FP="oklch(0.55 0.012 85)",hc="oklch(0.55 0.22 25)",pc='"Instrument Serif", "Times New Roman", Georgia, serif',Ioe='"Inter Tight", "Helvetica Neue", Arial, sans-serif',Ooe=["oklch(0.93 0.013 80)","oklch(0.87 0.04 55)","oklch(0.78 0.09 45)","oklch(0.67 0.16 35)","oklch(0.55 0.22 25)"];function P5({data:t}){const e=Aoe(t),n=N1(t.totalTokens),r=R5(t.totalCost),i=Coe(t.startDate),a=Poe(n,{baseSize:188,baseChars:9,shrinkPerChar:14,minSize:104}),s=Roe(t),o=Array.isArray(t.heatmapWeeks)&&t.heatmapWeeks.length>0;return m.jsxs("div",{style:{width:"100%",height:"100%",background:Loe,color:Ji,fontFamily:Ioe,padding:"80px 88px 68px 88px",boxSizing:"border-box",display:"flex",flexDirection:"column",position:"relative"},children:[m.jsxs("header",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:24,paddingBottom:14,borderBottom:`1px solid ${FP}`},children:[m.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14,fontSize:14,fontWeight:500,letterSpacing:"0.22em",textTransform:"uppercase",color:Ji},children:[m.jsx("div",{style:{width:10,height:10,borderRadius:"50%",background:hc}}),"The Token Tracker"]}),m.jsxs("div",{style:{fontSize:12,letterSpacing:"0.22em",textTransform:"uppercase",color:al,textAlign:"right"},children:[F("share.card.broadsheet.issue")," № ",e]})]}),m.jsxs("div",{style:{marginTop:24,display:"flex",justifyContent:"space-between",alignItems:"flex-end",gap:24},children:[m.jsxs("div",{children:[m.jsx("div",{style:{fontSize:12,letterSpacing:"0.2em",textTransform:"uppercase",color:al,marginBottom:6},children:F("share.card.broadsheet.by")}),m.jsx("div",{style:{fontFamily:pc,fontSize:52,fontStyle:"italic",lineHeight:1,color:Ji,letterSpacing:"-0.01em"},children:t.handle})]}),m.jsxs("div",{style:{fontSize:12,letterSpacing:"0.18em",textTransform:"uppercase",color:al,textAlign:"right",lineHeight:1.6},children:[F("share.card.broadsheet.tracked_since"),m.jsx("br",{}),m.jsx("span",{style:{color:Ji},children:i})]})]}),m.jsxs("div",{style:{marginTop:40,display:"flex",flexDirection:"column"},children:[m.jsx("div",{style:{fontSize:13,letterSpacing:"0.3em",textTransform:"uppercase",color:hc,marginBottom:10},children:F("share.card.broadsheet.total_tokens")}),m.jsx("div",{style:{fontFamily:pc,fontSize:a,fontWeight:400,lineHeight:.86,letterSpacing:"-0.032em",color:Ji,fontFeatureSettings:'"lnum" 1, "tnum" 1',whiteSpace:"nowrap",overflow:"hidden"},children:n}),m.jsxs("div",{style:{marginTop:14,fontFamily:pc,fontStyle:"italic",fontSize:34,lineHeight:1.15,color:Ji,letterSpacing:"-0.005em",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:["“",s,"”"]}),m.jsx("div",{style:{marginTop:14,height:1,background:hc,width:"100%"}}),m.jsxs("div",{style:{marginTop:10,display:"flex",justifyContent:"space-between",fontSize:13,letterSpacing:"0.16em",textTransform:"uppercase",color:al},children:[m.jsxs("span",{children:[F("share.card.broadsheet.estimated_spend")," · ",r]}),m.jsx("span",{children:F("share.card.broadsheet.billable_days",{days:t.activeDays})})]})]}),o?m.jsxs("section",{style:{marginTop:40},children:[m.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",marginBottom:12},children:[m.jsx("div",{style:{fontSize:12,letterSpacing:"0.3em",textTransform:"uppercase",color:Ji,fontWeight:600},children:F("share.card.broadsheet.heatmap_title")}),m.jsx("div",{style:{fontSize:11,letterSpacing:"0.18em",textTransform:"uppercase",color:al},children:F("share.card.broadsheet.heatmap_days_on_record",{active:t.heatmapActiveDays,total:t.heatmapTotalDays})})]}),m.jsx(Doe,{weeks:t.heatmapWeeks,palette:Ooe,width:1024,gap:3,radius:2})]}):null,m.jsxs("section",{style:{marginTop:30,flex:1},children:[m.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",borderBottom:`1px solid ${Ji}`,paddingBottom:10,marginBottom:6},children:[m.jsx("div",{style:{fontSize:12,letterSpacing:"0.3em",textTransform:"uppercase",color:Ji,fontWeight:600},children:F("share.card.broadsheet.roster_title")}),m.jsx("div",{style:{fontSize:11,letterSpacing:"0.18em",textTransform:"uppercase",color:al},children:F("share.card.broadsheet.roster_subtitle")})]}),t.topModels.length===0?m.jsx("div",{style:{fontFamily:pc,fontStyle:"italic",fontSize:26,color:al,paddingTop:14},children:F("share.card.broadsheet.empty")}):t.topModels.map((c,u)=>m.jsxs("div",{style:{display:"grid",gridTemplateColumns:"52px 1fr auto 68px",alignItems:"baseline",gap:16,padding:"13px 0",borderBottom:`1px solid ${FP}`},children:[m.jsx("div",{style:{fontFamily:pc,fontSize:34,fontStyle:"italic",color:hc,lineHeight:1},children:String(u+1).padStart(2,"0")}),m.jsx("div",{style:{fontFamily:pc,fontSize:32,color:Ji,lineHeight:1.1,letterSpacing:"-0.01em",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:c.name}),m.jsx("div",{style:{fontFamily:pc,fontSize:28,color:Ji,fontFeatureSettings:'"lnum" 1, "tnum" 1',whiteSpace:"nowrap"},children:N1(c.tokens)}),m.jsxs("div",{style:{fontSize:13,letterSpacing:"0.1em",color:al,textAlign:"right",fontFeatureSettings:'"tnum" 1'},children:[c.percent,"%"]})]},c.id||c.name))]}),m.jsxs("footer",{style:{marginTop:18,paddingTop:12,borderTop:`1px solid ${Ji}`,display:"flex",justifyContent:"space-between",alignItems:"center",fontSize:12,letterSpacing:"0.22em",textTransform:"uppercase",color:Ji},children:[m.jsxs("div",{style:{display:"flex",gap:28},children:[m.jsxs("span",{children:[F("share.card.broadsheet.global_rank")," ",m.jsxs("span",{style:{color:hc},children:["№ ",t.rank!=null?t.rank:"—"]})]}),m.jsxs("span",{children:[F("share.card.broadsheet.active_days")," ",m.jsx("span",{style:{color:hc},children:F("share.card.broadsheet.days_count",{days:t.activeDays})})]})]}),m.jsxs("div",{children:[F("share.card.broadsheet.track_yours")," ",m.jsx("span",{style:{color:hc},children:"→ tokentracker.cc"})]})]})]})}const Foe=C5["annual-report"].width,Uoe="#0a0820",sl="#ffffffee",Sc="rgba(255,255,255,0.45)",w_="#a78bfa",joe={background:"rgba(20,15,50,0.38)",backdropFilter:"blur(40px)",WebkitBackdropFilter:"blur(40px)",border:"1px solid rgba(255,255,255,0.05)",boxShadow:["0 39px 56px -36px rgba(255,255,255,0.10) inset","0 7px 11px -4px rgba(255,255,255,0.06) inset","0 -82px 68px -64px rgba(101,67,149,0.08) inset","0 98px 100px -48px rgba(208,171,255,0.06) inset","0 4px 18px 0 rgba(156,146,215,0.06) inset","0 1px 40px 0 rgba(228,222,255,0.04) inset"].join(", ")},Eg={background:"rgba(20,15,50,0.38)",backdropFilter:"blur(32px)",WebkitBackdropFilter:"blur(32px)",border:"1px solid rgba(255,255,255,0.06)",boxShadow:"0 1px 8px 0 rgba(228,222,255,0.06) inset"},D1='"Space Grotesk", "Inter Tight", sans-serif',S_='"Inter Tight", sans-serif',Boe="rgba(255,255,255,0.06)",N5=[Boe,"#4a3d8f","#6b5cbe","#9060e0","#d946ef"],D5=48,L5=28,my=4,I5=20,zoe=Foe-D5*2-L5*2,Voe=(zoe-I5*2)/3,L1=Math.min(Math.floor((Voe-my*6)/7),40),Hoe=L1*7+my*6;function Woe(t){if(!Array.isArray(t))return t;const e=[];for(const o of t)if(Array.isArray(o))for(const c of o)c?.day&&!c.future&&c.value>0&&e.push(c.value);if(!e.length)return t;e.sort((o,c)=>o-c);const n=o=>{const c=e.length,u=(c-1)*o,f=Math.floor(u);return Math.round((e[f]??0)+((e[Math.min(c-1,f+1)]??0)-(e[f]??0))*(u-f))},r=n(.5),i=n(.75),a=n(.9),s=o=>!o||o<=0?0:o<=r?1:o<=i?2:o<=a?3:4;return t.map(o=>Array.isArray(o)?o.map(c=>c?.day&&!c.future&&typeof c.value=="number"?{...c,level:s(c.value)}:c):o)}function Goe(t){if(!Array.isArray(t))return[];const e={},n=Woe(t);for(const r of n)if(Array.isArray(r))for(const i of r){if(!i?.day||i.future)continue;const a=i.day.split("-");if(a.length<2)continue;const s=`${a[0]}-${a[1]}`;(e[s]??=[]).push(i)}return Object.entries(e).sort(([r],[i])=>r.localeCompare(i)).slice(-12).map(([r,i])=>({month:parseInt(r.split("-")[1],10),cells:i}))}function $oe(t){if(!t.length)return[];const e=[...t].sort((s,o)=>s.day.localeCompare(o.day));let n=new Date(`${e[0].day}T00:00:00Z`).getUTCDay();const r=Array(n).fill(null).concat(e),i=[];for(let s=0;s<r.length;s+=7)i.push(r.slice(s,s+7));const a=i[i.length-1];for(;a&&a.length<7;)a.push(null);return i.slice(0,6)}const Yoe=["","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function qoe(t){if(!Array.isArray(t))return 0;const e=[];for(const i of t)if(Array.isArray(i))for(const a of i)a?.day&&!a.future&&e.push(a);e.sort((i,a)=>i.day.localeCompare(a.day));let n=0,r=0;for(const i of e)(i.level||0)>0?(r++,r>n&&(n=r)):r=0;return n}function UP(t){const[e,n]=x.useState(null);return x.useEffect(()=>{if(!t){n(null);return}let r=!1;const i=new Image;return i.crossOrigin="anonymous",i.onload=()=>{if(!r)try{const a=document.createElement("canvas");a.width=i.naturalWidth,a.height=i.naturalHeight,a.getContext("2d").drawImage(i,0,0),n(a.toDataURL("image/png"))}catch{n(null)}},i.onerror=()=>{r||n(null)},i.src=t,()=>{r=!0}},[t]),e}function Xoe({data:t}){const e=$oe(t.cells);return m.jsxs("div",{children:[m.jsx("div",{style:{fontSize:16,fontWeight:600,color:Sc,fontFamily:D1,marginBottom:4},children:Yoe[t.month]}),m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:my},children:e.map((n,r)=>m.jsx("div",{style:{display:"flex",gap:my},children:n.map((i,a)=>{const s=i?Math.min(4,Math.max(0,i.level||0)):-1;return m.jsx("div",{style:{width:L1,height:L1,borderRadius:4,background:s<0?"transparent":N5[s]}},a)})},r))})]})}function Koe({data:t}){const e=Goe(t.heatmapWeeks),n=qoe(t.heatmapWeeks),r=t.topModels[0],i=t.avatarUrl||null,a=UP(i),s=UP("/neon_bg.png"),o=(t.handle||"?")[0].toUpperCase(),c=16;return m.jsxs("div",{style:{width:"100%",height:"100%",background:Uoe,fontFamily:D1,position:"relative",overflow:"hidden",boxSizing:"border-box"},children:[m.jsx("img",{src:s||"/neon_bg.png",alt:"",style:{position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"cover",pointerEvents:"none"}}),m.jsxs("div",{style:{position:"relative",zIndex:1,display:"flex",flexDirection:"column",height:"100%",padding:D5,boxSizing:"border-box"},children:[m.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:c*3},children:[m.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[m.jsx("img",{src:"/app-icon.png",alt:"",width:64,height:64,style:{width:64,height:64,borderRadius:16,display:"block"}}),m.jsxs("div",{children:[m.jsx("div",{style:{fontSize:20,fontWeight:500,color:Sc,lineHeight:1.2},children:"Token Tracker"}),m.jsx("div",{style:{fontSize:36,fontWeight:700,lineHeight:1.15,color:sl},children:F("share.card.annual.report_title")})]})]}),m.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[m.jsx("div",{style:{width:48,height:48,borderRadius:"50%",background:"linear-gradient(135deg,#4c1d95,#7c3aed)",display:"flex",alignItems:"center",justifyContent:"center",border:"2px solid rgba(255,255,255,0.15)",overflow:"hidden",flexShrink:0},children:a?m.jsx("img",{src:a,alt:"",width:48,height:48,style:{width:48,height:48,objectFit:"cover",display:"block"},crossOrigin:"anonymous",referrerPolicy:"no-referrer"}):m.jsx("span",{style:{fontSize:20,fontWeight:700,color:sl},children:o})}),m.jsx("div",{style:{fontSize:32,fontWeight:700,color:sl},children:t.handle})]})]}),m.jsxs("div",{style:{...joe,borderRadius:22,padding:L5,marginBottom:c},children:[m.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:12},children:[m.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:14,color:Sc},children:[m.jsx("span",{children:F("share.card.annual.less")}),N5.map((u,f)=>m.jsx("div",{style:{width:16,height:16,borderRadius:3,background:u}},f)),m.jsx("span",{children:F("share.card.annual.more")})]}),m.jsx("div",{style:{fontSize:16,fontWeight:700,letterSpacing:"0.14em",color:"rgba(255,255,255,0.22)",textTransform:"uppercase"},children:F("share.card.annual.heatmap_title")})]}),m.jsx("div",{style:{display:"grid",gridTemplateColumns:`repeat(3,${Hoe}px)`,gap:`8px ${I5}px`,justifyContent:"center"},children:e.map(u=>m.jsx(Xoe,{data:u},u.month))})]}),m.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:c,marginBottom:c},children:[m.jsxs("div",{style:{...Eg,borderRadius:22,padding:"28px 16px",textAlign:"center"},children:[m.jsx("div",{style:{fontFamily:S_,fontSize:52,fontWeight:700,color:sl,letterSpacing:"-0.02em",lineHeight:1},children:N1(t.totalTokens)}),m.jsx("div",{style:{fontSize:22,color:Sc,marginTop:12},children:F("share.card.annual.total_tokens")})]}),m.jsxs("div",{style:{...Eg,borderRadius:22,padding:"28px 16px",textAlign:"center"},children:[m.jsx("div",{style:{fontFamily:S_,fontSize:52,fontWeight:700,color:sl,letterSpacing:"-0.02em",lineHeight:1},children:R5(t.totalCost)}),m.jsx("div",{style:{fontSize:22,color:Sc,marginTop:12},children:F("share.card.annual.estimated_cost")})]})]}),m.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:c},children:[m.jsxs("div",{style:{...Eg,borderRadius:22,padding:"18px 24px",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[m.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[m.jsxs("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:w_,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[m.jsx("path",{d:"M12 2v4m0 12v4M4.93 4.93l2.83 2.83m8.48 8.48 2.83 2.83M2 12h4m12 0h4M4.93 19.07l2.83-2.83m8.48-8.48 2.83-2.83"}),m.jsx("circle",{cx:"12",cy:"12",r:"4"})]}),m.jsx("span",{style:{fontSize:20,color:Sc},children:F("share.card.annual.longest_streak")})]}),m.jsx("span",{style:{fontFamily:S_,fontSize:28,fontWeight:700,color:sl},children:F("share.card.annual.days_count",{days:n})})]}),m.jsxs("div",{style:{...Eg,borderRadius:22,padding:"18px 24px",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[m.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[m.jsxs("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:w_,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[m.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"}),m.jsx("circle",{cx:"12",cy:"12",r:"4"})]}),m.jsx("span",{style:{fontSize:20,color:Sc},children:F("share.card.annual.top_model")})]}),m.jsx("span",{style:{fontFamily:D1,fontSize:28,fontWeight:700,color:sl},children:r?r.name:"—"})]})]}),m.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:"auto"},children:[m.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[m.jsx("img",{src:"/app-icon.png",alt:"",width:44,height:44,style:{width:44,height:44,borderRadius:8,display:"block"}}),m.jsx("span",{style:{fontSize:22,fontWeight:600,color:sl},children:"Token Tracker"})]}),m.jsx("span",{style:{fontSize:22,fontWeight:600,color:w_},children:"tokentracker.cc"})]})]})]})}const O5=[{id:"annual-report",labelKey:"share.variant.neon"},{id:"broadsheet",labelKey:"share.variant.broadsheet"}],Zoe={broadsheet:P5,"annual-report":Koe};function F5(t){return C5[t]||{width:M5,height:T5}}function Joe(t){const e=O5.find(n=>n.id===t);return e?.labelKey?F(e.labelKey):t}const jP=x.forwardRef(function({data:e,variant:n},r){const i=Zoe[n]||P5,{width:a,height:s}=F5(n);return m.jsx("div",{ref:r,"data-share-card":"true",style:{width:a,height:s,position:"relative",overflow:"hidden",boxSizing:"border-box"},children:m.jsx(i,{data:e})})});function Mg(){return typeof window>"u"?!1:!!window?.webkit?.messageHandlers?.nativeBridge}const Qoe=440;function ele(){const[t,e]=x.useState(null),n=x.useRef(null),r=x.useCallback((i,a="info")=>{n.current&&window.clearTimeout(n.current),e({id:Date.now(),kind:a,text:i}),n.current=window.setTimeout(()=>e(null),2800)},[]);return x.useEffect(()=>()=>{n.current&&window.clearTimeout(n.current)},[]),{toast:t,push:r}}function k_({onClick:t,disabled:e,children:n,emphasis:r,ariaLabel:i}){return m.jsx("button",{type:"button",onClick:t,disabled:e,"aria-label":i,className:["group relative flex items-center justify-between gap-3 w-full px-4 py-3 text-left","rounded-lg border transition-colors",r?"border-oai-black dark:border-oai-white bg-oai-black dark:bg-oai-white text-oai-white dark:text-oai-black hover:opacity-90":"border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 text-oai-black dark:text-oai-white hover:border-oai-gray-400 dark:hover:border-oai-gray-600",e?"opacity-60 cursor-not-allowed":"cursor-pointer"].join(" "),children:n})}function tle({open:t,onClose:e,data:n,twitterText:r}){const[i,a]=x.useState(null),[s,o]=x.useState(""),[c,u]=x.useState("annual-report"),f=x.useRef(null),{toast:h,push:p}=ele(),y=ss(),v=x.useMemo(()=>{const k=y?.user;if(!k||typeof k!="object")return null;const N=k.user_metadata||{},j=k.profile||{},L=N.avatar_url||N.picture||j.avatar_url||k.avatar_url;return typeof L=="string"&&L.trim()?L.trim():null},[y?.user]);x.useEffect(()=>{t&&(a(null),o(n?.handle||""))},[t,n?.handle]);const w=n&&{...n,handle:s||n.handle,avatarUrl:v},{width:b,height:_}=F5(c),E=Qoe/b;x.useEffect(()=>{if(!t)return;const k=N=>{N.key==="Escape"&&e?.()};return window.addEventListener("keydown",k),()=>window.removeEventListener("keydown",k)},[t,e]);const M=x.useCallback(async()=>{const k=f.current;if(!k)return null;try{return await woe(k)}catch(N){return console.warn("[share] capture failed",N),null}},[]),T=x.useCallback(async()=>{if(i)return;a("copy");const k=await M();if(!k){p(F("share.toast.failed"),"error"),a(null);return}let N=!1;if(Mg()){const j=await __(k);j&&(N=(await voe(j)).ok)}else N=await Uw(k);p(F(N?"share.toast.copied":"share.toast.failed"),N?"success":"error"),a(null)},[i,M,p]),R=x.useCallback(()=>`tokentracker-share-${Date.now()}.png`,[]),A=x.useCallback(async()=>{if(i)return;a("download");const k=await M();if(!k){p(F("share.toast.failed"),"error"),a(null);return}if(Mg()){const j=await __(k);if(j&&(await IP(j,R())).ok){p(F("share.toast.downloaded"),"success"),a(null);return}}const N=OP(k,R());p(F(N?"share.toast.downloaded":"share.toast.failed"),N?"success":"error"),a(null)},[i,M,R,p]),P=x.useCallback(async()=>{if(i)return;a("x");const k=await M();if(!k){p(F("share.toast.failed"),"error"),a(null);return}if(Mg()){const j=await __(k);j&&(await IP(j,R()),p(F("share.toast.downloaded"),"success"))}else await Uw(k)?p(F("share.toast.copied"),"success"):OP(k,R());const N=new URL("https://twitter.com/intent/tweet");if(r&&N.searchParams.set("text",r),Mg())try{window.webkit?.messageHandlers?.nativeBridge?.postMessage({type:"action",name:"openURL",value:N.toString()})}catch{window.open(N.toString(),"_blank","noopener,noreferrer")}else window.open(N.toString(),"_blank","noopener,noreferrer");a(null)},[i,M,p,r,R]);return t?m.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":F("share.modal.title"),"data-screenshot-exclude":"true",className:"fixed inset-0 z-[9999] flex items-center justify-center p-4 sm:p-6",style:{background:"rgba(10,10,10,0.72)"},onClick:k=>{k.target===k.currentTarget&&e?.()},children:[m.jsx("div",{"aria-hidden":!0,style:{position:"fixed",left:0,top:0,width:b,height:_,pointerEvents:"none",opacity:0,zIndex:-1,clip:"rect(0,0,0,0)",overflow:"hidden"},children:m.jsx(jP,{ref:f,data:w,variant:c})}),m.jsxs(fr.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},exit:{opacity:0,y:12},transition:{duration:.18,ease:[.2,.8,.2,1]},className:"relative w-full max-w-[1040px] max-h-[92vh] overflow-hidden rounded-2xl border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-black shadow-oai-lg",children:[m.jsxs("div",{className:"flex flex-col lg:flex-row max-h-[92vh]",children:[m.jsx("div",{className:"flex-1 min-w-0 p-4 sm:p-7 bg-oai-gray-50 dark:bg-oai-gray-950 flex items-center justify-center overflow-auto",children:m.jsxs("div",{style:{width:b*E,height:_*E,flexShrink:0,position:"relative"},className:"rounded-xl overflow-hidden shadow-oai-md ring-1 ring-black/5",children:[i?m.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-white/70 dark:bg-black/50",children:m.jsxs("svg",{className:"animate-spin h-6 w-6 text-oai-gray-500",viewBox:"0 0 24 24",fill:"none",children:[m.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3"}),m.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]})}):null,m.jsx("div",{style:{width:b,height:_,transform:`scale(${E})`,transformOrigin:"top left"},children:m.jsx(jP,{data:w,variant:c})})]})}),m.jsxs("div",{className:"w-full lg:w-[340px] flex-shrink-0 border-t lg:border-t-0 lg:border-l border-oai-gray-200 dark:border-oai-gray-800 p-5 sm:p-6 flex flex-col gap-5 overflow-y-auto",children:[m.jsxs("div",{className:"flex items-start justify-between gap-2",children:[m.jsxs("div",{children:[m.jsx("h2",{className:"text-lg font-semibold text-oai-black dark:text-oai-white",children:F("share.modal.title")}),m.jsx("p",{className:"mt-1 text-xs text-oai-gray-500 dark:text-oai-gray-400",children:F("share.modal.subtitle")})]}),m.jsx("button",{type:"button",onClick:e,"aria-label":F("share.modal.close"),className:"p-1.5 -mt-1 -mr-1 rounded-md text-oai-gray-500 hover:text-oai-black dark:hover:text-oai-white hover:bg-oai-gray-100 dark:hover:bg-oai-gray-800 transition-colors",children:m.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:m.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})})]}),m.jsxs("div",{children:[m.jsx("label",{htmlFor:"share-handle",className:"text-[11px] tracking-[0.18em] uppercase text-oai-gray-500 dark:text-oai-gray-400 mb-1.5 block",children:F("share.modal.name_label")}),m.jsx("input",{id:"share-handle",type:"text",value:s,onChange:k=>o(k.target.value),placeholder:F("share.modal.name_placeholder"),className:"w-full px-3 py-2 text-sm rounded-lg border border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 text-oai-black dark:text-oai-white placeholder:text-oai-gray-400 dark:placeholder:text-oai-gray-600 focus:outline-none focus:ring-1 focus:ring-inset focus:ring-oai-brand transition-colors"})]}),m.jsxs("div",{children:[m.jsx("label",{className:"text-[11px] tracking-[0.18em] uppercase text-oai-gray-500 dark:text-oai-gray-400 mb-1.5 block",children:F("share.modal.style_label")}),m.jsx("div",{className:"flex gap-2",children:O5.map(k=>m.jsx("button",{type:"button",onClick:()=>u(k.id),className:["flex-1 px-3 py-2 text-sm rounded-lg border transition-colors",c===k.id?"border-oai-black dark:border-oai-white bg-white dark:bg-oai-gray-900 text-oai-black dark:text-oai-white font-medium":"border-oai-gray-200 dark:border-oai-gray-800 bg-white dark:bg-oai-gray-900 text-oai-gray-500 dark:text-oai-gray-400 hover:border-oai-gray-400 dark:hover:border-oai-gray-600"].join(" "),children:Joe(k.id)},k.id))})]}),m.jsxs("div",{className:"grid grid-cols-1 gap-2",children:[m.jsxs(k_,{onClick:P,disabled:!!i,emphasis:!0,children:[m.jsxs("span",{className:"flex items-center gap-3",children:[m.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:m.jsx("path",{d:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"})}),m.jsx("span",{className:"font-medium text-sm",children:F("share.modal.action.x")})]}),m.jsx("span",{className:"text-[11px] opacity-70",children:F(i==="x"?"share.toast.working":"share.modal.hint.x")})]}),m.jsxs(k_,{onClick:A,disabled:!!i,children:[m.jsxs("span",{className:"flex items-center gap-3",children:[m.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[m.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),m.jsx("polyline",{points:"7 10 12 15 17 10"}),m.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]}),m.jsx("span",{className:"font-medium text-sm",children:F("share.modal.action.download")})]}),m.jsx("span",{className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400",children:"PNG"})]}),m.jsxs(k_,{onClick:T,disabled:!!i,children:[m.jsxs("span",{className:"flex items-center gap-3",children:[m.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[m.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),m.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),m.jsx("span",{className:"font-medium text-sm",children:F("share.modal.action.copy")})]}),m.jsx("span",{className:"text-[11px] text-oai-gray-500 dark:text-oai-gray-400",children:F("share.modal.hint.copy")})]})]}),m.jsx("div",{className:"mt-auto pt-4 border-t border-oai-gray-200 dark:border-oai-gray-800",children:m.jsx("p",{className:"text-[11px] leading-relaxed text-oai-gray-500 dark:text-oai-gray-400",children:F("share.modal.footer")})})]})]}),m.jsx(Pp,{children:h?m.jsx(fr.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:8},className:"pointer-events-none absolute left-1/2 bottom-4 -translate-x-1/2",children:m.jsx("div",{className:["px-4 py-2 rounded-full text-xs font-medium shadow-oai-md",h.kind==="error"?"bg-red-600 text-white":h.kind==="success"?"bg-oai-black dark:bg-oai-white text-oai-white dark:text-oai-black":"bg-oai-gray-800 text-white"].join(" "),children:h.text})},h.id):null})]})]}):null}function nle(t){const{enabled:e,handle:n,startDate:r,activeDays:i,summary:a,topModels:s,period:o,periodFrom:c,periodTo:u,heatmap:f,accessToken:h,userId:p}=t,[y,v]=x.useState(null);return x.useEffect(()=>{if(!e||!p&&!wr())return;let w=!1;return(async()=>{try{const _=await v3({accessToken:h,userId:p,period:o==="day"||o==="custom"?"week":o,metric:"all",limit:100,offset:0});if(w)return;const M=(Array.isArray(_?.entries)?_.entries:Array.isArray(_)?_:[]).find(R=>R?.is_me===!0),T=typeof M?.rank=="number"?M.rank:null;v(T)}catch{w||v(null)}})(),()=>{w=!0}},[e,h,p,o]),x.useMemo(()=>Eoe({handle:n,startDate:r,activeDays:i,summary:a,topModels:s,rank:y,period:o,periodFrom:c,periodTo:u,heatmap:f}),[n,r,i,a,s,y,o,c,u,f])}const rle=["day","week","month","total","custom"],E_=new Set(["day","hour","month"]),uh=new Set(["day","total","custom"]);function M_(t,e){if(typeof e=="number"&&e>0)return!0;if(typeof t=="bigint")return t>0n;if(typeof t=="number")return Number.isFinite(t)&&t>0;if(typeof t=="string"){const n=t.trim();if(!n)return!1;if(/^[0-9]+$/.test(n))try{return BigInt(n)>0n}catch{return!1}const r=Number(n);return Number.isFinite(r)&&r>0}return!1}function Tg(t){return t?t?.billable_total_tokens??t?.total_tokens:null}function BP(t){return t?t?.billable_total_tokens??t?.value??t?.total_tokens:null}function ile(t){if(typeof t!="string"||!t)return null;const e=t.split("-");if(e.length!==3)return null;const n=Number(e[0]),r=Number(e[1])-1,i=Number(e[2]);if(!Number.isFinite(n)||!Number.isFinite(r)||!Number.isFinite(i))return null;const a=new Date(Date.UTC(n,r,i));return Number.isFinite(a.getTime())?a:null}function ale(t,e){return new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()+e))}function sle(t){return t?t==="www.tokentracker.cc"||t==="tokentracker.cc":!1}function ole(){if(typeof window>"u")return!1;const t=new URLSearchParams(window.location.search),e=String(t.get("force_install")||"").toLowerCase();return e!=="1"&&e!=="true"?!1:!sle(window.location.hostname)}function lle({baseUrl:t,auth:e,signedIn:n,sessionSoftExpired:r,signOut:i,publicMode:a=!1,publicToken:s=null,signInUrl:o="/sign-in",signUpUrl:c="/sign-up"}){const{resolvedLocale:u}=su(),[f,h]=x.useState(!1),[p,y]=x.useState(null),[v,w]=x.useState(null),[b,_]=x.useState(!1),[E,M]=x.useState(null),[T,R]=x.useState(0),[A,P]=x.useState(0),[k,N]=x.useState(null),[j,L]=x.useState(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(max-width: 640px)").matches),z=x.useMemo(()=>typeof window>"u"?!1:sE(window.location.search),[]),U=x.useMemo(()=>ole(),[]),[V,W]=x.useState(!1),[K,Q]=x.useState(!1),O=2200,[G,Y]=x.useState(!0),[H,te]=x.useState(!1),[re,ue]=x.useState(!1),[ce,ee]=x.useState(!1),le=wr(),ve=n&&!r,Pe=x.useMemo(()=>ve&&(typeof e=="function"||typeof e=="string"||e&&typeof e=="object")?e:null,[e,ve]),be=ve?Pe:null,Ye=a?xo(s):be,he=n||le||a,Ue=ve&&Ol(be),je=n&&r&&!a;x.useEffect(()=>{if(!n||le){y(null),w(null),_(!1),M(null);return}if(a)return;if(!Ue){y(null),w(null),_(!1),M(null);return}let Ge=!0;const Wt=()=>{y(null),w(null),_(!1),M(null)};return _(!0),M(null),(async()=>{let Xt=null;try{Xt=await Nl(be)}catch{Xt=null}if(Ge){if(!Xt){Wt();return}try{const tn={link_code:null,expires_at:null};if(!Ge)return;y(typeof tn?.link_code=="string"?tn.link_code:null),w(typeof tn?.expires_at=="string"?tn.expires_at:null)}catch(tn){if(!Ge)return;y(null),w(null),M(tn?.message||"Failed to load link code")}finally{if(!Ge)return;_(!1)}}})(),()=>{Ge=!1}},[t,le,n,a,Ue,be,A]);const et=typeof window<"u"&&(window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1");x.useEffect(()=>{if(!et&&(!n||le||a)){N(null);return}if(!et&&!Ue){N(null);return}let Ge=!0;return(async()=>{let Wt=null;try{Wt=await Nl(be)}catch{Wt=null}if(Ge){if(!Wt&&!et){N(null);return}try{const Xt=await lW({baseUrl:t,accessToken:Wt});if(!Ge)return;N(Xt&&typeof Xt=="object"?Xt:null)}catch{if(!Ge)return;N(null)}}})(),()=>{Ge=!1}},[Ue,t,be,le,a,n]);const _e=x.useMemo(()=>{if(!v)return!1;const Ge=Date.parse(v);if(!Number.isFinite(Ge))return!1;const Wt=T||Date.now();return Ge<=Wt},[v,T]);x.useEffect(()=>{!n||le||a||!v||!_e||b||(y(null),w(null),M(null),P(Ge=>Ge+1))},[_e,v,b,le,n]),x.useEffect(()=>{if(!v||a)return;const Ge=Date.parse(v);if(!Number.isFinite(Ge))return;const Wt=Date.now();if(R(Wt),Ge<=Wt)return;const Xt=window.setTimeout(()=>R(Date.now()),Ge-Wt),tn=()=>{typeof document>"u"||document.visibilityState==="visible"&&R(Date.now())};return typeof document<"u"&&document.addEventListener("visibilitychange",tn),window.addEventListener("focus",tn),()=>{window.clearTimeout(Xt),typeof document<"u"&&document.removeEventListener("visibilitychange",tn),window.removeEventListener("focus",tn)}},[v]),x.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const Ge=window.matchMedia("(max-width: 640px)"),Wt=()=>L(Ge.matches);return Wt(),Ge.addEventListener?(Ge.addEventListener("change",Wt),()=>Ge.removeEventListener("change",Wt)):(Ge.addListener(Wt),()=>Ge.removeListener(Wt))},[]);const oe=x.useMemo(()=>MH(),[]),J=x.useMemo(()=>TH(),[]),ze=x.useMemo(()=>BH(),[]),Ne=a?null:e?.userId||e?.email||"default",[De,Le]=x.useState("month"),[$,I]=x.useState(null),[Z,pe]=x.useState(null),[Se,xe]=x.useState(!1),Ie=z?"total":De,He=x.useMemo(()=>Ie==="custom"&&$&&Z?{from:$,to:Z}:p3(Ie,{timeZone:oe,offsetMinutes:J,now:ze}),[ze,Ie,oe,J,$,Z]),qe=He.from,ft=He.to,We=x.useMemo(()=>CH({timeZone:oe,offsetMinutes:J}),[oe,J]),Xe=x.useMemo(()=>AH({timeZone:oe,offsetMinutes:J}),[oe,J]),nt=x.useMemo(()=>`Local time (${Xe})`,[Xe]),ct=oe,Ke=J,gt=We,ne=x.useMemo(()=>vk({timeZone:oe,offsetMinutes:J,date:ze||new Date}),[ze,oe,J]),Be=x.useMemo(()=>{const Ge=ile(ne)||new Date,Wt=ale(Ge,-29);return{from:Hn(Wt),to:Hn(Ge)}},[ne]),{daily:ke,summary:Ae,rolling:Ve,source:ge,loading:ht,error:bt,refresh:Kt}=fR({baseUrl:t,accessToken:Ye,guestAllowed:je,from:qe,to:ft,includeDaily:Ie!=="total",cacheKey:Ne,timeZone:oe,tzOffsetMinutes:J,now:ze}),{daily:Bt,loading:St,refresh:Rt}=fR({baseUrl:t,accessToken:Ye,guestAllowed:je,from:Be.from,to:Be.to,includeDaily:!0,cacheKey:Ne?`${Ne}.daily-breakdown`:"daily-breakdown",timeZone:oe,tzOffsetMinutes:J,now:ze}),{breakdown:hn,loading:xn,refresh:ie}=zZ({baseUrl:t,accessToken:Ye,guestAllowed:je,from:qe,to:ft,cacheKey:Ne,timeZone:oe,tzOffsetMinutes:J}),[fe,Te]=x.useState(3),{entries:$e,loading:Ze,refresh:Ct}=NZ({baseUrl:t,accessToken:Ye,limit:fe,from:qe,to:ft,timeZone:oe,tzOffsetMinutes:J}),_t=Ie==="week"||Ie==="month",Pt=Ie==="week"||Ie==="month",vt=x.useMemo(()=>ke.filter(Ge=>Ge?.future?!1:!Ge?.day||!ne?!0:String(Ge.day)<=String(ne)),[ke,ne]),{rows:Mt,from:qt,to:zt,loading:En,refresh:yn}=LZ({baseUrl:t,accessToken:Ye,guestAllowed:je,period:Ie,from:qe,to:ft,months:24,cacheKey:Ne,timeZone:ct,tzOffsetMinutes:Ke,now:ze,sharedRows:_t?ke:null,sharedRange:_t?{from:qe,to:ft}:null}),{daily:Cn,heatmap:In,loading:hr,refresh:An}=PZ({baseUrl:t,accessToken:Ye,guestAllowed:je,weeks:52,cacheKey:Ne,timeZone:oe,tzOffsetMinutes:J,now:ze}),{refresh:X}=qO(),me=x.useMemo(()=>Ie==="day"?"hour":Ie==="total"?"month":"day",[Ie]),Re=x.useMemo(()=>pR(me),[me]),Ee="day",we=x.useMemo(()=>pR(Ee),[]),[st,mt]=x.useState(()=>({key:"day",dir:"desc"}));x.useEffect(()=>{mt(Ge=>!E_.has(Ge.key)||Ge.key===me?Ge:{key:me,dir:Ge.dir})},[me]);const it=x.useMemo(()=>E_.has(st.key)&&st.key!==me?{...st,key:me}:st,[me,st]),pt=x.useMemo(()=>{if(Ie==="day")return Array.isArray(Mt)?Mt.filter(Xt=>Xt?.hour&&!Xt?.future):[];if(Ie==="total"){const Xt=Array.isArray(Mt)?Mt.filter(tn=>tn?.month&&!tn?.future):[];return eJ(Xt)}const Ge=vt;return!Ge.some(Xt=>!Xt?.missing&&!Xt?.future)&&ke.length>0?ke.filter(Xt=>!Xt?.future).slice(-30).filter(Xt=>Xt?.day):Ge},[Ie,Mt,vt,ke]),kt=x.useMemo(()=>mR(pt,it),[pt,it]),ut=x.useMemo(()=>pt.some(Ge=>!Ge?.missing&&!Ge?.future),[pt]),Vt=x.useMemo(()=>{if(!uh.has(Ie))return 1;const Ge=Math.ceil(kt.length/ry);return Ge>0?Ge:1},[Ie,kt.length]),[Tt,un]=x.useState(0);x.useEffect(()=>{if(!uh.has(Ie)){un(0);return}un(Ge=>Math.min(Ge,Vt-1))},[Vt,Ie]),x.useEffect(()=>{uh.has(Ie)&&un(0)},[Ie,st.dir,st.key]);const en=x.useMemo(()=>uh.has(Ie)?tJ(kt,Tt,ry):kt,[Tt,Ie,kt]),Rn=x.useMemo(()=>Bt.filter(Ge=>!Ge?.future&&Ge?.day).slice(-30),[Bt]),cn=x.useMemo(()=>E_.has(st.key)?{...st,key:Ee}:st,[st]),tr=x.useMemo(()=>mR(Rn,cn),[Rn,cn]),Ft=x.useMemo(()=>Pt?ke:Ie==="day"?Array.isArray(Mt)?Mt.filter(Ge=>Ge?.hour):[]:Mt,[ke,Ie,Mt,Pt]),Kr=Pt?qe:qt,wn=Pt?ft:zt;function ri(Ge,Wt){return Ge?.future?"—":Ge?.missing?F("shared.status.unsynced"):Oi(Wt==="total_tokens"?Tg(Ge):Ge?.[Wt])}function ii(Ge){const Wt=Ge?.[me];if(Wt==null)return"";const Xt=String(Wt);if(me==="hour"){const[tn,pr]=Xt.split("T");if(tn&&pr)return`${tn} ${pr.slice(0,5)}`}return Xt}function xi(Ge){const Wt=Ge?.[Ee];return Wt==null?"":String(Wt)}function os(Ge){mt(Wt=>Wt.key===Ge?{key:Ge,dir:Wt.dir==="asc"?"desc":"asc"}:{key:Ge,dir:"desc"})}function Fn(Ge){return it.key!==Ge?"none":it.dir==="asc"?"ascending":"descending"}function nn(Ge){return it.key!==Ge?"":it.dir==="asc"?"▲":"▼"}function $i(Ge){return cn.key!==Ge?"none":cn.dir==="asc"?"ascending":"descending"}function lr(Ge){return cn.key!==Ge?"":cn.dir==="asc"?"▲":"▼"}const ai=x.useMemo(()=>{if(!n&&!le&&!a&&!et)return 0;const Ge=Number(In?.active_days);if(Number.isFinite(Ge))return Ge;let Wt=0;const Xt=new Set,tn=(Yn,nr,Qn)=>{typeof Yn!="string"||!Yn||Xt.has(Yn)||M_(nr,Qn)&&(Xt.add(Yn),Wt+=1)};if(Array.isArray(Cn))for(const Yn of Cn)tn(Yn?.day,Tg(Yn));const pr=Array.isArray(In?.weeks)?In.weeks:[];for(const Yn of pr)for(const nr of Array.isArray(Yn)?Yn:[]){const Qn=BP(nr);tn(nr?.day,Qn,nr?.level)}return Wt},[n,le,In?.active_days,In?.weeks,Cn]),[da,jo]=x.useState("month"),Yp=x.useCallback(Ge=>{Ge==="custom"?(jo(Wt=>Wt==="custom"?"month":Wt),Le(Wt=>$&&Z?"custom":Wt),xe(!0)):(Le(Ge),jo(Ge),xe(!1))},[$,Z]),vf=x.useCallback((Ge,Wt)=>{I(Ge),pe(Wt),Le("custom"),xe(!1)},[]),hu=x.useCallback(Ge=>{xe(Ge),!Ge&&De==="custom"&&!$&&Le(da)},[De,$,da]),Da=x.useCallback(async()=>{await Promise.all([Kt(),An(),yn(),ie(),Ct(),Rt(),X()])},[Rt,An,ie,Ct,yn,Kt,X]),ls=x.useCallback(async()=>{ee(!0);try{et&&await cW(),await Da()}catch(Ge){console.error("[DashboardPage] Refresh failed:",Ge)}finally{ee(!1)}},[et,Da]),cs=ce||ht||St||hr||En||xn||Ze,Gl=x.useMemo(()=>F("shared.data_source",{source:String(ge||"edge").toUpperCase()}),[ge,u]),us=x.useMemo(()=>typeof e?.name!="string"?"":e.name.trim(),[e?.name]),ds="",qp=x.useMemo(()=>!us||us.includes("@")?F("dashboard.identity.fallback"):us,[us]),xf=x.useMemo(()=>qp.replace(/[^a-zA-Z0-9._-]/g,"_"),[qp]),Bo=x.useMemo(()=>a?F("dashboard.identity.fallback"):xf,[xf,ds,a]),Xp=x.useMemo(()=>{let Ge=null;const Wt=tn=>{typeof tn!="string"||!tn||(!Ge||tn<Ge)&&(Ge=tn)};if(Array.isArray(Cn))for(const tn of Cn)tn?.day&&M_(Tg(tn))&&Wt(tn.day);const Xt=Array.isArray(In?.weeks)?In.weeks:[];for(const tn of Xt)for(const pr of Array.isArray(tn)?tn:[]){if(!pr?.day)continue;const Yn=BP(pr),nr=pr?.level;M_(Yn,nr)&&Wt(pr.day)}return Ge},[In?.weeks,Cn]),Kp=x.useMemo(()=>a?[]:(Array.isArray(k?.subscriptions?.items)?k.subscriptions.items:[]).map(Xt=>{const tn=typeof Xt?.tool=="string"?Xt.tool.trim():"",Yn=(typeof Xt?.plan_type=="string"?Xt.plan_type:typeof Xt?.planType=="string"?Xt.planType:"").trim();return!tn||!Yn?null:{tool:tn,planType:Yn,provider:typeof Xt?.provider=="string"?Xt.provider.trim():"",product:typeof Xt?.product=="string"?Xt.product.trim():"",rateLimitTier:typeof Xt?.rate_limit_tier=="string"?Xt.rate_limit_tier.trim():typeof Xt?.rateLimitTier=="string"?Xt.rateLimitTier.trim():""}}).filter(Boolean).slice(0,6),[a,k]),pu=m.jsx($J,{heatmap:In,timeZoneLabel:We,timeZoneShortLabel:Xe,hideLegend:z,defaultToLatestMonth:z}),Zp=x.useMemo(()=>`${qe}..${ft}`,[qe,Ie,ft]),_v=F("usage.summary.total"),Yi=Tg(Ae),zo=F("shared.unit.thousand_abbrev"),Qs=F("shared.unit.million_abbrev"),$l=F("shared.unit.billion_abbrev"),mu=ti(Yi),Jp=j&&mu!=null&&Math.abs(mu)>=1e9,bf=x.useMemo(()=>Jp?Iy(mu,{thousandSuffix:zo,millionSuffix:Qs,billionSuffix:$l,decimals:1}):Oi(Yi),[$l,Qs,Yi,mu,zo,Jp]),gu=F("dashboard.core_index.collapse_label"),_f=F("dashboard.core_index.expand_label"),Qp=F("dashboard.core_index.collapse_aria"),fs=F("dashboard.core_index.expand_aria"),wf=!z,yu=F("dashboard.screenshot.title_line1"),em=F("dashboard.screenshot.title_line2"),vu=F("dashboard.screenshot.twitter_label"),xu=F("dashboard.screenshot.twitter_button"),tm=F("dashboard.screenshot.twitter_hint"),Sr=F("shared.placeholder.short"),hs=x.useMemo(()=>{const Ge=Array.isArray(hn?.sources)?hn.sources:[];let Wt=null,Xt=0;for(const nr of Ge){const Qn=ti(nr?.totals?.billable_total_tokens??nr?.totals?.total_tokens);!Number.isFinite(Qn)||Qn<=0||Qn>Xt&&(Xt=Qn,Wt=nr)}let tn=Sr,pr=Sr,Yn="0.0";if(Wt&&Xt>0){tn=Wt?.source?String(Wt.source).toUpperCase():Sr;const nr=Array.isArray(Wt?.models)?Wt.models:[];let Qn=0;for(const La of nr){const Kl=ti(La?.totals?.billable_total_tokens??La?.totals?.total_tokens);!Number.isFinite(Kl)||Kl<=0||Kl>Qn&&(Qn=Kl,pr=La?.model?String(La.model):Sr)}Qn>0&&(Yn=(Qn/Xt*100).toFixed(1))}return{agentName:tn,modelName:pr,modelPercent:Yn}},[hn,Sr]),bu=Oi(Yi),Sf=F("dashboard.screenshot.twitter_text",{total_tokens:bu==="-"?Sr:bu,agent_name:hs.agentName,model_name:hs.modelName,model_percent:hs.modelPercent}),Yl=x.useMemo(()=>{if(typeof window>"u")return"";const Ge=new URL("https://twitter.com/intent/tweet");return Ge.searchParams.set("text",Sf),Ge.toString()},[Sf]),wu=x.useCallback(async()=>{if(typeof window>"u")return null;const Ge=async()=>{const nr=performance.now();for(;performance.now()-nr<2e3;){const Qn=document.querySelector("[data-heatmap-scroll='true']");if(!Qn||Qn.dataset.latestMonthReady==="true")return;await new Promise(La=>requestAnimationFrame(La))}},Wt=document.querySelector("#root")||document.body,Xt=document.documentElement,{scrollWidth:tn,scrollHeight:pr}=document.documentElement;Xt?.classList.add("screenshot-capture"),document.body?.classList.add("screenshot-capture"),await new Promise(Yn=>requestAnimationFrame(Yn)),await Ge();try{const{toBlob:Yn,toPng:nr}=await $O(async()=>{const{toBlob:eo,toPng:sm}=await import("./index-BeoRn2gJ.js");return{toBlob:eo,toPng:sm}},[]),Qn=await Yn(Wt,{backgroundColor:"#050505",pixelRatio:2,cacheBust:!0,width:tn,height:pr,style:{width:`${tn}px`,height:`${pr}px`},filter:eo=>!(eo instanceof HTMLElement)||eo.dataset?.screenshotExclude!=="true"});if(Qn)return Qn;const La=await nr(Wt,{backgroundColor:"#050505",pixelRatio:2,cacheBust:!0,width:tn,height:pr,style:{width:`${tn}px`,height:`${pr}px`},filter:eo=>!(eo instanceof HTMLElement)||eo.dataset?.screenshotExclude!=="true"});return La?await(await fetch(La)).blob():null}finally{Xt?.classList.remove("screenshot-capture"),document.body?.classList.remove("screenshot-capture")}},[]),ql=x.useCallback(async()=>{if(typeof window>"u"||V)return;W(!0);const Ge=navigator?.userAgent||"",Wt=/iP(hone|od|ad)/i.test(Ge),Xt=/Safari/i.test(Ge)&&!/Chrome|Chromium|Edg|OPR|CriOS|FxiOS/i.test(Ge),tn=typeof navigator<"u"&&!!navigator.clipboard?.write&&typeof window<"u"&&!!window.ClipboardItem;let Yn=!tn||Wt||Xt;try{const nr=await wu();nr&&tn&&(typeof document<"u"&&!document.hasFocus()&&window.focus?.(),Yn=await Uw(nr))}catch(nr){console.error("Failed to capture screenshot",nr)}finally{if(W(!1),!Yn){console.warn("Failed to write screenshot to clipboard.");return}Yl&&(window.location.href=Yl)}},[wu,V,Yl]),Su=x.useMemo(()=>z?[]:rle,[z]),nm=x.useMemo(()=>[{label:F("usage.metric.total"),value:Oi(Yi),valueClassName:"text-white"},{label:F("usage.metric.input"),value:Oi(Ae?.input_tokens)},{label:F("usage.metric.output"),value:Oi(Ae?.output_tokens)},{label:F("usage.metric.cached_input"),value:Oi(Ae?.cached_input_tokens)},{label:F("usage.metric.reasoning_output"),value:Oi(Ae?.reasoning_output_tokens)}],[Ae?.cached_input_tokens,Ae?.input_tokens,Ae?.output_tokens,Ae?.reasoning_output_tokens,Yi]),kf=x.useMemo(()=>{const Ge=Oy(Ae?.total_cost_usd);return!Ge||Ge==="-"||Ge.startsWith("$")?Ge:`$${Ge}`},[Ae?.total_cost_usd]),wv=x.useMemo(()=>Ae?.conversation_count??null,[Ae?.conversation_count]),rm=x.useMemo(()=>iJ(hn,{copyFn:F}),[hn]),ku=x.useMemo(()=>aJ(hn,{limit:3,copyFn:F}),[hn]),Sv=nle({enabled:K,handle:Bo,startDate:Xp,activeDays:ai,summary:Ae,topModels:ku,period:Ie,periodFrom:qe,periodTo:ft,heatmap:In,accessToken:typeof Ye=="string"?Ye:null,userId:e?.userId||null}),kv=x.useCallback(()=>Q(!0),[]),Ev=x.useCallback(()=>Q(!1),[]),Mv=x.useCallback(()=>h(!0),[]),Tv=x.useCallback(()=>h(!1),[]),im=kf&&kf!=="-"&&rm.length>0,Xl=F("dashboard.install.cmd.init"),Ef=_e?null:p,Mf=Ef?F("dashboard.install.cmd.init_link_code",{link_code:Ef}):Xl,Cv=Xl,Tf=F("dashboard.install.cmd.sync"),Av=F(Ef?"dashboard.install.copy":"dashboard.install.copy_base"),Rv=F("dashboard.install.copied");F("dashboard.session_expired.copy_label"),F("dashboard.session_expired.copied");const Pv=!!(k?.install?.has_active_device_token??k?.install?.hasActiveDeviceToken),am=nJ({publicMode:a,screenshotMode:z,forceInstall:U,accessEnabled:he,heatmapLoading:hr,activeDays:ai,hasActiveDeviceToken:Pv}),Nv=F("dashboard.install.prompt"),Dv=x.useCallback(async()=>{!Mf||!await Fw(Mf)||(te(!0),window.setTimeout(()=>te(!1),2e3))},[Mf]);x.useCallback(async()=>{!Xl||!await Fw(Xl)||(ue(!0),window.setTimeout(()=>ue(!1),2e3))},[Xl]);const Cf=x.useMemo(()=>F("dashboard.daily.empty",{cmd:"{{cmd}}"}),[u]),[Lv,Iv]=x.useMemo(()=>{const Ge=Cf.split("{{cmd}}");return Ge.length===1?[Cf,""]:[Ge[0],Ge.slice(1).join("{{cmd}}")]},[Cf]),Ov=r&&!a,Af=!n&&!le&&!r&&!et&&!a;return m.jsxs(m.Fragment,{children:[m.jsx(yoe,{copy:F,onOpenShare:kv,screenshotMode:z,showExpiredGate:Ov,showAuthGate:Af,screenshotTitleLine1:yu,screenshotTitleLine2:em,identityDisplayName:Bo,identityStartDate:Xp,activeDays:ai,identitySubscriptions:Kp,identityScrambleDurationMs:O,projectUsageEntries:$e,projectUsageLimit:fe,setProjectUsageLimit:Te,topModels:ku,signedIn:n,publicMode:a,isLocalMode:et,shouldShowInstall:am,installPrompt:Nv,handleCopyInstall:Dv,installCopied:H,installCopiedLabel:Rv,installCopyLabel:Av,installInitCmdDisplay:Cv,linkCodeLoading:b,linkCodeError:E,trendRowsForDisplay:Ft,trendFromForDisplay:Kr,trendToForDisplay:wn,period:Ie,trendTimeZoneLabel:gt,activityHeatmapBlock:pu,isCapturing:V,handleShareToX:ql,screenshotTwitterLabel:vu,screenshotTwitterButton:xu,screenshotTwitterHint:tm,periodsForDisplay:Su,setSelectedPeriod:Yp,customFrom:$,customTo:Z,onCustomRangeApply:vf,customRangeOpen:Se,onCustomRangeOpenChange:hu,metricsRows:nm,summaryLabel:_v,summaryValue:bf,summaryTotalTokensRaw:ti(Yi)||0,summaryCostValue:kf,summaryConversationsValue:wv,rollingUsage:Ve,costInfoEnabled:im,openCostModal:Mv,allowBreakdownToggle:wf,coreIndexCollapsed:G,setCoreIndexCollapsed:Y,coreIndexCollapseLabel:gu,coreIndexExpandLabel:_f,coreIndexCollapseAria:Qp,coreIndexExpandAria:fs,refreshAll:ls,usageLoadingState:cs,usageError:bt,rangeLabel:Zp,timeZoneRangeLabel:nt,usageSourceLabel:Gl,fleetData:rm,hasDetailsActual:ut,dailyEmptyPrefix:Lv,installSyncCmd:Tf,dailyEmptySuffix:Iv,detailsColumns:Re,ariaSortFor:Fn,toggleSort:os,sortIconFor:nn,pagedDetails:en,dailyBreakdownRows:tr,dailyBreakdownColumns:we,dailyBreakdownAriaSortFor:$i,dailyBreakdownSortIconFor:lr,dailyBreakdownDateKey:Ee,detailsDateKey:me,renderDetailDate:ii,renderDailyBreakdownDate:xi,renderDetailCell:ri,DETAILS_PAGED_PERIODS:uh,detailsPageCount:Vt,detailsPage:Tt,setDetailsPage:un,costModalOpen:f,closeCostModal:Tv}),m.jsx(tle,{open:K,onClose:Ev,data:Sv,twitterText:Sf})]})}function cle(){const[t,e]=x.useState(!1);return m.jsxs("div",{className:"h-full relative dark:bg-[#050505]",children:[!t&&m.jsxs("div",{className:"absolute inset-0 p-6 space-y-5 animate-pulse",children:[m.jsx("div",{className:"flex gap-4 justify-center",children:Array.from({length:6}).map((n,r)=>m.jsx("div",{className:"h-4 w-20 rounded bg-oai-gray-200 dark:bg-oai-gray-800"},r))}),m.jsxs("div",{className:"space-y-2 pt-2",children:[m.jsx("div",{className:"h-7 w-72 rounded bg-oai-gray-200 dark:bg-oai-gray-800"}),m.jsx("div",{className:"h-4 w-96 rounded bg-oai-gray-200 dark:bg-oai-gray-800"})]}),m.jsx("div",{className:"grid grid-cols-3 gap-4",children:Array.from({length:3}).map((n,r)=>m.jsx("div",{className:"h-24 rounded-xl bg-oai-gray-200 dark:bg-oai-gray-800"},r))}),m.jsx("div",{className:"grid grid-cols-3 gap-4",children:Array.from({length:3}).map((n,r)=>m.jsx("div",{className:"h-40 rounded-xl bg-oai-gray-200 dark:bg-oai-gray-800"},r))}),m.jsx("div",{className:"grid grid-cols-3 gap-4",children:Array.from({length:3}).map((n,r)=>m.jsx("div",{className:"h-32 rounded-xl bg-oai-gray-200 dark:bg-oai-gray-800"},r))})]}),m.jsx("iframe",{src:"https://ip.net.coffee/claude/",title:"Cloud AI IP Check",className:`w-full h-full dark:invert dark:hue-rotate-180 transition-opacity duration-300 ${t?"opacity-100":"opacity-0"}`,style:{border:"none"},onLoad:()=>e(!0)})]})}function ule(){if(typeof window>"u")return!1;const t=window.location.hostname;return t==="localhost"||t==="127.0.0.1"||t==="::1"}function dle(){return ule()?"/":"/dashboard"}function U5({repo:t="mm7894215/TokenTracker"}){const[e,n]=x.useState(null);return x.useEffect(()=>{if(typeof window>"u")return;const r=typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,i=typeof document<"u"&&(document.documentElement?.classList.contains("screenshot-capture")||document.body?.classList.contains("screenshot-capture"));CF({prefersReducedMotion:r,screenshotCapture:i})&&fetch(`https://api.github.com/repos/${t}`).then(a=>a.json()).then(a=>{a&&typeof a.stargazers_count=="number"&&n(a.stargazers_count)}).catch(()=>{})},[t]),m.jsxs("a",{href:`https://github.com/${t}`,target:"_blank",rel:"noopener noreferrer",className:"inline-flex shrink-0 items-center gap-2 px-3 py-1.5 rounded-md border border-oai-gray-200 dark:border-oai-gray-700 bg-oai-gray-50 dark:bg-oai-gray-800 hover:bg-oai-gray-100 dark:hover:bg-oai-gray-700 transition-colors no-underline",children:[m.jsx("svg",{height:"16",viewBox:"0 0 16 16",width:"16",className:"shrink-0 fill-oai-gray-700 dark:fill-oai-gray-300",children:m.jsx("path",{d:"M8 0c4.42 0 8 3.58 8 8a8.013 8.013 0 0 1-5.45 7.59c-.4.08-.55-.17-.55-.38 0-.27.01-1.13.01-2.2 0-.75-.25-1.23-.54-1.48 1.78-.2 3.65-.88 3.65-3.95 0-.88-.31-1.59-.82-2.15.08-.2.36-1.02-.08-2.12 0 0-.67-.22-2.2.82-.64-.18-1.32-.27-2-.27-.68 0-1.36.09-2 .27-1.53-1.03-2.2-.82-2.2-.82-.44 1.1-.16 1.92-.08 2.12-.51.56-.82 1.28-.82 2.15 0 3.06 1.86 3.75 3.64 3.95-.23.2-.44.55-.51 1.07-.46.21-1.61.55-2.33-.66-.15-.24-.6-.83-1.23-.82-.67.01-.27.38.01.53.34.19.73.9.82 1.13.16.45.68 1.31 2.69.94 0 .67.01 1.3.01 1.49 0 .21-.15.45-.55.38A7.995 7.995 0 0 1 0 8c0-4.42 3.58-8 8-8Z"})}),m.jsx("span",{className:"text-xs font-medium text-oai-gray-700 dark:text-oai-gray-300 whitespace-nowrap",children:"Star"}),e!==null&&m.jsx("span",{className:"text-xs font-semibold text-oai-gray-900 dark:text-oai-white tabular-nums whitespace-nowrap",children:e})]})}const WE="183",fle=0,zP=1,hle=2,w0=1,ple=2,Th=3,Il=0,zi=1,bo=2,To=0,Bc=1,VP=2,HP=3,WP=4,mle=5,Ec=100,gle=101,yle=102,vle=103,xle=104,ble=200,_le=201,wle=202,Sle=203,I1=204,O1=205,kle=206,Ele=207,Mle=208,Tle=209,Cle=210,Ale=211,Rle=212,Ple=213,Nle=214,F1=0,U1=1,j1=2,Gd=3,B1=4,z1=5,V1=6,H1=7,j5=0,Dle=1,Lle=2,Os=0,B5=1,z5=2,V5=3,H5=4,W5=5,G5=6,$5=7,Y5=300,eu=301,$d=302,T_=303,C_=304,uv=306,W1=1e3,So=1001,G1=1002,ni=1003,Ile=1004,Cg=1005,yi=1006,A_=1007,Lc=1008,Ea=1009,q5=1010,X5=1011,lp=1012,GE=1013,Ws=1014,Ps=1015,Lo=1016,$E=1017,YE=1018,cp=1020,K5=35902,Z5=35899,J5=1021,Q5=1022,es=1023,Io=1026,Ic=1027,eU=1028,qE=1029,Yd=1030,XE=1031,KE=1033,S0=33776,k0=33777,E0=33778,M0=33779,$1=35840,Y1=35841,q1=35842,X1=35843,K1=36196,Z1=37492,J1=37496,Q1=37488,eS=37489,tS=37490,nS=37491,rS=37808,iS=37809,aS=37810,sS=37811,oS=37812,lS=37813,cS=37814,uS=37815,dS=37816,fS=37817,hS=37818,pS=37819,mS=37820,gS=37821,yS=36492,vS=36494,xS=36495,bS=36283,_S=36284,wS=36285,SS=36286,Ole=3200,Fle=0,Ule=1,xl="",wa="srgb",tu="srgb-linear",gy="linear",qn="srgb",Zu=7680,GP=519,jle=512,Ble=513,zle=514,ZE=515,Vle=516,Hle=517,JE=518,Wle=519,$P=35044,YP="300 es",Ns=2e3,yy=2001;function Gle(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}function vy(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function $le(){const t=vy("canvas");return t.style.display="block",t}const qP={};function XP(...t){const e="THREE."+t.shift();console.log(e,...t)}function tU(t){const e=t[0];if(typeof e=="string"&&e.startsWith("TSL:")){const n=t[1];n&&n.isStackTrace?t[0]+=" "+n.getLocation():t[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return t}function ln(...t){t=tU(t);const e="THREE."+t.shift();{const n=t[0];n&&n.isStackTrace?console.warn(n.getError(e)):console.warn(e,...t)}}function Vn(...t){t=tU(t);const e="THREE."+t.shift();{const n=t[0];n&&n.isStackTrace?console.error(n.getError(e)):console.error(e,...t)}}function xy(...t){const e=t.join(" ");e in qP||(qP[e]=!0,ln(...t))}function Yle(t,e,n){return new Promise(function(r,i){function a(){switch(t.clientWaitSync(e,t.SYNC_FLUSH_COMMANDS_BIT,0)){case t.WAIT_FAILED:i();break;case t.TIMEOUT_EXPIRED:setTimeout(a,n);break;default:r()}}setTimeout(a,n)})}const qle={[F1]:U1,[j1]:V1,[B1]:H1,[Gd]:z1,[U1]:F1,[V1]:j1,[H1]:B1,[z1]:Gd};class df{addEventListener(e,n){this._listeners===void 0&&(this._listeners={});const r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(n)===-1&&r[e].push(n)}hasEventListener(e,n){const r=this._listeners;return r===void 0?!1:r[e]!==void 0&&r[e].indexOf(n)!==-1}removeEventListener(e,n){const r=this._listeners;if(r===void 0)return;const i=r[e];if(i!==void 0){const a=i.indexOf(n);a!==-1&&i.splice(a,1)}}dispatchEvent(e){const n=this._listeners;if(n===void 0)return;const r=n[e.type];if(r!==void 0){e.target=this;const i=r.slice(0);for(let a=0,s=i.length;a<s;a++)i[a].call(this,e);e.target=null}}}const ui=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"],R_=Math.PI/180,kS=180/Math.PI;function Bp(){const t=Math.random()*4294967295|0,e=Math.random()*4294967295|0,n=Math.random()*4294967295|0,r=Math.random()*4294967295|0;return(ui[t&255]+ui[t>>8&255]+ui[t>>16&255]+ui[t>>24&255]+"-"+ui[e&255]+ui[e>>8&255]+"-"+ui[e>>16&15|64]+ui[e>>24&255]+"-"+ui[n&63|128]+ui[n>>8&255]+"-"+ui[n>>16&255]+ui[n>>24&255]+ui[r&255]+ui[r>>8&255]+ui[r>>16&255]+ui[r>>24&255]).toLowerCase()}function Dn(t,e,n){return Math.max(e,Math.min(n,t))}function Xle(t,e){return(t%e+e)%e}function P_(t,e,n){return(1-n)*t+n*e}function dh(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function Ii(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(t*4294967295);case Uint16Array:return Math.round(t*65535);case Uint8Array:return Math.round(t*255);case Int32Array:return Math.round(t*2147483647);case Int16Array:return Math.round(t*32767);case Int8Array:return Math.round(t*127);default:throw new Error("Invalid component type.")}}class Gn{constructor(e=0,n=0){Gn.prototype.isVector2=!0,this.x=e,this.y=n}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,n){return this.x=e,this.y=n,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const n=this.x,r=this.y,i=e.elements;return this.x=i[0]*n+i[3]*r+i[6],this.y=i[1]*n+i[4]*r+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,n){return this.x=Dn(this.x,e.x,n.x),this.y=Dn(this.y,e.y,n.y),this}clampScalar(e,n){return this.x=Dn(this.x,e,n),this.y=Dn(this.y,e,n),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Dn(r,e,n))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const r=this.dot(e)/n;return Math.acos(Dn(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,r=this.y-e.y;return n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this}lerpVectors(e,n,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this}rotateAround(e,n){const r=Math.cos(n),i=Math.sin(n),a=this.x-e.x,s=this.y-e.y;return this.x=a*r-s*i+e.x,this.y=a*i+s*r+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class ff{constructor(e=0,n=0,r=0,i=1){this.isQuaternion=!0,this._x=e,this._y=n,this._z=r,this._w=i}static slerpFlat(e,n,r,i,a,s,o){let c=r[i+0],u=r[i+1],f=r[i+2],h=r[i+3],p=a[s+0],y=a[s+1],v=a[s+2],w=a[s+3];if(h!==w||c!==p||u!==y||f!==v){let b=c*p+u*y+f*v+h*w;b<0&&(p=-p,y=-y,v=-v,w=-w,b=-b);let _=1-o;if(b<.9995){const E=Math.acos(b),M=Math.sin(E);_=Math.sin(_*E)/M,o=Math.sin(o*E)/M,c=c*_+p*o,u=u*_+y*o,f=f*_+v*o,h=h*_+w*o}else{c=c*_+p*o,u=u*_+y*o,f=f*_+v*o,h=h*_+w*o;const E=1/Math.sqrt(c*c+u*u+f*f+h*h);c*=E,u*=E,f*=E,h*=E}}e[n]=c,e[n+1]=u,e[n+2]=f,e[n+3]=h}static multiplyQuaternionsFlat(e,n,r,i,a,s){const o=r[i],c=r[i+1],u=r[i+2],f=r[i+3],h=a[s],p=a[s+1],y=a[s+2],v=a[s+3];return e[n]=o*v+f*h+c*y-u*p,e[n+1]=c*v+f*p+u*h-o*y,e[n+2]=u*v+f*y+o*p-c*h,e[n+3]=f*v-o*h-c*p-u*y,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,n,r,i){return this._x=e,this._y=n,this._z=r,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,n=!0){const r=e._x,i=e._y,a=e._z,s=e._order,o=Math.cos,c=Math.sin,u=o(r/2),f=o(i/2),h=o(a/2),p=c(r/2),y=c(i/2),v=c(a/2);switch(s){case"XYZ":this._x=p*f*h+u*y*v,this._y=u*y*h-p*f*v,this._z=u*f*v+p*y*h,this._w=u*f*h-p*y*v;break;case"YXZ":this._x=p*f*h+u*y*v,this._y=u*y*h-p*f*v,this._z=u*f*v-p*y*h,this._w=u*f*h+p*y*v;break;case"ZXY":this._x=p*f*h-u*y*v,this._y=u*y*h+p*f*v,this._z=u*f*v+p*y*h,this._w=u*f*h-p*y*v;break;case"ZYX":this._x=p*f*h-u*y*v,this._y=u*y*h+p*f*v,this._z=u*f*v-p*y*h,this._w=u*f*h+p*y*v;break;case"YZX":this._x=p*f*h+u*y*v,this._y=u*y*h+p*f*v,this._z=u*f*v-p*y*h,this._w=u*f*h-p*y*v;break;case"XZY":this._x=p*f*h-u*y*v,this._y=u*y*h-p*f*v,this._z=u*f*v+p*y*h,this._w=u*f*h+p*y*v;break;default:ln("Quaternion: .setFromEuler() encountered an unknown order: "+s)}return n===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,n){const r=n/2,i=Math.sin(r);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(r),this._onChangeCallback(),this}setFromRotationMatrix(e){const n=e.elements,r=n[0],i=n[4],a=n[8],s=n[1],o=n[5],c=n[9],u=n[2],f=n[6],h=n[10],p=r+o+h;if(p>0){const y=.5/Math.sqrt(p+1);this._w=.25/y,this._x=(f-c)*y,this._y=(a-u)*y,this._z=(s-i)*y}else if(r>o&&r>h){const y=2*Math.sqrt(1+r-o-h);this._w=(f-c)/y,this._x=.25*y,this._y=(i+s)/y,this._z=(a+u)/y}else if(o>h){const y=2*Math.sqrt(1+o-r-h);this._w=(a-u)/y,this._x=(i+s)/y,this._y=.25*y,this._z=(c+f)/y}else{const y=2*Math.sqrt(1+h-r-o);this._w=(s-i)/y,this._x=(a+u)/y,this._y=(c+f)/y,this._z=.25*y}return this._onChangeCallback(),this}setFromUnitVectors(e,n){let r=e.dot(n)+1;return r<1e-8?(r=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(this._x=e.y*n.z-e.z*n.y,this._y=e.z*n.x-e.x*n.z,this._z=e.x*n.y-e.y*n.x,this._w=r),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Dn(this.dot(e),-1,1)))}rotateTowards(e,n){const r=this.angleTo(e);if(r===0)return this;const i=Math.min(1,n/r);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,n){const r=e._x,i=e._y,a=e._z,s=e._w,o=n._x,c=n._y,u=n._z,f=n._w;return this._x=r*f+s*o+i*u-a*c,this._y=i*f+s*c+a*o-r*u,this._z=a*f+s*u+r*c-i*o,this._w=s*f-r*o-i*c-a*u,this._onChangeCallback(),this}slerp(e,n){let r=e._x,i=e._y,a=e._z,s=e._w,o=this.dot(e);o<0&&(r=-r,i=-i,a=-a,s=-s,o=-o);let c=1-n;if(o<.9995){const u=Math.acos(o),f=Math.sin(u);c=Math.sin(c*u)/f,n=Math.sin(n*u)/f,this._x=this._x*c+r*n,this._y=this._y*c+i*n,this._z=this._z*c+a*n,this._w=this._w*c+s*n,this._onChangeCallback()}else this._x=this._x*c+r*n,this._y=this._y*c+i*n,this._z=this._z*c+a*n,this._w=this._w*c+s*n,this.normalize();return this}slerpQuaternions(e,n,r){return this.copy(e).slerp(n,r)}random(){const e=2*Math.PI*Math.random(),n=2*Math.PI*Math.random(),r=Math.random(),i=Math.sqrt(1-r),a=Math.sqrt(r);return this.set(i*Math.sin(e),i*Math.cos(e),a*Math.sin(n),a*Math.cos(n))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,n=0){return this._x=e[n],this._y=e[n+1],this._z=e[n+2],this._w=e[n+3],this._onChangeCallback(),this}toArray(e=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+3]=this._w,e}fromBufferAttribute(e,n){return this._x=e.getX(n),this._y=e.getY(n),this._z=e.getZ(n),this._w=e.getW(n),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class Oe{constructor(e=0,n=0,r=0){Oe.prototype.isVector3=!0,this.x=e,this.y=n,this.z=r}set(e,n,r){return r===void 0&&(r=this.z),this.x=e,this.y=n,this.z=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,n){return this.x=e.x*n.x,this.y=e.y*n.y,this.z=e.z*n.z,this}applyEuler(e){return this.applyQuaternion(KP.setFromEuler(e))}applyAxisAngle(e,n){return this.applyQuaternion(KP.setFromAxisAngle(e,n))}applyMatrix3(e){const n=this.x,r=this.y,i=this.z,a=e.elements;return this.x=a[0]*n+a[3]*r+a[6]*i,this.y=a[1]*n+a[4]*r+a[7]*i,this.z=a[2]*n+a[5]*r+a[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const n=this.x,r=this.y,i=this.z,a=e.elements,s=1/(a[3]*n+a[7]*r+a[11]*i+a[15]);return this.x=(a[0]*n+a[4]*r+a[8]*i+a[12])*s,this.y=(a[1]*n+a[5]*r+a[9]*i+a[13])*s,this.z=(a[2]*n+a[6]*r+a[10]*i+a[14])*s,this}applyQuaternion(e){const n=this.x,r=this.y,i=this.z,a=e.x,s=e.y,o=e.z,c=e.w,u=2*(s*i-o*r),f=2*(o*n-a*i),h=2*(a*r-s*n);return this.x=n+c*u+s*h-o*f,this.y=r+c*f+o*u-a*h,this.z=i+c*h+a*f-s*u,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const n=this.x,r=this.y,i=this.z,a=e.elements;return this.x=a[0]*n+a[4]*r+a[8]*i,this.y=a[1]*n+a[5]*r+a[9]*i,this.z=a[2]*n+a[6]*r+a[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,n){return this.x=Dn(this.x,e.x,n.x),this.y=Dn(this.y,e.y,n.y),this.z=Dn(this.z,e.z,n.z),this}clampScalar(e,n){return this.x=Dn(this.x,e,n),this.y=Dn(this.y,e,n),this.z=Dn(this.z,e,n),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Dn(r,e,n))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this}lerpVectors(e,n,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,this.z=e.z+(n.z-e.z)*r,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,n){const r=e.x,i=e.y,a=e.z,s=n.x,o=n.y,c=n.z;return this.x=i*c-a*o,this.y=a*s-r*c,this.z=r*o-i*s,this}projectOnVector(e){const n=e.lengthSq();if(n===0)return this.set(0,0,0);const r=e.dot(this)/n;return this.copy(e).multiplyScalar(r)}projectOnPlane(e){return N_.copy(this).projectOnVector(e),this.sub(N_)}reflect(e){return this.sub(N_.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const n=Math.sqrt(this.lengthSq()*e.lengthSq());if(n===0)return Math.PI/2;const r=this.dot(e)/n;return Math.acos(Dn(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const n=this.x-e.x,r=this.y-e.y,i=this.z-e.z;return n*n+r*r+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,n,r){const i=Math.sin(n)*e;return this.x=i*Math.sin(r),this.y=Math.cos(n)*e,this.z=i*Math.cos(r),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,n,r){return this.x=e*Math.sin(n),this.y=r,this.z=e*Math.cos(n),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this}setFromMatrixScale(e){const n=this.setFromMatrixColumn(e,0).length(),r=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=n,this.y=r,this.z=i,this}setFromMatrixColumn(e,n){return this.fromArray(e.elements,n*4)}setFromMatrix3Column(e,n){return this.fromArray(e.elements,n*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,n=Math.random()*2-1,r=Math.sqrt(1-n*n);return this.x=r*Math.cos(e),this.y=n,this.z=r*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const N_=new Oe,KP=new ff;class pn{constructor(e,n,r,i,a,s,o,c,u){pn.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,n,r,i,a,s,o,c,u)}set(e,n,r,i,a,s,o,c,u){const f=this.elements;return f[0]=e,f[1]=i,f[2]=o,f[3]=n,f[4]=a,f[5]=c,f[6]=r,f[7]=s,f[8]=u,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const n=this.elements,r=e.elements;return n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3],n[4]=r[4],n[5]=r[5],n[6]=r[6],n[7]=r[7],n[8]=r[8],this}extractBasis(e,n,r){return e.setFromMatrix3Column(this,0),n.setFromMatrix3Column(this,1),r.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const n=e.elements;return this.set(n[0],n[4],n[8],n[1],n[5],n[9],n[2],n[6],n[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const r=e.elements,i=n.elements,a=this.elements,s=r[0],o=r[3],c=r[6],u=r[1],f=r[4],h=r[7],p=r[2],y=r[5],v=r[8],w=i[0],b=i[3],_=i[6],E=i[1],M=i[4],T=i[7],R=i[2],A=i[5],P=i[8];return a[0]=s*w+o*E+c*R,a[3]=s*b+o*M+c*A,a[6]=s*_+o*T+c*P,a[1]=u*w+f*E+h*R,a[4]=u*b+f*M+h*A,a[7]=u*_+f*T+h*P,a[2]=p*w+y*E+v*R,a[5]=p*b+y*M+v*A,a[8]=p*_+y*T+v*P,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=e,n[4]*=e,n[7]*=e,n[2]*=e,n[5]*=e,n[8]*=e,this}determinant(){const e=this.elements,n=e[0],r=e[1],i=e[2],a=e[3],s=e[4],o=e[5],c=e[6],u=e[7],f=e[8];return n*s*f-n*o*u-r*a*f+r*o*c+i*a*u-i*s*c}invert(){const e=this.elements,n=e[0],r=e[1],i=e[2],a=e[3],s=e[4],o=e[5],c=e[6],u=e[7],f=e[8],h=f*s-o*u,p=o*c-f*a,y=u*a-s*c,v=n*h+r*p+i*y;if(v===0)return this.set(0,0,0,0,0,0,0,0,0);const w=1/v;return e[0]=h*w,e[1]=(i*u-f*r)*w,e[2]=(o*r-i*s)*w,e[3]=p*w,e[4]=(f*n-i*c)*w,e[5]=(i*a-o*n)*w,e[6]=y*w,e[7]=(r*c-u*n)*w,e[8]=(s*n-r*a)*w,this}transpose(){let e;const n=this.elements;return e=n[1],n[1]=n[3],n[3]=e,e=n[2],n[2]=n[6],n[6]=e,e=n[5],n[5]=n[7],n[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const n=this.elements;return e[0]=n[0],e[1]=n[3],e[2]=n[6],e[3]=n[1],e[4]=n[4],e[5]=n[7],e[6]=n[2],e[7]=n[5],e[8]=n[8],this}setUvTransform(e,n,r,i,a,s,o){const c=Math.cos(a),u=Math.sin(a);return this.set(r*c,r*u,-r*(c*s+u*o)+s+e,-i*u,i*c,-i*(-u*s+c*o)+o+n,0,0,1),this}scale(e,n){return this.premultiply(D_.makeScale(e,n)),this}rotate(e){return this.premultiply(D_.makeRotation(-e)),this}translate(e,n){return this.premultiply(D_.makeTranslation(e,n)),this}makeTranslation(e,n){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,n,0,0,1),this}makeRotation(e){const n=Math.cos(e),r=Math.sin(e);return this.set(n,-r,0,r,n,0,0,0,1),this}makeScale(e,n){return this.set(e,0,0,0,n,0,0,0,1),this}equals(e){const n=this.elements,r=e.elements;for(let i=0;i<9;i++)if(n[i]!==r[i])return!1;return!0}fromArray(e,n=0){for(let r=0;r<9;r++)this.elements[r]=e[r+n];return this}toArray(e=[],n=0){const r=this.elements;return e[n]=r[0],e[n+1]=r[1],e[n+2]=r[2],e[n+3]=r[3],e[n+4]=r[4],e[n+5]=r[5],e[n+6]=r[6],e[n+7]=r[7],e[n+8]=r[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const D_=new pn,ZP=new pn().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),JP=new pn().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Kle(){const t={enabled:!0,workingColorSpace:tu,spaces:{},convert:function(i,a,s){return this.enabled===!1||a===s||!a||!s||(this.spaces[a].transfer===qn&&(i.r=Co(i.r),i.g=Co(i.g),i.b=Co(i.b)),this.spaces[a].primaries!==this.spaces[s].primaries&&(i.applyMatrix3(this.spaces[a].toXYZ),i.applyMatrix3(this.spaces[s].fromXYZ)),this.spaces[s].transfer===qn&&(i.r=Rd(i.r),i.g=Rd(i.g),i.b=Rd(i.b))),i},workingToColorSpace:function(i,a){return this.convert(i,this.workingColorSpace,a)},colorSpaceToWorking:function(i,a){return this.convert(i,a,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===xl?gy:this.spaces[i].transfer},getToneMappingMode:function(i){return this.spaces[i].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(i,a=this.workingColorSpace){return i.fromArray(this.spaces[a].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,a,s){return i.copy(this.spaces[a].toXYZ).multiply(this.spaces[s].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,a){return xy("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),t.workingToColorSpace(i,a)},toWorkingColorSpace:function(i,a){return xy("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),t.colorSpaceToWorking(i,a)}},e=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],r=[.3127,.329];return t.define({[tu]:{primaries:e,whitePoint:r,transfer:gy,toXYZ:ZP,fromXYZ:JP,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:wa},outputColorSpaceConfig:{drawingBufferColorSpace:wa}},[wa]:{primaries:e,whitePoint:r,transfer:qn,toXYZ:ZP,fromXYZ:JP,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:wa}}}),t}const jn=Kle();function Co(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function Rd(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}let Ju;class Zle{static getDataURL(e,n="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let r;if(e instanceof HTMLCanvasElement)r=e;else{Ju===void 0&&(Ju=vy("canvas")),Ju.width=e.width,Ju.height=e.height;const i=Ju.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),r=Ju}return r.toDataURL(n)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const n=vy("canvas");n.width=e.width,n.height=e.height;const r=n.getContext("2d");r.drawImage(e,0,0,e.width,e.height);const i=r.getImageData(0,0,e.width,e.height),a=i.data;for(let s=0;s<a.length;s++)a[s]=Co(a[s]/255)*255;return r.putImageData(i,0,0),n}else if(e.data){const n=e.data.slice(0);for(let r=0;r<n.length;r++)n instanceof Uint8Array||n instanceof Uint8ClampedArray?n[r]=Math.floor(Co(n[r]/255)*255):n[r]=Co(n[r]);return{data:n,width:e.width,height:e.height}}else return ln("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let Jle=0;class QE{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Jle++}),this.uuid=Bp(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const n=this.data;return typeof HTMLVideoElement<"u"&&n instanceof HTMLVideoElement?e.set(n.videoWidth,n.videoHeight,0):typeof VideoFrame<"u"&&n instanceof VideoFrame?e.set(n.displayHeight,n.displayWidth,0):n!==null?e.set(n.width,n.height,n.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const n=e===void 0||typeof e=="string";if(!n&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const r={uuid:this.uuid,url:""},i=this.data;if(i!==null){let a;if(Array.isArray(i)){a=[];for(let s=0,o=i.length;s<o;s++)i[s].isDataTexture?a.push(L_(i[s].image)):a.push(L_(i[s]))}else a=L_(i);r.url=a}return n||(e.images[this.uuid]=r),r}}function L_(t){return typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap?Zle.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(ln("Texture: Unable to serialize Texture."),{})}let Qle=0;const I_=new Oe;class Ti extends df{constructor(e=Ti.DEFAULT_IMAGE,n=Ti.DEFAULT_MAPPING,r=So,i=So,a=yi,s=Lc,o=es,c=Ea,u=Ti.DEFAULT_ANISOTROPY,f=xl){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Qle++}),this.uuid=Bp(),this.name="",this.source=new QE(e),this.mipmaps=[],this.mapping=n,this.channel=0,this.wrapS=r,this.wrapT=i,this.magFilter=a,this.minFilter=s,this.anisotropy=u,this.format=o,this.internalFormat=null,this.type=c,this.offset=new Gn(0,0),this.repeat=new Gn(1,1),this.center=new Gn(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new pn,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=f,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(I_).x}get height(){return this.source.getSize(I_).y}get depth(){return this.source.getSize(I_).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,n){this.updateRanges.push({start:e,count:n})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const n in e){const r=e[n];if(r===void 0){ln(`Texture.setValues(): parameter '${n}' has value of undefined.`);continue}const i=this[n];if(i===void 0){ln(`Texture.setValues(): property '${n}' does not exist.`);continue}i&&r&&i.isVector2&&r.isVector2||i&&r&&i.isVector3&&r.isVector3||i&&r&&i.isMatrix3&&r.isMatrix3?i.copy(r):this[n]=r}}toJSON(e){const n=e===void 0||typeof e=="string";if(!n&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const r={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(r.userData=this.userData),n||(e.textures[this.uuid]=r),r}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Y5)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case W1:e.x=e.x-Math.floor(e.x);break;case So:e.x=e.x<0?0:1;break;case G1:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case W1:e.y=e.y-Math.floor(e.y);break;case So:e.y=e.y<0?0:1;break;case G1:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}Ti.DEFAULT_IMAGE=null;Ti.DEFAULT_MAPPING=Y5;Ti.DEFAULT_ANISOTROPY=1;class yr{constructor(e=0,n=0,r=0,i=1){yr.prototype.isVector4=!0,this.x=e,this.y=n,this.z=r,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,n,r,i){return this.x=e,this.y=n,this.z=r,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,n){switch(e){case 0:this.x=n;break;case 1:this.y=n;break;case 2:this.z=n;break;case 3:this.w=n;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,n){return this.x=e.x+n.x,this.y=e.y+n.y,this.z=e.z+n.z,this.w=e.w+n.w,this}addScaledVector(e,n){return this.x+=e.x*n,this.y+=e.y*n,this.z+=e.z*n,this.w+=e.w*n,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,n){return this.x=e.x-n.x,this.y=e.y-n.y,this.z=e.z-n.z,this.w=e.w-n.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const n=this.x,r=this.y,i=this.z,a=this.w,s=e.elements;return this.x=s[0]*n+s[4]*r+s[8]*i+s[12]*a,this.y=s[1]*n+s[5]*r+s[9]*i+s[13]*a,this.z=s[2]*n+s[6]*r+s[10]*i+s[14]*a,this.w=s[3]*n+s[7]*r+s[11]*i+s[15]*a,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const n=Math.sqrt(1-e.w*e.w);return n<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/n,this.y=e.y/n,this.z=e.z/n),this}setAxisAngleFromRotationMatrix(e){let n,r,i,a;const c=e.elements,u=c[0],f=c[4],h=c[8],p=c[1],y=c[5],v=c[9],w=c[2],b=c[6],_=c[10];if(Math.abs(f-p)<.01&&Math.abs(h-w)<.01&&Math.abs(v-b)<.01){if(Math.abs(f+p)<.1&&Math.abs(h+w)<.1&&Math.abs(v+b)<.1&&Math.abs(u+y+_-3)<.1)return this.set(1,0,0,0),this;n=Math.PI;const M=(u+1)/2,T=(y+1)/2,R=(_+1)/2,A=(f+p)/4,P=(h+w)/4,k=(v+b)/4;return M>T&&M>R?M<.01?(r=0,i=.707106781,a=.707106781):(r=Math.sqrt(M),i=A/r,a=P/r):T>R?T<.01?(r=.707106781,i=0,a=.707106781):(i=Math.sqrt(T),r=A/i,a=k/i):R<.01?(r=.707106781,i=.707106781,a=0):(a=Math.sqrt(R),r=P/a,i=k/a),this.set(r,i,a,n),this}let E=Math.sqrt((b-v)*(b-v)+(h-w)*(h-w)+(p-f)*(p-f));return Math.abs(E)<.001&&(E=1),this.x=(b-v)/E,this.y=(h-w)/E,this.z=(p-f)/E,this.w=Math.acos((u+y+_-1)/2),this}setFromMatrixPosition(e){const n=e.elements;return this.x=n[12],this.y=n[13],this.z=n[14],this.w=n[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,n){return this.x=Dn(this.x,e.x,n.x),this.y=Dn(this.y,e.y,n.y),this.z=Dn(this.z,e.z,n.z),this.w=Dn(this.w,e.w,n.w),this}clampScalar(e,n){return this.x=Dn(this.x,e,n),this.y=Dn(this.y,e,n),this.z=Dn(this.z,e,n),this.w=Dn(this.w,e,n),this}clampLength(e,n){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Dn(r,e,n))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,n){return this.x+=(e.x-this.x)*n,this.y+=(e.y-this.y)*n,this.z+=(e.z-this.z)*n,this.w+=(e.w-this.w)*n,this}lerpVectors(e,n,r){return this.x=e.x+(n.x-e.x)*r,this.y=e.y+(n.y-e.y)*r,this.z=e.z+(n.z-e.z)*r,this.w=e.w+(n.w-e.w)*r,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,n=0){return this.x=e[n],this.y=e[n+1],this.z=e[n+2],this.w=e[n+3],this}toArray(e=[],n=0){return e[n]=this.x,e[n+1]=this.y,e[n+2]=this.z,e[n+3]=this.w,e}fromBufferAttribute(e,n){return this.x=e.getX(n),this.y=e.getY(n),this.z=e.getZ(n),this.w=e.getW(n),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class ece extends df{constructor(e=1,n=1,r={}){super(),r=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:yi,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},r),this.isRenderTarget=!0,this.width=e,this.height=n,this.depth=r.depth,this.scissor=new yr(0,0,e,n),this.scissorTest=!1,this.viewport=new yr(0,0,e,n),this.textures=[];const i={width:e,height:n,depth:r.depth},a=new Ti(i),s=r.count;for(let o=0;o<s;o++)this.textures[o]=a.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this._setTextureOptions(r),this.depthBuffer=r.depthBuffer,this.stencilBuffer=r.stencilBuffer,this.resolveDepthBuffer=r.resolveDepthBuffer,this.resolveStencilBuffer=r.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=r.depthTexture,this.samples=r.samples,this.multiview=r.multiview}_setTextureOptions(e={}){const n={minFilter:yi,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(n.mapping=e.mapping),e.wrapS!==void 0&&(n.wrapS=e.wrapS),e.wrapT!==void 0&&(n.wrapT=e.wrapT),e.wrapR!==void 0&&(n.wrapR=e.wrapR),e.magFilter!==void 0&&(n.magFilter=e.magFilter),e.minFilter!==void 0&&(n.minFilter=e.minFilter),e.format!==void 0&&(n.format=e.format),e.type!==void 0&&(n.type=e.type),e.anisotropy!==void 0&&(n.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(n.colorSpace=e.colorSpace),e.flipY!==void 0&&(n.flipY=e.flipY),e.generateMipmaps!==void 0&&(n.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(n.internalFormat=e.internalFormat);for(let r=0;r<this.textures.length;r++)this.textures[r].setValues(n)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,n,r=1){if(this.width!==e||this.height!==n||this.depth!==r){this.width=e,this.height=n,this.depth=r;for(let i=0,a=this.textures.length;i<a;i++)this.textures[i].image.width=e,this.textures[i].image.height=n,this.textures[i].image.depth=r,this.textures[i].isData3DTexture!==!0&&(this.textures[i].isArrayTexture=this.textures[i].image.depth>1);this.dispose()}this.viewport.set(0,0,e,n),this.scissor.set(0,0,e,n)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let n=0,r=e.textures.length;n<r;n++){this.textures[n]=e.textures[n].clone(),this.textures[n].isRenderTargetTexture=!0,this.textures[n].renderTarget=this;const i=Object.assign({},e.textures[n].image);this.textures[n].source=new QE(i)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Fs extends ece{constructor(e=1,n=1,r={}){super(e,n,r),this.isWebGLRenderTarget=!0}}class nU extends Ti{constructor(e=null,n=1,r=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:n,height:r,depth:i},this.magFilter=ni,this.minFilter=ni,this.wrapR=So,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class tce extends Ti{constructor(e=null,n=1,r=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:n,height:r,depth:i},this.magFilter=ni,this.minFilter=ni,this.wrapR=So,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Nr{constructor(e,n,r,i,a,s,o,c,u,f,h,p,y,v,w,b){Nr.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,n,r,i,a,s,o,c,u,f,h,p,y,v,w,b)}set(e,n,r,i,a,s,o,c,u,f,h,p,y,v,w,b){const _=this.elements;return _[0]=e,_[4]=n,_[8]=r,_[12]=i,_[1]=a,_[5]=s,_[9]=o,_[13]=c,_[2]=u,_[6]=f,_[10]=h,_[14]=p,_[3]=y,_[7]=v,_[11]=w,_[15]=b,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Nr().fromArray(this.elements)}copy(e){const n=this.elements,r=e.elements;return n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=r[3],n[4]=r[4],n[5]=r[5],n[6]=r[6],n[7]=r[7],n[8]=r[8],n[9]=r[9],n[10]=r[10],n[11]=r[11],n[12]=r[12],n[13]=r[13],n[14]=r[14],n[15]=r[15],this}copyPosition(e){const n=this.elements,r=e.elements;return n[12]=r[12],n[13]=r[13],n[14]=r[14],this}setFromMatrix3(e){const n=e.elements;return this.set(n[0],n[3],n[6],0,n[1],n[4],n[7],0,n[2],n[5],n[8],0,0,0,0,1),this}extractBasis(e,n,r){return this.determinant()===0?(e.set(1,0,0),n.set(0,1,0),r.set(0,0,1),this):(e.setFromMatrixColumn(this,0),n.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this)}makeBasis(e,n,r){return this.set(e.x,n.x,r.x,0,e.y,n.y,r.y,0,e.z,n.z,r.z,0,0,0,0,1),this}extractRotation(e){if(e.determinant()===0)return this.identity();const n=this.elements,r=e.elements,i=1/Qu.setFromMatrixColumn(e,0).length(),a=1/Qu.setFromMatrixColumn(e,1).length(),s=1/Qu.setFromMatrixColumn(e,2).length();return n[0]=r[0]*i,n[1]=r[1]*i,n[2]=r[2]*i,n[3]=0,n[4]=r[4]*a,n[5]=r[5]*a,n[6]=r[6]*a,n[7]=0,n[8]=r[8]*s,n[9]=r[9]*s,n[10]=r[10]*s,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromEuler(e){const n=this.elements,r=e.x,i=e.y,a=e.z,s=Math.cos(r),o=Math.sin(r),c=Math.cos(i),u=Math.sin(i),f=Math.cos(a),h=Math.sin(a);if(e.order==="XYZ"){const p=s*f,y=s*h,v=o*f,w=o*h;n[0]=c*f,n[4]=-c*h,n[8]=u,n[1]=y+v*u,n[5]=p-w*u,n[9]=-o*c,n[2]=w-p*u,n[6]=v+y*u,n[10]=s*c}else if(e.order==="YXZ"){const p=c*f,y=c*h,v=u*f,w=u*h;n[0]=p+w*o,n[4]=v*o-y,n[8]=s*u,n[1]=s*h,n[5]=s*f,n[9]=-o,n[2]=y*o-v,n[6]=w+p*o,n[10]=s*c}else if(e.order==="ZXY"){const p=c*f,y=c*h,v=u*f,w=u*h;n[0]=p-w*o,n[4]=-s*h,n[8]=v+y*o,n[1]=y+v*o,n[5]=s*f,n[9]=w-p*o,n[2]=-s*u,n[6]=o,n[10]=s*c}else if(e.order==="ZYX"){const p=s*f,y=s*h,v=o*f,w=o*h;n[0]=c*f,n[4]=v*u-y,n[8]=p*u+w,n[1]=c*h,n[5]=w*u+p,n[9]=y*u-v,n[2]=-u,n[6]=o*c,n[10]=s*c}else if(e.order==="YZX"){const p=s*c,y=s*u,v=o*c,w=o*u;n[0]=c*f,n[4]=w-p*h,n[8]=v*h+y,n[1]=h,n[5]=s*f,n[9]=-o*f,n[2]=-u*f,n[6]=y*h+v,n[10]=p-w*h}else if(e.order==="XZY"){const p=s*c,y=s*u,v=o*c,w=o*u;n[0]=c*f,n[4]=-h,n[8]=u*f,n[1]=p*h+w,n[5]=s*f,n[9]=y*h-v,n[2]=v*h-y,n[6]=o*f,n[10]=w*h+p}return n[3]=0,n[7]=0,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this}makeRotationFromQuaternion(e){return this.compose(nce,e,rce)}lookAt(e,n,r){const i=this.elements;return Qi.subVectors(e,n),Qi.lengthSq()===0&&(Qi.z=1),Qi.normalize(),ol.crossVectors(r,Qi),ol.lengthSq()===0&&(Math.abs(r.z)===1?Qi.x+=1e-4:Qi.z+=1e-4,Qi.normalize(),ol.crossVectors(r,Qi)),ol.normalize(),Ag.crossVectors(Qi,ol),i[0]=ol.x,i[4]=Ag.x,i[8]=Qi.x,i[1]=ol.y,i[5]=Ag.y,i[9]=Qi.y,i[2]=ol.z,i[6]=Ag.z,i[10]=Qi.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,n){const r=e.elements,i=n.elements,a=this.elements,s=r[0],o=r[4],c=r[8],u=r[12],f=r[1],h=r[5],p=r[9],y=r[13],v=r[2],w=r[6],b=r[10],_=r[14],E=r[3],M=r[7],T=r[11],R=r[15],A=i[0],P=i[4],k=i[8],N=i[12],j=i[1],L=i[5],z=i[9],U=i[13],V=i[2],W=i[6],K=i[10],Q=i[14],O=i[3],G=i[7],Y=i[11],H=i[15];return a[0]=s*A+o*j+c*V+u*O,a[4]=s*P+o*L+c*W+u*G,a[8]=s*k+o*z+c*K+u*Y,a[12]=s*N+o*U+c*Q+u*H,a[1]=f*A+h*j+p*V+y*O,a[5]=f*P+h*L+p*W+y*G,a[9]=f*k+h*z+p*K+y*Y,a[13]=f*N+h*U+p*Q+y*H,a[2]=v*A+w*j+b*V+_*O,a[6]=v*P+w*L+b*W+_*G,a[10]=v*k+w*z+b*K+_*Y,a[14]=v*N+w*U+b*Q+_*H,a[3]=E*A+M*j+T*V+R*O,a[7]=E*P+M*L+T*W+R*G,a[11]=E*k+M*z+T*K+R*Y,a[15]=E*N+M*U+T*Q+R*H,this}multiplyScalar(e){const n=this.elements;return n[0]*=e,n[4]*=e,n[8]*=e,n[12]*=e,n[1]*=e,n[5]*=e,n[9]*=e,n[13]*=e,n[2]*=e,n[6]*=e,n[10]*=e,n[14]*=e,n[3]*=e,n[7]*=e,n[11]*=e,n[15]*=e,this}determinant(){const e=this.elements,n=e[0],r=e[4],i=e[8],a=e[12],s=e[1],o=e[5],c=e[9],u=e[13],f=e[2],h=e[6],p=e[10],y=e[14],v=e[3],w=e[7],b=e[11],_=e[15],E=c*y-u*p,M=o*y-u*h,T=o*p-c*h,R=s*y-u*f,A=s*p-c*f,P=s*h-o*f;return n*(w*E-b*M+_*T)-r*(v*E-b*R+_*A)+i*(v*M-w*R+_*P)-a*(v*T-w*A+b*P)}transpose(){const e=this.elements;let n;return n=e[1],e[1]=e[4],e[4]=n,n=e[2],e[2]=e[8],e[8]=n,n=e[6],e[6]=e[9],e[9]=n,n=e[3],e[3]=e[12],e[12]=n,n=e[7],e[7]=e[13],e[13]=n,n=e[11],e[11]=e[14],e[14]=n,this}setPosition(e,n,r){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=n,i[14]=r),this}invert(){const e=this.elements,n=e[0],r=e[1],i=e[2],a=e[3],s=e[4],o=e[5],c=e[6],u=e[7],f=e[8],h=e[9],p=e[10],y=e[11],v=e[12],w=e[13],b=e[14],_=e[15],E=n*o-r*s,M=n*c-i*s,T=n*u-a*s,R=r*c-i*o,A=r*u-a*o,P=i*u-a*c,k=f*w-h*v,N=f*b-p*v,j=f*_-y*v,L=h*b-p*w,z=h*_-y*w,U=p*_-y*b,V=E*U-M*z+T*L+R*j-A*N+P*k;if(V===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const W=1/V;return e[0]=(o*U-c*z+u*L)*W,e[1]=(i*z-r*U-a*L)*W,e[2]=(w*P-b*A+_*R)*W,e[3]=(p*A-h*P-y*R)*W,e[4]=(c*j-s*U-u*N)*W,e[5]=(n*U-i*j+a*N)*W,e[6]=(b*T-v*P-_*M)*W,e[7]=(f*P-p*T+y*M)*W,e[8]=(s*z-o*j+u*k)*W,e[9]=(r*j-n*z-a*k)*W,e[10]=(v*A-w*T+_*E)*W,e[11]=(h*T-f*A-y*E)*W,e[12]=(o*N-s*L-c*k)*W,e[13]=(n*L-r*N+i*k)*W,e[14]=(w*M-v*R-b*E)*W,e[15]=(f*R-h*M+p*E)*W,this}scale(e){const n=this.elements,r=e.x,i=e.y,a=e.z;return n[0]*=r,n[4]*=i,n[8]*=a,n[1]*=r,n[5]*=i,n[9]*=a,n[2]*=r,n[6]*=i,n[10]*=a,n[3]*=r,n[7]*=i,n[11]*=a,this}getMaxScaleOnAxis(){const e=this.elements,n=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(n,r,i))}makeTranslation(e,n,r){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,n,0,0,1,r,0,0,0,1),this}makeRotationX(e){const n=Math.cos(e),r=Math.sin(e);return this.set(1,0,0,0,0,n,-r,0,0,r,n,0,0,0,0,1),this}makeRotationY(e){const n=Math.cos(e),r=Math.sin(e);return this.set(n,0,r,0,0,1,0,0,-r,0,n,0,0,0,0,1),this}makeRotationZ(e){const n=Math.cos(e),r=Math.sin(e);return this.set(n,-r,0,0,r,n,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,n){const r=Math.cos(n),i=Math.sin(n),a=1-r,s=e.x,o=e.y,c=e.z,u=a*s,f=a*o;return this.set(u*s+r,u*o-i*c,u*c+i*o,0,u*o+i*c,f*o+r,f*c-i*s,0,u*c-i*o,f*c+i*s,a*c*c+r,0,0,0,0,1),this}makeScale(e,n,r){return this.set(e,0,0,0,0,n,0,0,0,0,r,0,0,0,0,1),this}makeShear(e,n,r,i,a,s){return this.set(1,r,a,0,e,1,s,0,n,i,1,0,0,0,0,1),this}compose(e,n,r){const i=this.elements,a=n._x,s=n._y,o=n._z,c=n._w,u=a+a,f=s+s,h=o+o,p=a*u,y=a*f,v=a*h,w=s*f,b=s*h,_=o*h,E=c*u,M=c*f,T=c*h,R=r.x,A=r.y,P=r.z;return i[0]=(1-(w+_))*R,i[1]=(y+T)*R,i[2]=(v-M)*R,i[3]=0,i[4]=(y-T)*A,i[5]=(1-(p+_))*A,i[6]=(b+E)*A,i[7]=0,i[8]=(v+M)*P,i[9]=(b-E)*P,i[10]=(1-(p+w))*P,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,n,r){const i=this.elements;e.x=i[12],e.y=i[13],e.z=i[14];const a=this.determinant();if(a===0)return r.set(1,1,1),n.identity(),this;let s=Qu.set(i[0],i[1],i[2]).length();const o=Qu.set(i[4],i[5],i[6]).length(),c=Qu.set(i[8],i[9],i[10]).length();a<0&&(s=-s),Wa.copy(this);const u=1/s,f=1/o,h=1/c;return Wa.elements[0]*=u,Wa.elements[1]*=u,Wa.elements[2]*=u,Wa.elements[4]*=f,Wa.elements[5]*=f,Wa.elements[6]*=f,Wa.elements[8]*=h,Wa.elements[9]*=h,Wa.elements[10]*=h,n.setFromRotationMatrix(Wa),r.x=s,r.y=o,r.z=c,this}makePerspective(e,n,r,i,a,s,o=Ns,c=!1){const u=this.elements,f=2*a/(n-e),h=2*a/(r-i),p=(n+e)/(n-e),y=(r+i)/(r-i);let v,w;if(c)v=a/(s-a),w=s*a/(s-a);else if(o===Ns)v=-(s+a)/(s-a),w=-2*s*a/(s-a);else if(o===yy)v=-s/(s-a),w=-s*a/(s-a);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return u[0]=f,u[4]=0,u[8]=p,u[12]=0,u[1]=0,u[5]=h,u[9]=y,u[13]=0,u[2]=0,u[6]=0,u[10]=v,u[14]=w,u[3]=0,u[7]=0,u[11]=-1,u[15]=0,this}makeOrthographic(e,n,r,i,a,s,o=Ns,c=!1){const u=this.elements,f=2/(n-e),h=2/(r-i),p=-(n+e)/(n-e),y=-(r+i)/(r-i);let v,w;if(c)v=1/(s-a),w=s/(s-a);else if(o===Ns)v=-2/(s-a),w=-(s+a)/(s-a);else if(o===yy)v=-1/(s-a),w=-a/(s-a);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return u[0]=f,u[4]=0,u[8]=0,u[12]=p,u[1]=0,u[5]=h,u[9]=0,u[13]=y,u[2]=0,u[6]=0,u[10]=v,u[14]=w,u[3]=0,u[7]=0,u[11]=0,u[15]=1,this}equals(e){const n=this.elements,r=e.elements;for(let i=0;i<16;i++)if(n[i]!==r[i])return!1;return!0}fromArray(e,n=0){for(let r=0;r<16;r++)this.elements[r]=e[r+n];return this}toArray(e=[],n=0){const r=this.elements;return e[n]=r[0],e[n+1]=r[1],e[n+2]=r[2],e[n+3]=r[3],e[n+4]=r[4],e[n+5]=r[5],e[n+6]=r[6],e[n+7]=r[7],e[n+8]=r[8],e[n+9]=r[9],e[n+10]=r[10],e[n+11]=r[11],e[n+12]=r[12],e[n+13]=r[13],e[n+14]=r[14],e[n+15]=r[15],e}}const Qu=new Oe,Wa=new Nr,nce=new Oe(0,0,0),rce=new Oe(1,1,1),ol=new Oe,Ag=new Oe,Qi=new Oe,QP=new Nr,eN=new ff;let nu=class rU{constructor(e=0,n=0,r=0,i=rU.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=n,this._z=r,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,n,r,i=this._order){return this._x=e,this._y=n,this._z=r,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,n=this._order,r=!0){const i=e.elements,a=i[0],s=i[4],o=i[8],c=i[1],u=i[5],f=i[9],h=i[2],p=i[6],y=i[10];switch(n){case"XYZ":this._y=Math.asin(Dn(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-f,y),this._z=Math.atan2(-s,a)):(this._x=Math.atan2(p,u),this._z=0);break;case"YXZ":this._x=Math.asin(-Dn(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(o,y),this._z=Math.atan2(c,u)):(this._y=Math.atan2(-h,a),this._z=0);break;case"ZXY":this._x=Math.asin(Dn(p,-1,1)),Math.abs(p)<.9999999?(this._y=Math.atan2(-h,y),this._z=Math.atan2(-s,u)):(this._y=0,this._z=Math.atan2(c,a));break;case"ZYX":this._y=Math.asin(-Dn(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(p,y),this._z=Math.atan2(c,a)):(this._x=0,this._z=Math.atan2(-s,u));break;case"YZX":this._z=Math.asin(Dn(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-f,u),this._y=Math.atan2(-h,a)):(this._x=0,this._y=Math.atan2(o,y));break;case"XZY":this._z=Math.asin(-Dn(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(p,u),this._y=Math.atan2(o,a)):(this._x=Math.atan2(-f,y),this._y=0);break;default:ln("Euler: .setFromRotationMatrix() encountered an unknown order: "+n)}return this._order=n,r===!0&&this._onChangeCallback(),this}setFromQuaternion(e,n,r){return QP.makeRotationFromQuaternion(e),this.setFromRotationMatrix(QP,n,r)}setFromVector3(e,n=this._order){return this.set(e.x,e.y,e.z,n)}reorder(e){return eN.setFromEuler(this),this.setFromQuaternion(eN,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],n=0){return e[n]=this._x,e[n+1]=this._y,e[n+2]=this._z,e[n+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};nu.DEFAULT_ORDER="XYZ";class iU{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let ice=0;const tN=new Oe,ed=new ff,uo=new Nr,Rg=new Oe,fh=new Oe,ace=new Oe,sce=new ff,nN=new Oe(1,0,0),rN=new Oe(0,1,0),iN=new Oe(0,0,1),aN={type:"added"},oce={type:"removed"},td={type:"childadded",child:null},O_={type:"childremoved",child:null};class la extends df{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:ice++}),this.uuid=Bp(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=la.DEFAULT_UP.clone();const e=new Oe,n=new nu,r=new ff,i=new Oe(1,1,1);function a(){r.setFromEuler(n,!1)}function s(){n.setFromQuaternion(r,void 0,!1)}n._onChange(a),r._onChange(s),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:n},quaternion:{configurable:!0,enumerable:!0,value:r},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Nr},normalMatrix:{value:new pn}}),this.matrix=new Nr,this.matrixWorld=new Nr,this.matrixAutoUpdate=la.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=la.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new iU,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,n){this.quaternion.setFromAxisAngle(e,n)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,n){return ed.setFromAxisAngle(e,n),this.quaternion.multiply(ed),this}rotateOnWorldAxis(e,n){return ed.setFromAxisAngle(e,n),this.quaternion.premultiply(ed),this}rotateX(e){return this.rotateOnAxis(nN,e)}rotateY(e){return this.rotateOnAxis(rN,e)}rotateZ(e){return this.rotateOnAxis(iN,e)}translateOnAxis(e,n){return tN.copy(e).applyQuaternion(this.quaternion),this.position.add(tN.multiplyScalar(n)),this}translateX(e){return this.translateOnAxis(nN,e)}translateY(e){return this.translateOnAxis(rN,e)}translateZ(e){return this.translateOnAxis(iN,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(uo.copy(this.matrixWorld).invert())}lookAt(e,n,r){e.isVector3?Rg.copy(e):Rg.set(e,n,r);const i=this.parent;this.updateWorldMatrix(!0,!1),fh.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?uo.lookAt(fh,Rg,this.up):uo.lookAt(Rg,fh,this.up),this.quaternion.setFromRotationMatrix(uo),i&&(uo.extractRotation(i.matrixWorld),ed.setFromRotationMatrix(uo),this.quaternion.premultiply(ed.invert()))}add(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.add(arguments[n]);return this}return e===this?(Vn("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(aN),td.child=e,this.dispatchEvent(td),td.child=null):Vn("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let r=0;r<arguments.length;r++)this.remove(arguments[r]);return this}const n=this.children.indexOf(e);return n!==-1&&(e.parent=null,this.children.splice(n,1),e.dispatchEvent(oce),O_.child=e,this.dispatchEvent(O_),O_.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),uo.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),uo.multiply(e.parent.matrixWorld)),e.applyMatrix4(uo),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(aN),td.child=e,this.dispatchEvent(td),td.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,n){if(this[e]===n)return this;for(let r=0,i=this.children.length;r<i;r++){const s=this.children[r].getObjectByProperty(e,n);if(s!==void 0)return s}}getObjectsByProperty(e,n,r=[]){this[e]===n&&r.push(this);const i=this.children;for(let a=0,s=i.length;a<s;a++)i[a].getObjectsByProperty(e,n,r);return r}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(fh,e,ace),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(fh,sce,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const n=this.matrixWorld.elements;return e.set(n[8],n[9],n[10]).normalize()}raycast(){}traverse(e){e(this);const n=this.children;for(let r=0,i=n.length;r<i;r++)n[r].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const n=this.children;for(let r=0,i=n.length;r<i;r++)n[r].traverseVisible(e)}traverseAncestors(e){const n=this.parent;n!==null&&(e(n),n.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);const e=this.pivot;if(e!==null){const n=e.x,r=e.y,i=e.z,a=this.matrix.elements;a[12]+=n-a[0]*n-a[4]*r-a[8]*i,a[13]+=r-a[1]*n-a[5]*r-a[9]*i,a[14]+=i-a[2]*n-a[6]*r-a[10]*i}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const n=this.children;for(let r=0,i=n.length;r<i;r++)n[r].updateMatrixWorld(e)}updateWorldMatrix(e,n){const r=this.parent;if(e===!0&&r!==null&&r.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),n===!0){const i=this.children;for(let a=0,s=i.length;a<s;a++)i[a].updateWorldMatrix(!1,!0)}}toJSON(e){const n=e===void 0||typeof e=="string",r={};n&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},r.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),this.static!==!1&&(i.static=this.static),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.pivot!==null&&(i.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(i.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(i.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(o=>({...o})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function a(o,c){return o[c.uuid]===void 0&&(o[c.uuid]=c.toJSON(e)),c.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=a(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const c=o.shapes;if(Array.isArray(c))for(let u=0,f=c.length;u<f;u++){const h=c[u];a(e.shapes,h)}else a(e.shapes,c)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(a(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let c=0,u=this.material.length;c<u;c++)o.push(a(e.materials,this.material[c]));i.material=o}else i.material=a(e.materials,this.material);if(this.children.length>0){i.children=[];for(let o=0;o<this.children.length;o++)i.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let o=0;o<this.animations.length;o++){const c=this.animations[o];i.animations.push(a(e.animations,c))}}if(n){const o=s(e.geometries),c=s(e.materials),u=s(e.textures),f=s(e.images),h=s(e.shapes),p=s(e.skeletons),y=s(e.animations),v=s(e.nodes);o.length>0&&(r.geometries=o),c.length>0&&(r.materials=c),u.length>0&&(r.textures=u),f.length>0&&(r.images=f),h.length>0&&(r.shapes=h),p.length>0&&(r.skeletons=p),y.length>0&&(r.animations=y),v.length>0&&(r.nodes=v)}return r.object=i,r;function s(o){const c=[];for(const u in o){const f=o[u];delete f.metadata,c.push(f)}return c}}clone(e){return new this.constructor().copy(this,e)}copy(e,n=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),e.pivot!==null&&(this.pivot=e.pivot.clone()),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),n===!0)for(let r=0;r<e.children.length;r++){const i=e.children[r];this.add(i.clone())}return this}}la.DEFAULT_UP=new Oe(0,1,0);la.DEFAULT_MATRIX_AUTO_UPDATE=!0;la.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class Pg extends la{constructor(){super(),this.isGroup=!0,this.type="Group"}}const lce={type:"move"};class F_{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Pg,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new Pg,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Oe,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Oe),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Pg,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Oe,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Oe),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const n=this._hand;if(n)for(const r of e.hand.values())this._getHandJoint(n,r)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,n,r){let i=null,a=null,s=null;const o=this._targetRay,c=this._grip,u=this._hand;if(e&&n.session.visibilityState!=="visible-blurred"){if(u&&e.hand){s=!0;for(const w of e.hand.values()){const b=n.getJointPose(w,r),_=this._getHandJoint(u,w);b!==null&&(_.matrix.fromArray(b.transform.matrix),_.matrix.decompose(_.position,_.rotation,_.scale),_.matrixWorldNeedsUpdate=!0,_.jointRadius=b.radius),_.visible=b!==null}const f=u.joints["index-finger-tip"],h=u.joints["thumb-tip"],p=f.position.distanceTo(h.position),y=.02,v=.005;u.inputState.pinching&&p>y+v?(u.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!u.inputState.pinching&&p<=y-v&&(u.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else c!==null&&e.gripSpace&&(a=n.getPose(e.gripSpace,r),a!==null&&(c.matrix.fromArray(a.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,a.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(a.linearVelocity)):c.hasLinearVelocity=!1,a.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(a.angularVelocity)):c.hasAngularVelocity=!1));o!==null&&(i=n.getPose(e.targetRaySpace,r),i===null&&a!==null&&(i=a),i!==null&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(lce)))}return o!==null&&(o.visible=i!==null),c!==null&&(c.visible=a!==null),u!==null&&(u.visible=s!==null),this}_getHandJoint(e,n){if(e.joints[n.jointName]===void 0){const r=new Pg;r.matrixAutoUpdate=!1,r.visible=!1,e.joints[n.jointName]=r,e.add(r)}return e.joints[n.jointName]}}const aU={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},ll={h:0,s:0,l:0},Ng={h:0,s:0,l:0};function U_(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*6*(2/3-n):t}class Zn{constructor(e,n,r){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,n,r)}set(e,n,r){if(n===void 0&&r===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,n,r);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,n=wa){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,jn.colorSpaceToWorking(this,n),this}setRGB(e,n,r,i=jn.workingColorSpace){return this.r=e,this.g=n,this.b=r,jn.colorSpaceToWorking(this,i),this}setHSL(e,n,r,i=jn.workingColorSpace){if(e=Xle(e,1),n=Dn(n,0,1),r=Dn(r,0,1),n===0)this.r=this.g=this.b=r;else{const a=r<=.5?r*(1+n):r+n-r*n,s=2*r-a;this.r=U_(s,a,e+1/3),this.g=U_(s,a,e),this.b=U_(s,a,e-1/3)}return jn.colorSpaceToWorking(this,i),this}setStyle(e,n=wa){function r(a){a!==void 0&&parseFloat(a)<1&&ln("Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let a;const s=i[1],o=i[2];switch(s){case"rgb":case"rgba":if(a=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return r(a[4]),this.setRGB(Math.min(255,parseInt(a[1],10))/255,Math.min(255,parseInt(a[2],10))/255,Math.min(255,parseInt(a[3],10))/255,n);if(a=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return r(a[4]),this.setRGB(Math.min(100,parseInt(a[1],10))/100,Math.min(100,parseInt(a[2],10))/100,Math.min(100,parseInt(a[3],10))/100,n);break;case"hsl":case"hsla":if(a=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return r(a[4]),this.setHSL(parseFloat(a[1])/360,parseFloat(a[2])/100,parseFloat(a[3])/100,n);break;default:ln("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const a=i[1],s=a.length;if(s===3)return this.setRGB(parseInt(a.charAt(0),16)/15,parseInt(a.charAt(1),16)/15,parseInt(a.charAt(2),16)/15,n);if(s===6)return this.setHex(parseInt(a,16),n);ln("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}setColorName(e,n=wa){const r=aU[e.toLowerCase()];return r!==void 0?this.setHex(r,n):ln("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Co(e.r),this.g=Co(e.g),this.b=Co(e.b),this}copyLinearToSRGB(e){return this.r=Rd(e.r),this.g=Rd(e.g),this.b=Rd(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=wa){return jn.workingToColorSpace(di.copy(this),e),Math.round(Dn(di.r*255,0,255))*65536+Math.round(Dn(di.g*255,0,255))*256+Math.round(Dn(di.b*255,0,255))}getHexString(e=wa){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,n=jn.workingColorSpace){jn.workingToColorSpace(di.copy(this),n);const r=di.r,i=di.g,a=di.b,s=Math.max(r,i,a),o=Math.min(r,i,a);let c,u;const f=(o+s)/2;if(o===s)c=0,u=0;else{const h=s-o;switch(u=f<=.5?h/(s+o):h/(2-s-o),s){case r:c=(i-a)/h+(i<a?6:0);break;case i:c=(a-r)/h+2;break;case a:c=(r-i)/h+4;break}c/=6}return e.h=c,e.s=u,e.l=f,e}getRGB(e,n=jn.workingColorSpace){return jn.workingToColorSpace(di.copy(this),n),e.r=di.r,e.g=di.g,e.b=di.b,e}getStyle(e=wa){jn.workingToColorSpace(di.copy(this),e);const n=di.r,r=di.g,i=di.b;return e!==wa?`color(${e} ${n.toFixed(3)} ${r.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(n*255)},${Math.round(r*255)},${Math.round(i*255)})`}offsetHSL(e,n,r){return this.getHSL(ll),this.setHSL(ll.h+e,ll.s+n,ll.l+r)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,n){return this.r=e.r+n.r,this.g=e.g+n.g,this.b=e.b+n.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,n){return this.r+=(e.r-this.r)*n,this.g+=(e.g-this.g)*n,this.b+=(e.b-this.b)*n,this}lerpColors(e,n,r){return this.r=e.r+(n.r-e.r)*r,this.g=e.g+(n.g-e.g)*r,this.b=e.b+(n.b-e.b)*r,this}lerpHSL(e,n){this.getHSL(ll),e.getHSL(Ng);const r=P_(ll.h,Ng.h,n),i=P_(ll.s,Ng.s,n),a=P_(ll.l,Ng.l,n);return this.setHSL(r,i,a),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const n=this.r,r=this.g,i=this.b,a=e.elements;return this.r=a[0]*n+a[3]*r+a[6]*i,this.g=a[1]*n+a[4]*r+a[7]*i,this.b=a[2]*n+a[5]*r+a[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,n=0){return this.r=e[n],this.g=e[n+1],this.b=e[n+2],this}toArray(e=[],n=0){return e[n]=this.r,e[n+1]=this.g,e[n+2]=this.b,e}fromBufferAttribute(e,n){return this.r=e.getX(n),this.g=e.getY(n),this.b=e.getZ(n),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const di=new Zn;Zn.NAMES=aU;class cce extends la{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new nu,this.environmentIntensity=1,this.environmentRotation=new nu,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,n){return super.copy(e,n),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const n=super.toJSON(e);return this.fog!==null&&(n.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(n.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(n.object.backgroundIntensity=this.backgroundIntensity),n.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(n.object.environmentIntensity=this.environmentIntensity),n.object.environmentRotation=this.environmentRotation.toArray(),n}}const Ga=new Oe,fo=new Oe,j_=new Oe,ho=new Oe,nd=new Oe,rd=new Oe,sN=new Oe,B_=new Oe,z_=new Oe,V_=new Oe,H_=new yr,W_=new yr,G_=new yr;let hh=class yd{constructor(e=new Oe,n=new Oe,r=new Oe){this.a=e,this.b=n,this.c=r}static getNormal(e,n,r,i){i.subVectors(r,n),Ga.subVectors(e,n),i.cross(Ga);const a=i.lengthSq();return a>0?i.multiplyScalar(1/Math.sqrt(a)):i.set(0,0,0)}static getBarycoord(e,n,r,i,a){Ga.subVectors(i,n),fo.subVectors(r,n),j_.subVectors(e,n);const s=Ga.dot(Ga),o=Ga.dot(fo),c=Ga.dot(j_),u=fo.dot(fo),f=fo.dot(j_),h=s*u-o*o;if(h===0)return a.set(0,0,0),null;const p=1/h,y=(u*c-o*f)*p,v=(s*f-o*c)*p;return a.set(1-y-v,v,y)}static containsPoint(e,n,r,i){return this.getBarycoord(e,n,r,i,ho)===null?!1:ho.x>=0&&ho.y>=0&&ho.x+ho.y<=1}static getInterpolation(e,n,r,i,a,s,o,c){return this.getBarycoord(e,n,r,i,ho)===null?(c.x=0,c.y=0,"z"in c&&(c.z=0),"w"in c&&(c.w=0),null):(c.setScalar(0),c.addScaledVector(a,ho.x),c.addScaledVector(s,ho.y),c.addScaledVector(o,ho.z),c)}static getInterpolatedAttribute(e,n,r,i,a,s){return H_.setScalar(0),W_.setScalar(0),G_.setScalar(0),H_.fromBufferAttribute(e,n),W_.fromBufferAttribute(e,r),G_.fromBufferAttribute(e,i),s.setScalar(0),s.addScaledVector(H_,a.x),s.addScaledVector(W_,a.y),s.addScaledVector(G_,a.z),s}static isFrontFacing(e,n,r,i){return Ga.subVectors(r,n),fo.subVectors(e,n),Ga.cross(fo).dot(i)<0}set(e,n,r){return this.a.copy(e),this.b.copy(n),this.c.copy(r),this}setFromPointsAndIndices(e,n,r,i){return this.a.copy(e[n]),this.b.copy(e[r]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,n,r,i){return this.a.fromBufferAttribute(e,n),this.b.fromBufferAttribute(e,r),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Ga.subVectors(this.c,this.b),fo.subVectors(this.a,this.b),Ga.cross(fo).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return yd.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,n){return yd.getBarycoord(e,this.a,this.b,this.c,n)}getInterpolation(e,n,r,i,a){return yd.getInterpolation(e,this.a,this.b,this.c,n,r,i,a)}containsPoint(e){return yd.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return yd.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,n){const r=this.a,i=this.b,a=this.c;let s,o;nd.subVectors(i,r),rd.subVectors(a,r),B_.subVectors(e,r);const c=nd.dot(B_),u=rd.dot(B_);if(c<=0&&u<=0)return n.copy(r);z_.subVectors(e,i);const f=nd.dot(z_),h=rd.dot(z_);if(f>=0&&h<=f)return n.copy(i);const p=c*h-f*u;if(p<=0&&c>=0&&f<=0)return s=c/(c-f),n.copy(r).addScaledVector(nd,s);V_.subVectors(e,a);const y=nd.dot(V_),v=rd.dot(V_);if(v>=0&&y<=v)return n.copy(a);const w=y*u-c*v;if(w<=0&&u>=0&&v<=0)return o=u/(u-v),n.copy(r).addScaledVector(rd,o);const b=f*v-y*h;if(b<=0&&h-f>=0&&y-v>=0)return sN.subVectors(a,i),o=(h-f)/(h-f+(y-v)),n.copy(i).addScaledVector(sN,o);const _=1/(b+w+p);return s=w*_,o=p*_,n.copy(r).addScaledVector(nd,s).addScaledVector(rd,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}};class zp{constructor(e=new Oe(1/0,1/0,1/0),n=new Oe(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=n}set(e,n){return this.min.copy(e),this.max.copy(n),this}setFromArray(e){this.makeEmpty();for(let n=0,r=e.length;n<r;n+=3)this.expandByPoint($a.fromArray(e,n));return this}setFromBufferAttribute(e){this.makeEmpty();for(let n=0,r=e.count;n<r;n++)this.expandByPoint($a.fromBufferAttribute(e,n));return this}setFromPoints(e){this.makeEmpty();for(let n=0,r=e.length;n<r;n++)this.expandByPoint(e[n]);return this}setFromCenterAndSize(e,n){const r=$a.copy(n).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this}setFromObject(e,n=!1){return this.makeEmpty(),this.expandByObject(e,n)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,n=!1){e.updateWorldMatrix(!1,!1);const r=e.geometry;if(r!==void 0){const a=r.getAttribute("position");if(n===!0&&a!==void 0&&e.isInstancedMesh!==!0)for(let s=0,o=a.count;s<o;s++)e.isMesh===!0?e.getVertexPosition(s,$a):$a.fromBufferAttribute(a,s),$a.applyMatrix4(e.matrixWorld),this.expandByPoint($a);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Dg.copy(e.boundingBox)):(r.boundingBox===null&&r.computeBoundingBox(),Dg.copy(r.boundingBox)),Dg.applyMatrix4(e.matrixWorld),this.union(Dg)}const i=e.children;for(let a=0,s=i.length;a<s;a++)this.expandByObject(i[a],n);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,n){return n.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,$a),$a.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let n,r;return e.normal.x>0?(n=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(n=e.normal.x*this.max.x,r=e.normal.x*this.min.x),e.normal.y>0?(n+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(n+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),e.normal.z>0?(n+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(n+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),n<=-e.constant&&r>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(ph),Lg.subVectors(this.max,ph),id.subVectors(e.a,ph),ad.subVectors(e.b,ph),sd.subVectors(e.c,ph),cl.subVectors(ad,id),ul.subVectors(sd,ad),mc.subVectors(id,sd);let n=[0,-cl.z,cl.y,0,-ul.z,ul.y,0,-mc.z,mc.y,cl.z,0,-cl.x,ul.z,0,-ul.x,mc.z,0,-mc.x,-cl.y,cl.x,0,-ul.y,ul.x,0,-mc.y,mc.x,0];return!$_(n,id,ad,sd,Lg)||(n=[1,0,0,0,1,0,0,0,1],!$_(n,id,ad,sd,Lg))?!1:(Ig.crossVectors(cl,ul),n=[Ig.x,Ig.y,Ig.z],$_(n,id,ad,sd,Lg))}clampPoint(e,n){return n.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,$a).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize($a).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(po[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),po[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),po[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),po[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),po[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),po[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),po[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),po[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(po),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const po=[new Oe,new Oe,new Oe,new Oe,new Oe,new Oe,new Oe,new Oe],$a=new Oe,Dg=new zp,id=new Oe,ad=new Oe,sd=new Oe,cl=new Oe,ul=new Oe,mc=new Oe,ph=new Oe,Lg=new Oe,Ig=new Oe,gc=new Oe;function $_(t,e,n,r,i){for(let a=0,s=t.length-3;a<=s;a+=3){gc.fromArray(t,a);const o=i.x*Math.abs(gc.x)+i.y*Math.abs(gc.y)+i.z*Math.abs(gc.z),c=e.dot(gc),u=n.dot(gc),f=r.dot(gc);if(Math.max(-Math.max(c,u,f),Math.min(c,u,f))>o)return!1}return!0}const Er=new Oe,Og=new Gn;let uce=0;class is{constructor(e,n,r=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:uce++}),this.name="",this.array=e,this.itemSize=n,this.count=e!==void 0?e.length/n:0,this.normalized=r,this.usage=$P,this.updateRanges=[],this.gpuType=Ps,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,n){this.updateRanges.push({start:e,count:n})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,n,r){e*=this.itemSize,r*=n.itemSize;for(let i=0,a=this.itemSize;i<a;i++)this.array[e+i]=n.array[r+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let n=0,r=this.count;n<r;n++)Og.fromBufferAttribute(this,n),Og.applyMatrix3(e),this.setXY(n,Og.x,Og.y);else if(this.itemSize===3)for(let n=0,r=this.count;n<r;n++)Er.fromBufferAttribute(this,n),Er.applyMatrix3(e),this.setXYZ(n,Er.x,Er.y,Er.z);return this}applyMatrix4(e){for(let n=0,r=this.count;n<r;n++)Er.fromBufferAttribute(this,n),Er.applyMatrix4(e),this.setXYZ(n,Er.x,Er.y,Er.z);return this}applyNormalMatrix(e){for(let n=0,r=this.count;n<r;n++)Er.fromBufferAttribute(this,n),Er.applyNormalMatrix(e),this.setXYZ(n,Er.x,Er.y,Er.z);return this}transformDirection(e){for(let n=0,r=this.count;n<r;n++)Er.fromBufferAttribute(this,n),Er.transformDirection(e),this.setXYZ(n,Er.x,Er.y,Er.z);return this}set(e,n=0){return this.array.set(e,n),this}getComponent(e,n){let r=this.array[e*this.itemSize+n];return this.normalized&&(r=dh(r,this.array)),r}setComponent(e,n,r){return this.normalized&&(r=Ii(r,this.array)),this.array[e*this.itemSize+n]=r,this}getX(e){let n=this.array[e*this.itemSize];return this.normalized&&(n=dh(n,this.array)),n}setX(e,n){return this.normalized&&(n=Ii(n,this.array)),this.array[e*this.itemSize]=n,this}getY(e){let n=this.array[e*this.itemSize+1];return this.normalized&&(n=dh(n,this.array)),n}setY(e,n){return this.normalized&&(n=Ii(n,this.array)),this.array[e*this.itemSize+1]=n,this}getZ(e){let n=this.array[e*this.itemSize+2];return this.normalized&&(n=dh(n,this.array)),n}setZ(e,n){return this.normalized&&(n=Ii(n,this.array)),this.array[e*this.itemSize+2]=n,this}getW(e){let n=this.array[e*this.itemSize+3];return this.normalized&&(n=dh(n,this.array)),n}setW(e,n){return this.normalized&&(n=Ii(n,this.array)),this.array[e*this.itemSize+3]=n,this}setXY(e,n,r){return e*=this.itemSize,this.normalized&&(n=Ii(n,this.array),r=Ii(r,this.array)),this.array[e+0]=n,this.array[e+1]=r,this}setXYZ(e,n,r,i){return e*=this.itemSize,this.normalized&&(n=Ii(n,this.array),r=Ii(r,this.array),i=Ii(i,this.array)),this.array[e+0]=n,this.array[e+1]=r,this.array[e+2]=i,this}setXYZW(e,n,r,i,a){return e*=this.itemSize,this.normalized&&(n=Ii(n,this.array),r=Ii(r,this.array),i=Ii(i,this.array),a=Ii(a,this.array)),this.array[e+0]=n,this.array[e+1]=r,this.array[e+2]=i,this.array[e+3]=a,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==$P&&(e.usage=this.usage),e}}class sU extends is{constructor(e,n,r){super(new Uint16Array(e),n,r)}}class oU extends is{constructor(e,n,r){super(new Uint32Array(e),n,r)}}class Ao extends is{constructor(e,n,r){super(new Float32Array(e),n,r)}}const dce=new zp,mh=new Oe,Y_=new Oe;class eM{constructor(e=new Oe,n=-1){this.isSphere=!0,this.center=e,this.radius=n}set(e,n){return this.center.copy(e),this.radius=n,this}setFromPoints(e,n){const r=this.center;n!==void 0?r.copy(n):dce.setFromPoints(e).getCenter(r);let i=0;for(let a=0,s=e.length;a<s;a++)i=Math.max(i,r.distanceToSquared(e[a]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const n=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=n*n}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,n){const r=this.center.distanceToSquared(e);return n.copy(e),r>this.radius*this.radius&&(n.sub(this.center).normalize(),n.multiplyScalar(this.radius).add(this.center)),n}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;mh.subVectors(e,this.center);const n=mh.lengthSq();if(n>this.radius*this.radius){const r=Math.sqrt(n),i=(r-this.radius)*.5;this.center.addScaledVector(mh,i/r),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Y_.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(mh.copy(e.center).add(Y_)),this.expandByPoint(mh.copy(e.center).sub(Y_))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}let fce=0;const va=new Nr,q_=new la,od=new Oe,ea=new zp,gh=new zp,Yr=new Oe;class Js extends df{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:fce++}),this.uuid=Bp(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(Gle(e)?oU:sU)(e,1):this.index=e,this}setIndirect(e,n=0){return this.indirect=e,this.indirectOffset=n,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,n){return this.attributes[e]=n,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,n,r=0){this.groups.push({start:e,count:n,materialIndex:r})}clearGroups(){this.groups=[]}setDrawRange(e,n){this.drawRange.start=e,this.drawRange.count=n}applyMatrix4(e){const n=this.attributes.position;n!==void 0&&(n.applyMatrix4(e),n.needsUpdate=!0);const r=this.attributes.normal;if(r!==void 0){const a=new pn().getNormalMatrix(e);r.applyNormalMatrix(a),r.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return va.makeRotationFromQuaternion(e),this.applyMatrix4(va),this}rotateX(e){return va.makeRotationX(e),this.applyMatrix4(va),this}rotateY(e){return va.makeRotationY(e),this.applyMatrix4(va),this}rotateZ(e){return va.makeRotationZ(e),this.applyMatrix4(va),this}translate(e,n,r){return va.makeTranslation(e,n,r),this.applyMatrix4(va),this}scale(e,n,r){return va.makeScale(e,n,r),this.applyMatrix4(va),this}lookAt(e){return q_.lookAt(e),q_.updateMatrix(),this.applyMatrix4(q_.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(od).negate(),this.translate(od.x,od.y,od.z),this}setFromPoints(e){const n=this.getAttribute("position");if(n===void 0){const r=[];for(let i=0,a=e.length;i<a;i++){const s=e[i];r.push(s.x,s.y,s.z||0)}this.setAttribute("position",new Ao(r,3))}else{const r=Math.min(e.length,n.count);for(let i=0;i<r;i++){const a=e[i];n.setXYZ(i,a.x,a.y,a.z||0)}e.length>n.count&&ln("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),n.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new zp);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Vn("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new Oe(-1/0,-1/0,-1/0),new Oe(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),n)for(let r=0,i=n.length;r<i;r++){const a=n[r];ea.setFromBufferAttribute(a),this.morphTargetsRelative?(Yr.addVectors(this.boundingBox.min,ea.min),this.boundingBox.expandByPoint(Yr),Yr.addVectors(this.boundingBox.max,ea.max),this.boundingBox.expandByPoint(Yr)):(this.boundingBox.expandByPoint(ea.min),this.boundingBox.expandByPoint(ea.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Vn('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new eM);const e=this.attributes.position,n=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Vn("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new Oe,1/0);return}if(e){const r=this.boundingSphere.center;if(ea.setFromBufferAttribute(e),n)for(let a=0,s=n.length;a<s;a++){const o=n[a];gh.setFromBufferAttribute(o),this.morphTargetsRelative?(Yr.addVectors(ea.min,gh.min),ea.expandByPoint(Yr),Yr.addVectors(ea.max,gh.max),ea.expandByPoint(Yr)):(ea.expandByPoint(gh.min),ea.expandByPoint(gh.max))}ea.getCenter(r);let i=0;for(let a=0,s=e.count;a<s;a++)Yr.fromBufferAttribute(e,a),i=Math.max(i,r.distanceToSquared(Yr));if(n)for(let a=0,s=n.length;a<s;a++){const o=n[a],c=this.morphTargetsRelative;for(let u=0,f=o.count;u<f;u++)Yr.fromBufferAttribute(o,u),c&&(od.fromBufferAttribute(e,u),Yr.add(od)),i=Math.max(i,r.distanceToSquared(Yr))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&Vn('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,n=this.attributes;if(e===null||n.position===void 0||n.normal===void 0||n.uv===void 0){Vn("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const r=n.position,i=n.normal,a=n.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new is(new Float32Array(4*r.count),4));const s=this.getAttribute("tangent"),o=[],c=[];for(let k=0;k<r.count;k++)o[k]=new Oe,c[k]=new Oe;const u=new Oe,f=new Oe,h=new Oe,p=new Gn,y=new Gn,v=new Gn,w=new Oe,b=new Oe;function _(k,N,j){u.fromBufferAttribute(r,k),f.fromBufferAttribute(r,N),h.fromBufferAttribute(r,j),p.fromBufferAttribute(a,k),y.fromBufferAttribute(a,N),v.fromBufferAttribute(a,j),f.sub(u),h.sub(u),y.sub(p),v.sub(p);const L=1/(y.x*v.y-v.x*y.y);isFinite(L)&&(w.copy(f).multiplyScalar(v.y).addScaledVector(h,-y.y).multiplyScalar(L),b.copy(h).multiplyScalar(y.x).addScaledVector(f,-v.x).multiplyScalar(L),o[k].add(w),o[N].add(w),o[j].add(w),c[k].add(b),c[N].add(b),c[j].add(b))}let E=this.groups;E.length===0&&(E=[{start:0,count:e.count}]);for(let k=0,N=E.length;k<N;++k){const j=E[k],L=j.start,z=j.count;for(let U=L,V=L+z;U<V;U+=3)_(e.getX(U+0),e.getX(U+1),e.getX(U+2))}const M=new Oe,T=new Oe,R=new Oe,A=new Oe;function P(k){R.fromBufferAttribute(i,k),A.copy(R);const N=o[k];M.copy(N),M.sub(R.multiplyScalar(R.dot(N))).normalize(),T.crossVectors(A,N);const L=T.dot(c[k])<0?-1:1;s.setXYZW(k,M.x,M.y,M.z,L)}for(let k=0,N=E.length;k<N;++k){const j=E[k],L=j.start,z=j.count;for(let U=L,V=L+z;U<V;U+=3)P(e.getX(U+0)),P(e.getX(U+1)),P(e.getX(U+2))}}computeVertexNormals(){const e=this.index,n=this.getAttribute("position");if(n!==void 0){let r=this.getAttribute("normal");if(r===void 0)r=new is(new Float32Array(n.count*3),3),this.setAttribute("normal",r);else for(let p=0,y=r.count;p<y;p++)r.setXYZ(p,0,0,0);const i=new Oe,a=new Oe,s=new Oe,o=new Oe,c=new Oe,u=new Oe,f=new Oe,h=new Oe;if(e)for(let p=0,y=e.count;p<y;p+=3){const v=e.getX(p+0),w=e.getX(p+1),b=e.getX(p+2);i.fromBufferAttribute(n,v),a.fromBufferAttribute(n,w),s.fromBufferAttribute(n,b),f.subVectors(s,a),h.subVectors(i,a),f.cross(h),o.fromBufferAttribute(r,v),c.fromBufferAttribute(r,w),u.fromBufferAttribute(r,b),o.add(f),c.add(f),u.add(f),r.setXYZ(v,o.x,o.y,o.z),r.setXYZ(w,c.x,c.y,c.z),r.setXYZ(b,u.x,u.y,u.z)}else for(let p=0,y=n.count;p<y;p+=3)i.fromBufferAttribute(n,p+0),a.fromBufferAttribute(n,p+1),s.fromBufferAttribute(n,p+2),f.subVectors(s,a),h.subVectors(i,a),f.cross(h),r.setXYZ(p+0,f.x,f.y,f.z),r.setXYZ(p+1,f.x,f.y,f.z),r.setXYZ(p+2,f.x,f.y,f.z);this.normalizeNormals(),r.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let n=0,r=e.count;n<r;n++)Yr.fromBufferAttribute(e,n),Yr.normalize(),e.setXYZ(n,Yr.x,Yr.y,Yr.z)}toNonIndexed(){function e(o,c){const u=o.array,f=o.itemSize,h=o.normalized,p=new u.constructor(c.length*f);let y=0,v=0;for(let w=0,b=c.length;w<b;w++){o.isInterleavedBufferAttribute?y=c[w]*o.data.stride+o.offset:y=c[w]*f;for(let _=0;_<f;_++)p[v++]=u[y++]}return new is(p,f,h)}if(this.index===null)return ln("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const n=new Js,r=this.index.array,i=this.attributes;for(const o in i){const c=i[o],u=e(c,r);n.setAttribute(o,u)}const a=this.morphAttributes;for(const o in a){const c=[],u=a[o];for(let f=0,h=u.length;f<h;f++){const p=u[f],y=e(p,r);c.push(y)}n.morphAttributes[o]=c}n.morphTargetsRelative=this.morphTargetsRelative;const s=this.groups;for(let o=0,c=s.length;o<c;o++){const u=s[o];n.addGroup(u.start,u.count,u.materialIndex)}return n}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const c=this.parameters;for(const u in c)c[u]!==void 0&&(e[u]=c[u]);return e}e.data={attributes:{}};const n=this.index;n!==null&&(e.data.index={type:n.array.constructor.name,array:Array.prototype.slice.call(n.array)});const r=this.attributes;for(const c in r){const u=r[c];e.data.attributes[c]=u.toJSON(e.data)}const i={};let a=!1;for(const c in this.morphAttributes){const u=this.morphAttributes[c],f=[];for(let h=0,p=u.length;h<p;h++){const y=u[h];f.push(y.toJSON(e.data))}f.length>0&&(i[c]=f,a=!0)}a&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const s=this.groups;s.length>0&&(e.data.groups=JSON.parse(JSON.stringify(s)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const n={};this.name=e.name;const r=e.index;r!==null&&this.setIndex(r.clone());const i=e.attributes;for(const u in i){const f=i[u];this.setAttribute(u,f.clone(n))}const a=e.morphAttributes;for(const u in a){const f=[],h=a[u];for(let p=0,y=h.length;p<y;p++)f.push(h[p].clone(n));this.morphAttributes[u]=f}this.morphTargetsRelative=e.morphTargetsRelative;const s=e.groups;for(let u=0,f=s.length;u<f;u++){const h=s[u];this.addGroup(h.start,h.count,h.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const c=e.boundingSphere;return c!==null&&(this.boundingSphere=c.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}let hce=0;class dv extends df{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:hce++}),this.uuid=Bp(),this.name="",this.type="Material",this.blending=Bc,this.side=Il,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=I1,this.blendDst=O1,this.blendEquation=Ec,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Zn(0,0,0),this.blendAlpha=0,this.depthFunc=Gd,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=GP,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Zu,this.stencilZFail=Zu,this.stencilZPass=Zu,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const n in e){const r=e[n];if(r===void 0){ln(`Material: parameter '${n}' has value of undefined.`);continue}const i=this[n];if(i===void 0){ln(`Material: '${n}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(r):i&&i.isVector3&&r&&r.isVector3?i.copy(r):this[n]=r}}toJSON(e){const n=e===void 0||typeof e=="string";n&&(e={textures:{},images:{}});const r={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.color&&this.color.isColor&&(r.color=this.color.getHex()),this.roughness!==void 0&&(r.roughness=this.roughness),this.metalness!==void 0&&(r.metalness=this.metalness),this.sheen!==void 0&&(r.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(r.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(r.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(r.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(r.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(r.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(r.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(r.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(r.shininess=this.shininess),this.clearcoat!==void 0&&(r.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(r.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(r.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(r.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,r.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(r.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(r.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(r.dispersion=this.dispersion),this.iridescence!==void 0&&(r.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(r.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(r.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(r.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(r.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(r.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(r.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(r.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(r.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(r.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(e).uuid,r.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(r.aoMap=this.aoMap.toJSON(e).uuid,r.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(e).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(e).uuid,r.normalMapType=this.normalMapType,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(e).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(r.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(r.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(r.combine=this.combine)),this.envMapRotation!==void 0&&(r.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(r.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(r.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(r.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(r.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(r.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(r.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(r.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(r.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(r.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(r.size=this.size),this.shadowSide!==null&&(r.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(r.sizeAttenuation=this.sizeAttenuation),this.blending!==Bc&&(r.blending=this.blending),this.side!==Il&&(r.side=this.side),this.vertexColors===!0&&(r.vertexColors=!0),this.opacity<1&&(r.opacity=this.opacity),this.transparent===!0&&(r.transparent=!0),this.blendSrc!==I1&&(r.blendSrc=this.blendSrc),this.blendDst!==O1&&(r.blendDst=this.blendDst),this.blendEquation!==Ec&&(r.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(r.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(r.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(r.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(r.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(r.blendAlpha=this.blendAlpha),this.depthFunc!==Gd&&(r.depthFunc=this.depthFunc),this.depthTest===!1&&(r.depthTest=this.depthTest),this.depthWrite===!1&&(r.depthWrite=this.depthWrite),this.colorWrite===!1&&(r.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(r.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==GP&&(r.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(r.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(r.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Zu&&(r.stencilFail=this.stencilFail),this.stencilZFail!==Zu&&(r.stencilZFail=this.stencilZFail),this.stencilZPass!==Zu&&(r.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(r.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(r.rotation=this.rotation),this.polygonOffset===!0&&(r.polygonOffset=!0),this.polygonOffsetFactor!==0&&(r.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(r.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(r.linewidth=this.linewidth),this.dashSize!==void 0&&(r.dashSize=this.dashSize),this.gapSize!==void 0&&(r.gapSize=this.gapSize),this.scale!==void 0&&(r.scale=this.scale),this.dithering===!0&&(r.dithering=!0),this.alphaTest>0&&(r.alphaTest=this.alphaTest),this.alphaHash===!0&&(r.alphaHash=!0),this.alphaToCoverage===!0&&(r.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(r.premultipliedAlpha=!0),this.forceSinglePass===!0&&(r.forceSinglePass=!0),this.allowOverride===!1&&(r.allowOverride=!1),this.wireframe===!0&&(r.wireframe=!0),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(r.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(r.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(r.flatShading=!0),this.visible===!1&&(r.visible=!1),this.toneMapped===!1&&(r.toneMapped=!1),this.fog===!1&&(r.fog=!1),Object.keys(this.userData).length>0&&(r.userData=this.userData);function i(a){const s=[];for(const o in a){const c=a[o];delete c.metadata,s.push(c)}return s}if(n){const a=i(e.textures),s=i(e.images);a.length>0&&(r.textures=a),s.length>0&&(r.images=s)}return r}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const n=e.clippingPlanes;let r=null;if(n!==null){const i=n.length;r=new Array(i);for(let a=0;a!==i;++a)r[a]=n[a].clone()}return this.clippingPlanes=r,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}const mo=new Oe,X_=new Oe,Fg=new Oe,dl=new Oe,K_=new Oe,Ug=new Oe,Z_=new Oe;class pce{constructor(e=new Oe,n=new Oe(0,0,-1)){this.origin=e,this.direction=n}set(e,n){return this.origin.copy(e),this.direction.copy(n),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,n){return n.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,mo)),this}closestPointToPoint(e,n){n.subVectors(e,this.origin);const r=n.dot(this.direction);return r<0?n.copy(this.origin):n.copy(this.origin).addScaledVector(this.direction,r)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const n=mo.subVectors(e,this.origin).dot(this.direction);return n<0?this.origin.distanceToSquared(e):(mo.copy(this.origin).addScaledVector(this.direction,n),mo.distanceToSquared(e))}distanceSqToSegment(e,n,r,i){X_.copy(e).add(n).multiplyScalar(.5),Fg.copy(n).sub(e).normalize(),dl.copy(this.origin).sub(X_);const a=e.distanceTo(n)*.5,s=-this.direction.dot(Fg),o=dl.dot(this.direction),c=-dl.dot(Fg),u=dl.lengthSq(),f=Math.abs(1-s*s);let h,p,y,v;if(f>0)if(h=s*c-o,p=s*o-c,v=a*f,h>=0)if(p>=-v)if(p<=v){const w=1/f;h*=w,p*=w,y=h*(h+s*p+2*o)+p*(s*h+p+2*c)+u}else p=a,h=Math.max(0,-(s*p+o)),y=-h*h+p*(p+2*c)+u;else p=-a,h=Math.max(0,-(s*p+o)),y=-h*h+p*(p+2*c)+u;else p<=-v?(h=Math.max(0,-(-s*a+o)),p=h>0?-a:Math.min(Math.max(-a,-c),a),y=-h*h+p*(p+2*c)+u):p<=v?(h=0,p=Math.min(Math.max(-a,-c),a),y=p*(p+2*c)+u):(h=Math.max(0,-(s*a+o)),p=h>0?a:Math.min(Math.max(-a,-c),a),y=-h*h+p*(p+2*c)+u);else p=s>0?-a:a,h=Math.max(0,-(s*p+o)),y=-h*h+p*(p+2*c)+u;return r&&r.copy(this.origin).addScaledVector(this.direction,h),i&&i.copy(X_).addScaledVector(Fg,p),y}intersectSphere(e,n){mo.subVectors(e.center,this.origin);const r=mo.dot(this.direction),i=mo.dot(mo)-r*r,a=e.radius*e.radius;if(i>a)return null;const s=Math.sqrt(a-i),o=r-s,c=r+s;return c<0?null:o<0?this.at(c,n):this.at(o,n)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const n=e.normal.dot(this.direction);if(n===0)return e.distanceToPoint(this.origin)===0?0:null;const r=-(this.origin.dot(e.normal)+e.constant)/n;return r>=0?r:null}intersectPlane(e,n){const r=this.distanceToPlane(e);return r===null?null:this.at(r,n)}intersectsPlane(e){const n=e.distanceToPoint(this.origin);return n===0||e.normal.dot(this.direction)*n<0}intersectBox(e,n){let r,i,a,s,o,c;const u=1/this.direction.x,f=1/this.direction.y,h=1/this.direction.z,p=this.origin;return u>=0?(r=(e.min.x-p.x)*u,i=(e.max.x-p.x)*u):(r=(e.max.x-p.x)*u,i=(e.min.x-p.x)*u),f>=0?(a=(e.min.y-p.y)*f,s=(e.max.y-p.y)*f):(a=(e.max.y-p.y)*f,s=(e.min.y-p.y)*f),r>s||a>i||((a>r||isNaN(r))&&(r=a),(s<i||isNaN(i))&&(i=s),h>=0?(o=(e.min.z-p.z)*h,c=(e.max.z-p.z)*h):(o=(e.max.z-p.z)*h,c=(e.min.z-p.z)*h),r>c||o>i)||((o>r||r!==r)&&(r=o),(c<i||i!==i)&&(i=c),i<0)?null:this.at(r>=0?r:i,n)}intersectsBox(e){return this.intersectBox(e,mo)!==null}intersectTriangle(e,n,r,i,a){K_.subVectors(n,e),Ug.subVectors(r,e),Z_.crossVectors(K_,Ug);let s=this.direction.dot(Z_),o;if(s>0){if(i)return null;o=1}else if(s<0)o=-1,s=-s;else return null;dl.subVectors(this.origin,e);const c=o*this.direction.dot(Ug.crossVectors(dl,Ug));if(c<0)return null;const u=o*this.direction.dot(K_.cross(dl));if(u<0||c+u>s)return null;const f=-o*dl.dot(Z_);return f<0?null:this.at(f/s,a)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class lU extends dv{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Zn(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new nu,this.combine=j5,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const oN=new Nr,yc=new pce,jg=new eM,lN=new Oe,Bg=new Oe,zg=new Oe,Vg=new Oe,J_=new Oe,Hg=new Oe,cN=new Oe,Wg=new Oe;let Gs=class extends la{constructor(e=new Js,n=new lU){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=n,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,n){return super.copy(e,n),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const n=this.geometry.morphAttributes,r=Object.keys(n);if(r.length>0){const i=n[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let a=0,s=i.length;a<s;a++){const o=i[a].name||String(a);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=a}}}}getVertexPosition(e,n){const r=this.geometry,i=r.attributes.position,a=r.morphAttributes.position,s=r.morphTargetsRelative;n.fromBufferAttribute(i,e);const o=this.morphTargetInfluences;if(a&&o){Hg.set(0,0,0);for(let c=0,u=a.length;c<u;c++){const f=o[c],h=a[c];f!==0&&(J_.fromBufferAttribute(h,e),s?Hg.addScaledVector(J_,f):Hg.addScaledVector(J_.sub(n),f))}n.add(Hg)}return n}raycast(e,n){const r=this.geometry,i=this.material,a=this.matrixWorld;i!==void 0&&(r.boundingSphere===null&&r.computeBoundingSphere(),jg.copy(r.boundingSphere),jg.applyMatrix4(a),yc.copy(e.ray).recast(e.near),!(jg.containsPoint(yc.origin)===!1&&(yc.intersectSphere(jg,lN)===null||yc.origin.distanceToSquared(lN)>(e.far-e.near)**2))&&(oN.copy(a).invert(),yc.copy(e.ray).applyMatrix4(oN),!(r.boundingBox!==null&&yc.intersectsBox(r.boundingBox)===!1)&&this._computeIntersections(e,n,yc)))}_computeIntersections(e,n,r){let i;const a=this.geometry,s=this.material,o=a.index,c=a.attributes.position,u=a.attributes.uv,f=a.attributes.uv1,h=a.attributes.normal,p=a.groups,y=a.drawRange;if(o!==null)if(Array.isArray(s))for(let v=0,w=p.length;v<w;v++){const b=p[v],_=s[b.materialIndex],E=Math.max(b.start,y.start),M=Math.min(o.count,Math.min(b.start+b.count,y.start+y.count));for(let T=E,R=M;T<R;T+=3){const A=o.getX(T),P=o.getX(T+1),k=o.getX(T+2);i=Gg(this,_,e,r,u,f,h,A,P,k),i&&(i.faceIndex=Math.floor(T/3),i.face.materialIndex=b.materialIndex,n.push(i))}}else{const v=Math.max(0,y.start),w=Math.min(o.count,y.start+y.count);for(let b=v,_=w;b<_;b+=3){const E=o.getX(b),M=o.getX(b+1),T=o.getX(b+2);i=Gg(this,s,e,r,u,f,h,E,M,T),i&&(i.faceIndex=Math.floor(b/3),n.push(i))}}else if(c!==void 0)if(Array.isArray(s))for(let v=0,w=p.length;v<w;v++){const b=p[v],_=s[b.materialIndex],E=Math.max(b.start,y.start),M=Math.min(c.count,Math.min(b.start+b.count,y.start+y.count));for(let T=E,R=M;T<R;T+=3){const A=T,P=T+1,k=T+2;i=Gg(this,_,e,r,u,f,h,A,P,k),i&&(i.faceIndex=Math.floor(T/3),i.face.materialIndex=b.materialIndex,n.push(i))}}else{const v=Math.max(0,y.start),w=Math.min(c.count,y.start+y.count);for(let b=v,_=w;b<_;b+=3){const E=b,M=b+1,T=b+2;i=Gg(this,s,e,r,u,f,h,E,M,T),i&&(i.faceIndex=Math.floor(b/3),n.push(i))}}}};function mce(t,e,n,r,i,a,s,o){let c;if(e.side===zi?c=r.intersectTriangle(s,a,i,!0,o):c=r.intersectTriangle(i,a,s,e.side===Il,o),c===null)return null;Wg.copy(o),Wg.applyMatrix4(t.matrixWorld);const u=n.ray.origin.distanceTo(Wg);return u<n.near||u>n.far?null:{distance:u,point:Wg.clone(),object:t}}function Gg(t,e,n,r,i,a,s,o,c,u){t.getVertexPosition(o,Bg),t.getVertexPosition(c,zg),t.getVertexPosition(u,Vg);const f=mce(t,e,n,r,Bg,zg,Vg,cN);if(f){const h=new Oe;hh.getBarycoord(cN,Bg,zg,Vg,h),i&&(f.uv=hh.getInterpolatedAttribute(i,o,c,u,h,new Gn)),a&&(f.uv1=hh.getInterpolatedAttribute(a,o,c,u,h,new Gn)),s&&(f.normal=hh.getInterpolatedAttribute(s,o,c,u,h,new Oe),f.normal.dot(r.direction)>0&&f.normal.multiplyScalar(-1));const p={a:o,b:c,c:u,normal:new Oe,materialIndex:0};hh.getNormal(Bg,zg,Vg,p.normal),f.face=p,f.barycoord=h}return f}class gce extends Ti{constructor(e=null,n=1,r=1,i,a,s,o,c,u=ni,f=ni,h,p){super(null,s,o,c,u,f,i,a,h,p),this.isDataTexture=!0,this.image={data:e,width:n,height:r},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const Q_=new Oe,yce=new Oe,vce=new pn;class kc{constructor(e=new Oe(1,0,0),n=0){this.isPlane=!0,this.normal=e,this.constant=n}set(e,n){return this.normal.copy(e),this.constant=n,this}setComponents(e,n,r,i){return this.normal.set(e,n,r),this.constant=i,this}setFromNormalAndCoplanarPoint(e,n){return this.normal.copy(e),this.constant=-n.dot(this.normal),this}setFromCoplanarPoints(e,n,r){const i=Q_.subVectors(r,n).cross(yce.subVectors(e,n)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,n){return n.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,n){const r=e.delta(Q_),i=this.normal.dot(r);if(i===0)return this.distanceToPoint(e.start)===0?n.copy(e.start):null;const a=-(e.start.dot(this.normal)+this.constant)/i;return a<0||a>1?null:n.copy(e.start).addScaledVector(r,a)}intersectsLine(e){const n=this.distanceToPoint(e.start),r=this.distanceToPoint(e.end);return n<0&&r>0||r<0&&n>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,n){const r=n||vce.getNormalMatrix(e),i=this.coplanarPoint(Q_).applyMatrix4(e),a=this.normal.applyMatrix3(r).normalize();return this.constant=-i.dot(a),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const vc=new eM,xce=new Gn(.5,.5),$g=new Oe;class cU{constructor(e=new kc,n=new kc,r=new kc,i=new kc,a=new kc,s=new kc){this.planes=[e,n,r,i,a,s]}set(e,n,r,i,a,s){const o=this.planes;return o[0].copy(e),o[1].copy(n),o[2].copy(r),o[3].copy(i),o[4].copy(a),o[5].copy(s),this}copy(e){const n=this.planes;for(let r=0;r<6;r++)n[r].copy(e.planes[r]);return this}setFromProjectionMatrix(e,n=Ns,r=!1){const i=this.planes,a=e.elements,s=a[0],o=a[1],c=a[2],u=a[3],f=a[4],h=a[5],p=a[6],y=a[7],v=a[8],w=a[9],b=a[10],_=a[11],E=a[12],M=a[13],T=a[14],R=a[15];if(i[0].setComponents(u-s,y-f,_-v,R-E).normalize(),i[1].setComponents(u+s,y+f,_+v,R+E).normalize(),i[2].setComponents(u+o,y+h,_+w,R+M).normalize(),i[3].setComponents(u-o,y-h,_-w,R-M).normalize(),r)i[4].setComponents(c,p,b,T).normalize(),i[5].setComponents(u-c,y-p,_-b,R-T).normalize();else if(i[4].setComponents(u-c,y-p,_-b,R-T).normalize(),n===Ns)i[5].setComponents(u+c,y+p,_+b,R+T).normalize();else if(n===yy)i[5].setComponents(c,p,b,T).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+n);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),vc.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const n=e.geometry;n.boundingSphere===null&&n.computeBoundingSphere(),vc.copy(n.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(vc)}intersectsSprite(e){vc.center.set(0,0,0);const n=xce.distanceTo(e.center);return vc.radius=.7071067811865476+n,vc.applyMatrix4(e.matrixWorld),this.intersectsSphere(vc)}intersectsSphere(e){const n=this.planes,r=e.center,i=-e.radius;for(let a=0;a<6;a++)if(n[a].distanceToPoint(r)<i)return!1;return!0}intersectsBox(e){const n=this.planes;for(let r=0;r<6;r++){const i=n[r];if($g.x=i.normal.x>0?e.max.x:e.min.x,$g.y=i.normal.y>0?e.max.y:e.min.y,$g.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint($g)<0)return!1}return!0}containsPoint(e){const n=this.planes;for(let r=0;r<6;r++)if(n[r].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class uU extends Ti{constructor(e=[],n=eu,r,i,a,s,o,c,u,f){super(e,n,r,i,a,s,o,c,u,f),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class up extends Ti{constructor(e,n,r=Ws,i,a,s,o=ni,c=ni,u,f=Io,h=1){if(f!==Io&&f!==Ic)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const p={width:e,height:n,depth:h};super(p,i,a,s,o,c,f,r,u),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new QE(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const n=super.toJSON(e);return this.compareFunction!==null&&(n.compareFunction=this.compareFunction),n}}class bce extends up{constructor(e,n=Ws,r=eu,i,a,s=ni,o=ni,c,u=Io){const f={width:e,height:e,depth:1},h=[f,f,f,f,f,f];super(e,e,n,r,i,a,s,o,c,u),this.image=h,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class dU extends Ti{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class Vp extends Js{constructor(e=1,n=1,r=1,i=1,a=1,s=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:n,depth:r,widthSegments:i,heightSegments:a,depthSegments:s};const o=this;i=Math.floor(i),a=Math.floor(a),s=Math.floor(s);const c=[],u=[],f=[],h=[];let p=0,y=0;v("z","y","x",-1,-1,r,n,e,s,a,0),v("z","y","x",1,-1,r,n,-e,s,a,1),v("x","z","y",1,1,e,r,n,i,s,2),v("x","z","y",1,-1,e,r,-n,i,s,3),v("x","y","z",1,-1,e,n,r,i,a,4),v("x","y","z",-1,-1,e,n,-r,i,a,5),this.setIndex(c),this.setAttribute("position",new Ao(u,3)),this.setAttribute("normal",new Ao(f,3)),this.setAttribute("uv",new Ao(h,2));function v(w,b,_,E,M,T,R,A,P,k,N){const j=T/P,L=R/k,z=T/2,U=R/2,V=A/2,W=P+1,K=k+1;let Q=0,O=0;const G=new Oe;for(let Y=0;Y<K;Y++){const H=Y*L-U;for(let te=0;te<W;te++){const re=te*j-z;G[w]=re*E,G[b]=H*M,G[_]=V,u.push(G.x,G.y,G.z),G[w]=0,G[b]=0,G[_]=A>0?1:-1,f.push(G.x,G.y,G.z),h.push(te/P),h.push(1-Y/k),Q+=1}}for(let Y=0;Y<k;Y++)for(let H=0;H<P;H++){const te=p+H+W*Y,re=p+H+W*(Y+1),ue=p+(H+1)+W*(Y+1),ce=p+(H+1)+W*Y;c.push(te,re,ce),c.push(re,ue,ce),O+=6}o.addGroup(y,O,N),y+=O,p+=Q}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Vp(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class fv extends Js{constructor(e=1,n=1,r=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:n,widthSegments:r,heightSegments:i};const a=e/2,s=n/2,o=Math.floor(r),c=Math.floor(i),u=o+1,f=c+1,h=e/o,p=n/c,y=[],v=[],w=[],b=[];for(let _=0;_<f;_++){const E=_*p-s;for(let M=0;M<u;M++){const T=M*h-a;v.push(T,-E,0),w.push(0,0,1),b.push(M/o),b.push(1-_/c)}}for(let _=0;_<c;_++)for(let E=0;E<o;E++){const M=E+u*_,T=E+u*(_+1),R=E+1+u*(_+1),A=E+1+u*_;y.push(M,T,A),y.push(T,R,A)}this.setIndex(y),this.setAttribute("position",new Ao(v,3)),this.setAttribute("normal",new Ao(w,3)),this.setAttribute("uv",new Ao(b,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new fv(e.width,e.height,e.widthSegments,e.heightSegments)}}function qd(t){const e={};for(const n in t){e[n]={};for(const r in t[n]){const i=t[n][r];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?i.isRenderTargetTexture?(ln("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[n][r]=null):e[n][r]=i.clone():Array.isArray(i)?e[n][r]=i.slice():e[n][r]=i}}return e}function wi(t){const e={};for(let n=0;n<t.length;n++){const r=qd(t[n]);for(const i in r)e[i]=r[i]}return e}function _ce(t){const e=[];for(let n=0;n<t.length;n++)e.push(t[n].clone());return e}function fU(t){const e=t.getRenderTarget();return e===null?t.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:jn.workingColorSpace}const wce={clone:qd,merge:wi};var Sce=`void main() {
808
808
  gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
809
809
  }`,kce=`void main() {
810
810
  gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );