heyio 1.13.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +162 -278
- package/dist/api/middleware/auth.d.ts +14 -0
- package/dist/api/middleware/auth.d.ts.map +1 -0
- package/dist/api/middleware/auth.js +66 -0
- package/dist/api/middleware/auth.js.map +1 -0
- package/dist/api/notifications.d.ts +14 -0
- package/dist/api/notifications.d.ts.map +1 -0
- package/dist/api/notifications.js +112 -0
- package/dist/api/notifications.js.map +1 -0
- package/dist/api/routes/activity.d.ts +3 -0
- package/dist/api/routes/activity.d.ts.map +1 -0
- package/dist/api/routes/activity.js +28 -0
- package/dist/api/routes/activity.js.map +1 -0
- package/dist/api/routes/attachments.d.ts +3 -0
- package/dist/api/routes/attachments.d.ts.map +1 -0
- package/dist/api/routes/attachments.js +83 -0
- package/dist/api/routes/attachments.js.map +1 -0
- package/dist/api/routes/config.d.ts +3 -0
- package/dist/api/routes/config.d.ts.map +1 -0
- package/dist/api/routes/config.js +106 -0
- package/dist/api/routes/config.js.map +1 -0
- package/dist/api/routes/conversations.d.ts +3 -0
- package/dist/api/routes/conversations.d.ts.map +1 -0
- package/dist/api/routes/conversations.js +69 -0
- package/dist/api/routes/conversations.js.map +1 -0
- package/dist/api/routes/health.d.ts +3 -0
- package/dist/api/routes/health.d.ts.map +1 -0
- package/dist/api/routes/health.js +16 -0
- package/dist/api/routes/health.js.map +1 -0
- package/dist/api/routes/inbox.d.ts +3 -0
- package/dist/api/routes/inbox.d.ts.map +1 -0
- package/dist/api/routes/inbox.js +88 -0
- package/dist/api/routes/inbox.js.map +1 -0
- package/dist/api/routes/schedules.d.ts +3 -0
- package/dist/api/routes/schedules.d.ts.map +1 -0
- package/dist/api/routes/schedules.js +96 -0
- package/dist/api/routes/schedules.js.map +1 -0
- package/dist/api/routes/skills.d.ts +2 -0
- package/dist/api/routes/skills.d.ts.map +1 -0
- package/dist/api/routes/skills.js +85 -0
- package/dist/api/routes/skills.js.map +1 -0
- package/dist/api/routes/squads.d.ts +3 -0
- package/dist/api/routes/squads.d.ts.map +1 -0
- package/dist/api/routes/squads.js +129 -0
- package/dist/api/routes/squads.js.map +1 -0
- package/dist/api/routes/usage.d.ts +3 -0
- package/dist/api/routes/usage.d.ts.map +1 -0
- package/dist/api/routes/usage.js +55 -0
- package/dist/api/routes/usage.js.map +1 -0
- package/dist/api/routes/wiki.d.ts +2 -0
- package/dist/api/routes/wiki.d.ts.map +1 -0
- package/dist/api/routes/wiki.js +43 -0
- package/dist/api/routes/wiki.js.map +1 -0
- package/dist/api/server.d.ts +7 -0
- package/dist/api/server.d.ts.map +1 -0
- package/dist/api/server.js +136 -634
- package/dist/api/server.js.map +1 -0
- package/dist/config.d.ts +3 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +2 -91
- package/dist/config.js.map +1 -0
- package/dist/copilot/client.d.ts +5 -0
- package/dist/copilot/client.d.ts.map +1 -0
- package/dist/copilot/client.js +19 -11
- package/dist/copilot/client.js.map +1 -0
- package/dist/copilot/health-monitor.d.ts +14 -0
- package/dist/copilot/health-monitor.d.ts.map +1 -0
- package/dist/copilot/health-monitor.js +70 -0
- package/dist/copilot/health-monitor.js.map +1 -0
- package/dist/copilot/orchestrator.d.ts +5 -0
- package/dist/copilot/orchestrator.d.ts.map +1 -0
- package/dist/copilot/orchestrator.js +127 -123
- package/dist/copilot/orchestrator.js.map +1 -0
- package/dist/copilot/tools.d.ts +49 -0
- package/dist/copilot/tools.d.ts.map +1 -0
- package/dist/copilot/tools.js +545 -321
- package/dist/copilot/tools.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +82 -26
- package/dist/index.js.map +1 -0
- package/dist/logging/logger.d.ts +6 -0
- package/dist/logging/logger.d.ts.map +1 -0
- package/dist/logging/logger.js +21 -0
- package/dist/logging/logger.js.map +1 -0
- package/dist/models/index.d.ts +6 -0
- package/dist/models/index.d.ts.map +1 -0
- package/dist/models/index.js +4 -0
- package/dist/models/index.js.map +1 -0
- package/dist/models/pricing.d.ts +25 -0
- package/dist/models/pricing.d.ts.map +1 -0
- package/dist/models/pricing.js +96 -0
- package/dist/models/pricing.js.map +1 -0
- package/dist/models/registry.d.ts +34 -0
- package/dist/models/registry.d.ts.map +1 -0
- package/dist/models/registry.js +109 -0
- package/dist/models/registry.js.map +1 -0
- package/dist/models/token-tracker.d.ts +40 -0
- package/dist/models/token-tracker.d.ts.map +1 -0
- package/dist/models/token-tracker.js +102 -0
- package/dist/models/token-tracker.js.map +1 -0
- package/dist/scheduler/engine.d.ts +9 -0
- package/dist/scheduler/engine.d.ts.map +1 -0
- package/dist/scheduler/engine.js +127 -0
- package/dist/scheduler/engine.js.map +1 -0
- package/dist/skills/index.d.ts +3 -0
- package/dist/skills/index.d.ts.map +1 -0
- package/dist/skills/index.js +2 -0
- package/dist/skills/index.js.map +1 -0
- package/dist/skills/store.d.ts +52 -0
- package/dist/skills/store.d.ts.map +1 -0
- package/dist/skills/store.js +148 -0
- package/dist/skills/store.js.map +1 -0
- package/dist/squad/agent.d.ts +46 -0
- package/dist/squad/agent.d.ts.map +1 -0
- package/dist/squad/agent.js +261 -0
- package/dist/squad/agent.js.map +1 -0
- package/dist/squad/autonomy.d.ts +16 -0
- package/dist/squad/autonomy.d.ts.map +1 -0
- package/dist/squad/autonomy.js +63 -0
- package/dist/squad/autonomy.js.map +1 -0
- package/dist/squad/event-bus.d.ts +22 -0
- package/dist/squad/event-bus.d.ts.map +1 -0
- package/dist/squad/event-bus.js +56 -0
- package/dist/squad/event-bus.js.map +1 -0
- package/dist/squad/execution/index.d.ts +12 -0
- package/dist/squad/execution/index.d.ts.map +1 -0
- package/dist/squad/execution/index.js +7 -0
- package/dist/squad/execution/index.js.map +1 -0
- package/dist/squad/execution/instance.d.ts +40 -0
- package/dist/squad/execution/instance.d.ts.map +1 -0
- package/dist/squad/execution/instance.js +138 -0
- package/dist/squad/execution/instance.js.map +1 -0
- package/dist/squad/execution/meeting.d.ts +25 -0
- package/dist/squad/execution/meeting.d.ts.map +1 -0
- package/dist/squad/execution/meeting.js +140 -0
- package/dist/squad/execution/meeting.js.map +1 -0
- package/dist/squad/execution/pr.d.ts +15 -0
- package/dist/squad/execution/pr.d.ts.map +1 -0
- package/dist/squad/execution/pr.js +93 -0
- package/dist/squad/execution/pr.js.map +1 -0
- package/dist/squad/execution/runner.d.ts +22 -0
- package/dist/squad/execution/runner.d.ts.map +1 -0
- package/dist/squad/execution/runner.js +68 -0
- package/dist/squad/execution/runner.js.map +1 -0
- package/dist/squad/execution/tasks.d.ts +11 -0
- package/dist/squad/execution/tasks.d.ts.map +1 -0
- package/dist/squad/execution/tasks.js +85 -0
- package/dist/squad/execution/tasks.js.map +1 -0
- package/dist/squad/execution/worktree.d.ts +26 -0
- package/dist/squad/execution/worktree.d.ts.map +1 -0
- package/dist/squad/execution/worktree.js +111 -0
- package/dist/squad/execution/worktree.js.map +1 -0
- package/dist/squad/hiring.d.ts +32 -0
- package/dist/squad/hiring.d.ts.map +1 -0
- package/dist/squad/hiring.js +200 -0
- package/dist/squad/hiring.js.map +1 -0
- package/dist/squad/index.d.ts +8 -0
- package/dist/squad/index.d.ts.map +1 -0
- package/dist/squad/index.js +6 -0
- package/dist/squad/index.js.map +1 -0
- package/dist/squad/manager.d.ts +48 -0
- package/dist/squad/manager.d.ts.map +1 -0
- package/dist/squad/manager.js +274 -0
- package/dist/squad/manager.js.map +1 -0
- package/dist/squad/name-generator.d.ts +16 -0
- package/dist/squad/name-generator.d.ts.map +1 -0
- package/dist/squad/name-generator.js +113 -0
- package/dist/squad/name-generator.js.map +1 -0
- package/dist/squad/roles/templates.d.ts +5 -0
- package/dist/squad/roles/templates.d.ts.map +1 -0
- package/dist/squad/roles/templates.js +102 -0
- package/dist/squad/roles/templates.js.map +1 -0
- package/dist/squad/skill-parser.d.ts +36 -0
- package/dist/squad/skill-parser.d.ts.map +1 -0
- package/dist/squad/skill-parser.js +83 -0
- package/dist/squad/skill-parser.js.map +1 -0
- package/dist/squad/source-resolver.d.ts +20 -0
- package/dist/squad/source-resolver.d.ts.map +1 -0
- package/dist/squad/source-resolver.js +52 -0
- package/dist/squad/source-resolver.js.map +1 -0
- package/dist/store/activity.d.ts +43 -0
- package/dist/store/activity.d.ts.map +1 -0
- package/dist/store/activity.js +131 -0
- package/dist/store/activity.js.map +1 -0
- package/dist/store/db.d.ts +5 -0
- package/dist/store/db.d.ts.map +1 -0
- package/dist/store/db.js +209 -248
- package/dist/store/db.js.map +1 -0
- package/dist/store/inbox.d.ts +53 -0
- package/dist/store/inbox.d.ts.map +1 -0
- package/dist/store/inbox.js +151 -0
- package/dist/store/inbox.js.map +1 -0
- package/dist/store/schedules.d.ts +53 -0
- package/dist/store/schedules.d.ts.map +1 -0
- package/dist/store/schedules.js +149 -54
- package/dist/store/schedules.js.map +1 -0
- package/dist/wiki/index.d.ts +3 -0
- package/dist/wiki/index.d.ts.map +1 -0
- package/dist/wiki/index.js +2 -0
- package/dist/wiki/index.js.map +1 -0
- package/dist/wiki/store.d.ts +49 -0
- package/dist/wiki/store.d.ts.map +1 -0
- package/dist/wiki/store.js +115 -0
- package/dist/wiki/store.js.map +1 -0
- package/node_modules/@io/shared/dist/config.d.ts +25 -0
- package/node_modules/@io/shared/dist/config.d.ts.map +1 -0
- package/node_modules/@io/shared/dist/config.js +47 -0
- package/node_modules/@io/shared/dist/config.js.map +1 -0
- package/node_modules/@io/shared/dist/constants.d.ts +13 -0
- package/node_modules/@io/shared/dist/constants.d.ts.map +1 -0
- package/node_modules/@io/shared/dist/constants.js +34 -0
- package/node_modules/@io/shared/dist/constants.js.map +1 -0
- package/node_modules/@io/shared/dist/index.d.ts +11 -0
- package/node_modules/@io/shared/dist/index.d.ts.map +1 -0
- package/node_modules/@io/shared/dist/index.js +3 -0
- package/node_modules/@io/shared/dist/index.js.map +1 -0
- package/node_modules/@io/shared/dist/types/agents.d.ts +3 -0
- package/node_modules/@io/shared/dist/types/agents.d.ts.map +1 -0
- package/node_modules/@io/shared/dist/types/agents.js +2 -0
- package/node_modules/@io/shared/dist/types/agents.js.map +1 -0
- package/node_modules/@io/shared/dist/types/api.d.ts +33 -0
- package/node_modules/@io/shared/dist/types/api.d.ts.map +1 -0
- package/node_modules/@io/shared/dist/types/api.js +2 -0
- package/node_modules/@io/shared/dist/types/api.js.map +1 -0
- package/node_modules/@io/shared/dist/types/attachments.d.ts +10 -0
- package/node_modules/@io/shared/dist/types/attachments.d.ts.map +1 -0
- package/node_modules/@io/shared/dist/types/attachments.js +2 -0
- package/node_modules/@io/shared/dist/types/attachments.js.map +1 -0
- package/node_modules/@io/shared/dist/types/events.d.ts +44 -0
- package/node_modules/@io/shared/dist/types/events.d.ts.map +1 -0
- package/node_modules/@io/shared/dist/types/events.js +2 -0
- package/node_modules/@io/shared/dist/types/events.js.map +1 -0
- package/node_modules/@io/shared/dist/types/messages.d.ts +15 -0
- package/node_modules/@io/shared/dist/types/messages.d.ts.map +1 -0
- package/node_modules/@io/shared/dist/types/messages.js +2 -0
- package/node_modules/@io/shared/dist/types/messages.js.map +1 -0
- package/node_modules/@io/shared/dist/types/squads.d.ts +43 -0
- package/node_modules/@io/shared/dist/types/squads.d.ts.map +1 -0
- package/node_modules/@io/shared/dist/types/squads.js +2 -0
- package/node_modules/@io/shared/dist/types/squads.js.map +1 -0
- package/node_modules/@io/shared/dist/types/tokens.d.ts +19 -0
- package/node_modules/@io/shared/dist/types/tokens.d.ts.map +1 -0
- package/node_modules/@io/shared/dist/types/tokens.js +2 -0
- package/node_modules/@io/shared/dist/types/tokens.js.map +1 -0
- package/node_modules/@io/shared/package.json +18 -0
- package/node_modules/@io/shared/src/config.ts +74 -0
- package/node_modules/@io/shared/src/constants.ts +36 -0
- package/node_modules/@io/shared/src/index.ts +37 -0
- package/node_modules/@io/shared/src/types/agents.ts +3 -0
- package/node_modules/@io/shared/src/types/api.ts +35 -0
- package/node_modules/@io/shared/src/types/attachments.ts +9 -0
- package/node_modules/@io/shared/src/types/events.ts +81 -0
- package/node_modules/@io/shared/src/types/messages.ts +15 -0
- package/node_modules/@io/shared/src/types/squads.ts +53 -0
- package/node_modules/@io/shared/src/types/tokens.ts +19 -0
- package/node_modules/@io/shared/tsconfig.json +9 -0
- package/node_modules/@io/shared/tsconfig.tsbuildinfo +1 -0
- package/package.json +56 -59
- package/src/api/middleware/auth.ts +76 -0
- package/src/api/notifications.ts +122 -0
- package/src/api/routes/activity.ts +29 -0
- package/src/api/routes/attachments.ts +93 -0
- package/src/api/routes/config.ts +115 -0
- package/src/api/routes/conversations.ts +87 -0
- package/src/api/routes/health.ts +18 -0
- package/src/api/routes/inbox.ts +98 -0
- package/src/api/routes/schedules.ts +121 -0
- package/src/api/routes/skills.ts +105 -0
- package/src/api/routes/squads.ts +145 -0
- package/src/api/routes/usage.ts +57 -0
- package/src/api/routes/wiki.ts +49 -0
- package/src/api/server.ts +186 -0
- package/src/config.ts +3 -0
- package/src/copilot/client.ts +42 -0
- package/src/copilot/health-monitor.ts +85 -0
- package/src/copilot/orchestrator.ts +222 -0
- package/src/copilot/tools.ts +707 -0
- package/src/index.ts +112 -0
- package/src/logging/logger.ts +26 -0
- package/src/models/index.ts +11 -0
- package/src/models/pricing.ts +121 -0
- package/src/models/registry.ts +131 -0
- package/src/models/token-tracker.ts +151 -0
- package/src/scheduler/engine.ts +146 -0
- package/src/skills/index.ts +13 -0
- package/src/skills/store.ts +188 -0
- package/src/squad/agent.ts +326 -0
- package/src/squad/autonomy.ts +78 -0
- package/src/squad/event-bus.ts +71 -0
- package/src/squad/execution/index.ts +17 -0
- package/src/squad/execution/instance.ts +186 -0
- package/src/squad/execution/meeting.ts +191 -0
- package/src/squad/execution/pr.ts +127 -0
- package/src/squad/execution/runner.ts +97 -0
- package/src/squad/execution/tasks.ts +111 -0
- package/src/squad/execution/worktree.ts +138 -0
- package/src/squad/hiring.ts +222 -0
- package/src/squad/index.ts +17 -0
- package/src/squad/manager.ts +337 -0
- package/src/squad/name-generator.ts +135 -0
- package/src/squad/roles/templates.ts +104 -0
- package/src/squad/skill-parser.ts +120 -0
- package/src/squad/source-resolver.ts +57 -0
- package/src/store/activity.ts +176 -0
- package/src/store/db.ts +237 -0
- package/src/store/inbox.ts +199 -0
- package/src/store/schedules.ts +199 -0
- package/src/wiki/index.ts +12 -0
- package/src/wiki/store.ts +139 -0
- package/tsconfig.json +9 -0
- package/LICENSE +0 -21
- package/dist/api/auth.js +0 -46
- package/dist/chat/attachments.js +0 -112
- package/dist/copilot/agents.js +0 -309
- package/dist/copilot/ceremonies.js +0 -174
- package/dist/copilot/gh-token.js +0 -64
- package/dist/copilot/io-scheduler.js +0 -79
- package/dist/copilot/model-router.js +0 -114
- package/dist/copilot/scheduler.js +0 -88
- package/dist/copilot/skills.js +0 -252
- package/dist/copilot/specialist-runner.js +0 -191
- package/dist/copilot/squad-tools.js +0 -258
- package/dist/copilot/system-message.js +0 -86
- package/dist/copilot/token-tracker.js +0 -98
- package/dist/copilot/trigger-schedule.js +0 -33
- package/dist/daemon.js +0 -67
- package/dist/logging.js +0 -27
- package/dist/mcp/config.js +0 -29
- package/dist/mcp/index.js +0 -3
- package/dist/mcp/registry.js +0 -42
- package/dist/notify.js +0 -25
- package/dist/paths.js +0 -17
- package/dist/setup.js +0 -35
- package/dist/store/agent-events.js +0 -19
- package/dist/store/audit-log.js +0 -71
- package/dist/store/conversations.js +0 -164
- package/dist/store/feed.js +0 -44
- package/dist/store/instances.js +0 -75
- package/dist/store/squad-colors.js +0 -23
- package/dist/store/squads.js +0 -60
- package/dist/store/tasks.js +0 -78
- package/dist/store/token-usage.js +0 -94
- package/dist/telegram/bot.js +0 -41
- package/dist/telegram/handlers.js +0 -42
- package/dist/watchdog.js +0 -37
- package/dist/wiki/backlinks.js +0 -51
- package/dist/wiki/fs.js +0 -108
- package/dist/wiki/search.js +0 -47
- package/web-dist/assets/AuditLogView-BzfjNXBT.js +0 -6
- package/web-dist/assets/ChatView-BdMukPKG.js +0 -1
- package/web-dist/assets/FeedView-BfPIabGr.js +0 -6
- package/web-dist/assets/HistoryView-BmEEk3Rs.js +0 -1
- package/web-dist/assets/LoginView-D7LrkeX7.js +0 -1
- package/web-dist/assets/McpView-BAP_ah3T.js +0 -1
- package/web-dist/assets/SchedulesView-CAtsUPCZ.js +0 -6
- package/web-dist/assets/SettingsView-BovjWZDa.js +0 -1
- package/web-dist/assets/SkillsView-DQSMM5LN.js +0 -16
- package/web-dist/assets/SquadDetailView-DBscu0m2.js +0 -26
- package/web-dist/assets/SquadHealthView-D686BuQo.js +0 -11
- package/web-dist/assets/SquadsView-AzMht2NJ.js +0 -6
- package/web-dist/assets/ToggleSwitch.vue_vue_type_script_setup_true_lang-DtShZAjW.js +0 -1
- package/web-dist/assets/UsageView-DiVn97aI.js +0 -16
- package/web-dist/assets/WikiView-Cn7KipkZ.js +0 -26
- package/web-dist/assets/api-D4mHJ3u0.js +0 -1
- package/web-dist/assets/arrow-left-D_qUNUWW.js +0 -6
- package/web-dist/assets/git-branch-DOM-orcl.js +0 -6
- package/web-dist/assets/index-Bo83B1LR.css +0 -1
- package/web-dist/assets/index-ELvnkQjd.js +0 -273
- package/web-dist/assets/pencil-CFsi7ufI.js +0 -6
- package/web-dist/assets/plus-BAzlGFd_.js +0 -6
- package/web-dist/assets/save-BmgCYJ1g.js +0 -6
- package/web-dist/assets/search-CS9zSIeW.js +0 -6
- package/web-dist/assets/squad-colors-B8B_Y-lz.js +0 -1
- package/web-dist/assets/trash-2-DLveUEsd.js +0 -6
- package/web-dist/assets/triangle-alert-lj4I30rL.js +0 -6
- package/web-dist/assets/x-CjXR97Fa.js +0 -6
- package/web-dist/favicon.svg +0 -10
- package/web-dist/index.html +0 -14
- package/web-dist/logo.svg +0 -10
|
@@ -1,273 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ChatView-BdMukPKG.js","assets/x-CjXR97Fa.js","assets/SquadsView-AzMht2NJ.js","assets/api-D4mHJ3u0.js","assets/squad-colors-B8B_Y-lz.js","assets/git-branch-DOM-orcl.js","assets/SquadHealthView-D686BuQo.js","assets/triangle-alert-lj4I30rL.js","assets/SquadDetailView-DBscu0m2.js","assets/trash-2-DLveUEsd.js","assets/arrow-left-D_qUNUWW.js","assets/FeedView-BfPIabGr.js","assets/SkillsView-DQSMM5LN.js","assets/plus-BAzlGFd_.js","assets/search-CS9zSIeW.js","assets/pencil-CFsi7ufI.js","assets/save-BmgCYJ1g.js","assets/McpView-BAP_ah3T.js","assets/ToggleSwitch.vue_vue_type_script_setup_true_lang-DtShZAjW.js","assets/SchedulesView-CAtsUPCZ.js","assets/HistoryView-BmEEk3Rs.js","assets/WikiView-Cn7KipkZ.js","assets/UsageView-DiVn97aI.js","assets/AuditLogView-BzfjNXBT.js","assets/SettingsView-BovjWZDa.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
var hh=Object.defineProperty;var dh=(t,e,r)=>e in t?hh(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var be=(t,e,r)=>dh(t,typeof e!="symbol"?e+"":e,r);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))n(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function r(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(s){if(s.ep)return;s.ep=!0;const i=r(s);fetch(s.href,i)}})();const fh="modulepreload",ph=function(t){return"/"+t},Jo={},Ke=function(e,r,n){let s=Promise.resolve();if(r&&r.length>0){let o=function(c){return Promise.all(c.map(u=>Promise.resolve(u).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));s=o(r.map(c=>{if(c=ph(c),c in Jo)return;Jo[c]=!0;const u=c.endsWith(".css"),h=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${h}`))return;const d=document.createElement("link");if(d.rel=u?"stylesheet":fh,u||(d.as="script"),d.crossOrigin="",d.href=c,l&&d.setAttribute("nonce",l),document.head.appendChild(d),u)return new Promise((f,p)=>{d.addEventListener("load",f),d.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return s.then(o=>{for(const a of o||[])a.status==="rejected"&&i(a.reason);return e().catch(i)})};/**
|
|
3
|
-
* @vue/shared v3.5.34
|
|
4
|
-
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
5
|
-
* @license MIT
|
|
6
|
-
**/function mo(t){const e=Object.create(null);for(const r of t.split(","))e[r]=1;return r=>r in e}const _e={},Kr=[],Nt=()=>{},Fl=()=>!1,Bs=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97),Ms=t=>t.startsWith("onUpdate:"),Ue=Object.assign,yo=(t,e)=>{const r=t.indexOf(e);r>-1&&t.splice(r,1)},gh=Object.prototype.hasOwnProperty,fe=(t,e)=>gh.call(t,e),F=Array.isArray,Gr=t=>Yn(t)==="[object Map]",sn=t=>Yn(t)==="[object Set]",Yo=t=>Yn(t)==="[object Date]",ee=t=>typeof t=="function",Te=t=>typeof t=="string",pt=t=>typeof t=="symbol",ge=t=>t!==null&&typeof t=="object",Vl=t=>(ge(t)||ee(t))&&ee(t.then)&&ee(t.catch),zl=Object.prototype.toString,Yn=t=>zl.call(t),mh=t=>Yn(t).slice(8,-1),Wl=t=>Yn(t)==="[object Object]",Hs=t=>Te(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,kn=mo(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),qs=t=>{const e=Object.create(null);return(r=>e[r]||(e[r]=t(r)))},yh=/-\w/g,et=qs(t=>t.replace(yh,e=>e.slice(1).toUpperCase())),vh=/\B([A-Z])/g,fr=qs(t=>t.replace(vh,"-$1").toLowerCase()),Fs=qs(t=>t.charAt(0).toUpperCase()+t.slice(1)),hi=qs(t=>t?`on${Fs(t)}`:""),jt=(t,e)=>!Object.is(t,e),ms=(t,...e)=>{for(let r=0;r<t.length;r++)t[r](...e)},Kl=(t,e,r,n=!1)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,writable:n,value:r})},Vs=t=>{const e=parseFloat(t);return isNaN(e)?t:e},bh=t=>{const e=Te(t)?Number(t):NaN;return isNaN(e)?t:e};let Xo;const zs=()=>Xo||(Xo=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Ws(t){if(F(t)){const e={};for(let r=0;r<t.length;r++){const n=t[r],s=Te(n)?Sh(n):Ws(n);if(s)for(const i in s)e[i]=s[i]}return e}else if(Te(t)||ge(t))return t}const _h=/;(?![^(]*\))/g,wh=/:([^]+)/,kh=/\/\*[^]*?\*\//g;function Sh(t){const e={};return t.replace(kh,"").split(_h).forEach(r=>{if(r){const n=r.split(wh);n.length>1&&(e[n[0].trim()]=n[1].trim())}}),e}function Ye(t){let e="";if(Te(t))e=t;else if(F(t))for(let r=0;r<t.length;r++){const n=Ye(t[r]);n&&(e+=n+" ")}else if(ge(t))for(const r in t)t[r]&&(e+=r+" ");return e.trim()}const Eh="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",Th=mo(Eh);function Gl(t){return!!t||t===""}function Ah(t,e){if(t.length!==e.length)return!1;let r=!0;for(let n=0;r&&n<t.length;n++)r=on(t[n],e[n]);return r}function on(t,e){if(t===e)return!0;let r=Yo(t),n=Yo(e);if(r||n)return r&&n?t.getTime()===e.getTime():!1;if(r=pt(t),n=pt(e),r||n)return t===e;if(r=F(t),n=F(e),r||n)return r&&n?Ah(t,e):!1;if(r=ge(t),n=ge(e),r||n){if(!r||!n)return!1;const s=Object.keys(t).length,i=Object.keys(e).length;if(s!==i)return!1;for(const o in t){const a=t.hasOwnProperty(o),l=e.hasOwnProperty(o);if(a&&!l||!a&&l||!on(t[o],e[o]))return!1}}return String(t)===String(e)}function vo(t,e){return t.findIndex(r=>on(r,e))}const Jl=t=>!!(t&&t.__v_isRef===!0),it=t=>Te(t)?t:t==null?"":F(t)||ge(t)&&(t.toString===zl||!ee(t.toString))?Jl(t)?it(t.value):JSON.stringify(t,Yl,2):String(t),Yl=(t,e)=>Jl(e)?Yl(t,e.value):Gr(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((r,[n,s],i)=>(r[di(n,i)+" =>"]=s,r),{})}:sn(e)?{[`Set(${e.size})`]:[...e.values()].map(r=>di(r))}:pt(e)?di(e):ge(e)&&!F(e)&&!Wl(e)?String(e):e,di=(t,e="")=>{var r;return pt(t)?`Symbol(${(r=t.description)!=null?r:e})`:t};/**
|
|
7
|
-
* @vue/reactivity v3.5.34
|
|
8
|
-
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
9
|
-
* @license MIT
|
|
10
|
-
**/let De;class Xl{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!e&&De&&(De.active?(this.parent=De,this.index=(De.scopes||(De.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,r;if(this.scopes)for(e=0,r=this.scopes.length;e<r;e++)this.scopes[e].pause();for(e=0,r=this.effects.length;e<r;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,r;if(this.scopes)for(e=0,r=this.scopes.length;e<r;e++)this.scopes[e].resume();for(e=0,r=this.effects.length;e<r;e++)this.effects[e].resume()}}run(e){if(this._active){const r=De;try{return De=this,e()}finally{De=r}}}on(){++this._on===1&&(this.prevScope=De,De=this)}off(){if(this._on>0&&--this._on===0){if(De===this)De=this.prevScope;else{let e=De;for(;e;){if(e.prevScope===this){e.prevScope=this.prevScope;break}e=e.prevScope}}this.prevScope=void 0}}stop(e){if(this._active){this._active=!1;let r,n;for(r=0,n=this.effects.length;r<n;r++)this.effects[r].stop();for(this.effects.length=0,r=0,n=this.cleanups.length;r<n;r++)this.cleanups[r]();if(this.cleanups.length=0,this.scopes){for(r=0,n=this.scopes.length;r<n;r++)this.scopes[r].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){const s=this.parent.scopes.pop();s&&s!==this&&(this.parent.scopes[this.index]=s,s.index=this.index)}this.parent=void 0}}}function Zl(t){return new Xl(t)}function Ql(){return De}function xh(t,e=!1){De&&De.cleanups.push(t)}let Se;const fi=new WeakSet;class ec{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,De&&(De.active?De.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,fi.has(this)&&(fi.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||rc(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Zo(this),nc(this);const e=Se,r=vt;Se=this,vt=!0;try{return this.fn()}finally{sc(this),Se=e,vt=r,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)wo(e);this.deps=this.depsTail=void 0,Zo(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?fi.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Ni(this)&&this.run()}get dirty(){return Ni(this)}}let tc=0,Sn,En;function rc(t,e=!1){if(t.flags|=8,e){t.next=En,En=t;return}t.next=Sn,Sn=t}function bo(){tc++}function _o(){if(--tc>0)return;if(En){let e=En;for(En=void 0;e;){const r=e.next;e.next=void 0,e.flags&=-9,e=r}}let t;for(;Sn;){let e=Sn;for(Sn=void 0;e;){const r=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(n){t||(t=n)}e=r}}if(t)throw t}function nc(t){for(let e=t.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function sc(t){let e,r=t.depsTail,n=r;for(;n;){const s=n.prevDep;n.version===-1?(n===r&&(r=s),wo(n),Rh(n)):e=n,n.dep.activeLink=n.prevActiveLink,n.prevActiveLink=void 0,n=s}t.deps=e,t.depsTail=r}function Ni(t){for(let e=t.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(ic(e.dep.computed)||e.dep.version!==e.version))return!0;return!!t._dirty}function ic(t){if(t.flags&4&&!(t.flags&16)||(t.flags&=-17,t.globalVersion===Nn)||(t.globalVersion=Nn,!t.isSSR&&t.flags&128&&(!t.deps&&!t._dirty||!Ni(t))))return;t.flags|=2;const e=t.dep,r=Se,n=vt;Se=t,vt=!0;try{nc(t);const s=t.fn(t._value);(e.version===0||jt(s,t._value))&&(t.flags|=128,t._value=s,e.version++)}catch(s){throw e.version++,s}finally{Se=r,vt=n,sc(t),t.flags&=-3}}function wo(t,e=!1){const{dep:r,prevSub:n,nextSub:s}=t;if(n&&(n.nextSub=s,t.prevSub=void 0),s&&(s.prevSub=n,t.nextSub=void 0),r.subs===t&&(r.subs=n,!n&&r.computed)){r.computed.flags&=-5;for(let i=r.computed.deps;i;i=i.nextDep)wo(i,!0)}!e&&!--r.sc&&r.map&&r.map.delete(r.key)}function Rh(t){const{prevDep:e,nextDep:r}=t;e&&(e.nextDep=r,t.prevDep=void 0),r&&(r.prevDep=e,t.nextDep=void 0)}let vt=!0;const oc=[];function Zt(){oc.push(vt),vt=!1}function Qt(){const t=oc.pop();vt=t===void 0?!0:t}function Zo(t){const{cleanup:e}=t;if(t.cleanup=void 0,e){const r=Se;Se=void 0;try{e()}finally{Se=r}}}let Nn=0;class Ch{constructor(e,r){this.sub=e,this.dep=r,this.version=r.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class ko{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!Se||!vt||Se===this.computed)return;let r=this.activeLink;if(r===void 0||r.sub!==Se)r=this.activeLink=new Ch(Se,this),Se.deps?(r.prevDep=Se.depsTail,Se.depsTail.nextDep=r,Se.depsTail=r):Se.deps=Se.depsTail=r,ac(r);else if(r.version===-1&&(r.version=this.version,r.nextDep)){const n=r.nextDep;n.prevDep=r.prevDep,r.prevDep&&(r.prevDep.nextDep=n),r.prevDep=Se.depsTail,r.nextDep=void 0,Se.depsTail.nextDep=r,Se.depsTail=r,Se.deps===r&&(Se.deps=n)}return r}trigger(e){this.version++,Nn++,this.notify(e)}notify(e){bo();try{for(let r=this.subs;r;r=r.prevSub)r.sub.notify()&&r.sub.dep.notify()}finally{_o()}}}function ac(t){if(t.dep.sc++,t.sub.flags&4){const e=t.dep.computed;if(e&&!t.dep.subs){e.flags|=20;for(let n=e.deps;n;n=n.nextDep)ac(n)}const r=t.dep.subs;r!==t&&(t.prevSub=r,r&&(r.nextSub=t)),t.dep.subs=t}}const ws=new WeakMap,xr=Symbol(""),Li=Symbol(""),Ln=Symbol("");function Ve(t,e,r){if(vt&&Se){let n=ws.get(t);n||ws.set(t,n=new Map);let s=n.get(r);s||(n.set(r,s=new ko),s.map=n,s.key=r),s.track()}}function zt(t,e,r,n,s,i){const o=ws.get(t);if(!o){Nn++;return}const a=l=>{l&&l.trigger()};if(bo(),e==="clear")o.forEach(a);else{const l=F(t),c=l&&Hs(r);if(l&&r==="length"){const u=Number(n);o.forEach((h,d)=>{(d==="length"||d===Ln||!pt(d)&&d>=u)&&a(h)})}else switch((r!==void 0||o.has(void 0))&&a(o.get(r)),c&&a(o.get(Ln)),e){case"add":l?c&&a(o.get("length")):(a(o.get(xr)),Gr(t)&&a(o.get(Li)));break;case"delete":l||(a(o.get(xr)),Gr(t)&&a(o.get(Li)));break;case"set":Gr(t)&&a(o.get(xr));break}}_o()}function Oh(t,e){const r=ws.get(t);return r&&r.get(e)}function Ir(t){const e=le(t);return e===t?e:(Ve(e,"iterate",Ln),ct(t)?e:e.map(bt))}function Ks(t){return Ve(t=le(t),"iterate",Ln),t}function Pt(t,e){return er(t)?Zr(Yt(t)?bt(e):e):bt(e)}const Ph={__proto__:null,[Symbol.iterator](){return pi(this,Symbol.iterator,t=>Pt(this,t))},concat(...t){return Ir(this).concat(...t.map(e=>F(e)?Ir(e):e))},entries(){return pi(this,"entries",t=>(t[1]=Pt(this,t[1]),t))},every(t,e){return Dt(this,"every",t,e,void 0,arguments)},filter(t,e){return Dt(this,"filter",t,e,r=>r.map(n=>Pt(this,n)),arguments)},find(t,e){return Dt(this,"find",t,e,r=>Pt(this,r),arguments)},findIndex(t,e){return Dt(this,"findIndex",t,e,void 0,arguments)},findLast(t,e){return Dt(this,"findLast",t,e,r=>Pt(this,r),arguments)},findLastIndex(t,e){return Dt(this,"findLastIndex",t,e,void 0,arguments)},forEach(t,e){return Dt(this,"forEach",t,e,void 0,arguments)},includes(...t){return gi(this,"includes",t)},indexOf(...t){return gi(this,"indexOf",t)},join(t){return Ir(this).join(t)},lastIndexOf(...t){return gi(this,"lastIndexOf",t)},map(t,e){return Dt(this,"map",t,e,void 0,arguments)},pop(){return un(this,"pop")},push(...t){return un(this,"push",t)},reduce(t,...e){return Qo(this,"reduce",t,e)},reduceRight(t,...e){return Qo(this,"reduceRight",t,e)},shift(){return un(this,"shift")},some(t,e){return Dt(this,"some",t,e,void 0,arguments)},splice(...t){return un(this,"splice",t)},toReversed(){return Ir(this).toReversed()},toSorted(t){return Ir(this).toSorted(t)},toSpliced(...t){return Ir(this).toSpliced(...t)},unshift(...t){return un(this,"unshift",t)},values(){return pi(this,"values",t=>Pt(this,t))}};function pi(t,e,r){const n=Ks(t),s=n[e]();return n!==t&&!ct(t)&&(s._next=s.next,s.next=()=>{const i=s._next();return i.done||(i.value=r(i.value)),i}),s}const Ih=Array.prototype;function Dt(t,e,r,n,s,i){const o=Ks(t),a=o!==t&&!ct(t),l=o[e];if(l!==Ih[e]){const h=l.apply(t,i);return a?bt(h):h}let c=r;o!==t&&(a?c=function(h,d){return r.call(this,Pt(t,h),d,t)}:r.length>2&&(c=function(h,d){return r.call(this,h,d,t)}));const u=l.call(o,c,n);return a&&s?s(u):u}function Qo(t,e,r,n){const s=Ks(t),i=s!==t&&!ct(t);let o=r,a=!1;s!==t&&(i?(a=n.length===0,o=function(c,u,h){return a&&(a=!1,c=Pt(t,c)),r.call(this,c,Pt(t,u),h,t)}):r.length>3&&(o=function(c,u,h){return r.call(this,c,u,h,t)}));const l=s[e](o,...n);return a?Pt(t,l):l}function gi(t,e,r){const n=le(t);Ve(n,"iterate",Ln);const s=n[e](...r);return(s===-1||s===!1)&&Gs(r[0])?(r[0]=le(r[0]),n[e](...r)):s}function un(t,e,r=[]){Zt(),bo();const n=le(t)[e].apply(t,r);return _o(),Qt(),n}const $h=mo("__proto__,__v_isRef,__isVue"),lc=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(pt));function jh(t){pt(t)||(t=String(t));const e=le(this);return Ve(e,"has",t),e.hasOwnProperty(t)}class cc{constructor(e=!1,r=!1){this._isReadonly=e,this._isShallow=r}get(e,r,n){if(r==="__v_skip")return e.__v_skip;const s=this._isReadonly,i=this._isShallow;if(r==="__v_isReactive")return!s;if(r==="__v_isReadonly")return s;if(r==="__v_isShallow")return i;if(r==="__v_raw")return n===(s?i?Vh:fc:i?dc:hc).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;const o=F(e);if(!s){let l;if(o&&(l=Ph[r]))return l;if(r==="hasOwnProperty")return jh}const a=Reflect.get(e,r,Ce(e)?e:n);if((pt(r)?lc.has(r):$h(r))||(s||Ve(e,"get",r),i))return a;if(Ce(a)){const l=o&&Hs(r)?a:a.value;return s&&ge(l)?Ui(l):l}return ge(a)?s?Ui(a):Xn(a):a}}class uc extends cc{constructor(e=!1){super(!1,e)}set(e,r,n,s){let i=e[r];const o=F(e)&&Hs(r);if(!this._isShallow){const c=er(i);if(!ct(n)&&!er(n)&&(i=le(i),n=le(n)),!o&&Ce(i)&&!Ce(n))return c||(i.value=n),!0}const a=o?Number(r)<e.length:fe(e,r),l=Reflect.set(e,r,n,Ce(e)?e:s);return e===le(s)&&(a?jt(n,i)&&zt(e,"set",r,n):zt(e,"add",r,n)),l}deleteProperty(e,r){const n=fe(e,r);e[r];const s=Reflect.deleteProperty(e,r);return s&&n&&zt(e,"delete",r,void 0),s}has(e,r){const n=Reflect.has(e,r);return(!pt(r)||!lc.has(r))&&Ve(e,"has",r),n}ownKeys(e){return Ve(e,"iterate",F(e)?"length":xr),Reflect.ownKeys(e)}}class Nh extends cc{constructor(e=!1){super(!0,e)}set(e,r){return!0}deleteProperty(e,r){return!0}}const Lh=new uc,Dh=new Nh,Uh=new uc(!0);const Di=t=>t,rs=t=>Reflect.getPrototypeOf(t);function Bh(t,e,r){return function(...n){const s=this.__v_raw,i=le(s),o=Gr(i),a=t==="entries"||t===Symbol.iterator&&o,l=t==="keys"&&o,c=s[t](...n),u=r?Di:e?Zr:bt;return!e&&Ve(i,"iterate",l?Li:xr),Ue(Object.create(c),{next(){const{value:h,done:d}=c.next();return d?{value:h,done:d}:{value:a?[u(h[0]),u(h[1])]:u(h),done:d}}})}}function ns(t){return function(...e){return t==="delete"?!1:t==="clear"?void 0:this}}function Mh(t,e){const r={get(s){const i=this.__v_raw,o=le(i),a=le(s);t||(jt(s,a)&&Ve(o,"get",s),Ve(o,"get",a));const{has:l}=rs(o),c=e?Di:t?Zr:bt;if(l.call(o,s))return c(i.get(s));if(l.call(o,a))return c(i.get(a));i!==o&&i.get(s)},get size(){const s=this.__v_raw;return!t&&Ve(le(s),"iterate",xr),s.size},has(s){const i=this.__v_raw,o=le(i),a=le(s);return t||(jt(s,a)&&Ve(o,"has",s),Ve(o,"has",a)),s===a?i.has(s):i.has(s)||i.has(a)},forEach(s,i){const o=this,a=o.__v_raw,l=le(a),c=e?Di:t?Zr:bt;return!t&&Ve(l,"iterate",xr),a.forEach((u,h)=>s.call(i,c(u),c(h),o))}};return Ue(r,t?{add:ns("add"),set:ns("set"),delete:ns("delete"),clear:ns("clear")}:{add(s){const i=le(this),o=rs(i),a=le(s),l=!e&&!ct(s)&&!er(s)?a:s;return o.has.call(i,l)||jt(s,l)&&o.has.call(i,s)||jt(a,l)&&o.has.call(i,a)||(i.add(l),zt(i,"add",l,l)),this},set(s,i){!e&&!ct(i)&&!er(i)&&(i=le(i));const o=le(this),{has:a,get:l}=rs(o);let c=a.call(o,s);c||(s=le(s),c=a.call(o,s));const u=l.call(o,s);return o.set(s,i),c?jt(i,u)&&zt(o,"set",s,i):zt(o,"add",s,i),this},delete(s){const i=le(this),{has:o,get:a}=rs(i);let l=o.call(i,s);l||(s=le(s),l=o.call(i,s)),a&&a.call(i,s);const c=i.delete(s);return l&&zt(i,"delete",s,void 0),c},clear(){const s=le(this),i=s.size!==0,o=s.clear();return i&&zt(s,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(s=>{r[s]=Bh(s,t,e)}),r}function So(t,e){const r=Mh(t,e);return(n,s,i)=>s==="__v_isReactive"?!t:s==="__v_isReadonly"?t:s==="__v_raw"?n:Reflect.get(fe(r,s)&&s in n?r:n,s,i)}const Hh={get:So(!1,!1)},qh={get:So(!1,!0)},Fh={get:So(!0,!1)};const hc=new WeakMap,dc=new WeakMap,fc=new WeakMap,Vh=new WeakMap;function zh(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Wh(t){return t.__v_skip||!Object.isExtensible(t)?0:zh(mh(t))}function Xn(t){return er(t)?t:Eo(t,!1,Lh,Hh,hc)}function pc(t){return Eo(t,!1,Uh,qh,dc)}function Ui(t){return Eo(t,!0,Dh,Fh,fc)}function Eo(t,e,r,n,s){if(!ge(t)||t.__v_raw&&!(e&&t.__v_isReactive))return t;const i=Wh(t);if(i===0)return t;const o=s.get(t);if(o)return o;const a=new Proxy(t,i===2?n:r);return s.set(t,a),a}function Yt(t){return er(t)?Yt(t.__v_raw):!!(t&&t.__v_isReactive)}function er(t){return!!(t&&t.__v_isReadonly)}function ct(t){return!!(t&&t.__v_isShallow)}function Gs(t){return t?!!t.__v_raw:!1}function le(t){const e=t&&t.__v_raw;return e?le(e):t}function To(t){return!fe(t,"__v_skip")&&Object.isExtensible(t)&&Kl(t,"__v_skip",!0),t}const bt=t=>ge(t)?Xn(t):t,Zr=t=>ge(t)?Ui(t):t;function Ce(t){return t?t.__v_isRef===!0:!1}function Oe(t){return gc(t,!1)}function Kh(t){return gc(t,!0)}function gc(t,e){return Ce(t)?t:new Gh(t,e)}class Gh{constructor(e,r){this.dep=new ko,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=r?e:le(e),this._value=r?e:bt(e),this.__v_isShallow=r}get value(){return this.dep.track(),this._value}set value(e){const r=this._rawValue,n=this.__v_isShallow||ct(e)||er(e);e=n?e:le(e),jt(e,r)&&(this._rawValue=e,this._value=n?e:bt(e),this.dep.trigger())}}function re(t){return Ce(t)?t.value:t}const Jh={get:(t,e,r)=>e==="__v_raw"?t:re(Reflect.get(t,e,r)),set:(t,e,r,n)=>{const s=t[e];return Ce(s)&&!Ce(r)?(s.value=r,!0):Reflect.set(t,e,r,n)}};function mc(t){return Yt(t)?t:new Proxy(t,Jh)}function Yh(t){const e=F(t)?new Array(t.length):{};for(const r in t)e[r]=Zh(t,r);return e}class Xh{constructor(e,r,n){this._object=e,this._defaultValue=n,this.__v_isRef=!0,this._value=void 0,this._key=pt(r)?r:String(r),this._raw=le(e);let s=!0,i=e;if(!F(e)||pt(this._key)||!Hs(this._key))do s=!Gs(i)||ct(i);while(s&&(i=i.__v_raw));this._shallow=s}get value(){let e=this._object[this._key];return this._shallow&&(e=re(e)),this._value=e===void 0?this._defaultValue:e}set value(e){if(this._shallow&&Ce(this._raw[this._key])){const r=this._object[this._key];if(Ce(r)){r.value=e;return}}this._object[this._key]=e}get dep(){return Oh(this._raw,this._key)}}function Zh(t,e,r){return new Xh(t,e,r)}class Qh{constructor(e,r,n){this.fn=e,this.setter=r,this._value=void 0,this.dep=new ko(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Nn-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!r,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&Se!==this)return rc(this,!0),!0}get value(){const e=this.dep.track();return ic(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function ed(t,e,r=!1){let n,s;return ee(t)?n=t:(n=t.get,s=t.set),new Qh(n,s,r)}const ss={},ks=new WeakMap;let kr;function td(t,e=!1,r=kr){if(r){let n=ks.get(r);n||ks.set(r,n=[]),n.push(t)}}function rd(t,e,r=_e){const{immediate:n,deep:s,once:i,scheduler:o,augmentJob:a,call:l}=r,c=x=>s?x:ct(x)||s===!1||s===0?Wt(x,1):Wt(x);let u,h,d,f,p=!1,y=!1;if(Ce(t)?(h=()=>t.value,p=ct(t)):Yt(t)?(h=()=>c(t),p=!0):F(t)?(y=!0,p=t.some(x=>Yt(x)||ct(x)),h=()=>t.map(x=>{if(Ce(x))return x.value;if(Yt(x))return c(x);if(ee(x))return l?l(x,2):x()})):ee(t)?e?h=l?()=>l(t,2):t:h=()=>{if(d){Zt();try{d()}finally{Qt()}}const x=kr;kr=u;try{return l?l(t,3,[f]):t(f)}finally{kr=x}}:h=Nt,e&&s){const x=h,D=s===!0?1/0:s;h=()=>Wt(x(),D)}const w=Ql(),k=()=>{u.stop(),w&&w.active&&yo(w.effects,u)};if(i&&e){const x=e;e=(...D)=>{x(...D),k()}}let _=y?new Array(t.length).fill(ss):ss;const b=x=>{if(!(!(u.flags&1)||!u.dirty&&!x))if(e){const D=u.run();if(s||p||(y?D.some((M,U)=>jt(M,_[U])):jt(D,_))){d&&d();const M=kr;kr=u;try{const U=[D,_===ss?void 0:y&&_[0]===ss?[]:_,f];_=D,l?l(e,3,U):e(...U)}finally{kr=M}}}else u.run()};return a&&a(b),u=new ec(h),u.scheduler=o?()=>o(b,!1):b,f=x=>td(x,!1,u),d=u.onStop=()=>{const x=ks.get(u);if(x){if(l)l(x,4);else for(const D of x)D();ks.delete(u)}},e?n?b(!0):_=u.run():o?o(b.bind(null,!0),!0):u.run(),k.pause=u.pause.bind(u),k.resume=u.resume.bind(u),k.stop=k,k}function Wt(t,e=1/0,r){if(e<=0||!ge(t)||t.__v_skip||(r=r||new Map,(r.get(t)||0)>=e))return t;if(r.set(t,e),e--,Ce(t))Wt(t.value,e,r);else if(F(t))for(let n=0;n<t.length;n++)Wt(t[n],e,r);else if(sn(t)||Gr(t))t.forEach(n=>{Wt(n,e,r)});else if(Wl(t)){for(const n in t)Wt(t[n],e,r);for(const n of Object.getOwnPropertySymbols(t))Object.prototype.propertyIsEnumerable.call(t,n)&&Wt(t[n],e,r)}return t}/**
|
|
11
|
-
* @vue/runtime-core v3.5.34
|
|
12
|
-
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
13
|
-
* @license MIT
|
|
14
|
-
**/function Zn(t,e,r,n){try{return n?t(...n):t()}catch(s){Js(s,e,r)}}function _t(t,e,r,n){if(ee(t)){const s=Zn(t,e,r,n);return s&&Vl(s)&&s.catch(i=>{Js(i,e,r)}),s}if(F(t)){const s=[];for(let i=0;i<t.length;i++)s.push(_t(t[i],e,r,n));return s}}function Js(t,e,r,n=!0){const s=e?e.vnode:null,{errorHandler:i,throwUnhandledErrorInProduction:o}=e&&e.appContext.config||_e;if(e){let a=e.parent;const l=e.proxy,c=`https://vuejs.org/error-reference/#runtime-${r}`;for(;a;){const u=a.ec;if(u){for(let h=0;h<u.length;h++)if(u[h](t,l,c)===!1)return}a=a.parent}if(i){Zt(),Zn(i,null,10,[t,l,c]),Qt();return}}nd(t,r,s,n,o)}function nd(t,e,r,n=!0,s=!1){if(s)throw t;console.error(t)}const Xe=[];let Rt=-1;const Jr=[];let or=null,Br=0;const yc=Promise.resolve();let Ss=null;function hr(t){const e=Ss||yc;return t?e.then(this?t.bind(this):t):e}function sd(t){let e=Rt+1,r=Xe.length;for(;e<r;){const n=e+r>>>1,s=Xe[n],i=Dn(s);i<t||i===t&&s.flags&2?e=n+1:r=n}return e}function Ao(t){if(!(t.flags&1)){const e=Dn(t),r=Xe[Xe.length-1];!r||!(t.flags&2)&&e>=Dn(r)?Xe.push(t):Xe.splice(sd(e),0,t),t.flags|=1,vc()}}function vc(){Ss||(Ss=yc.then(_c))}function id(t){F(t)?Jr.push(...t):or&&t.id===-1?or.splice(Br+1,0,t):t.flags&1||(Jr.push(t),t.flags|=1),vc()}function ea(t,e,r=Rt+1){for(;r<Xe.length;r++){const n=Xe[r];if(n&&n.flags&2){if(t&&n.id!==t.uid)continue;Xe.splice(r,1),r--,n.flags&4&&(n.flags&=-2),n(),n.flags&4||(n.flags&=-2)}}}function bc(t){if(Jr.length){const e=[...new Set(Jr)].sort((r,n)=>Dn(r)-Dn(n));if(Jr.length=0,or){or.push(...e);return}for(or=e,Br=0;Br<or.length;Br++){const r=or[Br];r.flags&4&&(r.flags&=-2),r.flags&8||r(),r.flags&=-2}or=null,Br=0}}const Dn=t=>t.id==null?t.flags&2?-1:1/0:t.id;function _c(t){try{for(Rt=0;Rt<Xe.length;Rt++){const e=Xe[Rt];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),Zn(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;Rt<Xe.length;Rt++){const e=Xe[Rt];e&&(e.flags&=-2)}Rt=-1,Xe.length=0,bc(),Ss=null,(Xe.length||Jr.length)&&_c()}}let at=null,wc=null;function Es(t){const e=at;return at=t,wc=t&&t.type.__scopeId||null,e}function Yr(t,e=at,r){if(!e||t._n)return t;const n=(...s)=>{n._d&&xs(-1);const i=Es(e);let o;try{o=t(...s)}finally{Es(i),n._d&&xs(1)}return o};return n._n=!0,n._c=!0,n._d=!0,n}function od(t,e){if(at===null)return t;const r=ti(at),n=t.dirs||(t.dirs=[]);for(let s=0;s<e.length;s++){let[i,o,a,l=_e]=e[s];i&&(ee(i)&&(i={mounted:i,updated:i}),i.deep&&Wt(o),n.push({dir:i,instance:r,value:o,oldValue:void 0,arg:a,modifiers:l}))}return t}function mr(t,e,r,n){const s=t.dirs,i=e&&e.dirs;for(let o=0;o<s.length;o++){const a=s[o];i&&(a.oldValue=i[o].value);let l=a.dir[n];l&&(Zt(),_t(l,r,8,[t.el,a,t,e]),Qt())}}function ys(t,e){if(ze){let r=ze.provides;const n=ze.parent&&ze.parent.provides;n===r&&(r=ze.provides=Object.create(n)),r[t]=e}}function ft(t,e,r=!1){const n=Po();if(n||Rr){let s=Rr?Rr._context.provides:n?n.parent==null||n.ce?n.vnode.appContext&&n.vnode.appContext.provides:n.parent.provides:void 0;if(s&&t in s)return s[t];if(arguments.length>1)return r&&ee(e)?e.call(n&&n.proxy):e}}function ad(){return!!(Po()||Rr)}const ld=Symbol.for("v-scx"),cd=()=>ft(ld);function Kt(t,e,r){return kc(t,e,r)}function kc(t,e,r=_e){const{immediate:n,deep:s,flush:i,once:o}=r,a=Ue({},r),l=e&&n||!e&&i!=="post";let c;if(Mn){if(i==="sync"){const f=cd();c=f.__watcherHandles||(f.__watcherHandles=[])}else if(!l){const f=()=>{};return f.stop=Nt,f.resume=Nt,f.pause=Nt,f}}const u=ze;a.call=(f,p,y)=>_t(f,u,p,y);let h=!1;i==="post"?a.scheduler=f=>{rt(f,u&&u.suspense)}:i!=="sync"&&(h=!0,a.scheduler=(f,p)=>{p?f():Ao(f)}),a.augmentJob=f=>{e&&(f.flags|=4),h&&(f.flags|=2,u&&(f.id=u.uid,f.i=u))};const d=rd(t,e,a);return Mn&&(c?c.push(d):l&&d()),d}function ud(t,e,r){const n=this.proxy,s=Te(t)?t.includes(".")?Sc(n,t):()=>n[t]:t.bind(n,n);let i;ee(e)?i=e:(i=e.handler,r=e);const o=Qn(this),a=kc(s,i.bind(n),r);return o(),a}function Sc(t,e){const r=e.split(".");return()=>{let n=t;for(let s=0;s<r.length&&n;s++)n=n[r[s]];return n}}const hd=Symbol("_vte"),Ec=t=>t.__isTeleport,Ct=Symbol("_leaveCb"),hn=Symbol("_enterCb");function dd(){const t={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return xo(()=>{t.isMounted=!0}),Ic(()=>{t.isUnmounting=!0}),t}const ht=[Function,Array],Tc={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:ht,onEnter:ht,onAfterEnter:ht,onEnterCancelled:ht,onBeforeLeave:ht,onLeave:ht,onAfterLeave:ht,onLeaveCancelled:ht,onBeforeAppear:ht,onAppear:ht,onAfterAppear:ht,onAppearCancelled:ht},Ac=t=>{const e=t.subTree;return e.component?Ac(e.component):e},fd={name:"BaseTransition",props:Tc,setup(t,{slots:e}){const r=Po(),n=dd();return()=>{const s=e.default&&Cc(e.default(),!0),i=s&&s.length?xc(s):r.subTree?$e():void 0;if(!i)return;const o=le(t),{mode:a}=o;if(n.isLeaving)return mi(i);const l=ta(i);if(!l)return mi(i);let c=Bi(l,o,n,r,h=>c=h);l.type!==Ze&&Un(l,c);let u=r.subTree&&ta(r.subTree);if(u&&u.type!==Ze&&!Er(u,l)&&Ac(r).type!==Ze){let h=Bi(u,o,n,r);if(Un(u,h),a==="out-in"&&l.type!==Ze)return n.isLeaving=!0,h.afterLeave=()=>{n.isLeaving=!1,r.job.flags&8||r.update(),delete h.afterLeave,u=void 0},mi(i);a==="in-out"&&l.type!==Ze?h.delayLeave=(d,f,p)=>{const y=Rc(n,u);y[String(u.key)]=u,d[Ct]=()=>{f(),d[Ct]=void 0,delete c.delayedLeave,u=void 0},c.delayedLeave=()=>{p(),delete c.delayedLeave,u=void 0}}:u=void 0}else u&&(u=void 0);return i}}};function xc(t){let e=t[0];if(t.length>1){for(const r of t)if(r.type!==Ze){e=r;break}}return e}const pd=fd;function Rc(t,e){const{leavingVNodes:r}=t;let n=r.get(e.type);return n||(n=Object.create(null),r.set(e.type,n)),n}function Bi(t,e,r,n,s){const{appear:i,mode:o,persisted:a=!1,onBeforeEnter:l,onEnter:c,onAfterEnter:u,onEnterCancelled:h,onBeforeLeave:d,onLeave:f,onAfterLeave:p,onLeaveCancelled:y,onBeforeAppear:w,onAppear:k,onAfterAppear:_,onAppearCancelled:b}=e,x=String(t.key),D=Rc(r,t),M=(C,z)=>{C&&_t(C,n,9,z)},U=(C,z)=>{const Q=z[1];M(C,z),F(C)?C.every(O=>O.length<=1)&&Q():C.length<=1&&Q()},V={mode:o,persisted:a,beforeEnter(C){let z=l;if(!r.isMounted)if(i)z=w||l;else return;C[Ct]&&C[Ct](!0);const Q=D[x];Q&&Er(t,Q)&&Q.el[Ct]&&Q.el[Ct](),M(z,[C])},enter(C){if(D[x]===t)return;let z=c,Q=u,O=h;if(!r.isMounted)if(i)z=k||c,Q=_||u,O=b||h;else return;let Y=!1;C[hn]=Ne=>{Y||(Y=!0,Ne?M(O,[C]):M(Q,[C]),V.delayedLeave&&V.delayedLeave(),C[hn]=void 0)};const Ee=C[hn].bind(null,!1);z?U(z,[C,Ee]):Ee()},leave(C,z){const Q=String(t.key);if(C[hn]&&C[hn](!0),r.isUnmounting)return z();M(d,[C]);let O=!1;C[Ct]=Ee=>{O||(O=!0,z(),Ee?M(y,[C]):M(p,[C]),C[Ct]=void 0,D[Q]===t&&delete D[Q])};const Y=C[Ct].bind(null,!1);D[Q]=t,f?U(f,[C,Y]):Y()},clone(C){const z=Bi(C,e,r,n,s);return s&&s(z),z}};return V}function mi(t){if(Ys(t))return t=dr(t),t.children=null,t}function ta(t){if(!Ys(t))return Ec(t.type)&&t.children?xc(t.children):t;if(t.component)return t.component.subTree;const{shapeFlag:e,children:r}=t;if(r){if(e&16)return r[0];if(e&32&&ee(r.default))return r.default()}}function Un(t,e){t.shapeFlag&6&&t.component?(t.transition=e,Un(t.component.subTree,e)):t.shapeFlag&128?(t.ssContent.transition=e.clone(t.ssContent),t.ssFallback.transition=e.clone(t.ssFallback)):t.transition=e}function Cc(t,e=!1,r){let n=[],s=0;for(let i=0;i<t.length;i++){let o=t[i];const a=r==null?o.key:String(r)+String(o.key!=null?o.key:i);o.type===Fe?(o.patchFlag&128&&s++,n=n.concat(Cc(o.children,e,a))):(e||o.type!==Ze)&&n.push(a!=null?dr(o,{key:a}):o)}if(s>1)for(let i=0;i<n.length;i++)n[i].patchFlag=-2;return n}function pr(t,e){return ee(t)?Ue({name:t.name},e,{setup:t}):t}function Oc(t){t.ids=[t.ids[0]+t.ids[2]+++"-",0,0]}function ra(t,e){let r;return!!((r=Object.getOwnPropertyDescriptor(t,e))&&!r.configurable)}const Ts=new WeakMap;function Tn(t,e,r,n,s=!1){if(F(t)){t.forEach((y,w)=>Tn(y,e&&(F(e)?e[w]:e),r,n,s));return}if(An(n)&&!s){n.shapeFlag&512&&n.type.__asyncResolved&&n.component.subTree.component&&Tn(t,e,r,n.component.subTree);return}const i=n.shapeFlag&4?ti(n.component):n.el,o=s?null:i,{i:a,r:l}=t,c=e&&e.r,u=a.refs===_e?a.refs={}:a.refs,h=a.setupState,d=le(h),f=h===_e?Fl:y=>ra(u,y)?!1:fe(d,y),p=(y,w)=>!(w&&ra(u,w));if(c!=null&&c!==l){if(na(e),Te(c))u[c]=null,f(c)&&(h[c]=null);else if(Ce(c)){const y=e;p(c,y.k)&&(c.value=null),y.k&&(u[y.k]=null)}}if(ee(l))Zn(l,a,12,[o,u]);else{const y=Te(l),w=Ce(l);if(y||w){const k=()=>{if(t.f){const _=y?f(l)?h[l]:u[l]:p()||!t.k?l.value:u[t.k];if(s)F(_)&&yo(_,i);else if(F(_))_.includes(i)||_.push(i);else if(y)u[l]=[i],f(l)&&(h[l]=u[l]);else{const b=[i];p(l,t.k)&&(l.value=b),t.k&&(u[t.k]=b)}}else y?(u[l]=o,f(l)&&(h[l]=o)):w&&(p(l,t.k)&&(l.value=o),t.k&&(u[t.k]=o))};if(o){const _=()=>{k(),Ts.delete(t)};_.id=-1,Ts.set(t,_),rt(_,r)}else na(t),k()}}}function na(t){const e=Ts.get(t);e&&(e.flags|=8,Ts.delete(t))}zs().requestIdleCallback;zs().cancelIdleCallback;const An=t=>!!t.type.__asyncLoader,Ys=t=>t.type.__isKeepAlive;function gd(t,e){Pc(t,"a",e)}function md(t,e){Pc(t,"da",e)}function Pc(t,e,r=ze){const n=t.__wdc||(t.__wdc=()=>{let s=r;for(;s;){if(s.isDeactivated)return;s=s.parent}return t()});if(Xs(e,n,r),r){let s=r.parent;for(;s&&s.parent;)Ys(s.parent.vnode)&&yd(n,e,r,s),s=s.parent}}function yd(t,e,r,n){const s=Xs(e,t,n,!0);$c(()=>{yo(n[e],s)},r)}function Xs(t,e,r=ze,n=!1){if(r){const s=r[t]||(r[t]=[]),i=e.__weh||(e.__weh=(...o)=>{Zt();const a=Qn(r),l=_t(e,r,t,o);return a(),Qt(),l});return n?s.unshift(i):s.push(i),i}}const tr=t=>(e,r=ze)=>{(!Mn||t==="sp")&&Xs(t,(...n)=>e(...n),r)},vd=tr("bm"),xo=tr("m"),bd=tr("bu"),_d=tr("u"),Ic=tr("bum"),$c=tr("um"),wd=tr("sp"),kd=tr("rtg"),Sd=tr("rtc");function Ed(t,e=ze){Xs("ec",t,e)}const jc="components";function Zs(t,e){return Lc(jc,t,!0,e)||t}const Nc=Symbol.for("v-ndc");function sa(t){return Te(t)?Lc(jc,t,!1)||t:t||Nc}function Lc(t,e,r=!0,n=!1){const s=at||ze;if(s){const i=s.type;{const a=cf(i,!1);if(a&&(a===e||a===et(e)||a===Fs(et(e))))return i}const o=ia(s[t]||i[t],e)||ia(s.appContext[t],e);return!o&&n?i:o}}function ia(t,e){return t&&(t[e]||t[et(e)]||t[Fs(et(e))])}function zr(t,e,r,n){let s;const i=r,o=F(t);if(o||Te(t)){const a=o&&Yt(t);let l=!1,c=!1;a&&(l=!ct(t),c=er(t),t=Ks(t)),s=new Array(t.length);for(let u=0,h=t.length;u<h;u++)s[u]=e(l?c?Zr(bt(t[u])):bt(t[u]):t[u],u,void 0,i)}else if(typeof t=="number"){s=new Array(t);for(let a=0;a<t;a++)s[a]=e(a+1,a,void 0,i)}else if(ge(t))if(t[Symbol.iterator])s=Array.from(t,(a,l)=>e(a,l,void 0,i));else{const a=Object.keys(t);s=new Array(a.length);for(let l=0,c=a.length;l<c;l++){const u=a[l];s[l]=e(t[u],u,l,i)}}else s=[];return s}const Mi=t=>t?nu(t)?ti(t):Mi(t.parent):null,xn=Ue(Object.create(null),{$:t=>t,$el:t=>t.vnode.el,$data:t=>t.data,$props:t=>t.props,$attrs:t=>t.attrs,$slots:t=>t.slots,$refs:t=>t.refs,$parent:t=>Mi(t.parent),$root:t=>Mi(t.root),$host:t=>t.ce,$emit:t=>t.emit,$options:t=>Uc(t),$forceUpdate:t=>t.f||(t.f=()=>{Ao(t.update)}),$nextTick:t=>t.n||(t.n=hr.bind(t.proxy)),$watch:t=>ud.bind(t)}),yi=(t,e)=>t!==_e&&!t.__isScriptSetup&&fe(t,e),Td={get({_:t},e){if(e==="__v_skip")return!0;const{ctx:r,setupState:n,data:s,props:i,accessCache:o,type:a,appContext:l}=t;if(e[0]!=="$"){const d=o[e];if(d!==void 0)switch(d){case 1:return n[e];case 2:return s[e];case 4:return r[e];case 3:return i[e]}else{if(yi(n,e))return o[e]=1,n[e];if(s!==_e&&fe(s,e))return o[e]=2,s[e];if(fe(i,e))return o[e]=3,i[e];if(r!==_e&&fe(r,e))return o[e]=4,r[e];Hi&&(o[e]=0)}}const c=xn[e];let u,h;if(c)return e==="$attrs"&&Ve(t.attrs,"get",""),c(t);if((u=a.__cssModules)&&(u=u[e]))return u;if(r!==_e&&fe(r,e))return o[e]=4,r[e];if(h=l.config.globalProperties,fe(h,e))return h[e]},set({_:t},e,r){const{data:n,setupState:s,ctx:i}=t;return yi(s,e)?(s[e]=r,!0):n!==_e&&fe(n,e)?(n[e]=r,!0):fe(t.props,e)||e[0]==="$"&&e.slice(1)in t?!1:(i[e]=r,!0)},has({_:{data:t,setupState:e,accessCache:r,ctx:n,appContext:s,props:i,type:o}},a){let l;return!!(r[a]||t!==_e&&a[0]!=="$"&&fe(t,a)||yi(e,a)||fe(i,a)||fe(n,a)||fe(xn,a)||fe(s.config.globalProperties,a)||(l=o.__cssModules)&&l[a])},defineProperty(t,e,r){return r.get!=null?t._.accessCache[e]=0:fe(r,"value")&&this.set(t,e,r.value,null),Reflect.defineProperty(t,e,r)}};function oa(t){return F(t)?t.reduce((e,r)=>(e[r]=null,e),{}):t}let Hi=!0;function Ad(t){const e=Uc(t),r=t.proxy,n=t.ctx;Hi=!1,e.beforeCreate&&aa(e.beforeCreate,t,"bc");const{data:s,computed:i,methods:o,watch:a,provide:l,inject:c,created:u,beforeMount:h,mounted:d,beforeUpdate:f,updated:p,activated:y,deactivated:w,beforeDestroy:k,beforeUnmount:_,destroyed:b,unmounted:x,render:D,renderTracked:M,renderTriggered:U,errorCaptured:V,serverPrefetch:C,expose:z,inheritAttrs:Q,components:O,directives:Y,filters:Ee}=e;if(c&&xd(c,n,null),o)for(const te in o){const L=o[te];ee(L)&&(n[te]=L.bind(r))}if(s){const te=s.call(r,r);ge(te)&&(t.data=Xn(te))}if(Hi=!0,i)for(const te in i){const L=i[te],se=ee(L)?L.bind(r,r):ee(L.get)?L.get.bind(r,r):Nt,We=!ee(L)&&ee(L.set)?L.set.bind(r):Nt,ie=je({get:se,set:We});Object.defineProperty(n,te,{enumerable:!0,configurable:!0,get:()=>ie.value,set:ae=>ie.value=ae})}if(a)for(const te in a)Dc(a[te],n,r,te);if(l){const te=ee(l)?l.call(r):l;Reflect.ownKeys(te).forEach(L=>{ys(L,te[L])})}u&&aa(u,t,"c");function ye(te,L){F(L)?L.forEach(se=>te(se.bind(r))):L&&te(L.bind(r))}if(ye(vd,h),ye(xo,d),ye(bd,f),ye(_d,p),ye(gd,y),ye(md,w),ye(Ed,V),ye(Sd,M),ye(kd,U),ye(Ic,_),ye($c,x),ye(wd,C),F(z))if(z.length){const te=t.exposed||(t.exposed={});z.forEach(L=>{Object.defineProperty(te,L,{get:()=>r[L],set:se=>r[L]=se,enumerable:!0})})}else t.exposed||(t.exposed={});D&&t.render===Nt&&(t.render=D),Q!=null&&(t.inheritAttrs=Q),O&&(t.components=O),Y&&(t.directives=Y),C&&Oc(t)}function xd(t,e,r=Nt){F(t)&&(t=qi(t));for(const n in t){const s=t[n];let i;ge(s)?"default"in s?i=ft(s.from||n,s.default,!0):i=ft(s.from||n):i=ft(s),Ce(i)?Object.defineProperty(e,n,{enumerable:!0,configurable:!0,get:()=>i.value,set:o=>i.value=o}):e[n]=i}}function aa(t,e,r){_t(F(t)?t.map(n=>n.bind(e.proxy)):t.bind(e.proxy),e,r)}function Dc(t,e,r,n){let s=n.includes(".")?Sc(r,n):()=>r[n];if(Te(t)){const i=e[t];ee(i)&&Kt(s,i)}else if(ee(t))Kt(s,t.bind(r));else if(ge(t))if(F(t))t.forEach(i=>Dc(i,e,r,n));else{const i=ee(t.handler)?t.handler.bind(r):e[t.handler];ee(i)&&Kt(s,i,t)}}function Uc(t){const e=t.type,{mixins:r,extends:n}=e,{mixins:s,optionsCache:i,config:{optionMergeStrategies:o}}=t.appContext,a=i.get(e);let l;return a?l=a:!s.length&&!r&&!n?l=e:(l={},s.length&&s.forEach(c=>As(l,c,o,!0)),As(l,e,o)),ge(e)&&i.set(e,l),l}function As(t,e,r,n=!1){const{mixins:s,extends:i}=e;i&&As(t,i,r,!0),s&&s.forEach(o=>As(t,o,r,!0));for(const o in e)if(!(n&&o==="expose")){const a=Rd[o]||r&&r[o];t[o]=a?a(t[o],e[o]):e[o]}return t}const Rd={data:la,props:ca,emits:ca,methods:vn,computed:vn,beforeCreate:Ge,created:Ge,beforeMount:Ge,mounted:Ge,beforeUpdate:Ge,updated:Ge,beforeDestroy:Ge,beforeUnmount:Ge,destroyed:Ge,unmounted:Ge,activated:Ge,deactivated:Ge,errorCaptured:Ge,serverPrefetch:Ge,components:vn,directives:vn,watch:Od,provide:la,inject:Cd};function la(t,e){return e?t?function(){return Ue(ee(t)?t.call(this,this):t,ee(e)?e.call(this,this):e)}:e:t}function Cd(t,e){return vn(qi(t),qi(e))}function qi(t){if(F(t)){const e={};for(let r=0;r<t.length;r++)e[t[r]]=t[r];return e}return t}function Ge(t,e){return t?[...new Set([].concat(t,e))]:e}function vn(t,e){return t?Ue(Object.create(null),t,e):e}function ca(t,e){return t?F(t)&&F(e)?[...new Set([...t,...e])]:Ue(Object.create(null),oa(t),oa(e??{})):e}function Od(t,e){if(!t)return e;if(!e)return t;const r=Ue(Object.create(null),t);for(const n in e)r[n]=Ge(t[n],e[n]);return r}function Bc(){return{app:null,config:{isNativeTag:Fl,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let Pd=0;function Id(t,e){return function(n,s=null){ee(n)||(n=Ue({},n)),s!=null&&!ge(s)&&(s=null);const i=Bc(),o=new WeakSet,a=[];let l=!1;const c=i.app={_uid:Pd++,_component:n,_props:s,_container:null,_context:i,_instance:null,version:hf,get config(){return i.config},set config(u){},use(u,...h){return o.has(u)||(u&&ee(u.install)?(o.add(u),u.install(c,...h)):ee(u)&&(o.add(u),u(c,...h))),c},mixin(u){return i.mixins.includes(u)||i.mixins.push(u),c},component(u,h){return h?(i.components[u]=h,c):i.components[u]},directive(u,h){return h?(i.directives[u]=h,c):i.directives[u]},mount(u,h,d){if(!l){const f=c._ceVNode||he(n,s);return f.appContext=i,d===!0?d="svg":d===!1&&(d=void 0),t(f,u,d),l=!0,c._container=u,u.__vue_app__=c,ti(f.component)}},onUnmount(u){a.push(u)},unmount(){l&&(_t(a,c._instance,16),t(null,c._container),delete c._container.__vue_app__)},provide(u,h){return i.provides[u]=h,c},runWithContext(u){const h=Rr;Rr=c;try{return u()}finally{Rr=h}}};return c}}let Rr=null;const $d=(t,e)=>e==="modelValue"||e==="model-value"?t.modelModifiers:t[`${e}Modifiers`]||t[`${et(e)}Modifiers`]||t[`${fr(e)}Modifiers`];function jd(t,e,...r){if(t.isUnmounted)return;const n=t.vnode.props||_e;let s=r;const i=e.startsWith("update:"),o=i&&$d(n,e.slice(7));o&&(o.trim&&(s=r.map(u=>Te(u)?u.trim():u)),o.number&&(s=r.map(Vs)));let a,l=n[a=hi(e)]||n[a=hi(et(e))];!l&&i&&(l=n[a=hi(fr(e))]),l&&_t(l,t,6,s);const c=n[a+"Once"];if(c){if(!t.emitted)t.emitted={};else if(t.emitted[a])return;t.emitted[a]=!0,_t(c,t,6,s)}}const Nd=new WeakMap;function Mc(t,e,r=!1){const n=r?Nd:e.emitsCache,s=n.get(t);if(s!==void 0)return s;const i=t.emits;let o={},a=!1;if(!ee(t)){const l=c=>{const u=Mc(c,e,!0);u&&(a=!0,Ue(o,u))};!r&&e.mixins.length&&e.mixins.forEach(l),t.extends&&l(t.extends),t.mixins&&t.mixins.forEach(l)}return!i&&!a?(ge(t)&&n.set(t,null),null):(F(i)?i.forEach(l=>o[l]=null):Ue(o,i),ge(t)&&n.set(t,o),o)}function Qs(t,e){return!t||!Bs(e)?!1:(e=e.slice(2).replace(/Once$/,""),fe(t,e[0].toLowerCase()+e.slice(1))||fe(t,fr(e))||fe(t,e))}function ua(t){const{type:e,vnode:r,proxy:n,withProxy:s,propsOptions:[i],slots:o,attrs:a,emit:l,render:c,renderCache:u,props:h,data:d,setupState:f,ctx:p,inheritAttrs:y}=t,w=Es(t);let k,_;try{if(r.shapeFlag&4){const x=s||n,D=x;k=It(c.call(D,x,u,h,f,d,p)),_=a}else{const x=e;k=It(x.length>1?x(h,{attrs:a,slots:o,emit:l}):x(h,null)),_=e.props?a:Ld(a)}}catch(x){Rn.length=0,Js(x,t,1),k=he(Ze)}let b=k;if(_&&y!==!1){const x=Object.keys(_),{shapeFlag:D}=b;x.length&&D&7&&(i&&x.some(Ms)&&(_=Dd(_,i)),b=dr(b,_,!1,!0))}return r.dirs&&(b=dr(b,null,!1,!0),b.dirs=b.dirs?b.dirs.concat(r.dirs):r.dirs),r.transition&&Un(b,r.transition),k=b,Es(w),k}const Ld=t=>{let e;for(const r in t)(r==="class"||r==="style"||Bs(r))&&((e||(e={}))[r]=t[r]);return e},Dd=(t,e)=>{const r={};for(const n in t)(!Ms(n)||!(n.slice(9)in e))&&(r[n]=t[n]);return r};function Ud(t,e,r){const{props:n,children:s,component:i}=t,{props:o,children:a,patchFlag:l}=e,c=i.emitsOptions;if(e.dirs||e.transition)return!0;if(r&&l>=0){if(l&1024)return!0;if(l&16)return n?ha(n,o,c):!!o;if(l&8){const u=e.dynamicProps;for(let h=0;h<u.length;h++){const d=u[h];if(Hc(o,n,d)&&!Qs(c,d))return!0}}}else return(s||a)&&(!a||!a.$stable)?!0:n===o?!1:n?o?ha(n,o,c):!0:!!o;return!1}function ha(t,e,r){const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!0;for(let s=0;s<n.length;s++){const i=n[s];if(Hc(e,t,i)&&!Qs(r,i))return!0}return!1}function Hc(t,e,r){const n=t[r],s=e[r];return r==="style"&&ge(n)&&ge(s)?!on(n,s):n!==s}function Bd({vnode:t,parent:e,suspense:r},n){for(;e;){const s=e.subTree;if(s.suspense&&s.suspense.activeBranch===t&&(s.suspense.vnode.el=s.el=n,t=s),s===t)(t=e.vnode).el=n,e=e.parent;else break}r&&r.activeBranch===t&&(r.vnode.el=n)}const qc={},Fc=()=>Object.create(qc),Vc=t=>Object.getPrototypeOf(t)===qc;function Md(t,e,r,n=!1){const s={},i=Fc();t.propsDefaults=Object.create(null),zc(t,e,s,i);for(const o in t.propsOptions[0])o in s||(s[o]=void 0);r?t.props=n?s:pc(s):t.type.props?t.props=s:t.props=i,t.attrs=i}function Hd(t,e,r,n){const{props:s,attrs:i,vnode:{patchFlag:o}}=t,a=le(s),[l]=t.propsOptions;let c=!1;if((n||o>0)&&!(o&16)){if(o&8){const u=t.vnode.dynamicProps;for(let h=0;h<u.length;h++){let d=u[h];if(Qs(t.emitsOptions,d))continue;const f=e[d];if(l)if(fe(i,d))f!==i[d]&&(i[d]=f,c=!0);else{const p=et(d);s[p]=Fi(l,a,p,f,t,!1)}else f!==i[d]&&(i[d]=f,c=!0)}}}else{zc(t,e,s,i)&&(c=!0);let u;for(const h in a)(!e||!fe(e,h)&&((u=fr(h))===h||!fe(e,u)))&&(l?r&&(r[h]!==void 0||r[u]!==void 0)&&(s[h]=Fi(l,a,h,void 0,t,!0)):delete s[h]);if(i!==a)for(const h in i)(!e||!fe(e,h))&&(delete i[h],c=!0)}c&&zt(t.attrs,"set","")}function zc(t,e,r,n){const[s,i]=t.propsOptions;let o=!1,a;if(e)for(let l in e){if(kn(l))continue;const c=e[l];let u;s&&fe(s,u=et(l))?!i||!i.includes(u)?r[u]=c:(a||(a={}))[u]=c:Qs(t.emitsOptions,l)||(!(l in n)||c!==n[l])&&(n[l]=c,o=!0)}if(i){const l=le(r),c=a||_e;for(let u=0;u<i.length;u++){const h=i[u];r[h]=Fi(s,l,h,c[h],t,!fe(c,h))}}return o}function Fi(t,e,r,n,s,i){const o=t[r];if(o!=null){const a=fe(o,"default");if(a&&n===void 0){const l=o.default;if(o.type!==Function&&!o.skipFactory&&ee(l)){const{propsDefaults:c}=s;if(r in c)n=c[r];else{const u=Qn(s);n=c[r]=l.call(null,e),u()}}else n=l;s.ce&&s.ce._setProp(r,n)}o[0]&&(i&&!a?n=!1:o[1]&&(n===""||n===fr(r))&&(n=!0))}return n}const qd=new WeakMap;function Wc(t,e,r=!1){const n=r?qd:e.propsCache,s=n.get(t);if(s)return s;const i=t.props,o={},a=[];let l=!1;if(!ee(t)){const u=h=>{l=!0;const[d,f]=Wc(h,e,!0);Ue(o,d),f&&a.push(...f)};!r&&e.mixins.length&&e.mixins.forEach(u),t.extends&&u(t.extends),t.mixins&&t.mixins.forEach(u)}if(!i&&!l)return ge(t)&&n.set(t,Kr),Kr;if(F(i))for(let u=0;u<i.length;u++){const h=et(i[u]);da(h)&&(o[h]=_e)}else if(i)for(const u in i){const h=et(u);if(da(h)){const d=i[u],f=o[h]=F(d)||ee(d)?{type:d}:Ue({},d),p=f.type;let y=!1,w=!0;if(F(p))for(let k=0;k<p.length;++k){const _=p[k],b=ee(_)&&_.name;if(b==="Boolean"){y=!0;break}else b==="String"&&(w=!1)}else y=ee(p)&&p.name==="Boolean";f[0]=y,f[1]=w,(y||fe(f,"default"))&&a.push(h)}}const c=[o,a];return ge(t)&&n.set(t,c),c}function da(t){return t[0]!=="$"&&!kn(t)}const Ro=t=>t==="_"||t==="_ctx"||t==="$stable",Co=t=>F(t)?t.map(It):[It(t)],Fd=(t,e,r)=>{if(e._n)return e;const n=Yr((...s)=>Co(e(...s)),r);return n._c=!1,n},Kc=(t,e,r)=>{const n=t._ctx;for(const s in t){if(Ro(s))continue;const i=t[s];if(ee(i))e[s]=Fd(s,i,n);else if(i!=null){const o=Co(i);e[s]=()=>o}}},Gc=(t,e)=>{const r=Co(e);t.slots.default=()=>r},Jc=(t,e,r)=>{for(const n in e)(r||!Ro(n))&&(t[n]=e[n])},Vd=(t,e,r)=>{const n=t.slots=Fc();if(t.vnode.shapeFlag&32){const s=e._;s?(Jc(n,e,r),r&&Kl(n,"_",s,!0)):Kc(e,n)}else e&&Gc(t,e)},zd=(t,e,r)=>{const{vnode:n,slots:s}=t;let i=!0,o=_e;if(n.shapeFlag&32){const a=e._;a?r&&a===1?i=!1:Jc(s,e,r):(i=!e.$stable,Kc(e,s)),o=e}else e&&(Gc(t,e),o={default:1});if(i)for(const a in s)!Ro(a)&&o[a]==null&&delete s[a]},rt=Yd;function Wd(t){return Kd(t)}function Kd(t,e){const r=zs();r.__VUE__=!0;const{insert:n,remove:s,patchProp:i,createElement:o,createText:a,createComment:l,setText:c,setElementText:u,parentNode:h,nextSibling:d,setScopeId:f=Nt,insertStaticContent:p}=t,y=(g,m,v,S=null,A=null,E=null,j=void 0,I=null,P=!!m.dynamicChildren)=>{if(g===m)return;g&&!Er(g,m)&&(S=T(g),ae(g,A,E,!0),g=null),m.patchFlag===-2&&(P=!1,m.dynamicChildren=null);const{type:R,ref:G,shapeFlag:B}=m;switch(R){case ei:w(g,m,v,S);break;case Ze:k(g,m,v,S);break;case bi:g==null&&_(m,v,S,j);break;case Fe:O(g,m,v,S,A,E,j,I,P);break;default:B&1?D(g,m,v,S,A,E,j,I,P):B&6?Y(g,m,v,S,A,E,j,I,P):(B&64||B&128)&&R.process(g,m,v,S,A,E,j,I,P,W)}G!=null&&A?Tn(G,g&&g.ref,E,m||g,!m):G==null&&g&&g.ref!=null&&Tn(g.ref,null,E,g,!0)},w=(g,m,v,S)=>{if(g==null)n(m.el=a(m.children),v,S);else{const A=m.el=g.el;m.children!==g.children&&c(A,m.children)}},k=(g,m,v,S)=>{g==null?n(m.el=l(m.children||""),v,S):m.el=g.el},_=(g,m,v,S)=>{[g.el,g.anchor]=p(g.children,m,v,S,g.el,g.anchor)},b=({el:g,anchor:m},v,S)=>{let A;for(;g&&g!==m;)A=d(g),n(g,v,S),g=A;n(m,v,S)},x=({el:g,anchor:m})=>{let v;for(;g&&g!==m;)v=d(g),s(g),g=v;s(m)},D=(g,m,v,S,A,E,j,I,P)=>{if(m.type==="svg"?j="svg":m.type==="math"&&(j="mathml"),g==null)M(m,v,S,A,E,j,I,P);else{const R=g.el&&g.el._isVueCE?g.el:null;try{R&&R._beginPatch(),C(g,m,A,E,j,I,P)}finally{R&&R._endPatch()}}},M=(g,m,v,S,A,E,j,I)=>{let P,R;const{props:G,shapeFlag:B,transition:K,dirs:X}=g;if(P=g.el=o(g.type,E,G&&G.is,G),B&8?u(P,g.children):B&16&&V(g.children,P,null,S,A,vi(g,E),j,I),X&&mr(g,null,S,"created"),U(P,g,g.scopeId,j,S),G){for(const ve in G)ve!=="value"&&!kn(ve)&&i(P,ve,null,G[ve],E,S);"value"in G&&i(P,"value",null,G.value,E),(R=G.onVnodeBeforeMount)&&Tt(R,S,g)}X&&mr(g,null,S,"beforeMount");const ce=Gd(A,K);ce&&K.beforeEnter(P),n(P,m,v),((R=G&&G.onVnodeMounted)||ce||X)&&rt(()=>{try{R&&Tt(R,S,g),ce&&K.enter(P),X&&mr(g,null,S,"mounted")}finally{}},A)},U=(g,m,v,S,A)=>{if(v&&f(g,v),S)for(let E=0;E<S.length;E++)f(g,S[E]);if(A){let E=A.subTree;if(m===E||Qc(E.type)&&(E.ssContent===m||E.ssFallback===m)){const j=A.vnode;U(g,j,j.scopeId,j.slotScopeIds,A.parent)}}},V=(g,m,v,S,A,E,j,I,P=0)=>{for(let R=P;R<g.length;R++){const G=g[R]=I?Vt(g[R]):It(g[R]);y(null,G,m,v,S,A,E,j,I)}},C=(g,m,v,S,A,E,j)=>{const I=m.el=g.el;let{patchFlag:P,dynamicChildren:R,dirs:G}=m;P|=g.patchFlag&16;const B=g.props||_e,K=m.props||_e;let X;if(v&&yr(v,!1),(X=K.onVnodeBeforeUpdate)&&Tt(X,v,m,g),G&&mr(m,g,v,"beforeUpdate"),v&&yr(v,!0),(B.innerHTML&&K.innerHTML==null||B.textContent&&K.textContent==null)&&u(I,""),R?z(g.dynamicChildren,R,I,v,S,vi(m,A),E):j||L(g,m,I,null,v,S,vi(m,A),E,!1),P>0){if(P&16)Q(I,B,K,v,A);else if(P&2&&B.class!==K.class&&i(I,"class",null,K.class,A),P&4&&i(I,"style",B.style,K.style,A),P&8){const ce=m.dynamicProps;for(let ve=0;ve<ce.length;ve++){const we=ce[ve],Pe=B[we],Me=K[we];(Me!==Pe||we==="value")&&i(I,we,Pe,Me,A,v)}}P&1&&g.children!==m.children&&u(I,m.children)}else!j&&R==null&&Q(I,B,K,v,A);((X=K.onVnodeUpdated)||G)&&rt(()=>{X&&Tt(X,v,m,g),G&&mr(m,g,v,"updated")},S)},z=(g,m,v,S,A,E,j)=>{for(let I=0;I<m.length;I++){const P=g[I],R=m[I],G=P.el&&(P.type===Fe||!Er(P,R)||P.shapeFlag&198)?h(P.el):v;y(P,R,G,null,S,A,E,j,!0)}},Q=(g,m,v,S,A)=>{if(m!==v){if(m!==_e)for(const E in m)!kn(E)&&!(E in v)&&i(g,E,m[E],null,A,S);for(const E in v){if(kn(E))continue;const j=v[E],I=m[E];j!==I&&E!=="value"&&i(g,E,I,j,A,S)}"value"in v&&i(g,"value",m.value,v.value,A)}},O=(g,m,v,S,A,E,j,I,P)=>{const R=m.el=g?g.el:a(""),G=m.anchor=g?g.anchor:a("");let{patchFlag:B,dynamicChildren:K,slotScopeIds:X}=m;X&&(I=I?I.concat(X):X),g==null?(n(R,v,S),n(G,v,S),V(m.children||[],v,G,A,E,j,I,P)):B>0&&B&64&&K&&g.dynamicChildren&&g.dynamicChildren.length===K.length?(z(g.dynamicChildren,K,v,A,E,j,I),(m.key!=null||A&&m===A.subTree)&&Yc(g,m,!0)):L(g,m,v,G,A,E,j,I,P)},Y=(g,m,v,S,A,E,j,I,P)=>{m.slotScopeIds=I,g==null?m.shapeFlag&512?A.ctx.activate(m,v,S,j,P):Ee(m,v,S,A,E,j,P):Ne(g,m,P)},Ee=(g,m,v,S,A,E,j)=>{const I=g.component=nf(g,S,A);if(Ys(g)&&(I.ctx.renderer=W),sf(I,!1,j),I.asyncDep){if(A&&A.registerDep(I,ye,j),!g.el){const P=I.subTree=he(Ze);k(null,P,m,v),g.placeholder=P.el}}else ye(I,g,m,v,A,E,j)},Ne=(g,m,v)=>{const S=m.component=g.component;if(Ud(g,m,v))if(S.asyncDep&&!S.asyncResolved){te(S,m,v);return}else S.next=m,S.update();else m.el=g.el,S.vnode=m},ye=(g,m,v,S,A,E,j)=>{const I=()=>{if(g.isMounted){let{next:B,bu:K,u:X,parent:ce,vnode:ve}=g;{const St=Xc(g);if(St){B&&(B.el=ve.el,te(g,B,j)),St.asyncDep.then(()=>{rt(()=>{g.isUnmounted||R()},A)});return}}let we=B,Pe;yr(g,!1),B?(B.el=ve.el,te(g,B,j)):B=ve,K&&ms(K),(Pe=B.props&&B.props.onVnodeBeforeUpdate)&&Tt(Pe,ce,B,ve),yr(g,!0);const Me=ua(g),kt=g.subTree;g.subTree=Me,y(kt,Me,h(kt.el),T(kt),g,A,E),B.el=Me.el,we===null&&Bd(g,Me.el),X&&rt(X,A),(Pe=B.props&&B.props.onVnodeUpdated)&&rt(()=>Tt(Pe,ce,B,ve),A)}else{let B;const{el:K,props:X}=m,{bm:ce,m:ve,parent:we,root:Pe,type:Me}=g,kt=An(m);yr(g,!1),ce&&ms(ce),!kt&&(B=X&&X.onVnodeBeforeMount)&&Tt(B,we,m),yr(g,!0);{Pe.ce&&Pe.ce._hasShadowRoot()&&Pe.ce._injectChildStyle(Me,g.parent?g.parent.type:void 0);const St=g.subTree=ua(g);y(null,St,v,S,g,A,E),m.el=St.el}if(ve&&rt(ve,A),!kt&&(B=X&&X.onVnodeMounted)){const St=m;rt(()=>Tt(B,we,St),A)}(m.shapeFlag&256||we&&An(we.vnode)&&we.vnode.shapeFlag&256)&&g.a&&rt(g.a,A),g.isMounted=!0,m=v=S=null}};g.scope.on();const P=g.effect=new ec(I);g.scope.off();const R=g.update=P.run.bind(P),G=g.job=P.runIfDirty.bind(P);G.i=g,G.id=g.uid,P.scheduler=()=>Ao(G),yr(g,!0),R()},te=(g,m,v)=>{m.component=g;const S=g.vnode.props;g.vnode=m,g.next=null,Hd(g,m.props,S,v),zd(g,m.children,v),Zt(),ea(g),Qt()},L=(g,m,v,S,A,E,j,I,P=!1)=>{const R=g&&g.children,G=g?g.shapeFlag:0,B=m.children,{patchFlag:K,shapeFlag:X}=m;if(K>0){if(K&128){We(R,B,v,S,A,E,j,I,P);return}else if(K&256){se(R,B,v,S,A,E,j,I,P);return}}X&8?(G&16&&ut(R,A,E),B!==R&&u(v,B)):G&16?X&16?We(R,B,v,S,A,E,j,I,P):ut(R,A,E,!0):(G&8&&u(v,""),X&16&&V(B,v,S,A,E,j,I,P))},se=(g,m,v,S,A,E,j,I,P)=>{g=g||Kr,m=m||Kr;const R=g.length,G=m.length,B=Math.min(R,G);let K;for(K=0;K<B;K++){const X=m[K]=P?Vt(m[K]):It(m[K]);y(g[K],X,v,null,A,E,j,I,P)}R>G?ut(g,A,E,!0,!1,B):V(m,v,S,A,E,j,I,P,B)},We=(g,m,v,S,A,E,j,I,P)=>{let R=0;const G=m.length;let B=g.length-1,K=G-1;for(;R<=B&&R<=K;){const X=g[R],ce=m[R]=P?Vt(m[R]):It(m[R]);if(Er(X,ce))y(X,ce,v,null,A,E,j,I,P);else break;R++}for(;R<=B&&R<=K;){const X=g[B],ce=m[K]=P?Vt(m[K]):It(m[K]);if(Er(X,ce))y(X,ce,v,null,A,E,j,I,P);else break;B--,K--}if(R>B){if(R<=K){const X=K+1,ce=X<G?m[X].el:S;for(;R<=K;)y(null,m[R]=P?Vt(m[R]):It(m[R]),v,ce,A,E,j,I,P),R++}}else if(R>K)for(;R<=B;)ae(g[R],A,E,!0),R++;else{const X=R,ce=R,ve=new Map;for(R=ce;R<=K;R++){const st=m[R]=P?Vt(m[R]):It(m[R]);st.key!=null&&ve.set(st.key,R)}let we,Pe=0;const Me=K-ce+1;let kt=!1,St=0;const cn=new Array(Me);for(R=0;R<Me;R++)cn[R]=0;for(R=X;R<=B;R++){const st=g[R];if(Pe>=Me){ae(st,A,E,!0);continue}let Et;if(st.key!=null)Et=ve.get(st.key);else for(we=ce;we<=K;we++)if(cn[we-ce]===0&&Er(st,m[we])){Et=we;break}Et===void 0?ae(st,A,E,!0):(cn[Et-ce]=R+1,Et>=St?St=Et:kt=!0,y(st,m[Et],v,null,A,E,j,I,P),Pe++)}const Wo=kt?Jd(cn):Kr;for(we=Wo.length-1,R=Me-1;R>=0;R--){const st=ce+R,Et=m[st],Ko=m[st+1],Go=st+1<G?Ko.el||Zc(Ko):S;cn[R]===0?y(null,Et,v,Go,A,E,j,I,P):kt&&(we<0||R!==Wo[we]?ie(Et,v,Go,2):we--)}}},ie=(g,m,v,S,A=null)=>{const{el:E,type:j,transition:I,children:P,shapeFlag:R}=g;if(R&6){ie(g.component.subTree,m,v,S);return}if(R&128){g.suspense.move(m,v,S);return}if(R&64){j.move(g,m,v,W);return}if(j===Fe){n(E,m,v);for(let B=0;B<P.length;B++)ie(P[B],m,v,S);n(g.anchor,m,v);return}if(j===bi){b(g,m,v);return}if(S!==2&&R&1&&I)if(S===0)I.beforeEnter(E),n(E,m,v),rt(()=>I.enter(E),A);else{const{leave:B,delayLeave:K,afterLeave:X}=I,ce=()=>{g.ctx.isUnmounted?s(E):n(E,m,v)},ve=()=>{E._isLeaving&&E[Ct](!0),B(E,()=>{ce(),X&&X()})};K?K(E,ce,ve):ve()}else n(E,m,v)},ae=(g,m,v,S=!1,A=!1)=>{const{type:E,props:j,ref:I,children:P,dynamicChildren:R,shapeFlag:G,patchFlag:B,dirs:K,cacheIndex:X,memo:ce}=g;if(B===-2&&(A=!1),I!=null&&(Zt(),Tn(I,null,v,g,!0),Qt()),X!=null&&(m.renderCache[X]=void 0),G&256){m.ctx.deactivate(g);return}const ve=G&1&&K,we=!An(g);let Pe;if(we&&(Pe=j&&j.onVnodeBeforeUnmount)&&Tt(Pe,m,g),G&6)gr(g.component,v,S);else{if(G&128){g.suspense.unmount(v,S);return}ve&&mr(g,null,m,"beforeUnmount"),G&64?g.type.remove(g,m,v,W,S):R&&!R.hasOnce&&(E!==Fe||B>0&&B&64)?ut(R,m,v,!1,!0):(E===Fe&&B&384||!A&&G&16)&&ut(P,m,v),S&&Lt(g)}const Me=ce!=null&&X==null;(we&&(Pe=j&&j.onVnodeUnmounted)||ve||Me)&&rt(()=>{Pe&&Tt(Pe,m,g),ve&&mr(g,null,m,"unmounted"),Me&&(g.el=null)},v)},Lt=g=>{const{type:m,el:v,anchor:S,transition:A}=g;if(m===Fe){Pr(v,S);return}if(m===bi){x(g);return}const E=()=>{s(v),A&&!A.persisted&&A.afterLeave&&A.afterLeave()};if(g.shapeFlag&1&&A&&!A.persisted){const{leave:j,delayLeave:I}=A,P=()=>j(v,E);I?I(g.el,E,P):P()}else E()},Pr=(g,m)=>{let v;for(;g!==m;)v=d(g),s(g),g=v;s(m)},gr=(g,m,v)=>{const{bum:S,scope:A,job:E,subTree:j,um:I,m:P,a:R}=g;fa(P),fa(R),S&&ms(S),A.stop(),E&&(E.flags|=8,ae(j,g,m,v)),I&&rt(I,m),rt(()=>{g.isUnmounted=!0},m)},ut=(g,m,v,S=!1,A=!1,E=0)=>{for(let j=E;j<g.length;j++)ae(g[j],m,v,S,A)},T=g=>{if(g.shapeFlag&6)return T(g.component.subTree);if(g.shapeFlag&128)return g.suspense.next();const m=d(g.anchor||g.el),v=m&&m[hd];return v?d(v):m};let H=!1;const N=(g,m,v)=>{let S;g==null?m._vnode&&(ae(m._vnode,null,null,!0),S=m._vnode.component):y(m._vnode||null,g,m,null,null,null,v),m._vnode=g,H||(H=!0,ea(S),bc(),H=!1)},W={p:y,um:ae,m:ie,r:Lt,mt:Ee,mc:V,pc:L,pbc:z,n:T,o:t};return{render:N,hydrate:void 0,createApp:Id(N)}}function vi({type:t,props:e},r){return r==="svg"&&t==="foreignObject"||r==="mathml"&&t==="annotation-xml"&&e&&e.encoding&&e.encoding.includes("html")?void 0:r}function yr({effect:t,job:e},r){r?(t.flags|=32,e.flags|=4):(t.flags&=-33,e.flags&=-5)}function Gd(t,e){return(!t||t&&!t.pendingBranch)&&e&&!e.persisted}function Yc(t,e,r=!1){const n=t.children,s=e.children;if(F(n)&&F(s))for(let i=0;i<n.length;i++){const o=n[i];let a=s[i];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=s[i]=Vt(s[i]),a.el=o.el),!r&&a.patchFlag!==-2&&Yc(o,a)),a.type===ei&&(a.patchFlag===-1&&(a=s[i]=Vt(a)),a.el=o.el),a.type===Ze&&!a.el&&(a.el=o.el)}}function Jd(t){const e=t.slice(),r=[0];let n,s,i,o,a;const l=t.length;for(n=0;n<l;n++){const c=t[n];if(c!==0){if(s=r[r.length-1],t[s]<c){e[n]=s,r.push(n);continue}for(i=0,o=r.length-1;i<o;)a=i+o>>1,t[r[a]]<c?i=a+1:o=a;c<t[r[i]]&&(i>0&&(e[n]=r[i-1]),r[i]=n)}}for(i=r.length,o=r[i-1];i-- >0;)r[i]=o,o=e[o];return r}function Xc(t){const e=t.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:Xc(e)}function fa(t){if(t)for(let e=0;e<t.length;e++)t[e].flags|=8}function Zc(t){if(t.placeholder)return t.placeholder;const e=t.component;return e?Zc(e.subTree):null}const Qc=t=>t.__isSuspense;function Yd(t,e){e&&e.pendingBranch?F(t)?e.effects.push(...t):e.effects.push(t):id(t)}const Fe=Symbol.for("v-fgt"),ei=Symbol.for("v-txt"),Ze=Symbol.for("v-cmt"),bi=Symbol.for("v-stc"),Rn=[];let lt=null;function Z(t=!1){Rn.push(lt=t?null:[])}function Xd(){Rn.pop(),lt=Rn[Rn.length-1]||null}let Bn=1;function xs(t,e=!1){Bn+=t,t<0&<&&e&&(lt.hasOnce=!0)}function eu(t){return t.dynamicChildren=Bn>0?lt||Kr:null,Xd(),Bn>0&<&<.push(t),t}function ue(t,e,r,n,s,i){return eu(ne(t,e,r,n,s,i,!0))}function nt(t,e,r,n,s){return eu(he(t,e,r,n,s,!0))}function Rs(t){return t?t.__v_isVNode===!0:!1}function Er(t,e){return t.type===e.type&&t.key===e.key}const tu=({key:t})=>t??null,vs=({ref:t,ref_key:e,ref_for:r})=>(typeof t=="number"&&(t=""+t),t!=null?Te(t)||Ce(t)||ee(t)?{i:at,r:t,k:e,f:!!r}:t:null);function ne(t,e=null,r=null,n=0,s=null,i=t===Fe?0:1,o=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&tu(e),ref:e&&vs(e),scopeId:wc,slotScopeIds:null,children:r,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:i,patchFlag:n,dynamicProps:s,dynamicChildren:null,appContext:null,ctx:at};return a?(Oo(l,r),i&128&&t.normalize(l)):r&&(l.shapeFlag|=Te(r)?8:16),Bn>0&&!o&<&&(l.patchFlag>0||i&6)&&l.patchFlag!==32&<.push(l),l}const he=Zd;function Zd(t,e=null,r=null,n=0,s=null,i=!1){if((!t||t===Nc)&&(t=Ze),Rs(t)){const a=dr(t,e,!0);return r&&Oo(a,r),Bn>0&&!i&<&&(a.shapeFlag&6?lt[lt.indexOf(t)]=a:lt.push(a)),a.patchFlag=-2,a}if(uf(t)&&(t=t.__vccOpts),e){e=Qd(e);let{class:a,style:l}=e;a&&!Te(a)&&(e.class=Ye(a)),ge(l)&&(Gs(l)&&!F(l)&&(l=Ue({},l)),e.style=Ws(l))}const o=Te(t)?1:Qc(t)?128:Ec(t)?64:ge(t)?4:ee(t)?2:0;return ne(t,e,r,n,s,o,i,!0)}function Qd(t){return t?Gs(t)||Vc(t)?Ue({},t):t:null}function dr(t,e,r=!1,n=!1){const{props:s,ref:i,patchFlag:o,children:a,transition:l}=t,c=e?ef(s||{},e):s,u={__v_isVNode:!0,__v_skip:!0,type:t.type,props:c,key:c&&tu(c),ref:e&&e.ref?r&&i?F(i)?i.concat(vs(e)):[i,vs(e)]:vs(e):i,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:a,target:t.target,targetStart:t.targetStart,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:e&&t.type!==Fe?o===-1?16:o|16:o,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:l,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&dr(t.ssContent),ssFallback:t.ssFallback&&dr(t.ssFallback),placeholder:t.placeholder,el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce};return l&&n&&Un(u,l.clone(u)),u}function ru(t=" ",e=0){return he(ei,null,t,e)}function $e(t="",e=!1){return e?(Z(),nt(Ze,null,t)):he(Ze,null,t)}function It(t){return t==null||typeof t=="boolean"?he(Ze):F(t)?he(Fe,null,t.slice()):Rs(t)?Vt(t):he(ei,null,String(t))}function Vt(t){return t.el===null&&t.patchFlag!==-1||t.memo?t:dr(t)}function Oo(t,e){let r=0;const{shapeFlag:n}=t;if(e==null)e=null;else if(F(e))r=16;else if(typeof e=="object")if(n&65){const s=e.default;s&&(s._c&&(s._d=!1),Oo(t,s()),s._c&&(s._d=!0));return}else{r=32;const s=e._;!s&&!Vc(e)?e._ctx=at:s===3&&at&&(at.slots._===1?e._=1:(e._=2,t.patchFlag|=1024))}else ee(e)?(e={default:e,_ctx:at},r=32):(e=String(e),n&64?(r=16,e=[ru(e)]):r=8);t.children=e,t.shapeFlag|=r}function ef(...t){const e={};for(let r=0;r<t.length;r++){const n=t[r];for(const s in n)if(s==="class")e.class!==n.class&&(e.class=Ye([e.class,n.class]));else if(s==="style")e.style=Ws([e.style,n.style]);else if(Bs(s)){const i=e[s],o=n[s];o&&i!==o&&!(F(i)&&i.includes(o))?e[s]=i?[].concat(i,o):o:o==null&&i==null&&!Ms(s)&&(e[s]=o)}else s!==""&&(e[s]=n[s])}return e}function Tt(t,e,r,n=null){_t(t,e,7,[r,n])}const tf=Bc();let rf=0;function nf(t,e,r){const n=t.type,s=(e?e.appContext:t.appContext)||tf,i={uid:rf++,vnode:t,type:n,parent:e,appContext:s,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Xl(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:e?e.provides:Object.create(s.provides),ids:e?e.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:Wc(n,s),emitsOptions:Mc(n,s),emit:null,emitted:null,propsDefaults:_e,inheritAttrs:n.inheritAttrs,ctx:_e,data:_e,props:_e,attrs:_e,slots:_e,refs:_e,setupState:_e,setupContext:null,suspense:r,suspenseId:r?r.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return i.ctx={_:i},i.root=e?e.root:i,i.emit=jd.bind(null,i),t.ce&&t.ce(i),i}let ze=null;const Po=()=>ze||at;let Cs,Vi;{const t=zs(),e=(r,n)=>{let s;return(s=t[r])||(s=t[r]=[]),s.push(n),i=>{s.length>1?s.forEach(o=>o(i)):s[0](i)}};Cs=e("__VUE_INSTANCE_SETTERS__",r=>ze=r),Vi=e("__VUE_SSR_SETTERS__",r=>Mn=r)}const Qn=t=>{const e=ze;return Cs(t),t.scope.on(),()=>{t.scope.off(),Cs(e)}},pa=()=>{ze&&ze.scope.off(),Cs(null)};function nu(t){return t.vnode.shapeFlag&4}let Mn=!1;function sf(t,e=!1,r=!1){e&&Vi(e);const{props:n,children:s}=t.vnode,i=nu(t);Md(t,n,i,e),Vd(t,s,r||e);const o=i?of(t,e):void 0;return e&&Vi(!1),o}function of(t,e){const r=t.type;t.accessCache=Object.create(null),t.proxy=new Proxy(t.ctx,Td);const{setup:n}=r;if(n){Zt();const s=t.setupContext=n.length>1?lf(t):null,i=Qn(t),o=Zn(n,t,0,[t.props,s]),a=Vl(o);if(Qt(),i(),(a||t.sp)&&!An(t)&&Oc(t),a){if(o.then(pa,pa),e)return o.then(l=>{ga(t,l)}).catch(l=>{Js(l,t,0)});t.asyncDep=o}else ga(t,o)}else su(t)}function ga(t,e,r){ee(e)?t.type.__ssrInlineRender?t.ssrRender=e:t.render=e:ge(e)&&(t.setupState=mc(e)),su(t)}function su(t,e,r){const n=t.type;t.render||(t.render=n.render||Nt);{const s=Qn(t);Zt();try{Ad(t)}finally{Qt(),s()}}}const af={get(t,e){return Ve(t,"get",""),t[e]}};function lf(t){const e=r=>{t.exposed=r||{}};return{attrs:new Proxy(t.attrs,af),slots:t.slots,emit:t.emit,expose:e}}function ti(t){return t.exposed?t.exposeProxy||(t.exposeProxy=new Proxy(mc(To(t.exposed)),{get(e,r){if(r in e)return e[r];if(r in xn)return xn[r](t)},has(e,r){return r in e||r in xn}})):t.proxy}function cf(t,e=!0){return ee(t)?t.displayName||t.name:t.name||e&&t.__name}function uf(t){return ee(t)&&"__vccOpts"in t}const je=(t,e)=>ed(t,e,Mn);function Qr(t,e,r){try{xs(-1);const n=arguments.length;return n===2?ge(e)&&!F(e)?Rs(e)?he(t,null,[e]):he(t,e):he(t,null,e):(n>3?r=Array.prototype.slice.call(arguments,2):n===3&&Rs(r)&&(r=[r]),he(t,e,r))}finally{xs(1)}}const hf="3.5.34";/**
|
|
15
|
-
* @vue/runtime-dom v3.5.34
|
|
16
|
-
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
17
|
-
* @license MIT
|
|
18
|
-
**/let zi;const ma=typeof window<"u"&&window.trustedTypes;if(ma)try{zi=ma.createPolicy("vue",{createHTML:t=>t})}catch{}const iu=zi?t=>zi.createHTML(t):t=>t,df="http://www.w3.org/2000/svg",ff="http://www.w3.org/1998/Math/MathML",Ht=typeof document<"u"?document:null,ya=Ht&&Ht.createElement("template"),pf={insert:(t,e,r)=>{e.insertBefore(t,r||null)},remove:t=>{const e=t.parentNode;e&&e.removeChild(t)},createElement:(t,e,r,n)=>{const s=e==="svg"?Ht.createElementNS(df,t):e==="mathml"?Ht.createElementNS(ff,t):r?Ht.createElement(t,{is:r}):Ht.createElement(t);return t==="select"&&n&&n.multiple!=null&&s.setAttribute("multiple",n.multiple),s},createText:t=>Ht.createTextNode(t),createComment:t=>Ht.createComment(t),setText:(t,e)=>{t.nodeValue=e},setElementText:(t,e)=>{t.textContent=e},parentNode:t=>t.parentNode,nextSibling:t=>t.nextSibling,querySelector:t=>Ht.querySelector(t),setScopeId(t,e){t.setAttribute(e,"")},insertStaticContent(t,e,r,n,s,i){const o=r?r.previousSibling:e.lastChild;if(s&&(s===i||s.nextSibling))for(;e.insertBefore(s.cloneNode(!0),r),!(s===i||!(s=s.nextSibling)););else{ya.innerHTML=iu(n==="svg"?`<svg>${t}</svg>`:n==="mathml"?`<math>${t}</math>`:t);const a=ya.content;if(n==="svg"||n==="mathml"){const l=a.firstChild;for(;l.firstChild;)a.appendChild(l.firstChild);a.removeChild(l)}e.insertBefore(a,r)}return[o?o.nextSibling:e.firstChild,r?r.previousSibling:e.lastChild]}},nr="transition",dn="animation",Hn=Symbol("_vtc"),ou={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},gf=Ue({},Tc,ou),mf=t=>(t.displayName="Transition",t.props=gf,t),yf=mf((t,{slots:e})=>Qr(pd,vf(t),e)),vr=(t,e=[])=>{F(t)?t.forEach(r=>r(...e)):t&&t(...e)},va=t=>t?F(t)?t.some(e=>e.length>1):t.length>1:!1;function vf(t){const e={};for(const O in t)O in ou||(e[O]=t[O]);if(t.css===!1)return e;const{name:r="v",type:n,duration:s,enterFromClass:i=`${r}-enter-from`,enterActiveClass:o=`${r}-enter-active`,enterToClass:a=`${r}-enter-to`,appearFromClass:l=i,appearActiveClass:c=o,appearToClass:u=a,leaveFromClass:h=`${r}-leave-from`,leaveActiveClass:d=`${r}-leave-active`,leaveToClass:f=`${r}-leave-to`}=t,p=bf(s),y=p&&p[0],w=p&&p[1],{onBeforeEnter:k,onEnter:_,onEnterCancelled:b,onLeave:x,onLeaveCancelled:D,onBeforeAppear:M=k,onAppear:U=_,onAppearCancelled:V=b}=e,C=(O,Y,Ee,Ne)=>{O._enterCancelled=Ne,br(O,Y?u:a),br(O,Y?c:o),Ee&&Ee()},z=(O,Y)=>{O._isLeaving=!1,br(O,h),br(O,f),br(O,d),Y&&Y()},Q=O=>(Y,Ee)=>{const Ne=O?U:_,ye=()=>C(Y,O,Ee);vr(Ne,[Y,ye]),ba(()=>{br(Y,O?l:i),Ut(Y,O?u:a),va(Ne)||_a(Y,n,y,ye)})};return Ue(e,{onBeforeEnter(O){vr(k,[O]),Ut(O,i),Ut(O,o)},onBeforeAppear(O){vr(M,[O]),Ut(O,l),Ut(O,c)},onEnter:Q(!1),onAppear:Q(!0),onLeave(O,Y){O._isLeaving=!0;const Ee=()=>z(O,Y);Ut(O,h),O._enterCancelled?(Ut(O,d),Sa(O)):(Sa(O),Ut(O,d)),ba(()=>{O._isLeaving&&(br(O,h),Ut(O,f),va(x)||_a(O,n,w,Ee))}),vr(x,[O,Ee])},onEnterCancelled(O){C(O,!1,void 0,!0),vr(b,[O])},onAppearCancelled(O){C(O,!0,void 0,!0),vr(V,[O])},onLeaveCancelled(O){z(O),vr(D,[O])}})}function bf(t){if(t==null)return null;if(ge(t))return[_i(t.enter),_i(t.leave)];{const e=_i(t);return[e,e]}}function _i(t){return bh(t)}function Ut(t,e){e.split(/\s+/).forEach(r=>r&&t.classList.add(r)),(t[Hn]||(t[Hn]=new Set)).add(e)}function br(t,e){e.split(/\s+/).forEach(n=>n&&t.classList.remove(n));const r=t[Hn];r&&(r.delete(e),r.size||(t[Hn]=void 0))}function ba(t){requestAnimationFrame(()=>{requestAnimationFrame(t)})}let _f=0;function _a(t,e,r,n){const s=t._endId=++_f,i=()=>{s===t._endId&&n()};if(r!=null)return setTimeout(i,r);const{type:o,timeout:a,propCount:l}=wf(t,e);if(!o)return n();const c=o+"end";let u=0;const h=()=>{t.removeEventListener(c,d),i()},d=f=>{f.target===t&&++u>=l&&h()};setTimeout(()=>{u<l&&h()},a+1),t.addEventListener(c,d)}function wf(t,e){const r=window.getComputedStyle(t),n=p=>(r[p]||"").split(", "),s=n(`${nr}Delay`),i=n(`${nr}Duration`),o=wa(s,i),a=n(`${dn}Delay`),l=n(`${dn}Duration`),c=wa(a,l);let u=null,h=0,d=0;e===nr?o>0&&(u=nr,h=o,d=i.length):e===dn?c>0&&(u=dn,h=c,d=l.length):(h=Math.max(o,c),u=h>0?o>c?nr:dn:null,d=u?u===nr?i.length:l.length:0);const f=u===nr&&/\b(?:transform|all)(?:,|$)/.test(n(`${nr}Property`).toString());return{type:u,timeout:h,propCount:d,hasTransform:f}}function wa(t,e){for(;t.length<e.length;)t=t.concat(t);return Math.max(...e.map((r,n)=>ka(r)+ka(t[n])))}function ka(t){return t==="auto"?0:Number(t.slice(0,-1).replace(",","."))*1e3}function Sa(t){return(t?t.ownerDocument:document).body.offsetHeight}function kf(t,e,r){const n=t[Hn];n&&(e=(e?[e,...n]:[...n]).join(" ")),e==null?t.removeAttribute("class"):r?t.setAttribute("class",e):t.className=e}const Ea=Symbol("_vod"),Sf=Symbol("_vsh"),Ef=Symbol(""),Tf=/(?:^|;)\s*display\s*:/;function Af(t,e,r){const n=t.style,s=Te(r);let i=!1;if(r&&!s){if(e)if(Te(e))for(const o of e.split(";")){const a=o.slice(0,o.indexOf(":")).trim();r[a]==null&&bn(n,a,"")}else for(const o in e)r[o]==null&&bn(n,o,"");for(const o in r){o==="display"&&(i=!0);const a=r[o];a!=null?Rf(t,o,!Te(e)&&e?e[o]:void 0,a)||bn(n,o,a):bn(n,o,"")}}else if(s){if(e!==r){const o=n[Ef];o&&(r+=";"+o),n.cssText=r,i=Tf.test(r)}}else e&&t.removeAttribute("style");Ea in t&&(t[Ea]=i?n.display:"",t[Sf]&&(n.display="none"))}const Ta=/\s*!important$/;function bn(t,e,r){if(F(r))r.forEach(n=>bn(t,e,n));else if(r==null&&(r=""),e.startsWith("--"))t.setProperty(e,r);else{const n=xf(t,e);Ta.test(r)?t.setProperty(fr(n),r.replace(Ta,""),"important"):t[n]=r}}const Aa=["Webkit","Moz","ms"],wi={};function xf(t,e){const r=wi[e];if(r)return r;let n=et(e);if(n!=="filter"&&n in t)return wi[e]=n;n=Fs(n);for(let s=0;s<Aa.length;s++){const i=Aa[s]+n;if(i in t)return wi[e]=i}return e}function Rf(t,e,r,n){return t.tagName==="TEXTAREA"&&(e==="width"||e==="height")&&Te(n)&&r===n}const xa="http://www.w3.org/1999/xlink";function Ra(t,e,r,n,s,i=Th(e)){n&&e.startsWith("xlink:")?r==null?t.removeAttributeNS(xa,e.slice(6,e.length)):t.setAttributeNS(xa,e,r):r==null||i&&!Gl(r)?t.removeAttribute(e):t.setAttribute(e,i?"":pt(r)?String(r):r)}function Ca(t,e,r,n,s){if(e==="innerHTML"||e==="textContent"){r!=null&&(t[e]=e==="innerHTML"?iu(r):r);return}const i=t.tagName;if(e==="value"&&i!=="PROGRESS"&&!i.includes("-")){const a=i==="OPTION"?t.getAttribute("value")||"":t.value,l=r==null?t.type==="checkbox"?"on":"":String(r);(a!==l||!("_value"in t))&&(t.value=l),r==null&&t.removeAttribute(e),t._value=r;return}let o=!1;if(r===""||r==null){const a=typeof t[e];a==="boolean"?r=Gl(r):r==null&&a==="string"?(r="",o=!0):a==="number"&&(r=0,o=!0)}try{t[e]=r}catch{}o&&t.removeAttribute(s||e)}function lr(t,e,r,n){t.addEventListener(e,r,n)}function Cf(t,e,r,n){t.removeEventListener(e,r,n)}const Oa=Symbol("_vei");function Of(t,e,r,n,s=null){const i=t[Oa]||(t[Oa]={}),o=i[e];if(n&&o)o.value=n;else{const[a,l]=Pf(e);if(n){const c=i[e]=jf(n,s);lr(t,a,c,l)}else o&&(Cf(t,a,o,l),i[e]=void 0)}}const Pa=/(?:Once|Passive|Capture)$/;function Pf(t){let e;if(Pa.test(t)){e={};let n;for(;n=t.match(Pa);)t=t.slice(0,t.length-n[0].length),e[n[0].toLowerCase()]=!0}return[t[2]===":"?t.slice(3):fr(t.slice(2)),e]}let ki=0;const If=Promise.resolve(),$f=()=>ki||(If.then(()=>ki=0),ki=Date.now());function jf(t,e){const r=n=>{if(!n._vts)n._vts=Date.now();else if(n._vts<=r.attached)return;_t(Nf(n,r.value),e,5,[n])};return r.value=t,r.attached=$f(),r}function Nf(t,e){if(F(e)){const r=t.stopImmediatePropagation;return t.stopImmediatePropagation=()=>{r.call(t),t._stopped=!0},e.map(n=>s=>!s._stopped&&n&&n(s))}else return e}const Ia=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>96&&t.charCodeAt(2)<123,Lf=(t,e,r,n,s,i)=>{const o=s==="svg";e==="class"?kf(t,n,o):e==="style"?Af(t,r,n):Bs(e)?Ms(e)||Of(t,e,r,n,i):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):Df(t,e,n,o))?(Ca(t,e,n),!t.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&Ra(t,e,n,o,i,e!=="value")):t._isVueCE&&(Uf(t,e)||t._def.__asyncLoader&&(/[A-Z]/.test(e)||!Te(n)))?Ca(t,et(e),n,i,e):(e==="true-value"?t._trueValue=n:e==="false-value"&&(t._falseValue=n),Ra(t,e,n,o))};function Df(t,e,r,n){if(n)return!!(e==="innerHTML"||e==="textContent"||e in t&&Ia(e)&&ee(r));if(e==="spellcheck"||e==="draggable"||e==="translate"||e==="autocorrect"||e==="sandbox"&&t.tagName==="IFRAME"||e==="form"||e==="list"&&t.tagName==="INPUT"||e==="type"&&t.tagName==="TEXTAREA")return!1;if(e==="width"||e==="height"){const s=t.tagName;if(s==="IMG"||s==="VIDEO"||s==="CANVAS"||s==="SOURCE")return!1}return Ia(e)&&Te(r)?!1:e in t}function Uf(t,e){const r=t._def.props;if(!r)return!1;const n=et(e);return Array.isArray(r)?r.some(s=>et(s)===n):Object.keys(r).some(s=>et(s)===n)}const en=t=>{const e=t.props["onUpdate:modelValue"]||!1;return F(e)?r=>ms(e,r):e};function Bf(t){t.target.composing=!0}function $a(t){const e=t.target;e.composing&&(e.composing=!1,e.dispatchEvent(new Event("input")))}const Xt=Symbol("_assign");function ja(t,e,r){return e&&(t=t.trim()),r&&(t=Vs(t)),t}const Mf={created(t,{modifiers:{lazy:e,trim:r,number:n}},s){t[Xt]=en(s);const i=n||s.props&&s.props.type==="number";lr(t,e?"change":"input",o=>{o.target.composing||t[Xt](ja(t.value,r,i))}),(r||i)&&lr(t,"change",()=>{t.value=ja(t.value,r,i)}),e||(lr(t,"compositionstart",Bf),lr(t,"compositionend",$a),lr(t,"change",$a))},mounted(t,{value:e}){t.value=e??""},beforeUpdate(t,{value:e,oldValue:r,modifiers:{lazy:n,trim:s,number:i}},o){if(t[Xt]=en(o),t.composing)return;const a=(i||t.type==="number")&&!/^0\d/.test(t.value)?Vs(t.value):t.value,l=e??"";if(a===l)return;const c=t.getRootNode();(c instanceof Document||c instanceof ShadowRoot)&&c.activeElement===t&&t.type!=="range"&&(n&&e===r||s&&t.value.trim()===l)||(t.value=l)}},d_={deep:!0,created(t,e,r){t[Xt]=en(r),lr(t,"change",()=>{const n=t._modelValue,s=qn(t),i=t.checked,o=t[Xt];if(F(n)){const a=vo(n,s),l=a!==-1;if(i&&!l)o(n.concat(s));else if(!i&&l){const c=[...n];c.splice(a,1),o(c)}}else if(sn(n)){const a=new Set(n);i?a.add(s):a.delete(s),o(a)}else o(au(t,i))})},mounted:Na,beforeUpdate(t,e,r){t[Xt]=en(r),Na(t,e,r)}};function Na(t,{value:e,oldValue:r},n){t._modelValue=e;let s;if(F(e))s=vo(e,n.props.value)>-1;else if(sn(e))s=e.has(n.props.value);else{if(e===r)return;s=on(e,au(t,!0))}t.checked!==s&&(t.checked=s)}const f_={deep:!0,created(t,{value:e,modifiers:{number:r}},n){const s=sn(e);lr(t,"change",()=>{const i=Array.prototype.filter.call(t.options,o=>o.selected).map(o=>r?Vs(qn(o)):qn(o));t[Xt](t.multiple?s?new Set(i):i:i[0]),t._assigning=!0,hr(()=>{t._assigning=!1})}),t[Xt]=en(n)},mounted(t,{value:e}){La(t,e)},beforeUpdate(t,e,r){t[Xt]=en(r)},updated(t,{value:e}){t._assigning||La(t,e)}};function La(t,e){const r=t.multiple,n=F(e);if(!(r&&!n&&!sn(e))){for(let s=0,i=t.options.length;s<i;s++){const o=t.options[s],a=qn(o);if(r)if(n){const l=typeof a;l==="string"||l==="number"?o.selected=e.some(c=>String(c)===String(a)):o.selected=vo(e,a)>-1}else o.selected=e.has(a);else if(on(qn(o),e)){t.selectedIndex!==s&&(t.selectedIndex=s);return}}!r&&t.selectedIndex!==-1&&(t.selectedIndex=-1)}}function qn(t){return"_value"in t?t._value:t.value}function au(t,e){const r=e?"_trueValue":"_falseValue";return r in t?t[r]:e}const Hf=["ctrl","shift","alt","meta"],qf={stop:t=>t.stopPropagation(),prevent:t=>t.preventDefault(),self:t=>t.target!==t.currentTarget,ctrl:t=>!t.ctrlKey,shift:t=>!t.shiftKey,alt:t=>!t.altKey,meta:t=>!t.metaKey,left:t=>"button"in t&&t.button!==0,middle:t=>"button"in t&&t.button!==1,right:t=>"button"in t&&t.button!==2,exact:(t,e)=>Hf.some(r=>t[`${r}Key`]&&!e.includes(r))},p_=(t,e)=>{if(!t)return t;const r=t._withMods||(t._withMods={}),n=e.join(".");return r[n]||(r[n]=((s,...i)=>{for(let o=0;o<e.length;o++){const a=qf[e[o]];if(a&&a(s,e))return}return t(s,...i)}))},Ff={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},g_=(t,e)=>{const r=t._withKeys||(t._withKeys={}),n=e.join(".");return r[n]||(r[n]=(s=>{if(!("key"in s))return;const i=fr(s.key);if(e.some(o=>o===i||Ff[o]===i))return t(s)}))},Vf=Ue({patchProp:Lf},pf);let Da;function zf(){return Da||(Da=Wd(Vf))}const Wf=((...t)=>{const e=zf().createApp(...t),{mount:r}=e;return e.mount=n=>{const s=Gf(n);if(!s)return;const i=e._component;!ee(i)&&!i.render&&!i.template&&(i.template=s.innerHTML),s.nodeType===1&&(s.textContent="");const o=r(s,!1,Kf(s));return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),o},e});function Kf(t){if(t instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&t instanceof MathMLElement)return"mathml"}function Gf(t){return Te(t)?document.querySelector(t):t}/*!
|
|
19
|
-
* pinia v3.0.4
|
|
20
|
-
* (c) 2025 Eduardo San Martin Morote
|
|
21
|
-
* @license MIT
|
|
22
|
-
*/let lu;const ri=t=>lu=t,cu=Symbol();function Wi(t){return t&&typeof t=="object"&&Object.prototype.toString.call(t)==="[object Object]"&&typeof t.toJSON!="function"}var Cn;(function(t){t.direct="direct",t.patchObject="patch object",t.patchFunction="patch function"})(Cn||(Cn={}));function Jf(){const t=Zl(!0),e=t.run(()=>Oe({}));let r=[],n=[];const s=To({install(i){ri(s),s._a=i,i.provide(cu,s),i.config.globalProperties.$pinia=s,n.forEach(o=>r.push(o)),n=[]},use(i){return this._a?r.push(i):n.push(i),this},_p:r,_a:null,_e:t,_s:new Map,state:e});return s}const uu=()=>{};function Ua(t,e,r,n=uu){t.add(e);const s=()=>{t.delete(e)&&n()};return!r&&Ql()&&xh(s),s}function $r(t,...e){t.forEach(r=>{r(...e)})}const Yf=t=>t(),Ba=Symbol(),Si=Symbol();function Ki(t,e){t instanceof Map&&e instanceof Map?e.forEach((r,n)=>t.set(n,r)):t instanceof Set&&e instanceof Set&&e.forEach(t.add,t);for(const r in e){if(!e.hasOwnProperty(r))continue;const n=e[r],s=t[r];Wi(s)&&Wi(n)&&t.hasOwnProperty(r)&&!Ce(n)&&!Yt(n)?t[r]=Ki(s,n):t[r]=n}return t}const Xf=Symbol();function Zf(t){return!Wi(t)||!Object.prototype.hasOwnProperty.call(t,Xf)}const{assign:ir}=Object;function Qf(t){return!!(Ce(t)&&t.effect)}function ep(t,e,r,n){const{state:s,actions:i,getters:o}=e,a=r.state.value[t];let l;function c(){a||(r.state.value[t]=s?s():{});const u=Yh(r.state.value[t]);return ir(u,i,Object.keys(o||{}).reduce((h,d)=>(h[d]=To(je(()=>{ri(r);const f=r._s.get(t);return o[d].call(f,f)})),h),{}))}return l=hu(t,c,e,r,n,!0),l}function hu(t,e,r={},n,s,i){let o;const a=ir({actions:{}},r),l={deep:!0};let c,u,h=new Set,d=new Set,f;const p=n.state.value[t];!i&&!p&&(n.state.value[t]={});let y;function w(V){let C;c=u=!1,typeof V=="function"?(V(n.state.value[t]),C={type:Cn.patchFunction,storeId:t,events:f}):(Ki(n.state.value[t],V),C={type:Cn.patchObject,payload:V,storeId:t,events:f});const z=y=Symbol();hr().then(()=>{y===z&&(c=!0)}),u=!0,$r(h,C,n.state.value[t])}const k=i?function(){const{state:C}=r,z=C?C():{};this.$patch(Q=>{ir(Q,z)})}:uu;function _(){o.stop(),h.clear(),d.clear(),n._s.delete(t)}const b=(V,C="")=>{if(Ba in V)return V[Si]=C,V;const z=function(){ri(n);const Q=Array.from(arguments),O=new Set,Y=new Set;function Ee(te){O.add(te)}function Ne(te){Y.add(te)}$r(d,{args:Q,name:z[Si],store:D,after:Ee,onError:Ne});let ye;try{ye=V.apply(this&&this.$id===t?this:D,Q)}catch(te){throw $r(Y,te),te}return ye instanceof Promise?ye.then(te=>($r(O,te),te)).catch(te=>($r(Y,te),Promise.reject(te))):($r(O,ye),ye)};return z[Ba]=!0,z[Si]=C,z},x={_p:n,$id:t,$onAction:Ua.bind(null,d),$patch:w,$reset:k,$subscribe(V,C={}){const z=Ua(h,V,C.detached,()=>Q()),Q=o.run(()=>Kt(()=>n.state.value[t],O=>{(C.flush==="sync"?u:c)&&V({storeId:t,type:Cn.direct,events:f},O)},ir({},l,C)));return z},$dispose:_},D=Xn(x);n._s.set(t,D);const U=(n._a&&n._a.runWithContext||Yf)(()=>n._e.run(()=>(o=Zl()).run(()=>e({action:b}))));for(const V in U){const C=U[V];if(Ce(C)&&!Qf(C)||Yt(C))i||(p&&Zf(C)&&(Ce(C)?C.value=p[V]:Ki(C,p[V])),n.state.value[t][V]=C);else if(typeof C=="function"){const z=b(C,V);U[V]=z,a.actions[V]=C}}return ir(D,U),ir(le(D),U),Object.defineProperty(D,"$state",{get:()=>n.state.value[t],set:V=>{w(C=>{ir(C,V)})}}),n._p.forEach(V=>{ir(D,o.run(()=>V({store:D,app:n._a,pinia:n,options:a})))}),p&&i&&r.hydrate&&r.hydrate(D.$state,p),c=!0,u=!0,D}/*! #__NO_SIDE_EFFECTS__ */function du(t,e,r){let n;const s=typeof e=="function";n=s?r:e;function i(o,a){const l=ad();return o=o||(l?ft(cu,null):null),o&&ri(o),o=lu,o._s.has(t)||(s?hu(t,e,n,o):ep(t,n,o)),o._s.get(t)}return i.$id=t,i}/*!
|
|
23
|
-
* vue-router v4.6.4
|
|
24
|
-
* (c) 2025 Eduardo San Martin Morote
|
|
25
|
-
* @license MIT
|
|
26
|
-
*/const Mr=typeof document<"u";function fu(t){return typeof t=="object"||"displayName"in t||"props"in t||"__vccOpts"in t}function tp(t){return t.__esModule||t[Symbol.toStringTag]==="Module"||t.default&&fu(t.default)}const de=Object.assign;function Ei(t,e){const r={};for(const n in e){const s=e[n];r[n]=wt(s)?s.map(t):t(s)}return r}const On=()=>{},wt=Array.isArray;function Ma(t,e){const r={};for(const n in t)r[n]=n in e?e[n]:t[n];return r}const pu=/#/g,rp=/&/g,np=/\//g,sp=/=/g,ip=/\?/g,gu=/\+/g,op=/%5B/g,ap=/%5D/g,mu=/%5E/g,lp=/%60/g,yu=/%7B/g,cp=/%7C/g,vu=/%7D/g,up=/%20/g;function Io(t){return t==null?"":encodeURI(""+t).replace(cp,"|").replace(op,"[").replace(ap,"]")}function hp(t){return Io(t).replace(yu,"{").replace(vu,"}").replace(mu,"^")}function Gi(t){return Io(t).replace(gu,"%2B").replace(up,"+").replace(pu,"%23").replace(rp,"%26").replace(lp,"`").replace(yu,"{").replace(vu,"}").replace(mu,"^")}function dp(t){return Gi(t).replace(sp,"%3D")}function fp(t){return Io(t).replace(pu,"%23").replace(ip,"%3F")}function pp(t){return fp(t).replace(np,"%2F")}function Fn(t){if(t==null)return null;try{return decodeURIComponent(""+t)}catch{}return""+t}const gp=/\/$/,mp=t=>t.replace(gp,"");function Ti(t,e,r="/"){let n,s={},i="",o="";const a=e.indexOf("#");let l=e.indexOf("?");return l=a>=0&&l>a?-1:l,l>=0&&(n=e.slice(0,l),i=e.slice(l,a>0?a:e.length),s=t(i.slice(1))),a>=0&&(n=n||e.slice(0,a),o=e.slice(a,e.length)),n=_p(n??e,r),{fullPath:n+i+o,path:n,query:s,hash:Fn(o)}}function yp(t,e){const r=e.query?t(e.query):"";return e.path+(r&&"?")+r+(e.hash||"")}function Ha(t,e){return!e||!t.toLowerCase().startsWith(e.toLowerCase())?t:t.slice(e.length)||"/"}function vp(t,e,r){const n=e.matched.length-1,s=r.matched.length-1;return n>-1&&n===s&&tn(e.matched[n],r.matched[s])&&bu(e.params,r.params)&&t(e.query)===t(r.query)&&e.hash===r.hash}function tn(t,e){return(t.aliasOf||t)===(e.aliasOf||e)}function bu(t,e){if(Object.keys(t).length!==Object.keys(e).length)return!1;for(var r in t)if(!bp(t[r],e[r]))return!1;return!0}function bp(t,e){return wt(t)?qa(t,e):wt(e)?qa(e,t):(t==null?void 0:t.valueOf())===(e==null?void 0:e.valueOf())}function qa(t,e){return wt(e)?t.length===e.length&&t.every((r,n)=>r===e[n]):t.length===1&&t[0]===e}function _p(t,e){if(t.startsWith("/"))return t;if(!t)return e;const r=e.split("/"),n=t.split("/"),s=n[n.length-1];(s===".."||s===".")&&n.push("");let i=r.length-1,o,a;for(o=0;o<n.length;o++)if(a=n[o],a!==".")if(a==="..")i>1&&i--;else break;return r.slice(0,i).join("/")+"/"+n.slice(o).join("/")}const sr={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let Ji=(function(t){return t.pop="pop",t.push="push",t})({}),Ai=(function(t){return t.back="back",t.forward="forward",t.unknown="",t})({});function wp(t){if(!t)if(Mr){const e=document.querySelector("base");t=e&&e.getAttribute("href")||"/",t=t.replace(/^\w+:\/\/[^\/]+/,"")}else t="/";return t[0]!=="/"&&t[0]!=="#"&&(t="/"+t),mp(t)}const kp=/^[^#]+#/;function Sp(t,e){return t.replace(kp,"#")+e}function Ep(t,e){const r=document.documentElement.getBoundingClientRect(),n=t.getBoundingClientRect();return{behavior:e.behavior,left:n.left-r.left-(e.left||0),top:n.top-r.top-(e.top||0)}}const ni=()=>({left:window.scrollX,top:window.scrollY});function Tp(t){let e;if("el"in t){const r=t.el,n=typeof r=="string"&&r.startsWith("#"),s=typeof r=="string"?n?document.getElementById(r.slice(1)):document.querySelector(r):r;if(!s)return;e=Ep(s,t)}else e=t;"scrollBehavior"in document.documentElement.style?window.scrollTo(e):window.scrollTo(e.left!=null?e.left:window.scrollX,e.top!=null?e.top:window.scrollY)}function Fa(t,e){return(history.state?history.state.position-e:-1)+t}const Yi=new Map;function Ap(t,e){Yi.set(t,e)}function xp(t){const e=Yi.get(t);return Yi.delete(t),e}function Rp(t){return typeof t=="string"||t&&typeof t=="object"}function _u(t){return typeof t=="string"||typeof t=="symbol"}let xe=(function(t){return t[t.MATCHER_NOT_FOUND=1]="MATCHER_NOT_FOUND",t[t.NAVIGATION_GUARD_REDIRECT=2]="NAVIGATION_GUARD_REDIRECT",t[t.NAVIGATION_ABORTED=4]="NAVIGATION_ABORTED",t[t.NAVIGATION_CANCELLED=8]="NAVIGATION_CANCELLED",t[t.NAVIGATION_DUPLICATED=16]="NAVIGATION_DUPLICATED",t})({});const wu=Symbol("");xe.MATCHER_NOT_FOUND+"",xe.NAVIGATION_GUARD_REDIRECT+"",xe.NAVIGATION_ABORTED+"",xe.NAVIGATION_CANCELLED+"",xe.NAVIGATION_DUPLICATED+"";function rn(t,e){return de(new Error,{type:t,[wu]:!0},e)}function Bt(t,e){return t instanceof Error&&wu in t&&(e==null||!!(t.type&e))}const Cp=["params","query","hash"];function Op(t){if(typeof t=="string")return t;if(t.path!=null)return t.path;const e={};for(const r of Cp)r in t&&(e[r]=t[r]);return JSON.stringify(e,null,2)}function Pp(t){const e={};if(t===""||t==="?")return e;const r=(t[0]==="?"?t.slice(1):t).split("&");for(let n=0;n<r.length;++n){const s=r[n].replace(gu," "),i=s.indexOf("="),o=Fn(i<0?s:s.slice(0,i)),a=i<0?null:Fn(s.slice(i+1));if(o in e){let l=e[o];wt(l)||(l=e[o]=[l]),l.push(a)}else e[o]=a}return e}function Va(t){let e="";for(let r in t){const n=t[r];if(r=dp(r),n==null){n!==void 0&&(e+=(e.length?"&":"")+r);continue}(wt(n)?n.map(s=>s&&Gi(s)):[n&&Gi(n)]).forEach(s=>{s!==void 0&&(e+=(e.length?"&":"")+r,s!=null&&(e+="="+s))})}return e}function Ip(t){const e={};for(const r in t){const n=t[r];n!==void 0&&(e[r]=wt(n)?n.map(s=>s==null?null:""+s):n==null?n:""+n)}return e}const $p=Symbol(""),za=Symbol(""),si=Symbol(""),$o=Symbol(""),Xi=Symbol("");function fn(){let t=[];function e(n){return t.push(n),()=>{const s=t.indexOf(n);s>-1&&t.splice(s,1)}}function r(){t=[]}return{add:e,list:()=>t.slice(),reset:r}}function ar(t,e,r,n,s,i=o=>o()){const o=n&&(n.enterCallbacks[s]=n.enterCallbacks[s]||[]);return()=>new Promise((a,l)=>{const c=d=>{d===!1?l(rn(xe.NAVIGATION_ABORTED,{from:r,to:e})):d instanceof Error?l(d):Rp(d)?l(rn(xe.NAVIGATION_GUARD_REDIRECT,{from:e,to:d})):(o&&n.enterCallbacks[s]===o&&typeof d=="function"&&o.push(d),a())},u=i(()=>t.call(n&&n.instances[s],e,r,c));let h=Promise.resolve(u);t.length<3&&(h=h.then(c)),h.catch(d=>l(d))})}function xi(t,e,r,n,s=i=>i()){const i=[];for(const o of t)for(const a in o.components){let l=o.components[a];if(!(e!=="beforeRouteEnter"&&!o.instances[a]))if(fu(l)){const c=(l.__vccOpts||l)[e];c&&i.push(ar(c,r,n,o,a,s))}else{let c=l();i.push(()=>c.then(u=>{if(!u)throw new Error(`Couldn't resolve component "${a}" at "${o.path}"`);const h=tp(u)?u.default:u;o.mods[a]=u,o.components[a]=h;const d=(h.__vccOpts||h)[e];return d&&ar(d,r,n,o,a,s)()}))}}return i}function jp(t,e){const r=[],n=[],s=[],i=Math.max(e.matched.length,t.matched.length);for(let o=0;o<i;o++){const a=e.matched[o];a&&(t.matched.find(c=>tn(c,a))?n.push(a):r.push(a));const l=t.matched[o];l&&(e.matched.find(c=>tn(c,l))||s.push(l))}return[r,n,s]}/*!
|
|
27
|
-
* vue-router v4.6.4
|
|
28
|
-
* (c) 2025 Eduardo San Martin Morote
|
|
29
|
-
* @license MIT
|
|
30
|
-
*/let Np=()=>location.protocol+"//"+location.host;function ku(t,e){const{pathname:r,search:n,hash:s}=e,i=t.indexOf("#");if(i>-1){let o=s.includes(t.slice(i))?t.slice(i).length:1,a=s.slice(o);return a[0]!=="/"&&(a="/"+a),Ha(a,"")}return Ha(r,t)+n+s}function Lp(t,e,r,n){let s=[],i=[],o=null;const a=({state:d})=>{const f=ku(t,location),p=r.value,y=e.value;let w=0;if(d){if(r.value=f,e.value=d,o&&o===p){o=null;return}w=y?d.position-y.position:0}else n(f);s.forEach(k=>{k(r.value,p,{delta:w,type:Ji.pop,direction:w?w>0?Ai.forward:Ai.back:Ai.unknown})})};function l(){o=r.value}function c(d){s.push(d);const f=()=>{const p=s.indexOf(d);p>-1&&s.splice(p,1)};return i.push(f),f}function u(){if(document.visibilityState==="hidden"){const{history:d}=window;if(!d.state)return;d.replaceState(de({},d.state,{scroll:ni()}),"")}}function h(){for(const d of i)d();i=[],window.removeEventListener("popstate",a),window.removeEventListener("pagehide",u),document.removeEventListener("visibilitychange",u)}return window.addEventListener("popstate",a),window.addEventListener("pagehide",u),document.addEventListener("visibilitychange",u),{pauseListeners:l,listen:c,destroy:h}}function Wa(t,e,r,n=!1,s=!1){return{back:t,current:e,forward:r,replaced:n,position:window.history.length,scroll:s?ni():null}}function Dp(t){const{history:e,location:r}=window,n={value:ku(t,r)},s={value:e.state};s.value||i(n.value,{back:null,current:n.value,forward:null,position:e.length-1,replaced:!0,scroll:null},!0);function i(l,c,u){const h=t.indexOf("#"),d=h>-1?(r.host&&document.querySelector("base")?t:t.slice(h))+l:Np()+t+l;try{e[u?"replaceState":"pushState"](c,"",d),s.value=c}catch(f){console.error(f),r[u?"replace":"assign"](d)}}function o(l,c){i(l,de({},e.state,Wa(s.value.back,l,s.value.forward,!0),c,{position:s.value.position}),!0),n.value=l}function a(l,c){const u=de({},s.value,e.state,{forward:l,scroll:ni()});i(u.current,u,!0),i(l,de({},Wa(n.value,l,null),{position:u.position+1},c),!1),n.value=l}return{location:n,state:s,push:a,replace:o}}function Up(t){t=wp(t);const e=Dp(t),r=Lp(t,e.state,e.location,e.replace);function n(i,o=!0){o||r.pauseListeners(),history.go(i)}const s=de({location:"",base:t,go:n,createHref:Sp.bind(null,t)},e,r);return Object.defineProperty(s,"location",{enumerable:!0,get:()=>e.location.value}),Object.defineProperty(s,"state",{enumerable:!0,get:()=>e.state.value}),s}let Tr=(function(t){return t[t.Static=0]="Static",t[t.Param=1]="Param",t[t.Group=2]="Group",t})({});var Le=(function(t){return t[t.Static=0]="Static",t[t.Param=1]="Param",t[t.ParamRegExp=2]="ParamRegExp",t[t.ParamRegExpEnd=3]="ParamRegExpEnd",t[t.EscapeNext=4]="EscapeNext",t})(Le||{});const Bp={type:Tr.Static,value:""},Mp=/[a-zA-Z0-9_]/;function Hp(t){if(!t)return[[]];if(t==="/")return[[Bp]];if(!t.startsWith("/"))throw new Error(`Invalid path "${t}"`);function e(f){throw new Error(`ERR (${r})/"${c}": ${f}`)}let r=Le.Static,n=r;const s=[];let i;function o(){i&&s.push(i),i=[]}let a=0,l,c="",u="";function h(){c&&(r===Le.Static?i.push({type:Tr.Static,value:c}):r===Le.Param||r===Le.ParamRegExp||r===Le.ParamRegExpEnd?(i.length>1&&(l==="*"||l==="+")&&e(`A repeatable param (${c}) must be alone in its segment. eg: '/:ids+.`),i.push({type:Tr.Param,value:c,regexp:u,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):e("Invalid state to consume buffer"),c="")}function d(){c+=l}for(;a<t.length;){if(l=t[a++],l==="\\"&&r!==Le.ParamRegExp){n=r,r=Le.EscapeNext;continue}switch(r){case Le.Static:l==="/"?(c&&h(),o()):l===":"?(h(),r=Le.Param):d();break;case Le.EscapeNext:d(),r=n;break;case Le.Param:l==="("?r=Le.ParamRegExp:Mp.test(l)?d():(h(),r=Le.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--);break;case Le.ParamRegExp:l===")"?u[u.length-1]=="\\"?u=u.slice(0,-1)+l:r=Le.ParamRegExpEnd:u+=l;break;case Le.ParamRegExpEnd:h(),r=Le.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--,u="";break;default:e("Unknown state");break}}return r===Le.ParamRegExp&&e(`Unfinished custom RegExp for param "${c}"`),h(),o(),s}const Ka="[^/]+?",qp={sensitive:!1,strict:!1,start:!0,end:!0};var Je=(function(t){return t[t._multiplier=10]="_multiplier",t[t.Root=90]="Root",t[t.Segment=40]="Segment",t[t.SubSegment=30]="SubSegment",t[t.Static=40]="Static",t[t.Dynamic=20]="Dynamic",t[t.BonusCustomRegExp=10]="BonusCustomRegExp",t[t.BonusWildcard=-50]="BonusWildcard",t[t.BonusRepeatable=-20]="BonusRepeatable",t[t.BonusOptional=-8]="BonusOptional",t[t.BonusStrict=.7000000000000001]="BonusStrict",t[t.BonusCaseSensitive=.25]="BonusCaseSensitive",t})(Je||{});const Fp=/[.+*?^${}()[\]/\\]/g;function Vp(t,e){const r=de({},qp,e),n=[];let s=r.start?"^":"";const i=[];for(const c of t){const u=c.length?[]:[Je.Root];r.strict&&!c.length&&(s+="/");for(let h=0;h<c.length;h++){const d=c[h];let f=Je.Segment+(r.sensitive?Je.BonusCaseSensitive:0);if(d.type===Tr.Static)h||(s+="/"),s+=d.value.replace(Fp,"\\$&"),f+=Je.Static;else if(d.type===Tr.Param){const{value:p,repeatable:y,optional:w,regexp:k}=d;i.push({name:p,repeatable:y,optional:w});const _=k||Ka;if(_!==Ka){f+=Je.BonusCustomRegExp;try{`${_}`}catch(x){throw new Error(`Invalid custom RegExp for param "${p}" (${_}): `+x.message)}}let b=y?`((?:${_})(?:/(?:${_}))*)`:`(${_})`;h||(b=w&&c.length<2?`(?:/${b})`:"/"+b),w&&(b+="?"),s+=b,f+=Je.Dynamic,w&&(f+=Je.BonusOptional),y&&(f+=Je.BonusRepeatable),_===".*"&&(f+=Je.BonusWildcard)}u.push(f)}n.push(u)}if(r.strict&&r.end){const c=n.length-1;n[c][n[c].length-1]+=Je.BonusStrict}r.strict||(s+="/?"),r.end?s+="$":r.strict&&!s.endsWith("/")&&(s+="(?:/|$)");const o=new RegExp(s,r.sensitive?"":"i");function a(c){const u=c.match(o),h={};if(!u)return null;for(let d=1;d<u.length;d++){const f=u[d]||"",p=i[d-1];h[p.name]=f&&p.repeatable?f.split("/"):f}return h}function l(c){let u="",h=!1;for(const d of t){(!h||!u.endsWith("/"))&&(u+="/"),h=!1;for(const f of d)if(f.type===Tr.Static)u+=f.value;else if(f.type===Tr.Param){const{value:p,repeatable:y,optional:w}=f,k=p in c?c[p]:"";if(wt(k)&&!y)throw new Error(`Provided param "${p}" is an array but it is not repeatable (* or + modifiers)`);const _=wt(k)?k.join("/"):k;if(!_)if(w)d.length<2&&(u.endsWith("/")?u=u.slice(0,-1):h=!0);else throw new Error(`Missing required param "${p}"`);u+=_}}return u||"/"}return{re:o,score:n,keys:i,parse:a,stringify:l}}function zp(t,e){let r=0;for(;r<t.length&&r<e.length;){const n=e[r]-t[r];if(n)return n;r++}return t.length<e.length?t.length===1&&t[0]===Je.Static+Je.Segment?-1:1:t.length>e.length?e.length===1&&e[0]===Je.Static+Je.Segment?1:-1:0}function Su(t,e){let r=0;const n=t.score,s=e.score;for(;r<n.length&&r<s.length;){const i=zp(n[r],s[r]);if(i)return i;r++}if(Math.abs(s.length-n.length)===1){if(Ga(n))return 1;if(Ga(s))return-1}return s.length-n.length}function Ga(t){const e=t[t.length-1];return t.length>0&&e[e.length-1]<0}const Wp={strict:!1,end:!0,sensitive:!1};function Kp(t,e,r){const n=Vp(Hp(t.path),r),s=de(n,{record:t,parent:e,children:[],alias:[]});return e&&!s.record.aliasOf==!e.record.aliasOf&&e.children.push(s),s}function Gp(t,e){const r=[],n=new Map;e=Ma(Wp,e);function s(h){return n.get(h)}function i(h,d,f){const p=!f,y=Ya(h);y.aliasOf=f&&f.record;const w=Ma(e,h),k=[y];if("alias"in h){const x=typeof h.alias=="string"?[h.alias]:h.alias;for(const D of x)k.push(Ya(de({},y,{components:f?f.record.components:y.components,path:D,aliasOf:f?f.record:y})))}let _,b;for(const x of k){const{path:D}=x;if(d&&D[0]!=="/"){const M=d.record.path,U=M[M.length-1]==="/"?"":"/";x.path=d.record.path+(D&&U+D)}if(_=Kp(x,d,w),f?f.alias.push(_):(b=b||_,b!==_&&b.alias.push(_),p&&h.name&&!Xa(_)&&o(h.name)),Eu(_)&&l(_),y.children){const M=y.children;for(let U=0;U<M.length;U++)i(M[U],_,f&&f.children[U])}f=f||_}return b?()=>{o(b)}:On}function o(h){if(_u(h)){const d=n.get(h);d&&(n.delete(h),r.splice(r.indexOf(d),1),d.children.forEach(o),d.alias.forEach(o))}else{const d=r.indexOf(h);d>-1&&(r.splice(d,1),h.record.name&&n.delete(h.record.name),h.children.forEach(o),h.alias.forEach(o))}}function a(){return r}function l(h){const d=Xp(h,r);r.splice(d,0,h),h.record.name&&!Xa(h)&&n.set(h.record.name,h)}function c(h,d){let f,p={},y,w;if("name"in h&&h.name){if(f=n.get(h.name),!f)throw rn(xe.MATCHER_NOT_FOUND,{location:h});w=f.record.name,p=de(Ja(d.params,f.keys.filter(b=>!b.optional).concat(f.parent?f.parent.keys.filter(b=>b.optional):[]).map(b=>b.name)),h.params&&Ja(h.params,f.keys.map(b=>b.name))),y=f.stringify(p)}else if(h.path!=null)y=h.path,f=r.find(b=>b.re.test(y)),f&&(p=f.parse(y),w=f.record.name);else{if(f=d.name?n.get(d.name):r.find(b=>b.re.test(d.path)),!f)throw rn(xe.MATCHER_NOT_FOUND,{location:h,currentLocation:d});w=f.record.name,p=de({},d.params,h.params),y=f.stringify(p)}const k=[];let _=f;for(;_;)k.unshift(_.record),_=_.parent;return{name:w,path:y,params:p,matched:k,meta:Yp(k)}}t.forEach(h=>i(h));function u(){r.length=0,n.clear()}return{addRoute:i,resolve:c,removeRoute:o,clearRoutes:u,getRoutes:a,getRecordMatcher:s}}function Ja(t,e){const r={};for(const n of e)n in t&&(r[n]=t[n]);return r}function Ya(t){const e={path:t.path,redirect:t.redirect,name:t.name,meta:t.meta||{},aliasOf:t.aliasOf,beforeEnter:t.beforeEnter,props:Jp(t),children:t.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in t?t.components||null:t.component&&{default:t.component}};return Object.defineProperty(e,"mods",{value:{}}),e}function Jp(t){const e={},r=t.props||!1;if("component"in t)e.default=r;else for(const n in t.components)e[n]=typeof r=="object"?r[n]:r;return e}function Xa(t){for(;t;){if(t.record.aliasOf)return!0;t=t.parent}return!1}function Yp(t){return t.reduce((e,r)=>de(e,r.meta),{})}function Xp(t,e){let r=0,n=e.length;for(;r!==n;){const i=r+n>>1;Su(t,e[i])<0?n=i:r=i+1}const s=Zp(t);return s&&(n=e.lastIndexOf(s,n-1)),n}function Zp(t){let e=t;for(;e=e.parent;)if(Eu(e)&&Su(t,e)===0)return e}function Eu({record:t}){return!!(t.name||t.components&&Object.keys(t.components).length||t.redirect)}function Za(t){const e=ft(si),r=ft($o),n=je(()=>{const l=re(t.to);return e.resolve(l)}),s=je(()=>{const{matched:l}=n.value,{length:c}=l,u=l[c-1],h=r.matched;if(!u||!h.length)return-1;const d=h.findIndex(tn.bind(null,u));if(d>-1)return d;const f=Qa(l[c-2]);return c>1&&Qa(u)===f&&h[h.length-1].path!==f?h.findIndex(tn.bind(null,l[c-2])):d}),i=je(()=>s.value>-1&&ng(r.params,n.value.params)),o=je(()=>s.value>-1&&s.value===r.matched.length-1&&bu(r.params,n.value.params));function a(l={}){if(rg(l)){const c=e[re(t.replace)?"replace":"push"](re(t.to)).catch(On);return t.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>c),c}return Promise.resolve()}return{route:n,href:je(()=>n.value.href),isActive:i,isExactActive:o,navigate:a}}function Qp(t){return t.length===1?t[0]:t}const eg=pr({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"},viewTransition:Boolean},useLink:Za,setup(t,{slots:e}){const r=Xn(Za(t)),{options:n}=ft(si),s=je(()=>({[el(t.activeClass,n.linkActiveClass,"router-link-active")]:r.isActive,[el(t.exactActiveClass,n.linkExactActiveClass,"router-link-exact-active")]:r.isExactActive}));return()=>{const i=e.default&&Qp(e.default(r));return t.custom?i:Qr("a",{"aria-current":r.isExactActive?t.ariaCurrentValue:null,href:r.href,onClick:r.navigate,class:s.value},i)}}}),tg=eg;function rg(t){if(!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)&&!t.defaultPrevented&&!(t.button!==void 0&&t.button!==0)){if(t.currentTarget&&t.currentTarget.getAttribute){const e=t.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return t.preventDefault&&t.preventDefault(),!0}}function ng(t,e){for(const r in e){const n=e[r],s=t[r];if(typeof n=="string"){if(n!==s)return!1}else if(!wt(s)||s.length!==n.length||n.some((i,o)=>i.valueOf()!==s[o].valueOf()))return!1}return!0}function Qa(t){return t?t.aliasOf?t.aliasOf.path:t.path:""}const el=(t,e,r)=>t??e??r,sg=pr({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(t,{attrs:e,slots:r}){const n=ft(Xi),s=je(()=>t.route||n.value),i=ft(za,0),o=je(()=>{let c=re(i);const{matched:u}=s.value;let h;for(;(h=u[c])&&!h.components;)c++;return c}),a=je(()=>s.value.matched[o.value]);ys(za,je(()=>o.value+1)),ys($p,a),ys(Xi,s);const l=Oe();return Kt(()=>[l.value,a.value,t.name],([c,u,h],[d,f,p])=>{u&&(u.instances[h]=c,f&&f!==u&&c&&c===d&&(u.leaveGuards.size||(u.leaveGuards=f.leaveGuards),u.updateGuards.size||(u.updateGuards=f.updateGuards))),c&&u&&(!f||!tn(u,f)||!d)&&(u.enterCallbacks[h]||[]).forEach(y=>y(c))},{flush:"post"}),()=>{const c=s.value,u=t.name,h=a.value,d=h&&h.components[u];if(!d)return tl(r.default,{Component:d,route:c});const f=h.props[u],p=f?f===!0?c.params:typeof f=="function"?f(c):f:null,w=Qr(d,de({},p,e,{onVnodeUnmounted:k=>{k.component.isUnmounted&&(h.instances[u]=null)},ref:l}));return tl(r.default,{Component:w,route:c})||w}}});function tl(t,e){if(!t)return null;const r=t(e);return r.length===1?r[0]:r}const ig=sg;function og(t){const e=Gp(t.routes,t),r=t.parseQuery||Pp,n=t.stringifyQuery||Va,s=t.history,i=fn(),o=fn(),a=fn(),l=Kh(sr);let c=sr;Mr&&t.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const u=Ei.bind(null,T=>""+T),h=Ei.bind(null,pp),d=Ei.bind(null,Fn);function f(T,H){let N,W;return _u(T)?(N=e.getRecordMatcher(T),W=H):W=T,e.addRoute(W,N)}function p(T){const H=e.getRecordMatcher(T);H&&e.removeRoute(H)}function y(){return e.getRoutes().map(T=>T.record)}function w(T){return!!e.getRecordMatcher(T)}function k(T,H){if(H=de({},H||l.value),typeof T=="string"){const v=Ti(r,T,H.path),S=e.resolve({path:v.path},H),A=s.createHref(v.fullPath);return de(v,S,{params:d(S.params),hash:Fn(v.hash),redirectedFrom:void 0,href:A})}let N;if(T.path!=null)N=de({},T,{path:Ti(r,T.path,H.path).path});else{const v=de({},T.params);for(const S in v)v[S]==null&&delete v[S];N=de({},T,{params:h(v)}),H.params=h(H.params)}const W=e.resolve(N,H),oe=T.hash||"";W.params=u(d(W.params));const g=yp(n,de({},T,{hash:hp(oe),path:W.path})),m=s.createHref(g);return de({fullPath:g,hash:oe,query:n===Va?Ip(T.query):T.query||{}},W,{redirectedFrom:void 0,href:m})}function _(T){return typeof T=="string"?Ti(r,T,l.value.path):de({},T)}function b(T,H){if(c!==T)return rn(xe.NAVIGATION_CANCELLED,{from:H,to:T})}function x(T){return U(T)}function D(T){return x(de(_(T),{replace:!0}))}function M(T,H){const N=T.matched[T.matched.length-1];if(N&&N.redirect){const{redirect:W}=N;let oe=typeof W=="function"?W(T,H):W;return typeof oe=="string"&&(oe=oe.includes("?")||oe.includes("#")?oe=_(oe):{path:oe},oe.params={}),de({query:T.query,hash:T.hash,params:oe.path!=null?{}:T.params},oe)}}function U(T,H){const N=c=k(T),W=l.value,oe=T.state,g=T.force,m=T.replace===!0,v=M(N,W);if(v)return U(de(_(v),{state:typeof v=="object"?de({},oe,v.state):oe,force:g,replace:m}),H||N);const S=N;S.redirectedFrom=H;let A;return!g&&vp(n,W,N)&&(A=rn(xe.NAVIGATION_DUPLICATED,{to:S,from:W}),ie(W,W,!0,!1)),(A?Promise.resolve(A):z(S,W)).catch(E=>Bt(E)?Bt(E,xe.NAVIGATION_GUARD_REDIRECT)?E:We(E):L(E,S,W)).then(E=>{if(E){if(Bt(E,xe.NAVIGATION_GUARD_REDIRECT))return U(de({replace:m},_(E.to),{state:typeof E.to=="object"?de({},oe,E.to.state):oe,force:g}),H||S)}else E=O(S,W,!0,m,oe);return Q(S,W,E),E})}function V(T,H){const N=b(T,H);return N?Promise.reject(N):Promise.resolve()}function C(T){const H=Pr.values().next().value;return H&&typeof H.runWithContext=="function"?H.runWithContext(T):T()}function z(T,H){let N;const[W,oe,g]=jp(T,H);N=xi(W.reverse(),"beforeRouteLeave",T,H);for(const v of W)v.leaveGuards.forEach(S=>{N.push(ar(S,T,H))});const m=V.bind(null,T,H);return N.push(m),ut(N).then(()=>{N=[];for(const v of i.list())N.push(ar(v,T,H));return N.push(m),ut(N)}).then(()=>{N=xi(oe,"beforeRouteUpdate",T,H);for(const v of oe)v.updateGuards.forEach(S=>{N.push(ar(S,T,H))});return N.push(m),ut(N)}).then(()=>{N=[];for(const v of g)if(v.beforeEnter)if(wt(v.beforeEnter))for(const S of v.beforeEnter)N.push(ar(S,T,H));else N.push(ar(v.beforeEnter,T,H));return N.push(m),ut(N)}).then(()=>(T.matched.forEach(v=>v.enterCallbacks={}),N=xi(g,"beforeRouteEnter",T,H,C),N.push(m),ut(N))).then(()=>{N=[];for(const v of o.list())N.push(ar(v,T,H));return N.push(m),ut(N)}).catch(v=>Bt(v,xe.NAVIGATION_CANCELLED)?v:Promise.reject(v))}function Q(T,H,N){a.list().forEach(W=>C(()=>W(T,H,N)))}function O(T,H,N,W,oe){const g=b(T,H);if(g)return g;const m=H===sr,v=Mr?history.state:{};N&&(W||m?s.replace(T.fullPath,de({scroll:m&&v&&v.scroll},oe)):s.push(T.fullPath,oe)),l.value=T,ie(T,H,N,m),We()}let Y;function Ee(){Y||(Y=s.listen((T,H,N)=>{if(!gr.listening)return;const W=k(T),oe=M(W,gr.currentRoute.value);if(oe){U(de(oe,{replace:!0,force:!0}),W).catch(On);return}c=W;const g=l.value;Mr&&Ap(Fa(g.fullPath,N.delta),ni()),z(W,g).catch(m=>Bt(m,xe.NAVIGATION_ABORTED|xe.NAVIGATION_CANCELLED)?m:Bt(m,xe.NAVIGATION_GUARD_REDIRECT)?(U(de(_(m.to),{force:!0}),W).then(v=>{Bt(v,xe.NAVIGATION_ABORTED|xe.NAVIGATION_DUPLICATED)&&!N.delta&&N.type===Ji.pop&&s.go(-1,!1)}).catch(On),Promise.reject()):(N.delta&&s.go(-N.delta,!1),L(m,W,g))).then(m=>{m=m||O(W,g,!1),m&&(N.delta&&!Bt(m,xe.NAVIGATION_CANCELLED)?s.go(-N.delta,!1):N.type===Ji.pop&&Bt(m,xe.NAVIGATION_ABORTED|xe.NAVIGATION_DUPLICATED)&&s.go(-1,!1)),Q(W,g,m)}).catch(On)}))}let Ne=fn(),ye=fn(),te;function L(T,H,N){We(T);const W=ye.list();return W.length?W.forEach(oe=>oe(T,H,N)):console.error(T),Promise.reject(T)}function se(){return te&&l.value!==sr?Promise.resolve():new Promise((T,H)=>{Ne.add([T,H])})}function We(T){return te||(te=!T,Ee(),Ne.list().forEach(([H,N])=>T?N(T):H()),Ne.reset()),T}function ie(T,H,N,W){const{scrollBehavior:oe}=t;if(!Mr||!oe)return Promise.resolve();const g=!N&&xp(Fa(T.fullPath,0))||(W||!N)&&history.state&&history.state.scroll||null;return hr().then(()=>oe(T,H,g)).then(m=>m&&Tp(m)).catch(m=>L(m,T,H))}const ae=T=>s.go(T);let Lt;const Pr=new Set,gr={currentRoute:l,listening:!0,addRoute:f,removeRoute:p,clearRoutes:e.clearRoutes,hasRoute:w,getRoutes:y,resolve:k,options:t,push:x,replace:D,go:ae,back:()=>ae(-1),forward:()=>ae(1),beforeEach:i.add,beforeResolve:o.add,afterEach:a.add,onError:ye.add,isReady:se,install(T){T.component("RouterLink",tg),T.component("RouterView",ig),T.config.globalProperties.$router=gr,Object.defineProperty(T.config.globalProperties,"$route",{enumerable:!0,get:()=>re(l)}),Mr&&!Lt&&l.value===sr&&(Lt=!0,x(s.location).catch(W=>{}));const H={};for(const W in sr)Object.defineProperty(H,W,{get:()=>l.value[W],enumerable:!0});T.provide(si,gr),T.provide($o,pc(H)),T.provide(Xi,l);const N=T.unmount;Pr.add(T),T.unmount=function(){Pr.delete(T),Pr.size<1&&(c=sr,Y&&Y(),Y=null,l.value=sr,Lt=!1,te=!1),N()}}};function ut(T){return T.reduce((H,N)=>H.then(()=>C(N)),Promise.resolve())}return gr}function ag(){return ft(si)}function jo(t){return ft($o)}const Tu="/logo.svg",lg=["width","height"],Zi=pr({__name:"LogoIcon",props:{size:{}},setup(t){return(e,r)=>(Z(),ue("img",{src:Tu,alt:"IO",width:t.size??32,height:t.size??32,class:"inline-block"},null,8,lg))}});/**
|
|
31
|
-
* @license lucide-vue-next v0.474.0 - ISC
|
|
32
|
-
*
|
|
33
|
-
* This source code is licensed under the ISC license.
|
|
34
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
35
|
-
*/const cg=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
|
|
36
|
-
* @license lucide-vue-next v0.474.0 - ISC
|
|
37
|
-
*
|
|
38
|
-
* This source code is licensed under the ISC license.
|
|
39
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
40
|
-
*/var is={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};/**
|
|
41
|
-
* @license lucide-vue-next v0.474.0 - ISC
|
|
42
|
-
*
|
|
43
|
-
* This source code is licensed under the ISC license.
|
|
44
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
45
|
-
*/const ug=({size:t,strokeWidth:e=2,absoluteStrokeWidth:r,color:n,iconNode:s,name:i,class:o,...a},{slots:l})=>Qr("svg",{...is,width:t||is.width,height:t||is.height,stroke:n||is.stroke,"stroke-width":r?Number(e)*24/Number(t):e,class:["lucide",`lucide-${cg(i??"icon")}`],...a},[...s.map(c=>Qr(...c)),...l.default?[l.default()]:[]]);/**
|
|
46
|
-
* @license lucide-vue-next v0.474.0 - ISC
|
|
47
|
-
*
|
|
48
|
-
* This source code is licensed under the ISC license.
|
|
49
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
50
|
-
*/const Ae=(t,e)=>(r,{slots:n})=>Qr(ug,{...r,iconNode:e,name:t},n);/**
|
|
51
|
-
* @license lucide-vue-next v0.474.0 - ISC
|
|
52
|
-
*
|
|
53
|
-
* This source code is licensed under the ISC license.
|
|
54
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
55
|
-
*/const hg=Ae("ActivityIcon",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/**
|
|
56
|
-
* @license lucide-vue-next v0.474.0 - ISC
|
|
57
|
-
*
|
|
58
|
-
* This source code is licensed under the ISC license.
|
|
59
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
60
|
-
*/const dg=Ae("BookOpenIcon",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/**
|
|
61
|
-
* @license lucide-vue-next v0.474.0 - ISC
|
|
62
|
-
*
|
|
63
|
-
* This source code is licensed under the ISC license.
|
|
64
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
65
|
-
*/const fg=Ae("ChartColumnIcon",[["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"}]]);/**
|
|
66
|
-
* @license lucide-vue-next v0.474.0 - ISC
|
|
67
|
-
*
|
|
68
|
-
* This source code is licensed under the ISC license.
|
|
69
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
70
|
-
*/const pg=Ae("ChevronDownIcon",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
|
|
71
|
-
* @license lucide-vue-next v0.474.0 - ISC
|
|
72
|
-
*
|
|
73
|
-
* This source code is licensed under the ISC license.
|
|
74
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
75
|
-
*/const gg=Ae("ClipboardListIcon",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/**
|
|
76
|
-
* @license lucide-vue-next v0.474.0 - ISC
|
|
77
|
-
*
|
|
78
|
-
* This source code is licensed under the ISC license.
|
|
79
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
80
|
-
*/const mg=Ae("ClockIcon",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
|
|
81
|
-
* @license lucide-vue-next v0.474.0 - ISC
|
|
82
|
-
*
|
|
83
|
-
* This source code is licensed under the ISC license.
|
|
84
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
85
|
-
*/const rl=Ae("FileTextIcon",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
|
|
86
|
-
* @license lucide-vue-next v0.474.0 - ISC
|
|
87
|
-
*
|
|
88
|
-
* This source code is licensed under the ISC license.
|
|
89
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
90
|
-
*/const yg=Ae("GithubIcon",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]);/**
|
|
91
|
-
* @license lucide-vue-next v0.474.0 - ISC
|
|
92
|
-
*
|
|
93
|
-
* This source code is licensed under the ISC license.
|
|
94
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
95
|
-
*/const vg=Ae("HistoryIcon",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);/**
|
|
96
|
-
* @license lucide-vue-next v0.474.0 - ISC
|
|
97
|
-
*
|
|
98
|
-
* This source code is licensed under the ISC license.
|
|
99
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
100
|
-
*/const nl=Ae("ImageIcon",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
|
|
101
|
-
* @license lucide-vue-next v0.474.0 - ISC
|
|
102
|
-
*
|
|
103
|
-
* This source code is licensed under the ISC license.
|
|
104
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
105
|
-
*/const Au=Ae("InboxIcon",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]);/**
|
|
106
|
-
* @license lucide-vue-next v0.474.0 - ISC
|
|
107
|
-
*
|
|
108
|
-
* This source code is licensed under the ISC license.
|
|
109
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
110
|
-
*/const bg=Ae("LogOutIcon",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
|
|
111
|
-
* @license lucide-vue-next v0.474.0 - ISC
|
|
112
|
-
*
|
|
113
|
-
* This source code is licensed under the ISC license.
|
|
114
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
115
|
-
*/const xu=Ae("MessageSquareIcon",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
|
|
116
|
-
* @license lucide-vue-next v0.474.0 - ISC
|
|
117
|
-
*
|
|
118
|
-
* This source code is licensed under the ISC license.
|
|
119
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
120
|
-
*/const _g=Ae("Minimize2Icon",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
|
|
121
|
-
* @license lucide-vue-next v0.474.0 - ISC
|
|
122
|
-
*
|
|
123
|
-
* This source code is licensed under the ISC license.
|
|
124
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
125
|
-
*/const wg=Ae("PanelLeftCloseIcon",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]);/**
|
|
126
|
-
* @license lucide-vue-next v0.474.0 - ISC
|
|
127
|
-
*
|
|
128
|
-
* This source code is licensed under the ISC license.
|
|
129
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
130
|
-
*/const kg=Ae("PanelLeftOpenIcon",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]]);/**
|
|
131
|
-
* @license lucide-vue-next v0.474.0 - ISC
|
|
132
|
-
*
|
|
133
|
-
* This source code is licensed under the ISC license.
|
|
134
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
135
|
-
*/const Sg=Ae("PaperclipIcon",[["path",{d:"M13.234 20.252 21 12.3",key:"1cbrk9"}],["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 0 2.828 2 2 0 0 0 2.828 0l8.414-8.586a4 4 0 0 0 0-5.656 4 4 0 0 0-5.656 0l-8.415 8.585a6 6 0 1 0 8.486 8.486",key:"1pkts6"}]]);/**
|
|
136
|
-
* @license lucide-vue-next v0.474.0 - ISC
|
|
137
|
-
*
|
|
138
|
-
* This source code is licensed under the ISC license.
|
|
139
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
140
|
-
*/const Eg=Ae("PuzzleIcon",[["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"}]]);/**
|
|
141
|
-
* @license lucide-vue-next v0.474.0 - ISC
|
|
142
|
-
*
|
|
143
|
-
* This source code is licensed under the ISC license.
|
|
144
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
145
|
-
*/const Tg=Ae("SendIcon",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/**
|
|
146
|
-
* @license lucide-vue-next v0.474.0 - ISC
|
|
147
|
-
*
|
|
148
|
-
* This source code is licensed under the ISC license.
|
|
149
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
150
|
-
*/const Ag=Ae("ServerIcon",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/**
|
|
151
|
-
* @license lucide-vue-next v0.474.0 - ISC
|
|
152
|
-
*
|
|
153
|
-
* This source code is licensed under the ISC license.
|
|
154
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
155
|
-
*/const xg=Ae("SettingsIcon",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
|
|
156
|
-
* @license lucide-vue-next v0.474.0 - ISC
|
|
157
|
-
*
|
|
158
|
-
* This source code is licensed under the ISC license.
|
|
159
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
160
|
-
*/const Rg=Ae("SquareIcon",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
|
|
161
|
-
* @license lucide-vue-next v0.474.0 - ISC
|
|
162
|
-
*
|
|
163
|
-
* This source code is licensed under the ISC license.
|
|
164
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
165
|
-
*/const Cg=Ae("UserIcon",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
|
|
166
|
-
* @license lucide-vue-next v0.474.0 - ISC
|
|
167
|
-
*
|
|
168
|
-
* This source code is licensed under the ISC license.
|
|
169
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
170
|
-
*/const Og=Ae("UsersIcon",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]),Pg={key:0,class:"font-display text-[1.1rem] font-normal uppercase tracking-[0.18em] bg-gradient-brand bg-clip-text text-transparent"},Ig=["title"],$g={class:"flex-1 p-2 space-y-0.5 overflow-y-auto"},jg={key:0},Ng={class:"border-t border-border p-2 space-y-0.5"},Lg={key:0},Dg=["href"],sl="https://github.com/michaeljolley/io",Ug=pr({__name:"AppSidebar",setup(t){const e=jo(),r=Oe(!1),n=[{name:"History",icon:vg,path:"/history"},{name:"Squads",icon:Og,path:"/squads"},{name:"Health",icon:hg,path:"/squads/health"},{name:"Usage",icon:fg,path:"/usage"},{name:"Audit Log",icon:gg,path:"/audit-log"},{name:"Skills",icon:Eg,path:"/skills"},{name:"MCP Servers",icon:Ag,path:"/mcp"},{name:"Schedules",icon:mg,path:"/schedules"},{name:"Wiki",icon:dg,path:"/wiki"}],s=[{name:"Chat",icon:xu,path:"/"},{name:"Feed",icon:Au,path:"/feed"},{name:"Settings",icon:xg,path:"/settings"}],i="1.13.0",o=je(()=>{let l="";const c=[...n,...s];for(const u of c){const h=u.path;(h==="/"?e.path==="/":e.path===h||e.path.startsWith(h+"/"))&&h.length>l.length&&(l=h)}return l});function a(){r.value=!r.value}return(l,c)=>{const u=Zs("router-link");return Z(),ue("aside",{class:Ye(["border-r border-border bg-sidebar flex flex-col h-full shrink-0 transition-all duration-200",r.value?"w-16":"w-56"])},[ne("div",{class:Ye(["p-3 border-b border-border flex items-center",r.value?"justify-center":"justify-between"])},[he(u,{to:"/",class:Ye(["flex items-center gap-2",r.value?"justify-center":""])},{default:Yr(()=>[he(Zi,{size:24}),r.value?$e("",!0):(Z(),ue("h1",Pg," IO "))]),_:1},8,["class"]),r.value?$e("",!0):(Z(),ue("button",{key:0,onClick:a,class:"p-1 rounded-full hover:bg-accent/70 text-muted-foreground hover:text-foreground transition-colors",title:r.value?"Expand sidebar":"Collapse sidebar"},[he(re(wg),{class:"w-4 h-4"})],8,Ig))],2),r.value?(Z(),ue("button",{key:0,onClick:a,class:"mx-auto mt-2 p-1.5 rounded-full hover:bg-accent/70 text-muted-foreground hover:text-foreground transition-colors",title:"Expand sidebar"},[he(re(kg),{class:"w-4 h-4"})])):$e("",!0),ne("nav",$g,[(Z(),ue(Fe,null,zr(n,h=>he(u,{key:h.path,to:h.path,class:Ye(["flex items-center gap-3 rounded-full text-sm transition-colors border border-transparent",[r.value?"justify-center px-2 py-2":"px-3 py-2",o.value===h.path?"bg-accent text-accent-foreground font-medium border border-white/10":"text-muted-foreground hover:bg-white/5 hover:text-foreground"]]),title:r.value?h.name:void 0},{default:Yr(()=>[(Z(),nt(sa(h.icon),{class:"w-4 h-4 shrink-0"})),r.value?$e("",!0):(Z(),ue("span",jg,it(h.name),1))]),_:2},1032,["to","class","title"])),64))]),ne("div",Ng,[(Z(),ue(Fe,null,zr(s,h=>he(u,{key:h.path,to:h.path,class:Ye(["flex items-center gap-3 rounded-full text-sm transition-colors border border-transparent",[r.value?"justify-center px-2 py-2":"px-3 py-2",o.value===h.path?"bg-accent text-accent-foreground font-medium border border-white/10":"text-muted-foreground hover:bg-white/5 hover:text-foreground"]]),title:r.value?h.name:void 0},{default:Yr(()=>[(Z(),nt(sa(h.icon),{class:"w-4 h-4 shrink-0"})),r.value?$e("",!0):(Z(),ue("span",Lg,it(h.name),1))]),_:2},1032,["to","class","title"])),64)),ne("div",{class:Ye(["flex items-center pt-2 mt-2 border-t border-border",r.value?"justify-center":"justify-between px-3"])},[r.value?$e("",!0):(Z(),ue("a",{key:0,href:`${sl}/releases/tag/v${re(i)}`,target:"_blank",class:"text-[10px] text-muted-foreground hover:text-foreground transition-colors",title:"Release notes"}," v"+it(re(i)),9,Dg)),ne("a",{href:sl,target:"_blank",class:"p-1 rounded-full hover:bg-accent/70 text-muted-foreground hover:text-foreground transition-colors",title:"GitHub repository"},[he(re(yg),{class:"w-3.5 h-3.5"})])],2)])],2)}}});function ii(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(t);s<n.length;s++)e.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(t,n[s])&&(r[n[s]]=t[n[s]]);return r}function Bg(t,e,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function a(u){try{c(n.next(u))}catch(h){o(h)}}function l(u){try{c(n.throw(u))}catch(h){o(h)}}function c(u){u.done?i(u.value):s(u.value).then(a,l)}c((n=n.apply(t,e||[])).next())})}const Mg=t=>t?(...e)=>t(...e):(...e)=>fetch(...e);class No extends Error{constructor(e,r="FunctionsError",n){super(e),this.name=r,this.context=n}toJSON(){return{name:this.name,message:this.message,context:this.context}}}class Hg extends No{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class il extends No{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class ol extends No{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var Qi;(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(Qi||(Qi={}));class qg{constructor(e,{headers:r={},customFetch:n,region:s=Qi.Any}={}){this.url=e,this.headers=r,this.region=s,this.fetch=Mg(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return Bg(this,arguments,void 0,function*(r,n={}){var s;let i,o;try{const{headers:a,method:l,body:c,signal:u,timeout:h}=n;let d={},{region:f}=n;f||(f=this.region);const p=new URL(`${this.url}/${r}`);f&&f!=="any"&&(d["x-region"]=f,p.searchParams.set("forceFunctionRegion",f));let y;c&&(a&&!Object.prototype.hasOwnProperty.call(a,"Content-Type")||!a)?typeof Blob<"u"&&c instanceof Blob||c instanceof ArrayBuffer?(d["Content-Type"]="application/octet-stream",y=c):typeof c=="string"?(d["Content-Type"]="text/plain",y=c):typeof FormData<"u"&&c instanceof FormData?y=c:(d["Content-Type"]="application/json",y=JSON.stringify(c)):c&&typeof c!="string"&&!(typeof Blob<"u"&&c instanceof Blob)&&!(c instanceof ArrayBuffer)&&!(typeof FormData<"u"&&c instanceof FormData)?y=JSON.stringify(c):y=c;let w=u;h&&(o=new AbortController,i=setTimeout(()=>o.abort(),h),u?(w=o.signal,u.addEventListener("abort",()=>o.abort())):w=o.signal);const k=yield this.fetch(p.toString(),{method:l||"POST",headers:Object.assign(Object.assign(Object.assign({},d),this.headers),a),body:y,signal:w}).catch(D=>{throw new Hg(D)}),_=k.headers.get("x-relay-error");if(_&&_==="true")throw new il(k);if(!k.ok)throw new ol(k);let b=((s=k.headers.get("Content-Type"))!==null&&s!==void 0?s:"text/plain").split(";")[0].trim(),x;return b==="application/json"?x=yield k.json():b==="application/octet-stream"||b==="application/pdf"?x=yield k.blob():b==="text/event-stream"?x=k:b==="multipart/form-data"?x=yield k.formData():x=yield k.text(),{data:x,error:null,response:k}}catch(a){return{data:null,error:a,response:a instanceof ol||a instanceof il?a.context:void 0}}finally{i&&clearTimeout(i)}})}}const Ru=3,al=t=>Math.min(1e3*2**t,3e4),Fg=[520,503],Cu=["GET","HEAD","OPTIONS"];var Vg=class extends Error{constructor(t){super(t.message),this.name="PostgrestError",this.details=t.details,this.hint=t.hint,this.code=t.code}toJSON(){return{name:this.name,message:this.message,details:this.details,hint:this.hint,code:this.code}}};function ll(t,e){return new Promise(r=>{if(e!=null&&e.aborted){r();return}const n=setTimeout(()=>{e==null||e.removeEventListener("abort",s),r()},t);function s(){clearTimeout(n),r()}e==null||e.addEventListener("abort",s)})}function zg(t,e,r,n){return!(!n||r>=Ru||!Cu.includes(t)||!Fg.includes(e))}var Wg=class{constructor(t){var e,r,n,s,i;this.shouldThrowOnError=!1,this.retryEnabled=!0,this.method=t.method,this.url=t.url,this.headers=new Headers(t.headers),this.schema=t.schema,this.body=t.body,this.shouldThrowOnError=(e=t.shouldThrowOnError)!==null&&e!==void 0?e:!1,this.signal=t.signal,this.isMaybeSingle=(r=t.isMaybeSingle)!==null&&r!==void 0?r:!1,this.shouldStripNulls=(n=t.shouldStripNulls)!==null&&n!==void 0?n:!1,this.urlLengthLimit=(s=t.urlLengthLimit)!==null&&s!==void 0?s:8e3,this.retryEnabled=(i=t.retry)!==null&&i!==void 0?i:!0,t.fetch?this.fetch=t.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}stripNulls(){if(this.headers.get("Accept")==="text/csv")throw new Error("stripNulls() cannot be used with csv()");return this.shouldStripNulls=!0,this}setHeader(t,e){return this.headers=new Headers(this.headers),this.headers.set(t,e),this}retry(t){return this.retryEnabled=t,this}then(t,e){var r=this;if(this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json"),this.shouldStripNulls){const o=this.headers.get("Accept");o==="application/vnd.pgrst.object+json"?this.headers.set("Accept","application/vnd.pgrst.object+json;nulls=stripped"):(!o||o==="application/json")&&this.headers.set("Accept","application/vnd.pgrst.array+json;nulls=stripped")}const n=this.fetch;let i=(async()=>{let o=0;for(;;){const c=new Headers(r.headers);o>0&&c.set("X-Retry-Count",String(o));let u;try{u=await n(r.url.toString(),{method:r.method,headers:c,body:JSON.stringify(r.body,(h,d)=>typeof d=="bigint"?d.toString():d),signal:r.signal})}catch(h){if((h==null?void 0:h.name)==="AbortError"||(h==null?void 0:h.code)==="ABORT_ERR"||!Cu.includes(r.method))throw h;if(r.retryEnabled&&o<Ru){const d=al(o);o++,await ll(d,r.signal);continue}throw h}if(zg(r.method,u.status,o,r.retryEnabled)){var a,l;const h=(a=(l=u.headers)===null||l===void 0?void 0:l.get("Retry-After"))!==null&&a!==void 0?a:null,d=h!==null?Math.max(0,parseInt(h,10)||0)*1e3:al(o);await u.text(),o++,await ll(d,r.signal);continue}return await r.processResponse(u)}})();return this.shouldThrowOnError||(i=i.catch(o=>{var a;let l="",c="",u="";const h=o==null?void 0:o.cause;if(h){var d,f,p,y;const _=(d=h==null?void 0:h.message)!==null&&d!==void 0?d:"",b=(f=h==null?void 0:h.code)!==null&&f!==void 0?f:"";l=`${(p=o==null?void 0:o.name)!==null&&p!==void 0?p:"FetchError"}: ${o==null?void 0:o.message}`,l+=`
|
|
171
|
-
|
|
172
|
-
Caused by: ${(y=h==null?void 0:h.name)!==null&&y!==void 0?y:"Error"}: ${_}`,b&&(l+=` (${b})`),h!=null&&h.stack&&(l+=`
|
|
173
|
-
${h.stack}`)}else{var w;l=(w=o==null?void 0:o.stack)!==null&&w!==void 0?w:""}const k=this.url.toString().length;return(o==null?void 0:o.name)==="AbortError"||(o==null?void 0:o.code)==="ABORT_ERR"?(u="",c="Request was aborted (timeout or manual cancellation)",k>this.urlLengthLimit&&(c+=`. Note: Your request URL is ${k} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`)):((h==null?void 0:h.name)==="HeadersOverflowError"||(h==null?void 0:h.code)==="UND_ERR_HEADERS_OVERFLOW")&&(u="",c="HTTP headers exceeded server limits (typically 16KB)",k>this.urlLengthLimit&&(c+=`. Your request URL is ${k} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`)),{success:!1,error:{message:`${(a=o==null?void 0:o.name)!==null&&a!==void 0?a:"FetchError"}: ${o==null?void 0:o.message}`,details:l,hint:c,code:u},data:null,count:null,status:0,statusText:""}})),i.then(t,e)}async processResponse(t){var e=this;let r=null,n=null,s=null,i=t.status,o=t.statusText;if(t.ok){var a,l;if(e.method!=="HEAD"){var c;const d=await t.text();d===""||(e.headers.get("Accept")==="text/csv"||e.headers.get("Accept")&&(!((c=e.headers.get("Accept"))===null||c===void 0)&&c.includes("application/vnd.pgrst.plan+text"))?n=d:n=JSON.parse(d))}const u=(a=e.headers.get("Prefer"))===null||a===void 0?void 0:a.match(/count=(exact|planned|estimated)/),h=(l=t.headers.get("content-range"))===null||l===void 0?void 0:l.split("/");u&&h&&h.length>1&&(s=parseInt(h[1])),e.isMaybeSingle&&Array.isArray(n)&&(n.length>1?(r={code:"PGRST116",details:`Results contain ${n.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},n=null,s=null,i=406,o="Not Acceptable"):n.length===1?n=n[0]:n=null)}else{const u=await t.text();try{r=JSON.parse(u),Array.isArray(r)&&t.status===404&&(n=[],r=null,i=200,o="OK")}catch{t.status===404&&u===""?(i=204,o="No Content"):r={message:u}}if(r&&e.shouldThrowOnError)throw new Vg(r)}return{success:r===null,error:r,data:n,count:s,status:i,statusText:o}}returns(){return this}overrideTypes(){return this}},Kg=class extends Wg{select(t){let e=!1;const r=(t??"*").split("").map(n=>/\s/.test(n)&&!e?"":(n==='"'&&(e=!e),n)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(t,{ascending:e=!0,nullsFirst:r,foreignTable:n,referencedTable:s=n}={}){const i=s?`${s}.order`:"order",o=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${o?`${o},`:""}${t}.${e?"asc":"desc"}${r===void 0?"":r?".nullsfirst":".nullslast"}`),this}limit(t,{foreignTable:e,referencedTable:r=e}={}){const n=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(n,`${t}`),this}range(t,e,{foreignTable:r,referencedTable:n=r}={}){const s=typeof n>"u"?"offset":`${n}.offset`,i=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(s,`${t}`),this.url.searchParams.set(i,`${e-t+1}`),this}abortSignal(t){return this.signal=t,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:t=!1,verbose:e=!1,settings:r=!1,buffers:n=!1,wal:s=!1,format:i="text"}={}){var o;const a=[t?"analyze":null,e?"verbose":null,r?"settings":null,n?"buffers":null,s?"wal":null].filter(Boolean).join("|"),l=(o=this.headers.get("Accept"))!==null&&o!==void 0?o:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${l}"; options=${a};`),i==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(t){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${t}`),this}};const cl=new RegExp("[,()]");var Hr=class extends Kg{eq(t,e){return this.url.searchParams.append(t,`eq.${e}`),this}neq(t,e){return this.url.searchParams.append(t,`neq.${e}`),this}gt(t,e){return this.url.searchParams.append(t,`gt.${e}`),this}gte(t,e){return this.url.searchParams.append(t,`gte.${e}`),this}lt(t,e){return this.url.searchParams.append(t,`lt.${e}`),this}lte(t,e){return this.url.searchParams.append(t,`lte.${e}`),this}like(t,e){return this.url.searchParams.append(t,`like.${e}`),this}likeAllOf(t,e){return this.url.searchParams.append(t,`like(all).{${e.join(",")}}`),this}likeAnyOf(t,e){return this.url.searchParams.append(t,`like(any).{${e.join(",")}}`),this}ilike(t,e){return this.url.searchParams.append(t,`ilike.${e}`),this}ilikeAllOf(t,e){return this.url.searchParams.append(t,`ilike(all).{${e.join(",")}}`),this}ilikeAnyOf(t,e){return this.url.searchParams.append(t,`ilike(any).{${e.join(",")}}`),this}regexMatch(t,e){return this.url.searchParams.append(t,`match.${e}`),this}regexIMatch(t,e){return this.url.searchParams.append(t,`imatch.${e}`),this}is(t,e){return this.url.searchParams.append(t,`is.${e}`),this}isDistinct(t,e){return this.url.searchParams.append(t,`isdistinct.${e}`),this}in(t,e){const r=Array.from(new Set(e)).map(n=>typeof n=="string"&&cl.test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(t,`in.(${r})`),this}notIn(t,e){const r=Array.from(new Set(e)).map(n=>typeof n=="string"&&cl.test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(t,`not.in.(${r})`),this}contains(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cs.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cs.{${e.join(",")}}`):this.url.searchParams.append(t,`cs.${JSON.stringify(e)}`),this}containedBy(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cd.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cd.{${e.join(",")}}`):this.url.searchParams.append(t,`cd.${JSON.stringify(e)}`),this}rangeGt(t,e){return this.url.searchParams.append(t,`sr.${e}`),this}rangeGte(t,e){return this.url.searchParams.append(t,`nxl.${e}`),this}rangeLt(t,e){return this.url.searchParams.append(t,`sl.${e}`),this}rangeLte(t,e){return this.url.searchParams.append(t,`nxr.${e}`),this}rangeAdjacent(t,e){return this.url.searchParams.append(t,`adj.${e}`),this}overlaps(t,e){return typeof e=="string"?this.url.searchParams.append(t,`ov.${e}`):this.url.searchParams.append(t,`ov.{${e.join(",")}}`),this}textSearch(t,e,{config:r,type:n}={}){let s="";n==="plain"?s="pl":n==="phrase"?s="ph":n==="websearch"&&(s="w");const i=r===void 0?"":`(${r})`;return this.url.searchParams.append(t,`${s}fts${i}.${e}`),this}match(t){return Object.entries(t).filter(([e,r])=>r!==void 0).forEach(([e,r])=>{this.url.searchParams.append(e,`eq.${r}`)}),this}not(t,e,r){return this.url.searchParams.append(t,`not.${e}.${r}`),this}or(t,{foreignTable:e,referencedTable:r=e}={}){const n=r?`${r}.or`:"or";return this.url.searchParams.append(n,`(${t})`),this}filter(t,e,r){return this.url.searchParams.append(t,`${e}.${r}`),this}},Gg=class{constructor(t,{headers:e={},schema:r,fetch:n,urlLengthLimit:s=8e3,retry:i}){this.url=t,this.headers=new Headers(e),this.schema=r,this.fetch=n,this.urlLengthLimit=s,this.retry=i}cloneRequestState(){return{url:new URL(this.url.toString()),headers:new Headers(this.headers)}}select(t,e){const{head:r=!1,count:n}=e??{},s=r?"HEAD":"GET";let i=!1;const o=(t??"*").split("").map(c=>/\s/.test(c)&&!i?"":(c==='"'&&(i=!i),c)).join(""),{url:a,headers:l}=this.cloneRequestState();return a.searchParams.set("select",o),n&&l.append("Prefer",`count=${n}`),new Hr({method:s,url:a,headers:l,schema:this.schema,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}insert(t,{count:e,defaultToNull:r=!0}={}){var n;const s="POST",{url:i,headers:o}=this.cloneRequestState();if(e&&o.append("Prefer",`count=${e}`),r||o.append("Prefer","missing=default"),Array.isArray(t)){const a=t.reduce((l,c)=>l.concat(Object.keys(c)),[]);if(a.length>0){const l=[...new Set(a)].map(c=>`"${c}"`);i.searchParams.set("columns",l.join(","))}}return new Hr({method:s,url:i,headers:o,schema:this.schema,body:t,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}upsert(t,{onConflict:e,ignoreDuplicates:r=!1,count:n,defaultToNull:s=!0}={}){var i;const o="POST",{url:a,headers:l}=this.cloneRequestState();if(l.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),e!==void 0&&a.searchParams.set("on_conflict",e),n&&l.append("Prefer",`count=${n}`),s||l.append("Prefer","missing=default"),Array.isArray(t)){const c=t.reduce((u,h)=>u.concat(Object.keys(h)),[]);if(c.length>0){const u=[...new Set(c)].map(h=>`"${h}"`);a.searchParams.set("columns",u.join(","))}}return new Hr({method:o,url:a,headers:l,schema:this.schema,body:t,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}update(t,{count:e}={}){var r;const n="PATCH",{url:s,headers:i}=this.cloneRequestState();return e&&i.append("Prefer",`count=${e}`),new Hr({method:n,url:s,headers:i,schema:this.schema,body:t,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}delete({count:t}={}){var e;const r="DELETE",{url:n,headers:s}=this.cloneRequestState();return t&&s.append("Prefer",`count=${t}`),new Hr({method:r,url:n,headers:s,schema:this.schema,fetch:(e=this.fetch)!==null&&e!==void 0?e:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};function Vn(t){"@babel/helpers - typeof";return Vn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Vn(t)}function Jg(t,e){if(Vn(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Vn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Yg(t){var e=Jg(t,"string");return Vn(e)=="symbol"?e:e+""}function Xg(t,e,r){return(e=Yg(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ul(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function os(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?ul(Object(r),!0).forEach(function(n){Xg(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ul(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var Zg=class Ou{constructor(e,{headers:r={},schema:n,fetch:s,timeout:i,urlLengthLimit:o=8e3,retry:a}={}){this.url=e,this.headers=new Headers(r),this.schemaName=n,this.urlLengthLimit=o;const l=s??globalThis.fetch;i!==void 0&&i>0?this.fetch=(c,u)=>{const h=new AbortController,d=setTimeout(()=>h.abort(),i),f=u==null?void 0:u.signal;if(f){if(f.aborted)return clearTimeout(d),l(c,u);const p=()=>{clearTimeout(d),h.abort()};return f.addEventListener("abort",p,{once:!0}),l(c,os(os({},u),{},{signal:h.signal})).finally(()=>{clearTimeout(d),f.removeEventListener("abort",p)})}return l(c,os(os({},u),{},{signal:h.signal})).finally(()=>clearTimeout(d))}:this.fetch=l,this.retry=a}from(e){if(!e||typeof e!="string"||e.trim()==="")throw new Error("Invalid relation name: relation must be a non-empty string.");return new Gg(new URL(`${this.url}/${e}`),{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}schema(e){return new Ou(this.url,{headers:this.headers,schema:e,fetch:this.fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}rpc(e,r={},{head:n=!1,get:s=!1,count:i}={}){var o;let a;const l=new URL(`${this.url}/rpc/${e}`);let c;const u=f=>f!==null&&typeof f=="object"&&(!Array.isArray(f)||f.some(u)),h=n&&Object.values(r).some(u);h?(a="POST",c=r):n||s?(a=n?"HEAD":"GET",Object.entries(r).filter(([f,p])=>p!==void 0).map(([f,p])=>[f,Array.isArray(p)?`{${p.join(",")}}`:`${p}`]).forEach(([f,p])=>{l.searchParams.append(f,p)})):(a="POST",c=r);const d=new Headers(this.headers);return h?d.set("Prefer",i?`count=${i},return=minimal`:"return=minimal"):i&&d.set("Prefer",`count=${i}`),new Hr({method:a,url:l,headers:d,schema:this.schemaName,body:c,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch,urlLengthLimit:this.urlLengthLimit,retry:this.retry})}};class Qg{constructor(){}static detectEnvironment(){var e;if(typeof WebSocket<"u")return{type:"native",wsConstructor:WebSocket};const r=globalThis;if(typeof globalThis<"u"&&typeof r.WebSocket<"u")return{type:"native",wsConstructor:r.WebSocket};const n=typeof global<"u"?global:void 0;if(n&&typeof n.WebSocket<"u")return{type:"native",wsConstructor:n.WebSocket};if(typeof globalThis<"u"&&typeof r.WebSocketPair<"u"&&typeof globalThis.WebSocket>"u")return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if(typeof globalThis<"u"&&r.EdgeRuntime||typeof navigator<"u"&&(!((e=navigator.userAgent)===null||e===void 0)&&e.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};const s=globalThis.process;if(s){const i=s.versions;if(i&&i.node){const o=i.node,a=parseInt(o.replace(/^v/,"").split(".")[0]);return a>=22?typeof globalThis.WebSocket<"u"?{type:"native",wsConstructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${a} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${a} detected without native WebSocket support.`,workaround:`For Node.js < 22, install "ws" package and provide it via the transport option:
|
|
174
|
-
import ws from "ws"
|
|
175
|
-
new RealtimeClient(url, { transport: ws })`}}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){const e=this.detectEnvironment();if(e.wsConstructor)return e.wsConstructor;let r=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(r+=`
|
|
176
|
-
|
|
177
|
-
Suggested solution: ${e.workaround}`),new Error(r)}static isWebSocketSupported(){try{const e=this.detectEnvironment();return e.type==="native"||e.type==="ws"}catch{return!1}}}const em="2.106.2",tm=`realtime-js/${em}`,rm="1.0.0",Pu="2.0.0",nm=Pu,sm=1e4,im=100,cr={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},Iu={close:"phx_close",error:"phx_error",join:"phx_join",leave:"phx_leave",access_token:"access_token"},eo={connecting:"connecting",closing:"closing",closed:"closed"};class om{constructor(e){this.HEADER_LENGTH=1,this.USER_BROADCAST_PUSH_META_LENGTH=6,this.KINDS={userBroadcastPush:3,userBroadcast:4},this.BINARY_ENCODING=0,this.JSON_ENCODING=1,this.BROADCAST_EVENT="broadcast",this.allowedMetadataKeys=[],this.allowedMetadataKeys=e??[]}encode(e,r){if(e.event===this.BROADCAST_EVENT&&!(e.payload instanceof ArrayBuffer)&&typeof e.payload.event=="string")return r(this._binaryEncodeUserBroadcastPush(e));let n=[e.join_ref,e.ref,e.topic,e.event,e.payload];return r(JSON.stringify(n))}_binaryEncodeUserBroadcastPush(e){var r;return this._isArrayBuffer((r=e.payload)===null||r===void 0?void 0:r.payload)?this._encodeBinaryUserBroadcastPush(e):this._encodeJsonUserBroadcastPush(e)}_encodeBinaryUserBroadcastPush(e){var r,n;const s=(n=(r=e.payload)===null||r===void 0?void 0:r.payload)!==null&&n!==void 0?n:new ArrayBuffer(0);return this._encodeUserBroadcastPush(e,this.BINARY_ENCODING,s)}_encodeJsonUserBroadcastPush(e){var r,n;const s=(n=(r=e.payload)===null||r===void 0?void 0:r.payload)!==null&&n!==void 0?n:{},o=new TextEncoder().encode(JSON.stringify(s)).buffer;return this._encodeUserBroadcastPush(e,this.JSON_ENCODING,o)}_encodeUserBroadcastPush(e,r,n){var s,i;const o=e.topic,a=(s=e.ref)!==null&&s!==void 0?s:"",l=(i=e.join_ref)!==null&&i!==void 0?i:"",c=e.payload.event,u=this.allowedMetadataKeys?this._pick(e.payload,this.allowedMetadataKeys):{},h=Object.keys(u).length===0?"":JSON.stringify(u);if(l.length>255)throw new Error(`joinRef length ${l.length} exceeds maximum of 255`);if(a.length>255)throw new Error(`ref length ${a.length} exceeds maximum of 255`);if(o.length>255)throw new Error(`topic length ${o.length} exceeds maximum of 255`);if(c.length>255)throw new Error(`userEvent length ${c.length} exceeds maximum of 255`);if(h.length>255)throw new Error(`metadata length ${h.length} exceeds maximum of 255`);const d=this.USER_BROADCAST_PUSH_META_LENGTH+l.length+a.length+o.length+c.length+h.length,f=new ArrayBuffer(this.HEADER_LENGTH+d);let p=new DataView(f),y=0;p.setUint8(y++,this.KINDS.userBroadcastPush),p.setUint8(y++,l.length),p.setUint8(y++,a.length),p.setUint8(y++,o.length),p.setUint8(y++,c.length),p.setUint8(y++,h.length),p.setUint8(y++,r),Array.from(l,k=>p.setUint8(y++,k.charCodeAt(0))),Array.from(a,k=>p.setUint8(y++,k.charCodeAt(0))),Array.from(o,k=>p.setUint8(y++,k.charCodeAt(0))),Array.from(c,k=>p.setUint8(y++,k.charCodeAt(0))),Array.from(h,k=>p.setUint8(y++,k.charCodeAt(0)));var w=new Uint8Array(f.byteLength+n.byteLength);return w.set(new Uint8Array(f),0),w.set(new Uint8Array(n),f.byteLength),w.buffer}decode(e,r){if(this._isArrayBuffer(e)){let n=this._binaryDecode(e);return r(n)}if(typeof e=="string"){const n=JSON.parse(e),[s,i,o,a,l]=n;return r({join_ref:s,ref:i,topic:o,event:a,payload:l})}return r({})}_binaryDecode(e){const r=new DataView(e),n=r.getUint8(0),s=new TextDecoder;switch(n){case this.KINDS.userBroadcast:return this._decodeUserBroadcast(e,r,s)}}_decodeUserBroadcast(e,r,n){const s=r.getUint8(1),i=r.getUint8(2),o=r.getUint8(3),a=r.getUint8(4);let l=this.HEADER_LENGTH+4;const c=n.decode(e.slice(l,l+s));l=l+s;const u=n.decode(e.slice(l,l+i));l=l+i;const h=n.decode(e.slice(l,l+o));l=l+o;const d=e.slice(l,e.byteLength),f=a===this.JSON_ENCODING?JSON.parse(n.decode(d)):d,p={type:this.BROADCAST_EVENT,event:u,payload:f};return o>0&&(p.meta=JSON.parse(h)),{join_ref:null,ref:null,topic:c,event:this.BROADCAST_EVENT,payload:p}}_isArrayBuffer(e){var r;return e instanceof ArrayBuffer||((r=e==null?void 0:e.constructor)===null||r===void 0?void 0:r.name)==="ArrayBuffer"}_pick(e,r){return!e||typeof e!="object"?{}:Object.fromEntries(Object.entries(e).filter(([n])=>r.includes(n)))}}var ke;(function(t){t.abstime="abstime",t.bool="bool",t.date="date",t.daterange="daterange",t.float4="float4",t.float8="float8",t.int2="int2",t.int4="int4",t.int4range="int4range",t.int8="int8",t.int8range="int8range",t.json="json",t.jsonb="jsonb",t.money="money",t.numeric="numeric",t.oid="oid",t.reltime="reltime",t.text="text",t.time="time",t.timestamp="timestamp",t.timestamptz="timestamptz",t.timetz="timetz",t.tsrange="tsrange",t.tstzrange="tstzrange"})(ke||(ke={}));const hl=(t,e,r={})=>{var n;const s=(n=r.skipTypes)!==null&&n!==void 0?n:[];return e?Object.keys(e).reduce((i,o)=>(i[o]=am(o,t,e,s),i),{}):{}},am=(t,e,r,n)=>{const s=e.find(a=>a.name===t),i=s==null?void 0:s.type,o=r[t];return i&&!n.includes(i)?$u(i,o):to(o)},$u=(t,e)=>{if(t.charAt(0)==="_"){const r=t.slice(1,t.length);return hm(e,r)}switch(t){case ke.bool:return lm(e);case ke.float4:case ke.float8:case ke.int2:case ke.int4:case ke.int8:case ke.numeric:case ke.oid:return cm(e);case ke.json:case ke.jsonb:return um(e);case ke.timestamp:return dm(e);case ke.abstime:case ke.date:case ke.daterange:case ke.int4range:case ke.int8range:case ke.money:case ke.reltime:case ke.text:case ke.time:case ke.timestamptz:case ke.timetz:case ke.tsrange:case ke.tstzrange:return to(e);default:return to(e)}},to=t=>t,lm=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}},cm=t=>{if(typeof t=="string"){const e=parseFloat(t);if(!Number.isNaN(e))return e}return t},um=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch{return t}return t},hm=(t,e)=>{if(typeof t!="string")return t;const r=t.length-1,n=t[r];if(t[0]==="{"&&n==="}"){let i;const o=t.slice(1,r);try{i=JSON.parse("["+o+"]")}catch{i=o?o.split(","):[]}return i.map(a=>$u(e,a))}return t},dm=t=>typeof t=="string"?t.replace(" ","T"):t,ju=t=>{const e=new URL(t);return e.protocol=e.protocol.replace(/^ws/i,"http"),e.pathname=e.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),e.pathname===""||e.pathname==="/"?e.pathname="/api/broadcast":e.pathname=e.pathname+"/api/broadcast",e.href};var Pn=t=>typeof t=="function"?t:function(){return t},fm=typeof self<"u"?self:null,qr=typeof window<"u"?window:null,Ot=fm||qr||globalThis,pm="2.0.0",gm=1e4,mm=1e3,$t={connecting:0,open:1,closing:2,closed:3},tt={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},qt={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},ro={longpoll:"longpoll",websocket:"websocket"},ym={complete:4},no="base64url.bearer.phx.",as=class{constructor(t,e,r,n){this.channel=t,this.event=e,this.payload=r||function(){return{}},this.receivedResp=null,this.timeout=n,this.timeoutTimer=null,this.recHooks=[],this.sent=!1,this.ref=void 0}resend(t){this.timeout=t,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(t,e){return this.hasReceived(t)&&e(this.receivedResp.response),this.recHooks.push({status:t,callback:e}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}destroy(){this.cancelRefEvent(),this.cancelTimeout()}matchReceive({status:t,response:e,_ref:r}){this.recHooks.filter(n=>n.status===t).forEach(n=>n.callback(e))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,t=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=t,this.matchReceive(t)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(t){return this.receivedResp&&this.receivedResp.status===t}trigger(t,e){this.channel.trigger(this.refEvent,{status:t,response:e})}},Nu=class{constructor(t,e){this.callback=t,this.timerCalc=e,this.timer=void 0,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},vm=class{constructor(t,e,r){this.state=tt.closed,this.topic=t,this.params=Pn(e||{}),this.socket=r,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new as(this,qt.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new Nu(()=>{this.socket.isConnected()&&this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()})),this.joinPush.receive("ok",()=>{this.state=tt.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(n=>n.send()),this.pushBuffer=[]}),this.joinPush.receive("error",n=>{this.state=tt.errored,this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,n),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic}`),this.state=tt.closed,this.socket.remove(this)}),this.onError(n=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,n),this.isJoining()&&this.joinPush.reset(),this.state=tt.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),new as(this,qt.leave,Pn({}),this.timeout).send(),this.state=tt.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(qt.reply,(n,s)=>{this.trigger(this.replyEventName(s),n)})}join(t=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=t,this.joinedOnce=!0,this.rejoin(),this.joinPush}teardown(){this.pushBuffer.forEach(t=>t.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=tt.closed,this.bindings=[]}onClose(t){this.on(qt.close,t)}onError(t){return this.on(qt.error,e=>t(e))}on(t,e){let r=this.bindingRef++;return this.bindings.push({event:t,ref:r,callback:e}),r}off(t,e){this.bindings=this.bindings.filter(r=>!(r.event===t&&(typeof e>"u"||e===r.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(t,e,r=this.timeout){if(e=e||{},!this.joinedOnce)throw new Error(`tried to push '${t}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let n=new as(this,t,function(){return e},r);return this.canPush()?n.send():(n.startTimeout(),this.pushBuffer.push(n)),n}leave(t=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=tt.leaving;let e=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(qt.close,"leave")},r=new as(this,qt.leave,Pn({}),t);return r.receive("ok",()=>e()).receive("timeout",()=>e()),r.send(),this.canPush()||r.trigger("ok",{}),r}onMessage(t,e,r){return e}filterBindings(t,e,r){return!0}isMember(t,e,r,n){return this.topic!==t?!1:n&&n!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:t,event:e,payload:r,joinRef:n}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(t=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=tt.joining,this.joinPush.resend(t))}trigger(t,e,r,n){let s=this.onMessage(t,e,r,n);if(e&&!s)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let i=this.bindings.filter(o=>o.event===t&&this.filterBindings(o,e,r));for(let o=0;o<i.length;o++)i[o].callback(s,r,n||this.joinRef())}replyEventName(t){return`chan_reply_${t}`}isClosed(){return this.state===tt.closed}isErrored(){return this.state===tt.errored}isJoined(){return this.state===tt.joined}isJoining(){return this.state===tt.joining}isLeaving(){return this.state===tt.leaving}},Os=class{static request(t,e,r,n,s,i,o){if(Ot.XDomainRequest){let a=new Ot.XDomainRequest;return this.xdomainRequest(a,t,e,n,s,i,o)}else if(Ot.XMLHttpRequest){let a=new Ot.XMLHttpRequest;return this.xhrRequest(a,t,e,r,n,s,i,o)}else{if(Ot.fetch&&Ot.AbortController)return this.fetchRequest(t,e,r,n,s,i,o);throw new Error("No suitable XMLHttpRequest implementation found")}}static fetchRequest(t,e,r,n,s,i,o){let a={method:t,headers:r,body:n},l=null;return s&&(l=new AbortController,setTimeout(()=>l.abort(),s),a.signal=l.signal),Ot.fetch(e,a).then(c=>c.text()).then(c=>this.parseJSON(c)).then(c=>o&&o(c)).catch(c=>{c.name==="AbortError"&&i?i():o&&o(null)}),l}static xdomainRequest(t,e,r,n,s,i,o){return t.timeout=s,t.open(e,r),t.onload=()=>{let a=this.parseJSON(t.responseText);o&&o(a)},i&&(t.ontimeout=i),t.onprogress=()=>{},t.send(n),t}static xhrRequest(t,e,r,n,s,i,o,a){t.open(e,r,!0),t.timeout=i;for(let[l,c]of Object.entries(n))t.setRequestHeader(l,c);return t.onerror=()=>a&&a(null),t.onreadystatechange=()=>{if(t.readyState===ym.complete&&a){let l=this.parseJSON(t.responseText);a(l)}},o&&(t.ontimeout=o),t.send(s),t}static parseJSON(t){if(!t||t==="")return null;try{return JSON.parse(t)}catch{return console&&console.log("failed to parse JSON response",t),null}}static serialize(t,e){let r=[];for(var n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;let s=e?`${e}[${n}]`:n,i=t[n];typeof i=="object"?r.push(this.serialize(i,s)):r.push(encodeURIComponent(s)+"="+encodeURIComponent(i))}return r.join("&")}static appendParams(t,e){if(Object.keys(e).length===0)return t;let r=t.match(/\?/)?"&":"?";return`${t}${r}${this.serialize(e)}`}},bm=t=>{let e="",r=new Uint8Array(t),n=r.byteLength;for(let s=0;s<n;s++)e+=String.fromCharCode(r[s]);return btoa(e)},jr=class{constructor(t,e){e&&e.length===2&&e[1].startsWith(no)&&(this.authToken=atob(e[1].slice(no.length))),this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.awaitingBatchAck=!1,this.currentBatch=null,this.currentBatchTimer=null,this.batchBuffer=[],this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(t),this.readyState=$t.connecting,setTimeout(()=>this.poll(),0)}normalizeEndpoint(t){return t.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+ro.websocket),"$1/"+ro.longpoll)}endpointURL(){return Os.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(t,e,r){this.close(t,e,r),this.readyState=$t.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===$t.open||this.readyState===$t.connecting}poll(){const t={Accept:"application/json"};this.authToken&&(t["X-Phoenix-AuthToken"]=this.authToken),this.ajax("GET",t,null,()=>this.ontimeout(),e=>{if(e){var{status:r,token:n,messages:s}=e;if(r===410&&this.token!==null){this.onerror(410),this.closeAndRetry(3410,"session_gone",!1);return}this.token=n}else r=0;switch(r){case 200:s.forEach(i=>{setTimeout(()=>this.onmessage({data:i}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=$t.open,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${r}`)}})}send(t){typeof t!="string"&&(t=bm(t)),this.currentBatch?this.currentBatch.push(t):this.awaitingBatchAck?this.batchBuffer.push(t):(this.currentBatch=[t],this.currentBatchTimer=setTimeout(()=>{this.batchSend(this.currentBatch),this.currentBatch=null},0))}batchSend(t){this.awaitingBatchAck=!0,this.ajax("POST",{"Content-Type":"application/x-ndjson"},t.join(`
|
|
178
|
-
`),()=>this.onerror("timeout"),e=>{this.awaitingBatchAck=!1,!e||e.status!==200?(this.onerror(e&&e.status),this.closeAndRetry(1011,"internal server error",!1)):this.batchBuffer.length>0&&(this.batchSend(this.batchBuffer),this.batchBuffer=[])})}close(t,e,r){for(let s of this.reqs)s.abort();this.readyState=$t.closed;let n=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:t,reason:e,wasClean:r});this.batchBuffer=[],clearTimeout(this.currentBatchTimer),this.currentBatchTimer=null,typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",n)):this.onclose(n)}ajax(t,e,r,n,s){let i,o=()=>{this.reqs.delete(i),n()};i=Os.request(t,this.endpointURL(),e,r,this.timeout,o,a=>{this.reqs.delete(i),this.isActive()&&s(a)}),this.reqs.add(i)}},_m=class _n{constructor(e,r={}){let n=r.events||{state:"presence_state",diff:"presence_diff"};this.state={},this.pendingDiffs=[],this.channel=e,this.joinRef=null,this.caller={onJoin:function(){},onLeave:function(){},onSync:function(){}},this.channel.on(n.state,s=>{let{onJoin:i,onLeave:o,onSync:a}=this.caller;this.joinRef=this.channel.joinRef(),this.state=_n.syncState(this.state,s,i,o),this.pendingDiffs.forEach(l=>{this.state=_n.syncDiff(this.state,l,i,o)}),this.pendingDiffs=[],a()}),this.channel.on(n.diff,s=>{let{onJoin:i,onLeave:o,onSync:a}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(s):(this.state=_n.syncDiff(this.state,s,i,o),a())})}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}list(e){return _n.list(this.state,e)}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel.joinRef()}static syncState(e,r,n,s){let i=this.clone(e),o={},a={};return this.map(i,(l,c)=>{r[l]||(a[l]=c)}),this.map(r,(l,c)=>{let u=i[l];if(u){let h=c.metas.map(y=>y.phx_ref),d=u.metas.map(y=>y.phx_ref),f=c.metas.filter(y=>d.indexOf(y.phx_ref)<0),p=u.metas.filter(y=>h.indexOf(y.phx_ref)<0);f.length>0&&(o[l]=c,o[l].metas=f),p.length>0&&(a[l]=this.clone(u),a[l].metas=p)}else o[l]=c}),this.syncDiff(i,{joins:o,leaves:a},n,s)}static syncDiff(e,r,n,s){let{joins:i,leaves:o}=this.clone(r);return n||(n=function(){}),s||(s=function(){}),this.map(i,(a,l)=>{let c=e[a];if(e[a]=this.clone(l),c){let u=e[a].metas.map(d=>d.phx_ref),h=c.metas.filter(d=>u.indexOf(d.phx_ref)<0);e[a].metas.unshift(...h)}n(a,c,l)}),this.map(o,(a,l)=>{let c=e[a];if(!c)return;let u=l.metas.map(h=>h.phx_ref);c.metas=c.metas.filter(h=>u.indexOf(h.phx_ref)<0),s(a,c,l),c.metas.length===0&&delete e[a]}),e}static list(e,r){return r||(r=function(n,s){return s}),this.map(e,(n,s)=>r(n,s))}static map(e,r){return Object.getOwnPropertyNames(e).map(n=>r(n,e[n]))}static clone(e){return JSON.parse(JSON.stringify(e))}},ls={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(t,e){if(t.payload.constructor===ArrayBuffer)return e(this.binaryEncode(t));{let r=[t.join_ref,t.ref,t.topic,t.event,t.payload];return e(JSON.stringify(r))}},decode(t,e){if(t.constructor===ArrayBuffer)return e(this.binaryDecode(t));{let[r,n,s,i,o]=JSON.parse(t);return e({join_ref:r,ref:n,topic:s,event:i,payload:o})}},binaryEncode(t){let{join_ref:e,ref:r,event:n,topic:s,payload:i}=t,o=this.META_LENGTH+e.length+r.length+s.length+n.length,a=new ArrayBuffer(this.HEADER_LENGTH+o),l=new DataView(a),c=0;l.setUint8(c++,this.KINDS.push),l.setUint8(c++,e.length),l.setUint8(c++,r.length),l.setUint8(c++,s.length),l.setUint8(c++,n.length),Array.from(e,h=>l.setUint8(c++,h.charCodeAt(0))),Array.from(r,h=>l.setUint8(c++,h.charCodeAt(0))),Array.from(s,h=>l.setUint8(c++,h.charCodeAt(0))),Array.from(n,h=>l.setUint8(c++,h.charCodeAt(0)));var u=new Uint8Array(a.byteLength+i.byteLength);return u.set(new Uint8Array(a),0),u.set(new Uint8Array(i),a.byteLength),u.buffer},binaryDecode(t){let e=new DataView(t),r=e.getUint8(0),n=new TextDecoder;switch(r){case this.KINDS.push:return this.decodePush(t,e,n);case this.KINDS.reply:return this.decodeReply(t,e,n);case this.KINDS.broadcast:return this.decodeBroadcast(t,e,n)}},decodePush(t,e,r){let n=e.getUint8(1),s=e.getUint8(2),i=e.getUint8(3),o=this.HEADER_LENGTH+this.META_LENGTH-1,a=r.decode(t.slice(o,o+n));o=o+n;let l=r.decode(t.slice(o,o+s));o=o+s;let c=r.decode(t.slice(o,o+i));o=o+i;let u=t.slice(o,t.byteLength);return{join_ref:a,ref:null,topic:l,event:c,payload:u}},decodeReply(t,e,r){let n=e.getUint8(1),s=e.getUint8(2),i=e.getUint8(3),o=e.getUint8(4),a=this.HEADER_LENGTH+this.META_LENGTH,l=r.decode(t.slice(a,a+n));a=a+n;let c=r.decode(t.slice(a,a+s));a=a+s;let u=r.decode(t.slice(a,a+i));a=a+i;let h=r.decode(t.slice(a,a+o));a=a+o;let d=t.slice(a,t.byteLength),f={status:h,response:d};return{join_ref:l,ref:c,topic:u,event:qt.reply,payload:f}},decodeBroadcast(t,e,r){let n=e.getUint8(1),s=e.getUint8(2),i=this.HEADER_LENGTH+2,o=r.decode(t.slice(i,i+n));i=i+n;let a=r.decode(t.slice(i,i+s));i=i+s;let l=t.slice(i,t.byteLength);return{join_ref:null,ref:null,topic:o,event:a,payload:l}}},wm=class{constructor(t,e={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.fallbackRef=null,this.timeout=e.timeout||gm,this.transport=e.transport||Ot.WebSocket||jr,this.conn=void 0,this.primaryPassedHealthCheck=!1,this.longPollFallbackMs=e.longPollFallbackMs,this.fallbackTimer=null;let r=null;try{r=Ot&&Ot.sessionStorage}catch{}this.sessionStore=e.sessionStorage||r,this.establishedConnections=0,this.defaultEncoder=ls.encode.bind(ls),this.defaultDecoder=ls.decode.bind(ls),this.closeWasClean=!0,this.disconnecting=!1,this.binaryType=e.binaryType||"arraybuffer",this.connectClock=1,this.pageHidden=!1,this.encode=void 0,this.decode=void 0,this.transport!==jr?(this.encode=e.encode||this.defaultEncoder,this.decode=e.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let n=null;qr&&qr.addEventListener&&(qr.addEventListener("pagehide",s=>{this.conn&&(this.disconnect(),n=this.connectClock)}),qr.addEventListener("pageshow",s=>{n===this.connectClock&&(n=null,this.connect())}),qr.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?this.pageHidden=!0:(this.pageHidden=!1,!this.isConnected()&&!this.closeWasClean&&this.teardown(()=>this.connect()))})),this.heartbeatIntervalMs=e.heartbeatIntervalMs||3e4,this.autoSendHeartbeat=e.autoSendHeartbeat??!0,this.heartbeatCallback=e.heartbeatCallback??(()=>{}),this.rejoinAfterMs=s=>e.rejoinAfterMs?e.rejoinAfterMs(s):[1e3,2e3,5e3][s-1]||1e4,this.reconnectAfterMs=s=>e.reconnectAfterMs?e.reconnectAfterMs(s):[10,50,100,150,200,250,500,1e3,2e3][s-1]||5e3,this.logger=e.logger||null,!this.logger&&e.debug&&(this.logger=(s,i,o)=>{console.log(`${s}: ${i}`,o)}),this.longpollerTimeout=e.longpollerTimeout||2e4,this.params=Pn(e.params||{}),this.endPoint=`${t}/${ro.websocket}`,this.vsn=e.vsn||pm,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.heartbeatSentAt=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new Nu(()=>{if(this.pageHidden){this.log("Not reconnecting as page is hidden!"),this.teardown();return}this.teardown(async()=>{e.beforeReconnect&&await e.beforeReconnect(),this.connect()})},this.reconnectAfterMs),this.authToken=e.authToken}getLongPollTransport(){return jr}replaceTransport(t){this.connectClock++,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.conn&&(this.conn.close(),this.conn=null),this.transport=t}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let t=Os.appendParams(Os.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return t.charAt(0)!=="/"?t:t.charAt(1)==="/"?`${this.protocol()}:${t}`:`${this.protocol()}://${location.host}${t}`}disconnect(t,e,r){this.connectClock++,this.disconnecting=!0,this.closeWasClean=!0,clearTimeout(this.fallbackTimer),this.reconnectTimer.reset(),this.teardown(()=>{this.disconnecting=!1,t&&t()},e,r)}connect(t){t&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=Pn(t)),!(this.conn&&!this.disconnecting)&&(this.longPollFallbackMs&&this.transport!==jr?this.connectWithFallback(jr,this.longPollFallbackMs):this.transportConnect())}log(t,e,r){this.logger&&this.logger(t,e,r)}hasLogger(){return this.logger!==null}onOpen(t){let e=this.makeRef();return this.stateChangeCallbacks.open.push([e,t]),e}onClose(t){let e=this.makeRef();return this.stateChangeCallbacks.close.push([e,t]),e}onError(t){let e=this.makeRef();return this.stateChangeCallbacks.error.push([e,t]),e}onMessage(t){let e=this.makeRef();return this.stateChangeCallbacks.message.push([e,t]),e}onHeartbeat(t){this.heartbeatCallback=t}ping(t){if(!this.isConnected())return!1;let e=this.makeRef(),r=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:e});let n=this.onMessage(s=>{s.ref===e&&(this.off([n]),t(Date.now()-r))});return!0}transportName(t){switch(t){case jr:return"LongPoll";default:return t.name}}transportConnect(){this.connectClock++,this.closeWasClean=!1;let t;this.authToken&&(t=["phoenix",`${no}${btoa(this.authToken).replace(/=/g,"")}`]),this.conn=new this.transport(this.endPointURL(),t),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=e=>this.onConnError(e),this.conn.onmessage=e=>this.onConnMessage(e),this.conn.onclose=e=>this.onConnClose(e)}getSession(t){return this.sessionStore&&this.sessionStore.getItem(t)}storeSession(t,e){this.sessionStore&&this.sessionStore.setItem(t,e)}connectWithFallback(t,e=2500){clearTimeout(this.fallbackTimer);let r=!1,n=!0,s,i,o=this.transportName(t),a=l=>{this.log("transport",`falling back to ${o}...`,l),this.off([s,i]),n=!1,this.replaceTransport(t),this.transportConnect()};if(this.getSession(`phx:fallback:${o}`))return a("memorized");this.fallbackTimer=setTimeout(a,e),i=this.onError(l=>{this.log("transport","error",l),n&&!r&&(clearTimeout(this.fallbackTimer),a(l))}),this.fallbackRef&&this.off([this.fallbackRef]),this.fallbackRef=this.onOpen(()=>{if(r=!0,!n){let l=this.transportName(t);return this.primaryPassedHealthCheck||this.storeSession(`phx:fallback:${l}`,"true"),this.log("transport",`established ${l} fallback`)}clearTimeout(this.fallbackTimer),this.fallbackTimer=setTimeout(a,e),this.ping(l=>{this.log("transport","connected to primary after",l),this.primaryPassedHealthCheck=!0,clearTimeout(this.fallbackTimer)})}),this.transportConnect()}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.disconnecting=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.autoSendHeartbeat&&this.resetHeartbeat(),this.triggerStateCallbacks("open")}heartbeatTimeout(){if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(t){this.log("error","error in heartbeat callback",t)}this.triggerChanError(new Error("heartbeat timeout")),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),mm,"heartbeat timeout")}}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(t,e,r){if(!this.conn)return t&&t();const n=this.conn;this.waitForBufferDone(n,()=>{e?n.close(e,r||""):n.close(),this.waitForSocketClosed(n,()=>{this.conn===n&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),t&&t()})})}waitForBufferDone(t,e,r=1){if(r===5||!t.bufferedAmount){e();return}setTimeout(()=>{this.waitForBufferDone(t,e,r+1)},150*r)}waitForSocketClosed(t,e,r=1){if(r===5||t.readyState===$t.closed){e();return}setTimeout(()=>{this.waitForSocketClosed(t,e,r+1)},150*r)}onConnClose(t){this.conn&&(this.conn.onclose=()=>{}),this.hasLogger()&&this.log("transport","close",t),this.triggerChanError(t),this.clearHeartbeats(),this.closeWasClean||this.reconnectTimer.scheduleTimeout(),this.triggerStateCallbacks("close",t)}onConnError(t){this.hasLogger()&&this.log("transport","error",t);let e=this.transport,r=this.establishedConnections;this.triggerStateCallbacks("error",t,e,r),(e===this.transport||r>0)&&this.triggerChanError(t)}triggerChanError(t){this.channels.forEach(e=>{e.isErrored()||e.isLeaving()||e.isClosed()||e.trigger(qt.error,t)})}connectionState(){switch(this.conn&&this.conn.readyState){case $t.connecting:return"connecting";case $t.open:return"open";case $t.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(t){this.off(t.stateChangeRefs),this.channels=this.channels.filter(e=>e!==t)}off(t){for(let e in this.stateChangeCallbacks)this.stateChangeCallbacks[e]=this.stateChangeCallbacks[e].filter(([r])=>t.indexOf(r)===-1)}channel(t,e={}){let r=new vm(t,e,this);return this.channels.push(r),r}push(t){if(this.hasLogger()){let{topic:e,event:r,payload:n,ref:s,join_ref:i}=t;this.log("push",`${e} ${r} (${i}, ${s})`,n)}this.isConnected()?this.encode(t,e=>this.conn.send(e)):this.sendBuffer.push(()=>this.encode(t,e=>this.conn.send(e)))}makeRef(){let t=this.ref+1;return t===this.ref?this.ref=0:this.ref=t,this.ref.toString()}sendHeartbeat(){if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(t){this.log("error","error in heartbeat callback",t)}return}if(this.pendingHeartbeatRef){this.heartbeatTimeout();return}this.pendingHeartbeatRef=this.makeRef(),this.heartbeatSentAt=Date.now(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(t){this.log("error","error in heartbeat callback",t)}this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs)}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(t=>t()),this.sendBuffer=[])}onConnMessage(t){this.decode(t.data,e=>{let{topic:r,event:n,payload:s,ref:i,join_ref:o}=e;if(i&&i===this.pendingHeartbeatRef){const a=this.heartbeatSentAt?Date.now()-this.heartbeatSentAt:void 0;this.clearHeartbeats();try{this.heartbeatCallback(s.status==="ok"?"ok":"error",a)}catch(l){this.log("error","error in heartbeat callback",l)}this.pendingHeartbeatRef=null,this.heartbeatSentAt=null,this.autoSendHeartbeat&&(this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}this.hasLogger()&&this.log("receive",`${s.status||""} ${r} ${n} ${i&&"("+i+")"||""}`.trim(),s);for(let a=0;a<this.channels.length;a++){const l=this.channels[a];l.isMember(r,n,s,o)&&l.trigger(n,s,i,o)}this.triggerStateCallbacks("message",e)})}triggerStateCallbacks(t,...e){try{this.stateChangeCallbacks[t].forEach(([r,n])=>{try{n(...e)}catch(s){this.log("error",`error in ${t} callback`,s)}})}catch(r){this.log("error",`error triggering ${t} callbacks`,r)}}leaveOpenTopic(t){let e=this.channels.find(r=>r.topic===t&&(r.isJoined()||r.isJoining()));e&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${t}"`),e.leave())}};class In{constructor(e,r){const n=Sm(r);this.presence=new _m(e.getChannel(),n),this.presence.onJoin((s,i,o)=>{const a=In.onJoinPayload(s,i,o);e.getChannel().trigger("presence",a)}),this.presence.onLeave((s,i,o)=>{const a=In.onLeavePayload(s,i,o);e.getChannel().trigger("presence",a)}),this.presence.onSync(()=>{e.getChannel().trigger("presence",{event:"sync"})})}get state(){return In.transformState(this.presence.state)}static transformState(e){return e=km(e),Object.getOwnPropertyNames(e).reduce((r,n)=>{const s=e[n];return r[n]=bs(s),r},{})}static onJoinPayload(e,r,n){const s=dl(r),i=bs(n);return{event:"join",key:e,currentPresences:s,newPresences:i}}static onLeavePayload(e,r,n){const s=dl(r),i=bs(n);return{event:"leave",key:e,currentPresences:s,leftPresences:i}}}function bs(t){return t.metas.map(e=>(e.presence_ref=e.phx_ref,delete e.phx_ref,delete e.phx_ref_prev,e))}function km(t){return JSON.parse(JSON.stringify(t))}function Sm(t){return(t==null?void 0:t.events)&&{events:t.events}}function dl(t){return t!=null&&t.metas?bs(t):[]}var fl;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(fl||(fl={}));class Em{get state(){return this.presenceAdapter.state}constructor(e,r){this.channel=e,this.presenceAdapter=new In(this.channel.channelAdapter,r)}}function Tm(t){if(t instanceof Error)return t;if(typeof t=="string")return new Error(t);if(t&&typeof t=="object"){const e=t;if(typeof e.code=="number"){const r=typeof e.reason=="string"&&e.reason?` (${e.reason})`:"";return new Error(`socket closed: ${e.code}${r}`,{cause:t})}return new Error("channel error: transport failure",{cause:t})}return new Error("channel error: connection lost")}class Am{constructor(e,r,n){const s=xm(n);this.channel=e.getSocket().channel(r,s),this.socket=e}get state(){return this.channel.state}set state(e){this.channel.state=e}get joinedOnce(){return this.channel.joinedOnce}get joinPush(){return this.channel.joinPush}get rejoinTimer(){return this.channel.rejoinTimer}on(e,r){return this.channel.on(e,r)}off(e,r){this.channel.off(e,r)}subscribe(e){return this.channel.join(e)}unsubscribe(e){return this.channel.leave(e)}teardown(){this.channel.teardown()}onClose(e){this.channel.onClose(e)}onError(e){return this.channel.onError(e)}push(e,r,n){let s;try{s=this.channel.push(e,r,n)}catch{throw new Error(`tried to push '${e}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events`)}if(this.channel.pushBuffer.length>im){const i=this.channel.pushBuffer.shift();i.cancelTimeout(),this.socket.log("channel",`discarded push due to buffer overflow: ${i.event}`,i.payload())}return s}updateJoinPayload(e){const r=this.channel.joinPush.payload();this.channel.joinPush.payload=()=>Object.assign(Object.assign({},r),e)}canPush(){return this.socket.isConnected()&&this.state===cr.joined}isJoined(){return this.state===cr.joined}isJoining(){return this.state===cr.joining}isClosed(){return this.state===cr.closed}isLeaving(){return this.state===cr.leaving}updateFilterBindings(e){this.channel.filterBindings=e}updatePayloadTransform(e){this.channel.onMessage=e}getChannel(){return this.channel}}function xm(t){return{config:Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},t.config)}}var pl;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(pl||(pl={}));var Wr;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(Wr||(Wr={}));var Ft;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(Ft||(Ft={}));class $n{get state(){return this.channelAdapter.state}set state(e){this.channelAdapter.state=e}get joinedOnce(){return this.channelAdapter.joinedOnce}get timeout(){return this.socket.timeout}get joinPush(){return this.channelAdapter.joinPush}get rejoinTimer(){return this.channelAdapter.rejoinTimer}constructor(e,r={config:{}},n){var s,i;if(this.topic=e,this.params=r,this.socket=n,this.bindings={},this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},r.config),this.channelAdapter=new Am(this.socket.socketAdapter,e,this.params),this.presence=new Em(this),this._onClose(()=>{this.socket._remove(this)}),this._updateFilterTransform(),this.broadcastEndpointURL=ju(this.socket.socketAdapter.endPointURL()),this.private=this.params.config.private||!1,!this.private&&(!((i=(s=this.params.config)===null||s===void 0?void 0:s.broadcast)===null||i===void 0)&&i.replay))throw new Error(`tried to use replay on public channel '${this.topic}'. It must be a private channel.`)}subscribe(e,r=this.timeout){var n,s,i;if(this.socket.isConnected()||this.socket.connect(),this.channelAdapter.isClosed()){const{config:{broadcast:o,presence:a,private:l}}=this.params,c=(s=(n=this.bindings.postgres_changes)===null||n===void 0?void 0:n.map(f=>f.filter))!==null&&s!==void 0?s:[],u=!!this.bindings[Wr.PRESENCE]&&this.bindings[Wr.PRESENCE].length>0||((i=this.params.config.presence)===null||i===void 0?void 0:i.enabled)===!0,h={},d={broadcast:o,presence:Object.assign(Object.assign({},a),{enabled:u}),postgres_changes:c,private:l};this.socket.accessTokenValue&&(h.access_token=this.socket.accessTokenValue),this._onError(f=>{e==null||e(Ft.CHANNEL_ERROR,Tm(f))}),this._onClose(()=>e==null?void 0:e(Ft.CLOSED)),this.updateJoinPayload(Object.assign({config:d},h)),this._updateFilterMessage(),this.channelAdapter.subscribe(r).receive("ok",async({postgres_changes:f})=>{if(this.socket._isManualToken()||this.socket.setAuth(),f===void 0){e==null||e(Ft.SUBSCRIBED);return}this._updatePostgresBindings(f,e)}).receive("error",f=>{this.state=cr.errored;const p=Object.values(f).join(", ")||"error";e==null||e(Ft.CHANNEL_ERROR,new Error(p,{cause:f}))}).receive("timeout",()=>{e==null||e(Ft.TIMED_OUT)})}return this}_updatePostgresBindings(e,r){var n;const s=this.bindings.postgres_changes,i=(n=s==null?void 0:s.length)!==null&&n!==void 0?n:0,o=[];for(let a=0;a<i;a++){const l=s[a],{filter:{event:c,schema:u,table:h,filter:d}}=l,f=e&&e[a];if(f&&f.event===c&&$n.isFilterValueEqual(f.schema,u)&&$n.isFilterValueEqual(f.table,h)&&$n.isFilterValueEqual(f.filter,d))o.push(Object.assign(Object.assign({},l),{id:f.id}));else{this.unsubscribe(),this.state=cr.errored,r==null||r(Ft.CHANNEL_ERROR,new Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=o,this.state!=cr.errored&&r&&r(Ft.SUBSCRIBED)}presenceState(){return this.presence.state}async track(e,r={}){return await this.send({type:"presence",event:"track",payload:e},r.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,r,n){const s=this.channelAdapter.isJoined()||this.channelAdapter.isJoining(),i=e===Wr.PRESENCE||e===Wr.POSTGRES_CHANGES;if(s&&i)throw this.socket.log("channel",`cannot add \`${e}\` callbacks for ${this.topic} after \`subscribe()\`.`),new Error(`cannot add \`${e}\` callbacks for ${this.topic} after \`subscribe()\`.`);return this._on(e,r,n)}async httpSend(e,r,n={}){var s;if(r==null)return Promise.reject(new Error("Payload is required for httpSend()"));const i={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(i.Authorization=`Bearer ${this.socket.accessTokenValue}`);const o={method:"POST",headers:i,body:JSON.stringify({messages:[{topic:this.subTopic,event:e,payload:r,private:this.private}]})},a=await this._fetchWithTimeout(this.broadcastEndpointURL,o,(s=n.timeout)!==null&&s!==void 0?s:this.timeout);if(a.status===202)return{success:!0};let l=a.statusText;try{const c=await a.json();l=c.error||c.message||l}catch{}return Promise.reject(new Error(l))}async send(e,r={}){var n,s;if(!this.channelAdapter.canPush()&&e.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:i,payload:o}=e,a={apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"};this.socket.accessTokenValue&&(a.Authorization=`Bearer ${this.socket.accessTokenValue}`);const l={method:"POST",headers:a,body:JSON.stringify({messages:[{topic:this.subTopic,event:i,payload:o,private:this.private}]})};try{const c=await this._fetchWithTimeout(this.broadcastEndpointURL,l,(n=r.timeout)!==null&&n!==void 0?n:this.timeout);return await((s=c.body)===null||s===void 0?void 0:s.cancel()),c.ok?"ok":"error"}catch(c){return c instanceof Error&&c.name==="AbortError"?"timed out":"error"}}else return new Promise(i=>{var o,a,l;const c=this.channelAdapter.push(e.type,e,r.timeout||this.timeout);e.type==="broadcast"&&!(!((l=(a=(o=this.params)===null||o===void 0?void 0:o.config)===null||a===void 0?void 0:a.broadcast)===null||l===void 0)&&l.ack)&&i("ok"),c.receive("ok",()=>i("ok")),c.receive("error",()=>i("error")),c.receive("timeout",()=>i("timed out"))})}updateJoinPayload(e){this.channelAdapter.updateJoinPayload(e)}async unsubscribe(e=this.timeout){return new Promise(r=>{this.channelAdapter.unsubscribe(e).receive("ok",()=>r("ok")).receive("timeout",()=>r("timed out")).receive("error",()=>r("error"))})}teardown(){this.channelAdapter.teardown()}async _fetchWithTimeout(e,r,n){const s=new AbortController,i=setTimeout(()=>s.abort(),n),o=await this.socket.fetch(e,Object.assign(Object.assign({},r),{signal:s.signal}));return clearTimeout(i),o}_on(e,r,n){const s=e.toLocaleLowerCase(),i=this.channelAdapter.on(e,n),o={type:s,filter:r,callback:n,ref:i};return this.bindings[s]?this.bindings[s].push(o):this.bindings[s]=[o],this._updateFilterMessage(),this}_onClose(e){this.channelAdapter.onClose(e)}_onError(e){this.channelAdapter.onError(e)}_updateFilterMessage(){this.channelAdapter.updateFilterBindings((e,r,n)=>{var s,i,o,a,l,c,u;const h=e.event.toLocaleLowerCase();if(this._notThisChannelEvent(h,n))return!1;const d=(s=this.bindings[h])===null||s===void 0?void 0:s.find(f=>f.ref===e.ref);if(!d)return!0;if(["broadcast","presence","postgres_changes"].includes(h))if("id"in d){const f=d.id,p=(i=d.filter)===null||i===void 0?void 0:i.event;return f&&((o=r.ids)===null||o===void 0?void 0:o.includes(f))&&(p==="*"||(p==null?void 0:p.toLocaleLowerCase())===((a=r.data)===null||a===void 0?void 0:a.type.toLocaleLowerCase()))}else{const f=(c=(l=d==null?void 0:d.filter)===null||l===void 0?void 0:l.event)===null||c===void 0?void 0:c.toLocaleLowerCase();return f==="*"||f===((u=r==null?void 0:r.event)===null||u===void 0?void 0:u.toLocaleLowerCase())}else return d.type.toLocaleLowerCase()===h})}_notThisChannelEvent(e,r){const{close:n,error:s,leave:i,join:o}=Iu;return r&&[n,s,i,o].includes(e)&&r!==this.joinPush.ref}_updateFilterTransform(){this.channelAdapter.updatePayloadTransform((e,r,n)=>{if(typeof r=="object"&&"ids"in r){const s=r.data,{schema:i,table:o,commit_timestamp:a,type:l,errors:c}=s;return Object.assign(Object.assign({},{schema:i,table:o,commit_timestamp:a,eventType:l,new:{},old:{},errors:c}),this._getPayloadRecords(s))}return r})}copyBindings(e){if(this.joinedOnce)throw new Error("cannot copy bindings into joined channel");for(const r in e.bindings)for(const n of e.bindings[r])this._on(n.type,n.filter,n.callback)}static isFilterValueEqual(e,r){return(e??void 0)===(r??void 0)}_getPayloadRecords(e){const r={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(r.new=hl(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(r.old=hl(e.columns,e.old_record)),r}}class Rm{constructor(e,r){this.socket=new wm(e,r)}get timeout(){return this.socket.timeout}get endPoint(){return this.socket.endPoint}get transport(){return this.socket.transport}get heartbeatIntervalMs(){return this.socket.heartbeatIntervalMs}get heartbeatCallback(){return this.socket.heartbeatCallback}set heartbeatCallback(e){this.socket.heartbeatCallback=e}get heartbeatTimer(){return this.socket.heartbeatTimer}get pendingHeartbeatRef(){return this.socket.pendingHeartbeatRef}get reconnectTimer(){return this.socket.reconnectTimer}get vsn(){return this.socket.vsn}get encode(){return this.socket.encode}get decode(){return this.socket.decode}get reconnectAfterMs(){return this.socket.reconnectAfterMs}get sendBuffer(){return this.socket.sendBuffer}get stateChangeCallbacks(){return this.socket.stateChangeCallbacks}connect(){this.socket.connect()}disconnect(e,r,n,s=1e4){return new Promise(i=>{setTimeout(()=>i("timeout"),s),this.socket.disconnect(()=>{e(),i("ok")},r,n)})}push(e){this.socket.push(e)}log(e,r,n){this.socket.log(e,r,n)}makeRef(){return this.socket.makeRef()}onOpen(e){this.socket.onOpen(e)}onClose(e){this.socket.onClose(e)}onError(e){this.socket.onError(e)}onMessage(e){this.socket.onMessage(e)}isConnected(){return this.socket.isConnected()}isConnecting(){return this.socket.connectionState()==eo.connecting}isDisconnecting(){return this.socket.connectionState()==eo.closing}connectionState(){return this.socket.connectionState()}endPointURL(){return this.socket.endPointURL()}sendHeartbeat(){this.socket.sendHeartbeat()}getSocket(){return this.socket}}const gl={HEARTBEAT_INTERVAL:25e3},Cm=[1e3,2e3,5e3,1e4],Om=1e4;function Pm(){const t=new Map;return{get length(){return t.size},clear(){t.clear()},getItem(e){return t.has(e)?t.get(e):null},key(e){var r;return(r=Array.from(t.keys())[e])!==null&&r!==void 0?r:null},removeItem(e){t.delete(e)},setItem(e,r){t.set(e,String(r))}}}function Im(){try{if(typeof globalThis<"u"&&globalThis.sessionStorage)return globalThis.sessionStorage}catch{}return Pm()}const $m=`
|
|
179
|
-
addEventListener("message", (e) => {
|
|
180
|
-
if (e.data.event === "start") {
|
|
181
|
-
setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval);
|
|
182
|
-
}
|
|
183
|
-
});`;class jm{get endPoint(){return this.socketAdapter.endPoint}get timeout(){return this.socketAdapter.timeout}get transport(){return this.socketAdapter.transport}get heartbeatCallback(){return this.socketAdapter.heartbeatCallback}get heartbeatIntervalMs(){return this.socketAdapter.heartbeatIntervalMs}get heartbeatTimer(){return this.worker?this._workerHeartbeatTimer:this.socketAdapter.heartbeatTimer}get pendingHeartbeatRef(){return this.worker?this._pendingWorkerHeartbeatRef:this.socketAdapter.pendingHeartbeatRef}get reconnectTimer(){return this.socketAdapter.reconnectTimer}get vsn(){return this.socketAdapter.vsn}get encode(){return this.socketAdapter.encode}get decode(){return this.socketAdapter.decode}get reconnectAfterMs(){return this.socketAdapter.reconnectAfterMs}get sendBuffer(){return this.socketAdapter.sendBuffer}get stateChangeCallbacks(){return this.socketAdapter.stateChangeCallbacks}constructor(e,r){var n;if(this.channels=new Array,this.accessTokenValue=null,this.accessToken=null,this.apiKey=null,this.httpEndpoint="",this.headers={},this.params={},this.ref=0,this.serializer=new om,this._manuallySetToken=!1,this._authPromise=null,this._workerHeartbeatTimer=void 0,this._pendingWorkerHeartbeatRef=null,this._pendingDisconnectTimer=null,this._disconnectOnEmptyChannelsAfterMs=0,this._resolveFetch=i=>i?(...o)=>i(...o):(...o)=>fetch(...o),!(!((n=r==null?void 0:r.params)===null||n===void 0)&&n.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=r.params.apikey;const s=this._initializeOptions(r);this.socketAdapter=new Rm(e,s),this.httpEndpoint=ju(e),this.fetch=this._resolveFetch(r==null?void 0:r.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||this.isConnected())){this.accessToken&&!this._authPromise&&this._setAuthSafely("connect"),this._setupConnectionHandlers();try{this.socketAdapter.connect()}catch(e){const r=e.message;throw r.includes("Node.js")?new Error(`${r}
|
|
184
|
-
|
|
185
|
-
To use Realtime in Node.js, you need to provide a WebSocket implementation:
|
|
186
|
-
|
|
187
|
-
Option 1: Use Node.js 22+ which has native WebSocket support
|
|
188
|
-
Option 2: Install and provide the "ws" package:
|
|
189
|
-
|
|
190
|
-
npm install ws
|
|
191
|
-
|
|
192
|
-
import ws from "ws"
|
|
193
|
-
const client = new RealtimeClient(url, {
|
|
194
|
-
...options,
|
|
195
|
-
transport: ws
|
|
196
|
-
})`):new Error(`WebSocket not available: ${r}`)}this._handleNodeJsRaceCondition()}}endpointURL(){return this.socketAdapter.endPointURL()}async disconnect(e,r){return this._cancelPendingDisconnect(),this.isDisconnecting()?"ok":await this.socketAdapter.disconnect(()=>{clearInterval(this._workerHeartbeatTimer),this._terminateWorker()},e,r)}getChannels(){return this.channels}async removeChannel(e){const r=await e.unsubscribe();return r==="ok"&&e.teardown(),r}async removeAllChannels(){const e=this.channels.map(async n=>{const s=await n.unsubscribe();return n.teardown(),s}),r=await Promise.all(e);return await this.disconnect(),r}log(e,r,n){this.socketAdapter.log(e,r,n)}connectionState(){return this.socketAdapter.connectionState()||eo.closed}isConnected(){return this.socketAdapter.isConnected()}isConnecting(){return this.socketAdapter.isConnecting()}isDisconnecting(){return this.socketAdapter.isDisconnecting()}channel(e,r={config:{}}){const n=`realtime:${e}`,s=this.getChannels().find(i=>i.topic===n);if(s)return s;{const i=new $n(`realtime:${e}`,r,this);return this._cancelPendingDisconnect(),this.channels.push(i),i}}push(e){this.socketAdapter.push(e)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}_isManualToken(){return this._manuallySetToken}async sendHeartbeat(){this.socketAdapter.sendHeartbeat()}onHeartbeat(e){this.socketAdapter.heartbeatCallback=this._wrapHeartbeatCallback(e)}_makeRef(){return this.socketAdapter.makeRef()}_remove(e){this.channels=this.channels.filter(r=>r.topic!==e.topic),this.channels.length===0&&(this.log("transport","no channels remaining, scheduling disconnect"),this._schedulePendingDisconnect())}_schedulePendingDisconnect(){if(this._cancelPendingDisconnect(),this._disconnectOnEmptyChannelsAfterMs===0){this.log("transport","disconnecting immediately - no channels"),this.disconnect();return}this._pendingDisconnectTimer=setTimeout(()=>{this._pendingDisconnectTimer=null,this.channels.length===0&&(this.log("transport","deferred disconnect fired - no channels, disconnecting"),this.disconnect())},this._disconnectOnEmptyChannelsAfterMs),this.log("transport",`deferred disconnect scheduled in ${this._disconnectOnEmptyChannelsAfterMs}ms`)}_cancelPendingDisconnect(){this._pendingDisconnectTimer!==null&&(this.log("transport","pending disconnect cancelled - channel activity detected"),clearTimeout(this._pendingDisconnectTimer),this._pendingDisconnectTimer=null)}async _performAuth(e=null){let r,n=!1;if(e)r=e,n=!0;else if(this.accessToken)try{r=await this.accessToken()}catch(s){this.log("error","Error fetching access token from callback",s),r=this.accessTokenValue}else r=this.accessTokenValue;n?this._manuallySetToken=!0:this.accessToken&&(this._manuallySetToken=!1),this.accessTokenValue!=r&&(this.accessTokenValue=r,this.channels.forEach(s=>{const i={access_token:r,version:tm};r&&s.updateJoinPayload(i),s.joinedOnce&&s.channelAdapter.isJoined()&&s.channelAdapter.push(Iu.access_token,{access_token:r})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this._isManualToken()||this.setAuth().catch(r=>{this.log("error",`Error setting auth in ${e}`,r)})}_setupConnectionHandlers(){this.socketAdapter.onOpen(()=>{(this._authPromise||(this.accessToken&&!this.accessTokenValue?this.setAuth():Promise.resolve())).catch(r=>{this.log("error","error waiting for auth on connect",r)}),this.worker&&!this.workerRef&&this._startWorkerHeartbeat()}),this.socketAdapter.onClose(()=>{this.worker&&this.workerRef&&this._terminateWorker()}),this.socketAdapter.onMessage(e=>{e.ref&&e.ref===this._pendingWorkerHeartbeatRef&&(this._pendingWorkerHeartbeatRef=null)})}_handleNodeJsRaceCondition(){this.socketAdapter.isConnected()&&this.socketAdapter.getSocket().onConnOpen()}_wrapHeartbeatCallback(e){return(r,n)=>{r=="sent"&&this._setAuthSafely(),e&&e(r,n)}}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=r=>{this.log("worker","worker error",r.message),this._terminateWorker(),this.disconnect()},this.workerRef.onmessage=r=>{r.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_terminateWorker(){this.workerRef&&(this.log("worker","terminating worker"),this.workerRef.terminate(),this.workerRef=void 0)}_workerObjectUrl(e){let r;if(e)r=e;else{const n=new Blob([$m],{type:"application/javascript"});r=URL.createObjectURL(n)}return r}_initializeOptions(e){var r,n,s,i,o,a,l,c,u,h,d,f;this.worker=(r=e==null?void 0:e.worker)!==null&&r!==void 0?r:!1,this.accessToken=(n=e==null?void 0:e.accessToken)!==null&&n!==void 0?n:null;const p={};p.timeout=(s=e==null?void 0:e.timeout)!==null&&s!==void 0?s:sm,p.heartbeatIntervalMs=(i=e==null?void 0:e.heartbeatIntervalMs)!==null&&i!==void 0?i:gl.HEARTBEAT_INTERVAL,this._disconnectOnEmptyChannelsAfterMs=(o=e==null?void 0:e.disconnectOnEmptyChannelsAfterMs)!==null&&o!==void 0?o:2*((a=e==null?void 0:e.heartbeatIntervalMs)!==null&&a!==void 0?a:gl.HEARTBEAT_INTERVAL),p.transport=(l=e==null?void 0:e.transport)!==null&&l!==void 0?l:Qg.getWebSocketConstructor(),p.params=e==null?void 0:e.params,p.logger=e==null?void 0:e.logger,p.heartbeatCallback=this._wrapHeartbeatCallback(e==null?void 0:e.heartbeatCallback),p.sessionStorage=(c=e==null?void 0:e.sessionStorage)!==null&&c!==void 0?c:Im(),p.reconnectAfterMs=(u=e==null?void 0:e.reconnectAfterMs)!==null&&u!==void 0?u:(_=>Cm[_-1]||Om);let y,w;const k=(h=e==null?void 0:e.vsn)!==null&&h!==void 0?h:nm;switch(k){case rm:y=(_,b)=>b(JSON.stringify(_)),w=(_,b)=>b(JSON.parse(_));break;case Pu:y=this.serializer.encode.bind(this.serializer),w=this.serializer.decode.bind(this.serializer);break;default:throw new Error(`Unsupported serializer version: ${p.vsn}`)}if(p.vsn=k,p.encode=(d=e==null?void 0:e.encode)!==null&&d!==void 0?d:y,p.decode=(f=e==null?void 0:e.decode)!==null&&f!==void 0?f:w,p.beforeReconnect=this._reconnectAuth.bind(this),(e!=null&&e.logLevel||e!=null&&e.log_level)&&(this.logLevel=e.logLevel||e.log_level,p.params=Object.assign(Object.assign({},p.params),{log_level:this.logLevel})),this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=e==null?void 0:e.workerUrl,p.autoSendHeartbeat=!this.worker}return p}async _reconnectAuth(){await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()}}var zn=class extends Error{constructor(t,e){var r;super(t),this.name="IcebergError",this.status=e.status,this.icebergType=e.icebergType,this.icebergCode=e.icebergCode,this.details=e.details,this.isCommitStateUnknown=e.icebergType==="CommitStateUnknownException"||[500,502,504].includes(e.status)&&((r=e.icebergType)==null?void 0:r.includes("CommitState"))===!0}isNotFound(){return this.status===404}isConflict(){return this.status===409}isAuthenticationTimeout(){return this.status===419}};function Nm(t,e,r){const n=new URL(e,t);if(r)for(const[s,i]of Object.entries(r))i!==void 0&&n.searchParams.set(s,i);return n.toString()}async function Lm(t){return!t||t.type==="none"?{}:t.type==="bearer"?{Authorization:`Bearer ${t.token}`}:t.type==="header"?{[t.name]:t.value}:t.type==="custom"?await t.getHeaders():{}}function Dm(t){const e=t.fetchImpl??globalThis.fetch;return{async request({method:r,path:n,query:s,body:i,headers:o}){const a=Nm(t.baseUrl,n,s),l=await Lm(t.auth),c=await e(a,{method:r,headers:{...i?{"Content-Type":"application/json"}:{},...l,...o},body:i?JSON.stringify(i):void 0}),u=await c.text(),h=(c.headers.get("content-type")||"").includes("application/json"),d=h&&u?JSON.parse(u):u;if(!c.ok){const f=h?d:void 0,p=f==null?void 0:f.error;throw new zn((p==null?void 0:p.message)??`Request failed with status ${c.status}`,{status:c.status,icebergType:p==null?void 0:p.type,icebergCode:p==null?void 0:p.code,details:f})}return{status:c.status,headers:c.headers,data:d}}}}function cs(t){return t.join("")}var Um=class{constructor(t,e=""){this.client=t,this.prefix=e}async listNamespaces(t){const e=t?{parent:cs(t.namespace)}:void 0;return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces`,query:e})).data.namespaces.map(n=>({namespace:n}))}async createNamespace(t,e){const r={namespace:t.namespace,properties:e==null?void 0:e.properties};return(await this.client.request({method:"POST",path:`${this.prefix}/namespaces`,body:r})).data}async dropNamespace(t){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${cs(t.namespace)}`})}async loadNamespaceMetadata(t){return{properties:(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${cs(t.namespace)}`})).data.properties}}async namespaceExists(t){try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${cs(t.namespace)}`}),!0}catch(e){if(e instanceof zn&&e.status===404)return!1;throw e}}async createNamespaceIfNotExists(t,e){try{return await this.createNamespace(t,e)}catch(r){if(r instanceof zn&&r.status===409)return;throw r}}};function Nr(t){return t.join("")}var Bm=class{constructor(t,e="",r){this.client=t,this.prefix=e,this.accessDelegation=r}async listTables(t){return(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Nr(t.namespace)}/tables`})).data.identifiers}async createTable(t,e){const r={};return this.accessDelegation&&(r["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Nr(t.namespace)}/tables`,body:e,headers:r})).data.metadata}async updateTable(t,e){const r=await this.client.request({method:"POST",path:`${this.prefix}/namespaces/${Nr(t.namespace)}/tables/${t.name}`,body:e});return{"metadata-location":r.data["metadata-location"],metadata:r.data.metadata}}async dropTable(t,e){await this.client.request({method:"DELETE",path:`${this.prefix}/namespaces/${Nr(t.namespace)}/tables/${t.name}`,query:{purgeRequested:String((e==null?void 0:e.purge)??!1)}})}async loadTable(t){const e={};return this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation),(await this.client.request({method:"GET",path:`${this.prefix}/namespaces/${Nr(t.namespace)}/tables/${t.name}`,headers:e})).data.metadata}async tableExists(t){const e={};this.accessDelegation&&(e["X-Iceberg-Access-Delegation"]=this.accessDelegation);try{return await this.client.request({method:"HEAD",path:`${this.prefix}/namespaces/${Nr(t.namespace)}/tables/${t.name}`,headers:e}),!0}catch(r){if(r instanceof zn&&r.status===404)return!1;throw r}}async createTableIfNotExists(t,e){try{return await this.createTable(t,e)}catch(r){if(r instanceof zn&&r.status===409)return await this.loadTable({namespace:t.namespace,name:e.name});throw r}}},Mm=class{constructor(t){var n;let e="v1";t.catalogName&&(e+=`/${t.catalogName}`);const r=t.baseUrl.endsWith("/")?t.baseUrl:`${t.baseUrl}/`;this.client=Dm({baseUrl:r,auth:t.auth,fetchImpl:t.fetch}),this.accessDelegation=(n=t.accessDelegation)==null?void 0:n.join(","),this.namespaceOps=new Um(this.client,e),this.tableOps=new Bm(this.client,e,this.accessDelegation)}async listNamespaces(t){return this.namespaceOps.listNamespaces(t)}async createNamespace(t,e){return this.namespaceOps.createNamespace(t,e)}async dropNamespace(t){await this.namespaceOps.dropNamespace(t)}async loadNamespaceMetadata(t){return this.namespaceOps.loadNamespaceMetadata(t)}async listTables(t){return this.tableOps.listTables(t)}async createTable(t,e){return this.tableOps.createTable(t,e)}async updateTable(t,e){return this.tableOps.updateTable(t,e)}async dropTable(t,e){await this.tableOps.dropTable(t,e)}async loadTable(t){return this.tableOps.loadTable(t)}async namespaceExists(t){return this.namespaceOps.namespaceExists(t)}async tableExists(t){return this.tableOps.tableExists(t)}async createNamespaceIfNotExists(t,e){return this.namespaceOps.createNamespaceIfNotExists(t,e)}async createTableIfNotExists(t,e){return this.tableOps.createTableIfNotExists(t,e)}};function Wn(t){"@babel/helpers - typeof";return Wn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Wn(t)}function Hm(t,e){if(Wn(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Wn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function qm(t){var e=Hm(t,"string");return Wn(e)=="symbol"?e:e+""}function Fm(t,e,r){return(e=qm(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ml(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function J(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?ml(Object(r),!0).forEach(function(n){Fm(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ml(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}var oi=class extends Error{constructor(t,e="storage",r,n){super(t),this.__isStorageError=!0,this.namespace=e,this.name=e==="vectors"?"StorageVectorsError":"StorageError",this.status=r,this.statusCode=n}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}};function ai(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}var so=class extends oi{constructor(t,e,r,n="storage"){super(t,n,e,r),this.name=n==="vectors"?"StorageVectorsApiError":"StorageApiError",this.status=e,this.statusCode=r}toJSON(){return J({},super.toJSON())}},Lu=class extends oi{constructor(t,e,r="storage"){super(t,r),this.name=r==="vectors"?"StorageVectorsUnknownError":"StorageUnknownError",this.originalError=e}};function Ps(t,e,r){const n=J({},t),s=e.toLowerCase();for(const i of Object.keys(n))i.toLowerCase()===s&&delete n[i];return n[s]=r,n}function Vm(t){const e={};for(const[r,n]of Object.entries(t))e[r.toLowerCase()]=n;return e}const zm=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),Wm=t=>{if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},io=t=>{if(Array.isArray(t))return t.map(r=>io(r));if(typeof t=="function"||t!==Object(t))return t;const e={};return Object.entries(t).forEach(([r,n])=>{const s=r.replace(/([-_][a-z])/gi,i=>i.toUpperCase().replace(/[-_]/g,""));e[s]=io(n)}),e},Km=t=>!t||typeof t!="string"||t.length===0||t.length>100||t.trim()!==t||t.includes("/")||t.includes("\\")?!1:/^[\w!.\*'() &$@=;:+,?-]+$/.test(t),yl=t=>{if(typeof t=="object"&&t!==null){const e=t;if(typeof e.msg=="string")return e.msg;if(typeof e.message=="string")return e.message;if(typeof e.error_description=="string")return e.error_description;if(typeof e.error=="string")return e.error;if(typeof e.error=="object"&&e.error!==null){const r=e.error;if(typeof r.message=="string")return r.message}}return JSON.stringify(t)},Gm=async(t,e,r,n)=>{if(t!==null&&typeof t=="object"&&"json"in t&&typeof t.json=="function"){const s=t;let i=parseInt(String(s.status),10);Number.isFinite(i)||(i=500),s.json().then(o=>{const a=(o==null?void 0:o.statusCode)||(o==null?void 0:o.code)||i+"";e(new so(yl(o),i,a,n))}).catch(()=>{const o=i+"";e(new so(s.statusText||`HTTP ${i} error`,i,o,n))})}else e(new Lu(yl(t),t,n))},Jm=(t,e,r,n)=>{const s={method:t,headers:(e==null?void 0:e.headers)||{}};if(t==="GET"||t==="HEAD"||!n)return J(J({},s),r);if(Wm(n)){var i;const o=(e==null?void 0:e.headers)||{};let a;for(const[l,c]of Object.entries(o))l.toLowerCase()==="content-type"&&(a=c);s.headers=Ps(o,"Content-Type",(i=a)!==null&&i!==void 0?i:"application/json"),s.body=JSON.stringify(n)}else s.body=n;return e!=null&&e.duplex&&(s.duplex=e.duplex),J(J({},s),r)};async function pn(t,e,r,n,s,i,o){return new Promise((a,l)=>{t(r,Jm(e,n,s,i)).then(c=>{if(!c.ok)throw c;if(n!=null&&n.noResolveJson)return c;if(o==="vectors"){const u=c.headers.get("content-type");if(c.headers.get("content-length")==="0"||c.status===204)return{};if(!u||!u.includes("application/json"))return{}}return c.json()}).then(c=>a(c)).catch(c=>Gm(c,l,n,o))})}function Du(t="storage"){return{get:async(e,r,n,s)=>pn(e,"GET",r,n,s,void 0,t),post:async(e,r,n,s,i)=>pn(e,"POST",r,s,i,n,t),put:async(e,r,n,s,i)=>pn(e,"PUT",r,s,i,n,t),head:async(e,r,n,s)=>pn(e,"HEAD",r,J(J({},n),{},{noResolveJson:!0}),s,void 0,t),remove:async(e,r,n,s,i)=>pn(e,"DELETE",r,s,i,n,t)}}const Ym=Du("storage"),{get:Kn,post:mt,put:oo,head:Xm,remove:Lo}=Ym,ot=Du("vectors");var an=class{constructor(t,e={},r,n="storage"){this.shouldThrowOnError=!1,this.url=t,this.headers=Vm(e),this.fetch=zm(r),this.namespace=n}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(t,e){return this.headers=Ps(this.headers,t,e),this}async handleOperation(t){var e=this;try{return{data:await t(),error:null}}catch(r){if(e.shouldThrowOnError)throw r;if(ai(r))return{data:null,error:r};throw r}}};let Uu;Uu=Symbol.toStringTag;var Zm=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[Uu]="StreamDownloadBuilder",this.promise=null}then(t,e){return this.getPromise().then(t,e)}catch(t){return this.getPromise().catch(t)}finally(t){return this.getPromise().finally(t)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var t=this;try{return{data:(await t.downloadFn()).body,error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(ai(e))return{data:null,error:e};throw e}}};let Bu;Bu=Symbol.toStringTag;var Qm=class{constructor(t,e){this.downloadFn=t,this.shouldThrowOnError=e,this[Bu]="BlobDownloadBuilder",this.promise=null}asStream(){return new Zm(this.downloadFn,this.shouldThrowOnError)}then(t,e){return this.getPromise().then(t,e)}catch(t){return this.getPromise().catch(t)}finally(t){return this.getPromise().finally(t)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}async execute(){var t=this;try{return{data:await(await t.downloadFn()).blob(),error:null}}catch(e){if(t.shouldThrowOnError)throw e;if(ai(e))return{data:null,error:e};throw e}}};const ey={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},vl={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};var ty=class extends an{constructor(t,e={},r,n){super(t,e,n,"storage"),this.bucketId=r}async uploadOrUpdate(t,e,r,n){var s=this;return s.handleOperation(async()=>{let i;const o=J(J({},vl),n);let a=J(J({},s.headers),t==="POST"&&{"x-upsert":String(o.upsert)});const l=o.metadata;if(typeof Blob<"u"&&r instanceof Blob?(i=new FormData,i.append("cacheControl",o.cacheControl),l&&i.append("metadata",s.encodeMetadata(l)),i.append("",r)):typeof FormData<"u"&&r instanceof FormData?(i=r,i.has("cacheControl")||i.append("cacheControl",o.cacheControl),l&&!i.has("metadata")&&i.append("metadata",s.encodeMetadata(l))):(i=r,a["cache-control"]=`max-age=${o.cacheControl}`,a["content-type"]=o.contentType,l&&(a["x-metadata"]=s.toBase64(s.encodeMetadata(l))),(typeof ReadableStream<"u"&&i instanceof ReadableStream||i&&typeof i=="object"&&"pipe"in i&&typeof i.pipe=="function")&&!o.duplex&&(o.duplex="half")),n!=null&&n.headers)for(const[d,f]of Object.entries(n.headers))a=Ps(a,d,f);const c=s._removeEmptyFolders(e),u=s._getFinalPath(c),h=await(t=="PUT"?oo:mt)(s.fetch,`${s.url}/object/${u}`,i,J({headers:a},o!=null&&o.duplex?{duplex:o.duplex}:{}));return{path:c,id:h.Id,fullPath:h.Key}})}async upload(t,e,r){return this.uploadOrUpdate("POST",t,e,r)}async uploadToSignedUrl(t,e,r,n){var s=this;const i=s._removeEmptyFolders(t),o=s._getFinalPath(i),a=new URL(s.url+`/object/upload/sign/${o}`);return a.searchParams.set("token",e),s.handleOperation(async()=>{let l;const c=J(J({},vl),n);let u=J(J({},s.headers),{"x-upsert":String(c.upsert)});const h=c.metadata;if(typeof Blob<"u"&&r instanceof Blob?(l=new FormData,l.append("cacheControl",c.cacheControl),h&&l.append("metadata",s.encodeMetadata(h)),l.append("",r)):typeof FormData<"u"&&r instanceof FormData?(l=r,l.has("cacheControl")||l.append("cacheControl",c.cacheControl),h&&!l.has("metadata")&&l.append("metadata",s.encodeMetadata(h))):(l=r,u["cache-control"]=`max-age=${c.cacheControl}`,u["content-type"]=c.contentType,h&&(u["x-metadata"]=s.toBase64(s.encodeMetadata(h))),(typeof ReadableStream<"u"&&l instanceof ReadableStream||l&&typeof l=="object"&&"pipe"in l&&typeof l.pipe=="function")&&!c.duplex&&(c.duplex="half")),n!=null&&n.headers)for(const[d,f]of Object.entries(n.headers))u=Ps(u,d,f);return{path:i,fullPath:(await oo(s.fetch,a.toString(),l,J({headers:u},c!=null&&c.duplex?{duplex:c.duplex}:{}))).Key}})}async createSignedUploadUrl(t,e){var r=this;return r.handleOperation(async()=>{let n=r._getFinalPath(t);const s=J({},r.headers);e!=null&&e.upsert&&(s["x-upsert"]="true");const i=await mt(r.fetch,`${r.url}/object/upload/sign/${n}`,{},{headers:s}),o=new URL(r.url+i.url),a=o.searchParams.get("token");if(!a)throw new oi("No token returned by API");return{signedUrl:o.toString(),path:t,token:a}})}async update(t,e,r){return this.uploadOrUpdate("PUT",t,e,r)}async move(t,e,r){var n=this;return n.handleOperation(async()=>await mt(n.fetch,`${n.url}/object/move`,{bucketId:n.bucketId,sourceKey:t,destinationKey:e,destinationBucket:r==null?void 0:r.destinationBucket},{headers:n.headers}))}async copy(t,e,r){var n=this;return n.handleOperation(async()=>({path:(await mt(n.fetch,`${n.url}/object/copy`,{bucketId:n.bucketId,sourceKey:t,destinationKey:e,destinationBucket:r==null?void 0:r.destinationBucket},{headers:n.headers})).Key}))}async createSignedUrl(t,e,r){var n=this;return n.handleOperation(async()=>{let s=n._getFinalPath(t);const i=typeof(r==null?void 0:r.transform)=="object"&&r.transform!==null&&Object.keys(r.transform).length>0;let o=await mt(n.fetch,`${n.url}/object/sign/${s}`,J({expiresIn:e},i?{transform:r.transform}:{}),{headers:n.headers});const a=new URLSearchParams;r!=null&&r.download&&a.set("download",r.download===!0?"":r.download),(r==null?void 0:r.cacheNonce)!=null&&a.set("cacheNonce",String(r.cacheNonce));const l=a.toString();return{signedUrl:encodeURI(`${n.url}${o.signedURL}${l?`&${l}`:""}`)}})}async createSignedUrls(t,e,r){var n=this;return n.handleOperation(async()=>{const s=await mt(n.fetch,`${n.url}/object/sign/${n.bucketId}`,{expiresIn:e,paths:t},{headers:n.headers}),i=new URLSearchParams;r!=null&&r.download&&i.set("download",r.download===!0?"":r.download),(r==null?void 0:r.cacheNonce)!=null&&i.set("cacheNonce",String(r.cacheNonce));const o=i.toString();return s.map(a=>J(J({},a),{},{signedUrl:a.signedURL?encodeURI(`${n.url}${a.signedURL}${o?`&${o}`:""}`):null}))})}download(t,e,r){const n=typeof(e==null?void 0:e.transform)=="object"&&e.transform!==null&&Object.keys(e.transform).length>0?"render/image/authenticated":"object",s=new URLSearchParams;e!=null&&e.transform&&this.applyTransformOptsToQuery(s,e.transform),(e==null?void 0:e.cacheNonce)!=null&&s.set("cacheNonce",String(e.cacheNonce));const i=s.toString(),o=this._getFinalPath(t),a=()=>Kn(this.fetch,`${this.url}/${n}/${o}${i?`?${i}`:""}`,{headers:this.headers,noResolveJson:!0},r);return new Qm(a,this.shouldThrowOnError)}async info(t){var e=this;const r=e._getFinalPath(t);return e.handleOperation(async()=>io(await Kn(e.fetch,`${e.url}/object/info/${r}`,{headers:e.headers})))}async exists(t){var e=this;const r=e._getFinalPath(t);try{return await Xm(e.fetch,`${e.url}/object/${r}`,{headers:e.headers}),{data:!0,error:null}}catch(s){if(e.shouldThrowOnError)throw s;if(ai(s)){var n;const i=s instanceof so?s.status:s instanceof Lu?(n=s.originalError)===null||n===void 0?void 0:n.status:void 0;if(i!==void 0&&[400,404].includes(i))return{data:!1,error:s}}throw s}}getPublicUrl(t,e){const r=this._getFinalPath(t),n=new URLSearchParams;e!=null&&e.download&&n.set("download",e.download===!0?"":e.download),e!=null&&e.transform&&this.applyTransformOptsToQuery(n,e.transform),(e==null?void 0:e.cacheNonce)!=null&&n.set("cacheNonce",String(e.cacheNonce));const s=n.toString(),i=typeof(e==null?void 0:e.transform)=="object"&&e.transform!==null&&Object.keys(e.transform).length>0?"render/image":"object";return{data:{publicUrl:encodeURI(`${this.url}/${i}/public/${r}`)+(s?`?${s}`:"")}}}async remove(t){var e=this;return e.handleOperation(async()=>await Lo(e.fetch,`${e.url}/object/${e.bucketId}`,{prefixes:t},{headers:e.headers}))}async list(t,e,r){var n=this;return n.handleOperation(async()=>{const s=J(J(J({},ey),e),{},{prefix:t||""});return await mt(n.fetch,`${n.url}/object/list/${n.bucketId}`,s,{headers:n.headers},r)})}async listV2(t,e){var r=this;return r.handleOperation(async()=>{const n=J({},t);return await mt(r.fetch,`${r.url}/object/list-v2/${r.bucketId}`,n,{headers:r.headers},e)})}encodeMetadata(t){return JSON.stringify(t)}toBase64(t){return typeof Buffer<"u"?Buffer.from(t).toString("base64"):btoa(t)}_getFinalPath(t){return`${this.bucketId}/${t.replace(/^\/+/,"")}`}_removeEmptyFolders(t){return t.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}applyTransformOptsToQuery(t,e){return e.width&&t.set("width",e.width.toString()),e.height&&t.set("height",e.height.toString()),e.resize&&t.set("resize",e.resize),e.format&&t.set("format",e.format),e.quality&&t.set("quality",e.quality.toString()),t}};const ry="2.106.2",es={"X-Client-Info":`storage-js/${ry}`};var ny=class extends an{constructor(t,e={},r,n){const s=new URL(t);n!=null&&n.useNewHostname&&/supabase\.(co|in|red)$/.test(s.hostname)&&!s.hostname.includes("storage.supabase.")&&(s.hostname=s.hostname.replace("supabase.","storage.supabase."));const i=s.href.replace(/\/$/,""),o=J(J({},es),e);super(i,o,r,"storage")}async listBuckets(t){var e=this;return e.handleOperation(async()=>{const r=e.listBucketOptionsToQueryString(t);return await Kn(e.fetch,`${e.url}/bucket${r}`,{headers:e.headers})})}async getBucket(t){var e=this;return e.handleOperation(async()=>await Kn(e.fetch,`${e.url}/bucket/${t}`,{headers:e.headers}))}async createBucket(t,e={public:!1}){var r=this;return r.handleOperation(async()=>await mt(r.fetch,`${r.url}/bucket`,{id:t,name:t,type:e.type,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:r.headers}))}async updateBucket(t,e){var r=this;return r.handleOperation(async()=>await oo(r.fetch,`${r.url}/bucket/${t}`,{id:t,name:t,public:e.public,file_size_limit:e.fileSizeLimit,allowed_mime_types:e.allowedMimeTypes},{headers:r.headers}))}async emptyBucket(t){var e=this;return e.handleOperation(async()=>await mt(e.fetch,`${e.url}/bucket/${t}/empty`,{},{headers:e.headers}))}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await Lo(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}))}listBucketOptionsToQueryString(t){const e={};return t&&("limit"in t&&(e.limit=String(t.limit)),"offset"in t&&(e.offset=String(t.offset)),t.search&&(e.search=t.search),t.sortColumn&&(e.sortColumn=t.sortColumn),t.sortOrder&&(e.sortOrder=t.sortOrder)),Object.keys(e).length>0?"?"+new URLSearchParams(e).toString():""}},sy=class extends an{constructor(t,e={},r){const n=t.replace(/\/$/,""),s=J(J({},es),e);super(n,s,r,"storage")}async createBucket(t){var e=this;return e.handleOperation(async()=>await mt(e.fetch,`${e.url}/bucket`,{name:t},{headers:e.headers}))}async listBuckets(t){var e=this;return e.handleOperation(async()=>{const r=new URLSearchParams;(t==null?void 0:t.limit)!==void 0&&r.set("limit",t.limit.toString()),(t==null?void 0:t.offset)!==void 0&&r.set("offset",t.offset.toString()),t!=null&&t.sortColumn&&r.set("sortColumn",t.sortColumn),t!=null&&t.sortOrder&&r.set("sortOrder",t.sortOrder),t!=null&&t.search&&r.set("search",t.search);const n=r.toString(),s=n?`${e.url}/bucket?${n}`:`${e.url}/bucket`;return await Kn(e.fetch,s,{headers:e.headers})})}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await Lo(e.fetch,`${e.url}/bucket/${t}`,{},{headers:e.headers}))}from(t){var e=this;if(!Km(t))throw new oi("Invalid bucket name: File, folder, and bucket names must follow AWS object key naming guidelines and should avoid the use of any other characters.");const r=new Mm({baseUrl:this.url,catalogName:t,auth:{type:"custom",getHeaders:async()=>e.headers},fetch:this.fetch}),n=this.shouldThrowOnError;return new Proxy(r,{get(s,i){const o=s[i];return typeof o!="function"?o:async(...a)=>{try{return{data:await o.apply(s,a),error:null}}catch(l){if(n)throw l;return{data:null,error:l}}}}})}},iy=class extends an{constructor(t,e={},r){const n=t.replace(/\/$/,""),s=J(J({},es),{},{"Content-Type":"application/json"},e);super(n,s,r,"vectors")}async createIndex(t){var e=this;return e.handleOperation(async()=>await ot.post(e.fetch,`${e.url}/CreateIndex`,t,{headers:e.headers})||{})}async getIndex(t,e){var r=this;return r.handleOperation(async()=>await ot.post(r.fetch,`${r.url}/GetIndex`,{vectorBucketName:t,indexName:e},{headers:r.headers}))}async listIndexes(t){var e=this;return e.handleOperation(async()=>await ot.post(e.fetch,`${e.url}/ListIndexes`,t,{headers:e.headers}))}async deleteIndex(t,e){var r=this;return r.handleOperation(async()=>await ot.post(r.fetch,`${r.url}/DeleteIndex`,{vectorBucketName:t,indexName:e},{headers:r.headers})||{})}},oy=class extends an{constructor(t,e={},r){const n=t.replace(/\/$/,""),s=J(J({},es),{},{"Content-Type":"application/json"},e);super(n,s,r,"vectors")}async putVectors(t){var e=this;if(t.vectors.length<1||t.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return e.handleOperation(async()=>await ot.post(e.fetch,`${e.url}/PutVectors`,t,{headers:e.headers})||{})}async getVectors(t){var e=this;return e.handleOperation(async()=>await ot.post(e.fetch,`${e.url}/GetVectors`,t,{headers:e.headers}))}async listVectors(t){var e=this;if(t.segmentCount!==void 0){if(t.segmentCount<1||t.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(t.segmentIndex!==void 0&&(t.segmentIndex<0||t.segmentIndex>=t.segmentCount))throw new Error(`segmentIndex must be between 0 and ${t.segmentCount-1}`)}return e.handleOperation(async()=>await ot.post(e.fetch,`${e.url}/ListVectors`,t,{headers:e.headers}))}async queryVectors(t){var e=this;return e.handleOperation(async()=>await ot.post(e.fetch,`${e.url}/QueryVectors`,t,{headers:e.headers}))}async deleteVectors(t){var e=this;if(t.keys.length<1||t.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return e.handleOperation(async()=>await ot.post(e.fetch,`${e.url}/DeleteVectors`,t,{headers:e.headers})||{})}},ay=class extends an{constructor(t,e={},r){const n=t.replace(/\/$/,""),s=J(J({},es),{},{"Content-Type":"application/json"},e);super(n,s,r,"vectors")}async createBucket(t){var e=this;return e.handleOperation(async()=>await ot.post(e.fetch,`${e.url}/CreateVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{})}async getBucket(t){var e=this;return e.handleOperation(async()=>await ot.post(e.fetch,`${e.url}/GetVectorBucket`,{vectorBucketName:t},{headers:e.headers}))}async listBuckets(t={}){var e=this;return e.handleOperation(async()=>await ot.post(e.fetch,`${e.url}/ListVectorBuckets`,t,{headers:e.headers}))}async deleteBucket(t){var e=this;return e.handleOperation(async()=>await ot.post(e.fetch,`${e.url}/DeleteVectorBucket`,{vectorBucketName:t},{headers:e.headers})||{})}},ly=class extends ay{constructor(t,e={}){super(t,e.headers||{},e.fetch)}from(t){return new cy(this.url,this.headers,t,this.fetch)}async createBucket(t){var e=()=>super.createBucket,r=this;return e().call(r,t)}async getBucket(t){var e=()=>super.getBucket,r=this;return e().call(r,t)}async listBuckets(t={}){var e=()=>super.listBuckets,r=this;return e().call(r,t)}async deleteBucket(t){var e=()=>super.deleteBucket,r=this;return e().call(r,t)}},cy=class extends iy{constructor(t,e,r,n){super(t,e,n),this.vectorBucketName=r}async createIndex(t){var e=()=>super.createIndex,r=this;return e().call(r,J(J({},t),{},{vectorBucketName:r.vectorBucketName}))}async listIndexes(t={}){var e=()=>super.listIndexes,r=this;return e().call(r,J(J({},t),{},{vectorBucketName:r.vectorBucketName}))}async getIndex(t){var e=()=>super.getIndex,r=this;return e().call(r,r.vectorBucketName,t)}async deleteIndex(t){var e=()=>super.deleteIndex,r=this;return e().call(r,r.vectorBucketName,t)}index(t){return new uy(this.url,this.headers,this.vectorBucketName,t,this.fetch)}},uy=class extends oy{constructor(t,e,r,n,s){super(t,e,s),this.vectorBucketName=r,this.indexName=n}async putVectors(t){var e=()=>super.putVectors,r=this;return e().call(r,J(J({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async getVectors(t){var e=()=>super.getVectors,r=this;return e().call(r,J(J({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async listVectors(t={}){var e=()=>super.listVectors,r=this;return e().call(r,J(J({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async queryVectors(t){var e=()=>super.queryVectors,r=this;return e().call(r,J(J({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}async deleteVectors(t){var e=()=>super.deleteVectors,r=this;return e().call(r,J(J({},t),{},{vectorBucketName:r.vectorBucketName,indexName:r.indexName}))}},hy=class extends ny{constructor(t,e={},r,n){super(t,e,r,n)}from(t){return new ty(this.url,this.headers,t,this.fetch)}get vectors(){return new ly(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new sy(this.url+"/iceberg",this.headers,this.fetch)}};const Mu="2.106.2",Fr=30*1e3,ao=3,Ri=ao*Fr,dy="http://localhost:9999",fy="supabase.auth.token",py={"X-Client-Info":`gotrue-js/${Mu}`},lo="X-Supabase-Api-Version",Hu={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},gy=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,my=600*1e3;class nn extends Error{constructor(e,r,n){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=r,this.code=n}toJSON(){return{name:this.name,message:this.message,status:this.status,code:this.code}}}function $(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}class yy extends nn{constructor(e,r,n){super(e,r,n),this.name="AuthApiError",this.status=r,this.code=n}}function vy(t){return $(t)&&t.name==="AuthApiError"}class yt extends nn{constructor(e,r){super(e),this.name="AuthUnknownError",this.originalError=r}}class rr extends nn{constructor(e,r,n,s){super(e,n,s),this.name=r,this.status=n}}class Be extends rr{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function us(t){return $(t)&&t.name==="AuthSessionMissingError"}class Lr extends rr{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class hs extends rr{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class ds extends rr{constructor(e,r=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=r}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}function by(t){return $(t)&&t.name==="AuthImplicitGrantRedirectError"}class bl extends rr{constructor(e,r=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=r}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{details:this.details})}}class _y extends rr{constructor(){super("PKCE code verifier not found in storage. This can happen if the auth flow was initiated in a different browser or device, or if the storage was cleared. For SSR frameworks (Next.js, SvelteKit, etc.), use @supabase/ssr on both the server and client to store the code verifier in cookies.","AuthPKCECodeVerifierMissingError",400,"pkce_code_verifier_not_found")}}class co extends rr{constructor(e,r){super(e,"AuthRetryableFetchError",r,void 0)}}function Ci(t){return $(t)&&t.name==="AuthRetryableFetchError"}class _l extends rr{constructor(e,r,n){super(e,"AuthWeakPasswordError",r,"weak_password"),this.reasons=n}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{reasons:this.reasons})}}class uo extends rr{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const Is="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),wl=`
|
|
197
|
-
\r=`.split(""),wy=(()=>{const t=new Array(128);for(let e=0;e<t.length;e+=1)t[e]=-1;for(let e=0;e<wl.length;e+=1)t[wl[e].charCodeAt(0)]=-2;for(let e=0;e<Is.length;e+=1)t[Is[e].charCodeAt(0)]=e;return t})();function kl(t,e,r){if(t!==null)for(e.queue=e.queue<<8|t,e.queuedBits+=8;e.queuedBits>=6;){const n=e.queue>>e.queuedBits-6&63;r(Is[n]),e.queuedBits-=6}else if(e.queuedBits>0)for(e.queue=e.queue<<6-e.queuedBits,e.queuedBits=6;e.queuedBits>=6;){const n=e.queue>>e.queuedBits-6&63;r(Is[n]),e.queuedBits-=6}}function qu(t,e,r){const n=wy[t];if(n>-1)for(e.queue=e.queue<<6|n,e.queuedBits+=6;e.queuedBits>=8;)r(e.queue>>e.queuedBits-8&255),e.queuedBits-=8;else{if(n===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(t)}"`)}}function Sl(t){const e=[],r=o=>{e.push(String.fromCodePoint(o))},n={utf8seq:0,codepoint:0},s={queue:0,queuedBits:0},i=o=>{Ey(o,n,r)};for(let o=0;o<t.length;o+=1)qu(t.charCodeAt(o),s,i);return e.join("")}function ky(t,e){if(t<=127){e(t);return}else if(t<=2047){e(192|t>>6),e(128|t&63);return}else if(t<=65535){e(224|t>>12),e(128|t>>6&63),e(128|t&63);return}else if(t<=1114111){e(240|t>>18),e(128|t>>12&63),e(128|t>>6&63),e(128|t&63);return}throw new Error(`Unrecognized Unicode codepoint: ${t.toString(16)}`)}function Sy(t,e){for(let r=0;r<t.length;r+=1){let n=t.charCodeAt(r);if(n>55295&&n<=56319){const s=(n-55296)*1024&65535;n=(t.charCodeAt(r+1)-56320&65535|s)+65536,r+=1}ky(n,e)}}function Ey(t,e,r){if(e.utf8seq===0){if(t<=127){r(t);return}for(let n=1;n<6;n+=1)if((t>>7-n&1)===0){e.utf8seq=n;break}if(e.utf8seq===2)e.codepoint=t&31;else if(e.utf8seq===3)e.codepoint=t&15;else if(e.utf8seq===4)e.codepoint=t&7;else throw new Error("Invalid UTF-8 sequence");e.utf8seq-=1}else if(e.utf8seq>0){if(t<=127)throw new Error("Invalid UTF-8 sequence");e.codepoint=e.codepoint<<6|t&63,e.utf8seq-=1,e.utf8seq===0&&r(e.codepoint)}}function Xr(t){const e=[],r={queue:0,queuedBits:0},n=s=>{e.push(s)};for(let s=0;s<t.length;s+=1)qu(t.charCodeAt(s),r,n);return new Uint8Array(e)}function Ty(t){const e=[];return Sy(t,r=>e.push(r)),new Uint8Array(e)}function Ar(t){const e=[],r={queue:0,queuedBits:0},n=s=>{e.push(s)};return t.forEach(s=>kl(s,r,n)),kl(null,r,n),e.join("")}function Ay(t){return Math.round(Date.now()/1e3)+t}function xy(){return Symbol("auth-callback")}const qe=()=>typeof window<"u"&&typeof document<"u",_r={tested:!1,writable:!1},Fu=()=>{if(!qe())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(_r.tested)return _r.writable;const t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),_r.tested=!0,_r.writable=!0}catch{_r.tested=!0,_r.writable=!1}return _r.writable};function Ry(t){const e={},r=new URL(t);if(r.hash&&r.hash[0]==="#")try{new URLSearchParams(r.hash.substring(1)).forEach((s,i)=>{e[i]=s})}catch{}return r.searchParams.forEach((n,s)=>{e[s]=n}),e}const Vu=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),Cy=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function",Vr=async(t,e,r)=>{await t.setItem(e,JSON.stringify(r))},wr=async(t,e)=>{const r=await t.getItem(e);if(!r)return null;try{return JSON.parse(r)}catch{return null}},He=async(t,e)=>{await t.removeItem(e)};class li{constructor(){this.promise=new li.promiseConstructor((e,r)=>{this.resolve=e,this.reject=r})}}li.promiseConstructor=Promise;function fs(t){const e=t.split(".");if(e.length!==3)throw new uo("Invalid JWT structure");for(let n=0;n<e.length;n++)if(!gy.test(e[n]))throw new uo("JWT not in base64url format");return{header:JSON.parse(Sl(e[0])),payload:JSON.parse(Sl(e[1])),signature:Xr(e[2]),raw:{header:e[0],payload:e[1]}}}async function Oy(t){return await new Promise(e=>{setTimeout(()=>e(null),t)})}function Py(t,e){return new Promise((n,s)=>{(async()=>{for(let i=0;i<1/0;i++)try{const o=await t(i);if(!e(i,null,o)){n(o);return}}catch(o){if(!e(i,o)){s(o);return}}})()})}function Iy(t){return("0"+t.toString(16)).substr(-2)}function $y(){const e=new Uint32Array(56);if(typeof crypto>"u"){const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",n=r.length;let s="";for(let i=0;i<56;i++)s+=r.charAt(Math.floor(Math.random()*n));return s}return crypto.getRandomValues(e),Array.from(e,Iy).join("")}async function jy(t){const r=new TextEncoder().encode(t),n=await crypto.subtle.digest("SHA-256",r),s=new Uint8Array(n);return Array.from(s).map(i=>String.fromCharCode(i)).join("")}async function Ny(t){if(!(typeof crypto<"u"&&typeof crypto.subtle<"u"&&typeof TextEncoder<"u"))return console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),t;const r=await jy(t);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Dr(t,e,r=!1){const n=$y();let s=n;r&&(s+="/recovery"),await Vr(t,`${e}-code-verifier`,s);const i=await Ny(n);return[i,n===i?"plain":"s256"]}const Ly=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function Dy(t){const e=t.headers.get(lo);if(!e||!e.match(Ly))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function Uy(t){if(!t)throw new Error("Missing exp claim");const e=Math.floor(Date.now()/1e3);if(t<=e)throw new Error("JWT has expired")}function By(t){switch(t){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw new Error("Invalid alg claim")}}const My=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function Mt(t){if(!My.test(t))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function gt(t){if(!t.passkey)throw new Error("@supabase/auth-js: the passkey API is experimental and disabled by default. Enable it by passing `auth: { experimental: { passkey: true } }` to createClient (or to the GoTrueClient constructor).")}function Oi(){const t={};return new Proxy(t,{get:(e,r)=>{if(r==="__isUserNotAvailableProxy")return!0;if(typeof r=="symbol"){const n=r.toString();if(n==="Symbol(Symbol.toPrimitive)"||n==="Symbol(Symbol.toStringTag)"||n==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${r}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,r)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${r}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function Hy(t,e){return new Proxy(t,{get:(r,n,s)=>{if(n==="__isInsecureUserWarningProxy")return!0;if(typeof n=="symbol"){const i=n.toString();if(i==="Symbol(Symbol.toPrimitive)"||i==="Symbol(Symbol.toStringTag)"||i==="Symbol(util.inspect.custom)"||i==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(r,n,s)}return!e.value&&typeof n=="string"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),e.value=!0),Reflect.get(r,n,s)}})}function El(t){return JSON.parse(JSON.stringify(t))}const Sr=t=>{if(typeof t=="object"&&t!==null){const e=t;if(typeof e.msg=="string")return e.msg;if(typeof e.message=="string")return e.message;if(typeof e.error_description=="string")return e.error_description;if(typeof e.error=="string")return e.error}return JSON.stringify(t)},qy=[502,503,504,520,521,522,523,524,530];async function Tl(t){var e;if(!Cy(t))throw new co(Sr(t),0);if(qy.includes(t.status))throw new co(Sr(t),t.status);let r;try{r=await t.json()}catch(i){throw new yt(Sr(i),i)}let n;const s=Dy(t);if(s&&s.getTime()>=Hu["2024-01-01"].timestamp&&typeof r=="object"&&r&&typeof r.code=="string"?n=r.code:typeof r=="object"&&r&&typeof r.error_code=="string"&&(n=r.error_code),n){if(n==="weak_password")throw new _l(Sr(r),t.status,((e=r.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(n==="session_not_found")throw new Be}else if(typeof r=="object"&&r&&typeof r.weak_password=="object"&&r.weak_password&&Array.isArray(r.weak_password.reasons)&&r.weak_password.reasons.length&&r.weak_password.reasons.reduce((i,o)=>i&&typeof o=="string",!0))throw new _l(Sr(r),t.status,r.weak_password.reasons);throw new yy(Sr(r),t.status||500,n)}const Fy=(t,e,r,n)=>{const s={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"?s:(s.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e==null?void 0:e.headers),s.body=JSON.stringify(n),Object.assign(Object.assign({},s),r))};async function q(t,e,r,n){var s;const i=Object.assign({},n==null?void 0:n.headers);i[lo]||(i[lo]=Hu["2024-01-01"].name),n!=null&&n.jwt&&(i.Authorization=`Bearer ${n.jwt}`);const o=(s=n==null?void 0:n.query)!==null&&s!==void 0?s:{};n!=null&&n.redirectTo&&(o.redirect_to=n.redirectTo);const a=Object.keys(o).length?"?"+new URLSearchParams(o).toString():"",l=await Vy(t,e,r+a,{headers:i,noResolveJson:n==null?void 0:n.noResolveJson},{},n==null?void 0:n.body);return n!=null&&n.xform?n==null?void 0:n.xform(l):{data:Object.assign({},l),error:null}}async function Vy(t,e,r,n,s,i){const o=Fy(e,n,s,i);let a;try{a=await t(r,Object.assign({},o))}catch(l){throw console.error(l),new co(Sr(l),0)}if(a.ok||await Tl(a),n!=null&&n.noResolveJson)return a;try{return await a.json()}catch(l){await Tl(l)}}function dt(t){var e;let r=null;Ky(t)&&(r=Object.assign({},t),t.expires_at||(r.expires_at=Ay(t.expires_in)));const n=(e=t.user)!==null&&e!==void 0?e:typeof(t==null?void 0:t.id)=="string"?t:null;return{data:{session:r,user:n},error:null}}function Al(t){const e=dt(t);return!e.error&&t.weak_password&&typeof t.weak_password=="object"&&Array.isArray(t.weak_password.reasons)&&t.weak_password.reasons.length&&t.weak_password.message&&typeof t.weak_password.message=="string"&&t.weak_password.reasons.reduce((r,n)=>r&&typeof n=="string",!0)&&(e.data.weak_password=t.weak_password),e}function ur(t){var e;return{data:{user:(e=t.user)!==null&&e!==void 0?e:t},error:null}}function zy(t){return{data:t,error:null}}function Wy(t){const{action_link:e,email_otp:r,hashed_token:n,redirect_to:s,verification_type:i}=t,o=ii(t,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),a={action_link:e,email_otp:r,hashed_token:n,redirect_to:s,verification_type:i},l=Object.assign({},o);return{data:{properties:a,user:l},error:null}}function xl(t){return t}function Ky(t){return!!t.access_token&&!!t.refresh_token&&!!t.expires_in}const Pi=["global","local","others"];class Gy{_encodePathSegment(e){if(e==="."||e==="..")throw new nn("Invalid path segment");return encodeURIComponent(e)}constructor({url:e="",headers:r={},fetch:n,experimental:s}){this.url=e,this.headers=r,this.fetch=Vu(n),this.experimental=s??{},this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)},this.customProviders={listProviders:this._listCustomProviders.bind(this),createProvider:this._createCustomProvider.bind(this),getProvider:this._getCustomProvider.bind(this),updateProvider:this._updateCustomProvider.bind(this),deleteProvider:this._deleteCustomProvider.bind(this)},this.passkey={listPasskeys:this._adminListPasskeys.bind(this),deletePasskey:this._adminDeletePasskey.bind(this)}}async signOut(e,r=Pi[0]){if(Pi.indexOf(r)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Pi.join(", ")}`);try{return await q(this.fetch,"POST",`${this.url}/logout?scope=${r}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(n){if($(n))return{data:null,error:n};throw n}}async inviteUserByEmail(e,r={}){try{return await q(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:r.data},headers:this.headers,redirectTo:r.redirectTo,xform:ur})}catch(n){if($(n))return{data:{user:null},error:n};throw n}}async generateLink(e){try{const{options:r}=e,n=ii(e,["options"]),s=Object.assign(Object.assign({},n),r);return"newEmail"in n&&(s.new_email=n==null?void 0:n.newEmail,delete s.newEmail),await q(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:s,headers:this.headers,xform:Wy,redirectTo:r==null?void 0:r.redirectTo})}catch(r){if($(r))return{data:{properties:null,user:null},error:r};throw r}}async createUser(e){try{return await q(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:ur})}catch(r){if($(r))return{data:{user:null},error:r};throw r}}async listUsers(e){var r,n,s,i,o,a,l;try{const c={nextPage:null,lastPage:0,total:0},u=await q(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(r=e==null?void 0:e.page)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:"",per_page:(i=(s=e==null?void 0:e.perPage)===null||s===void 0?void 0:s.toString())!==null&&i!==void 0?i:""},xform:xl});if(u.error)throw u.error;const h=await u.json(),d=(o=u.headers.get("x-total-count"))!==null&&o!==void 0?o:0,f=(l=(a=u.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&l!==void 0?l:[];return f.length>0&&(f.forEach(p=>{const y=parseInt(p.split(";")[0].split("=")[1].substring(0,1)),w=JSON.parse(p.split(";")[1].split("=")[1]);c[`${w}Page`]=y}),c.total=parseInt(d)),{data:Object.assign(Object.assign({},h),c),error:null}}catch(c){if($(c))return{data:{users:[]},error:c};throw c}}async getUserById(e){Mt(e);try{return await q(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:ur})}catch(r){if($(r))return{data:{user:null},error:r};throw r}}async updateUserById(e,r){Mt(e);try{return await q(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:r,headers:this.headers,xform:ur})}catch(n){if($(n))return{data:{user:null},error:n};throw n}}async deleteUser(e,r=!1){Mt(e);try{return await q(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:r},xform:ur})}catch(n){if($(n))return{data:{user:null},error:n};throw n}}async _listFactors(e){Mt(e.userId);try{const{data:r,error:n}=await q(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:s=>({data:{factors:s},error:null})});return{data:r,error:n}}catch(r){if($(r))return{data:null,error:r};throw r}}async _deleteFactor(e){Mt(e.userId),Mt(e.id);try{return{data:await q(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(r){if($(r))return{data:null,error:r};throw r}}async _listOAuthClients(e){var r,n,s,i,o,a,l;try{const c={nextPage:null,lastPage:0,total:0},u=await q(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(n=(r=e==null?void 0:e.page)===null||r===void 0?void 0:r.toString())!==null&&n!==void 0?n:"",per_page:(i=(s=e==null?void 0:e.perPage)===null||s===void 0?void 0:s.toString())!==null&&i!==void 0?i:""},xform:xl});if(u.error)throw u.error;const h=await u.json(),d=(o=u.headers.get("x-total-count"))!==null&&o!==void 0?o:0,f=(l=(a=u.headers.get("link"))===null||a===void 0?void 0:a.split(","))!==null&&l!==void 0?l:[];return f.length>0&&(f.forEach(p=>{const y=parseInt(p.split(";")[0].split("=")[1].substring(0,1)),w=JSON.parse(p.split(";")[1].split("=")[1]);c[`${w}Page`]=y}),c.total=parseInt(d)),{data:Object.assign(Object.assign({},h),c),error:null}}catch(c){if($(c))return{data:{clients:[]},error:c};throw c}}async _createOAuthClient(e){try{return await q(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if($(r))return{data:null,error:r};throw r}}async _getOAuthClient(e){try{const r=this._encodePathSegment(e);return await q(this.fetch,"GET",`${this.url}/admin/oauth/clients/${r}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(r){if($(r))return{data:null,error:r};throw r}}async _updateOAuthClient(e,r){try{const n=this._encodePathSegment(e);return await q(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${n}`,{body:r,headers:this.headers,xform:s=>({data:s,error:null})})}catch(n){if($(n))return{data:null,error:n};throw n}}async _deleteOAuthClient(e){try{const r=this._encodePathSegment(e);return await q(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${r}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if($(r))return{data:null,error:r};throw r}}async _regenerateOAuthClientSecret(e){try{const r=this._encodePathSegment(e);return await q(this.fetch,"POST",`${this.url}/admin/oauth/clients/${r}/regenerate_secret`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(r){if($(r))return{data:null,error:r};throw r}}async _listCustomProviders(e){try{const r={};return e!=null&&e.type&&(r.type=e.type),await q(this.fetch,"GET",`${this.url}/admin/custom-providers`,{headers:this.headers,query:r,xform:n=>{var s;return{data:{providers:(s=n==null?void 0:n.providers)!==null&&s!==void 0?s:[]},error:null}}})}catch(r){if($(r))return{data:{providers:[]},error:r};throw r}}async _createCustomProvider(e){try{return await q(this.fetch,"POST",`${this.url}/admin/custom-providers`,{body:e,headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if($(r))return{data:null,error:r};throw r}}async _getCustomProvider(e){try{const r=this._encodePathSegment(e);return await q(this.fetch,"GET",`${this.url}/admin/custom-providers/${r}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(r){if($(r))return{data:null,error:r};throw r}}async _updateCustomProvider(e,r){try{const n=this._encodePathSegment(e);return await q(this.fetch,"PUT",`${this.url}/admin/custom-providers/${n}`,{body:r,headers:this.headers,xform:s=>({data:s,error:null})})}catch(n){if($(n))return{data:null,error:n};throw n}}async _deleteCustomProvider(e){try{const r=this._encodePathSegment(e);return await q(this.fetch,"DELETE",`${this.url}/admin/custom-providers/${r}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if($(r))return{data:null,error:r};throw r}}async _adminListPasskeys(e){gt(this.experimental),Mt(e.userId);try{return await q(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/passkeys`,{headers:this.headers,xform:r=>({data:r,error:null})})}catch(r){if($(r))return{data:null,error:r};throw r}}async _adminDeletePasskey(e){gt(this.experimental),Mt(e.userId),Mt(e.passkeyId);try{return await q(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/passkeys/${e.passkeyId}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(r){if($(r))return{data:null,error:r};throw r}}}function Rl(t={}){return{getItem:e=>t[e]||null,setItem:(e,r)=>{t[e]=r},removeItem:e=>{delete t[e]}}}const At={debug:!!(globalThis&&Fu()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class zu extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class Cl extends zu{}async function Jy(t,e,r){At.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",t,e);const n=new globalThis.AbortController;let s;e>0&&(s=setTimeout(()=>{n.abort(),At.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",t)},e)),await Promise.resolve();try{return await globalThis.navigator.locks.request(t,e===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:n.signal},async i=>{if(i){clearTimeout(s),At.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",t,i.name);try{return await r()}finally{At.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",t,i.name)}}else{if(e===0)throw At.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",t),new Cl(`Acquiring an exclusive Navigator LockManager lock "${t}" immediately failed`);if(At.debug)try{const o=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(o,null," "))}catch(o){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",o)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),clearTimeout(s),await r()}})}catch(i){if(e>0&&clearTimeout(s),i!==null&&typeof i=="object"&&"name"in i&&i.name==="AbortError"&&e>0){if(n.signal.aborted)return At.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire timeout, recovering by stealing lock",t),console.warn(`@supabase/gotrue-js: Lock "${t}" was not released within ${e}ms. This may indicate an orphaned lock from a component unmount (e.g., React Strict Mode). Forcefully acquiring the lock to recover.`),await Promise.resolve().then(()=>globalThis.navigator.locks.request(t,{mode:"exclusive",steal:!0},async o=>{if(o){At.debug&&console.log("@supabase/gotrue-js: navigatorLock: recovered (stolen)",t,o.name);try{return await r()}finally{At.debug&&console.log("@supabase/gotrue-js: navigatorLock: released (stolen)",t,o.name)}}else return console.warn("@supabase/gotrue-js: Navigator LockManager returned null lock even with steal: true"),await r()}));throw At.debug&&console.log("@supabase/gotrue-js: navigatorLock: lock was stolen by another request",t),new Cl(`Lock "${t}" was released because another request stole it`)}throw i}}function Yy(){if(typeof globalThis!="object")try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch{typeof self<"u"&&(self.globalThis=self)}}function Wu(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}function Xy(t){return parseInt(t,16)}function Zy(t){const e=new TextEncoder().encode(t);return"0x"+Array.from(e,n=>n.toString(16).padStart(2,"0")).join("")}function Qy(t){var e;const{chainId:r,domain:n,expirationTime:s,issuedAt:i=new Date,nonce:o,notBefore:a,requestId:l,resources:c,scheme:u,uri:h,version:d}=t;{if(!Number.isInteger(r))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${r}`);if(!n)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(o&&o.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${o}`);if(!h)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(d!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${d}`);if(!((e=t.statement)===null||e===void 0)&&e.includes(`
|
|
198
|
-
`))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${t.statement}`)}const f=Wu(t.address),p=u?`${u}://${n}`:n,y=t.statement?`${t.statement}
|
|
199
|
-
`:"",w=`${p} wants you to sign in with your Ethereum account:
|
|
200
|
-
${f}
|
|
201
|
-
|
|
202
|
-
${y}`;let k=`URI: ${h}
|
|
203
|
-
Version: ${d}
|
|
204
|
-
Chain ID: ${r}${o?`
|
|
205
|
-
Nonce: ${o}`:""}
|
|
206
|
-
Issued At: ${i.toISOString()}`;if(s&&(k+=`
|
|
207
|
-
Expiration Time: ${s.toISOString()}`),a&&(k+=`
|
|
208
|
-
Not Before: ${a.toISOString()}`),l&&(k+=`
|
|
209
|
-
Request ID: ${l}`),c){let _=`
|
|
210
|
-
Resources:`;for(const b of c){if(!b||typeof b!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${b}`);_+=`
|
|
211
|
-
- ${b}`}k+=_}return`${w}
|
|
212
|
-
${k}`}class Ie extends Error{constructor({message:e,code:r,cause:n,name:s}){var i;super(e,{cause:n}),this.__isWebAuthnError=!0,this.name=(i=s??(n instanceof Error?n.name:void 0))!==null&&i!==void 0?i:"Unknown Error",this.code=r}toJSON(){return{name:this.name,message:this.message,code:this.code}}}class $s extends Ie{constructor(e,r){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:r,message:e}),this.name="WebAuthnUnknownError",this.originalError=r}}function ev({error:t,options:e}){var r,n,s;const{publicKey:i}=e;if(!i)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new Ie({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else if(t.name==="ConstraintError"){if(((r=i.authenticatorSelection)===null||r===void 0?void 0:r.requireResidentKey)===!0)return new Ie({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:t});if(e.mediation==="conditional"&&((n=i.authenticatorSelection)===null||n===void 0?void 0:n.userVerification)==="required")return new Ie({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:t});if(((s=i.authenticatorSelection)===null||s===void 0?void 0:s.userVerification)==="required")return new Ie({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:t})}else{if(t.name==="InvalidStateError")return new Ie({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new Ie({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="NotSupportedError")return i.pubKeyCredParams.filter(a=>a.type==="public-key").length===0?new Ie({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new Ie({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:t});if(t.name==="SecurityError"){const o=window.location.hostname;if(Ku(o)){if(i.rp.id!==o)return new Ie({message:`The RP ID "${i.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new Ie({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="TypeError"){if(i.user.id.byteLength<1||i.user.id.byteLength>64)return new Ie({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:t})}else if(t.name==="UnknownError")return new Ie({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new Ie({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}function tv({error:t,options:e}){const{publicKey:r}=e;if(!r)throw Error("options was missing required publicKey property");if(t.name==="AbortError"){if(e.signal instanceof AbortSignal)return new Ie({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new Ie({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){const n=window.location.hostname;if(Ku(n)){if(r.rpId!==n)return new Ie({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new Ie({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new Ie({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:t})}return new Ie({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}class rv{createNewAbortSignal(){if(this.controller){const r=new Error("Cancelling existing WebAuthn API call for new one");r.name="AbortError",this.controller.abort(r)}const e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){const e=new Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}}const ho=new rv;function Ol(t){if(!t)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(t);const{challenge:e,user:r,excludeCredentials:n}=t,s=ii(t,["challenge","user","excludeCredentials"]),i=Xr(e).buffer,o=Object.assign(Object.assign({},r),{id:Xr(r.id).buffer}),a=Object.assign(Object.assign({},s),{challenge:i,user:o});if(n&&n.length>0){a.excludeCredentials=new Array(n.length);for(let l=0;l<n.length;l++){const c=n[l];a.excludeCredentials[l]=Object.assign(Object.assign({},c),{id:Xr(c.id).buffer,type:c.type||"public-key",transports:c.transports})}}return a}function Pl(t){if(!t)throw new Error("Credential request options are required");if(typeof PublicKeyCredential<"u"&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseRequestOptionsFromJSON=="function")return PublicKeyCredential.parseRequestOptionsFromJSON(t);const{challenge:e,allowCredentials:r}=t,n=ii(t,["challenge","allowCredentials"]),s=Xr(e).buffer,i=Object.assign(Object.assign({},n),{challenge:s});if(r&&r.length>0){i.allowCredentials=new Array(r.length);for(let o=0;o<r.length;o++){const a=r[o];i.allowCredentials[o]=Object.assign(Object.assign({},a),{id:Xr(a.id).buffer,type:a.type||"public-key",transports:a.transports})}}return i}function Il(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const r=t;return{id:t.id,rawId:t.id,response:{attestationObject:Ar(new Uint8Array(t.response.attestationObject)),clientDataJSON:Ar(new Uint8Array(t.response.clientDataJSON))},type:"public-key",clientExtensionResults:t.getClientExtensionResults(),authenticatorAttachment:(e=r.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function $l(t){var e;if("toJSON"in t&&typeof t.toJSON=="function")return t.toJSON();const r=t,n=t.getClientExtensionResults(),s=t.response;return{id:t.id,rawId:t.id,response:{authenticatorData:Ar(new Uint8Array(s.authenticatorData)),clientDataJSON:Ar(new Uint8Array(s.clientDataJSON)),signature:Ar(new Uint8Array(s.signature)),userHandle:s.userHandle?Ar(new Uint8Array(s.userHandle)):void 0},type:"public-key",clientExtensionResults:n,authenticatorAttachment:(e=r.authenticatorAttachment)!==null&&e!==void 0?e:void 0}}function Ku(t){return t==="localhost"||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(t)}function js(){var t,e;return!!(qe()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&typeof((t=navigator==null?void 0:navigator.credentials)===null||t===void 0?void 0:t.create)=="function"&&typeof((e=navigator==null?void 0:navigator.credentials)===null||e===void 0?void 0:e.get)=="function")}async function Gu(t){try{const e=await navigator.credentials.create(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new $s("Browser returned unexpected credential type",e)}:{data:null,error:new $s("Empty credential response",e)}}catch(e){return{data:null,error:ev({error:e,options:t})}}}async function Ju(t){try{const e=await navigator.credentials.get(t);return e?e instanceof PublicKeyCredential?{data:e,error:null}:{data:null,error:new $s("Browser returned unexpected credential type",e)}:{data:null,error:new $s("Empty credential response",e)}}catch(e){return{data:null,error:tv({error:e,options:t})}}}const nv={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"direct"},sv={userVerification:"preferred",hints:["security-key"],attestation:"direct"};function Ns(...t){const e=s=>s!==null&&typeof s=="object"&&!Array.isArray(s),r=s=>s instanceof ArrayBuffer||ArrayBuffer.isView(s),n={};for(const s of t)if(s)for(const i in s){const o=s[i];if(o!==void 0)if(Array.isArray(o))n[i]=o;else if(r(o))n[i]=o;else if(e(o)){const a=n[i];e(a)?n[i]=Ns(a,o):n[i]=Ns(o)}else n[i]=o}return n}function iv(t,e){return Ns(nv,t,e||{})}function ov(t,e){return Ns(sv,t,e||{})}class av{constructor(e){this.client=e,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))}async _challenge({factorId:e,webauthn:r,friendlyName:n,signal:s},i){var o;try{const{data:a,error:l}=await this.client.mfa.challenge({factorId:e,webauthn:r});if(!a)return{data:null,error:l};const c=s??ho.createNewAbortSignal();if(a.webauthn.type==="create"){const{user:u}=a.webauthn.credential_options.publicKey;if(!u.name){const h=n;if(h)u.name=`${u.id}:${h}`;else{const f=(await this.client.getUser()).data.user,p=((o=f==null?void 0:f.user_metadata)===null||o===void 0?void 0:o.name)||(f==null?void 0:f.email)||(f==null?void 0:f.id)||"User";u.name=`${u.id}:${p}`}}u.displayName||(u.displayName=u.name)}switch(a.webauthn.type){case"create":{const u=iv(a.webauthn.credential_options.publicKey,i==null?void 0:i.create),{data:h,error:d}=await Gu({publicKey:u,signal:c});return h?{data:{factorId:e,challengeId:a.id,webauthn:{type:a.webauthn.type,credential_response:h}},error:null}:{data:null,error:d}}case"request":{const u=ov(a.webauthn.credential_options.publicKey,i==null?void 0:i.request),{data:h,error:d}=await Ju(Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:u,signal:c}));return h?{data:{factorId:e,challengeId:a.id,webauthn:{type:a.webauthn.type,credential_response:h}},error:null}:{data:null,error:d}}}}catch(a){return $(a)?{data:null,error:a}:{data:null,error:new yt("Unexpected error in challenge",a)}}}async _verify({challengeId:e,factorId:r,webauthn:n}){return this.client.mfa.verify({factorId:r,challengeId:e,webauthn:n})}async _authenticate({factorId:e,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:s}={}},i){if(!r)return{data:null,error:new nn("rpId is required for WebAuthn authentication")};try{if(!js())return{data:null,error:new yt("Browser does not support WebAuthn",null)};const{data:o,error:a}=await this.challenge({factorId:e,webauthn:{rpId:r,rpOrigins:n},signal:s},{request:i});if(!o)return{data:null,error:a};const{webauthn:l}=o;return this._verify({factorId:e,challengeId:o.challengeId,webauthn:{type:l.type,rpId:r,rpOrigins:n,credential_response:l.credential_response}})}catch(o){return $(o)?{data:null,error:o}:{data:null,error:new yt("Unexpected error in authenticate",o)}}}async _register({friendlyName:e,webauthn:{rpId:r=typeof window<"u"?window.location.hostname:void 0,rpOrigins:n=typeof window<"u"?[window.location.origin]:void 0,signal:s}={}},i){if(!r)return{data:null,error:new nn("rpId is required for WebAuthn registration")};try{if(!js())return{data:null,error:new yt("Browser does not support WebAuthn",null)};const{data:o,error:a}=await this._enroll({friendlyName:e});if(!o)return await this.client.mfa.listFactors().then(u=>{var h;return(h=u.data)===null||h===void 0?void 0:h.all.find(d=>d.factor_type==="webauthn"&&d.friendly_name===e&&d.status!=="unverified")}).then(u=>u?this.client.mfa.unenroll({factorId:u==null?void 0:u.id}):void 0),{data:null,error:a};const{data:l,error:c}=await this._challenge({factorId:o.id,friendlyName:o.friendly_name,webauthn:{rpId:r,rpOrigins:n},signal:s},{create:i});return l?this._verify({factorId:o.id,challengeId:l.challengeId,webauthn:{rpId:r,rpOrigins:n,type:l.webauthn.type,credential_response:l.webauthn.credential_response}}):{data:null,error:c}}catch(o){return $(o)?{data:null,error:o}:{data:null,error:new yt("Unexpected error in register",o)}}}}Yy();const lv={url:dy,storageKey:fy,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:py,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1,throwOnError:!1,lockAcquireTimeout:5e3,skipAutoInitialize:!1,experimental:{}};async function jl(t,e,r){return await r()}const Ur={};class Gn{get jwks(){var e,r;return(r=(e=Ur[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&r!==void 0?r:{keys:[]}}set jwks(e){Ur[this.storageKey]=Object.assign(Object.assign({},Ur[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,r;return(r=(e=Ur[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&r!==void 0?r:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){Ur[this.storageKey]=Object.assign(Object.assign({},Ur[this.storageKey]),{cachedAt:e})}constructor(e){var r,n,s,i;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.autoRefreshTickTimeout=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log;const o=Object.assign(Object.assign({},lv),e);if(this.storageKey=o.storageKey,this.instanceID=(r=Gn.nextInstanceID[this.storageKey])!==null&&r!==void 0?r:0,Gn.nextInstanceID[this.storageKey]=this.instanceID+1,this.logDebugMessages=!!o.debug,typeof o.debug=="function"&&(this.logger=o.debug),this.instanceID>0&&qe()){const a=`${this._logPrefix()} Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.`;console.warn(a),this.logDebugMessages&&console.trace(a)}if(this.persistSession=o.persistSession,this.autoRefreshToken=o.autoRefreshToken,this.experimental=(n=o.experimental)!==null&&n!==void 0?n:{},this.admin=new Gy({url:o.url,headers:o.headers,fetch:o.fetch,experimental:this.experimental}),this.url=o.url,this.headers=o.headers,this.fetch=Vu(o.fetch),this.lock=o.lock||jl,this.detectSessionInUrl=o.detectSessionInUrl,this.flowType=o.flowType,this.hasCustomAuthorizationHeader=o.hasCustomAuthorizationHeader,this.throwOnError=o.throwOnError,this.lockAcquireTimeout=o.lockAcquireTimeout,o.lock?this.lock=o.lock:this.persistSession&&qe()&&(!((s=globalThis==null?void 0:globalThis.navigator)===null||s===void 0)&&s.locks)?this.lock=Jy:this.lock=jl,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new av(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this),listGrants:this._listOAuthGrants.bind(this),revokeGrant:this._revokeOAuthGrant.bind(this)},this.passkey={startRegistration:this._startPasskeyRegistration.bind(this),verifyRegistration:this._verifyPasskeyRegistration.bind(this),startAuthentication:this._startPasskeyAuthentication.bind(this),verifyAuthentication:this._verifyPasskeyAuthentication.bind(this),list:this._listPasskeys.bind(this),update:this._updatePasskey.bind(this),delete:this._deletePasskey.bind(this)},this.persistSession?(o.storage?this.storage=o.storage:Fu()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=Rl(this.memoryStorage)),o.userStorage&&(this.userStorage=o.userStorage)):(this.memoryStorage={},this.storage=Rl(this.memoryStorage)),qe()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(a){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",a)}(i=this.broadcastChannel)===null||i===void 0||i.addEventListener("message",async a=>{this._debug("received broadcast notification from other tab or client",a);try{await this._notifyAllSubscribers(a.data.event,a.data.session,!1)}catch(l){this._debug("#broadcastChannel","error",l)}})}o.skipAutoInitialize||this.initialize().catch(a=>{this._debug("#initialize()","error",a)})}isThrowOnErrorEnabled(){return this.throwOnError}_returnResult(e){if(this.throwOnError&&e&&e.error)throw e.error;return e}_logPrefix(){return`GoTrueClient@${this.storageKey}:${this.instanceID} (${Mu}) ${new Date().toISOString()}`}_debug(...e){return this.logDebugMessages&&this.logger(this._logPrefix(),...e),this}async initialize(){return this.initializePromise?await this.initializePromise:(this.initializePromise=(async()=>await this._acquireLock(this.lockAcquireTimeout,async()=>await this._initialize()))(),await this.initializePromise)}async _initialize(){var e;try{let r={},n="none";if(qe()&&(r=Ry(window.location.href),this._isImplicitGrantCallback(r)?n="implicit":await this._isPKCECallback(r)&&(n="pkce")),qe()&&this.detectSessionInUrl&&n!=="none"){const{data:s,error:i}=await this._getSessionFromURL(r,n);if(i){if(this._debug("#_initialize()","error detecting session from URL",i),by(i)){const l=(e=i.details)===null||e===void 0?void 0:e.code;if(l==="identity_already_exists"||l==="identity_not_found"||l==="single_identity_not_deletable")return{error:i}}return{error:i}}const{session:o,redirectType:a}=s;return this._debug("#_initialize()","detected session in URL",o,"redirect type",a),await this._saveSession(o),setTimeout(async()=>{a==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",o):await this._notifyAllSubscribers("SIGNED_IN",o)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(r){return $(r)?this._returnResult({error:r}):this._returnResult({error:new yt("Unexpected error during initialization",r)})}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var r,n,s;try{const i=await q(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(n=(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:(s=e==null?void 0:e.options)===null||s===void 0?void 0:s.captchaToken}},xform:dt}),{data:o,error:a}=i;if(a||!o)return this._returnResult({data:{user:null,session:null},error:a});const l=o.session,c=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(i){if($(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signUp(e){var r,n,s;try{let i;if("email"in e){const{email:u,password:h,options:d}=e;let f=null,p=null;this.flowType==="pkce"&&([f,p]=await Dr(this.storage,this.storageKey)),i=await q(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:d==null?void 0:d.emailRedirectTo,body:{email:u,password:h,data:(r=d==null?void 0:d.data)!==null&&r!==void 0?r:{},gotrue_meta_security:{captcha_token:d==null?void 0:d.captchaToken},code_challenge:f,code_challenge_method:p},xform:dt})}else if("phone"in e){const{phone:u,password:h,options:d}=e;i=await q(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:u,password:h,data:(n=d==null?void 0:d.data)!==null&&n!==void 0?n:{},channel:(s=d==null?void 0:d.channel)!==null&&s!==void 0?s:"sms",gotrue_meta_security:{captcha_token:d==null?void 0:d.captchaToken}},xform:dt})}else throw new hs("You must provide either an email or phone number and a password");const{data:o,error:a}=i;if(a||!o)return await He(this.storage,`${this.storageKey}-code-verifier`),this._returnResult({data:{user:null,session:null},error:a});const l=o.session,c=o.user;return o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(i){if(await He(this.storage,`${this.storageKey}-code-verifier`),$(i))return this._returnResult({data:{user:null,session:null},error:i});throw i}}async signInWithPassword(e){try{let r;if("email"in e){const{email:i,password:o,options:a}=e;r=await q(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:i,password:o,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:Al})}else if("phone"in e){const{phone:i,password:o,options:a}=e;r=await q(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:i,password:o,gotrue_meta_security:{captcha_token:a==null?void 0:a.captchaToken}},xform:Al})}else throw new hs("You must provide either an email or phone number and a password");const{data:n,error:s}=r;if(s)return this._returnResult({data:{user:null,session:null},error:s});if(!n||!n.session||!n.user){const i=new Lr;return this._returnResult({data:{user:null,session:null},error:i})}return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",n.session)),this._returnResult({data:Object.assign({user:n.user,session:n.session},n.weak_password?{weakPassword:n.weak_password}:null),error:s})}catch(r){if($(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOAuth(e){var r,n,s,i;return await this._handleProviderSignIn(e.provider,{redirectTo:(r=e.options)===null||r===void 0?void 0:r.redirectTo,scopes:(n=e.options)===null||n===void 0?void 0:n.scopes,queryParams:(s=e.options)===null||s===void 0?void 0:s.queryParams,skipBrowserRedirect:(i=e.options)===null||i===void 0?void 0:i.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(this.lockAcquireTimeout,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){const{chain:r}=e;switch(r){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${r}"`)}}async signInWithEthereum(e){var r,n,s,i,o,a,l,c,u,h,d;let f,p;if("message"in e)f=e.message,p=e.signature;else{const{chain:y,wallet:w,statement:k,options:_}=e;let b;if(qe())if(typeof w=="object")b=w;else{const C=window;if("ethereum"in C&&typeof C.ethereum=="object"&&"request"in C.ethereum&&typeof C.ethereum.request=="function")b=C.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof w!="object"||!(_!=null&&_.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");b=w}const x=new URL((r=_==null?void 0:_.url)!==null&&r!==void 0?r:window.location.href),D=await b.request({method:"eth_requestAccounts"}).then(C=>C).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!D||D.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const M=Wu(D[0]);let U=(n=_==null?void 0:_.signInWithEthereum)===null||n===void 0?void 0:n.chainId;if(!U){const C=await b.request({method:"eth_chainId"});U=Xy(C)}const V={domain:x.host,address:M,statement:k,uri:x.href,version:"1",chainId:U,nonce:(s=_==null?void 0:_.signInWithEthereum)===null||s===void 0?void 0:s.nonce,issuedAt:(o=(i=_==null?void 0:_.signInWithEthereum)===null||i===void 0?void 0:i.issuedAt)!==null&&o!==void 0?o:new Date,expirationTime:(a=_==null?void 0:_.signInWithEthereum)===null||a===void 0?void 0:a.expirationTime,notBefore:(l=_==null?void 0:_.signInWithEthereum)===null||l===void 0?void 0:l.notBefore,requestId:(c=_==null?void 0:_.signInWithEthereum)===null||c===void 0?void 0:c.requestId,resources:(u=_==null?void 0:_.signInWithEthereum)===null||u===void 0?void 0:u.resources};f=Qy(V),p=await b.request({method:"personal_sign",params:[Zy(f),M]})}try{const{data:y,error:w}=await q(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:f,signature:p},!((h=e.options)===null||h===void 0)&&h.captchaToken?{gotrue_meta_security:{captcha_token:(d=e.options)===null||d===void 0?void 0:d.captchaToken}}:null),xform:dt});if(w)throw w;if(!y||!y.session||!y.user){const k=new Lr;return this._returnResult({data:{user:null,session:null},error:k})}return y.session&&(await this._saveSession(y.session),await this._notifyAllSubscribers("SIGNED_IN",y.session)),this._returnResult({data:Object.assign({},y),error:w})}catch(y){if($(y))return this._returnResult({data:{user:null,session:null},error:y});throw y}}async signInWithSolana(e){var r,n,s,i,o,a,l,c,u,h,d,f;let p,y;if("message"in e)p=e.message,y=e.signature;else{const{chain:w,wallet:k,statement:_,options:b}=e;let x;if(qe())if(typeof k=="object")x=k;else{const M=window;if("solana"in M&&typeof M.solana=="object"&&("signIn"in M.solana&&typeof M.solana.signIn=="function"||"signMessage"in M.solana&&typeof M.solana.signMessage=="function"))x=M.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof k!="object"||!(b!=null&&b.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");x=k}const D=new URL((r=b==null?void 0:b.url)!==null&&r!==void 0?r:window.location.href);if("signIn"in x&&x.signIn){const M=await x.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},b==null?void 0:b.signInWithSolana),{version:"1",domain:D.host,uri:D.href}),_?{statement:_}:null));let U;if(Array.isArray(M)&&M[0]&&typeof M[0]=="object")U=M[0];else if(M&&typeof M=="object"&&"signedMessage"in M&&"signature"in M)U=M;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in U&&"signature"in U&&(typeof U.signedMessage=="string"||U.signedMessage instanceof Uint8Array)&&U.signature instanceof Uint8Array)p=typeof U.signedMessage=="string"?U.signedMessage:new TextDecoder().decode(U.signedMessage),y=U.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in x)||typeof x.signMessage!="function"||!("publicKey"in x)||typeof x!="object"||!x.publicKey||!("toBase58"in x.publicKey)||typeof x.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");p=[`${D.host} wants you to sign in with your Solana account:`,x.publicKey.toBase58(),..._?["",_,""]:[""],"Version: 1",`URI: ${D.href}`,`Issued At: ${(s=(n=b==null?void 0:b.signInWithSolana)===null||n===void 0?void 0:n.issuedAt)!==null&&s!==void 0?s:new Date().toISOString()}`,...!((i=b==null?void 0:b.signInWithSolana)===null||i===void 0)&&i.notBefore?[`Not Before: ${b.signInWithSolana.notBefore}`]:[],...!((o=b==null?void 0:b.signInWithSolana)===null||o===void 0)&&o.expirationTime?[`Expiration Time: ${b.signInWithSolana.expirationTime}`]:[],...!((a=b==null?void 0:b.signInWithSolana)===null||a===void 0)&&a.chainId?[`Chain ID: ${b.signInWithSolana.chainId}`]:[],...!((l=b==null?void 0:b.signInWithSolana)===null||l===void 0)&&l.nonce?[`Nonce: ${b.signInWithSolana.nonce}`]:[],...!((c=b==null?void 0:b.signInWithSolana)===null||c===void 0)&&c.requestId?[`Request ID: ${b.signInWithSolana.requestId}`]:[],...!((h=(u=b==null?void 0:b.signInWithSolana)===null||u===void 0?void 0:u.resources)===null||h===void 0)&&h.length?["Resources",...b.signInWithSolana.resources.map(U=>`- ${U}`)]:[]].join(`
|
|
213
|
-
`);const M=await x.signMessage(new TextEncoder().encode(p),"utf8");if(!M||!(M instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");y=M}}try{const{data:w,error:k}=await q(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:p,signature:Ar(y)},!((d=e.options)===null||d===void 0)&&d.captchaToken?{gotrue_meta_security:{captcha_token:(f=e.options)===null||f===void 0?void 0:f.captchaToken}}:null),xform:dt});if(k)throw k;if(!w||!w.session||!w.user){const _=new Lr;return this._returnResult({data:{user:null,session:null},error:_})}return w.session&&(await this._saveSession(w.session),await this._notifyAllSubscribers("SIGNED_IN",w.session)),this._returnResult({data:Object.assign({},w),error:k})}catch(w){if($(w))return this._returnResult({data:{user:null,session:null},error:w});throw w}}async _exchangeCodeForSession(e){const r=await wr(this.storage,`${this.storageKey}-code-verifier`),[n,s]=(r??"").split("/");try{if(!n&&this.flowType==="pkce")throw new _y;const{data:i,error:o}=await q(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:n},xform:dt});if(await He(this.storage,`${this.storageKey}-code-verifier`),o)throw o;if(!i||!i.session||!i.user){const a=new Lr;return this._returnResult({data:{user:null,session:null,redirectType:null},error:a})}return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers(s==="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",i.session)),this._returnResult({data:Object.assign(Object.assign({},i),{redirectType:s??null}),error:o})}catch(i){if(await He(this.storage,`${this.storageKey}-code-verifier`),$(i))return this._returnResult({data:{user:null,session:null,redirectType:null},error:i});throw i}}async signInWithIdToken(e){try{const{options:r,provider:n,token:s,access_token:i,nonce:o}=e,a=await q(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:n,id_token:s,access_token:i,nonce:o,gotrue_meta_security:{captcha_token:r==null?void 0:r.captchaToken}},xform:dt}),{data:l,error:c}=a;if(c)return this._returnResult({data:{user:null,session:null},error:c});if(!l||!l.session||!l.user){const u=new Lr;return this._returnResult({data:{user:null,session:null},error:u})}return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",l.session)),this._returnResult({data:l,error:c})}catch(r){if($(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async signInWithOtp(e){var r,n,s,i,o;try{if("email"in e){const{email:a,options:l}=e;let c=null,u=null;this.flowType==="pkce"&&([c,u]=await Dr(this.storage,this.storageKey));const{error:h}=await q(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:a,data:(r=l==null?void 0:l.data)!==null&&r!==void 0?r:{},create_user:(n=l==null?void 0:l.shouldCreateUser)!==null&&n!==void 0?n:!0,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken},code_challenge:c,code_challenge_method:u},redirectTo:l==null?void 0:l.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:h})}if("phone"in e){const{phone:a,options:l}=e,{data:c,error:u}=await q(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:a,data:(s=l==null?void 0:l.data)!==null&&s!==void 0?s:{},create_user:(i=l==null?void 0:l.shouldCreateUser)!==null&&i!==void 0?i:!0,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken},channel:(o=l==null?void 0:l.channel)!==null&&o!==void 0?o:"sms"}});return this._returnResult({data:{user:null,session:null,messageId:c==null?void 0:c.message_id},error:u})}throw new hs("You must provide either an email or phone number.")}catch(a){if(await He(this.storage,`${this.storageKey}-code-verifier`),$(a))return this._returnResult({data:{user:null,session:null},error:a});throw a}}async verifyOtp(e){var r,n;try{let s,i;"options"in e&&(s=(r=e.options)===null||r===void 0?void 0:r.redirectTo,i=(n=e.options)===null||n===void 0?void 0:n.captchaToken);const{data:o,error:a}=await q(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:i}}),redirectTo:s,xform:dt});if(a)throw a;if(!o)throw new Error("An error occurred on token verification.");const l=o.session,c=o.user;return l!=null&&l.access_token&&(await this._saveSession(l),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",l)),this._returnResult({data:{user:c,session:l},error:null})}catch(s){if($(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}}async signInWithSSO(e){var r,n,s,i,o;try{let a=null,l=null;this.flowType==="pkce"&&([a,l]=await Dr(this.storage,this.storageKey));const c=await q(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:(n=(r=e.options)===null||r===void 0?void 0:r.redirectTo)!==null&&n!==void 0?n:void 0}),!((s=e==null?void 0:e.options)===null||s===void 0)&&s.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:a,code_challenge_method:l}),headers:this.headers,xform:zy});return!((i=c.data)===null||i===void 0)&&i.url&&qe()&&!(!((o=e.options)===null||o===void 0)&&o.skipBrowserRedirect)&&window.location.assign(c.data.url),this._returnResult(c)}catch(a){if(await He(this.storage,`${this.storageKey}-code-verifier`),$(a))return this._returnResult({data:null,error:a});throw a}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:r},error:n}=e;if(n)throw n;if(!r)throw new Be;const{error:s}=await q(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:r.access_token});return this._returnResult({data:{user:null,session:null},error:s})})}catch(e){if($(e))return this._returnResult({data:{user:null,session:null},error:e});throw e}}async resend(e){try{const r=`${this.url}/resend`;if("email"in e){const{email:n,type:s,options:i}=e,{error:o}=await q(this.fetch,"POST",r,{headers:this.headers,body:{email:n,type:s,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}},redirectTo:i==null?void 0:i.emailRedirectTo});return this._returnResult({data:{user:null,session:null},error:o})}else if("phone"in e){const{phone:n,type:s,options:i}=e,{data:o,error:a}=await q(this.fetch,"POST",r,{headers:this.headers,body:{phone:n,type:s,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}}});return this._returnResult({data:{user:null,session:null,messageId:o==null?void 0:o.message_id},error:a})}throw new hs("You must provide either an email or phone number and a type")}catch(r){if($(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async getSession(){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>this._useSession(async r=>r))}async _acquireLock(e,r){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const n=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),s=(async()=>(await n,await r()))();return this.pendingInLock.push((async()=>{try{await s}catch{}})()),s}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const n=r();for(this.pendingInLock.push((async()=>{try{await n}catch{}})()),await n;this.pendingInLock.length;){const s=[...this.pendingInLock];await Promise.all(s),this.pendingInLock.splice(0,s.length)}return await n}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{const r=await this.__loadSession();return await e(r)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let e=null;const r=await wr(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",r),r!==null&&(this._isValidSession(r)?e=r:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};const n=e.expires_at?e.expires_at*1e3-Date.now()<Ri:!1;if(this._debug("#__loadSession()",`session has${n?"":" not"} expired`,"expires_at",e.expires_at),!n){if(this.userStorage){const o=await wr(this.userStorage,this.storageKey+"-user");o!=null&&o.user?e.user=o.user:e.user=Oi()}if(this.storage.isServer&&e.user&&!e.user.__isUserNotAvailableProxy){const o={value:this.suppressGetSessionWarning};e.user=Hy(e.user,o),o.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:e},error:null}}const{data:s,error:i}=await this._callRefreshToken(e.refresh_token);return i?this._returnResult({data:{session:null},error:i}):this._returnResult({data:{session:s},error:null})}finally{this._debug("#__loadSession()","end")}}async getUser(e){if(e)return await this._getUser(e);await this.initializePromise;const r=await this._acquireLock(this.lockAcquireTimeout,async()=>await this._getUser());return r.data.user&&(this.suppressGetSessionWarning=!0),r}async _getUser(e){try{return e?await q(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:ur}):await this._useSession(async r=>{var n,s,i;const{data:o,error:a}=r;if(a)throw a;return!(!((n=o.session)===null||n===void 0)&&n.access_token)&&!this.hasCustomAuthorizationHeader?{data:{user:null},error:new Be}:await q(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(i=(s=o.session)===null||s===void 0?void 0:s.access_token)!==null&&i!==void 0?i:void 0,xform:ur})})}catch(r){if($(r))return us(r)&&(await this._removeSession(),await He(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({data:{user:null},error:r});throw r}}async updateUser(e,r={}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._updateUser(e,r))}async _updateUser(e,r={}){try{return await this._useSession(async n=>{const{data:s,error:i}=n;if(i)throw i;if(!s.session)throw new Be;const o=s.session;let a=null,l=null;this.flowType==="pkce"&&e.email!=null&&([a,l]=await Dr(this.storage,this.storageKey));const{data:c,error:u}=await q(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:r==null?void 0:r.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:a,code_challenge_method:l}),jwt:o.access_token,xform:ur});if(u)throw u;return o.user=c.user,await this._saveSession(o),await this._notifyAllSubscribers("USER_UPDATED",o),this._returnResult({data:{user:o.user},error:null})})}catch(n){if(await He(this.storage,`${this.storageKey}-code-verifier`),$(n))return this._returnResult({data:{user:null},error:n});throw n}}async setSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new Be;const r=Date.now()/1e3;let n=r,s=!0,i=null;const{payload:o}=fs(e.access_token);if(o.exp&&(n=o.exp,s=n<=r),s){const{data:a,error:l}=await this._callRefreshToken(e.refresh_token);if(l)return this._returnResult({data:{user:null,session:null},error:l});if(!a)return{data:{user:null,session:null},error:null};i=a}else{const{data:a,error:l}=await this._getUser(e.access_token);if(l)return this._returnResult({data:{user:null,session:null},error:l});i={access_token:e.access_token,refresh_token:e.refresh_token,user:a.user,token_type:"bearer",expires_in:n-r,expires_at:n},await this._saveSession(i),await this._notifyAllSubscribers("SIGNED_IN",i)}return this._returnResult({data:{user:i.user,session:i},error:null})}catch(r){if($(r))return this._returnResult({data:{session:null,user:null},error:r});throw r}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async r=>{var n;if(!e){const{data:o,error:a}=r;if(a)throw a;e=(n=o.session)!==null&&n!==void 0?n:void 0}if(!(e!=null&&e.refresh_token))throw new Be;const{data:s,error:i}=await this._callRefreshToken(e.refresh_token);return i?this._returnResult({data:{user:null,session:null},error:i}):s?this._returnResult({data:{user:s.user,session:s},error:null}):this._returnResult({data:{user:null,session:null},error:null})})}catch(r){if($(r))return this._returnResult({data:{user:null,session:null},error:r});throw r}}async _getSessionFromURL(e,r){var n;try{if(!qe())throw new ds("No browser detected.");if(e.error||e.error_description||e.error_code)throw new ds(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(r){case"implicit":if(this.flowType==="pkce")throw new bl("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new ds("Not a valid implicit grant flow url.");break;default:}if(r==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new bl("No code detected.");const{data:b,error:x}=await this._exchangeCodeForSession(e.code);if(x)throw x;const D=new URL(window.location.href);return D.searchParams.delete("code"),window.history.replaceState(window.history.state,"",D.toString()),{data:{session:b.session,redirectType:(n=b.redirectType)!==null&&n!==void 0?n:null},error:null}}const{provider_token:s,provider_refresh_token:i,access_token:o,refresh_token:a,expires_in:l,expires_at:c,token_type:u}=e;if(!o||!l||!a||!u)throw new ds("No session defined in URL");const h=Math.round(Date.now()/1e3),d=parseInt(l);let f=h+d;c&&(f=parseInt(c));const p=f-h;p*1e3<=Fr&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${p}s, should have been closer to ${d}s`);const y=f-d;h-y>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",y,f,h):h-y<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",y,f,h);const{data:w,error:k}=await this._getUser(o);if(k)throw k;const _={provider_token:s,provider_refresh_token:i,access_token:o,expires_in:d,expires_at:f,refresh_token:a,token_type:u,user:w.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),this._returnResult({data:{session:_,redirectType:e.type},error:null})}catch(s){if($(s))return this._returnResult({data:{session:null,redirectType:null},error:s});throw s}}_isImplicitGrantCallback(e){return typeof this.detectSessionInUrl=="function"?this.detectSessionInUrl(new URL(window.location.href),e):!!(e.access_token||e.error_description)}async _isPKCECallback(e){const r=await wr(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&r)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async r=>{var n;const{data:s,error:i}=r;if(i&&!us(i))return this._returnResult({error:i});const o=(n=s.session)===null||n===void 0?void 0:n.access_token;if(o){const{error:a}=await this.admin.signOut(o,e);if(a&&!(vy(a)&&(a.status===404||a.status===401||a.status===403)||us(a)))return this._returnResult({error:a})}return e!=="others"&&(await this._removeSession(),await He(this.storage,`${this.storageKey}-code-verifier`)),this._returnResult({error:null})})}onAuthStateChange(e){const r=xy(),n={id:r,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",r),this.stateChangeEmitters.delete(r)}};return this._debug("#onAuthStateChange()","registered callback with id",r),this.stateChangeEmitters.set(r,n),(async()=>(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{this._emitInitialSession(r)})))(),{data:{subscription:n}}}async _emitInitialSession(e){return await this._useSession(async r=>{var n,s;try{const{data:{session:i},error:o}=r;if(o)throw o;await((n=this.stateChangeEmitters.get(e))===null||n===void 0?void 0:n.callback("INITIAL_SESSION",i)),this._debug("INITIAL_SESSION","callback id",e,"session",i)}catch(i){await((s=this.stateChangeEmitters.get(e))===null||s===void 0?void 0:s.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",i),us(i)?console.warn(i):console.error(i)}})}async resetPasswordForEmail(e,r={}){let n=null,s=null;this.flowType==="pkce"&&([n,s]=await Dr(this.storage,this.storageKey,!0));try{return await q(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:n,code_challenge_method:s,gotrue_meta_security:{captcha_token:r.captchaToken}},headers:this.headers,redirectTo:r.redirectTo})}catch(i){if(await He(this.storage,`${this.storageKey}-code-verifier`),$(i))return this._returnResult({data:null,error:i});throw i}}async getUserIdentities(){var e;try{const{data:r,error:n}=await this.getUser();if(n)throw n;return this._returnResult({data:{identities:(e=r.user.identities)!==null&&e!==void 0?e:[]},error:null})}catch(r){if($(r))return this._returnResult({data:null,error:r});throw r}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var r;try{const{data:n,error:s}=await this._useSession(async i=>{var o,a,l,c,u;const{data:h,error:d}=i;if(d)throw d;const f=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(o=e.options)===null||o===void 0?void 0:o.redirectTo,scopes:(a=e.options)===null||a===void 0?void 0:a.scopes,queryParams:(l=e.options)===null||l===void 0?void 0:l.queryParams,skipBrowserRedirect:!0});return await q(this.fetch,"GET",f,{headers:this.headers,jwt:(u=(c=h.session)===null||c===void 0?void 0:c.access_token)!==null&&u!==void 0?u:void 0})});if(s)throw s;return qe()&&!(!((r=e.options)===null||r===void 0)&&r.skipBrowserRedirect)&&window.location.assign(n==null?void 0:n.url),this._returnResult({data:{provider:e.provider,url:n==null?void 0:n.url},error:null})}catch(n){if($(n))return this._returnResult({data:{provider:e.provider,url:null},error:n});throw n}}async linkIdentityIdToken(e){return await this._useSession(async r=>{var n;try{const{error:s,data:{session:i}}=r;if(s)throw s;const{options:o,provider:a,token:l,access_token:c,nonce:u}=e,h=await q(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(n=i==null?void 0:i.access_token)!==null&&n!==void 0?n:void 0,body:{provider:a,id_token:l,access_token:c,nonce:u,link_identity:!0,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},xform:dt}),{data:d,error:f}=h;return f?this._returnResult({data:{user:null,session:null},error:f}):!d||!d.session||!d.user?this._returnResult({data:{user:null,session:null},error:new Lr}):(d.session&&(await this._saveSession(d.session),await this._notifyAllSubscribers("USER_UPDATED",d.session)),this._returnResult({data:d,error:f}))}catch(s){if(await He(this.storage,`${this.storageKey}-code-verifier`),$(s))return this._returnResult({data:{user:null,session:null},error:s});throw s}})}async unlinkIdentity(e){try{return await this._useSession(async r=>{var n,s;const{data:i,error:o}=r;if(o)throw o;return await q(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(s=(n=i.session)===null||n===void 0?void 0:n.access_token)!==null&&s!==void 0?s:void 0})})}catch(r){if($(r))return this._returnResult({data:null,error:r});throw r}}async _refreshAccessToken(e){const r=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(r,"begin");try{const n=Date.now();return await Py(async s=>(s>0&&await Oy(200*Math.pow(2,s-1)),this._debug(r,"refreshing attempt",s),await q(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:dt})),(s,i)=>{const o=200*Math.pow(2,s);return i&&Ci(i)&&Date.now()+o-n<Fr})}catch(n){if(this._debug(r,"error",n),$(n))return this._returnResult({data:{session:null,user:null},error:n});throw n}finally{this._debug(r,"end")}}_isValidSession(e){return typeof e=="object"&&e!==null&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,r){const n=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:r.redirectTo,scopes:r.scopes,queryParams:r.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",r,"url",n),qe()&&!r.skipBrowserRedirect&&window.location.assign(n),{data:{provider:e,url:n},error:null}}async _recoverAndRefresh(){var e,r;const n="#_recoverAndRefresh()";this._debug(n,"begin");try{const s=await wr(this.storage,this.storageKey);if(s&&this.userStorage){let o=await wr(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!o&&(o={user:s.user},await Vr(this.userStorage,this.storageKey+"-user",o)),s.user=(e=o==null?void 0:o.user)!==null&&e!==void 0?e:Oi()}else if(s&&!s.user&&!s.user){const o=await wr(this.storage,this.storageKey+"-user");o&&(o!=null&&o.user)?(s.user=o.user,await He(this.storage,this.storageKey+"-user"),await Vr(this.storage,this.storageKey,s)):s.user=Oi()}if(this._debug(n,"session from storage",s),!this._isValidSession(s)){this._debug(n,"session is not valid"),s!==null&&await this._removeSession();return}const i=((r=s.expires_at)!==null&&r!==void 0?r:1/0)*1e3-Date.now()<Ri;if(this._debug(n,`session has${i?"":" not"} expired with margin of ${Ri}s`),i){if(this.autoRefreshToken&&s.refresh_token){const{error:o}=await this._callRefreshToken(s.refresh_token);o&&(console.error(o),Ci(o)||(this._debug(n,"refresh failed with a non-retryable error, removing the session",o),await this._removeSession()))}}else if(s.user&&s.user.__isUserNotAvailableProxy===!0)try{const{data:o,error:a}=await this._getUser(s.access_token);!a&&(o!=null&&o.user)?(s.user=o.user,await this._saveSession(s),await this._notifyAllSubscribers("SIGNED_IN",s)):this._debug(n,"could not get user data, skipping SIGNED_IN notification")}catch(o){console.error("Error getting user data:",o),this._debug(n,"error getting user data, skipping SIGNED_IN notification",o)}else await this._notifyAllSubscribers("SIGNED_IN",s)}catch(s){this._debug(n,"error",s),console.error(s);return}finally{this._debug(n,"end")}}async _callRefreshToken(e){var r,n;if(!e)throw new Be;if(this.refreshingDeferred)return this.refreshingDeferred.promise;const s=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(s,"begin");try{this.refreshingDeferred=new li;const{data:i,error:o}=await this._refreshAccessToken(e);if(o)throw o;if(!i.session)throw new Be;await this._saveSession(i.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",i.session);const a={data:i.session,error:null};return this.refreshingDeferred.resolve(a),a}catch(i){if(this._debug(s,"error",i),$(i)){const o={data:null,error:i};return Ci(i)||await this._removeSession(),(r=this.refreshingDeferred)===null||r===void 0||r.resolve(o),o}throw(n=this.refreshingDeferred)===null||n===void 0||n.reject(i),i}finally{this.refreshingDeferred=null,this._debug(s,"end")}}async _notifyAllSubscribers(e,r,n=!0){const s=`#_notifyAllSubscribers(${e})`;this._debug(s,"begin",r,`broadcast = ${n}`);try{this.broadcastChannel&&n&&this.broadcastChannel.postMessage({event:e,session:r});const i=[],o=Array.from(this.stateChangeEmitters.values()).map(async a=>{try{await a.callback(e,r)}catch(l){i.push(l)}});if(await Promise.all(o),i.length>0){for(let a=0;a<i.length;a+=1)console.error(i[a]);throw i[0]}}finally{this._debug(s,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0,await He(this.storage,`${this.storageKey}-code-verifier`);const r=Object.assign({},e),n=r.user&&r.user.__isUserNotAvailableProxy===!0;if(this.userStorage){!n&&r.user&&await Vr(this.userStorage,this.storageKey+"-user",{user:r.user});const s=Object.assign({},r);delete s.user;const i=El(s);await Vr(this.storage,this.storageKey,i)}else{const s=El(r);await Vr(this.storage,this.storageKey,s)}}async _removeSession(){this._debug("#_removeSession()"),this.suppressGetSessionWarning=!1,await He(this.storage,this.storageKey),await He(this.storage,this.storageKey+"-code-verifier"),await He(this.storage,this.storageKey+"-user"),this.userStorage&&await He(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");const e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&qe()&&(window!=null&&window.removeEventListener)&&window.removeEventListener("visibilitychange",e)}catch(r){console.error("removing visibilitychange callback failed",r)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");const e=setInterval(()=>this._autoRefreshTokenTick(),Fr);this.autoRefreshTicker=e,e&&typeof e=="object"&&typeof e.unref=="function"?e.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(e);const r=setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0);this.autoRefreshTickTimeout=r,r&&typeof r=="object"&&typeof r.unref=="function"?r.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(r)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e);const r=this.autoRefreshTickTimeout;this.autoRefreshTickTimeout=null,r&&clearTimeout(r)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{const e=Date.now();try{return await this._useSession(async r=>{const{data:{session:n}}=r;if(!n||!n.refresh_token||!n.expires_at){this._debug("#_autoRefreshTokenTick()","no session");return}const s=Math.floor((n.expires_at*1e3-e)/Fr);this._debug("#_autoRefreshTokenTick()",`access token expires in ${s} ticks, a tick lasts ${Fr}ms, refresh threshold is ${ao} ticks`),s<=ao&&await this._callRefreshToken(n.refresh_token)})}catch(r){console.error("Auto refresh tick failed with error. This is likely a transient error.",r)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e instanceof zu)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!qe()||!(window!=null&&window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>{try{await this._onVisibilityChanged(!1)}catch(e){this._debug("#visibilityChangedCallback","error",e)}},window==null||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){const r=`#_onVisibilityChanged(${e})`;this._debug(r,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(this.lockAcquireTimeout,async()=>{if(document.visibilityState!=="visible"){this._debug(r,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");return}await this._recoverAndRefresh()}))):document.visibilityState==="hidden"&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,r,n){const s=[`provider=${encodeURIComponent(r)}`];if(n!=null&&n.redirectTo&&s.push(`redirect_to=${encodeURIComponent(n.redirectTo)}`),n!=null&&n.scopes&&s.push(`scopes=${encodeURIComponent(n.scopes)}`),this.flowType==="pkce"){const[i,o]=await Dr(this.storage,this.storageKey),a=new URLSearchParams({code_challenge:`${encodeURIComponent(i)}`,code_challenge_method:`${encodeURIComponent(o)}`});s.push(a.toString())}if(n!=null&&n.queryParams){const i=new URLSearchParams(n.queryParams);s.push(i.toString())}return n!=null&&n.skipBrowserRedirect&&s.push(`skip_http_redirect=${n.skipBrowserRedirect}`),`${e}?${s.join("&")}`}async _unenroll(e){try{return await this._useSession(async r=>{var n;const{data:s,error:i}=r;return i?this._returnResult({data:null,error:i}):await q(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(n=s==null?void 0:s.session)===null||n===void 0?void 0:n.access_token})})}catch(r){if($(r))return this._returnResult({data:null,error:r});throw r}}async _enroll(e){try{return await this._useSession(async r=>{var n,s;const{data:i,error:o}=r;if(o)return this._returnResult({data:null,error:o});const a=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:e.factorType==="totp"?{issuer:e.issuer}:{}),{data:l,error:c}=await q(this.fetch,"POST",`${this.url}/factors`,{body:a,headers:this.headers,jwt:(n=i==null?void 0:i.session)===null||n===void 0?void 0:n.access_token});return c?this._returnResult({data:null,error:c}):(e.factorType==="totp"&&l.type==="totp"&&(!((s=l==null?void 0:l.totp)===null||s===void 0)&&s.qr_code)&&(l.totp.qr_code=`data:image/svg+xml;utf-8,${l.totp.qr_code}`),this._returnResult({data:l,error:null}))})}catch(r){if($(r))return this._returnResult({data:null,error:r});throw r}}async _verify(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async r=>{var n;const{data:s,error:i}=r;if(i)return this._returnResult({data:null,error:i});const o=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type==="create"?Il(e.webauthn.credential_response):$l(e.webauthn.credential_response)})}:{code:e.code}),{data:a,error:l}=await q(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:o,headers:this.headers,jwt:(n=s==null?void 0:s.session)===null||n===void 0?void 0:n.access_token});return l?this._returnResult({data:null,error:l}):(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+a.expires_in},a)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",a),this._returnResult({data:a,error:l}))})}catch(r){if($(r))return this._returnResult({data:null,error:r});throw r}})}async _challenge(e){return this._acquireLock(this.lockAcquireTimeout,async()=>{try{return await this._useSession(async r=>{var n;const{data:s,error:i}=r;if(i)return this._returnResult({data:null,error:i});const o=await q(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:(n=s==null?void 0:s.session)===null||n===void 0?void 0:n.access_token});if(o.error)return o;const{data:a}=o;if(a.type!=="webauthn")return{data:a,error:null};switch(a.webauthn.type){case"create":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:Ol(a.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},a),{webauthn:Object.assign(Object.assign({},a.webauthn),{credential_options:Object.assign(Object.assign({},a.webauthn.credential_options),{publicKey:Pl(a.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(r){if($(r))return this._returnResult({data:null,error:r});throw r}})}async _challengeAndVerify(e){const{data:r,error:n}=await this._challenge({factorId:e.factorId});return n?this._returnResult({data:null,error:n}):await this._verify({factorId:e.factorId,challengeId:r.id,code:e.code})}async _listFactors(){var e;const{data:{user:r},error:n}=await this.getUser();if(n)return{data:null,error:n};const s={all:[],phone:[],totp:[],webauthn:[]};for(const i of(e=r==null?void 0:r.factors)!==null&&e!==void 0?e:[])s.all.push(i),i.status==="verified"&&s[i.factor_type].push(i);return{data:s,error:null}}async _getAuthenticatorAssuranceLevel(e){var r,n,s,i;if(e)try{const{payload:f}=fs(e);let p=null;f.aal&&(p=f.aal);let y=p;const{data:{user:w},error:k}=await this.getUser(e);if(k)return this._returnResult({data:null,error:k});((n=(r=w==null?void 0:w.factors)===null||r===void 0?void 0:r.filter(x=>x.status==="verified"))!==null&&n!==void 0?n:[]).length>0&&(y="aal2");const b=f.amr||[];return{data:{currentLevel:p,nextLevel:y,currentAuthenticationMethods:b},error:null}}catch(f){if($(f))return this._returnResult({data:null,error:f});throw f}const{data:{session:o},error:a}=await this.getSession();if(a)return this._returnResult({data:null,error:a});if(!o)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:l}=fs(o.access_token);let c=null;l.aal&&(c=l.aal);let u=c;((i=(s=o.user.factors)===null||s===void 0?void 0:s.filter(f=>f.status==="verified"))!==null&&i!==void 0?i:[]).length>0&&(u="aal2");const d=l.amr||[];return{data:{currentLevel:c,nextLevel:u,currentAuthenticationMethods:d},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;return s?this._returnResult({data:null,error:s}):n?await q(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:n.access_token,xform:i=>({data:i,error:null})}):this._returnResult({data:null,error:new Be})})}catch(r){if($(r))return this._returnResult({data:null,error:r});throw r}}async _approveAuthorization(e,r){try{return await this._useSession(async n=>{const{data:{session:s},error:i}=n;if(i)return this._returnResult({data:null,error:i});if(!s)return this._returnResult({data:null,error:new Be});const o=await q(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:s.access_token,body:{action:"approve"},xform:a=>({data:a,error:null})});return o.data&&o.data.redirect_url&&qe()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(n){if($(n))return this._returnResult({data:null,error:n});throw n}}async _denyAuthorization(e,r){try{return await this._useSession(async n=>{const{data:{session:s},error:i}=n;if(i)return this._returnResult({data:null,error:i});if(!s)return this._returnResult({data:null,error:new Be});const o=await q(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:s.access_token,body:{action:"deny"},xform:a=>({data:a,error:null})});return o.data&&o.data.redirect_url&&qe()&&!(r!=null&&r.skipBrowserRedirect)&&window.location.assign(o.data.redirect_url),o})}catch(n){if($(n))return this._returnResult({data:null,error:n});throw n}}async _listOAuthGrants(){try{return await this._useSession(async e=>{const{data:{session:r},error:n}=e;return n?this._returnResult({data:null,error:n}):r?await q(this.fetch,"GET",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:r.access_token,xform:s=>({data:s,error:null})}):this._returnResult({data:null,error:new Be})})}catch(e){if($(e))return this._returnResult({data:null,error:e});throw e}}async _revokeOAuthGrant(e){try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;return s?this._returnResult({data:null,error:s}):n?(await q(this.fetch,"DELETE",`${this.url}/user/oauth/grants`,{headers:this.headers,jwt:n.access_token,query:{client_id:e.clientId},noResolveJson:!0}),{data:{},error:null}):this._returnResult({data:null,error:new Be})})}catch(r){if($(r))return this._returnResult({data:null,error:r});throw r}}async fetchJwk(e,r={keys:[]}){let n=r.keys.find(a=>a.kid===e);if(n)return n;const s=Date.now();if(n=this.jwks.keys.find(a=>a.kid===e),n&&this.jwks_cached_at+my>s)return n;const{data:i,error:o}=await q(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(o)throw o;return!i.keys||i.keys.length===0||(this.jwks=i,this.jwks_cached_at=s,n=i.keys.find(a=>a.kid===e),!n)?null:n}async getClaims(e,r={}){try{let n=e;if(!n){const{data:f,error:p}=await this.getSession();if(p||!f.session)return this._returnResult({data:null,error:p});n=f.session.access_token}const{header:s,payload:i,signature:o,raw:{header:a,payload:l}}=fs(n);r!=null&&r.allowExpired||Uy(i.exp);const c=!s.alg||s.alg.startsWith("HS")||!s.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(s.kid,r!=null&&r.keys?{keys:r.keys}:r==null?void 0:r.jwks);if(!c){const{error:f}=await this.getUser(n);if(f)throw f;return{data:{claims:i,header:s,signature:o},error:null}}const u=By(s.alg),h=await crypto.subtle.importKey("jwk",c,u,!0,["verify"]);if(!await crypto.subtle.verify(u,h,o,Ty(`${a}.${l}`)))throw new uo("Invalid JWT signature");return{data:{claims:i,header:s,signature:o},error:null}}catch(n){if($(n))return this._returnResult({data:null,error:n});throw n}}async signInWithPasskey(e){var r,n,s;gt(this.experimental);try{if(!js())return this._returnResult({data:null,error:new yt("Browser does not support WebAuthn",null)});const{data:i,error:o}=await this._startPasskeyAuthentication({options:{captchaToken:(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.captchaToken}});if(o||!i)return this._returnResult({data:null,error:o});const a=Pl(i.options),l=(s=(n=e==null?void 0:e.options)===null||n===void 0?void 0:n.signal)!==null&&s!==void 0?s:ho.createNewAbortSignal(),{data:c,error:u}=await Ju({publicKey:a,signal:l});if(u||!c)return this._returnResult({data:null,error:u??new yt("WebAuthn ceremony failed",null)});const h=$l(c);return this._verifyPasskeyAuthentication({challengeId:i.challenge_id,credential:h})}catch(i){if($(i))return this._returnResult({data:null,error:i});throw i}}async registerPasskey(e){var r,n;gt(this.experimental);try{if(!js())return this._returnResult({data:null,error:new yt("Browser does not support WebAuthn",null)});const{data:s,error:i}=await this._startPasskeyRegistration();if(i||!s)return this._returnResult({data:null,error:i});const o=Ol(s.options),a=(n=(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.signal)!==null&&n!==void 0?n:ho.createNewAbortSignal(),{data:l,error:c}=await Gu({publicKey:o,signal:a});if(c||!l)return this._returnResult({data:null,error:c??new yt("WebAuthn ceremony failed",null)});const u=Il(l);return this._verifyPasskeyRegistration({challengeId:s.challenge_id,credential:u})}catch(s){if($(s))return this._returnResult({data:null,error:s});throw s}}async _startPasskeyRegistration(){gt(this.experimental);try{return await this._useSession(async e=>{const{data:{session:r},error:n}=e;if(n)return this._returnResult({data:null,error:n});if(!r)return this._returnResult({data:null,error:new Be});const{data:s,error:i}=await q(this.fetch,"POST",`${this.url}/passkeys/registration/options`,{headers:this.headers,jwt:r.access_token,body:{}});return i?this._returnResult({data:null,error:i}):this._returnResult({data:s,error:null})})}catch(e){if($(e))return this._returnResult({data:null,error:e});throw e}}async _verifyPasskeyRegistration(e){gt(this.experimental);try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;if(s)return this._returnResult({data:null,error:s});if(!n)return this._returnResult({data:null,error:new Be});const{data:i,error:o}=await q(this.fetch,"POST",`${this.url}/passkeys/registration/verify`,{headers:this.headers,jwt:n.access_token,body:{challenge_id:e.challengeId,credential:e.credential}});return o?this._returnResult({data:null,error:o}):this._returnResult({data:i,error:null})})}catch(r){if($(r))return this._returnResult({data:null,error:r});throw r}}async _startPasskeyAuthentication(e){var r;gt(this.experimental);try{const{data:n,error:s}=await q(this.fetch,"POST",`${this.url}/passkeys/authentication/options`,{headers:this.headers,body:{gotrue_meta_security:{captcha_token:(r=e==null?void 0:e.options)===null||r===void 0?void 0:r.captchaToken}}});return s?this._returnResult({data:null,error:s}):this._returnResult({data:n,error:null})}catch(n){if($(n))return this._returnResult({data:null,error:n});throw n}}async _verifyPasskeyAuthentication(e){gt(this.experimental);try{const{data:r,error:n}=await q(this.fetch,"POST",`${this.url}/passkeys/authentication/verify`,{headers:this.headers,body:{challenge_id:e.challengeId,credential:e.credential},xform:dt});return n?this._returnResult({data:null,error:n}):(r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),this._returnResult({data:r,error:null}))}catch(r){if($(r))return this._returnResult({data:null,error:r});throw r}}async _listPasskeys(){gt(this.experimental);try{return await this._useSession(async e=>{const{data:{session:r},error:n}=e;if(n)return this._returnResult({data:null,error:n});if(!r)return this._returnResult({data:null,error:new Be});const{data:s,error:i}=await q(this.fetch,"GET",`${this.url}/passkeys`,{headers:this.headers,jwt:r.access_token,xform:o=>({data:o,error:null})});return i?this._returnResult({data:null,error:i}):this._returnResult({data:s,error:null})})}catch(e){if($(e))return this._returnResult({data:null,error:e});throw e}}async _updatePasskey(e){gt(this.experimental);try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;if(s)return this._returnResult({data:null,error:s});if(!n)return this._returnResult({data:null,error:new Be});const{data:i,error:o}=await q(this.fetch,"PATCH",`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:n.access_token,body:{friendly_name:e.friendlyName}});return o?this._returnResult({data:null,error:o}):this._returnResult({data:i,error:null})})}catch(r){if($(r))return this._returnResult({data:null,error:r});throw r}}async _deletePasskey(e){gt(this.experimental);try{return await this._useSession(async r=>{const{data:{session:n},error:s}=r;if(s)return this._returnResult({data:null,error:s});if(!n)return this._returnResult({data:null,error:new Be});const{error:i}=await q(this.fetch,"DELETE",`${this.url}/passkeys/${e.passkeyId}`,{headers:this.headers,jwt:n.access_token,noResolveJson:!0});return i?this._returnResult({data:null,error:i}):this._returnResult({data:null,error:null})})}catch(r){if($(r))return this._returnResult({data:null,error:r});throw r}}}Gn.nextInstanceID={};const cv=Gn,uv="2.106.2";let wn="";typeof Deno<"u"?wn="deno":typeof document<"u"?wn="web":typeof navigator<"u"&&navigator.product==="ReactNative"?wn="react-native":wn="node";const hv={"X-Client-Info":`supabase-js-${wn}/${uv}`},dv={headers:hv},fv={schema:"public"},pv={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},gv={},mv={enabled:!1,respectSamplingDecision:!0};function yv(t,e,r,n){function s(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function a(u){try{c(n.next(u))}catch(h){o(h)}}function l(u){try{c(n.throw(u))}catch(h){o(h)}}function c(u){u.done?i(u.value):s(u.value).then(a,l)}c((n=n.apply(t,[])).next())})}let Ii=null;const vv="@opentelemetry/api";function bv(){return Ii===null&&(Ii=import(vv).catch(()=>null)),Ii}function _v(){return yv(this,void 0,void 0,function*(){try{const t=yield bv();if(!t||!t.propagation||!t.context)return null;const e={};t.propagation.inject(t.context.active(),e);const r=e.traceparent;return r?{traceparent:r,tracestate:e.tracestate,baggage:e.baggage}:null}catch{return null}})}function wv(t){if(!t||typeof t!="string")return null;const e=t.split("-");if(e.length!==4)return null;const[r,n,s,i]=e;if(r.length!==2||n.length!==32||s.length!==16||i.length!==2)return null;const o=/^[0-9a-f]+$/i;return!o.test(r)||!o.test(n)||!o.test(s)||!o.test(i)||n==="00000000000000000000000000000000"||s==="0000000000000000"?null:{version:r,traceId:n,parentId:s,traceFlags:i,isSampled:(parseInt(i,16)&1)===1}}function kv(t,e){if(!t||!e||e.length===0)return!1;let r;if(t instanceof URL)r=t;else try{r=new URL(t)}catch{return!1}for(const n of e)try{if(typeof n=="string"){if(Sv(r.hostname,n))return!0}else if(n instanceof RegExp){if(n.test(r.hostname))return!0}else if(typeof n=="function"&&n(r))return!0}catch{continue}return!1}function Sv(t,e){if(e===t)return!0;if(e.startsWith("*.")){const r=e.slice(2);if(t.endsWith(r)&&(t===r||t.endsWith("."+r)))return!0}return!1}function Ev(t){const e=[];try{const r=new URL(t);e.push(r.hostname)}catch{}return e.push("*.supabase.co","*.supabase.in"),e.push("localhost","127.0.0.1","[::1]"),e}function Jn(t){"@babel/helpers - typeof";return Jn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Jn(t)}function Tv(t,e){if(Jn(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(Jn(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Av(t){var e=Tv(t,"string");return Jn(e)=="symbol"?e:e+""}function xv(t,e,r){return(e=Av(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Nl(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),r.push.apply(r,n)}return r}function Re(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Nl(Object(r),!0).forEach(function(n){xv(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Nl(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}const Rv=t=>t?(...e)=>t(...e):(...e)=>fetch(...e),Cv=()=>Headers,Ov=(t,e,r,n,s)=>{const i=Rv(n),o=Cv(),a=(s==null?void 0:s.enabled)===!0,l=(s==null?void 0:s.respectSamplingDecision)!==!1,c=a?Ev(e):null;return async(u,h)=>{var d;const f=(d=await r())!==null&&d!==void 0?d:t;let p=new o(h==null?void 0:h.headers);if(p.has("apikey")||p.set("apikey",t),p.has("Authorization")||p.set("Authorization",`Bearer ${f}`),c){const y=await Pv(u,c,l);y&&(y.traceparent&&!p.has("traceparent")&&p.set("traceparent",y.traceparent),y.tracestate&&!p.has("tracestate")&&p.set("tracestate",y.tracestate),y.baggage&&!p.has("baggage")&&p.set("baggage",y.baggage))}return i(u,Re(Re({},h),{},{headers:p}))}};async function Pv(t,e,r){if(!kv(typeof t=="string"||t instanceof URL?t:t.url,e))return null;const n=await _v();if(!n||!n.traceparent)return null;if(r){const s=wv(n.traceparent);if(s&&!s.isSampled)return null}return n}function Ll(t){return typeof t=="boolean"?{enabled:t}:t}function Iv(t){return t.endsWith("/")?t:t+"/"}function $v(t,e){var r,n,s,i,o,a;const{db:l,auth:c,realtime:u,global:h}=t,{db:d,auth:f,realtime:p,global:y}=e,w=Ll(t.tracePropagation),k=Ll(e.tracePropagation),_={db:Re(Re({},d),l),auth:Re(Re({},f),c),realtime:Re(Re({},p),u),storage:{},global:Re(Re(Re({},y),h),{},{headers:Re(Re({},(r=y==null?void 0:y.headers)!==null&&r!==void 0?r:{}),(n=h==null?void 0:h.headers)!==null&&n!==void 0?n:{})}),tracePropagation:{enabled:(s=(i=w==null?void 0:w.enabled)!==null&&i!==void 0?i:k==null?void 0:k.enabled)!==null&&s!==void 0?s:!1,respectSamplingDecision:(o=(a=w==null?void 0:w.respectSamplingDecision)!==null&&a!==void 0?a:k==null?void 0:k.respectSamplingDecision)!==null&&o!==void 0?o:!0},accessToken:async()=>""};return t.accessToken?_.accessToken=t.accessToken:delete _.accessToken,_}function jv(t){const e=t==null?void 0:t.trim();if(!e)throw new Error("supabaseUrl is required.");if(!e.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(Iv(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}var Nv=class extends cv{constructor(t){super(t)}},Lv=class{constructor(t,e,r){var n,s;this.supabaseUrl=t,this.supabaseKey=e;const i=jv(t);if(!e)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",i),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",i),this.storageUrl=new URL("storage/v1",i),this.functionsUrl=new URL("functions/v1",i);const o=`sb-${i.hostname.split(".")[0]}-auth-token`,a={db:fv,realtime:gv,auth:Re(Re({},pv),{},{storageKey:o}),global:dv,tracePropagation:mv},l=$v(r??{},a);if(this.settings=l,this.storageKey=(n=l.auth.storageKey)!==null&&n!==void 0?n:"",this.headers=(s=l.global.headers)!==null&&s!==void 0?s:{},l.accessToken)this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(u,h)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(h)} is not possible`)}});else{var c;this.auth=this._initSupabaseAuthClient((c=l.auth)!==null&&c!==void 0?c:{},this.headers,l.global.fetch)}this.fetch=Ov(e,t,this._getAccessToken.bind(this),l.global.fetch,l.tracePropagation),this.realtime=this._initRealtimeClient(Re({headers:this.headers,accessToken:this._getAccessToken.bind(this),fetch:this.fetch},l.realtime)),this.accessToken&&Promise.resolve(this.accessToken()).then(u=>this.realtime.setAuth(u)).catch(u=>console.warn("Failed to set initial Realtime auth token:",u)),this.rest=new Zg(new URL("rest/v1",i).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch,timeout:l.db.timeout,urlLengthLimit:l.db.urlLengthLimit}),this.storage=new hy(this.storageUrl.href,this.headers,this.fetch,r==null?void 0:r.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new qg(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(t){return this.rest.from(t)}schema(t){return this.rest.schema(t)}rpc(t,e={},r={head:!1,get:!1,count:void 0}){return this.rest.rpc(t,e,r)}channel(t,e={config:{}}){return this.realtime.channel(t,e)}getChannels(){return this.realtime.getChannels()}removeChannel(t){return this.realtime.removeChannel(t)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var t=this,e,r;if(t.accessToken)return await t.accessToken();const{data:n}=await t.auth.getSession();return(e=(r=n.session)===null||r===void 0?void 0:r.access_token)!==null&&e!==void 0?e:t.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:t,persistSession:e,detectSessionInUrl:r,storage:n,userStorage:s,storageKey:i,flowType:o,lock:a,debug:l,throwOnError:c,experimental:u,lockAcquireTimeout:h,skipAutoInitialize:d},f,p){const y={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new Nv({url:this.authUrl.href,headers:Re(Re({},y),f),storageKey:i,autoRefreshToken:t,persistSession:e,detectSessionInUrl:r,storage:n,userStorage:s,flowType:o,lock:a,debug:l,throwOnError:c,experimental:u,fetch:p,lockAcquireTimeout:h,skipAutoInitialize:d,hasCustomAuthorizationHeader:Object.keys(this.headers).some(w=>w.toLowerCase()==="authorization")})}_initRealtimeClient(t){return new jm(this.realtimeUrl.href,Re(Re({},t),{},{params:Re(Re({},{apikey:this.supabaseKey}),t==null?void 0:t.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((t,e)=>{this._handleTokenChanged(t,"CLIENT",e==null?void 0:e.access_token)})}_handleTokenChanged(t,e,r){(t==="TOKEN_REFRESHED"||t==="SIGNED_IN")&&this.changedAccessToken!==r?(this.changedAccessToken=r,this.realtime.setAuth(r)):t==="SIGNED_OUT"&&(this.realtime.setAuth(),e=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}};const Dv=(t,e,r)=>new Lv(t,e,r);function Uv(){if(typeof window<"u")return!1;const t=globalThis.process;if(!t)return!1;const e=t.version;if(e==null)return!1;const r=e.match(/^v(\d+)\./);return r?parseInt(r[1],10)<=18:!1}Uv()&&console.warn("⚠️ Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");let Yu=null,Dl=!1;async function Bv(){if(!Dl){Dl=!0;try{const t=await fetch("/api/auth/config");if(!t.ok)return;const{supabaseUrl:e,supabaseAnonKey:r}=await t.json();e&&r&&(Yu=Dv(e,r))}catch{}}}function ps(){return Yu}const ln=du("auth",()=>{const t=Oe(localStorage.getItem("io_token")),e=Oe(localStorage.getItem("io_email")),r=Oe(!1);let n=null;const s=je(()=>!!t.value);function i(h,d=3e5){try{return JSON.parse(atob(h.split(".")[1])).exp*1e3<=Date.now()+d}catch{return!0}}function o(){const h=ps();h&&(h.auth.onAuthStateChange((d,f)=>{var p,y;f?(t.value=f.access_token,e.value=((p=f.user)==null?void 0:p.email)??null,localStorage.setItem("io_token",f.access_token),(y=f.user)!=null&&y.email&&localStorage.setItem("io_email",f.user.email)):(t.value=null,e.value=null,localStorage.removeItem("io_token"),localStorage.removeItem("io_email"))}),a())}function a(){n||(n=setInterval(async()=>{t.value&&i(t.value)&&await u()},300*1e3))}async function l(h,d){var p,y;const f=ps();if(!f)throw new Error("Auth not configured");r.value=!0;try{const{data:w,error:k}=await f.auth.signInWithPassword({email:h,password:d});if(k)throw k;t.value=((p=w.session)==null?void 0:p.access_token)??null,e.value=((y=w.user)==null?void 0:y.email)??null,t.value&&localStorage.setItem("io_token",t.value),e.value&&localStorage.setItem("io_email",e.value)}finally{r.value=!1}}async function c(){const h=ps();h&&await h.auth.signOut(),t.value=null,e.value=null,localStorage.removeItem("io_token"),localStorage.removeItem("io_email"),n&&(clearInterval(n),n=null)}async function u(){const h=ps();if(!h)return;const{data:d,error:f}=await h.auth.refreshSession();if(!f&&d.session){t.value=d.session.access_token,localStorage.setItem("io_token",d.session.access_token);return}const{data:p}=await h.auth.getSession();if(p.session){t.value=p.session.access_token,localStorage.setItem("io_token",p.session.access_token);return}t.value=null,localStorage.removeItem("io_token")}return{token:t,email:e,loading:r,isAuthenticated:s,login:l,logout:c,refreshToken:u,initAuthListener:o}}),Mv=Object.freeze(Object.defineProperty({__proto__:null,useAuthStore:ln},Symbol.toStringTag,{value:"Module"})),Hv={class:"h-12 border-b border-border bg-header flex items-center justify-between px-4 shrink-0"},qv={class:"flex items-center gap-2"},Fv={class:"w-7 h-7 rounded-full bg-secondary flex items-center justify-center",title:"User"},Vv=pr({__name:"AppHeader",setup(t){const e=ln(),r=ag();async function n(){await e.logout(),r.push("/login")}return(s,i)=>{const o=Zs("router-link");return Z(),ue("header",Hv,[i[0]||(i[0]=ne("div",null,null,-1)),ne("div",qv,[he(o,{to:"/feed",class:"p-2 rounded-md hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",title:"Inbox"},{default:Yr(()=>[he(re(Au),{class:"w-4 h-4"})]),_:1}),ne("div",Fv,[he(re(Cg),{class:"w-3.5 h-3.5 text-muted-foreground"})]),ne("button",{onClick:n,class:"p-2 rounded-md hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",title:"Sign out"},[he(re(bg),{class:"w-4 h-4"})])])])}}}),zv=5e3;function Wv(t){try{return JSON.parse(atob(t.split(".")[1])).exp*1e3<=Date.now()+6e4}catch{return!0}}const Kv=du("chat",()=>{const t=Oe([]),e=Oe(!1),r=Oe(null),n=Oe(crypto.randomUUID()),s=Oe(null);function i(u,h=[]){const d={id:crypto.randomUUID(),role:"user",content:u,attachments:h,timestamp:new Date};return t.value.push(d),d}async function o(u,h=[]){i(u,h),e.value=!0;const d={id:crypto.randomUUID(),role:"assistant",content:"",attachments:[],timestamp:new Date,streaming:!0};t.value.push(d);let f=Date.now();try{const p=ln();p.token&&Wv(p.token)&&await p.refreshToken();const y={"Content-Type":"application/json"};p.token&&(y.Authorization=`Bearer ${p.token}`),s.value=new AbortController;const w=await fetch("/api/message",{method:"POST",headers:y,signal:s.value.signal,body:JSON.stringify({prompt:u,conversationId:n.value,attachments:h})});if(!w.ok||!w.body)throw new Error(`API error: ${w.status}`);const k=w.body.getReader(),_=new TextDecoder;let b="";for(;;){const{done:x,value:D}=await k.read();if(x)break;b+=_.decode(D,{stream:!0});const M=b.split(`
|
|
214
|
-
`);b=M.pop()??"";let U="";for(const V of M)if(V.startsWith("event: "))U=V.slice(7);else if(V.startsWith("data: ")){const C=V.slice(6);try{const z=JSON.parse(C);if(U==="delta"){const Q=Date.now(),O=t.value[t.value.length-1];if(O&&!O.streaming&&O.role==="assistant"&&Q-f>zv){const Y={id:crypto.randomUUID(),role:"assistant",content:z.content,attachments:[],timestamp:new Date,streaming:!0};t.value.push(Y)}else{const Y=t.value.filter(Ne=>Ne.streaming),Ee=Y[Y.length-1];Ee&&(Ee.content=z.content)}f=Q}else if(U==="done"){const Q=t.value.filter(Y=>Y.streaming),O=Q[Q.length-1];O&&(O.content=z.content,O.streaming=!1),z.conversationId&&(n.value=z.conversationId)}else if(U==="error"){const Q=t.value.filter(Y=>Y.streaming),O=Q[Q.length-1];O&&(O.content=`Error: ${z.error}`,O.streaming=!1)}}catch{}U=""}else V.startsWith(":")}}catch(p){const y=t.value.filter(k=>k.streaming),w=y[y.length-1];w&&((p==null?void 0:p.name)==="AbortError"||(w.content=`Error: ${p.message}`),w.streaming=!1)}finally{s.value=null,e.value=!1}}function a(){var u;(u=s.value)==null||u.abort()}function l(u){const h=t.value[t.value.length-1];h!=null&&h.streaming&&(h.content=u)}function c(){t.value=[],n.value=crypto.randomUUID()}return{messages:t,isStreaming:e,eventSource:r,conversationId:n,sendMessage:o,updateStreamingMessage:l,clearMessages:c,stopStreaming:a}});function Do(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Or=Do();function Xu(t){Or=t}var jn={exec:()=>null};function me(t,e=""){let r=typeof t=="string"?t:t.source;const n={replace:(s,i)=>{let o=typeof i=="string"?i:i.source;return o=o.replace(Qe.caret,"$1"),r=r.replace(s,o),n},getRegex:()=>new RegExp(r,e)};return n}var Qe={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},Gv=/^(?:[ \t]*(?:\n|$))+/,Jv=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Yv=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,ts=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Xv=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Uo=/(?:[*+-]|\d{1,9}[.)])/,Zu=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Qu=me(Zu).replace(/bull/g,Uo).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Zv=me(Zu).replace(/bull/g,Uo).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Bo=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Qv=/^[^\n]+/,Mo=/(?!\s*\])(?:\\.|[^\[\]\\])+/,eb=me(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Mo).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),tb=me(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Uo).getRegex(),ci="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Ho=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,rb=me("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Ho).replace("tag",ci).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),eh=me(Bo).replace("hr",ts).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ci).getRegex(),nb=me(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",eh).getRegex(),qo={blockquote:nb,code:Jv,def:eb,fences:Yv,heading:Xv,hr:ts,html:rb,lheading:Qu,list:tb,newline:Gv,paragraph:eh,table:jn,text:Qv},Ul=me("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",ts).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ci).getRegex(),sb={...qo,lheading:Zv,table:Ul,paragraph:me(Bo).replace("hr",ts).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Ul).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ci).getRegex()},ib={...qo,html:me(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Ho).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:jn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:me(Bo).replace("hr",ts).replace("heading",` *#{1,6} *[^
|
|
215
|
-
]`).replace("lheading",Qu).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},ob=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,ab=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,th=/^( {2,}|\\)\n(?!\s*$)/,lb=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ui=/[\p{P}\p{S}]/u,Fo=/[\s\p{P}\p{S}]/u,rh=/[^\s\p{P}\p{S}]/u,cb=me(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Fo).getRegex(),nh=/(?!~)[\p{P}\p{S}]/u,ub=/(?!~)[\s\p{P}\p{S}]/u,hb=/(?:[^\s\p{P}\p{S}]|~)/u,db=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,sh=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,fb=me(sh,"u").replace(/punct/g,ui).getRegex(),pb=me(sh,"u").replace(/punct/g,nh).getRegex(),ih="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",gb=me(ih,"gu").replace(/notPunctSpace/g,rh).replace(/punctSpace/g,Fo).replace(/punct/g,ui).getRegex(),mb=me(ih,"gu").replace(/notPunctSpace/g,hb).replace(/punctSpace/g,ub).replace(/punct/g,nh).getRegex(),yb=me("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,rh).replace(/punctSpace/g,Fo).replace(/punct/g,ui).getRegex(),vb=me(/\\(punct)/,"gu").replace(/punct/g,ui).getRegex(),bb=me(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),_b=me(Ho).replace("(?:-->|$)","-->").getRegex(),wb=me("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",_b).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Ls=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,kb=me(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Ls).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),oh=me(/^!?\[(label)\]\[(ref)\]/).replace("label",Ls).replace("ref",Mo).getRegex(),ah=me(/^!?\[(ref)\](?:\[\])?/).replace("ref",Mo).getRegex(),Sb=me("reflink|nolink(?!\\()","g").replace("reflink",oh).replace("nolink",ah).getRegex(),Vo={_backpedal:jn,anyPunctuation:vb,autolink:bb,blockSkip:db,br:th,code:ab,del:jn,emStrongLDelim:fb,emStrongRDelimAst:gb,emStrongRDelimUnd:yb,escape:ob,link:kb,nolink:ah,punctuation:cb,reflink:oh,reflinkSearch:Sb,tag:wb,text:lb,url:jn},Eb={...Vo,link:me(/^!?\[(label)\]\((.*?)\)/).replace("label",Ls).getRegex(),reflink:me(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Ls).getRegex()},fo={...Vo,emStrongRDelimAst:mb,emStrongLDelim:pb,url:me(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},Tb={...fo,br:me(th).replace("{2,}","*").getRegex(),text:me(fo.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},gs={normal:qo,gfm:sb,pedantic:ib},gn={normal:Vo,gfm:fo,breaks:Tb,pedantic:Eb},Ab={"&":"&","<":"<",">":">",'"':""","'":"'"},Bl=t=>Ab[t];function xt(t,e){if(e){if(Qe.escapeTest.test(t))return t.replace(Qe.escapeReplace,Bl)}else if(Qe.escapeTestNoEncode.test(t))return t.replace(Qe.escapeReplaceNoEncode,Bl);return t}function Ml(t){try{t=encodeURI(t).replace(Qe.percentDecode,"%")}catch{return null}return t}function Hl(t,e){var i;const r=t.replace(Qe.findPipe,(o,a,l)=>{let c=!1,u=a;for(;--u>=0&&l[u]==="\\";)c=!c;return c?"|":" |"}),n=r.split(Qe.splitPipe);let s=0;if(n[0].trim()||n.shift(),n.length>0&&!((i=n.at(-1))!=null&&i.trim())&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;s<n.length;s++)n[s]=n[s].trim().replace(Qe.slashPipe,"|");return n}function mn(t,e,r){const n=t.length;if(n===0)return"";let s=0;for(;s<n&&t.charAt(n-s-1)===e;)s++;return t.slice(0,n-s)}function xb(t,e){if(t.indexOf(e[1])===-1)return-1;let r=0;for(let n=0;n<t.length;n++)if(t[n]==="\\")n++;else if(t[n]===e[0])r++;else if(t[n]===e[1]&&(r--,r<0))return n;return r>0?-2:-1}function ql(t,e,r,n,s){const i=e.href,o=e.title||null,a=t[1].replace(s.other.outputLinkReplace,"$1");n.state.inLink=!0;const l={type:t[0].charAt(0)==="!"?"image":"link",raw:r,href:i,title:o,text:a,tokens:n.inlineTokens(a)};return n.state.inLink=!1,l}function Rb(t,e,r){const n=t.match(r.other.indentCodeCompensation);if(n===null)return e;const s=n[1];return e.split(`
|
|
216
|
-
`).map(i=>{const o=i.match(r.other.beginningSpace);if(o===null)return i;const[a]=o;return a.length>=s.length?i.slice(s.length):i}).join(`
|
|
217
|
-
`)}var Ds=class{constructor(t){be(this,"options");be(this,"rules");be(this,"lexer");this.options=t||Or}space(t){const e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){const e=this.rules.block.code.exec(t);if(e){const r=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?r:mn(r,`
|
|
218
|
-
`)}}}fences(t){const e=this.rules.block.fences.exec(t);if(e){const r=e[0],n=Rb(r,e[3]||"",this.rules);return{type:"code",raw:r,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:n}}}heading(t){const e=this.rules.block.heading.exec(t);if(e){let r=e[2].trim();if(this.rules.other.endingHash.test(r)){const n=mn(r,"#");(this.options.pedantic||!n||this.rules.other.endingSpaceChar.test(n))&&(r=n.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(t){const e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:mn(e[0],`
|
|
219
|
-
`)}}blockquote(t){const e=this.rules.block.blockquote.exec(t);if(e){let r=mn(e[0],`
|
|
220
|
-
`).split(`
|
|
221
|
-
`),n="",s="";const i=[];for(;r.length>0;){let o=!1;const a=[];let l;for(l=0;l<r.length;l++)if(this.rules.other.blockquoteStart.test(r[l]))a.push(r[l]),o=!0;else if(!o)a.push(r[l]);else break;r=r.slice(l);const c=a.join(`
|
|
222
|
-
`),u=c.replace(this.rules.other.blockquoteSetextReplace,`
|
|
223
|
-
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");n=n?`${n}
|
|
224
|
-
${c}`:c,s=s?`${s}
|
|
225
|
-
${u}`:u;const h=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(u,i,!0),this.lexer.state.top=h,r.length===0)break;const d=i.at(-1);if((d==null?void 0:d.type)==="code")break;if((d==null?void 0:d.type)==="blockquote"){const f=d,p=f.raw+`
|
|
226
|
-
`+r.join(`
|
|
227
|
-
`),y=this.blockquote(p);i[i.length-1]=y,n=n.substring(0,n.length-f.raw.length)+y.raw,s=s.substring(0,s.length-f.text.length)+y.text;break}else if((d==null?void 0:d.type)==="list"){const f=d,p=f.raw+`
|
|
228
|
-
`+r.join(`
|
|
229
|
-
`),y=this.list(p);i[i.length-1]=y,n=n.substring(0,n.length-d.raw.length)+y.raw,s=s.substring(0,s.length-f.raw.length)+y.raw,r=p.substring(i.at(-1).raw.length).split(`
|
|
230
|
-
`);continue}}return{type:"blockquote",raw:n,tokens:i,text:s}}}list(t){let e=this.rules.block.list.exec(t);if(e){let r=e[1].trim();const n=r.length>1,s={type:"list",raw:"",ordered:n,start:n?+r.slice(0,-1):"",loose:!1,items:[]};r=n?`\\d{1,9}\\${r.slice(-1)}`:`\\${r}`,this.options.pedantic&&(r=n?r:"[*+-]");const i=this.rules.other.listItemRegex(r);let o=!1;for(;t;){let l=!1,c="",u="";if(!(e=i.exec(t))||this.rules.block.hr.test(t))break;c=e[0],t=t.substring(c.length);let h=e[2].split(`
|
|
231
|
-
`,1)[0].replace(this.rules.other.listReplaceTabs,k=>" ".repeat(3*k.length)),d=t.split(`
|
|
232
|
-
`,1)[0],f=!h.trim(),p=0;if(this.options.pedantic?(p=2,u=h.trimStart()):f?p=e[1].length+1:(p=e[2].search(this.rules.other.nonSpaceChar),p=p>4?1:p,u=h.slice(p),p+=e[1].length),f&&this.rules.other.blankLine.test(d)&&(c+=d+`
|
|
233
|
-
`,t=t.substring(d.length+1),l=!0),!l){const k=this.rules.other.nextBulletRegex(p),_=this.rules.other.hrRegex(p),b=this.rules.other.fencesBeginRegex(p),x=this.rules.other.headingBeginRegex(p),D=this.rules.other.htmlBeginRegex(p);for(;t;){const M=t.split(`
|
|
234
|
-
`,1)[0];let U;if(d=M,this.options.pedantic?(d=d.replace(this.rules.other.listReplaceNesting," "),U=d):U=d.replace(this.rules.other.tabCharGlobal," "),b.test(d)||x.test(d)||D.test(d)||k.test(d)||_.test(d))break;if(U.search(this.rules.other.nonSpaceChar)>=p||!d.trim())u+=`
|
|
235
|
-
`+U.slice(p);else{if(f||h.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||b.test(h)||x.test(h)||_.test(h))break;u+=`
|
|
236
|
-
`+d}!f&&!d.trim()&&(f=!0),c+=M+`
|
|
237
|
-
`,t=t.substring(M.length+1),h=U.slice(p)}}s.loose||(o?s.loose=!0:this.rules.other.doubleBlankLine.test(c)&&(o=!0));let y=null,w;this.options.gfm&&(y=this.rules.other.listIsTask.exec(u),y&&(w=y[0]!=="[ ] ",u=u.replace(this.rules.other.listReplaceTask,""))),s.items.push({type:"list_item",raw:c,task:!!y,checked:w,loose:!1,text:u,tokens:[]}),s.raw+=c}const a=s.items.at(-1);if(a)a.raw=a.raw.trimEnd(),a.text=a.text.trimEnd();else return;s.raw=s.raw.trimEnd();for(let l=0;l<s.items.length;l++)if(this.lexer.state.top=!1,s.items[l].tokens=this.lexer.blockTokens(s.items[l].text,[]),!s.loose){const c=s.items[l].tokens.filter(h=>h.type==="space"),u=c.length>0&&c.some(h=>this.rules.other.anyLine.test(h.raw));s.loose=u}if(s.loose)for(let l=0;l<s.items.length;l++)s.items[l].loose=!0;return s}}html(t){const e=this.rules.block.html.exec(t);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(t){const e=this.rules.block.def.exec(t);if(e){const r=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),n=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:r,raw:e[0],href:n,title:s}}}table(t){var o;const e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;const r=Hl(e[1]),n=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=(o=e[3])!=null&&o.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
238
|
-
`):[],i={type:"table",raw:e[0],header:[],align:[],rows:[]};if(r.length===n.length){for(const a of n)this.rules.other.tableAlignRight.test(a)?i.align.push("right"):this.rules.other.tableAlignCenter.test(a)?i.align.push("center"):this.rules.other.tableAlignLeft.test(a)?i.align.push("left"):i.align.push(null);for(let a=0;a<r.length;a++)i.header.push({text:r[a],tokens:this.lexer.inline(r[a]),header:!0,align:i.align[a]});for(const a of s)i.rows.push(Hl(a,i.header.length).map((l,c)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:i.align[c]})));return i}}lheading(t){const e=this.rules.block.lheading.exec(t);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(t){const e=this.rules.block.paragraph.exec(t);if(e){const r=e[1].charAt(e[1].length-1)===`
|
|
239
|
-
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:r,tokens:this.lexer.inline(r)}}}text(t){const e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){const e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){const e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){const e=this.rules.inline.link.exec(t);if(e){const r=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;const i=mn(r.slice(0,-1),"\\");if((r.length-i.length)%2===0)return}else{const i=xb(e[2],"()");if(i===-2)return;if(i>-1){const a=(e[0].indexOf("!")===0?5:4)+e[1].length+i;e[2]=e[2].substring(0,i),e[0]=e[0].substring(0,a).trim(),e[3]=""}}let n=e[2],s="";if(this.options.pedantic){const i=this.rules.other.pedanticHrefTitle.exec(n);i&&(n=i[1],s=i[3])}else s=e[3]?e[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?n=n.slice(1):n=n.slice(1,-1)),ql(e,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let r;if((r=this.rules.inline.reflink.exec(t))||(r=this.rules.inline.nolink.exec(t))){const n=(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=e[n.toLowerCase()];if(!s){const i=r[0].charAt(0);return{type:"text",raw:i,text:i}}return ql(r,s,r[0],this.lexer,this.rules)}}emStrong(t,e,r=""){let n=this.rules.inline.emStrongLDelim.exec(t);if(!n||n[3]&&r.match(this.rules.other.unicodeAlphaNumeric))return;if(!(n[1]||n[2]||"")||!r||this.rules.inline.punctuation.exec(r)){const i=[...n[0]].length-1;let o,a,l=i,c=0;const u=n[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,e=e.slice(-1*t.length+i);(n=u.exec(e))!=null;){if(o=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!o)continue;if(a=[...o].length,n[3]||n[4]){l+=a;continue}else if((n[5]||n[6])&&i%3&&!((i+a)%3)){c+=a;continue}if(l-=a,l>0)continue;a=Math.min(a,a+l+c);const h=[...n[0]][0].length,d=t.slice(0,i+n.index+h+a);if(Math.min(i,a)%2){const p=d.slice(1,-1);return{type:"em",raw:d,text:p,tokens:this.lexer.inlineTokens(p)}}const f=d.slice(2,-2);return{type:"strong",raw:d,text:f,tokens:this.lexer.inlineTokens(f)}}}}codespan(t){const e=this.rules.inline.code.exec(t);if(e){let r=e[2].replace(this.rules.other.newLineCharGlobal," ");const n=this.rules.other.nonSpaceChar.test(r),s=this.rules.other.startingSpaceChar.test(r)&&this.rules.other.endingSpaceChar.test(r);return n&&s&&(r=r.substring(1,r.length-1)),{type:"codespan",raw:e[0],text:r}}}br(t){const e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t){const e=this.rules.inline.del.exec(t);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(t){const e=this.rules.inline.autolink.exec(t);if(e){let r,n;return e[2]==="@"?(r=e[1],n="mailto:"+r):(r=e[1],n=r),{type:"link",raw:e[0],text:r,href:n,tokens:[{type:"text",raw:r,text:r}]}}}url(t){var r;let e;if(e=this.rules.inline.url.exec(t)){let n,s;if(e[2]==="@")n=e[0],s="mailto:"+n;else{let i;do i=e[0],e[0]=((r=this.rules.inline._backpedal.exec(e[0]))==null?void 0:r[0])??"";while(i!==e[0]);n=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(t){const e=this.rules.inline.text.exec(t);if(e){const r=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:r}}}},Gt=class po{constructor(e){be(this,"tokens");be(this,"options");be(this,"state");be(this,"tokenizer");be(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Or,this.options.tokenizer=this.options.tokenizer||new Ds,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const r={other:Qe,block:gs.normal,inline:gn.normal};this.options.pedantic?(r.block=gs.pedantic,r.inline=gn.pedantic):this.options.gfm&&(r.block=gs.gfm,this.options.breaks?r.inline=gn.breaks:r.inline=gn.gfm),this.tokenizer.rules=r}static get rules(){return{block:gs,inline:gn}}static lex(e,r){return new po(r).lex(e)}static lexInline(e,r){return new po(r).inlineTokens(e)}lex(e){e=e.replace(Qe.carriageReturn,`
|
|
240
|
-
`),this.blockTokens(e,this.tokens);for(let r=0;r<this.inlineQueue.length;r++){const n=this.inlineQueue[r];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,r=[],n=!1){var s,i,o;for(this.options.pedantic&&(e=e.replace(Qe.tabCharGlobal," ").replace(Qe.spaceLine,""));e;){let a;if((i=(s=this.options.extensions)==null?void 0:s.block)!=null&&i.some(c=>(a=c.call({lexer:this},e,r))?(e=e.substring(a.raw.length),r.push(a),!0):!1))continue;if(a=this.tokenizer.space(e)){e=e.substring(a.raw.length);const c=r.at(-1);a.raw.length===1&&c!==void 0?c.raw+=`
|
|
241
|
-
`:r.push(a);continue}if(a=this.tokenizer.code(e)){e=e.substring(a.raw.length);const c=r.at(-1);(c==null?void 0:c.type)==="paragraph"||(c==null?void 0:c.type)==="text"?(c.raw+=`
|
|
242
|
-
`+a.raw,c.text+=`
|
|
243
|
-
`+a.text,this.inlineQueue.at(-1).src=c.text):r.push(a);continue}if(a=this.tokenizer.fences(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.heading(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.hr(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.blockquote(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.list(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.html(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.def(e)){e=e.substring(a.raw.length);const c=r.at(-1);(c==null?void 0:c.type)==="paragraph"||(c==null?void 0:c.type)==="text"?(c.raw+=`
|
|
244
|
-
`+a.raw,c.text+=`
|
|
245
|
-
`+a.raw,this.inlineQueue.at(-1).src=c.text):this.tokens.links[a.tag]||(this.tokens.links[a.tag]={href:a.href,title:a.title});continue}if(a=this.tokenizer.table(e)){e=e.substring(a.raw.length),r.push(a);continue}if(a=this.tokenizer.lheading(e)){e=e.substring(a.raw.length),r.push(a);continue}let l=e;if((o=this.options.extensions)!=null&&o.startBlock){let c=1/0;const u=e.slice(1);let h;this.options.extensions.startBlock.forEach(d=>{h=d.call({lexer:this},u),typeof h=="number"&&h>=0&&(c=Math.min(c,h))}),c<1/0&&c>=0&&(l=e.substring(0,c+1))}if(this.state.top&&(a=this.tokenizer.paragraph(l))){const c=r.at(-1);n&&(c==null?void 0:c.type)==="paragraph"?(c.raw+=`
|
|
246
|
-
`+a.raw,c.text+=`
|
|
247
|
-
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):r.push(a),n=l.length!==e.length,e=e.substring(a.raw.length);continue}if(a=this.tokenizer.text(e)){e=e.substring(a.raw.length);const c=r.at(-1);(c==null?void 0:c.type)==="text"?(c.raw+=`
|
|
248
|
-
`+a.raw,c.text+=`
|
|
249
|
-
`+a.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):r.push(a);continue}if(e){const c="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return this.state.top=!0,r}inline(e,r=[]){return this.inlineQueue.push({src:e,tokens:r}),r}inlineTokens(e,r=[]){var a,l,c;let n=e,s=null;if(this.tokens.links){const u=Object.keys(this.tokens.links);if(u.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)u.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,s.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(s=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)n=n.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let i=!1,o="";for(;e;){i||(o=""),i=!1;let u;if((l=(a=this.options.extensions)==null?void 0:a.inline)!=null&&l.some(d=>(u=d.call({lexer:this},e,r))?(e=e.substring(u.raw.length),r.push(u),!0):!1))continue;if(u=this.tokenizer.escape(e)){e=e.substring(u.raw.length),r.push(u);continue}if(u=this.tokenizer.tag(e)){e=e.substring(u.raw.length),r.push(u);continue}if(u=this.tokenizer.link(e)){e=e.substring(u.raw.length),r.push(u);continue}if(u=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(u.raw.length);const d=r.at(-1);u.type==="text"&&(d==null?void 0:d.type)==="text"?(d.raw+=u.raw,d.text+=u.text):r.push(u);continue}if(u=this.tokenizer.emStrong(e,n,o)){e=e.substring(u.raw.length),r.push(u);continue}if(u=this.tokenizer.codespan(e)){e=e.substring(u.raw.length),r.push(u);continue}if(u=this.tokenizer.br(e)){e=e.substring(u.raw.length),r.push(u);continue}if(u=this.tokenizer.del(e)){e=e.substring(u.raw.length),r.push(u);continue}if(u=this.tokenizer.autolink(e)){e=e.substring(u.raw.length),r.push(u);continue}if(!this.state.inLink&&(u=this.tokenizer.url(e))){e=e.substring(u.raw.length),r.push(u);continue}let h=e;if((c=this.options.extensions)!=null&&c.startInline){let d=1/0;const f=e.slice(1);let p;this.options.extensions.startInline.forEach(y=>{p=y.call({lexer:this},f),typeof p=="number"&&p>=0&&(d=Math.min(d,p))}),d<1/0&&d>=0&&(h=e.substring(0,d+1))}if(u=this.tokenizer.inlineText(h)){e=e.substring(u.raw.length),u.raw.slice(-1)!=="_"&&(o=u.raw.slice(-1)),i=!0;const d=r.at(-1);(d==null?void 0:d.type)==="text"?(d.raw+=u.raw,d.text+=u.text):r.push(u);continue}if(e){const d="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(d);break}else throw new Error(d)}}return r}},Us=class{constructor(t){be(this,"options");be(this,"parser");this.options=t||Or}space(t){return""}code({text:t,lang:e,escaped:r}){var i;const n=(i=(e||"").match(Qe.notSpaceStart))==null?void 0:i[0],s=t.replace(Qe.endingNewline,"")+`
|
|
250
|
-
`;return n?'<pre><code class="language-'+xt(n)+'">'+(r?s:xt(s,!0))+`</code></pre>
|
|
251
|
-
`:"<pre><code>"+(r?s:xt(s,!0))+`</code></pre>
|
|
252
|
-
`}blockquote({tokens:t}){return`<blockquote>
|
|
253
|
-
${this.parser.parse(t)}</blockquote>
|
|
254
|
-
`}html({text:t}){return t}heading({tokens:t,depth:e}){return`<h${e}>${this.parser.parseInline(t)}</h${e}>
|
|
255
|
-
`}hr(t){return`<hr>
|
|
256
|
-
`}list(t){const e=t.ordered,r=t.start;let n="";for(let o=0;o<t.items.length;o++){const a=t.items[o];n+=this.listitem(a)}const s=e?"ol":"ul",i=e&&r!==1?' start="'+r+'"':"";return"<"+s+i+`>
|
|
257
|
-
`+n+"</"+s+`>
|
|
258
|
-
`}listitem(t){var r;let e="";if(t.task){const n=this.checkbox({checked:!!t.checked});t.loose?((r=t.tokens[0])==null?void 0:r.type)==="paragraph"?(t.tokens[0].text=n+" "+t.tokens[0].text,t.tokens[0].tokens&&t.tokens[0].tokens.length>0&&t.tokens[0].tokens[0].type==="text"&&(t.tokens[0].tokens[0].text=n+" "+xt(t.tokens[0].tokens[0].text),t.tokens[0].tokens[0].escaped=!0)):t.tokens.unshift({type:"text",raw:n+" ",text:n+" ",escaped:!0}):e+=n+" "}return e+=this.parser.parse(t.tokens,!!t.loose),`<li>${e}</li>
|
|
259
|
-
`}checkbox({checked:t}){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:t}){return`<p>${this.parser.parseInline(t)}</p>
|
|
260
|
-
`}table(t){let e="",r="";for(let s=0;s<t.header.length;s++)r+=this.tablecell(t.header[s]);e+=this.tablerow({text:r});let n="";for(let s=0;s<t.rows.length;s++){const i=t.rows[s];r="";for(let o=0;o<i.length;o++)r+=this.tablecell(i[o]);n+=this.tablerow({text:r})}return n&&(n=`<tbody>${n}</tbody>`),`<table>
|
|
261
|
-
<thead>
|
|
262
|
-
`+e+`</thead>
|
|
263
|
-
`+n+`</table>
|
|
264
|
-
`}tablerow({text:t}){return`<tr>
|
|
265
|
-
${t}</tr>
|
|
266
|
-
`}tablecell(t){const e=this.parser.parseInline(t.tokens),r=t.header?"th":"td";return(t.align?`<${r} align="${t.align}">`:`<${r}>`)+e+`</${r}>
|
|
267
|
-
`}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${xt(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:r}){const n=this.parser.parseInline(r),s=Ml(t);if(s===null)return n;t=s;let i='<a href="'+t+'"';return e&&(i+=' title="'+xt(e)+'"'),i+=">"+n+"</a>",i}image({href:t,title:e,text:r,tokens:n}){n&&(r=this.parser.parseInline(n,this.parser.textRenderer));const s=Ml(t);if(s===null)return xt(r);t=s;let i=`<img src="${t}" alt="${r}"`;return e&&(i+=` title="${xt(e)}"`),i+=">",i}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:xt(t.text)}},zo=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}},Jt=class go{constructor(e){be(this,"options");be(this,"renderer");be(this,"textRenderer");this.options=e||Or,this.options.renderer=this.options.renderer||new Us,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new zo}static parse(e,r){return new go(r).parse(e)}static parseInline(e,r){return new go(r).parseInline(e)}parse(e,r=!0){var s,i;let n="";for(let o=0;o<e.length;o++){const a=e[o];if((i=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&i[a.type]){const c=a,u=this.options.extensions.renderers[c.type].call({parser:this},c);if(u!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(c.type)){n+=u||"";continue}}const l=a;switch(l.type){case"space":{n+=this.renderer.space(l);continue}case"hr":{n+=this.renderer.hr(l);continue}case"heading":{n+=this.renderer.heading(l);continue}case"code":{n+=this.renderer.code(l);continue}case"table":{n+=this.renderer.table(l);continue}case"blockquote":{n+=this.renderer.blockquote(l);continue}case"list":{n+=this.renderer.list(l);continue}case"html":{n+=this.renderer.html(l);continue}case"paragraph":{n+=this.renderer.paragraph(l);continue}case"text":{let c=l,u=this.renderer.text(c);for(;o+1<e.length&&e[o+1].type==="text";)c=e[++o],u+=`
|
|
268
|
-
`+this.renderer.text(c);r?n+=this.renderer.paragraph({type:"paragraph",raw:u,text:u,tokens:[{type:"text",raw:u,text:u,escaped:!0}]}):n+=u;continue}default:{const c='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return n}parseInline(e,r=this.renderer){var s,i;let n="";for(let o=0;o<e.length;o++){const a=e[o];if((i=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&i[a.type]){const c=this.options.extensions.renderers[a.type].call({parser:this},a);if(c!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(a.type)){n+=c||"";continue}}const l=a;switch(l.type){case"escape":{n+=r.text(l);break}case"html":{n+=r.html(l);break}case"link":{n+=r.link(l);break}case"image":{n+=r.image(l);break}case"strong":{n+=r.strong(l);break}case"em":{n+=r.em(l);break}case"codespan":{n+=r.codespan(l);break}case"br":{n+=r.br(l);break}case"del":{n+=r.del(l);break}case"text":{n+=r.text(l);break}default:{const c='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return n}},ji,_s=(ji=class{constructor(t){be(this,"options");be(this,"block");this.options=t||Or}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}provideLexer(){return this.block?Gt.lex:Gt.lexInline}provideParser(){return this.block?Jt.parse:Jt.parseInline}},be(ji,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"])),ji),Cb=class{constructor(...t){be(this,"defaults",Do());be(this,"options",this.setOptions);be(this,"parse",this.parseMarkdown(!0));be(this,"parseInline",this.parseMarkdown(!1));be(this,"Parser",Jt);be(this,"Renderer",Us);be(this,"TextRenderer",zo);be(this,"Lexer",Gt);be(this,"Tokenizer",Ds);be(this,"Hooks",_s);this.use(...t)}walkTokens(t,e){var n,s;let r=[];for(const i of t)switch(r=r.concat(e.call(this,i)),i.type){case"table":{const o=i;for(const a of o.header)r=r.concat(this.walkTokens(a.tokens,e));for(const a of o.rows)for(const l of a)r=r.concat(this.walkTokens(l.tokens,e));break}case"list":{const o=i;r=r.concat(this.walkTokens(o.items,e));break}default:{const o=i;(s=(n=this.defaults.extensions)==null?void 0:n.childTokens)!=null&&s[o.type]?this.defaults.extensions.childTokens[o.type].forEach(a=>{const l=o[a].flat(1/0);r=r.concat(this.walkTokens(l,e))}):o.tokens&&(r=r.concat(this.walkTokens(o.tokens,e)))}}return r}use(...t){const e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(r=>{const n={...r};if(n.async=this.defaults.async||n.async||!1,r.extensions&&(r.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){const i=e.renderers[s.name];i?e.renderers[s.name]=function(...o){let a=s.renderer.apply(this,o);return a===!1&&(a=i.apply(this,o)),a}:e.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const i=e[s.level];i?i.unshift(s.tokenizer):e[s.level]=[s.tokenizer],s.start&&(s.level==="block"?e.startBlock?e.startBlock.push(s.start):e.startBlock=[s.start]:s.level==="inline"&&(e.startInline?e.startInline.push(s.start):e.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(e.childTokens[s.name]=s.childTokens)}),n.extensions=e),r.renderer){const s=this.defaults.renderer||new Us(this.defaults);for(const i in r.renderer){if(!(i in s))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;const o=i,a=r.renderer[o],l=s[o];s[o]=(...c)=>{let u=a.apply(s,c);return u===!1&&(u=l.apply(s,c)),u||""}}n.renderer=s}if(r.tokenizer){const s=this.defaults.tokenizer||new Ds(this.defaults);for(const i in r.tokenizer){if(!(i in s))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;const o=i,a=r.tokenizer[o],l=s[o];s[o]=(...c)=>{let u=a.apply(s,c);return u===!1&&(u=l.apply(s,c)),u}}n.tokenizer=s}if(r.hooks){const s=this.defaults.hooks||new _s;for(const i in r.hooks){if(!(i in s))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;const o=i,a=r.hooks[o],l=s[o];_s.passThroughHooks.has(i)?s[o]=c=>{if(this.defaults.async)return Promise.resolve(a.call(s,c)).then(h=>l.call(s,h));const u=a.call(s,c);return l.call(s,u)}:s[o]=(...c)=>{let u=a.apply(s,c);return u===!1&&(u=l.apply(s,c)),u}}n.hooks=s}if(r.walkTokens){const s=this.defaults.walkTokens,i=r.walkTokens;n.walkTokens=function(o){let a=[];return a.push(i.call(this,o)),s&&(a=a.concat(s.call(this,o))),a}}this.defaults={...this.defaults,...n}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return Gt.lex(t,e??this.defaults)}parser(t,e){return Jt.parse(t,e??this.defaults)}parseMarkdown(t){return(r,n)=>{const s={...n},i={...this.defaults,...s},o=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&s.async===!1)return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof r>"u"||r===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof r!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(r)+", string expected"));i.hooks&&(i.hooks.options=i,i.hooks.block=t);const a=i.hooks?i.hooks.provideLexer():t?Gt.lex:Gt.lexInline,l=i.hooks?i.hooks.provideParser():t?Jt.parse:Jt.parseInline;if(i.async)return Promise.resolve(i.hooks?i.hooks.preprocess(r):r).then(c=>a(c,i)).then(c=>i.hooks?i.hooks.processAllTokens(c):c).then(c=>i.walkTokens?Promise.all(this.walkTokens(c,i.walkTokens)).then(()=>c):c).then(c=>l(c,i)).then(c=>i.hooks?i.hooks.postprocess(c):c).catch(o);try{i.hooks&&(r=i.hooks.preprocess(r));let c=a(r,i);i.hooks&&(c=i.hooks.processAllTokens(c)),i.walkTokens&&this.walkTokens(c,i.walkTokens);let u=l(c,i);return i.hooks&&(u=i.hooks.postprocess(u)),u}catch(c){return o(c)}}}onError(t,e){return r=>{if(r.message+=`
|
|
269
|
-
Please report this to https://github.com/markedjs/marked.`,t){const n="<p>An error occurred:</p><pre>"+xt(r.message+"",!0)+"</pre>";return e?Promise.resolve(n):n}if(e)return Promise.reject(r);throw r}}},Cr=new Cb;function pe(t,e){return Cr.parse(t,e)}pe.options=pe.setOptions=function(t){return Cr.setOptions(t),pe.defaults=Cr.defaults,Xu(pe.defaults),pe};pe.getDefaults=Do;pe.defaults=Or;pe.use=function(...t){return Cr.use(...t),pe.defaults=Cr.defaults,Xu(pe.defaults),pe};pe.walkTokens=function(t,e){return Cr.walkTokens(t,e)};pe.parseInline=Cr.parseInline;pe.Parser=Jt;pe.parser=Jt.parse;pe.Renderer=Us;pe.TextRenderer=zo;pe.Lexer=Gt;pe.lexer=Gt.lex;pe.Tokenizer=Ds;pe.Hooks=_s;pe.parse=pe;pe.options;pe.setOptions;pe.use;pe.walkTokens;pe.parseInline;Jt.parse;Gt.lex;const Ob=["innerHTML"],Pb=pr({__name:"MarkdownContent",props:{content:{}},setup(t){const e=t,r=new pe.Renderer;r.link=({href:s,title:i,text:o})=>{const a=s??"",l=i?` title="${i}"`:"";return`<a href="${a}"${l} target="_blank" rel="noopener noreferrer">${o}</a>`};const n=je(()=>e.content?pe.parse(e.content,{async:!1,renderer:r}):"");return(s,i)=>(Z(),ue("div",{class:"prose prose-sm dark:prose-invert max-w-none markdown-content",innerHTML:n.value},null,8,Ob))}}),lh=10*1024*1024,ch=25*1024*1024;function yn(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function $i(t){return t.mimeType.startsWith("image/")}function Ib(t){return`data:${t.mimeType};base64,${t.content}`}async function $b(t){const e=await new Promise((n,s)=>{const i=new FileReader;i.onload=()=>n(String(i.result??"")),i.onerror=()=>s(new Error("Unable to read file")),i.readAsDataURL(t)}),r=e.indexOf(",");if(r===-1)throw new Error(`Unable to parse file content for ${t.name}`);return{name:t.name,mimeType:t.type||"application/octet-stream",size:t.size,content:e.slice(r+1)}}function jb(t){for(const r of t)if(r.size>lh)return{ok:!1,error:`"${r.name}" exceeds the 10MB per-file limit.`};return t.reduce((r,n)=>r+n.size,0)>ch?{ok:!1,error:"Attachments exceed the 25MB per-message limit."}:{ok:!0}}const Nb={class:"overlay-header",style:{background:`linear-gradient(
|
|
270
|
-
180deg,
|
|
271
|
-
rgba(216, 51, 51, 0.12) 0%,
|
|
272
|
-
rgba(240, 65, 255, 0.06) 100%
|
|
273
|
-
)`}},Lb={key:0,class:"flex h-full items-center justify-center px-5 text-center"},Db={key:0,class:"overlay-avatar-letter"},Ub={key:0,class:"mb-2 space-y-2"},Bb=["src","alt"],Mb={class:"flex items-center gap-2 text-[9px]"},Hb={class:"truncate"},qb={class:"opacity-70"},Fb={key:2,class:"text-zinc-500"},Vb={key:0,class:"overlay-stream-indicator"},zb={class:"overlay-footer"},Wb={key:0,class:"mb-2 space-y-2"},Kb={class:"flex flex-wrap gap-1.5"},Gb={class:"max-w-[120px] truncate"},Jb={class:"opacity-65"},Yb=["onClick"],Xb={class:"overlay-meta text-zinc-500"},Zb={key:1,class:"mb-2 text-[11px] text-[#ef4444]"},Qb={class:"overlay-composer-field"},e_=["disabled"],t_=["disabled","aria-label","title"],r_=pr({__name:"ChatOverlay",setup(t){const e=Kv(),r=ln(),n=jo(),s=Oe(!1),i=Oe(""),o=Oe(""),a=Oe(!1),l=Oe([]),c=Oe(),u=Oe(),h=Oe(),d=Oe(!0),f=Oe(!1),p=[0,110,220],y=je(()=>e.messages.length>0),w=()=>n.path==="/",k=je(()=>l.value.reduce((L,se)=>L+se.size,0)),_=je(()=>{const L=typeof r.email=="string"?r.email.trim():"";return L?L.charAt(0).toUpperCase():"U"}),b=je(()=>!e.isStreaming&&(i.value.trim().length>0||l.value.length>0));function x(){w()||(s.value=!s.value)}function D(){h.value&&(h.value.style.height="auto",h.value.style.height=`${Math.min(h.value.scrollHeight,136)}px`)}function M(){if(!c.value)return;const L=c.value,se=L.scrollHeight-L.scrollTop-L.clientHeight;d.value=se<40,f.value=!d.value}function U(L=!1){c.value&&(L||d.value)&&(c.value.scrollTop=c.value.scrollHeight,f.value=!1)}async function V(L){if(!L||L.length===0)return;o.value="";const se=[];try{for(const ae of Array.from(L))se.push(await $b(ae))}catch(ae){o.value=(ae==null?void 0:ae.message)??"Unable to read one or more files.";return}const We=[...l.value,...se],ie=jb(We);if(!ie.ok){o.value=ie.error;return}l.value=We,u.value&&(u.value.value="")}function C(L){l.value.splice(L,1),o.value=""}function z(){var L;e.isStreaming||(L=u.value)==null||L.click()}function Q(L){const se=L.target;V((se==null?void 0:se.files)??null)}async function O(){if(!b.value)return;const L=i.value.trim(),se=[...l.value],We=L||"Please review the attached file(s).";i.value="",l.value=[],o.value="",D(),await e.sendMessage(We,se)}function Y(){e.stopStreaming()}function Ee(L){if(L.key==="Enter"&&!L.shiftKey){if(L.preventDefault(),e.isStreaming){Y();return}O()}}function Ne(L){L.preventDefault(),!e.isStreaming&&(a.value=!0)}function ye(L){L.preventDefault(),a.value=!1}async function te(L){var se;L.preventDefault(),a.value=!1,!e.isStreaming&&await V(((se=L.dataTransfer)==null?void 0:se.files)??null)}return Kt(i,()=>D()),Kt(()=>e.messages.map(L=>L.content),async()=>{await hr(),M(),U()},{deep:!0}),Kt(()=>e.messages.length,async()=>{await hr(),M(),U(!0)}),Kt(s,async L=>{L&&(await hr(),D(),M(),U(!0))}),xo(async()=>{await hr(),D()}),(L,se)=>{const We=Zs("X");return Z(),ue(Fe,null,[!s.value&&!w()?(Z(),ue("button",{key:0,onClick:x,class:"overlay-fab",title:"Chat with IO","aria-label":"Open chat overlay"},[he(re(xu),{class:"h-4 w-4 text-white"})])):$e("",!0),he(yf,{"enter-active-class":"transition-all duration-200 ease-out","enter-from-class":"opacity-0 translate-y-4 scale-[0.98]","enter-to-class":"opacity-100 translate-y-0 scale-100","leave-active-class":"transition-all duration-150 ease-in","leave-from-class":"opacity-100 translate-y-0 scale-100","leave-to-class":"opacity-0 translate-y-4 scale-[0.98]"},{default:Yr(()=>[s.value?(Z(),ue("section",{key:0,class:Ye(["overlay-panel",a.value?"overlay-panel-dragging":""]),"aria-label":"IO Assistant chat",onDragover:Ne,onDragleave:ye,onDrop:te},[ne("header",Nb,[se[4]||(se[4]=ne("div",{class:"flex items-center gap-2.5"},[ne("div",{class:"overlay-brand-mark","aria-hidden":"true"},[ne("img",{src:Tu,alt:"IO",width:"18",height:"18",class:"shrink-0"})]),ne("div",{class:"flex items-center leading-none"},[ne("span",{class:"overlay-title"},"IO Chat")])],-1)),ne("button",{onClick:se[0]||(se[0]=ie=>s.value=!1),class:"overlay-icon-btn","aria-label":"Minimize chat overlay",title:"Minimize chat"},[he(re(_g),{class:"h-3.5 w-3.5"})])]),ne("div",{ref_key:"messagesContainer",ref:c,class:"overlay-messages",onScroll:M},[y.value?$e("",!0):(Z(),ue("div",Lb,[ne("div",null,[he(Zi,{size:32,class:"mx-auto mb-3 shrink-0"}),se[5]||(se[5]=ne("p",{class:"overlay-empty-copy"}," Ask IO about your workspace, agents, or recent changes. ",-1))])])),(Z(!0),ue(Fe,null,zr(re(e).messages,ie=>(Z(),ue("div",{key:ie.id,class:Ye(["flex",ie.role==="user"?"justify-end":"justify-start"])},[ne("div",{class:Ye(["flex max-w-full items-start gap-2",ie.role==="user"?"flex-row-reverse":""])},[ne("div",{class:Ye(["overlay-avatar",ie.role==="user"?"overlay-avatar-user":"overlay-avatar-assistant"]),"aria-hidden":"true"},[ie.role==="user"?(Z(),ue("span",Db,it(_.value),1)):(Z(),nt(Zi,{key:1,size:10,class:"shrink-0"}))],2),ne("article",{class:Ye(["overlay-bubble",ie.role==="user"?"overlay-bubble-user rounded-tr-sm":"overlay-bubble-assistant rounded-tl-sm"])},[ie.attachments.length>0?(Z(),ue("div",Ub,[(Z(!0),ue(Fe,null,zr(ie.attachments,(ae,Lt)=>(Z(),ue("div",{key:`${ie.id}-${Lt}`,class:"overlay-attachment"},[re($i)(ae)?(Z(),ue("img",{key:0,src:re(Ib)(ae),alt:ae.name,class:"mb-1 max-h-44 rounded-md object-contain"},null,8,Bb)):$e("",!0),ne("div",Mb,[re($i)(ae)?(Z(),nt(re(nl),{key:0,class:"h-3.5 w-3.5"})):(Z(),nt(re(rl),{key:1,class:"h-3.5 w-3.5"})),ne("span",Hb,it(ae.name),1),ne("span",qb,it(re(yn)(ae.size)),1)])]))),128))])):$e("",!0),ie.content?(Z(),nt(Pb,{key:1,content:ie.content,class:Ye(["overlay-markdown",ie.role==="user"?"prose-invert":""])},null,8,["content","class"])):ie.streaming?$e("",!0):(Z(),ue("span",Fb,"..."))],2)],2),ie.streaming&&ie.role==="assistant"?(Z(),ue("div",Vb,[(Z(),ue(Fe,null,zr(p,ae=>ne("span",{key:ae,class:"overlay-stream-dot",style:Ws({animationDelay:`${ae}ms`})},null,4)),64))])):$e("",!0)],2))),128))],544),f.value?(Z(),ue("button",{key:0,class:"overlay-scroll-hint",type:"button",onClick:se[1]||(se[1]=ie=>U(!0)),"aria-label":"Scroll to latest message"},[he(re(pg),{class:"h-3.5 w-3.5"}),se[6]||(se[6]=ru(" Latest ",-1))])):$e("",!0),ne("footer",zb,[ne("input",{ref_key:"fileInput",ref:u,type:"file",multiple:"",class:"hidden",onChange:Q},null,544),l.value.length>0?(Z(),ue("div",Wb,[ne("div",Kb,[(Z(!0),ue(Fe,null,zr(l.value,(ie,ae)=>(Z(),ue("div",{key:`${ie.name}-${ae}`,class:"overlay-chip"},[re($i)(ie)?(Z(),nt(re(nl),{key:0,class:"h-3.5 w-3.5"})):(Z(),nt(re(rl),{key:1,class:"h-3.5 w-3.5"})),ne("span",Gb,it(ie.name),1),ne("span",Jb,it(re(yn)(ie.size)),1),ne("button",{class:"hover:text-destructive",onClick:Lt=>C(ae)},[he(We,{class:"h-3.5 w-3.5"})],8,Yb)]))),128))]),ne("p",Xb,it(re(yn)(k.value))+" · Max "+it(re(yn)(re(lh)))+" file · "+it(re(yn)(re(ch)))+" total ",1)])):$e("",!0),o.value?(Z(),ue("p",Zb,it(o.value),1)):$e("",!0),ne("div",Qb,[ne("button",{class:"overlay-attach-btn",disabled:re(e).isStreaming,onClick:z,title:"Attach files","aria-label":"Attach files"},[he(re(Sg),{class:"h-4 w-4"})],8,e_),od(ne("textarea",{ref_key:"textareaRef",ref:h,"onUpdate:modelValue":se[2]||(se[2]=ie=>i.value=ie),onKeydown:Ee,placeholder:"Message IO…",rows:"1",class:"overlay-input"},null,544),[[Mf,i.value]]),ne("button",{onClick:se[3]||(se[3]=ie=>re(e).isStreaming?Y():O()),disabled:!b.value&&!re(e).isStreaming,class:"overlay-send-btn","aria-label":re(e).isStreaming?"Stop generation":"Send message",title:re(e).isStreaming?"Stop generation":"Send message"},[re(e).isStreaming?(Z(),nt(re(Rg),{key:1,class:"h-3 w-3"})):(Z(),nt(re(Tg),{key:0,class:"h-3 w-3"}))],8,t_)])])],34)):$e("",!0)]),_:1})],64)}}}),n_=(t,e)=>{const r=t.__vccOpts||t;for(const[n,s]of e)r[n]=s;return r},s_=n_(r_,[["__scopeId","data-v-6cea3afb"]]),i_={class:"flex h-screen overflow-hidden"},o_={class:"flex-1 flex flex-col overflow-hidden"},a_={class:"flex-1 overflow-auto"},l_=pr({__name:"App",setup(t){const e=ln(),r=jo(),n=je(()=>e.isAuthenticated&&r.name!=="login");return(s,i)=>{const o=Zs("router-view");return Z(),ue("div",i_,[n.value?(Z(),nt(Ug,{key:0})):$e("",!0),ne("div",o_,[n.value?(Z(),nt(Vv,{key:0})):$e("",!0),ne("main",a_,[he(o)])]),n.value?(Z(),nt(s_,{key:1})):$e("",!0)])}}}),c_=[{path:"/login",name:"login",component:()=>Ke(()=>import("./LoginView-D7LrkeX7.js"),[]),meta:{public:!0}},{path:"/",name:"chat",component:()=>Ke(()=>import("./ChatView-BdMukPKG.js"),__vite__mapDeps([0,1]))},{path:"/squads",name:"squads",component:()=>Ke(()=>import("./SquadsView-AzMht2NJ.js"),__vite__mapDeps([2,3,4,5]))},{path:"/squads/health",name:"squad-health",component:()=>Ke(()=>import("./SquadHealthView-D686BuQo.js"),__vite__mapDeps([6,3,7,5]))},{path:"/squads/:id",name:"squad-detail",component:()=>Ke(()=>import("./SquadDetailView-DBscu0m2.js"),__vite__mapDeps([8,3,4,1,5,9,10]))},{path:"/feed",name:"feed",component:()=>Ke(()=>import("./FeedView-BfPIabGr.js"),__vite__mapDeps([11,3,4,9]))},{path:"/skills",name:"skills",component:()=>Ke(()=>import("./SkillsView-DQSMM5LN.js"),__vite__mapDeps([12,3,13,14,15,16,1,9]))},{path:"/mcp",name:"mcp",component:()=>Ke(()=>import("./McpView-BAP_ah3T.js"),__vite__mapDeps([17,3,18,13,9]))},{path:"/schedules",name:"schedules",component:()=>Ke(()=>import("./SchedulesView-CAtsUPCZ.js"),__vite__mapDeps([19,3,4,18,13,15,9]))},{path:"/history",name:"history",component:()=>Ke(()=>import("./HistoryView-BmEEk3Rs.js"),__vite__mapDeps([20,3,14,10,9]))},{path:"/wiki",name:"wiki",component:()=>Ke(()=>import("./WikiView-Cn7KipkZ.js"),__vite__mapDeps([21,3,14,13,15,9,16,1]))},{path:"/usage",name:"usage",component:()=>Ke(()=>import("./UsageView-DiVn97aI.js"),__vite__mapDeps([22,3,7]))},{path:"/audit-log",name:"audit-log",component:()=>Ke(()=>import("./AuditLogView-BzfjNXBT.js"),__vite__mapDeps([23,3]))},{path:"/settings",name:"settings",component:()=>Ke(()=>import("./SettingsView-BovjWZDa.js"),__vite__mapDeps([24,3]))}],uh=og({history:Up(),routes:c_});uh.beforeEach(t=>{const e=ln();if(!t.meta.public&&!e.isAuthenticated)return{name:"login"}});async function u_(){await Bv();const t=Wf(l_);t.use(Jf()),t.use(uh);const{useAuthStore:e}=await Ke(async()=>{const{useAuthStore:n}=await Promise.resolve().then(()=>Mv);return{useAuthStore:n}},void 0),r=e();r.initAuthListener(),r.token&&await r.refreshToken(),t.mount("#app")}u_();export{f_ as $,hg as A,dg as B,fg as C,Ws as D,xo as E,rl as F,$c as G,vg as H,nl as I,Z as J,Oe as K,zr as L,lh as M,Zs as N,uh as O,Sg as P,Ib as Q,it as R,Tg as S,re as T,Cg as U,ln as V,Kv as W,jo as X,ag as Y,d_ as Z,Zi as _,pg as a,Mf as a0,jb as a1,Kt as a2,Yr as a3,od as a4,g_ as a5,p_ as a6,gg as b,mg as c,Fe as d,Au as e,ch as f,xu as g,Eg as h,Ag as i,Rg as j,Og as k,Pb as l,je as m,ne as n,nt as o,$e as p,ue as q,Ae as r,ru as s,he as t,pr as u,$b as v,yn as w,$i as x,hr as y,Ye as z};
|