agor-live 0.21.2 → 0.22.0
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/dist/cli/commands/branch/env/restart.js +1 -1
- package/dist/cli/commands/branch/env/start.js +1 -1
- package/dist/cli/commands/branch/env/stop.js +1 -1
- package/dist/core/api/index.cjs +5 -1
- package/dist/core/api/index.d.ts +6 -1
- package/dist/core/api/index.d.ts.map +1 -1
- package/dist/core/api/index.js +5 -1
- package/dist/core/claude/index.cjs +162 -14
- package/dist/core/claude/index.js +166 -18
- package/dist/core/client/index.cjs +43 -3
- package/dist/core/client/index.js +37 -3
- package/dist/core/config/browser.cjs +2 -2
- package/dist/core/config/browser.js +2 -2
- package/dist/core/config/config-manager.d.ts.map +1 -1
- package/dist/core/config/constants.d.ts +1 -1
- package/dist/core/config/index.cjs +174 -20
- package/dist/core/config/index.js +178 -24
- package/dist/core/config/types.d.ts +8 -0
- package/dist/core/config/types.d.ts.map +1 -1
- package/dist/core/db/index.cjs +495 -86
- package/dist/core/db/index.js +482 -75
- package/dist/core/db/repositories/artifacts.d.ts.map +1 -1
- package/dist/core/db/repositories/branches.d.ts +13 -1
- package/dist/core/db/repositories/branches.d.ts.map +1 -1
- package/dist/core/db/repositories/gateway-channels.d.ts.map +1 -1
- package/dist/core/db/repositories/index.d.ts +1 -0
- package/dist/core/db/repositories/index.d.ts.map +1 -1
- package/dist/core/db/repositories/session-relationships.d.ts +30 -0
- package/dist/core/db/repositories/session-relationships.d.ts.map +1 -0
- package/dist/core/db/repositories/users.d.ts +11 -0
- package/dist/core/db/repositories/users.d.ts.map +1 -1
- package/dist/core/db/schema.d.ts +421 -4
- package/dist/core/db/schema.d.ts.map +1 -1
- package/dist/core/db/schema.postgres.d.ts +226 -2
- package/dist/core/db/schema.postgres.d.ts.map +1 -1
- package/dist/core/db/schema.sqlite.d.ts +228 -2
- package/dist/core/db/schema.sqlite.d.ts.map +1 -1
- package/dist/core/drizzle/postgres/0050_artifact_source_session.sql +3 -0
- package/dist/core/drizzle/postgres/0051_session_relationships.sql +26 -0
- package/dist/core/drizzle/postgres/meta/_journal.json +14 -0
- package/dist/core/drizzle/sqlite/0059_artifact_source_session.sql +2 -0
- package/dist/core/drizzle/sqlite/0060_session_relationships.sql +23 -0
- package/dist/core/drizzle/sqlite/meta/_journal.json +14 -0
- package/dist/core/gateway/connector-registry.d.ts.map +1 -1
- package/dist/core/gateway/connector.d.ts +22 -0
- package/dist/core/gateway/connector.d.ts.map +1 -1
- package/dist/core/gateway/connectors/slack.d.ts +35 -3
- package/dist/core/gateway/connectors/slack.d.ts.map +1 -1
- package/dist/core/gateway/connectors/teams.d.ts +107 -0
- package/dist/core/gateway/connectors/teams.d.ts.map +1 -0
- package/dist/core/gateway/context.d.ts.map +1 -1
- package/dist/core/gateway/index.cjs +552 -52
- package/dist/core/gateway/index.d.ts +3 -2
- package/dist/core/gateway/index.d.ts.map +1 -1
- package/dist/core/gateway/index.js +544 -52
- package/dist/core/gateway/system-message.d.ts +21 -0
- package/dist/core/gateway/system-message.d.ts.map +1 -1
- package/dist/core/index.cjs +616 -127
- package/dist/core/index.js +597 -116
- package/dist/core/mcp/index.cjs +146 -9
- package/dist/core/mcp/index.js +146 -9
- package/dist/core/mcp/template-resolver.d.ts.map +1 -1
- package/dist/core/seed/index.cjs +375 -59
- package/dist/core/seed/index.js +378 -62
- package/dist/core/sessions/index.cjs +19 -0
- package/dist/core/sessions/index.js +19 -0
- package/dist/core/templates/agor-system-prompt.md +21 -53
- package/dist/core/templates/session-context.cjs +2 -73
- package/dist/core/templates/session-context.d.ts +9 -53
- package/dist/core/templates/session-context.d.ts.map +1 -1
- package/dist/core/templates/session-context.js +2 -72
- package/dist/core/tools/mcp/jwt-auth.cjs +2 -20
- package/dist/core/tools/mcp/jwt-auth.d.ts.map +1 -1
- package/dist/core/tools/mcp/jwt-auth.js +2 -20
- package/dist/core/tools/mcp/oauth-mcp-transport.cjs +2 -15
- package/dist/core/tools/mcp/oauth-mcp-transport.d.ts.map +1 -1
- package/dist/core/tools/mcp/oauth-mcp-transport.js +2 -15
- package/dist/core/tools/mcp/oauth-refresh.cjs +167 -19
- package/dist/core/tools/mcp/oauth-refresh.js +167 -19
- package/dist/core/types/artifact.d.ts +5 -1
- package/dist/core/types/artifact.d.ts.map +1 -1
- package/dist/core/types/branch.d.ts +14 -0
- package/dist/core/types/branch.d.ts.map +1 -1
- package/dist/core/types/gateway.d.ts +1 -1
- package/dist/core/types/gateway.d.ts.map +1 -1
- package/dist/core/types/id.d.ts +1 -0
- package/dist/core/types/id.d.ts.map +1 -1
- package/dist/core/types/index.cjs +36 -0
- package/dist/core/types/index.js +30 -0
- package/dist/core/types/session.d.ts +65 -1
- package/dist/core/types/session.d.ts.map +1 -1
- package/dist/core/types/task.d.ts +9 -0
- package/dist/core/types/task.d.ts.map +1 -1
- package/dist/core/unix/index.cjs +371 -55
- package/dist/core/unix/index.js +374 -58
- package/dist/core/unix/unix-integration-service.d.ts +10 -7
- package/dist/core/unix/unix-integration-service.d.ts.map +1 -1
- package/dist/core/utils/permission-mode-mapper.cjs +19 -0
- package/dist/core/utils/permission-mode-mapper.js +19 -0
- package/dist/daemon/declarations.d.ts +7 -0
- package/dist/daemon/declarations.d.ts.map +1 -1
- package/dist/daemon/hooks/gateway-route.d.ts.map +1 -1
- package/dist/daemon/hooks/gateway-route.js +53 -1
- package/dist/daemon/index.js +3760 -2107
- package/dist/daemon/main.js +3760 -2107
- package/dist/daemon/mcp/server.js +155 -17
- package/dist/daemon/mcp/tools/analytics.js +6 -7
- package/dist/daemon/mcp/tools/artifacts.d.ts.map +1 -1
- package/dist/daemon/mcp/tools/artifacts.js +7 -7
- package/dist/daemon/mcp/tools/boards.js +6 -7
- package/dist/daemon/mcp/tools/branches.js +6 -7
- package/dist/daemon/mcp/tools/card-types.js +6 -7
- package/dist/daemon/mcp/tools/cards.js +6 -7
- package/dist/daemon/mcp/tools/environment.d.ts.map +1 -1
- package/dist/daemon/mcp/tools/environment.js +19 -12
- package/dist/daemon/mcp/tools/knowledge.js +6 -7
- package/dist/daemon/mcp/tools/mcp-servers.js +6 -7
- package/dist/daemon/mcp/tools/messages.js +6 -7
- package/dist/daemon/mcp/tools/proxies.js +6 -7
- package/dist/daemon/mcp/tools/repos.js +6 -7
- package/dist/daemon/mcp/tools/schedules.js +6 -7
- package/dist/daemon/mcp/tools/search.js +6 -7
- package/dist/daemon/mcp/tools/sessions.d.ts.map +1 -1
- package/dist/daemon/mcp/tools/sessions.js +140 -11
- package/dist/daemon/mcp/tools/tasks.js +6 -7
- package/dist/daemon/mcp/tools/users.js +6 -7
- package/dist/daemon/mcp/tools/widgets.js +7 -8
- package/dist/daemon/register-hooks.d.ts +5 -1
- package/dist/daemon/register-hooks.d.ts.map +1 -1
- package/dist/daemon/register-hooks.js +404 -179
- package/dist/daemon/register-routes.d.ts.map +1 -1
- package/dist/daemon/register-routes.js +360 -162
- package/dist/daemon/register-services.d.ts.map +1 -1
- package/dist/daemon/register-services.js +1928 -671
- package/dist/daemon/services/artifacts.d.ts +10 -1
- package/dist/daemon/services/artifacts.d.ts.map +1 -1
- package/dist/daemon/services/artifacts.js +25 -1
- package/dist/daemon/services/branches.d.ts +11 -1
- package/dist/daemon/services/branches.d.ts.map +1 -1
- package/dist/daemon/services/branches.js +470 -184
- package/dist/daemon/services/claude-models.js +879 -339
- package/dist/daemon/services/gateway.d.ts +58 -2
- package/dist/daemon/services/gateway.d.ts.map +1 -1
- package/dist/daemon/services/gateway.js +590 -47
- package/dist/daemon/services/groups.d.ts +2 -0
- package/dist/daemon/services/groups.d.ts.map +1 -1
- package/dist/daemon/services/groups.js +56 -0
- package/dist/daemon/services/mcp-servers.d.ts.map +1 -1
- package/dist/daemon/services/mcp-servers.js +0 -6
- package/dist/daemon/services/scheduler.d.ts.map +1 -1
- package/dist/daemon/services/scheduler.js +6 -2
- package/dist/daemon/services/sessions.d.ts +11 -3
- package/dist/daemon/services/sessions.d.ts.map +1 -1
- package/dist/daemon/services/sessions.js +68 -7
- package/dist/daemon/services/tasks.d.ts +13 -2
- package/dist/daemon/services/tasks.d.ts.map +1 -1
- package/dist/daemon/services/tasks.js +42 -26
- package/dist/daemon/startup.js +6 -2
- package/dist/daemon/utils/session-stop.d.ts +43 -0
- package/dist/daemon/utils/session-stop.d.ts.map +1 -0
- package/dist/daemon/utils/session-stop.js +102 -0
- package/dist/daemon/utils/session-task-state.d.ts +7 -2
- package/dist/daemon/utils/session-task-state.d.ts.map +1 -1
- package/dist/daemon/utils/session-task-state.js +9 -3
- package/dist/daemon/utils/session-tasks.d.ts +4 -4
- package/dist/daemon/utils/session-tasks.d.ts.map +1 -1
- package/dist/daemon/utils/session-tasks.js +4 -8
- package/dist/executor/commands/environment.d.ts +13 -0
- package/dist/executor/commands/environment.d.ts.map +1 -0
- package/dist/executor/commands/environment.js +287 -0
- package/dist/executor/commands/index.d.ts.map +1 -1
- package/dist/executor/commands/index.js +5 -1
- package/dist/executor/commands/unix.d.ts +8 -1
- package/dist/executor/commands/unix.d.ts.map +1 -1
- package/dist/executor/commands/unix.js +157 -2
- package/dist/executor/payload-types.d.ts +201 -5
- package/dist/executor/payload-types.d.ts.map +1 -1
- package/dist/executor/payload-types.js +98 -0
- package/dist/executor/sdk-handlers/base/mcp-scoping.d.ts.map +1 -1
- package/dist/executor/sdk-handlers/base/mcp-scoping.js +14 -0
- package/dist/executor/sdk-handlers/claude/message-processor.d.ts.map +1 -1
- package/dist/executor/sdk-handlers/claude/message-processor.js +0 -1
- package/dist/executor/sdk-handlers/claude/query-builder.d.ts +1 -0
- package/dist/executor/sdk-handlers/claude/query-builder.d.ts.map +1 -1
- package/dist/executor/sdk-handlers/claude/query-builder.js +91 -39
- package/dist/executor/sdk-handlers/codex/prompt-service.d.ts +12 -5
- package/dist/executor/sdk-handlers/codex/prompt-service.d.ts.map +1 -1
- package/dist/executor/sdk-handlers/codex/prompt-service.js +72 -30
- package/dist/executor/sdk-handlers/copilot/prompt-service.d.ts +2 -4
- package/dist/executor/sdk-handlers/copilot/prompt-service.d.ts.map +1 -1
- package/dist/executor/sdk-handlers/copilot/prompt-service.js +4 -13
- package/dist/executor/sdk-handlers/gemini/prompt-service.d.ts +2 -4
- package/dist/executor/sdk-handlers/gemini/prompt-service.d.ts.map +1 -1
- package/dist/executor/sdk-handlers/gemini/prompt-service.js +4 -13
- package/dist/ui/assets/App-DcEY8Ota.js +3 -0
- package/dist/ui/assets/App-DcEY8Ota.js.gz +0 -0
- package/dist/ui/assets/{ArtifactConsentModal-ParNk5kW.js → ArtifactConsentModal-CiCbK9iv.js} +1 -1
- package/dist/ui/assets/ArtifactConsentModal-CiCbK9iv.js.gz +0 -0
- package/dist/ui/assets/ArtifactFullscreenPage-CfsTEGKd.js +9 -0
- package/dist/ui/assets/ArtifactFullscreenPage-CfsTEGKd.js.gz +0 -0
- package/dist/ui/assets/AutocompleteTextarea-BAFFH_5e.js +18 -0
- package/dist/ui/assets/AutocompleteTextarea-BAFFH_5e.js.gz +0 -0
- package/dist/ui/assets/BoardObjectNodes-D-O6bZIG.js +34 -0
- package/dist/ui/assets/BoardObjectNodes-D-O6bZIG.js.gz +0 -0
- package/dist/ui/assets/{CodeEditor.inner-D51Z_CLQ.js → CodeEditor.inner-DBgsP4tn.js} +2 -2
- package/dist/ui/assets/CodeEditor.inner-DBgsP4tn.js.gz +0 -0
- package/dist/ui/assets/ConversationView-CUWR0gR6.js +1 -0
- package/dist/ui/assets/ConversationView-CUWR0gR6.js.gz +0 -0
- package/dist/ui/assets/KnowledgePage-B2bzlXfn.js +24 -0
- package/dist/ui/assets/KnowledgePage-B2bzlXfn.js.gz +0 -0
- package/dist/ui/assets/MarketingScreenshotPage-9Qd7eZsm.css +1 -0
- package/dist/ui/assets/MarketingScreenshotPage-zv5RUCuV.js +143 -0
- package/dist/ui/assets/MarketingScreenshotPage-zv5RUCuV.js.gz +0 -0
- package/dist/ui/assets/MobileApp-VgVnsnsN.js +1 -0
- package/dist/ui/assets/MobileApp-VgVnsnsN.js.gz +0 -0
- package/dist/ui/assets/SessionCanvas-f1-1Gbcw.js +20 -0
- package/dist/ui/assets/SessionCanvas-f1-1Gbcw.js.gz +0 -0
- package/dist/ui/assets/{App-BAdBsEnV.css → SessionCanvas-mEmYGZhC.css} +1 -1
- package/dist/ui/assets/SessionCanvas-mEmYGZhC.css.gz +0 -0
- package/dist/ui/assets/{StreamdownDemoPage-B9wbgp2s.js → StreamdownDemoPage-wzWaqWwr.js} +1 -1
- package/dist/ui/assets/StreamdownDemoPage-wzWaqWwr.js.gz +0 -0
- package/dist/ui/assets/{ThemeSwitcher-ubn6IOz9.js → ThemeSwitcher-Dly2y9pi.js} +1 -1
- package/dist/ui/assets/ThemeSwitcher-Dly2y9pi.js.gz +0 -0
- package/dist/ui/assets/antd-CfbbHJOz.js +401 -0
- package/dist/ui/assets/antd-CfbbHJOz.js.gz +0 -0
- package/dist/ui/assets/architecture-U656AL7Q-CykGFbQU.js +1 -0
- package/dist/ui/assets/{architectureDiagram-VXUJARFQ-ChmZt3zk.js → architectureDiagram-VXUJARFQ-C8HXAenz.js} +1 -1
- package/dist/ui/assets/architectureDiagram-VXUJARFQ-C8HXAenz.js.gz +0 -0
- package/dist/ui/assets/{blockDiagram-VD42YOAC-CzGHAHao.js → blockDiagram-VD42YOAC-BhZaEN19.js} +1 -1
- package/dist/ui/assets/blockDiagram-VD42YOAC-BhZaEN19.js.gz +0 -0
- package/dist/ui/assets/{c4Diagram-YG6GDRKO-DscJyaWN.js → c4Diagram-YG6GDRKO-Dk_UH-sY.js} +1 -1
- package/dist/ui/assets/c4Diagram-YG6GDRKO-Dk_UH-sY.js.gz +0 -0
- package/dist/ui/assets/channel-D6_nUWlW.js +1 -0
- package/dist/ui/assets/{chunk-4BX2VUAB-DoWpTvP8.js → chunk-4BX2VUAB-XprbG2TG.js} +1 -1
- package/dist/ui/assets/chunk-55IACEB6-ByzqIgSb.js +1 -0
- package/dist/ui/assets/{chunk-ABZYJK2D-RzDCrjE6.js → chunk-ABZYJK2D-BJcrryHK.js} +1 -1
- package/dist/ui/assets/chunk-ABZYJK2D-BJcrryHK.js.gz +0 -0
- package/dist/ui/assets/{chunk-AGHRB4JF-jidCS5Of.js → chunk-AGHRB4JF-DvxmfbM0.js} +1 -1
- package/dist/ui/assets/chunk-AGHRB4JF-DvxmfbM0.js.gz +0 -0
- package/dist/ui/assets/{chunk-ATLVNIR6-BEIIfJtC.js → chunk-ATLVNIR6-DbeJ0OrR.js} +1 -1
- package/dist/ui/assets/chunk-ATLVNIR6-DbeJ0OrR.js.gz +0 -0
- package/dist/ui/assets/{chunk-B4BG7PRW-B8b6dQQ2.js → chunk-B4BG7PRW-C53q2ggf.js} +1 -1
- package/dist/ui/assets/chunk-B4BG7PRW-C53q2ggf.js.gz +0 -0
- package/dist/ui/assets/{chunk-CVBHYZKI-D-mQAfrk.js → chunk-CVBHYZKI-B3EBSlb3.js} +1 -1
- package/dist/ui/assets/{chunk-DI55MBZ5-BfATX3V8.js → chunk-DI55MBZ5-vIyNEQN-.js} +1 -1
- package/dist/ui/assets/chunk-DI55MBZ5-vIyNEQN-.js.gz +0 -0
- package/dist/ui/assets/chunk-EXTU4WIE-B3ObkuOm.js +1 -0
- package/dist/ui/assets/{chunk-FMBD7UC4-fqXscNvc.js → chunk-FMBD7UC4-rddmfK-Z.js} +1 -1
- package/dist/ui/assets/{chunk-HN2XXSSU-BCHvD80g.js → chunk-HN2XXSSU-Dttqcg3b.js} +1 -1
- package/dist/ui/assets/chunk-HN2XXSSU-Dttqcg3b.js.gz +0 -0
- package/dist/ui/assets/{chunk-JA3XYJ7Z-Cp6dqHnY.js → chunk-JA3XYJ7Z-DbNDev3D.js} +1 -1
- package/dist/ui/assets/chunk-JA3XYJ7Z-DbNDev3D.js.gz +0 -0
- package/dist/ui/assets/{chunk-JZLCHNYA-cKMooY3y.js → chunk-JZLCHNYA-EUmx2y4H.js} +1 -1
- package/dist/ui/assets/chunk-JZLCHNYA-EUmx2y4H.js.gz +0 -0
- package/dist/ui/assets/{chunk-MI3HLSF2-BlzO5wOE.js → chunk-MI3HLSF2-65n9Mkyc.js} +1 -1
- package/dist/ui/assets/chunk-MI3HLSF2-65n9Mkyc.js.gz +0 -0
- package/dist/ui/assets/chunk-N4CR4FBY-mv5koXqW.js +2 -0
- package/dist/ui/assets/chunk-N4CR4FBY-mv5koXqW.js.gz +0 -0
- package/dist/ui/assets/{chunk-QN33PNHL-DIHGQ_pd.js → chunk-QN33PNHL-DsRKK6NR.js} +1 -1
- package/dist/ui/assets/{chunk-QXUST7PY-C9l0muI0.js → chunk-QXUST7PY-BCYnMiS3.js} +1 -1
- package/dist/ui/assets/chunk-QXUST7PY-BCYnMiS3.js.gz +0 -0
- package/dist/ui/assets/chunk-QZHKN3VN-HucAw4xW.js +1 -0
- package/dist/ui/assets/{chunk-S3R3BYOJ-VJiLzt2o.js → chunk-S3R3BYOJ-CWMEa9Dc.js} +1 -1
- package/dist/ui/assets/chunk-S3R3BYOJ-CWMEa9Dc.js.gz +0 -0
- package/dist/ui/assets/{chunk-TZMSLE5B-DZwI0C_2.js → chunk-TZMSLE5B-BuQUQcTr.js} +1 -1
- package/dist/ui/assets/chunk-TZMSLE5B-BuQUQcTr.js.gz +0 -0
- package/dist/ui/assets/classDiagram-2ON5EDUG-CUT3rPTB.js +1 -0
- package/dist/ui/assets/classDiagram-v2-WZHVMYZB-CUT3rPTB.js +1 -0
- package/dist/ui/assets/{cose-bilkent-S5V4N54A-Ipik-oSD.js → cose-bilkent-S5V4N54A-CnPB3ARO.js} +1 -1
- package/dist/ui/assets/cose-bilkent-S5V4N54A-CnPB3ARO.js.gz +0 -0
- package/dist/ui/assets/cursor-QEb7m-rN.png +0 -0
- package/dist/ui/assets/{dagre-6UL2VRFP-BDpyWQnh.js → dagre-6UL2VRFP-DhS-k_Se.js} +1 -1
- package/dist/ui/assets/dagre-6UL2VRFP-DhS-k_Se.js.gz +0 -0
- package/dist/ui/assets/{dagre-CgA4KhUX.js → dagre-KgLoHEuy.js} +1 -1
- package/dist/ui/assets/dagre-KgLoHEuy.js.gz +0 -0
- package/dist/ui/assets/{diagram-PSM6KHXK-B4GRzxLJ.js → diagram-PSM6KHXK-BZg3MJmb.js} +1 -1
- package/dist/ui/assets/diagram-PSM6KHXK-BZg3MJmb.js.gz +0 -0
- package/dist/ui/assets/{diagram-QEK2KX5R-BWPW28XI.js → diagram-QEK2KX5R-BPCitvbo.js} +1 -1
- package/dist/ui/assets/diagram-QEK2KX5R-BPCitvbo.js.gz +0 -0
- package/dist/ui/assets/{diagram-S2PKOQOG-BIHhcGoV.js → diagram-S2PKOQOG-NW4uK6sx.js} +1 -1
- package/dist/ui/assets/diagram-S2PKOQOG-NW4uK6sx.js.gz +0 -0
- package/dist/ui/assets/{editor-C-HJ7Yw0.js → editor-CzFWIUw2.js} +1 -1
- package/dist/ui/assets/editor-CzFWIUw2.js.gz +0 -0
- package/dist/ui/assets/{emoji-D8F6B62m.js → emoji-Dkz4Zzv_.js} +1 -1
- package/dist/ui/assets/emoji-Dkz4Zzv_.js.gz +0 -0
- package/dist/ui/assets/{erDiagram-Q2GNP2WA-ubTaAFcK.js → erDiagram-Q2GNP2WA-me1fboaf.js} +1 -1
- package/dist/ui/assets/erDiagram-Q2GNP2WA-me1fboaf.js.gz +0 -0
- package/dist/ui/assets/{flowDiagram-NV44I4VS-BHLCTYjI.js → flowDiagram-NV44I4VS-DzE8dGsh.js} +1 -1
- package/dist/ui/assets/flowDiagram-NV44I4VS-DzE8dGsh.js.gz +0 -0
- package/dist/ui/assets/{ganttDiagram-LVOFAZNH-ClC3pay1.js → ganttDiagram-LVOFAZNH-CFQD09Mi.js} +2 -2
- package/dist/ui/assets/ganttDiagram-LVOFAZNH-CFQD09Mi.js.gz +0 -0
- package/dist/ui/assets/{gitGraph-F6HP7TQM-DghoobE6.js → gitGraph-F6HP7TQM-CfFE_uAC.js} +1 -1
- package/dist/ui/assets/{gitGraphDiagram-NY62KEGX-Clqpiswu.js → gitGraphDiagram-NY62KEGX-CaVoxU4C.js} +1 -1
- package/dist/ui/assets/gitGraphDiagram-NY62KEGX-CaVoxU4C.js.gz +0 -0
- package/dist/ui/assets/index-BN5_Qq7R.js +324 -0
- package/dist/ui/assets/index-BN5_Qq7R.js.gz +0 -0
- package/dist/ui/assets/index-DxuPq13l.css +1 -0
- package/dist/ui/assets/index-DxuPq13l.css.gz +0 -0
- package/dist/ui/assets/{info-NVLQJR56-0ZldEXPQ.js → info-NVLQJR56-i_xHYg3f.js} +1 -1
- package/dist/ui/assets/{infoDiagram-ER5ION4S-DMmPX-il.js → infoDiagram-ER5ION4S-2NL93b78.js} +1 -1
- package/dist/ui/assets/{journeyDiagram-XKPGCS4Q-CrVickA2.js → journeyDiagram-XKPGCS4Q-CZF-2DHU.js} +1 -1
- package/dist/ui/assets/journeyDiagram-XKPGCS4Q-CZF-2DHU.js.gz +0 -0
- package/dist/ui/assets/{kanban-definition-3W4ZIXB7-C_BsdHYL.js → kanban-definition-3W4ZIXB7-CfvJIOny.js} +1 -1
- package/dist/ui/assets/kanban-definition-3W4ZIXB7-CfvJIOny.js.gz +0 -0
- package/dist/ui/assets/{line-CfBP7Yic.js → line-DDv8kOJk.js} +1 -1
- package/dist/ui/assets/{linear-BsjageUB.js → linear-Daef-l29.js} +1 -1
- package/dist/ui/assets/linear-Daef-l29.js.gz +0 -0
- package/dist/ui/assets/{mermaid-parser.core-DZdP-NFq.js → mermaid-parser.core-CdK9QgYV.js} +2 -2
- package/dist/ui/assets/mermaid-parser.core-CdK9QgYV.js.gz +0 -0
- package/dist/ui/assets/{mermaid.core-TNrI0pHG.js → mermaid.core-D6GS9mU-.js} +3 -3
- package/dist/ui/assets/mermaid.core-D6GS9mU-.js.gz +0 -0
- package/dist/ui/assets/message-SqLqNYcv.js +36 -0
- package/dist/ui/assets/message-SqLqNYcv.js.gz +0 -0
- package/dist/ui/assets/{mindmap-definition-VGOIOE7T-BbmaUjMY.js → mindmap-definition-VGOIOE7T-Cb3QMflX.js} +1 -1
- package/dist/ui/assets/mindmap-definition-VGOIOE7T-Cb3QMflX.js.gz +0 -0
- package/dist/ui/assets/{packet-BFZMPI3H-D_ZhkXuT.js → packet-BFZMPI3H-Bm2uwz4i.js} +1 -1
- package/dist/ui/assets/{particles-Dv28pjOd.js → particles-DsJFOarW.js} +1 -1
- package/dist/ui/assets/particles-DsJFOarW.js.gz +0 -0
- package/dist/ui/assets/{pie-7BOR55EZ-Dn0Q3qNx.js → pie-7BOR55EZ-5i17tVnF.js} +1 -1
- package/dist/ui/assets/{pieDiagram-ADFJNKIX-BbyjfYu8.js → pieDiagram-ADFJNKIX-BxIwQWvw.js} +1 -1
- package/dist/ui/assets/pieDiagram-ADFJNKIX-BxIwQWvw.js.gz +0 -0
- package/dist/ui/assets/{quadrantDiagram-AYHSOK5B-Bc3GqMKz.js → quadrantDiagram-AYHSOK5B-B5HPe4ga.js} +1 -1
- package/dist/ui/assets/quadrantDiagram-AYHSOK5B-B5HPe4ga.js.gz +0 -0
- package/dist/ui/assets/{radar-NHE76QYJ-BHwoAy1q.js → radar-NHE76QYJ-BTn-tq0k.js} +1 -1
- package/dist/ui/assets/{reactflow-BVYPxNhc.js → reactflow-Bf74ngoo.js} +2 -2
- package/dist/ui/assets/reactflow-Bf74ngoo.js.gz +0 -0
- package/dist/ui/assets/{requirementDiagram-UZGBJVZJ-BQaKKL09.js → requirementDiagram-UZGBJVZJ-YfI6llkX.js} +1 -1
- package/dist/ui/assets/requirementDiagram-UZGBJVZJ-YfI6llkX.js.gz +0 -0
- package/dist/ui/assets/{sandpack-BQW_FQ7G.js → sandpack-D7koO5op.js} +1 -1
- package/dist/ui/assets/sandpack-D7koO5op.js.gz +0 -0
- package/dist/ui/assets/{sankeyDiagram-TZEHDZUN-DiJvDvhb.js → sankeyDiagram-TZEHDZUN-DOk_B10B.js} +1 -1
- package/dist/ui/assets/sankeyDiagram-TZEHDZUN-DOk_B10B.js.gz +0 -0
- package/dist/ui/assets/{sequenceDiagram-WL72ISMW-Dw32824o.js → sequenceDiagram-WL72ISMW-DAe4Um17.js} +1 -1
- package/dist/ui/assets/sequenceDiagram-WL72ISMW-DAe4Um17.js.gz +0 -0
- package/dist/ui/assets/{stateDiagram-FKZM4ZOC-BCOpNdHV.js → stateDiagram-FKZM4ZOC-CCesDu_C.js} +1 -1
- package/dist/ui/assets/stateDiagram-FKZM4ZOC-CCesDu_C.js.gz +0 -0
- package/dist/ui/assets/stateDiagram-v2-4FDKWEC3-CMlIrsoO.js +1 -0
- package/dist/ui/assets/{syntax-VJrU5BEu.js → syntax-C-M-8jOU.js} +1 -1
- package/dist/ui/assets/syntax-C-M-8jOU.js.gz +0 -0
- package/dist/ui/assets/{theme-DZtFA8b4.js → theme-BQZdiqwv.js} +1 -1
- package/dist/ui/assets/{timeline-definition-IT6M3QCI-Jh_WZzXv.js → timeline-definition-IT6M3QCI-D6P5txjT.js} +1 -1
- package/dist/ui/assets/timeline-definition-IT6M3QCI-D6P5txjT.js.gz +0 -0
- package/dist/ui/assets/{treemap-KMMF4GRG-CPYIgjxE.js → treemap-KMMF4GRG-Bitm3gy4.js} +1 -1
- package/dist/ui/assets/{knowledgeRoutes-CivaUqha.js → useUserLocalStorage-Ckb8HsIw.js} +1 -1
- package/dist/ui/assets/useUserLocalStorage-Ckb8HsIw.js.gz +0 -0
- package/dist/ui/assets/{xychartDiagram-PRI3JC2R-CERc7Rdb.js → xychartDiagram-PRI3JC2R-CsybjUbd.js} +1 -1
- package/dist/ui/assets/xychartDiagram-PRI3JC2R-CsybjUbd.js.gz +0 -0
- package/dist/ui/index.html +13 -11
- package/dist/ui/index.html.gz +0 -0
- package/package.json +10 -9
- package/dist/ui/assets/App-9s2WHM6S.js +0 -22
- package/dist/ui/assets/App-9s2WHM6S.js.gz +0 -0
- package/dist/ui/assets/App-BAdBsEnV.css.gz +0 -0
- package/dist/ui/assets/ArtifactConsentModal-ParNk5kW.js.gz +0 -0
- package/dist/ui/assets/ArtifactFullscreenPage-VQxLMCiN.js +0 -9
- package/dist/ui/assets/ArtifactFullscreenPage-VQxLMCiN.js.gz +0 -0
- package/dist/ui/assets/AutocompleteTextarea-3RchrIgk.js +0 -18
- package/dist/ui/assets/AutocompleteTextarea-3RchrIgk.js.gz +0 -0
- package/dist/ui/assets/CodeEditor.inner-D51Z_CLQ.js.gz +0 -0
- package/dist/ui/assets/ConversationView-Dyddw2b1.js +0 -34
- package/dist/ui/assets/ConversationView-Dyddw2b1.js.gz +0 -0
- package/dist/ui/assets/KnowledgePage-CdftslnF.js +0 -24
- package/dist/ui/assets/KnowledgePage-CdftslnF.js.gz +0 -0
- package/dist/ui/assets/MobileApp-BdBMpnJ1.js +0 -1
- package/dist/ui/assets/MobileApp-BdBMpnJ1.js.gz +0 -0
- package/dist/ui/assets/StreamdownDemoPage-B9wbgp2s.js.gz +0 -0
- package/dist/ui/assets/ThemeSwitcher-ubn6IOz9.js.gz +0 -0
- package/dist/ui/assets/antd-C-HfEC4E.js +0 -400
- package/dist/ui/assets/antd-C-HfEC4E.js.gz +0 -0
- package/dist/ui/assets/architecture-U656AL7Q-dkBewUpN.js +0 -1
- package/dist/ui/assets/architectureDiagram-VXUJARFQ-ChmZt3zk.js.gz +0 -0
- package/dist/ui/assets/blockDiagram-VD42YOAC-CzGHAHao.js.gz +0 -0
- package/dist/ui/assets/c4Diagram-YG6GDRKO-DscJyaWN.js.gz +0 -0
- package/dist/ui/assets/channel-DvRQqEqC.js +0 -1
- package/dist/ui/assets/chunk-55IACEB6-DojF2pZN.js +0 -1
- package/dist/ui/assets/chunk-ABZYJK2D-RzDCrjE6.js.gz +0 -0
- package/dist/ui/assets/chunk-AGHRB4JF-jidCS5Of.js.gz +0 -0
- package/dist/ui/assets/chunk-ATLVNIR6-BEIIfJtC.js.gz +0 -0
- package/dist/ui/assets/chunk-B4BG7PRW-B8b6dQQ2.js.gz +0 -0
- package/dist/ui/assets/chunk-DI55MBZ5-BfATX3V8.js.gz +0 -0
- package/dist/ui/assets/chunk-EXTU4WIE-BKt6lPJM.js +0 -1
- package/dist/ui/assets/chunk-HN2XXSSU-BCHvD80g.js.gz +0 -0
- package/dist/ui/assets/chunk-JA3XYJ7Z-Cp6dqHnY.js.gz +0 -0
- package/dist/ui/assets/chunk-JZLCHNYA-cKMooY3y.js.gz +0 -0
- package/dist/ui/assets/chunk-MI3HLSF2-BlzO5wOE.js.gz +0 -0
- package/dist/ui/assets/chunk-N4CR4FBY-pASDorUx.js +0 -2
- package/dist/ui/assets/chunk-N4CR4FBY-pASDorUx.js.gz +0 -0
- package/dist/ui/assets/chunk-QXUST7PY-C9l0muI0.js.gz +0 -0
- package/dist/ui/assets/chunk-QZHKN3VN-CZskCFCf.js +0 -1
- package/dist/ui/assets/chunk-S3R3BYOJ-VJiLzt2o.js.gz +0 -0
- package/dist/ui/assets/chunk-TZMSLE5B-DZwI0C_2.js.gz +0 -0
- package/dist/ui/assets/classDiagram-2ON5EDUG-BFASUbmZ.js +0 -1
- package/dist/ui/assets/classDiagram-v2-WZHVMYZB-BFASUbmZ.js +0 -1
- package/dist/ui/assets/cose-bilkent-S5V4N54A-Ipik-oSD.js.gz +0 -0
- package/dist/ui/assets/dagre-6UL2VRFP-BDpyWQnh.js.gz +0 -0
- package/dist/ui/assets/dagre-CgA4KhUX.js.gz +0 -0
- package/dist/ui/assets/diagram-PSM6KHXK-B4GRzxLJ.js.gz +0 -0
- package/dist/ui/assets/diagram-QEK2KX5R-BWPW28XI.js.gz +0 -0
- package/dist/ui/assets/diagram-S2PKOQOG-BIHhcGoV.js.gz +0 -0
- package/dist/ui/assets/editor-C-HJ7Yw0.js.gz +0 -0
- package/dist/ui/assets/emoji-D8F6B62m.js.gz +0 -0
- package/dist/ui/assets/erDiagram-Q2GNP2WA-ubTaAFcK.js.gz +0 -0
- package/dist/ui/assets/flowDiagram-NV44I4VS-BHLCTYjI.js.gz +0 -0
- package/dist/ui/assets/ganttDiagram-LVOFAZNH-ClC3pay1.js.gz +0 -0
- package/dist/ui/assets/gitGraphDiagram-NY62KEGX-Clqpiswu.js.gz +0 -0
- package/dist/ui/assets/index-D9OElx9A.css +0 -1
- package/dist/ui/assets/index-D9OElx9A.css.gz +0 -0
- package/dist/ui/assets/index-DxPuzG7E.js +0 -350
- package/dist/ui/assets/index-DxPuzG7E.js.gz +0 -0
- package/dist/ui/assets/journeyDiagram-XKPGCS4Q-CrVickA2.js.gz +0 -0
- package/dist/ui/assets/kanban-definition-3W4ZIXB7-C_BsdHYL.js.gz +0 -0
- package/dist/ui/assets/knowledgeRoutes-CivaUqha.js.gz +0 -0
- package/dist/ui/assets/linear-BsjageUB.js.gz +0 -0
- package/dist/ui/assets/mermaid-parser.core-DZdP-NFq.js.gz +0 -0
- package/dist/ui/assets/mermaid.core-TNrI0pHG.js.gz +0 -0
- package/dist/ui/assets/message-BtWWJ9Af.js +0 -36
- package/dist/ui/assets/message-BtWWJ9Af.js.gz +0 -0
- package/dist/ui/assets/mindmap-definition-VGOIOE7T-BbmaUjMY.js.gz +0 -0
- package/dist/ui/assets/particles-Dv28pjOd.js.gz +0 -0
- package/dist/ui/assets/pieDiagram-ADFJNKIX-BbyjfYu8.js.gz +0 -0
- package/dist/ui/assets/quadrantDiagram-AYHSOK5B-Bc3GqMKz.js.gz +0 -0
- package/dist/ui/assets/reactflow-BVYPxNhc.js.gz +0 -0
- package/dist/ui/assets/requirementDiagram-UZGBJVZJ-BQaKKL09.js.gz +0 -0
- package/dist/ui/assets/sandpack-BQW_FQ7G.js.gz +0 -0
- package/dist/ui/assets/sankeyDiagram-TZEHDZUN-DiJvDvhb.js.gz +0 -0
- package/dist/ui/assets/sequenceDiagram-WL72ISMW-Dw32824o.js.gz +0 -0
- package/dist/ui/assets/stateDiagram-FKZM4ZOC-BCOpNdHV.js.gz +0 -0
- package/dist/ui/assets/stateDiagram-v2-4FDKWEC3-Cuqwvgfg.js +0 -1
- package/dist/ui/assets/syntax-VJrU5BEu.js.gz +0 -0
- package/dist/ui/assets/timeline-definition-IT6M3QCI-Jh_WZzXv.js.gz +0 -0
- package/dist/ui/assets/xychartDiagram-PRI3JC2R-CERc7Rdb.js.gz +0 -0
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/CodeEditor.inner-DBgsP4tn.js","assets/rolldown-runtime--c01j_DQ.js","assets/sandpack-D7koO5op.js","assets/antd-CfbbHJOz.js","assets/editor-CzFWIUw2.js","assets/angular-html-HOxwNvyT.js","assets/html-B2jixUwZ.js","assets/css-DoNhQY6j.js","assets/javascript-B0z-AXw4.js","assets/angular-ts-Ov9R9Ljq.js","assets/scss-DbrHP5dI.js","assets/apl-CXOUvgw5.js","assets/json-DXfqaPEF.js","assets/xml-BGEfOfoz.js","assets/java-DUjKRM5T.js","assets/astro-CVgXjgWt.js","assets/postcss-BXeXVLqQ.js","assets/tsx-37JSciWV.js","assets/typescript-CdMIlDjx.js","assets/blade-BoqMnz_b.js","assets/html-derivative-DDwnamny.js","assets/sql-DF8Xc7bQ.js","assets/bsl-BkkzgIyY.js","assets/sdbl-bTVj8UrX.js","assets/c-DOayRvVf.js","assets/cairo-DLTphjLi.js","assets/python-gzcpVVnB.js","assets/cobol-Xel1q7J4.js","assets/coffee-CPGd8RFL.js","assets/cpp-DcSExVLf.js","assets/glsl-CDvScVSv.js","assets/regexp-B9Q6kuZt.js","assets/crystal-DSuicNBl.js","assets/shellscript-DmsGrsQL.js","assets/edge-193c5yJY.js","assets/elixir-ND4M129Z.js","assets/elm-2Xpf1qa1.js","assets/erb-B3CzWkDu.js","assets/ruby-BGs-nVm6.js","assets/graphql-CLdnI2jj.js","assets/jsx-xIBTuBAZ.js","assets/haml-B_7gR2-C.js","assets/lua-CdPd6TdG.js","assets/yaml-Ce3AqKtC.js","assets/erlang-Cphh6RMH.js","assets/markdown-BYOwaDjH.js","assets/fortran-fixed-form-BJLMMyj_.js","assets/fortran-free-form-B3N2jM_P.js","assets/fsharp-D13ZGOAj.js","assets/gdresource-DJtKbqXX.js","assets/gdscript-CtYHxktr.js","assets/gdshader-CBce3t8t.js","assets/git-commit-BSykSTBG.js","assets/diff-woXpYk--.js","assets/git-rebase-CPlAfnUu.js","assets/glimmer-js-CxAZE7iu.js","assets/glimmer-ts-CNJweuJS.js","assets/hack-U_u3qiXF.js","assets/handlebars-CIGlWSZz.js","assets/http-BEmBIeh2.js","assets/hurl-BoVPi727.js","assets/csv-Dx-8-gkx.js","assets/hxml-B0Qn7Nwc.js","assets/haxe-OTjmBuCE.js","assets/jinja-DHg7q1DE.js","assets/jison-Bi4c9iNP.js","assets/julia-w0S0kN7z.js","assets/r-D6SIBEiO.js","assets/latex-ed26ywxS.js","assets/tex-C_btdDbR.js","assets/liquid-CAruNf-N.js","assets/marko-DJQST3lL.js","assets/less-DVTAwKKz.js","assets/mdc-BpPhzEd0.js","assets/nginx-D0L6l3UG.js","assets/nim-CXwZWzWk.js","assets/perl-Bu8Q5Bv6.js","assets/php-B4SpY2t5.js","assets/pug-BaOpKkdB.js","assets/qml-sjeCigfm.js","assets/razor-BDd5S6a7.js","assets/csharp-BEKXm5hI.js","assets/rst-BIVXRxMh.js","assets/cmake-Bj61d0ZC.js","assets/sas-B2Nr8S2D.js","assets/shaderlab-TOUzSsQk.js","assets/hlsl-Cvrh5tZx.js","assets/shellsession-BLlGThAF.js","assets/soy-y67J1JBf.js","assets/sparql-D_iOobhT.js","assets/turtle-ByJddavk.js","assets/stata-DWwtR4o7.js","assets/svelte-BVXg4aFm.js","assets/templ-B35jE-cr.js","assets/go-DNk2CfY5.js","assets/ts-tags-B1RVrAVr.js","assets/twig-BaTGNYMW.js","assets/vue-C1368MUJ.js","assets/vue-html-CMU60TJw.js","assets/vue-vine-B0ZobtBU.js","assets/stylus-B6D30XZt.js","assets/xsl-D3QHn1W2.js","assets/mermaid.core-D6GS9mU-.js","assets/chunk-JA3XYJ7Z-DbNDev3D.js","assets/reactflow-Bf74ngoo.js","assets/reactflow-8hax8RNO.css","assets/chunk-AGHRB4JF-DvxmfbM0.js","assets/chunk-S3R3BYOJ-CWMEa9Dc.js","assets/dist-CSqJezV7.js","assets/math-Bi_r_ZWc.js","assets/chunk-ABZYJK2D-BJcrryHK.js","assets/isArrayLikeObject-CjHW3d_5.js","assets/isEmpty-CyN-1FA0.js","assets/chunk-6MN3ZHY7-Chms2Ycd.js","assets/chunk-ATLVNIR6-DbeJ0OrR.js","assets/chunk-CVBHYZKI-B3EBSlb3.js","assets/chunk-EXTU4WIE-B3ObkuOm.js","assets/chunk-HN2XXSSU-Dttqcg3b.js","assets/chunk-JZLCHNYA-EUmx2y4H.js","assets/chunk-MI3HLSF2-65n9Mkyc.js","assets/chunk-N4CR4FBY-mv5koXqW.js","assets/chunk-QXUST7PY-BCYnMiS3.js","assets/line-DDv8kOJk.js","assets/path-BWPyau1x.js","assets/array-BifhSqXX.js","assets/katex-C_WiJGP_.css","assets/App-DcEY8Ota.js","assets/BoardObjectNodes-D-O6bZIG.js","assets/AutocompleteTextarea-BAFFH_5e.js","assets/message-SqLqNYcv.js","assets/__vite-browser-external-BBPYNvOp.js","assets/theme-BQZdiqwv.js","assets/emoji-Dkz4Zzv_.js","assets/AutocompleteTextarea-x1XGuNl0.css","assets/SessionCanvas-f1-1Gbcw.js","assets/ArtifactConsentModal-CiCbK9iv.js","assets/ThemeSwitcher-Dly2y9pi.js","assets/SessionCanvas-mEmYGZhC.css","assets/ConversationView-CUWR0gR6.js","assets/useUserLocalStorage-Ckb8HsIw.js","assets/xterm-BkujP7YO.js","assets/xterm-BrP-ENHg.css","assets/KnowledgePage-B2bzlXfn.js","assets/ArtifactFullscreenPage-CfsTEGKd.js","assets/MobileApp-VgVnsnsN.js","assets/StreamdownDemoPage-wzWaqWwr.js","assets/MarketingScreenshotPage-zv5RUCuV.js","assets/MarketingScreenshotPage-9Qd7eZsm.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{o as e,r as t,t as n}from"./rolldown-runtime--c01j_DQ.js";import{$ as r,$t as i,A as a,At as o,B as s,Bn as c,Bt as l,C as u,Cn as d,Ct as f,D as p,E as m,Et as h,F as g,Fn as _,Ft as v,G as y,Gn as b,Gt as x,H as S,Ht as C,I as w,In as T,It as E,J as D,Jn as O,Kn as k,Kt as A,Lt as j,Mn as M,Mt as N,N as P,Nn as ee,Nt as te,O as ne,On as re,Ot as ie,P as ae,Pn as F,Pt as I,Q as oe,Qn as se,Qt as ce,R as le,Rn as ue,Rt as de,Sn as fe,Tn as pe,Tt as me,U as he,Ut as ge,V as _e,Vt as ve,W as ye,Wn as be,Wt as xe,X as Se,Xn as Ce,Xt as we,Y as Te,Yn as Ee,Yt as De,Zt as L,_n as Oe,_t as ke,a as Ae,at as je,b as Me,bn as Ne,cn as R,d as Pe,dn as Fe,dt as Ie,fn as Le,gt as Re,h as ze,i as Be,in as Ve,j as He,jn as Ue,jt as We,l as Ge,ln as Ke,m as qe,mt as Je,n as Ye,nn as Xe,o as Ze,on as z,ot as Qe,pn as $e,pt as et,qn as tt,qt as nt,rn as rt,rt as it,s as at,sn as ot,tn as B,tt as st,u as ct,v as lt,vn as ut,vt as dt,w as ft,wn as V,wt as pt,xn as mt,y as ht,yn as gt,z as _t,zn as vt}from"./antd-CfbbHJOz.js";import{A as yt,B as bt,Ct as xt,D as St,E as Ct,F as wt,G as Tt,H as Et,I as Dt,L as Ot,M as kt,N as At,O as jt,P as Mt,R as Nt,S as Pt,St as Ft,T as It,Tt as Lt,V as Rt,W as zt,_ as Bt,_t as Vt,at as Ht,b as Ut,bt as Wt,c as Gt,ct as Kt,d as qt,f as Jt,ft as Yt,g as Xt,gt as Zt,h as Qt,ht as $t,i as en,j as tn,k as nn,m as rn,mt as an,n as on,o as sn,ot as cn,s as ln,st as un,t as dn,u as fn,v as pn,vt as mn,w as hn,wt as gn,x as _n,xt as vn,y as yn,yt as bn,z as xn}from"./message-SqLqNYcv.js";import{c as H,o as Sn,s as Cn}from"./sandpack-D7koO5op.js";import{N as wn}from"./editor-CzFWIUw2.js";import{n as Tn,r as En,t as Dn}from"./particles-DsJFOarW.js";import{a as On,i as kn,r as An}from"./emoji-Dkz4Zzv_.js";import{a as jn,c as Mn,d as Nn,f as Pn,i as Fn,l as In,n as Ln,o as Rn,p as zn,r as Bn,s as Vn,t as Hn,u as Un}from"./syntax-C-M-8jOU.js";import{n as Wn}from"./theme-BQZdiqwv.js";import{t as Gn}from"./katex-CamJ39w1.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var Kn={session:(e=>[e.title,e.description,e.agentic_tool]),branch:(e=>[e.name,e.ref,e.notes,e.issue_url,e.pull_request_url,an(e)?.displayName]),artifact:(e=>[e.name,e.description]),board:(e=>[e.name,e.description]),mcp:(e=>[e.name,e.display_name,e.description])};function qn(e,t){let n=e.map(e=>e.trim().toLowerCase()).filter(Boolean);if(n.length===0)return!1;let r=t.filter(e=>!!e).join(`
|
|
3
|
+
`).toLowerCase();return n.every(e=>r.includes(e))}function Jn(e){return e.trim().toLowerCase().split(/\s+/).filter(Boolean)}var Yn=Ce(),U=e(se(),1),W=wn(),Xn=(0,U.forwardRef)(({variant:e=`outlined`,...t},n)=>(0,W.jsx)(v,{ref:n,variant:e,...t}));Xn.displayName=`Tag`,v.CheckableTag;var Zn=Object.assign(Xn,{CheckableTag:v.CheckableTag}),Qn=`/ui/assets/cc-CYmbalCD.png`,$n=`/ui/assets/claude-code-cli-D5DHHf2_.png`,er=`/ui/assets/codex-4sLD1mVS.png`,tr=`/ui/assets/copilot-CI1k0esO.png`,nr=`/ui/assets/cursor-QEb7m-rN.png`,rr=`/ui/assets/gemini-ajOb7iAl.png`,ir=`data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAADWklEQVR4nGKRktJjGEyAaaAdgA5GHUQIjDqIEBh1ECEw6iBCYNRBhMCgcxALkeoc7C3zchK5ubnIsOP48bMNzf1EKmYkprYXEhI4enA9Hx/PxUvXDh859f//f+JdE+jvwcvLraXnTKR6okKoqCCVj4/n/v1HAUEpv37/Jt41/Hy8oSE+fRNmE6+FcBpSU1WKjQ5mYGC4fPUmSa5hYGCoqy188eLV/IWriNdCOIQa6gpZWJhJcgcE2NmaBwW4e/jE/f37j2oOcnW2tbezwCrFz8+XEB8qyM+HS6+Pj8uPHz8jw/0YYEnu379/O3YdOHX6IvkOqq7MxSU1a3q7srLC2nXbfvz4iVXB0mXr0UT0dDWXLJxkYOLx7dt3chzEwcGuqqqIVSrA393czNDVI+r2nQd4TEADQoL8ly/sERTgx+MgfImakZERqzg3N2dNVd6yFRtJcg0DAwMxiYmEklpIkB/CyMtJ4uPlmTBxDkmuIRIQW1IzMDBYWZqkpURdvnIjLSX6zNmLIiJCIiJCBHX9Z2C4d+/hz5+/iLQFX0nNyclx58ZhZJF/IPD/P8P////+MzD8hwEoC5chp05fCA5Lh5ST1y7vM7P0ffrsBS5LiQ2hHz9+5hfVb9+xn6RChYGBYeWyaSRVNfgchJyoG5r6tmzdS5JTGBgYHB0sLcwN3b1iiNdCVKJet3774qXrSHUNGxtrU33xvAUrb9y8CxFhZmYCpyp8AYYvhP7+/csADu2qmk40KStLYxNj/M0ERhtrUyUlee0Xr/NyEiFChgY6//79//zpC5kO+vnz17adB7w8HPfsXP7l61dkKSVFudNnLl2/cRuP9us3bkMUCAsLMjAw8HBzu7nYXrl26/OXr/j8gb89xMjIaKCvxcrKiizY1lz29dv3oNBUkhK4sLDg2ZPbCoobNmzciUcZgVz2////8xeuIosE+LvLykq5ekaTmt0a6grPX7iC3zWkFYwMDAwiwoItjSWNzRMePXpKkkZrKxN/P3dv3ziCKklzUFFh2rdvP46fPKugIEu8LilJ8e6O6tWrt1y+cpPKDrp+/ba7q926VbNI0vXnz9+jx07XNfYSo5ioRj49waDrl406iBAYdRAhMOogQmDUQYTAqIMIgUHnIEAAAAD//xjiMCmHkZcfAAAAAElFTkSuQmCC`,{useToken:ar}=I,or={"claude-code":Qn,"claude-code-cli":$n,codex:er,gemini:rr,opencode:ir,copilot:tr,cursor:nr},sr=new Set([`claude-code-cli`]),cr=({tool:e,size:t=32,className:n=``})=>{let{token:r}=ar(),i=or[e],a=sr.has(e)?`#fff`:`#000`;return i?(0,W.jsx)(`div`,{className:`tool-icon ${n}`,style:{width:t,height:t,borderRadius:`50%`,background:a,border:`1px solid ${r.colorBorder}`,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:t*.1,flexShrink:0,overflow:`hidden`},children:(0,W.jsx)(`img`,{src:i,alt:`${e} logo`,style:{width:`100%`,height:`100%`,objectFit:`contain`}})}):(0,W.jsx)(`div`,{className:`tool-icon ${n}`,style:{width:t,height:t,borderRadius:`50%`,background:a,border:`1px solid ${r.colorBorder}`,display:`flex`,alignItems:`center`,justifyContent:`center`,fontSize:t*.6,flexShrink:0},children:{"claude-code":`🤖`,codex:`💻`,gemini:`💎`,opencode:`🌐`,copilot:`✈️`,cursor:`⌘`}[e]||`🤖`})},lr=({agent:e,selected:t=!1,onClick:n})=>(0,W.jsx)(Ne,{hoverable:!0,onClick:n,style:{borderColor:t?`#1890ff`:void 0,borderWidth:t?2:1,cursor:`pointer`},styles:{body:{padding:12}},children:(0,W.jsxs)(z,{orientation:`vertical`,style:{width:`100%`},size:4,children:[(0,W.jsx)(z,{style:{width:`100%`,justifyContent:`space-between`},size:8,children:(0,W.jsxs)(z,{size:8,children:[(0,W.jsx)(cr,{tool:e.id,size:24}),(0,W.jsx)(o.Text,{strong:!0,style:{fontSize:`14px`},children:e.name}),e.beta&&(0,W.jsx)(Zn,{color:`warning`,children:`BETA`})]})}),e.version&&(0,W.jsxs)(o.Text,{type:`secondary`,style:{fontSize:`11px`},children:[`Version: `,e.version]}),e.description&&(0,W.jsx)(o.Text,{type:`secondary`,style:{fontSize:`12px`},children:e.description})]})}),{Text:ur}=o,dr=({agents:e,selectedAgentId:t,onSelect:n,variant:r=`cards`,columns:i=3,showHelperText:a=!1,helperText:o=`Click on an agent card to select it`,showComparisonLink:s=!1})=>r===`select`?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(F,{value:t??void 0,onChange:e=>n(e),style:{width:`100%`},options:e.map(e=>({value:e.id,label:(0,W.jsxs)(z,{size:8,children:[(0,W.jsx)(cr,{tool:e.id,size:16}),(0,W.jsx)(`span`,{children:e.name}),e.beta&&(0,W.jsx)(Zn,{color:`warning`,children:`BETA`})]})}))}),s&&(0,W.jsx)(fr,{})]}):(0,W.jsxs)(W.Fragment,{children:[a&&!t&&(0,W.jsx)(ur,{type:`secondary`,style:{fontSize:12,marginBottom:8,display:`block`},children:o}),(0,W.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(${i}, 1fr)`,gap:8,marginTop:8},children:e.map(e=>(0,W.jsx)(lr,{agent:e,selected:t===e.id,onClick:()=>n(e.id)},e.id))}),s&&(0,W.jsx)(fr,{})]}),fr=()=>(0,W.jsxs)(ur,{type:`secondary`,style:{fontSize:11,marginTop:8,display:`block`,textAlign:`center`},children:[`Compare features:`,` `,(0,W.jsx)(`a`,{href:`https://agor.live/guide/sdk-comparison`,target:`_blank`,rel:`noopener noreferrer`,children:`SDK Comparison Guide`})]}),pr=[{id:`claude-code`,name:`Claude Code`,icon:`🤖`,description:`Anthropic Claude coding agent`},{id:`codex`,name:`Codex`,icon:`💻`,description:`OpenAI Codex coding agent`},{id:`gemini`,name:`Gemini`,icon:`💎`,description:`Google Gemini coding agent`},{id:`opencode`,name:`OpenCode`,icon:`🌐`,description:`Open-source terminal AI with 75+ LLM providers`,beta:!0},{id:`cursor`,name:`Cursor SDK`,icon:`⌘`,description:`Cursor agentic runtime via the Cursor SDK`,beta:!0},{id:`copilot`,name:`GitHub Copilot`,icon:`✈️`,description:`GitHub Copilot agentic runtime`,beta:!0},{id:`claude-code-cli`,name:`Claude Code CLI`,icon:`🤖`,description:`Anthropic Claude CLI, billed to your Pro/Max subscription`,beta:!0}],mr={buildSha:null,userEmail:null};function hr(e){mr={...mr,...e}}function gr(){return mr}var _r=`https://github.com/preset-io/agor/issues/new`,vr=4e3;function yr(e){return e?e.match(/in\s+([A-Za-z0-9_$.]+)/)?.[1]??`unknown component`:`unknown component`}function br(e,t,n={}){let{buildSha:r,userEmail:i}=gr(),a=(n.now??new Date).toISOString(),o=n.href??(typeof window<`u`?window.location.href:`unknown`),s=n.userAgent??(typeof navigator<`u`?navigator.userAgent:`unknown`),c=yr(t?.componentStack);return[`## UI crash report`,``,`- **When:** ${a}`,`- **Where:** ${o}`,`- **Component:** ${c}`,`- **User:** ${i??`(not signed in)`}`,`- **Build:** ${r??`unknown`}`,`- **Browser:** ${s}`,`- **Error:** ${e.message||String(e)}`,``,`### Component stack`,"```",(t?.componentStack??`(unavailable)`).trim(),"```",``,`### Error stack`,"```",(e.stack??`(unavailable)`).trim(),"```",``].join(`
|
|
4
|
+
`)}function xr(e,t,n={}){let r=`UI crash: ${yr(t?.componentStack)} — ${e.message?.slice(0,80)??`unknown error`}`,i=br(e,t,n);return i.length>4e3&&(i=`${i.slice(0,vr)}\n\n_(truncated — see full report copied to clipboard)_`),`${_r}?${new URLSearchParams({title:r,body:i,labels:`bug`}).toString()}`}var{Title:Sr,Paragraph:Cr,Text:wr}=o;function Tr({error:e,errorInfo:t}){let{token:n}=I.useToken(),[r,i]=(0,U.useState)(!1),a=async()=>{await on(br(e,t))&&(i(!0),setTimeout(()=>i(!1),2e3))},o=()=>{window.location.reload()},s=xr(e,t),l=yr(t?.componentStack);return(0,W.jsx)(`div`,{style:{minHeight:`100vh`,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`2rem`,backgroundColor:n.colorBgLayout},children:(0,W.jsxs)(Ne,{style:{maxWidth:640,width:`100%`,textAlign:`center`},styles:{body:{padding:`2.5rem 2rem`}},children:[(0,W.jsx)(oe,{style:{fontSize:96,color:n.colorTextTertiary,marginBottom:n.marginLG}}),(0,W.jsx)(Sr,{level:2,style:{marginTop:0,marginBottom:n.marginXS},children:`Well, that wasn't supposed to happen.`}),(0,W.jsx)(Cr,{style:{color:n.colorTextSecondary,marginBottom:n.marginLG},children:`The UI hit an unexpected error and couldn't finish rendering. Reloading usually gets you going again. If it keeps happening, the report below will help us fix it.`}),(0,W.jsxs)(z,{wrap:!0,style:{justifyContent:`center`,marginBottom:n.marginLG},children:[(0,W.jsx)(V,{icon:(0,W.jsx)(We,{}),onClick:a,children:r?`Copied!`:`Copy error details`}),(0,W.jsx)(V,{icon:(0,W.jsx)(Se,{}),href:s,target:`_blank`,rel:`noopener noreferrer`,children:`Report on GitHub`}),(0,W.jsx)(V,{type:`primary`,icon:(0,W.jsx)(x,{}),onClick:o,children:`Reload page`})]}),(0,W.jsx)(c,{ghost:!0,items:[{key:`details`,label:(0,W.jsx)(wr,{type:`secondary`,children:`Show technical details`}),children:(0,W.jsxs)(`div`,{style:{textAlign:`left`},children:[(0,W.jsxs)(Cr,{style:{marginBottom:n.marginSM},children:[(0,W.jsx)(wr,{strong:!0,children:`Component:`}),` `,(0,W.jsx)(wr,{code:!0,children:l}),(0,W.jsx)(`br`,{}),(0,W.jsx)(wr,{strong:!0,children:`Error:`}),` `,(0,W.jsx)(wr,{code:!0,children:e.message||String(e)})]}),(0,W.jsx)(`pre`,{style:{maxHeight:240,overflow:`auto`,fontSize:12,padding:n.paddingSM,backgroundColor:n.colorBgContainerDisabled,borderRadius:n.borderRadiusSM,margin:0},children:(t?.componentStack??e.stack??`(no stack available)`).trim()})]})}]})]})})}var Er=class extends U.Component{state={error:null,errorInfo:null,resetKey:this.props.resetKey};static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return e.resetKey===t.resetKey?null:{error:null,errorInfo:null,resetKey:e.resetKey}}componentDidCatch(e,t){console.error(`ErrorBoundary caught render error:`,e,t.componentStack),this.setState({errorInfo:t})}render(){let{error:e,errorInfo:t}=this.state,{variant:n=`scoped`,fallbackTitle:r,children:i}=this.props;return e?n===`global`?(0,W.jsx)(Tr,{error:e,errorInfo:t}):(0,W.jsx)(k,{type:`error`,showIcon:!0,title:r??`Something went wrong rendering this view.`,description:e.message||String(e)}):i}},{Text:Dr}=o;function Or({open:e,user:t,onChangePassword:n,onLogout:r}){let[i]=B.useForm(),[a,o]=(0,U.useState)(!1),[s,c]=(0,U.useState)(null),{token:l}=I.useToken();return(0,W.jsxs)(nt,{title:(0,W.jsxs)(`span`,{children:[(0,W.jsx)(Ye,{style:{color:l.colorWarning,marginRight:8}}),`Password Change Required`]}),open:e,onOk:async()=>{if(t)try{let e=await i.validateFields();o(!0),c(null),await n(t.user_id,e.newPassword),i.resetFields()}catch(e){e instanceof Error&&c(e.message)}finally{o(!1)}},okText:`Change Password`,cancelText:`Logout`,onCancel:r,confirmLoading:a,closable:!1,mask:{closable:!1},keyboard:!1,width:400,children:[(0,W.jsx)(k,{type:`warning`,title:`Your administrator requires you to change your password before continuing.`,style:{marginBottom:24},showIcon:!0}),s&&(0,W.jsx)(k,{type:`error`,title:s,style:{marginBottom:16},showIcon:!0,closable:!0,onClose:()=>c(null)}),(0,W.jsxs)(B,{form:i,layout:`vertical`,children:[(0,W.jsx)(B.Item,{name:`newPassword`,label:`New Password`,rules:[{required:!0,message:`Please enter a new password`},{min:8,message:`Password must be at least 8 characters`}],children:(0,W.jsx)(L.Password,{prefix:(0,W.jsx)(_t,{style:{color:l.colorTextQuaternary}}),placeholder:`Enter new password`,autoComplete:`new-password`})}),(0,W.jsx)(B.Item,{name:`confirmPassword`,label:`Confirm Password`,dependencies:[`newPassword`],rules:[{required:!0,message:`Please confirm your password`},({getFieldValue:e})=>({validator(t,n){return!n||e(`newPassword`)===n?Promise.resolve():Promise.reject(Error(`Passwords do not match`))}})],children:(0,W.jsx)(L.Password,{prefix:(0,W.jsx)(_t,{style:{color:l.colorTextQuaternary}}),placeholder:`Confirm new password`,autoComplete:`new-password`})})]}),(0,W.jsx)(Dr,{type:`secondary`,style:{fontSize:12},children:`After changing your password, you will be able to continue using the application.`})]})}var kr=new Set([`sessions`,`branches`,`boards`,`repos`,`users`,`mcp-servers`,`artifacts`]);function Ar({phase:e=`loading`,connecting:t=!1,loadingStage:n=`fetching`,items:r=[],message:i}){let{token:a}=I.useToken(),[s,c]=(0,U.useState)(!1),l=i??(t?`Connecting to daemon…`:n===`indexing`?`Indexing workspace data…`:`Loading workspace data…`),u=!t&&r.length>0,d=r.filter(e=>kr.has(e.key)),f=r.filter(e=>!kr.has(e.key)),p=f.filter(e=>e.done).length,m=f.length-p,h=m>0?`Show details (${m} pending)`:`Show details (${p}/${f.length} loaded)`,g=({key:e,label:t,done:n,count:r})=>(0,W.jsxs)(Ve,{align:`center`,justify:`space-between`,gap:a.sizeSM,children:[(0,W.jsxs)(Ve,{align:`center`,gap:a.sizeSM,children:[(0,W.jsx)(Ve,{align:`center`,justify:`center`,style:{width:a.sizeMD},children:n?(0,W.jsx)(O,{style:{color:a.colorSuccess}}):(0,W.jsx)(De,{size:`small`})}),(0,W.jsx)(o.Text,{type:n?`secondary`:void 0,disabled:!n,children:t})]}),(0,W.jsx)(Zn,{color:n?`success`:void 0,variant:`filled`,style:{marginInlineEnd:0,minWidth:28,textAlign:`center`},children:r})]},e);return(0,W.jsxs)(Ve,{vertical:!0,align:`center`,justify:`center`,style:{minHeight:`100vh`,backgroundColor:a.colorBgLayout,opacity:e===`fading`?0:1,transition:`opacity 280ms ease-out`},children:[(0,W.jsx)(De,{size:`large`}),(0,W.jsx)(o.Text,{type:`secondary`,style:{marginTop:a.marginMD},children:l}),u&&(0,W.jsxs)(Ve,{vertical:!0,gap:a.sizeXXS,style:{marginTop:a.marginLG,minWidth:200},children:[d.map(g),f.length>0&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(V,{type:`link`,size:`small`,onClick:()=>c(e=>!e),style:{alignSelf:`center`,paddingInline:0},children:s?`Hide details`:h}),s&&f.map(g)]})]})]})}var jr={name:`Agor`,markFile:`favicon.png`,titleSeparator:` · `};function Mr(e=`/ui/`){return`${e}${jr.markFile}`}function Nr(e){return e?`${e}${jr.titleSeparator}${jr.name}`:jr.name}var Pr={1:`43px`,2:`34px`,3:`27px`,4:`23px`,5:`18px`},Fr=({level:e=3,style:t,className:n})=>(0,W.jsx)(`h1`,{className:n,style:{margin:0,fontSize:Pr[e],lineHeight:1.35,background:`linear-gradient(90deg, #2e9a92 0%, #7fe8df 50%, #a8f5ed 100%)`,WebkitBackgroundClip:`text`,WebkitTextFillColor:`transparent`,backgroundClip:`text`,fontWeight:700,width:`fit-content`,...t},children:`agor`}),Ir={background:{color:{value:`transparent`}},fpsLimit:60,interactivity:{events:{onHover:{enable:!0,mode:`attract`},resize:{enable:!0}},modes:{attract:{distance:200,duration:.4,speed:3}}},particles:{color:{value:`#2e9a92`},links:{color:`#2e9a92`,distance:150,enable:!0,opacity:.2,width:1},move:{direction:`none`,enable:!0,outModes:{default:`bounce`},random:!1,speed:1,straight:!1},number:{density:{enable:!0,width:1920,height:1080},value:150},opacity:{value:.4},shape:{type:`circle`},size:{value:{min:1,max:3}}},detectRetina:!0},Lr=t({ParticleBackground:()=>Rr}),Rr=(0,U.memo)(function(){let e=(0,U.useId)(),[t,n]=(0,U.useState)(!1);return(0,U.useEffect)(()=>{Tn(async e=>{await Dn(e)}).then(()=>{n(!0)})},[]),t?(0,W.jsx)(En,{id:e,particlesLoaded:async e=>{},options:Ir,style:{position:`absolute`,width:`100%`,height:`100%`,top:0,left:0,zIndex:0}}):null}),{Text:zr}=o;function Br(){return typeof window>`u`?null:`${window.location.pathname.startsWith(`//`)?`/`:window.location.pathname}${window.location.search}${window.location.hash}`}function Vr(e){let t=Br();if(!t)return e;try{let n=new URL(e);return n.searchParams.set(`return_to`,t),n.toString()}catch{return e}}function Hr({onLogin:e,loading:t=!1,error:n,externalLaunchLoginRedirectUrl:r}){let[i]=B.useForm(),[a,o]=(0,U.useState)(!1),[s,c]=(0,U.useState)(!1),{token:l}=I.useToken(),u=!!r,d=r?Vr(r):void 0,f=!u||s,p=n?.startsWith(`Launch sign-in failed`)??!1;return(0,W.jsxs)(`div`,{style:{minHeight:`100dvh`,width:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 50%, #0f1f1e 100%)`,padding:`16px`,position:`relative`,overflow:`auto`},children:[(0,W.jsx)(Rr,{}),(0,W.jsx)(`a`,{href:`https://particles.js.org`,target:`_blank`,rel:`noopener noreferrer`,style:{position:`fixed`,bottom:16,right:16,fontSize:10,color:`rgba(46, 154, 146, 0.3)`,textDecoration:`none`,zIndex:0,transition:`color 0.3s`},onMouseEnter:e=>{e.currentTarget.style.color=`rgba(46, 154, 146, 0.6)`},onMouseLeave:e=>{e.currentTarget.style.color=`rgba(46, 154, 146, 0.3)`},children:`🤍 tsparticles`}),(0,W.jsxs)(Ne,{style:{width:`100%`,maxWidth:420,borderRadius:12,boxShadow:`0 8px 32px rgba(0, 0, 0, 0.4)`,position:`relative`,zIndex:1,margin:`auto`},variant:`borderless`,children:[(0,W.jsx)(z,{orientation:`vertical`,size:`large`,style:{width:`100%`,marginBottom:24},children:(0,W.jsxs)(`div`,{style:{textAlign:`center`},children:[(0,W.jsx)(`img`,{src:Mr(),alt:jr.name,style:{width:72,height:72,marginBottom:16,objectFit:`cover`,borderRadius:`50%`,display:`block`,margin:`0 auto 16px`}}),(0,W.jsx)(`div`,{style:{display:`flex`,justifyContent:`center`,marginBottom:12},children:(0,W.jsx)(Fr,{level:1})}),(0,W.jsx)(`div`,{children:(0,W.jsx)(zr,{type:`secondary`,children:`Team command center for all things agentic`})}),(0,W.jsx)(Oe,{style:{margin:`16px 0 0 0`}})]})}),n&&(0,W.jsx)(k,{type:`error`,title:p?`Launch sign-in failed`:`Login Failed`,description:n,showIcon:!0,closable:!0,style:{marginBottom:24}}),u&&(0,W.jsxs)(z,{orientation:`vertical`,size:`middle`,style:{width:`100%`,marginBottom:24},children:[!n&&(0,W.jsx)(k,{type:`info`,title:`Open from your workspace`,description:`This runtime is configured for external launch sign-in. Return to your workspace to open a fresh launch link.`,showIcon:!0}),(0,W.jsx)(V,{type:`primary`,href:d,block:!0,"data-testid":`external-launch-return`,children:`Return to workspace`}),!s&&(0,W.jsx)(V,{type:`link`,block:!0,onClick:()=>c(!0),children:`Use local login instead`})]}),f&&(0,W.jsxs)(W.Fragment,{children:[u&&(0,W.jsx)(Oe,{style:{margin:`0 0 24px 0`},children:`Local login`}),(0,W.jsxs)(B,{form:i,name:`login`,layout:`vertical`,onFinish:async t=>{o(!0);try{await e(t.email,t.password)}finally{o(!1)}},autoComplete:`off`,children:[(0,W.jsx)(B.Item,{name:`email`,rules:[{required:!0,message:`Please enter your email`},{type:`email`,message:`Please enter a valid email`}],children:(0,W.jsx)(L,{prefix:(0,W.jsx)(w,{style:{color:l.colorTextQuaternary}}),placeholder:`Email address`,autoComplete:`email`})}),(0,W.jsx)(B.Item,{name:`password`,rules:[{required:!0,message:`Please enter your password`}],children:(0,W.jsx)(L.Password,{prefix:(0,W.jsx)(_t,{style:{color:l.colorTextQuaternary}}),placeholder:`Password`,autoComplete:`current-password`})}),(0,W.jsx)(B.Item,{style:{marginBottom:8},children:(0,W.jsx)(V,{type:`primary`,htmlType:`submit`,loading:a||t,block:!0,children:`Sign In`})})]})]})]})]})}var Ur=`preset-io/agor-assistant`,Wr=`https://github.com/preset-io/agor-assistant.git`;function Gr(e){let t,n;for(let r of e){if(r.slug?.includes(`agor-assistant-private`)||r.remote_url?.includes(`agor-assistant-private`))return r;!t&&r.slug===`preset-io/agor-assistant`&&(t=r),!n&&(r.remote_url?.includes(`agor-assistant`)||r.remote_url?.includes(`agor-openclaw`))&&(n=r)}return t||n}function Kr(e){return(0,U.useMemo)(()=>Gr(e),[e])}function qr(e,t){let n=[],r=new Map;for(let i of e){let e=i[1];t?.readyOnly&&e.clone_status!==`ready`&&e.clone_status!==void 0||(n.push(e),r.set(e.repo_id,i))}let i=Gr(n);if(i)return r.get(i.repo_id)}function Jr(e){let t=[`### First boot instructions for Agor Assistant`,``,`Context:`,`- Assistant: ${e.assistant.displayName} ${e.assistant.emoji}`];return e.assistant.description&&t.push(`- Assistant description: ${e.assistant.description}`),e.user?.name?t.push(`- User: ${e.user.name}${e.user.email?` <${e.user.email}>`:``}`):e.user?.email&&t.push(`- User email: ${e.user.email}`),t.push(``),t.push(`Read BOOTSTRAP.md, then say hello and ask only the next useful questions to shape this assistant.`),t.join(`
|
|
5
|
+
`)}function Yr({displayName:e,emoji:t,description:n,userName:r,userEmail:i}){let a=r?.trim(),o=i?.trim();return{assistant:{displayName:e.trim()||`My Assistant`,emoji:t?.trim()||`🤖`,...n?.trim()?{description:n.trim()}:{}},...a||o?{user:{...a?{name:a}:{},...o?{email:o}:{}}}:{},firstSession:!0}}function Xr(e){return Jr(Yr(e))}async function Zr({client:e,boardId:t,assistantName:n,assistantEmoji:r}){if(!(!e||!t))try{await e.service(`boards`).ensureAssistantWelcomeNote({boardId:t,assistantName:n,assistantEmoji:r})}catch(e){console.warn(`Failed to create assistant welcome note:`,e)}}function Qr(e){if(!e)return``;let t=e.replace(/\\/g,`/`).split(`/`).filter(Boolean),n=t[t.length-1]||``;if(!n)return``;let r=n.trim().toLowerCase().replace(/[^a-z0-9._-]+/g,`-`).replace(/^-+|-+$/g,``);return r?`local/${r}`:``}function $r(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``)}var ei=e=>new Promise(t=>setTimeout(t,e));async function ti(e,t,{timeoutMs:n=3e4,intervalMs:r=500}={}){if(!e)return;let i=Date.now()+n,a;for(;Date.now()<i;){let n=await e.service(`branches`).get(t);if(a=n.filesystem_status,!a||a===`ready`)return;if(a===`failed`)throw Error(n.error_message||`Branch filesystem creation failed`);if(a===`deleted`||a===`cleaned`||a===`preserved`)throw Error(`Branch filesystem is ${a}`);await ei(r)}throw Error(`Timed out waiting for branch filesystem to become ready (${a})`)}async function ni({client:e,branchId:t,boardId:n,sessionConfig:r,onCreateSession:i,onStatusChange:a}){a?.(`Preparing assistant worktree…`),await ti(e,t),a?.(`Starting first session…`);let o=await i(r,n);if(!o)throw Error(`First assistant session could not be created.`);return o}var ri=({onEmojiClick:e})=>(0,W.jsx)(An,{onEmojiClick:e,theme:On.DARK,emojiStyle:kn.NATIVE,width:350,height:400}),ii=({value:e,onChange:t,defaultEmoji:n=`📋`,disabled:r=!1})=>{let[i,a]=(0,U.useState)(!1);return(0,W.jsxs)(`div`,{style:{display:`flex`,gap:0},children:[(0,W.jsx)(L,{prefix:(0,W.jsx)(`span`,{style:{fontSize:14},children:e||n}),readOnly:!0,disabled:r,style:{cursor:`default`,width:40,borderTopRightRadius:0,borderBottomRightRadius:0}}),(0,W.jsx)(Ue,{content:(0,W.jsx)(ri,{onEmojiClick:e=>{t?.(e.emoji),a(!1)}}),trigger:r?[]:`click`,open:r?!1:i,onOpenChange:e=>{r||a(e)},placement:`right`,children:(0,W.jsx)(V,{icon:(0,W.jsx)(lt,{}),disabled:r,style:{borderTopLeftRadius:0,borderBottomLeftRadius:0,borderLeft:`none`}})})]})},ai=({fieldName:e,defaultEmoji:t})=>(0,W.jsx)(B.Item,{name:e,noStyle:!0,initialValue:t,children:(0,W.jsx)(ii,{defaultEmoji:t})}),{Text:oi,Title:si,Paragraph:ci}=o,{useToken:li}=I,ui=12e4;function di(e){return e.toLowerCase().replace(/[^a-z0-9-]/g,`-`).replace(/-{2,}/g,`-`).replace(/^-|-$/g,``)}function fi(e){return di(`private-${$r(e.trim()||`My Assistant`)||`my-assistant`}`)}function pi(e){return qr(e,{readyOnly:!0})}function mi(e,t=`api-key`){return e===`claude-code`&&t===`claude-subscription-token`?`CLAUDE_CODE_OAUTH_TOKEN`:Yt[e]??`ANTHROPIC_API_KEY`}function hi(e,t=`api-key`){return e===`claude-code`&&t===`claude-subscription-token`?`sk-ant-oat01-...`:e===`codex`?`sk-...`:e===`gemini`?`AIza...`:e===`copilot`?`ghp_...`:e===`cursor`?`key_...`:`sk-ant-...`}var gi={"claude-code":`Claude Code`,"claude-code-cli":`Claude Code CLI`,codex:`Codex`,gemini:`Gemini`,opencode:`OpenCode`,copilot:`GitHub Copilot`,cursor:`Cursor SDK`},_i=[{value:`claude-code`,title:`Claude Code`,eyebrow:`Recommended`},{value:`codex`,title:`Codex`,eyebrow:`Recommended`}],vi=[{value:`gemini`,label:`Gemini`},{value:`copilot`,label:`GitHub Copilot`},{value:`opencode`,label:`OpenCode`},{value:`cursor`,label:`Cursor SDK (Beta)`}],yi=new Set(_i.map(e=>e.value)),bi={"claude-code":{label:`platform.claude.com/settings/keys`,url:`https://platform.claude.com/settings/keys`},"claude-code-cli":{label:`platform.claude.com/settings/keys`,url:`https://platform.claude.com/settings/keys`},codex:{label:`platform.openai.com/api-keys`,url:`https://platform.openai.com/api-keys`},gemini:{label:`aistudio.google.com`,url:`https://aistudio.google.com/apikey`},copilot:{label:`github.com/features/copilot`,url:`https://github.com/features/copilot`},cursor:{label:`cursor.com`,url:`https://cursor.com`},opencode:null};function xi(e){return e===`codex`?`codex-cli-auth`:`api-key`}function Si(e){if(e?.model)return{mode:e.mode??`exact`,model:e.model,...e.advisorModel?{advisorModel:e.advisorModel}:{}}}function Ci(e){return e===`claude-code`?[{value:`claude-subscription-token`,label:`Subscription`},{value:`api-key`,label:`API key`}]:e===`codex`?[{value:`codex-cli-auth`,label:`CLI sign-in`},{value:`api-key`,label:`API key`}]:null}function wi({open:e,onComplete:t,repoById:n,branchById:r,boardById:i,user:a,client:s,onCreateRepo:c,onCreateBranch:l,onCreateSession:u,onUpdateUser:f,onCheckAuth:p,frameworkRepoUrl:m}){let{token:h}=li(),[g,_]=(0,U.useState)(`identity`),[y,b]=(0,U.useState)(`My Assistant`),[x,S]=(0,U.useState)(`🤖`),[C,w]=(0,U.useState)(`claude-code`),[T,E]=(0,U.useState)(`claude-code`),[D,O]=(0,U.useState)(!1),[A,j]=(0,U.useState)(`api-key`),[M,N]=(0,U.useState)(``),[P,ee]=(0,U.useState)(!1),[te,ne]=(0,U.useState)(null),[re,ie]=(0,U.useState)(!1),[ae,I]=(0,U.useState)(`idle`),[oe,se]=(0,U.useState)(``),[ce,le]=(0,U.useState)(null),ue=(0,U.useRef)(null),de=(0,U.useRef)(null),fe=(0,U.useRef)(new Set),pe=m||`https://github.com/preset-io/agor-assistant.git`,me=(0,U.useMemo)(()=>fi(y),[y]),he=(0,U.useCallback)(e=>{if(!a)return;let t=a.preferences?.onboarding||{},n={...a.preferences,onboarding:{...t,...e}};e.boardId&&(n.mainBoardId=e.boardId),f(a.user_id,{preferences:n})},[f,a]);(0,U.useEffect)(()=>{if(!e||!a)return;let t=a.preferences?.onboarding;typeof t?.assistantDisplayName==`string`&&b(t.assistantDisplayName||`My Assistant`),typeof t?.assistantEmoji==`string`&&S(t.assistantEmoji||`🤖`)},[e,a]),(0,U.useEffect)(()=>()=>{ue.current&&clearTimeout(ue.current)},[]);let ge=(0,U.useCallback)(e=>{let t=a?.agentic_tools?.[`claude-code`],n=a?.agentic_tools?.codex,r=a?.agentic_tools?.gemini,i=a?.agentic_tools?.copilot,o=a?.agentic_tools?.cursor,s=!!(t?.ANTHROPIC_API_KEY||t?.CLAUDE_CODE_OAUTH_TOKEN||a?.env_vars?.ANTHROPIC_API_KEY),c=!!(n?.OPENAI_API_KEY||a?.env_vars?.OPENAI_API_KEY),l=!!(r?.GEMINI_API_KEY||a?.env_vars?.GEMINI_API_KEY),u=!!(i?.COPILOT_GITHUB_TOKEN||a?.env_vars?.COPILOT_GITHUB_TOKEN),d=!!(o?.CURSOR_API_KEY||a?.env_vars?.CURSOR_API_KEY);return e===`claude-code`?s:e===`codex`?c:e===`gemini`?l:e===`copilot`?u:e===`cursor`?d:e===`opencode`?s||c||l:!1},[a]),ve=(0,U.useCallback)(()=>{N(``),le(null),ne(null),ee(!1)},[]),ye=(0,U.useCallback)((e,t={})=>{w(e),j(xi(e)),yi.has(e)&&E(e),O(t.useDifferentProvider??!yi.has(e)),ve()},[ve]),be=(0,U.useCallback)(e=>{let t=a?.default_agentic_config?.[C],n=t?.permissionMode??Tt(C),r={branch_id:e,agent:C,initialPrompt:Xr({displayName:y.trim()||`My Assistant`,emoji:x||`🤖`,userName:a?.name,userEmail:a?.email}),modelConfig:Si(t?.modelConfig),effort:t?.modelConfig?.effort,mcpServerIds:t?.mcpServerIds,permissionMode:n};if(C===`codex`){let e=wt(n);r.codexSandboxMode=t?.codexSandboxMode??e.sandboxMode,r.codexApprovalPolicy=t?.codexApprovalPolicy??e.approvalPolicy,r.codexNetworkAccess=t?.codexNetworkAccess??e.networkAccess}return r},[y,x,C,a]),Se=(0,U.useCallback)(async e=>{if(de.current!==e){de.current=e,ue.current&&=(clearTimeout(ue.current),null);try{le(null),he({repoId:e}),I(`board`),se(`Creating your assistant board…`);let r=a?.preferences?.mainBoardId,o=r&&a&&i.get(r)?.created_by===a.user_id?r:null;if(o||=(await s?.service(`boards`).create({name:`${y.trim()||`My Assistant`}'s Board`,icon:x||`🤖`}))?.board_id??null,!o)throw Error(`Failed to create assistant board.`);he({boardId:o}),await Zr({client:s,boardId:o,assistantName:y.trim()||`My Assistant`,assistantEmoji:x}),I(`branch`),se(`Creating the default assistant branch…`);let c=n.get(e)?.default_branch||`main`,d={kind:`assistant`,displayName:y.trim()||`My Assistant`,emoji:x||void 0,frameworkRepo:Ur,createdViaOnboarding:!0},f=await l(e,{name:me,ref:me,createBranch:!0,sourceBranch:c,pullLatest:!0,boardId:o,custom_context:{assistant:d}});if(!f?.branch_id)throw Error(`Failed to create assistant branch.`);he({branchId:f.branch_id}),await s?.service(`boards`).setPrimaryAssistant({boardId:o,branchId:f.branch_id}),I(`session`),se(`Starting your assistant…`);let p=await ni({client:s,branchId:f.branch_id,boardId:o,sessionConfig:be(f.branch_id),onCreateSession:u,onStatusChange:se});I(`done`),se(`Opening your assistant…`),t({branchId:f.branch_id,sessionId:p,boardId:o,path:`assistant`})}catch(e){de.current=null,I(`error`),le(e instanceof Error?e.message:String(e))}}},[y,x,i,be,s,me,t,l,u,n,he,a]),Ce=(0,U.useCallback)(async()=>{_(`loading`),I(`cloning`),se(`Cloning assistant framework…`),le(null),de.current=null;let e=pi(n);if(e){se(`Preparing assistant workspace…`),Se(e[0]);return}fe.current=new Set(Array.from(n.values()).filter(e=>e.clone_status===`failed`).map(e=>e.repo_id));try{await c({url:pe,slug:Ur,default_branch:`main`}),ue.current=setTimeout(()=>{I(`error`),le(`Clone is taking longer than expected. Please check the repository connection and try again.`)},ui)}catch(e){I(`error`),le(e instanceof Error?e.message:String(e))}},[pe,Se,c,n]);(0,U.useEffect)(()=>{if(g!==`loading`||ae!==`cloning`)return;let e=pi(n);e&&Se(e[0])},[g,Se,n,ae]),(0,U.useEffect)(()=>{if(!(g!==`loading`||ae!==`cloning`)){for(let e of n.values())if(e.clone_status===`failed`&&!fe.current.has(e.repo_id)&&!(e.slug!==`preset-io/agor-assistant`&&!e.remote_url?.includes(`agor-assistant`))){I(`error`),le(e.clone_error?.message??`Clone failed (exit ${e.clone_error?.exit_code??`?`}).`),ue.current&&=(clearTimeout(ue.current),null);return}}},[g,n,ae]),(0,U.useEffect)(()=>{if(!s?.io)return;let e=e=>{g!==`loading`||ae!==`cloning`||e.slug!==`preset-io/agor-assistant`&&!e.url?.includes(`agor-assistant`)||(I(`error`),le(e.error),ue.current&&=(clearTimeout(ue.current),null))};return s.io.on(`repo:cloneError`,e),()=>s.io.off(`repo:cloneError`,e)},[s,g,ae]);let we=(0,U.useCallback)(()=>{let e=y.trim()||`My Assistant`;b(e),he({path:`assistant`,assistantDisplayName:e,assistantEmoji:x||`🤖`}),le(null),_(`llm`)},[y,x,he]),Te=(0,U.useCallback)(async()=>{if(!a||!M.trim())return;le(null);let e=mi(C,A),t=C===`opencode`?`claude-code`:C;try{await f(a.user_id,{agentic_tools:{[t]:{[e]:M.trim()}}}),await Ce()}catch(e){le(`Failed to save API key: ${e instanceof Error?e.message:String(e)}`)}},[M,A,f,C,Ce,a]),Ee=(0,U.useCallback)(async()=>{if(!p)return;ie(!0),ne(null);let e=await p(C,A===`codex-cli-auth`?void 0:M.trim()||void 0);ie(!1),ne(e)},[M,A,p,C]),Oe=()=>(0,W.jsxs)(`div`,{children:[(0,W.jsx)(si,{level:4,style:{marginBottom:8},children:`Welcome to Agor ✨`}),(0,W.jsxs)(ci,{style:{marginBottom:14},children:[`Start by creating your`,` `,(0,W.jsx)(o.Link,{strong:!0,href:`https://agor.live/guide/assistants`,target:`_blank`,rel:`noopener noreferrer`,children:`Agor assistant`}),`: a persistent agent that can help set up your workspace and keep things moving.`]}),(0,W.jsxs)(`div`,{style:{background:h.colorPrimaryBg,border:`1px solid ${h.colorPrimaryBorder}`,borderRadius:8,padding:`12px 14px`,marginBottom:16},children:[(0,W.jsx)(oi,{strong:!0,children:`Your assistant can help:`}),(0,W.jsxs)(`ul`,{style:{margin:`8px 0 0`,paddingLeft:20,color:h.colorTextSecondary},children:[(0,W.jsx)(`li`,{children:`🧰 Connect tools and credentials`}),(0,W.jsx)(`li`,{children:`🗺️ Set up your board and workflow`}),(0,W.jsx)(`li`,{children:`🤝 Coordinate agents and sessions`}),(0,W.jsx)(`li`,{children:`💬 Show you around and answer questions`})]})]}),(0,W.jsx)(B,{layout:`vertical`,children:(0,W.jsx)(B.Item,{label:`Name and emoji`,required:!0,children:(0,W.jsxs)(z.Compact,{style:{display:`flex`},children:[(0,W.jsx)(ii,{value:x,onChange:S,defaultEmoji:`🤖`}),(0,W.jsx)(L,{placeholder:`My Assistant`,value:y,onChange:e=>b(e.target.value),autoFocus:!0,style:{flex:1}})]})})}),ce&&(0,W.jsx)(k,{type:`error`,message:ce,showIcon:!0,style:{marginBottom:16}}),(0,W.jsx)(V,{type:`primary`,onClick:we,disabled:!y.trim(),children:`Continue`})]}),ke=()=>{if(C===`claude-code`)return A===`claude-subscription-token`?(0,W.jsx)(k,{type:`info`,showIcon:!0,style:{marginBottom:16,textAlign:`left`},description:(0,W.jsxs)(`span`,{children:[`Run `,(0,W.jsx)(oi,{code:!0,children:`claude setup-token`}),`, then paste the token below.`]})}):(0,W.jsxs)(ci,{type:`secondary`,style:{marginBottom:16},children:[`Paste an `,(0,W.jsx)(oi,{code:!0,children:`ANTHROPIC_API_KEY`}),` from`,` `,(0,W.jsx)(o.Link,{href:`https://platform.claude.com/settings/keys`,target:`_blank`,children:`Claude Console`}),`.`]});if(C===`codex`)return A===`codex-cli-auth`?(0,W.jsx)(k,{type:`info`,showIcon:!0,style:{marginBottom:16,textAlign:`left`},description:(0,W.jsxs)(`span`,{children:[`Run `,(0,W.jsx)(oi,{code:!0,children:`codex login --device-auth`}),`; Agor will use that local auth.`]})}):(0,W.jsxs)(ci,{type:`secondary`,style:{marginBottom:16},children:[`Paste an `,(0,W.jsx)(oi,{code:!0,children:`OPENAI_API_KEY`}),` from`,` `,(0,W.jsx)(o.Link,{href:`https://platform.openai.com/api-keys`,target:`_blank`,children:`OpenAI Platform`}),`.`]});let e=bi[C];return e?(0,W.jsxs)(ci,{type:`secondary`,style:{marginBottom:16},children:[`Paste your `,mi(C,A),` from`,` `,(0,W.jsx)(o.Link,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:e.label}),`.`]}):null};return(0,W.jsxs)(nt,{open:e,closable:!1,mask:{closable:!1},keyboard:!1,footer:g===`loading`?null:(0,W.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,W.jsxs)(oi,{type:`secondary`,style:{fontSize:12},children:[`Step `,g===`identity`?`1`:`2`,` of 2`]}),g===`llm`&&(0,W.jsx)(V,{type:`link`,onClick:()=>_(`identity`),children:`← Back`})]}),width:680,styles:{body:{minHeight:440,maxHeight:640,overflowY:`auto`,padding:`28px 36px`}},children:[g===`identity`&&Oe(),g===`llm`&&(()=>{let e=ge(C)&&!P,t=Ci(C),n=C===`codex`&&A===`codex-cli-auth`,r=mi(C,A);return(0,W.jsxs)(`div`,{children:[(0,W.jsx)(si,{level:4,children:`Choose your LLM`}),(0,W.jsx)(ci,{type:`secondary`,style:{marginBottom:16},children:`Pick what powers your assistant.`}),(0,W.jsxs)(z,{orientation:`vertical`,size:`middle`,style:{width:`100%`,marginBottom:16},children:[(0,W.jsx)(`div`,{role:`radiogroup`,"aria-label":`Recommended LLM providers`,style:{display:`grid`,gridTemplateColumns:`repeat(2, minmax(0, 1fr))`,gap:12},children:_i.map(e=>{let t=C===e.value;return(0,W.jsx)(Ne,{size:`small`,style:{borderColor:t?h.colorPrimary:h.colorBorder,background:t?h.colorPrimaryBg:void 0},styles:{body:{padding:0}},children:(0,W.jsx)(`label`,{style:{display:`block`,cursor:`pointer`,padding:14},children:(0,W.jsxs)(z,{align:`center`,size:10,style:{width:`100%`},children:[(0,W.jsx)(cr,{tool:e.value,size:32}),(0,W.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,W.jsx)(oi,{strong:!0,children:e.title}),(0,W.jsx)(`div`,{children:(0,W.jsx)(v,{color:t?`blue`:`default`,children:e.eyebrow})})]}),(0,W.jsx)(`input`,{type:`radio`,name:`recommended-agent`,value:e.value,checked:t,onChange:()=>ye(e.value,{useDifferentProvider:!1}),style:{accentColor:h.colorPrimary}})]})})},e.value)})}),(0,W.jsx)(gt,{checked:D,onChange:e=>{let t=e.target.checked;ye(t?vi[0].value:T,{useDifferentProvider:t})},children:`Use a different provider`}),D&&(0,W.jsx)(B,{layout:`vertical`,children:(0,W.jsx)(B.Item,{label:`Other LLM providers`,style:{marginBottom:0},children:(0,W.jsx)(F,{value:yi.has(C)?void 0:C,onChange:e=>ye(e,{useDifferentProvider:!0}),options:vi,style:{width:`100%`}})})})]}),e?(0,W.jsxs)(`div`,{style:{textAlign:`center`},children:[(0,W.jsx)(xe,{style:{padding:`8px 0 12px`},icon:(0,W.jsx)(Re,{style:{color:h.colorSuccess}}),title:`${gi[C]} is configured`,subTitle:`You're all set to use ${gi[C]}.`}),(0,W.jsxs)(z,{orientation:`vertical`,size:`small`,children:[(0,W.jsx)(V,{type:`primary`,onClick:Ce,children:`Continue`}),(0,W.jsx)(V,{type:`link`,onClick:()=>ee(!0),children:`Use a different API key instead`})]})]}):(0,W.jsxs)(W.Fragment,{children:[P&&(0,W.jsx)(V,{type:`link`,onClick:()=>{ee(!1),N(``)},style:{padding:0,marginBottom:12},children:`← Back to detected authentication`}),t&&(0,W.jsx)(d.Group,{value:A,onChange:e=>{j(e.target.value),N(``),ne(null)},style:{width:`100%`,marginBottom:16},children:(0,W.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:`repeat(2, minmax(0, 1fr))`,gap:8},children:t.map(e=>(0,W.jsx)(d,{value:e.value,style:{border:`1px solid ${h.colorBorder}`,borderRadius:8,marginInlineEnd:0,padding:`8px 12px`},children:(0,W.jsx)(oi,{strong:A===e.value,children:e.label})},e.value))})}),ke(),C===`opencode`&&(0,W.jsx)(ci,{type:`secondary`,style:{marginBottom:16},children:`OpenCode supports many LLM providers. Configure the key for your provider below.`}),!n&&(0,W.jsx)(B,{layout:`vertical`,children:(0,W.jsx)(B.Item,{label:r,children:(0,W.jsx)(L.Password,{placeholder:hi(C,A),value:M,onChange:e=>{N(e.target.value),ne(null)}})})}),ce&&(0,W.jsx)(k,{type:`error`,message:ce,showIcon:!0,style:{marginBottom:16}}),te&&(0,W.jsx)(k,{type:te.authenticated?`success`:`warning`,showIcon:!0,style:{marginBottom:16,textAlign:`left`},message:te.authenticated?`Connection works`:`Not authenticated`,description:te.hint}),(0,W.jsxs)(z,{wrap:!0,children:[n?(0,W.jsx)(V,{type:`primary`,onClick:Ce,children:`Continue with Codex CLI auth`}):(0,W.jsx)(V,{type:`primary`,onClick:Te,disabled:!M.trim(),icon:(0,W.jsx)(_e,{}),children:`Save & Continue`}),p&&(0,W.jsx)(V,{onClick:Ee,loading:re,children:`Test Connection`}),!n&&(0,W.jsx)(V,{onClick:Ce,children:`Continue without key`})]})]})]})})(),g===`loading`&&(0,W.jsx)(`div`,{style:{textAlign:`center`,padding:`48px 0`},children:ae===`error`?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(k,{type:`error`,message:`Setup failed`,description:ce,showIcon:!0,style:{marginBottom:16,textAlign:`left`}}),(0,W.jsx)(V,{type:`primary`,onClick:Ce,children:`Retry`})]}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(De,{size:`large`}),(0,W.jsx)(si,{level:4,style:{marginTop:20,marginBottom:8},children:`Setting up Agor`}),(0,W.jsx)(ci,{type:`secondary`,style:{marginBottom:0},children:oe})]})})]})}var Ti=5e3,Ei=(0,U.createContext)(null);function Di({children:e}){let t=(0,U.useRef)(null),n=(0,U.useRef)(null),r=(0,U.useRef)(null),i=(0,U.useMemo)(()=>({recenterRef:t,boardSwitcherRef:n,pendingRef:r}),[]);return(0,W.jsx)(Ei.Provider,{value:i,children:e})}function Oi(e,t){(0,U.useEffect)(()=>{if(e)return e.current=t,()=>{e.current===t&&(e.current=null)}},[e,t])}function ki(e){Oi((0,U.useContext)(Ei)?.recenterRef,e)}function Ai(e){Oi((0,U.useContext)(Ei)?.boardSwitcherRef,e)}function ji(){let e=(0,U.useContext)(Ei);return(0,U.useCallback)(()=>{let t=e?.pendingRef.current;return t?Date.now()>t.expiresAt?(e.pendingRef.current=null,null):(e.pendingRef.current=null,t.nodeId):null},[e])}function Mi(){let e=(0,U.useContext)(Ei);return(0,U.useCallback)((t,n)=>e?e.recenterRef.current?.(t)?!0:n?.boardId&&e.boardSwitcherRef.current?(e.pendingRef.current={nodeId:t,expiresAt:Date.now()+Ti},e.boardSwitcherRef.current(n.boardId),!0):!1:!1,[e])}var Ni=(0,U.createContext)({connected:!1,connecting:!1,outOfSync:!1,capturedSha:null,currentSha:null}),Pi=Ni.Provider;function Fi(){return!Li().canMutate}function Ii(){return(0,U.useContext)(Ni)}function Li(){let{connected:e,connecting:t,outOfSync:n}=(0,U.useContext)(Ni);return n?{canMutate:!1,reason:`out-of-sync`,message:`Daemon was upgraded — refresh the page to continue.`}:t?{canMutate:!1,reason:`reconnecting`,message:`Reconnecting to daemon…`}:e?{canMutate:!0,reason:null,message:null}:{canMutate:!1,reason:`disconnected`,message:`Disconnected from daemon. Action unavailable.`}}var Ri=(0,U.createContext)(void 0),{darkAlgorithm:zi,defaultAlgorithm:Bi}=I,Vi=(0,U.createContext)(void 0),Hi=`agor:themeMode`,Ui=`agor:customTheme`,Wi=({children:e})=>{let[t,n]=(0,U.useState)(()=>localStorage.getItem(Hi)||`dark`),[r,i]=(0,U.useState)(()=>{let e=localStorage.getItem(Ui);if(e)try{return JSON.parse(e)}catch(e){return console.error(`Failed to parse custom theme from localStorage:`,e),null}return null}),a=e=>{n(e),localStorage.setItem(Hi,e)},o=e=>{if(e){let{algorithm:t,...n}=e;i(n),localStorage.setItem(Ui,JSON.stringify(n))}else i(null),localStorage.removeItem(Ui)},s=(0,U.useMemo)(()=>{let e={token:{colorPrimary:`#2e9a92`,colorSuccess:`#52c41a`,colorWarning:`#faad14`,colorError:`#ff4d4f`,colorInfo:`#2e9a92`,colorLink:`#2e9a92`,borderRadius:8,fontFamily:`'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif`}};return t===`custom`&&r?{...e,...r,token:{...e.token,...r.token},algorithm:zi}:{...e,algorithm:t===`dark`?zi:Bi}},[t,r]),c=(0,U.useCallback)(()=>s,[s]),l=t!==`light`;return(0,U.useEffect)(()=>{c(),document.body.style.backgroundColor=l?`#141414`:`#f0f2f5`,l?document.documentElement.classList.add(`dark`):document.documentElement.classList.remove(`dark`)},[l,c]),(0,W.jsx)(Vi.Provider,{value:{themeMode:t,setThemeMode:a,customTheme:r,setCustomTheme:o,getCurrentThemeConfig:c,isDark:l},children:e})},Gi=()=>{let e=(0,U.useContext)(Vi);if(!e)throw Error(`useTheme must be used within a ThemeProvider`);return e};function Ki(){if(typeof window<`u`){let e=window.AGOR_DAEMON_URL;if(e)return e}let e=3031;if(typeof window<`u`){if(window.location.pathname.startsWith(`/ui`))return window.location.origin;let t=window.location.origin,n=new URL(t);return`${n.protocol}//${n.hostname}:${e}`}return`http://${gn.DEFAULT_HOST}:${e}`}Ki();function qi(e){if(!e||typeof e!=`object`)return;let t=e;if(typeof t.code==`number`)return t.code;if(typeof t.statusCode==`number`)return t.statusCode;if(typeof t.status==`number`)return t.status}function Ji(e){let t=qi(e);if(t===401||t===403)return!0;if(!e||typeof e!=`object`)return!1;let n=e;return n.name===`NotAuthenticated`||n.className===`not-authenticated`}function Yi(e){if(Ji(e))return!1;let t=qi(e);if(t===0||t===408||t===429||t!==void 0&&t>=500)return!0;if(!e||typeof e!=`object`)return!1;let n=e,r=typeof n.message==`string`?n.message.toLowerCase():``,i=e instanceof Error?e.constructor.name:``;return i===`TypeError`&&r.includes(`fetch`)?!0:r.includes(`connection`)||r.includes(`timeout`)||r.includes(`websocket`)||r.includes(`transport`)||r.includes(`failed to fetch`)||r.includes(`networkerror`)||r.includes(`network error`)||r.includes(`load failed`)||i===`TransportError`||i===`WebSocketError`}var Xi=`agor-access-token`,Zi=`agor-refresh-token`;async function Qi(e,t){return await e.service(`authentication/refresh`).create({refreshToken:t})}function $i(e,t){localStorage.setItem(Xi,e),t&&localStorage.setItem(Zi,t)}function ea(){return localStorage.getItem(Zi)}function ta(){return localStorage.getItem(Xi)}function na(){localStorage.removeItem(Xi),localStorage.removeItem(Zi)}async function ra(e,t){let n=await Qi(e,t);return $i(n.accessToken,n.refreshToken),n}var ia=`agor:tokens-refreshed`,aa=`agor:tokens-refresh-unrecoverable`,oa=null,sa=!1,ca=class extends Error{constructor(e=`Refresh token is invalid or expired`,t){super(e,t),this.name=`RefreshUnrecoverableError`}};function la(){sa=!1}function ua(e,t){return sa?Promise.reject(new ca):oa||(oa=ra(e,t).then(e=>(sa=!1,typeof window<`u`&&window.dispatchEvent(new CustomEvent(ia,{detail:e})),e)).catch(e=>{throw Ji(e)?(sa=!0,typeof window<`u`&&window.dispatchEvent(new CustomEvent(aa)),new ca(void 0,{cause:e})):e}).finally(()=>{oa=null}),oa)}async function da(e){let t=ea();if(!t)return null;let n=await ua(e,t);return await e.authenticate({strategy:`jwt`,accessToken:n.accessToken}),n}function fa(e={}){let{url:t=Ki(),accessToken:n}=e,[r,i]=(0,U.useState)(!1),[a,o]=(0,U.useState)(!!n),[s,c]=(0,U.useState)(null),l=(0,U.useRef)(null),u=(0,U.useRef)(n);u.current=n;let d=!!n;return(0,U.useEffect)(()=>{let e=!0,n=null,r=!1,a=0,s=null,f=()=>{s!==null&&(clearTimeout(s),s=null)},p=null,m=()=>{p!==null&&(clearTimeout(p),p=null)},h=()=>{p===null&&(p=setTimeout(()=>{p=null,e&&i(!1)},1500))};async function g(){if(!d){o(!1),i(!1),c(null),l.current=null;return}i(!1),o(!0),c(null),n=rn(t,!1),l.current=n;let p=new Set([`authentication`,`authentication/refresh`]);n.hooks({around:{all:[async(e,t)=>{let r=e.path;if(typeof r==`string`&&p.has(r)){await t();return}try{await t()}catch(t){if(!Ji(t)||(e.params??{})._refreshRetried||!n)throw t;try{if(!await da(n))throw t}catch{throw t}let i=e.arguments?[...e.arguments]:[],a=i.length-1,o=i[a],s=typeof o==`object`&&!!o&&!Array.isArray(o),c={...s?o:{},_refreshRetried:!0};s?i[a]=c:i.push(c);let l=n.service(r),u=l[e.method];if(typeof u!=`function`)throw t;e.result=await u.call(l,...i)}}]}}),typeof window<`u`&&(window.__agorClient=n),n.io.on(`connect`,async()=>{if(e){let e=r;if(r=!0,a=0,f(),m(),!e)return;let t=u.current;try{if(t)try{await n.authenticate({strategy:`jwt`,accessToken:t}),i(!0),o(!1),c(null);return}catch{try{if(await da(n)){i(!0),o(!1),c(null);return}}catch(e){if(console.error(`❌ Refresh failed on reconnect:`,e),e instanceof ca||Ji(e)){o(!1),i(!1),c(`Session expired. Please log in again.`);return}i(!1),o(!0);return}}console.error(`❌ Re-authentication failed after reconnect - all tokens expired`),o(!1),i(!1),c(`Session expired. Please log in again.`)}catch(e){console.error(`❌ Re-authentication failed after reconnect:`,e),o(!1),i(!1)}}}),n.io.on(`disconnect`,t=>{if(e)if(r?h():i(!1),t===`io server disconnect`){if(a>=10){o(!1),m(),i(!1),c(`Lost connection to daemon after multiple attempts. Please reload the page.`);return}o(!0);let t=a++,r=Math.min(500*2**t,3e4);f(),s=setTimeout(()=>{s=null,e&&n?.io.connect()},r)}else (t===`transport close`||t===`transport error`||t===`ping timeout`)&&o(!0)}),n.io.on(`connect_error`,t=>{e&&(r?(o(!0),i(!1)):(c(`Daemon is not running. Start it with: cd apps/agor-daemon && pnpm dev`),o(!1),i(!1)))}),n.io.connect();try{await new Promise((e,t)=>{let r=setTimeout(()=>{t(Error(`Connection timeout`))},5e3);if(n.io.connected){clearTimeout(r),e();return}n.io.once(`connect`,()=>{clearTimeout(r),e()}),n.io.once(`connect_error`,e=>{clearTimeout(r),t(e)})})}catch{e&&(c(`Failed to connect to daemon. Make sure it is running on :3030`),o(!1),i(!1));return}let g=u.current;try{g&&await n.authenticate({strategy:`jwt`,accessToken:g})}catch{e&&(c(`Authentication failed. Please log in again.`),o(!1),i(!1));return}e&&(i(!0),o(!1),c(null))}g();let _=t=>{if(!e)return;let r=t.detail;!r||!n||n.io.connected&&n.authenticate({strategy:`jwt`,accessToken:r.accessToken}).then(()=>{e&&(i(!0),o(!1),c(null))}).catch(e=>{console.error(`In-place re-authentication failed after token refresh:`,e)})};return window.addEventListener(ia,_),()=>{e=!1,f(),m(),window.removeEventListener(ia,_),n?.io&&(n.io.removeAllListeners(),n.io.close()),typeof window<`u`&&window.__agorClient===n&&delete window.__agorClient}},[t,d]),{client:l.current,connected:r,connecting:a,error:s,retryConnection:()=>{let e=l.current;e?.io&&(e.io.connected&&e.io.disconnect(),o(!0),c(null),e.io.connect())}}}var pa=`agor.debug.initialLoad`;function ma(){return typeof window>`u`?null:window}function ha(){return typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now()}function ga(e){return Math.round(e*10)/10}function _a(e){return e instanceof Error?e.message:String(e)}function va(e=ma()){if(!e)return!1;let t=null;try{t=new URLSearchParams(e.location.search).get(`debugLoad`)}catch{t=null}try{return t===`1`?e.localStorage.setItem(pa,`1`):t===`0`&&e.localStorage.removeItem(pa),e.localStorage.getItem(pa)===`1`}catch{return t===`1`}}function ya(){return va()}function ba(e){let t=ha(),n=new Date().toISOString(),r=new Map(e.map(e=>[e.key,e.label])),i=[],a=[],o=null,s=null,c=null,l=null;return{markStage:e=>{a.push({stage:e,atMs:ga(ha()-t)})},startFetchPhase(){o=ha()},endFetchPhase(){s=ha()},startIndexing(){c=ha()},endIndexing(){l=ha()},track(e,t){let n=ha();return t.then(t=>(i.push({key:e,label:r.get(e)??e,durationMs:ga(ha()-n),count:t.length,status:`success`}),t),t=>{throw i.push({key:e,label:r.get(e)??e,durationMs:ga(ha()-n),count:null,status:`error`,error:_a(t)}),t})},finish(e,r){let u={label:`Agor initial load`,startedAt:n,totalMs:ga(ha()-t),fetchPhaseMs:o===null?null:ga((s??ha())-o),indexingMs:c===null?null:ga((l??ha())-c),status:e,error:r===void 0?void 0:_a(r),fetches:[...i].sort((e,t)=>e.key.localeCompare(t.key)),stageTransitions:[...a]},d=ma();return d&&(d.__AGOR_INITIAL_LOAD_TIMINGS__=u),typeof console<`u`&&((console.groupCollapsed??console.group)?.call(console,`[Agor initial load]`,{status:u.status,totalMs:u.totalMs,fetchPhaseMs:u.fetchPhaseMs,indexingMs:u.indexingMs}),console.table?.(u.fetches),u.stageTransitions.length>0&&console.log(`stageTransitions`,u.stageTransitions),u.error&&console.warn(`[Agor initial load] failed`,u.error),console.log(`Copy from window.__AGOR_INITIAL_LOAD_TIMINGS__`,u),console.groupEnd?.()),u}}}function xa(e,t){if(e===t)return!0;if(e==null||t==null)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!Object.hasOwn(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var Sa=[{key:`sessions`,label:`Sessions`},{key:`boards`,label:`Boards`},{key:`board-objects`,label:`Board objects`},{key:`board-comments`,label:`Board comments`},{key:`branches`,label:`Branches`},{key:`repos`,label:`Repos`},{key:`users`,label:`Users`},{key:`cards`,label:`Cards`},{key:`card-types`,label:`Card types`},{key:`mcp-servers`,label:`MCP servers`},{key:`session-mcp-servers`,label:`Session MCP links`},{key:`gateway-channels`,label:`Gateway channels`},{key:`artifacts`,label:`Artifacts`}],Ca={sessionById:new Map,sessionsByBranch:new Map,boardById:new Map,boardObjectById:new Map,boardObjectsByBoardId:new Map,boardObjectByBranchId:new Map,boardObjectByCardId:new Map,commentById:new Map,cardById:new Map,cardTypeById:new Map,repoById:new Map,branchById:new Map,userById:new Map,mcpServerById:new Map,gatewayChannelById:new Map,artifactById:new Map,sessionMcpServerIds:new Map,userAuthenticatedMcpServerIds:new Set};function wa(e,t,n){let r=e.get(t);if(r&&xa(r,n))return e;let i=new Map(e);return i.set(t,n),i}function Ta(e,t){let n=e.get(t.board_id);if(!n?.some(e=>e.object_id===t.object_id))return e;let r=new Map(e),i=n.filter(e=>e.object_id!==t.object_id);return i.length>0?r.set(t.board_id,i):r.delete(t.board_id),r}function Ea(e,t,n){let r=e.boardObjectById.get(t.object_id);if(n===`create`&&r||n===`patch`&&r&&xa(r,t))return e;let i=new Map(e.boardObjectById);i.set(t.object_id,t);let a=e.boardObjectsByBoardId;r&&r.board_id!==t.board_id&&(a=Ta(a,r));let o=a.get(t.board_id)??[],s=o.findIndex(e=>e.object_id===t.object_id);if(s===-1||o[s]!==t||!xa(o[s],t)){let e=new Map(a);if(s===-1)e.set(t.board_id,[...o,t]);else{let n=[...o];n[s]=t,e.set(t.board_id,n)}a=e}let c=e.boardObjectByBranchId;if(r?.branch_id&&r.branch_id!==t.branch_id&&(c=new Map(c),c.delete(r.branch_id)),t.branch_id){let n=c.get(t.branch_id);(!n||!xa(n,t))&&(c=c===e.boardObjectByBranchId?new Map(c):c,c.set(t.branch_id,t))}let l=e.boardObjectByCardId;if(r?.card_id&&r.card_id!==t.card_id&&(l=new Map(l),l.delete(r.card_id)),t.card_id){let n=l.get(t.card_id);(!n||!xa(n,t))&&(l=l===e.boardObjectByCardId?new Map(l):l,l.set(t.card_id,t))}return{...e,boardObjectById:i,boardObjectsByBoardId:a,boardObjectByBranchId:c,boardObjectByCardId:l}}function Da(e,t){let n=e.boardObjectById.get(t.object_id);if(!n)return e;let r=new Map(e.boardObjectById);r.delete(n.object_id);let i=e.boardObjectByBranchId;n.branch_id&&i.get(n.branch_id)?.object_id===n.object_id&&(i=new Map(i),i.delete(n.branch_id));let a=e.boardObjectByCardId;return n.card_id&&a.get(n.card_id)?.object_id===n.object_id&&(a=new Map(a),a.delete(n.card_id)),{...e,boardObjectById:r,boardObjectsByBoardId:Ta(e.boardObjectsByBoardId,n),boardObjectByBranchId:i,boardObjectByCardId:a}}function Oa(e,t,n){return Ht(e,Array.from(t,e=>({id:n(e)}))).length>0}function ka(e,t){if(!t)return e;let n=e.remote_relationships??t.remote_relationships,r=e.remote_surrogate??t.remote_surrogate;return n===e.remote_relationships&&r===e.remote_surrogate?e:{...e,...n!==void 0&&{remote_relationships:n},...r!==void 0&&{remote_surrogate:r}}}function Aa(e,t,n){return n.relationship_type!==`remote_create`||t.archived||t.branch_id===e.branch_id?null:{...t,branch_id:e.branch_id,genealogy:{...t.genealogy??{},parent_session_id:e.session_id},remote_surrogate:{relationship:n,source_session_id:e.session_id,source_branch_id:e.branch_id,target_branch_id:t.branch_id}}}function ja(e,t){for(let n of e.values()){let e=n.find(e=>e.session_id===t);if(e&&!e.remote_surrogate)return e}}function Ma(e,t){let n=t?.enabled??!0,r=t?.directSessionId??null,[i,a]=(0,U.useState)(Ca),o=e=>t=>a(n=>{let r=typeof t==`function`?t(n[e]):t;return Object.is(r,n[e])?n:{...n,[e]:r}}),s=o(`sessionById`),c=o(`sessionsByBranch`),l=o(`boardById`),u=o(`commentById`),d=o(`cardById`),f=o(`cardTypeById`),p=o(`repoById`),m=o(`branchById`),h=o(`userById`),g=o(`mcpServerById`),_=o(`gatewayChannelById`),v=o(`artifactById`),y=o(`sessionMcpServerIds`),b=o(`userAuthenticatedMcpServerIds`),[x,S]=(0,U.useState)(!0),[C,w]=(0,U.useState)(`idle`),[T,E]=(0,U.useState)(null),[D,O]=(0,U.useState)({}),[k,A]=(0,U.useState)(!1),j=(0,U.useRef)(!1),M=(0,U.useRef)(!1),N=(0,U.useCallback)(async({silent:t=!1}={})=>{if(!e||!n)return;let i=!t&&ya()?ba(Sa):null,o=null,s;try{t||(S(!0),w(`fetching`),i?.markStage(`fetching`),E(null),O({}));let n=(e,n)=>(i?.track(e,n)??n).then(n=>(t||O(t=>({...t,[e]:n.length})),n));i?.startFetchPhase();let[s,c,l,u,d,f,p,m,h,g,_,v,y,b]=await Promise.all([n(`sessions`,e.service(`sessions`).findAll({query:{archived:!1,$limit:Lt.DEFAULT_LIMIT,$sort:{updated_at:-1}}})),n(`boards`,e.service(`boards`).findAll({query:{$limit:Lt.DEFAULT_LIMIT}})),n(`board-objects`,e.service(`board-objects`).findAll({query:{$limit:Lt.DEFAULT_LIMIT}})),n(`board-comments`,e.service(`board-comments`).findAll({query:{$limit:Lt.DEFAULT_LIMIT}})),n(`cards`,e.service(`cards`).findAll({query:{$limit:Lt.DEFAULT_LIMIT}})),n(`card-types`,e.service(`card-types`).findAll({query:{$limit:Lt.DEFAULT_LIMIT}})),n(`repos`,e.service(`repos`).findAll({query:{$limit:Lt.DEFAULT_LIMIT}})),n(`branches`,e.service(`branches`).findAll({query:{archived:!1,$limit:Lt.DEFAULT_LIMIT}})),n(`users`,e.service(`users`).findAll({query:{$limit:Lt.DEFAULT_LIMIT}})),n(`mcp-servers`,e.service(`mcp-servers`).findAll({query:{$limit:Lt.DEFAULT_LIMIT}})),n(`session-mcp-servers`,e.service(`session-mcp-servers`).findAll({query:{$limit:Lt.DEFAULT_LIMIT}})),n(`gateway-channels`,e.service(`gateway-channels`).findAll({query:{$limit:Lt.DEFAULT_LIMIT}})),n(`artifacts`,e.service(`artifacts`).findAll({query:{$limit:Lt.DEFAULT_LIMIT,$select:[`artifact_id`,`branch_id`,`source_session_id`,`board_id`,`name`,`description`,`path`,`template`,`build_status`,`build_errors`,`content_hash`,`public`,`created_by`,`created_at`,`updated_at`,`archived`,`archived_at`,`fullscreen_url`,`url`]}})),e.service(`mcp-servers/oauth-status`).find().catch(()=>({authenticated_server_ids:[]}))]);if(i?.endFetchPhase(),r&&!Oa(r,s,e=>e.session_id))try{let t=await e.service(`sessions`).get(r);if(s.some(e=>e.session_id===t.session_id)||s.push(t),!t.archived&&t.branch_id&&!m.some(e=>e.branch_id===t.branch_id))try{let n=await e.service(`branches`).get(t.branch_id);n.archived||m.push(n)}catch{}}catch{}t||(w(`indexing`),i?.markStage(`indexing`),i?.startIndexing(),await new Promise(e=>{if(typeof window>`u`||typeof window.requestAnimationFrame!=`function`){e();return}window.requestAnimationFrame(()=>e())}));let x=new Map,C=new Map;for(let e of s){if(x.set(e.session_id,e),e.archived)continue;let t=e.branch_id;C.has(t)||C.set(t,[]),C.get(t).push(e)}for(let e of s)if(!e.archived)for(let t of e.remote_relationships?.as_source??[]){if(t.relationship_type!==`remote_create`)continue;let n=x.get(t.target_session_id);if(!n)continue;let r=C.get(e.branch_id)??[];if(r.some(e=>e.session_id===n.session_id))continue;let i=Aa(e,n,t);i&&C.set(e.branch_id,[...r,i])}let T=new Map;for(let e of c)T.set(e.board_id,e);let D=new Map,k=new Map,A=new Map,j=new Map;for(let e of l){D.set(e.object_id,e);let t=k.get(e.board_id);t?t.push(e):k.set(e.board_id,[e]),e.branch_id&&A.set(e.branch_id,e),e.card_id&&j.set(e.card_id,e)}let N=new Map;for(let e of u)N.set(e.comment_id,e);let P=new Map;for(let e of d)P.set(e.card_id,e);let ee=new Map;for(let e of f)ee.set(e.card_type_id,e);let te=new Map;for(let e of p)te.set(e.repo_id,e);let ne=new Map;for(let e of m)ne.set(e.branch_id,e);let re=new Map;for(let e of h)re.set(e.user_id,e);let ie=new Map;for(let e of g)ie.set(e.mcp_server_id,e);let ae=new Map;for(let e of v)ae.set(e.id,e);let F=new Map;for(let e of y)F.set(e.artifact_id,e);let I=new Map;for(let e of _)I.has(e.session_id)||I.set(e.session_id,[]),I.get(e.session_id).push(e.mcp_server_id);a({sessionById:x,sessionsByBranch:C,boardById:T,boardObjectById:D,boardObjectsByBoardId:k,boardObjectByBranchId:A,boardObjectByCardId:j,commentById:N,cardById:P,cardTypeById:ee,repoById:te,branchById:ne,userById:re,mcpServerById:ie,gatewayChannelById:ae,artifactById:F,sessionMcpServerIds:I,userAuthenticatedMcpServerIds:new Set(b?.authenticated_server_ids??[])}),i?.endIndexing(),o=`success`,t&&(M.current=!1)}catch(e){t?(console.warn(`[useAgorData] silent refetch failed:`,e),M.current=!0):(o=`error`,s=e,E(e instanceof Error?e.message:`Failed to fetch data`))}finally{t||(S(!1),w(`idle`),i?.markStage(`idle`),o&&i?.finish(o,s))}},[e,r,n]);(0,U.useEffect)(()=>{e||(a(Ca),A(!1))},[e]),(0,U.useEffect)(()=>{if(!e||!n||!k||!r||i.sessionById.has(r)||Oa(r,i.sessionById.values(),e=>e.session_id))return;let t=!1;return(async()=>{try{let n=await e.service(`sessions`).get(r);if(t)return;if(s(e=>{if(e.has(n.session_id))return e;let t=new Map(e);return t.set(n.session_id,n),t}),n.archived||c(e=>{let t=e.get(n.branch_id)||[];if(t.some(e=>e.session_id===n.session_id))return e;let r=new Map(e);return r.set(n.branch_id,[...t,n]),r}),!n.archived&&n.branch_id&&!i.branchById.has(n.branch_id))try{let r=await e.service(`branches`).get(n.branch_id);if(t)return;m(e=>{if(r.archived||e.has(r.branch_id))return e;let t=new Map(e);return t.set(r.branch_id,r),t})}catch{}}catch{}})(),()=>{t=!0}},[e,r,n,k,i.branchById,i.sessionById,m,s,c]),(0,U.useEffect)(()=>{if(!e||!n){S(!1),w(`idle`);return}k||N().then(()=>A(!0));let t=e.service(`sessions`),r=e=>{e.archived||(s(t=>{if(t.has(e.session_id))return t;let n=new Map(t);return n.set(e.session_id,e),n}),c(t=>{let n=t.get(e.branch_id)||[];if(n.some(t=>t.session_id===e.session_id))return t;let r=new Map(t);return r.set(e.branch_id,[...n,e]),r}))},i=e=>{let t=e.archived===!0,n=null;s(r=>{let i=r.get(e.session_id);if(n=i?.branch_id||null,t){if(!i)return r;let t=new Map(r);return t.delete(e.session_id),t}let a=ka(e,i);if(i&&xa(i,a))return r;let o=new Map(r);return o.set(e.session_id,a),o}),c(r=>{let i=!1,a=new Map(r),o=e.branch_id,s=t=>{let n=a.get(t)||[],r=n.filter(t=>t.session_id!==e.session_id);r.length!==n.length&&(i=!0,r.length>0?a.set(t,r):a.delete(t))};if(t){for(let[t,n]of a)n.some(t=>t.session_id===e.session_id)&&s(t);return i?a:r}n&&n!==o&&s(n);let c=a.get(o)||[],l=c.findIndex(t=>t.session_id===e.session_id),u=e;if(l===-1)a.set(o,[...c,e]);else{let t=ka(e,c[l]);if(u=t,c[l]===t||xa(c[l],t))return i?a:r;let n=[...c];n[l]=t,a.set(o,n);for(let[t,n]of a){if(t===o)continue;let r=!1,i=n.map(t=>t.session_id===e.session_id?(r=!0,{...ka(e,t),branch_id:t.branch_id,genealogy:t.genealogy,remote_surrogate:t.remote_surrogate}):t);r&&a.set(t,i)}}for(let e of u.remote_relationships?.as_source??[]){if(e.relationship_type!==`remote_create`)continue;let t=ja(a,e.target_session_id);if(!t)continue;let n=a.get(u.branch_id)??[];if(n.some(e=>e.session_id===t.session_id))continue;let r=Aa(u,t,e);r&&a.set(u.branch_id,[...n,r])}return a})},o=e=>{s(t=>{if(!t.has(e.session_id))return t;let n=new Map(t);return n.delete(e.session_id),n}),c(t=>{let n=t.get(e.branch_id);if(!n?.some(t=>t.session_id===e.session_id))return t;let r=new Map(t),i=n.filter(t=>t.session_id!==e.session_id);return i.length>0?r.set(e.branch_id,i):r.delete(e.branch_id),r})};t.on(`created`,r),t.on(`patched`,i),t.on(`updated`,i),t.on(`removed`,o);let x=e.service(`boards`),C=e=>{l(t=>{if(t.has(e.board_id))return t;let n=new Map(t);return n.set(e.board_id,e),n})},T=e=>{l(t=>wa(t,e.board_id,e))},E=e=>{l(t=>{if(!t.has(e.board_id))return t;let n=new Map(t);return n.delete(e.board_id),n})};x.on(`created`,C),x.on(`patched`,T),x.on(`updated`,T),x.on(`removed`,E);let D=e.service(`board-objects`),O=e=>{a(t=>Ea(t,e,`create`))},P=e=>{a(t=>Ea(t,e,`patch`))},ee=e=>{a(t=>Da(t,e))};D.on(`created`,O),D.on(`patched`,P),D.on(`updated`,P),D.on(`removed`,ee);let te=e.service(`repos`),ne=e=>{p(t=>{if(t.has(e.repo_id))return t;let n=new Map(t);return n.set(e.repo_id,e),n})},re=e=>{p(t=>wa(t,e.repo_id,e))},ie=e=>{p(t=>{if(!t.has(e.repo_id))return t;let n=new Map(t);return n.delete(e.repo_id),n})};te.on(`created`,ne),te.on(`patched`,re),te.on(`updated`,re),te.on(`removed`,ie);let ae=e.service(`branches`),F=e=>{e.archived||m(t=>{if(t.has(e.branch_id))return t;let n=new Map(t);return n.set(e.branch_id,e),n})},I=e=>{m(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n}),c(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n}),s(t=>{let n=!1,r=new Map(t);for(let[i,a]of t.entries())a.branch_id===e&&(r.delete(i),n=!0);return n?r:t})},oe=e=>{if(e.archived){I(e.branch_id);return}m(t=>wa(t,e.branch_id,e))},se=e=>{I(e.branch_id)};ae.on(`created`,F),ae.on(`patched`,oe),ae.on(`updated`,oe),ae.on(`removed`,se);let ce=e.service(`users`),le=e=>{h(t=>{if(t.has(e.user_id))return t;let n=new Map(t);return n.set(e.user_id,e),n})},ue=e=>{h(t=>wa(t,e.user_id,e))},de=e=>{h(t=>{if(!t.has(e.user_id))return t;let n=new Map(t);return n.delete(e.user_id),n})};ce.on(`created`,le),ce.on(`patched`,ue),ce.on(`updated`,ue),ce.on(`removed`,de);let fe=e.service(`mcp-servers`),pe=e=>{g(t=>{if(t.has(e.mcp_server_id))return t;let n=new Map(t);return n.set(e.mcp_server_id,e),n})},me=e=>{g(t=>wa(t,e.mcp_server_id,e))},he=e=>{g(t=>{if(!t.has(e.mcp_server_id))return t;let n=new Map(t);return n.delete(e.mcp_server_id),n})};fe.on(`created`,pe),fe.on(`patched`,me),fe.on(`updated`,me),fe.on(`removed`,he);let ge=e.service(`gateway-channels`),_e=e=>{_(t=>{if(t.has(e.id))return t;let n=new Map(t);return n.set(e.id,e),n})},ve=e=>{_(t=>wa(t,e.id,e))},ye=e=>{_(t=>{if(!t.has(e.id))return t;let n=new Map(t);return n.delete(e.id),n})};ge.on(`created`,_e),ge.on(`patched`,ve),ge.on(`updated`,ve),ge.on(`removed`,ye);let be=e.service(`cards`),xe=e=>{d(t=>{if(t.has(e.card_id))return t;let n=new Map(t);return n.set(e.card_id,e),n})},Se=e=>{d(t=>wa(t,e.card_id,e))},Ce=e=>{d(t=>{if(!t.has(e.card_id))return t;let n=new Map(t);return n.delete(e.card_id),n})};be.on(`created`,xe),be.on(`patched`,Se),be.on(`updated`,Se),be.on(`removed`,Ce);let we=e.service(`card-types`),Te=e=>{f(t=>{if(t.has(e.card_type_id))return t;let n=new Map(t);return n.set(e.card_type_id,e),n})},Ee=e=>{f(t=>wa(t,e.card_type_id,e))},De=e=>{f(t=>{if(!t.has(e.card_type_id))return t;let n=new Map(t);return n.delete(e.card_type_id),n})};we.on(`created`,Te),we.on(`patched`,Ee),we.on(`updated`,Ee),we.on(`removed`,De);let L=e.service(`artifacts`),Oe=e=>{v(t=>{if(t.has(e.artifact_id))return t;let n=new Map(t);return n.set(e.artifact_id,e),n})},ke=e=>{v(t=>wa(t,e.artifact_id,e)),window.dispatchEvent(new CustomEvent(`agor:artifact-patched`,{detail:{artifactId:e.artifact_id,contentHash:e.content_hash}}))},Ae=e=>{v(t=>{if(!t.has(e.artifact_id))return t;let n=new Map(t);return n.delete(e.artifact_id),n})};L.on(`created`,Oe),L.on(`patched`,ke),L.on(`updated`,ke),L.on(`removed`,Ae);let je=e=>{window.dispatchEvent(new CustomEvent(`agor:artifact-runtime-query`,{detail:e}))};L.on(`agor-query`,je);let Me=e.service(`session-mcp-servers`),Ne=e=>{y(t=>{let n=t.get(e.session_id)||[];if(n.includes(e.mcp_server_id))return t;let r=new Map(t);return r.set(e.session_id,[...n,e.mcp_server_id]),r})},R=e=>{y(t=>{let n=t.get(e.session_id)||[],r=n.filter(t=>t!==e.mcp_server_id);if(r.length===n.length)return t;let i=new Map(t);return r.length>0?i.set(e.session_id,r):i.delete(e.session_id),i})};Me.on(`created`,Ne),Me.on(`removed`,R);let Pe=e.service(`board-comments`),Fe=e=>{u(t=>{if(t.has(e.comment_id))return t;let n=new Map(t);return n.set(e.comment_id,e),n})},Ie=e=>{u(t=>wa(t,e.comment_id,e))},Le=e=>{u(t=>{if(!t.has(e.comment_id))return t;let n=new Map(t);return n.delete(e.comment_id),n})};Pe.on(`created`,Fe),Pe.on(`patched`,Ie),Pe.on(`updated`,Ie),Pe.on(`removed`,Le);let Re=async t=>{if(!(!t.success||!t.mcp_server_id)){(t.oauth_mode||`per_user`)===`per_user`&&b(e=>{if(e.has(t.mcp_server_id))return e;let n=new Set(e);return n.add(t.mcp_server_id),n});try{let n=await e.service(`mcp-servers`).get(t.mcp_server_id);g(e=>wa(e,n.mcp_server_id,n))}catch(e){console.warn(`[OAuth] Failed to refetch MCP server after re-auth:`,e)}}};e.io.on(`oauth:completed`,Re);let ze=async t=>{if(t.mcp_server_id){b(e=>{if(!e.has(t.mcp_server_id))return e;let n=new Set(e);return n.delete(t.mcp_server_id),n}),g(e=>{let n=e.get(t.mcp_server_id);if(!n?.auth?.oauth_access_token)return e;let r=new Map(e);return r.set(t.mcp_server_id,{...n,auth:{...n.auth,oauth_access_token:void 0,oauth_token_expires_at:void 0}}),r});try{let n=await e.service(`mcp-servers`).get(t.mcp_server_id);g(e=>wa(e,n.mcp_server_id,n))}catch(e){console.warn(`[OAuth] Failed to refetch MCP server after disconnect:`,e)}}};e.io.on(`oauth:disconnected`,ze);let Be=async()=>{if(k&&!j.current){j.current=!0;try{await N({silent:!0})}finally{j.current=!1}}};e.io.on(`connect`,Be);let Ve=()=>{M.current&&Be()};return window.addEventListener(ia,Ve),()=>{e.io.off(`oauth:completed`,Re),e.io.off(`oauth:disconnected`,ze),e.io.off(`connect`,Be),window.removeEventListener(ia,Ve),t.removeListener(`created`,r),t.removeListener(`patched`,i),t.removeListener(`updated`,i),t.removeListener(`removed`,o),x.removeListener(`created`,C),x.removeListener(`patched`,T),x.removeListener(`updated`,T),x.removeListener(`removed`,E),D.removeListener(`created`,O),D.removeListener(`patched`,P),D.removeListener(`updated`,P),D.removeListener(`removed`,ee),te.removeListener(`created`,ne),te.removeListener(`patched`,re),te.removeListener(`updated`,re),te.removeListener(`removed`,ie),ae.removeListener(`created`,F),ae.removeListener(`patched`,oe),ae.removeListener(`updated`,oe),ae.removeListener(`removed`,se),ce.removeListener(`created`,le),ce.removeListener(`patched`,ue),ce.removeListener(`updated`,ue),ce.removeListener(`removed`,de),fe.removeListener(`created`,pe),fe.removeListener(`patched`,me),fe.removeListener(`updated`,me),fe.removeListener(`removed`,he),Me.removeListener(`created`,Ne),Me.removeListener(`removed`,R),Pe.removeListener(`created`,Fe),Pe.removeListener(`patched`,Ie),Pe.removeListener(`updated`,Ie),Pe.removeListener(`removed`,Le),ge.removeListener(`created`,_e),ge.removeListener(`patched`,ve),ge.removeListener(`updated`,ve),ge.removeListener(`removed`,ye),be.removeListener(`created`,xe),be.removeListener(`patched`,Se),be.removeListener(`updated`,Se),be.removeListener(`removed`,Ce),we.removeListener(`created`,Te),we.removeListener(`patched`,Ee),we.removeListener(`updated`,Ee),we.removeListener(`removed`,De),L.removeListener(`created`,Oe),L.removeListener(`patched`,ke),L.removeListener(`updated`,ke),L.removeListener(`removed`,Ae),L.removeListener(`agor-query`,je)}},[e,n,N,k]);let P=(0,U.useMemo)(()=>Sa.map(({key:e,label:t})=>{let n=D[e];return{key:e,label:t,done:n!==void 0,count:n??0}}),[D]),ee=Sa.every(({key:e})=>D[e]!==void 0);return{...i,initialLoadItems:P,initialLoadComplete:ee,loadingStage:C,loading:x,error:T,refetch:N}}function Na(e){let t=e.split(`.`);if(t.length!==3)return null;let n=t[1];if(!n)return null;try{let e=La(n),t=JSON.parse(e);if(t&&typeof t==`object`&&`exp`in t){let e=t.exp;if(typeof e==`number`&&Number.isFinite(e)&&e>0)return e}return null}catch{return null}}function Pa(e){let t=Na(e);return t===null?null:t*1e3}function Fa(e,t=Date.now()){let n=Pa(e);return n===null?null:n-t}function Ia(e,t){let n=Fa(e);return n===null?!0:n<=t}function La(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`),n=t+`=`.repeat((4-t.length%4)%4);if(typeof Buffer<`u`)return Buffer.from(n,`base64`).toString(`utf8`);let r=globalThis.atob(n),i=new Uint8Array(r.length);for(let e=0;e<r.length;e++)i[e]=r.charCodeAt(e);return new TextDecoder().decode(i)}var Ra=`launch_code`;function za(e){let t=new URLSearchParams(e).get(Ra);return t?.trim()?t:null}function Ba(){if(typeof window>`u`)return;let e=new URL(window.location.href);e.searchParams.has(`launch_code`)&&(e.searchParams.delete(Ra),window.history.replaceState(window.history.state,document.title,`${e.pathname}${e.search}${e.hash}`))}async function Va(e,t){let n=await e.service(`auth/launch`).create({launchCode:t});return $i(n.accessToken,n.refreshToken),n}var Ha=`The Agor server returned an unexpected response while signing in. Check that the daemon URL is correct and the server is reachable, then try again.`;function Ua(e){if(!e||typeof e!=`object`)return!1;let t=e instanceof Error?e.message:String(e.message??``);return/json parsing error/i.test(t)||/unexpected token.*json/i.test(t)}function Wa(e){return Ua(e)?Ha:Yi(e)?`Unable to reach the Agor server. Check your connection and try again.`:e instanceof Error?e.message:`Login failed`}function Ga(){let[e,t]=(0,U.useState)({user:null,accessToken:null,authenticated:!1,loading:!0,error:null}),n=(0,U.useCallback)(async(e=0,r)=>{t(e=>({...e,loading:!0,error:null}));let i=ta(),a=ea(),o=!!i||!!a,s=r||(typeof window<`u`?za(window.location.search):null),c=!1,l=!1;async function u(e){if(!i&&!a)return!1;if(i)try{let n=await e.authenticate({strategy:`jwt`,accessToken:i});return t({user:n.user,accessToken:n.accessToken,authenticated:!0,loading:!1,error:null}),!0}catch{}if(a)try{let n=await ua(e,a);return t({user:n.user,accessToken:n.accessToken,authenticated:!0,loading:!1,error:null}),!0}catch{}return!1}try{let r=await Qt(Ki());if(s){c=!0,Ba();try{let e=await Va(r,s);la(),t({user:e.user,accessToken:e.accessToken,authenticated:!0,loading:!1,error:null});return}catch(t){if(Yi(t)&&e<5){let t=Math.min(2e3*1.5**e,1e4);return await new Promise(e=>setTimeout(e,t)),n(e+1,s)}if(l=!0,!o)throw t;console.warn(`Launch sign-in failed; falling back to stored auth tokens:`,t)}}if(!o){t({user:null,accessToken:null,authenticated:!1,loading:!1,error:l?`Launch sign-in failed. The one-time launch code may have expired or already been used.`:null});return}if(await u(r))return;na(),t({user:null,accessToken:null,authenticated:!1,loading:!1,error:l?`Launch sign-in failed. The one-time launch code may have expired or already been used.`:null})}catch(r){let i=Yi(r);if(i&&e<5){let t=Math.min(2e3*1.5**e,1e4);return await new Promise(e=>setTimeout(e,t)),n(e+1,c&&s||void 0)}if(!i&&!(c&&o)&&(console.error(`Authentication failure, clearing tokens:`,r),na()),c&&o&&await u(await Qt(Ki())))return;t({user:null,accessToken:null,authenticated:!1,loading:!1,error:i?`Connection lost - waiting for daemon...`:c?`Launch sign-in failed. The one-time launch code may have expired or already been used.`:null})}},[]);(0,U.useEffect)(()=>{n()},[n]),(0,U.useEffect)(()=>{let t=async()=>{if(document.visibilityState!==`visible`)return;if(!e.authenticated){(ta()||ea())&&n();return}let t=ta();if(!t||!Ia(t,6e4))return;let r=ea();if(r)try{await ua(await Qt(Ki()),r)}catch(e){if(e instanceof ca)return;Yi(e)||n()}};return document.addEventListener(`visibilitychange`,t),()=>document.removeEventListener(`visibilitychange`,t)},[e.authenticated,n]),(0,U.useEffect)(()=>{if(e.authenticated||e.loading||!(ta()||ea()))return;let t=setInterval(()=>{n()},3e3);return()=>clearInterval(t)},[e.authenticated,e.loading,n]),(0,U.useEffect)(()=>{if(!e.authenticated||!e.accessToken)return;let n=Fa(e.accessToken),r=n===null?3e5:Math.max(1e3,n-6e4),i=setTimeout(async()=>{let e=ea();if(e)try{await ua(await Qt(Ki()),e)}catch(e){if(e instanceof ca)return;console.error(`Failed to auto-refresh token:`,e),Yi(e)?t(e=>({...e,error:`Connection lost - waiting for daemon...`})):(na(),t({user:null,accessToken:null,authenticated:!1,loading:!1,error:`Session expired, please login again`}))}},r);return()=>clearTimeout(i)},[e.authenticated,e.accessToken]),(0,U.useEffect)(()=>{let e=e=>{let n=e.detail;n&&t(e=>({...e,accessToken:n.accessToken,user:n.user,authenticated:!0}))};return window.addEventListener(ia,e),()=>window.removeEventListener(ia,e)},[]),(0,U.useEffect)(()=>{let e=()=>{na(),t({user:null,accessToken:null,authenticated:!1,loading:!1,error:`Session expired, please login again`})};return window.addEventListener(aa,e),()=>window.removeEventListener(aa,e)},[]);let r=async(e,n)=>{t(e=>({...e,loading:!0,error:null}));try{let r=await(await Qt(Ki())).authenticate({strategy:`local`,email:e,password:n});return $i(r.accessToken,r.refreshToken),la(),t({user:r.user,accessToken:r.accessToken,authenticated:!0,loading:!1,error:null}),!0}catch(e){console.error(`❌ Login failed:`,e);let n=Wa(e),r=e instanceof Error?e.message:`Login failed`;return console.error(`❌ Error message:`,r),t(e=>({...e,loading:!1,error:n})),!1}},i=async()=>{na(),t({user:null,accessToken:null,authenticated:!1,loading:!1,error:null})};return{...e,login:r,logout:i,reAuthenticate:n}}function Ka(){let[e,t]=(0,U.useState)(null),[n,r]=(0,U.useState)(null),[i,a]=(0,U.useState)(null),[o,s]=(0,U.useState)(void 0),[c,l]=(0,U.useState)(void 0),[u,d]=(0,U.useState)(!0),[f,p]=(0,U.useState)(null);return(0,U.useEffect)(()=>{async function e(){try{let e=await fetch(`${Ki()}/health`);if(!e.ok)throw Error(`Failed to fetch auth config: ${e.statusText}`);let n=await e.json();t(n.auth),r(n.instance??null),a(n.onboarding??null),s(n.services),l(n.features),p(null)}catch(e){p(e instanceof Error?e:Error(String(e))),t({requireAuth:!0}),r(null),a(null),s(void 0),l(void 0)}finally{d(!1)}}e()},[]),{config:e,instanceConfig:n,onboardingConfig:i,servicesConfig:o,featuresConfig:c,loading:u,error:f}}function qa(e){let[t,n]=(0,U.useState)(!1),{showError:r}=dn();return{createBoard:async t=>{if(!e)return null;try{return n(!0),await e.service(`boards`).create(t)}catch(e){return r(`Failed to create board: ${e instanceof Error?e.message:String(e)}`),null}finally{n(!1)}},updateBoard:async(t,i)=>{if(!e)return null;try{return n(!0),await e.service(`boards`).patch(t,i)}catch(e){return r(`Failed to update board: ${e instanceof Error?e.message:String(e)}`),null}finally{n(!1)}},deleteBoard:async t=>{if(!e)return!1;try{return n(!0),await e.service(`boards`).remove(t),!0}catch(e){return r(`Failed to delete board: ${e instanceof Error?e.message:String(e)}`),!1}finally{n(!1)}},archiveBoard:async t=>{if(!e)return null;try{return n(!0),await e.service(`boards/${t}/archive`).create({})}catch(e){return r(`Failed to archive board: ${e instanceof Error?e.message:String(e)}`),null}finally{n(!1)}},unarchiveBoard:async t=>{if(!e)return null;try{return n(!0),await e.service(`boards/${t}/unarchive`).create({})}catch(e){return r(`Failed to unarchive board: ${e instanceof Error?e.message:String(e)}`),null}finally{n(!1)}},loading:t}}function Ja(){let{modal:e}=vt.useApp();return{confirm:t=>e.confirm(t),info:t=>e.info(t),warning:t=>e.warning(t),error:t=>e.error(t),success:t=>e.success(t)}}function Ya(){let{confirm:e}=Ja(),{token:t}=I.useToken();return n=>e({title:`Nuke environment?`,icon:(0,W.jsx)(st,{style:{color:t.colorError}}),content:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{children:(0,W.jsx)(`strong`,{children:`This is a destructive operation.`})}),(0,W.jsx)(`p`,{children:`This typically removes all Docker volumes, databases, and other environment state. Source files in the branch are not deleted, but anything stored inside containers or volumes may be lost.`})]}),okText:`Nuke environment`,okType:`danger`,cancelText:`Cancel`,onOk:n})}function Xa({connecting:e,loading:t,dataError:n,mustChangePassword:r,initialLoadComplete:i}){let[a,o]=(0,U.useState)(`loading`);return(0,U.useEffect)(()=>{!e&&!t&&a===`loading`&&(n||r?o(`done`):i&&o(`complete`))},[e,t,a,n,r,i]),(0,U.useEffect)(()=>{if(a===`complete`){let e=setTimeout(()=>o(`fading`),250);return()=>clearTimeout(e)}if(a===`fading`){let e=setTimeout(()=>o(`done`),280);return()=>clearTimeout(e)}},[a]),a}function Za(e,t){if(typeof window>`u`)return t;try{let n=window.localStorage.getItem(e);return n?JSON.parse(n):t}catch(n){return console.error(`Error reading localStorage key "${e}":`,n),t}}function Qa(e,t){if(!(typeof window>`u`))try{window.localStorage.setItem(e,JSON.stringify(t))}catch(t){console.error(`Error setting localStorage key "${e}":`,t)}}var $a=`agor-local-storage-change`;function eo(e,t){let n=(0,U.useCallback)(()=>Za(e,t),[t,e]),[r,i]=(0,U.useState)(n),a=(0,U.useRef)(e);a.current=e;let o=(0,U.useCallback)(e=>{try{i(t=>{let n=e instanceof Function?e(t):e;return Qa(a.current,n),typeof window<`u`&&window.dispatchEvent(new CustomEvent($a,{detail:{key:a.current,value:n}})),n})}catch(e){console.error(`Error setting localStorage key "${a.current}":`,e)}},[]);return(0,U.useEffect)(()=>{if(typeof window>`u`)return;let t=t=>{t.key===e&&i(n())},r=t=>{let n=t;n.detail?.key===e&&i(n.detail.value)};return window.addEventListener(`storage`,t),window.addEventListener($a,r),()=>{window.removeEventListener(`storage`,t),window.removeEventListener($a,r)}},[e,n]),[r,o]}function to(){let{user:e}=Ga(),t=e?.role;return(0,U.useMemo)(()=>({role:t,isAdmin:bt(t,Nt.ADMIN),isSuperAdmin:bt(t,Nt.SUPERADMIN),hasRole:e=>bt(t,e)}),[t])}var no=`agor:recentBoardIds`,ro=10;function io(e,t){let[n,r]=eo(no,[]),i=(0,U.useCallback)(e=>{r(t=>[e,...t.filter(t=>t!==e)].slice(0,ro))},[r]);return{recentBoards:(0,U.useMemo)(()=>{let r=new Map(e.map(e=>[e.board_id,e]));return n.filter(e=>e!==t&&r.has(e)).map(e=>r.get(e)).slice(0,3)},[n,t,e]),recentBoardIds:n,trackBoardVisit:i}}var ao=6e4;function oo(e,t){return!e||!t||e===`dev`||t===`dev`?!1:e!==t}function so(e,t=Ki(),n=ao){let[r,i]=(0,U.useState)(null),[a,o]=(0,U.useState)(null),s=(0,U.useRef)(null),c=(0,U.useCallback)(e=>{e&&(o(e),s.current===null&&(s.current=e,i(e)))},[]);return(0,U.useEffect)(()=>{let e=new AbortController,r=t.replace(/\/$/,``),i=()=>{fetch(`${r}/health`,{signal:e.signal}).then(e=>e.ok?e.json():null).then(e=>{typeof e?.buildSha==`string`&&c(e.buildSha)}).catch(()=>{})};i();let a=n>0?setInterval(i,n):null;return()=>{e.abort(),a!==null&&clearInterval(a)}},[t,n,c]),(0,U.useEffect)(()=>{if(!e?.io)return;let t=e=>{typeof e?.buildSha==`string`&&c(e.buildSha)};return e.io.on(`server-info`,t),()=>{e.io.off(`server-info`,t)}},[e,c]),{capturedSha:r,currentSha:a,outOfSync:oo(r,a)}}function co(){return(0,U.useContext)(Ri)}function lo(e){return un(co(),e)}function uo(e){return Kt(co(),e)}function fo(e){let[t,n]=(0,U.useState)(!1),[r,i]=(0,U.useState)(null),a=async t=>{if(!e)return i(`Client not connected`),null;try{if(n(!0),i(null),!t.branch_id)throw Error(`Branch ID is required`);let r=t.agent,a=t.permissionMode||Tt(r),o={mode:a};if(r===`codex`){let e=wt(a);o.codex={sandboxMode:t.codexSandboxMode??e.sandboxMode,approvalPolicy:t.codexApprovalPolicy??e.approvalPolicy,networkAccess:t.codexNetworkAccess??e.networkAccess}}return await e.service(`sessions`).create({agentic_tool:r,status:zt.IDLE,title:t.title||void 0,description:t.initialPrompt||void 0,branch_id:t.branch_id,model_config:t.modelConfig?{...t.modelConfig,...t.effort&&{effort:t.effort},updated_at:new Date().toISOString()}:t.effort?{effort:t.effort,updated_at:new Date().toISOString()}:void 0,permission_config:o})}catch(e){return i(e instanceof Error?e.message:`Failed to create session`),console.error(`Failed to create session:`,e),null}finally{n(!1)}},o=async(t,r)=>{if(!e)throw i(`Client not connected`),Error(`Client not connected`);try{n(!0),i(null);let a=await e.service(`sessions/${t}/fork`).create({prompt:r});return r.trim()&&await e.sessions.prompt(a.session_id,r,{messageSource:`agor`}),a}catch(e){let t=e instanceof Error?e.message:`Failed to fork session`;throw i(t),console.error(`Failed to fork session:`,e),e instanceof Error?e:Error(t)}finally{n(!1)}},s=async(t,r)=>{if(!e)throw i(`Client not connected`),Error(`Client not connected`);try{n(!0),i(null);let a=await e.service(`sessions/${t}/fork`).create({prompt:r});return await e.service(`sessions`).patch(a.session_id,{fork_origin:`btw`}),r.trim()&&await e.sessions.prompt(a.session_id,r,{messageSource:`agor`}),a}catch(e){let t=e instanceof Error?e.message:`Failed to create btw fork`;throw i(t),console.error(`Failed to create btw fork:`,e),e instanceof Error?e:Error(t)}finally{n(!1)}},c=async(t,r)=>{if(!e)throw i(`Client not connected`),Error(`Client not connected`);try{n(!0),i(null);let a=await e.service(`sessions/${t}/spawn`).create(r);return r.prompt?.trim()&&await e.sessions.prompt(a.session_id,r.prompt,{messageSource:`agor`}),a}catch(e){let t=e instanceof Error?e.message:`Failed to spawn session`;throw i(t),console.error(`Failed to spawn session:`,e),e instanceof Error?e:Error(t)}finally{n(!1)}},l=async(t,n)=>{if(!e)return i(`Client not connected`),null;try{return i(null),await e.service(`sessions`).patch(t,n)}catch(e){return i(e instanceof Error?e.message:`Failed to update session`),console.error(`Failed to update session:`,e),null}};return{createSession:a,updateSession:l,deleteSession:async t=>{if(!e)return i(`Client not connected`),!1;try{return i(null),await e.service(`sessions`).remove(t),!0}catch(e){return i(e instanceof Error?e.message:`Failed to delete session`),console.error(`Failed to delete session:`,e),!1}},archiveSession:async e=>l(e,{archived:!0,archived_reason:`manual`}),unarchiveSession:async e=>l(e,{archived:!1,archived_reason:void 0}),forkSession:o,btwForkSession:s,spawnSession:c,creating:t,error:r}}var po=[`boards`,`repos`,`branches`,`assistants`,`cards`,`artifacts`,`mcp`,`agentic-tools`,`gateway`,`groups`,`users`,`about`];function mo(){let e=fn(),t=qt(),n=e.state?.settingsBackgroundPath??null,r=(0,U.useMemo)(()=>{let t=e.pathname.match(/\/settings(?:\/([^/]+))?(?:\/([^/]+))?\/?$/);if(!t)return{isOpen:!1,section:`boards`,itemId:null};let[,n,r]=t;return{isOpen:!0,section:po.includes(n)?n:`boards`,itemId:r||null}},[e.pathname]),i=(0,U.useCallback)((r=`boards`,i)=>{t(i?`/settings/${r}/${i}/`:`/settings/${r}/`,{state:{settingsBackgroundPath:e.pathname.startsWith(`/settings`)?n||`/`:`${e.pathname}${e.search}${e.hash}`}})},[e.hash,e.pathname,e.search,t,n]),a=(0,U.useCallback)(()=>{t(n||`/`)},[t,n]),o=(0,U.useCallback)(e=>{t(`/settings/${e}/`,{state:n?{settingsBackgroundPath:n}:void 0})},[t,n]),s=(0,U.useCallback)(e=>{t(`/settings/${r.section}/${e}/`,{state:n?{settingsBackgroundPath:n}:void 0})},[t,r.section,n]),c=(0,U.useCallback)(()=>{t(`/settings/${r.section}/`,{state:n?{settingsBackgroundPath:n}:void 0})},[t,r.section,n]);return{...r,openSettings:i,closeSettings:a,setSection:o,openItem:s,closeItem:c}}function ho(e,t,n={}){let{enabled:r=!0,reactiveOptions:i}=n,a=i?.taskHydration??`lazy`,[o,s]=(0,U.useState)(null),[c,l]=(0,U.useState)(null);return(0,U.useEffect)(()=>{if(!e||!t||!r){s(null),l(null);return}let n=St(e,t,{taskHydration:a});s(n);let i=!1,o=()=>{i||l(n.state)};o();let c=n.subscribe(o);return n.ready().then(o).catch(o),()=>{i=!0,c(),Ct(e,t,{taskHydration:a})}},[e,t,r,a]),(0,U.useEffect)(()=>{if(!o)return;let e=()=>{let e=o.state;!e.error||e.terminal||o.resync()},t=()=>{document.visibilityState===`visible`&&e()},n=()=>{e()};return document.addEventListener(`visibilitychange`,t),window.addEventListener(ia,n),()=>{document.removeEventListener(`visibilitychange`,t),window.removeEventListener(ia,n)}},[o]),{handle:o,state:c}}function go(e,t,n,r){let i=Ht(e,Array.from(t,e=>({id:n(e)})));return i.length===0?null:i.length===1?i[0].id:(r?.(e,i.length),null)}function _o(e,t,n){for(let n of t.values())if(n.slug===e)return n.board_id;return go(e,t.values(),e=>e.board_id,n)}function vo(e,t,n){return go(e,t.values(),e=>e.session_id,n)}function yo(e,t,n){return go(e,t.values(),e=>e.branch_id,n)}function bo(e,t,n){return go(e,t.values(),e=>e.artifact_id,n)}function xo(e,t){return t.get(e)?.slug}function So(e,t){return tn(e,xo(e,t))}function Co(e){let{currentBoardId:t,currentSessionId:n,boardById:r,sessionById:i,branchById:a,artifactById:o,onBoardChange:s,onSessionChange:c,onActiveUrlTargetChange:l}=e,u=qt(),d=fn(),f=Jt(),p=Mi(),m=(0,U.useRef)(!1),h=(0,U.useRef)(null),g=(0,U.useRef)(t),_=(0,U.useRef)(n),v=(0,U.useRef)(null),y=(0,U.useRef)(null),b=(0,U.useRef)(null),x=(0,U.useRef)(null),S=(0,U.useRef)({board:!1,session:!1,branch:!1,artifact:!1}),C=(0,U.useRef)(null),w=(0,U.useRef)(null);(0,U.useEffect)(()=>{g.current=t,_.current=n},[t,n]),(0,U.useEffect)(()=>()=>{C.current&&=(clearTimeout(C.current),null)},[]);let T=f.boardParam||null,E=f.sessionShortId||null,D=f.branchShortId||null,O=f.artifactShortId||null,k=d.pathname.startsWith(`/settings`),A=(0,U.useCallback)((e,t)=>t?Mt(t):e?So(e,r):`/`,[r]),j=(0,U.useCallback)(()=>{if(m.current||n===null&&[jt.branch,jt.artifact].some(e=>d.pathname.startsWith(`/${e}/`)))return;let e=A(t,n),r=`${(d.pathname+d.search).replace(/\/$/,``)}/`;`${e.replace(/\/$/,``)}/`!==r&&e!==h.current&&(h.current=e,u(e,{replace:!0}))},[t,n,A,d.pathname,d.search,u]),M=(0,U.useCallback)((e,t,n)=>{},[]),N=(0,U.useCallback)(e=>_o(e,r,(e,t)=>M(`board`,e,t)),[r,M]),P=(0,U.useCallback)(e=>vo(e,i,(e,t)=>M(`session`,e,t)),[i,M]),ee=(0,U.useCallback)(e=>yo(e,a,(e,t)=>M(`branch`,e,t)),[a,M]),te=(0,U.useCallback)(e=>bo(e,o,(e,t)=>M(`artifact`,e,t)),[o,M]);(0,U.useEffect)(()=>{let e=T!==v.current||E!==y.current||D!==b.current||O!==x.current;e&&(S.current={board:!1,session:!1,branch:!1,artifact:!1},v.current=T,y.current=E,b.current=D,x.current=O,C.current&&=(clearTimeout(C.current),null));let t=S.current.board&&S.current.session&&S.current.branch&&S.current.artifact;if(!e&&t)return;if(!T&&!E&&!D&&!O){let e=d.pathname===`/`||d.pathname===``;if(!k&&!e){m.current=!0,u(`/`,{replace:!0}),setTimeout(()=>{m.current=!1},0);return}!k&&g.current&&(m.current=!0,s(``),_.current&&c(null),setTimeout(()=>{m.current=!1},0)),l&&w.current!==null&&(w.current=null,l(null));return}if(T&&r.size===0||E&&i.size===0||D&&a.size===0||O&&o.size===0)return;let n=null,f=null,h=null,A=null;if(T?(n=N(T),n&&(S.current.board=!0)):S.current.board=!0,E){if(f=P(E),f){S.current.session=!0;let e=i.get(f),t=e?.branch_id?a.get(e.branch_id):void 0;t?.board_id&&(n=t.board_id,h=t.branch_id)}}else S.current.session=!0;if(D){let e=ee(D);if(e){S.current.branch=!0,A={kind:`branch`,id:e};let t=a.get(e);t?.board_id&&(n=t.board_id,h=e)}}else S.current.branch=!0;if(O){let e=te(O);if(e){S.current.artifact=!0,A={kind:`artifact`,id:e};let t=o.get(e);t?.board_id&&(n=t.board_id,h=e)}}else S.current.artifact=!0;if(l){let e=w.current;(e===null!=(A===null)||e!==null&&A!==null&&(e.kind!==A.kind||e.id!==A.id))&&(w.current=A,l(A))}let j=n&&n!==g.current,M=E?f:null,ne=M!==_.current;if((j||ne)&&(m.current=!0,j&&n&&s(n),ne&&c(M),setTimeout(()=>{m.current=!1},0)),e&&h&&n){let e=h,t=n;C.current=setTimeout(()=>{C.current=null,p(e,{boardId:t})},50)}},[T,E,D,O,r.size,i,a,o,N,P,ee,te,s,c,l,k,p,d.pathname,u]),(0,U.useEffect)(()=>{m.current||k||!T&&!E&&!D&&!O&&d.pathname!==`/`&&d.pathname!==``||r.size!==0&&(T&&!S.current.board||E&&!S.current.session||D&&!S.current.branch||O&&!S.current.artifact||j())},[r.size,T,E,D,O,k,j,d.pathname])}function wo(e){(0,U.useEffect)(()=>{if(e.branding===`dynamic`)return;let t=document.querySelector(`link[rel~='icon']`);t&&(t.href=Mr()),document.title=e.branding},[e])}function To(e){return Array.from(e.values())}function Eo(e,t){let n=Array.from(e.values());return t?n.sort(t):n}function Do(e){return Jn(e).map(e=>e.trim().toLowerCase()).filter(Boolean)}function Oo(e){return e==null?[]:Array.isArray(e)?e.flatMap(Oo):[String(e)]}function ko(e,t,n){let r=Do(t);return r.length===0?!0:qn(r,n.flatMap(t=>Oo(t(e))))}function Ao(e,t,n){return Do(t).length===0?e:e.filter(e=>ko(e,t,n))}function jo(e,t=2){let n=e.trim().toLowerCase(),r=Mo(Jn(e).filter(e=>e.length>=t)),i=n.split(/\s+/).filter(Boolean);return n.length>=t&&i.length>0&&i.every(e=>e.length>=t)&&!r.includes(n)&&r.unshift(n),r.sort((e,t)=>t.length-e.length)}function Mo(e){let t=new Set,n=[];for(let r of e)t.has(r)||(t.add(r),n.push(r));return n}var No=({text:e,query:t=``,terms:n,minTermLength:r=2})=>{let{token:i}=I.useToken(),a=n??jo(t,r);if(!e||a.length===0)return(0,W.jsx)(W.Fragment,{children:e});let o=a.map(Po).filter(Boolean);if(o.length===0)return(0,W.jsx)(W.Fragment,{children:e});let s=RegExp(`(${o.join(`|`)})`,`gi`);return(0,W.jsx)(W.Fragment,{children:e.split(s).map((e,t)=>e?a.some(t=>t.toLowerCase()===e.toLowerCase())?(0,W.jsx)(`mark`,{style:{backgroundColor:i.colorWarning,color:`rgba(0, 0, 0, 0.88)`,padding:`0 ${i.paddingXXS}px`,borderRadius:i.borderRadiusSM,fontWeight:600},children:e},t):(0,W.jsx)(`span`,{children:e},t):null)})};function Po(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}var Fo=new Set([`authorization`,`connection`,`content-length`,`cookie`,`host`,`mcp-session-id`,`te`,`trailer`,`transfer-encoding`,`upgrade`]),Io=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function Lo(e){return Io.test(e)}function Ro(e){return Fo.has(e.toLowerCase())}function zo(e){return e?e.includes(`{{`)&&e.includes(`}}`):!1}function Bo(e){let t={};return e.oauth_authorization_url&&typeof e.oauth_authorization_url==`string`&&(t.oauth_authorization_url=e.oauth_authorization_url),e.oauth_token_url&&typeof e.oauth_token_url==`string`&&(t.oauth_token_url=e.oauth_token_url),e.oauth_client_id&&typeof e.oauth_client_id==`string`&&(t.oauth_client_id=e.oauth_client_id),e.oauth_client_secret&&typeof e.oauth_client_secret==`string`&&(t.oauth_client_secret=e.oauth_client_secret),e.oauth_scope&&typeof e.oauth_scope==`string`&&(t.oauth_scope=e.oauth_scope),t.oauth_grant_type=typeof e.oauth_grant_type==`string`?e.oauth_grant_type:`client_credentials`,t.oauth_mode=e.oauth_mode===`shared`?`shared`:`per_user`,t}function Vo(e){if(!e.url||typeof e.url!=`string`)return null;let t={mcp_url:e.url};return e.oauth_token_url&&typeof e.oauth_token_url==`string`&&(t.token_url=e.oauth_token_url),e.oauth_client_id&&typeof e.oauth_client_id==`string`&&!zo(e.oauth_client_id)&&(t.client_id=e.oauth_client_id),e.oauth_client_secret&&typeof e.oauth_client_secret==`string`&&!zo(e.oauth_client_secret)&&(t.client_secret=e.oauth_client_secret),e.oauth_scope&&typeof e.oauth_scope==`string`&&(t.scope=e.oauth_scope),e.oauth_grant_type&&typeof e.oauth_grant_type==`string`&&(t.grant_type=e.oauth_grant_type),t}function Ho(e){let t=e.auth_type;if(t!==`bearer`&&t!==`jwt`&&t!==`oauth`)return;let n={type:t};return t===`bearer`?typeof e.auth_token==`string`&&(n.token=e.auth_token):t===`jwt`?(typeof e.jwt_api_url==`string`&&(n.api_url=e.jwt_api_url),typeof e.jwt_api_token==`string`&&(n.api_token=e.jwt_api_token),typeof e.jwt_api_secret==`string`&&(n.api_secret=e.jwt_api_secret)):Object.assign(n,Bo(e)),n}function Uo(e){if(!(typeof e!=`string`||!e.trim()))try{return JSON.parse(e)}catch{return}}function Wo(e){if(!(typeof e!=`string`||!e.trim()))try{let t=JSON.parse(e),n={};for(let[e,r]of Object.entries(t))e.toLowerCase()!==`authorization`&&typeof r==`string`&&(n[e]=r);return n}catch{return}}function Go(e){if(typeof e!=`string`||!e.trim())return;let t;try{t=JSON.parse(e)}catch{return`Custom HTTP headers must be valid JSON`}if(!t||typeof t!=`object`||Array.isArray(t))return`Custom HTTP headers must be a JSON object`;for(let[e,n]of Object.entries(t)){let t=e.trim();if(!t)return`Custom HTTP header names cannot be empty`;if(!Lo(t))return`Invalid custom HTTP header name: ${e}`;if(Ro(t))return`Custom HTTP header ${t} is reserved and cannot be configured here`;if(typeof n!=`string`)return`Custom HTTP header values must be strings`}}var{TextArea:Ko}=L;function qo(e){return e!==`stdio`}var Jo=({mode:e,transport:t,onTransportChange:n,authType:r=`none`,onAuthTypeChange:i,form:a,client:s,serverId:l,onTestConnection:u,testing:d=!1,testResult:f,onSaveFirst:p})=>{let{showSuccess:m,showError:h,showWarning:g,showInfo:_}=dn(),[y,b]=(0,U.useState)(!1),[x,S]=(0,U.useState)(!1),[C,w]=(0,U.useState)(!1),[E,D]=(0,U.useState)(!1),[O,A]=(0,U.useState)(!1),j=(0,U.useRef)(null);(0,U.useEffect)(()=>()=>{j.current?.()},[]);let[N,P]=(0,U.useState)(l);(0,U.useEffect)(()=>{P(l)},[l]);let ee=B.useWatch(`oauth_authorization_url`,a),te=B.useWatch(`oauth_token_url`,a),ne=B.useWatch(`oauth_scope`,a),ie=B.useWatch(`oauth_client_id`,a),ae=B.useWatch(`oauth_client_secret`,a),I=B.useWatch(`oauth_mode`,a),oe=B.useWatch(`env`,a),se=B.useWatch(`headers`,a),ce=typeof oe==`string`&&oe.trim().length>0,le=qo(t)&&typeof se==`string`&&se.trim().length>0,ue=[ee,te,ne,ie,ae].some(e=>typeof e==`string`&&e.trim().length>0)||typeof I==`string`&&I!==`per_user`,de=async()=>{if(!s){h(`Client not available`);return}let e=N;if(!e&&p){_(`Saving MCP server before testing...`);let t=await p();if(!t){h(`Failed to save MCP server`);return}e=t,P(t)}let t=Vo(a.getFieldsValue(!0));if(!t){h(`MCP URL is required`);return}w(!0);let n=({authUrl:e})=>{window.open(e,`_blank`,`noopener,noreferrer`)};s.io.on(`oauth:open_browser`,n);try{_(`Starting OAuth authentication flow...`);let n=await s.service(`mcp-servers/oauth-start`).create({mcp_url:t.mcp_url,mcp_server_id:e,client_id:t.client_id});if(n.success&&n.state){D(!0),_(`Authenticating... complete sign-in in the new tab.`);let e=e=>{e.state===n.state&&e.success&&(m(`OAuth authentication successful!`),D(!1),S(!1),t())},t=()=>{s.io.off(`oauth:completed`,e),j.current=null};j.current?.(),j.current=t,s.io.on(`oauth:completed`,e)}else h(n.error||`Failed to start OAuth flow`)}catch(e){h(`OAuth flow error: ${e instanceof Error?e.message:String(e)}`)}finally{s.io.off(`oauth:open_browser`,n),w(!1)}},fe=async()=>{if(!s){h(`Client not available`);return}if(!N){h(`Cannot disconnect: MCP server must be saved first`);return}A(!0);try{let e=await s.service(`mcp-servers/oauth-disconnect`).create({mcp_server_id:N});e.success?(m(e.message||`OAuth connection removed`),S(!0)):h(e.error||`Failed to disconnect OAuth`)}catch(e){h(`Disconnect error: ${e instanceof Error?e.message:String(e)}`)}finally{A(!1)}},pe=async()=>{if(!s){h(`Client not available`);return}let e=a.getFieldsValue(!0),t=e.auth_type||r;b(!0);try{if(t===`jwt`){let t=e.jwt_api_url,n=e.jwt_api_token,r=e.jwt_api_secret;if(!t||!n||!r){h(`Please fill in all JWT authentication fields`);return}let i=await s.service(`mcp-servers/test-jwt`).create({api_url:t,api_token:n,api_secret:r});i.success?m(`JWT authentication successful - token received`):h(i.error||`JWT authentication failed`)}else if(t===`oauth`){let t=Vo(e);if(!t){g(`Please enter MCP URL first to test OAuth authentication`);return}let n=await s.service(`mcp-servers/test-oauth`).create(t);if(n.success)if(n.requiresBrowserFlow)S(!0),_(n.message||`OAuth 2.1 detected. Click "Start OAuth Flow" to authenticate in browser.`);else if(n.oauthType===`none`)S(!1),m(`MCP server accessible without authentication`);else{let e=n.message||`OAuth authentication successful`;n.tokenUrlSource===`auto-detected`&&(e+=` (token URL auto-detected)`),n.mcpStatus!==void 0&&(e+=` | MCP server responded with ${n.mcpStatus}`),m(e)}else{let e=n.error||`OAuth authentication failed`;n.hint&&(e+=`\n\nHint: ${n.hint}`),h(e)}}else t===`bearer`?e.auth_token?m(`Bearer token configured`):g(`No bearer token provided`):_(`No authentication required - ready to use`)}catch(e){h(`Connection test failed: ${e instanceof Error?e.message:`Unknown error`}`)}finally{b(!1)}},me=qo(t),he=me&&r===`oauth`,_e=e===`create`,ye=(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(ge,{gutter:16,children:[(0,W.jsx)(ut,{span:12,children:_e?(0,W.jsx)(B.Item,{label:`Name (Internal ID)`,name:`name`,rules:[{required:!0,message:`Please enter a server name`},{pattern:/^[a-z][a-z0-9_-]*$/,message:`Lowercase letters, digits, _ or - only; must start with a letter`},{max:64,message:`Maximum 64 characters`}],tooltip:`Internal identifier - lowercase, no spaces (e.g., filesystem, sentry, context7)`,children:(0,W.jsx)(L,{placeholder:`context7`})}):(0,W.jsx)(B.Item,{label:`Name (Internal ID)`,name:`name`,tooltip:`Internal identifier - cannot be changed after creation`,children:(0,W.jsx)(L,{disabled:!0})})}),(0,W.jsx)(ut,{span:12,children:(0,W.jsx)(B.Item,{label:_e?`Display Name (Optional)`:`Display Name`,name:`display_name`,tooltip:`User-friendly name shown in UI (e.g., Context7 MCP)`,children:(0,W.jsx)(L,{placeholder:_e?`Context7 MCP`:`Filesystem Access`})})})]}),(0,W.jsxs)(ge,{gutter:16,children:[(0,W.jsx)(ut,{span:12,children:(0,W.jsx)(B.Item,{label:`Scope`,name:`scope`,initialValue:_e?`session`:`global`,tooltip:`Where this server is available`,children:(0,W.jsxs)(F,{children:[(0,W.jsx)(F.Option,{value:`global`,children:`Global (all sessions)`}),(0,W.jsx)(F.Option,{value:`session`,children:`Session`})]})})}),(0,W.jsx)(ut,{span:12,children:(0,W.jsx)(B.Item,{label:`Enabled`,name:`enabled`,valuePropName:`checked`,initialValue:!0,children:(0,W.jsx)(ve,{})})})]}),(0,W.jsx)(B.Item,{label:`Description`,name:`description`,children:(0,W.jsx)(Ko,{placeholder:`Optional description...`,rows:2})})]}),be=(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(k,{title:(0,W.jsxs)(W.Fragment,{children:[`Use `,(0,W.jsx)(o.Text,{code:!0,children:`{{ user.env.VAR }}`}),` to inject your environment variables.`]}),type:`info`,showIcon:!0,style:{marginBottom:16}}),(0,W.jsx)(B.Item,{label:`Transport`,name:`transport`,rules:e===`create`?[{required:!0}]:[],initialValue:e===`create`?`stdio`:void 0,tooltip:`Connection method: stdio for local processes, HTTP/SSE for remote servers`,children:(0,W.jsxs)(F,{onChange:e=>n?.(e),children:[(0,W.jsx)(F.Option,{value:`stdio`,children:`stdio (Local process)`}),(0,W.jsx)(F.Option,{value:`http`,children:`HTTP`}),(0,W.jsx)(F.Option,{value:`sse`,children:`SSE (Server-Sent Events)`})]})}),t===`stdio`?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(B.Item,{label:`Command`,name:`command`,rules:e===`create`?[{required:!0,message:`Please enter a command`}]:[],tooltip:`Command to execute (e.g., npx, node, python)`,children:(0,W.jsx)(L,{placeholder:`npx`})}),(0,W.jsx)(B.Item,{label:`Arguments`,name:`args`,tooltip:`Comma-separated arguments. Each argument will be passed separately to the command. Example: -y, @modelcontextprotocol/server-filesystem, /allowed/path`,children:(0,W.jsx)(L,{placeholder:`-y, @modelcontextprotocol/server-filesystem, /allowed/path`})})]}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(B.Item,{label:`URL`,name:`url`,rules:e===`create`?[{required:!0,message:`Please enter a URL`}]:[],tooltip:`Server URL. Supports templates like {{ user.env.MCP_URL }}`,children:(0,W.jsx)(L,{placeholder:`https://mcp.example.com`})}),(0,W.jsx)(B.Item,{label:`Auth Type`,name:`auth_type`,initialValue:`none`,tooltip:`Authentication method for the MCP server`,children:(0,W.jsxs)(F,{onChange:e=>{S(!1),e!==`jwt`&&a.setFieldsValue({jwt_api_url:void 0,jwt_api_token:void 0,jwt_api_secret:void 0}),e!==`bearer`&&a.setFieldsValue({auth_token:void 0}),e!==`oauth`&&a.setFieldsValue({oauth_authorization_url:void 0,oauth_token_url:void 0,oauth_client_id:void 0,oauth_client_secret:void 0,oauth_scope:void 0}),i?.(e)},children:[(0,W.jsx)(F.Option,{value:`none`,children:`None`}),(0,W.jsx)(F.Option,{value:`bearer`,children:`Bearer Token`}),(0,W.jsx)(F.Option,{value:`jwt`,children:`JWT`}),(0,W.jsx)(F.Option,{value:`oauth`,children:`OAuth 2.1`})]})}),r===`bearer`&&(0,W.jsx)(B.Item,{label:`Token`,name:`auth_token`,rules:[{required:!0,message:`Please enter a bearer token`}],tooltip:`Bearer token. Supports templates like {{ user.env.API_TOKEN }}`,children:(0,W.jsx)(L.Password,{placeholder:`{{ user.env.API_TOKEN }} or raw token`})}),r===`jwt`&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(B.Item,{label:`API URL`,name:`jwt_api_url`,rules:[{required:!0,message:`Please enter the API URL`}],tooltip:`JWT auth API URL. Supports templates.`,children:(0,W.jsx)(L,{placeholder:`https://auth.example.com/token`})}),(0,W.jsx)(B.Item,{label:`API Token`,name:`jwt_api_token`,rules:[{required:!0,message:`Please enter the API token`}],tooltip:`JWT API token. Supports templates like {{ user.env.JWT_TOKEN }}`,children:(0,W.jsx)(L.Password,{placeholder:`{{ user.env.JWT_TOKEN }} or raw token`})}),(0,W.jsx)(B.Item,{label:`API Secret`,name:`jwt_api_secret`,rules:[{required:!0,message:`Please enter the API secret`}],tooltip:`JWT API secret. Supports templates like {{ user.env.JWT_SECRET }}`,children:(0,W.jsx)(L.Password,{placeholder:`{{ user.env.JWT_SECRET }} or raw secret`})})]})]}),(r!==`none`||me)&&(0,W.jsx)(B.Item,{label:`Actions`,style:{marginBottom:16},children:(0,W.jsxs)(z,{wrap:!0,children:[r!==`none`&&(0,W.jsx)(V,{type:`default`,loading:y,onClick:pe,children:`Test Authentication`}),r===`oauth`&&x&&(0,W.jsx)(V,{type:`primary`,loading:C,onClick:de,children:`Start OAuth Flow`}),r===`oauth`&&N&&!x&&(0,W.jsx)(V,{type:`default`,danger:!0,loading:O,onClick:fe,children:`Disconnect OAuth`}),me&&(0,W.jsx)(V,{type:`default`,icon:(0,W.jsx)(pt,{}),onClick:u,loading:d,children:d?`Testing...`:`Test Connection`})]})}),f?.success&&(0,W.jsxs)(`div`,{style:{marginBottom:16},children:[(0,W.jsx)(k,{type:`success`,title:`Connected: ${f.toolCount} tools, ${f.resourceCount} resources, ${f.promptCount} prompts`,showIcon:!0,style:{marginBottom:8}}),f.tools&&f.tools.length>0&&(0,W.jsxs)(`div`,{style:{marginTop:8},children:[(0,W.jsx)(o.Text,{type:`secondary`,style:{fontSize:12,display:`block`,marginBottom:4},children:`Tools:`}),(0,W.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:4},children:f.tools.map(e=>(0,W.jsx)(M,{title:e.description||`No description`,placement:`top`,children:(0,W.jsx)(v,{color:`blue`,style:{marginBottom:4,cursor:`help`},children:e.name})},e.name))})]}),f.resources&&f.resources.length>0&&(0,W.jsxs)(`div`,{style:{marginTop:8},children:[(0,W.jsx)(o.Text,{type:`secondary`,style:{fontSize:12,display:`block`,marginBottom:4},children:`Resources:`}),(0,W.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:4},children:f.resources.map(e=>(0,W.jsx)(M,{title:(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{children:e.uri}),e.mimeType&&(0,W.jsx)(`div`,{style:{opacity:.7,fontSize:11},children:e.mimeType})]}),placement:`top`,children:(0,W.jsx)(v,{color:`cyan`,style:{marginBottom:4,cursor:`help`},children:e.name})},e.uri))})]}),f.prompts&&f.prompts.length>0&&(0,W.jsxs)(`div`,{style:{marginTop:8},children:[(0,W.jsx)(o.Text,{type:`secondary`,style:{fontSize:12,display:`block`,marginBottom:4},children:`Prompts:`}),(0,W.jsx)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:4},children:f.prompts.map(e=>(0,W.jsx)(M,{title:e.description||`No description`,placement:`top`,children:(0,W.jsx)(v,{color:`purple`,style:{marginBottom:4,cursor:`help`},children:e.name})},e.name))})]})]}),f&&!f.success&&(0,W.jsx)(k,{type:`error`,title:`Connection failed`,description:f.error,showIcon:!0,style:{marginBottom:16}}),he&&(0,W.jsx)(c,{ghost:!0,destroyOnHidden:!1,expandIcon:({isActive:e})=>(0,W.jsx)(T,{rotate:e?180:0}),items:[{key:`advanced-oauth`,forceRender:!0,label:(0,W.jsxs)(z,{size:8,children:[(0,W.jsx)(o.Text,{strong:!0,children:`Advanced — OAuth settings`}),(0,W.jsx)(o.Text,{type:`secondary`,style:{fontSize:12},children:`(auto-discovered when blank)`}),ue&&(0,W.jsx)(M,{title:`Customized — one or more values overridden`,children:(0,W.jsx)(re,{color:`orange`})})]}),children:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(k,{title:`OAuth defaults are usually fine`,description:(0,W.jsxs)(`ul`,{style:{margin:0,paddingLeft:20,fontSize:12},children:[(0,W.jsx)(`li`,{children:`Modern OAuth 2.1 servers support discovery (RFC 8414 / RFC 9728) and Dynamic Client Registration — leave everything here blank.`}),(0,W.jsx)(`li`,{children:`Set Client ID / Client Secret only for servers that require a pre-registered OAuth app (e.g. Figma, GitHub).`}),(0,W.jsx)(`li`,{children:`Override the URLs only if the server doesn't expose a discovery document or you need a non-default endpoint.`})]}),type:`info`,showIcon:!0,style:{marginBottom:16}}),(0,W.jsx)(B.Item,{label:`Client ID`,name:`oauth_client_id`,tooltip:`Required for servers that don't support Dynamic Client Registration (e.g. Figma, GitHub). Register an OAuth app with the provider and paste the client ID here. Leave blank to use DCR.`,children:(0,W.jsx)(L,{placeholder:`Enter client ID or {{ user.env.OAUTH_CLIENT_ID }}`,allowClear:!0})}),(0,W.jsx)(B.Item,{label:`Client Secret`,name:`oauth_client_secret`,tooltip:`Required for servers that use confidential clients (e.g. Figma). The secret is sent via HTTP Basic Auth during token exchange.`,children:(0,W.jsx)(L.Password,{placeholder:`Enter client secret or {{ user.env.OAUTH_CLIENT_SECRET }}`,allowClear:!0})}),(0,W.jsx)(B.Item,{label:`OAuth Mode`,name:`oauth_mode`,initialValue:`per_user`,tooltip:`Per User: Each user authenticates separately (recommended). Shared: One token for all users.`,children:(0,W.jsxs)(F,{children:[(0,W.jsx)(F.Option,{value:`per_user`,children:`Per User (each user authenticates) - Recommended`}),(0,W.jsx)(F.Option,{value:`shared`,children:`Shared (single token for all users)`})]})}),(0,W.jsx)(B.Item,{label:`Authorization URL`,name:`oauth_authorization_url`,tooltip:`OAuth authorization endpoint for browser-based login. Leave empty for auto-discovery (RFC 8414).`,children:(0,W.jsx)(L,{placeholder:`https://auth.example.com/oauth/authorize`,allowClear:!0})}),(0,W.jsx)(B.Item,{label:`Token URL`,name:`oauth_token_url`,tooltip:`OAuth token endpoint. Leave empty for auto-discovery (OAuth 2.1 RFC 9728)`,children:(0,W.jsx)(L,{placeholder:`Auto-detect or {{ user.env.OAUTH_TOKEN_URL }}`,allowClear:!0})}),(0,W.jsx)(B.Item,{label:`Scope`,name:`oauth_scope`,tooltip:`Optional: OAuth scopes (space-separated, e.g., 'read write')`,children:(0,W.jsx)(L,{placeholder:`Leave empty or specify scopes`,allowClear:!0})}),(0,W.jsx)(B.Item,{label:`Grant Type`,name:`oauth_grant_type`,initialValue:`client_credentials`,tooltip:`OAuth grant type for Client Credentials flow. OAuth 2.1 auto-discovery uses Authorization Code with PKCE instead.`,children:(0,W.jsx)(F,{disabled:!0,children:(0,W.jsx)(F.Option,{value:`client_credentials`,children:`Client Credentials`})})})]})}]})]});return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(c,{ghost:!0,destroyOnHidden:!1,defaultActiveKey:[`basic`,`connection`],expandIcon:({isActive:e})=>(0,W.jsx)(T,{rotate:e?180:0}),items:[{key:`basic`,label:(0,W.jsx)(o.Text,{strong:!0,children:`Basic Information`}),children:ye},{key:`connection`,label:(0,W.jsx)(o.Text,{strong:!0,children:`Connection`}),children:be},{key:`advanced-config`,label:(0,W.jsxs)(z,{size:8,children:[(0,W.jsx)(o.Text,{strong:!0,children:`Advanced Configuration`}),(0,W.jsx)(o.Text,{type:`secondary`,style:{fontSize:12},children:`(headers and environment variables)`}),(le||ce)&&(0,W.jsx)(M,{title:`Advanced configuration set`,children:(0,W.jsx)(re,{color:`orange`})})]}),children:(0,W.jsxs)(W.Fragment,{children:[me&&(0,W.jsx)(B.Item,{label:`Custom HTTP Headers`,name:`headers`,tooltip:`JSON object of additional headers for HTTP/SSE transports. Values support templates like {{ user.env.DATADOG_API_KEY }}. Authorization is configured via Auth Type, not here.`,rules:[{validator:async(e,t)=>{let n=Go(t);if(n)throw Error(n)}}],children:(0,W.jsx)(Ko,{placeholder:`{"DD-API-KEY": "{{ user.env.DATADOG_API_KEY }}", "X-Datadog-Parent-Org-Id": "123"}`,rows:3})}),(0,W.jsx)(B.Item,{label:`Environment Variables`,name:`env`,tooltip:`JSON object of environment variables. Values support templates like {{ user.env.VAR_NAME }}`,children:(0,W.jsx)(Ko,{placeholder:`{"GITHUB_TOKEN": "{{ user.env.GITHUB_TOKEN }}", "ALLOWED_PATHS": "/path"}`,rows:3})})]})}]}),(0,W.jsx)(nt,{title:`OAuth Authentication`,open:E,onCancel:()=>{D(!1),j.current?.()},footer:[(0,W.jsx)(V,{onClick:()=>{D(!1),j.current?.()},children:`Cancel`},`cancel`)],children:(0,W.jsxs)(z,{orientation:`vertical`,style:{width:`100%`},children:[(0,W.jsx)(o.Paragraph,{children:`Waiting for authentication to complete in the browser tab...`}),(0,W.jsx)(o.Paragraph,{children:`This dialog will close automatically once sign-in is complete.`})]})})]})},Yo=({server:e,open:t,client:n,onClose:r})=>{let{showSuccess:i,showError:a}=dn(),[o]=B.useForm(),[s,c]=(0,U.useState)(`stdio`),[l,u]=(0,U.useState)(`none`),[d,f]=(0,U.useState)(!1),[p,m]=(0,U.useState)(null);(0,U.useEffect)(()=>{if(!t||!e)return;m(null);let n=e.auth?.type||`none`;u(n),c(e.transport||(e.url?`http`:`stdio`)),o.resetFields();let r={name:e.name,display_name:e.display_name,description:e.description,transport:e.transport||(e.url?`http`:`stdio`),command:e.command,args:e.args?.join(`, `),url:e.url,scope:e.scope,enabled:e.enabled,env:e.env?JSON.stringify(e.env,null,2):void 0,headers:e.headers?JSON.stringify(e.headers,null,2):void 0,auth_type:n};n===`bearer`?r.auth_token=e.auth?.token:n===`jwt`?(r.jwt_api_url=e.auth?.api_url,r.jwt_api_token=e.auth?.api_token,r.jwt_api_secret=e.auth?.api_secret):n===`oauth`&&(r.oauth_authorization_url=e.auth?.oauth_authorization_url,r.oauth_token_url=e.auth?.oauth_token_url,r.oauth_client_id=e.auth?.oauth_client_id,r.oauth_client_secret=e.auth?.oauth_client_secret,r.oauth_scope=e.auth?.oauth_scope,r.oauth_grant_type=e.auth?.oauth_grant_type||`client_credentials`,r.oauth_mode=e.auth?.oauth_mode||`per_user`),o.setFieldsValue(r)},[t,e?.mcp_server_id,o]);let h=()=>{o.resetFields(),c(`stdio`),u(`none`),m(null),r()};return(0,W.jsx)(nt,{title:`Edit MCP Server`,open:t,onOk:async()=>{if(!(!e||!n))try{await o.validateFields();let t=o.getFieldsValue(!0),r={display_name:t.display_name,description:t.description,scope:t.scope,enabled:t.enabled,transport:t.transport};t.transport===`stdio`?(r.command=t.command,r.args=t.args?.split(`,`).map(e=>e.trim())||[]):(r.url=t.url,r.headers=Wo(t.headers));let a=Uo(t.env);a&&(r.env=a),r.auth=Ho(t),await n.service(`mcp-servers`).patch(e.mcp_server_id,r),i(`MCP server updated successfully`),h()}catch(e){a(e instanceof Error?e.message:`Failed to update server`)}},onCancel:h,okText:`Save`,width:600,destroyOnHidden:!0,children:(0,W.jsx)(B,{form:o,layout:`vertical`,style:{marginTop:16},children:(0,W.jsx)(Jo,{mode:`edit`,transport:s,onTransportChange:c,authType:l,onAuthTypeChange:u,form:o,client:n,serverId:e?.mcp_server_id,onTestConnection:async()=>{if(!n||!e){a(`Client not available`);return}let t=o.getFieldsValue(!0);if(!t.url){a(`URL is required to test connection`);return}if(t.transport===`stdio`){a(`Connection test is not available for stdio transport`);return}try{await o.validateFields([`headers`])}catch{a(`Please fix custom HTTP headers before testing`);return}f(!0),m(null);try{let r=await n.service(`mcp-servers/discover`).create({mcp_server_id:e.mcp_server_id,url:t.url,transport:t.transport||`http`,auth:Ho(t),headers:Wo(t.headers)});r.success&&r.capabilities?m({success:!0,toolCount:r.capabilities.tools,resourceCount:r.capabilities.resources,promptCount:r.capabilities.prompts,tools:r.tools,resources:r.resources,prompts:r.prompts}):m({success:!1,toolCount:0,resourceCount:0,promptCount:0,error:r.error||`Connection test failed`})}catch(e){m({success:!1,toolCount:0,resourceCount:0,promptCount:0,error:e instanceof Error?e.message:`Unknown error`})}finally{f(!1)}},testing:d,testResult:p})})})};function Xo(e){let t=typeof e==`string`?new Date(e):e,n=new Date().getTime()-t.getTime(),r=Math.floor(n/1e3),i=Math.floor(r/60),a=Math.floor(i/60),o=Math.floor(a/24);return r<60?`just now`:i<60?`${i}m ago`:a<24?`${a}h ago`:o<7?`${o}d ago`:o<30?`${Math.floor(o/7)}w ago`:o<365?`${Math.floor(o/30)}mo ago`:`${Math.floor(o/365)}y ago`}function Zo(e){if(!e)return;let t=typeof e==`string`?new Date(e):e;if(!Number.isNaN(t.getTime()))return Xo(t)}function Qo(e){let t=typeof e==`string`?new Date(e):e;return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)} ${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}:${String(t.getSeconds()).padStart(2,`0`)}`}function $o(e,t){let n=Xo(e),r=Qo(e);return t===void 0?`${n}\n${r}`:`${n}\n${r}\nMessage index: ${t}`}var es=({id:e,label:t,icon:n,color:r,copyLabel:i,metadataCard:a})=>{let{showSuccess:o,showError:s}=dn(),c=(0,W.jsx)(Zn,{icon:(0,W.jsx)(n,{}),color:r,style:{margin:0,fontSize:10,cursor:`pointer`,fontFamily:`monospace`},onClick:a?void 0:async()=>{await on(e)?o(`${i} copied: ${e}`):s(`Failed to copy to clipboard`)},children:t??cn(e)});return a?(0,W.jsx)(Ue,{content:a,title:null,trigger:`click`,placement:`left`,children:c}):c};function ts(e){return e<50?`rgba(82, 196, 26, 0.12)`:e<80?`rgba(250, 173, 20, 0.12)`:`rgba(255, 77, 79, 0.12)`}function ns(e){return Number.isFinite(e)?Math.max(0,Math.min(100,e)):0}function rs(e,t,n){return n&&Number.isFinite(n.percentage)?ns(n.percentage):!e||!t?0:ns(e/t*100)}function is(e,t,n){if(!n&&(!e||!t))return;let r=rs(e,t,n);return`linear-gradient(to right, ${ts(r)} ${r}%, transparent ${r}%)`}var as=`-dirty`;function os(e){return e?e.endsWith(as)?{cleanSha:e.slice(0,-6),isDirty:!0}:{cleanSha:e,isDirty:!1}:{cleanSha:``,isDirty:!1}}var ss=({label:e,id:t})=>{let{token:n}=I.useToken();return(0,W.jsxs)(`div`,{style:{display:`flex`,alignItems:`baseline`,gap:8,padding:`2px 0`},children:[(0,W.jsx)(`span`,{style:{minWidth:84,flexShrink:0,color:n.colorTextSecondary,fontSize:`0.85em`},children:e}),(0,W.jsx)(o.Text,{copyable:{text:t,tooltips:[`Copy`,`Copied!`]},style:{fontFamily:n.fontFamilyCode,fontSize:`0.85em`,wordBreak:`break-all`},children:t})]})},cs=({session:e})=>(0,W.jsxs)(`div`,{children:[(0,W.jsx)(ss,{label:`Agor`,id:e.session_id}),e.sdk_session_id&&(0,W.jsx)(ss,{label:e.agentic_tool||`SDK`,id:e.sdk_session_id})]}),ls=({session:e})=>(0,W.jsx)(Ue,{title:(0,W.jsxs)(`span`,{children:[(0,W.jsx)(ye,{style:{marginRight:8}}),`Session IDs`]}),content:(0,W.jsx)(`div`,{style:{width:400,maxWidth:`90vw`},children:(0,W.jsx)(cs,{session:e})}),trigger:`click`,placement:`topLeft`,children:(0,W.jsx)(M,{title:`Session IDs`,children:(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(ye,{}),"aria-label":`Session IDs`})})});function us(e){if(e.includes(`sonnet`)){let t=e.match(/sonnet-(\d)-(\d)/);return t?`sonnet-${t[1]}.${t[2]}`:`sonnet`}if(e.includes(`haiku`)){let t=e.match(/haiku-(\d)-(\d)/);return t?`haiku-${t[1]}.${t[2]}`:`haiku`}if(e.includes(`opus`)){let t=e.match(/opus-(\d)-(\d)/);return t?`opus-${t[1]}.${t[2]}`:`opus`}return e}function ds(e){return e?.trim().replace(/\.git$/,``).replace(/^\/+|\/+$/g,``).toLowerCase()||void 0}function fs(e){try{return new URL(e).hostname.toLowerCase()}catch{return e.match(/^[^@]+@([^:]+):/)?.[1]?.toLowerCase()}}function ps(e){if(!(!e||fs(e)!==`github.com`))try{return ds(Ft(e))}catch{return}}function ms(e){let t=e.pathname.split(`/`).filter(Boolean);if(!(e.hostname!==`github.com`||t.length<2))return ds(`${t[0]}/${t[1]}`)}function hs(e){return ps(e?.remote_url)}function gs(e,t={}){try{let n=new URL(e),r=n.pathname.split(`/`).filter(Boolean);if(n.hostname===`github.com`&&r.length>=4){let[e,i,a,o]=r,s=`${e}/${i}`;return(a===`issues`||a===`pull`)&&ms(n)===hs(t.currentRepo)?`#${o}`:`${s}#${o}`}if(n.hostname===`app.shortcut.com`&&r.length>=3)return`${r[1]}/${r[2]}`;if(n.hostname.includes(`atlassian.net`)||n.hostname.includes(`jira`))return r[r.length-1]||n.hostname;if(n.hostname===`linear.app`){let e=r.indexOf(`issue`);return e!==-1&&r[e+1]?r[e+1]:r[r.length-1]||n.hostname}return r[r.length-1]||n.hostname}catch{return e.split(`/`).pop()||`?`}}function _s(e){try{let{hostname:t}=new URL(e);return t===`github.com`||t.endsWith(`.github.com`)}catch{return!1}}var vs={branch:`cyan`,session:`default`,board:`blue`,assistant:`geekblue`,mcp:`purple`,user:`orange`,artifact:`gold`,repo:`default`},ys={message:`default`,tool:`default`,token:`default`,model:`default`,git:`default`,session:vs.session,success:`green`,error:`red`,warning:`orange`,processing:`cyan`,fork:`cyan`,spawn:`purple`,report:`green`,concept:`geekblue`,branch:vs.branch},bs=({icon:e,color:t=`default`,children:n,onClick:r,tooltip:i})=>{let{token:a}=I.useToken(),o=(0,W.jsx)(Zn,{icon:e,color:t,style:{cursor:r?`pointer`:`default`},onClick:r,children:(0,W.jsx)(`span`,{style:{fontFamily:a.fontFamilyCode,lineHeight:1},children:n})});return i?(0,W.jsx)(`span`,{title:i,children:o}):o},xs=({count:e,estimatedCost:t,inputTokens:n,outputTokens:r,cacheReadTokens:i,cacheCreationTokens:a,style:o})=>{let s=n!==void 0||r!==void 0?(0,W.jsxs)(`div`,{children:[n!==void 0&&(0,W.jsxs)(`div`,{children:[`Input: `,n.toLocaleString()]}),r!==void 0&&(0,W.jsxs)(`div`,{children:[`Output: `,r.toLocaleString()]}),i!==void 0&&i>0&&(0,W.jsxs)(`div`,{children:[`Cache Read: `,i.toLocaleString()]}),a!==void 0&&a>0&&(0,W.jsxs)(`div`,{children:[`Cache Creation: `,a.toLocaleString()]}),t!==void 0&&(0,W.jsxs)(`div`,{children:[`Est. Cost: $`,t.toFixed(4)]})]}):t===void 0?void 0:`Est. Cost: $${t.toFixed(4)}`,c=(0,W.jsx)(Zn,{icon:(0,W.jsx)(ct,{}),color:ys.token,style:o,children:e.toLocaleString()});return s?(0,W.jsx)(M,{title:s,children:c}):c},Ss=({used:e,limit:t,percentage:n,taskMetadata:r})=>{let{token:i}=I.useToken(),a=[],o=r?.raw_sdk_response,s=r?.normalized_sdk_response,l=s?.contextUsageSnapshot??null;return l&&a.push({key:`sdk-context-usage`,label:`Context Window (SDK)`,children:(0,W.jsxs)(`div`,{style:{fontSize:`0.9em`,color:i.colorTextSecondary},children:[(0,W.jsxs)(`div`,{children:[`Used: `,(0,W.jsx)(`strong`,{children:l.totalTokens.toLocaleString()}),` tokens`]}),(0,W.jsxs)(`div`,{children:[`Limit: `,(0,W.jsx)(`strong`,{children:l.maxTokens.toLocaleString()}),` tokens`]}),(0,W.jsxs)(`div`,{children:[`Percentage: `,(0,W.jsxs)(`strong`,{children:[l.percentage,`%`]})]}),(0,W.jsx)(`div`,{style:{fontSize:`0.85em`,color:i.colorTextTertiary,marginTop:4},children:`Authoritative snapshot reported by the agent (Claude SDK getContextUsage() or Codex CLI token_count event).`})]})}),o&&typeof o==`object`&&o&&`modelUsage`in o&&o.modelUsage&&a.push({key:`per-model`,label:`Per-Model Usage`,children:(0,W.jsx)(`div`,{style:{fontSize:`0.9em`},children:Object.entries(o.modelUsage).map(([e,t])=>((t.inputTokens||0)+(t.outputTokens||0),(0,W.jsxs)(`div`,{style:{marginBottom:12},children:[(0,W.jsx)(`div`,{style:{fontWeight:500,marginBottom:4},children:e}),(0,W.jsxs)(`div`,{style:{marginLeft:12,fontSize:`0.95em`,color:i.colorTextSecondary},children:[(0,W.jsxs)(`div`,{children:[`Input: `,t.inputTokens?.toLocaleString()||0]}),(0,W.jsxs)(`div`,{children:[`Output: `,t.outputTokens?.toLocaleString()||0]}),t.cacheCreationInputTokens!==void 0&&t.cacheCreationInputTokens>0&&(0,W.jsxs)(`div`,{children:[`Cache creation: `,t.cacheCreationInputTokens.toLocaleString()]}),t.cacheReadInputTokens!==void 0&&t.cacheReadInputTokens>0&&(0,W.jsxs)(`div`,{children:[`Cache read: `,t.cacheReadInputTokens.toLocaleString()]}),(0,W.jsxs)(`div`,{style:{marginTop:4,fontWeight:500,color:i.colorText},children:[`Context limit: `,t.contextWindow?.toLocaleString()||0]})]})]},e)))})}),o&&a.push({key:`raw-sdk-response`,label:`🔍 Raw SDK Response`,children:(0,W.jsx)(`pre`,{style:{fontSize:`0.75em`,fontFamily:i.fontFamilyCode,background:i.colorBgContainer,padding:8,borderRadius:4,overflowX:`auto`,maxHeight:300,margin:0,border:`1px solid ${i.colorBorder}`},children:JSON.stringify(o,null,2)})}),(0,W.jsxs)(`div`,{style:{width:400,maxWidth:`90vw`},children:[(0,W.jsxs)(`div`,{style:{marginBottom:16},children:[(0,W.jsx)(`div`,{style:{fontWeight:600,fontSize:`1.05em`,marginBottom:8},children:`Context Window Usage`}),(0,W.jsxs)(`div`,{style:{fontSize:`1.1em`,fontFamily:i.fontFamilyCode},children:[e.toLocaleString(),t>0?` / ${t.toLocaleString()}`:``,` `,t>0&&(0,W.jsxs)(`span`,{style:{color:i.colorTextSecondary},children:[`(`,n,`%)`]})]}),(0,W.jsx)(`div`,{style:{fontSize:`0.85em`,color:i.colorTextTertiary,marginTop:6},children:t>0?`Current context window snapshot`:`Current context window snapshot (limit unknown)`})]}),s&&(0,W.jsxs)(`div`,{style:{marginBottom:16},children:[(0,W.jsx)(`div`,{style:{fontWeight:500,marginBottom:6},children:`Token Breakdown`}),(0,W.jsxs)(`div`,{style:{fontSize:`0.9em`,marginLeft:12,color:i.colorTextSecondary},children:[(0,W.jsxs)(`div`,{children:[`Input: `,s.tokenUsage.inputTokens.toLocaleString()]}),(0,W.jsxs)(`div`,{children:[`Output: `,s.tokenUsage.outputTokens.toLocaleString()]}),(s.tokenUsage.cacheCreationTokens??0)>0&&(0,W.jsxs)(`div`,{children:[`Cache creation: `,s.tokenUsage.cacheCreationTokens?.toLocaleString()]}),(s.tokenUsage.cacheReadTokens??0)>0&&(0,W.jsxs)(`div`,{children:[`Cache read: `,s.tokenUsage.cacheReadTokens?.toLocaleString()]}),(0,W.jsxs)(`div`,{style:{marginTop:4,fontWeight:500,color:i.colorText},children:[`Total: `,s.tokenUsage.totalTokens.toLocaleString()]})]})]}),(r?.model||r?.duration_ms!==void 0)&&(0,W.jsxs)(`div`,{style:{fontSize:`0.85em`,color:i.colorTextSecondary,paddingTop:12,borderTop:`1px solid ${i.colorBorderSecondary}`,marginBottom:16},children:[r?.model&&(0,W.jsxs)(`div`,{children:[`Model: `,(0,W.jsx)(`span`,{style:{fontFamily:i.fontFamilyCode},children:r.model})]}),r?.duration_ms!==void 0&&(0,W.jsxs)(`div`,{children:[`Duration: `,(r.duration_ms/1e3).toFixed(2),`s`]})]}),a.length>0&&(0,W.jsx)(c,{size:`small`,ghost:!0,items:a,style:{fontSize:`0.9em`}})]})},Cs=({used:e,limit:t,taskMetadata:n,style:r})=>{let i=n?.normalized_sdk_response?.contextUsageSnapshot,a=i?.totalTokens??e,o=i?.maxTokens??t,s=o>0,c=s?Math.round(rs(a,o,i)):0,l=(0,W.jsx)(Zn,{icon:(0,W.jsx)(He,{}),color:s?c<50?`green`:c<80?`orange`:`red`:`blue`,style:r,children:s?`${c}%`:`?`});return(0,W.jsx)(Ue,{content:(0,W.jsx)(Ss,{used:a,limit:o,percentage:c,taskMetadata:n}),title:null,trigger:`hover`,placement:`top`,mouseEnterDelay:.3,children:l})},ws=({model:e,style:t})=>(0,W.jsx)(Zn,{icon:(0,W.jsx)(m,{}),color:ys.model,style:t,children:us(e)}),Ts=()=>(0,W.jsx)(`span`,{"aria-hidden":`true`,style:{display:`inline-flex`,flexShrink:0,marginLeft:6},children:(0,W.jsx)(re,{status:`warning`})}),Es=({branch:e,sha:t,branchName:n,showDirtyIndicator:i=!0,style:a})=>{let{token:o}=I.useToken(),{cleanSha:s,isDirty:c}=os(t),l=s.substring(0,7),u=c&&i,d=e&&e!==n,f=u?`Git commit SHA (working tree has uncommitted changes) · click to copy`:`Git commit SHA · click to copy`,p=async e=>{e.stopPropagation(),await on(s)};return(0,W.jsx)(M,{title:f,children:(0,W.jsxs)(Zn,{icon:(0,W.jsx)(r,{}),color:ys.git,style:{...a,cursor:`pointer`},onClick:p,children:[d&&(0,W.jsxs)(`span`,{children:[e,` : `]}),(0,W.jsx)(`span`,{style:{fontFamily:o.fontFamilyCode},children:l}),u&&(0,W.jsx)(Ts,{})]})})},Ds=({status:e,style:t})=>{let n={completed:{icon:(0,W.jsx)(Re,{}),color:ys.success,text:`Completed`},failed:{icon:(0,W.jsx)(Je,{}),color:ys.error,text:`Failed`},running:{icon:(0,W.jsx)(Ge,{}),color:ys.processing,text:`Running`},timed_out:{icon:(0,W.jsx)(Ke,{}),color:ys.warning,text:`Timed Out`},idle:{icon:(0,W.jsx)(Ge,{}),color:ys.session,text:`Idle`},pending:{icon:(0,W.jsx)(Ge,{}),color:ys.session,text:`Pending`}}[e];return n?(0,W.jsx)(Zn,{icon:n.icon,color:n.color,style:t,children:n.text}):(0,W.jsx)(Zn,{icon:(0,W.jsx)(Ge,{}),color:ys.session,style:t,children:e})},Os=({fromSessionId:e,taskId:t,messageIndex:n,style:i})=>{let a=t=>{t.stopPropagation(),on(e)};return(0,W.jsx)(M,{title:(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`div`,{children:[`Forked from session `,cn(e)]}),n!==void 0&&(0,W.jsxs)(`div`,{children:[`Message index: `,n]}),(0,W.jsx)(`div`,{style:{marginTop:4,fontSize:`0.9em`,opacity:.8},children:`Click to copy session ID`})]}),children:(0,W.jsxs)(Zn,{icon:(0,W.jsx)(r,{}),color:ys.fork,style:{...i,cursor:`pointer`},onClick:a,children:[`FORKED from `,cn(e),n!==void 0&&` as of message ${n}`]})})},ks=({fromSessionId:e,taskId:t,messageIndex:n,style:r})=>{let i=t=>{t.stopPropagation(),on(e)};return(0,W.jsx)(M,{title:(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`div`,{children:[`Spawned from session `,cn(e)]}),n!==void 0&&(0,W.jsxs)(`div`,{children:[`Message index: `,n]}),(0,W.jsx)(`div`,{style:{marginTop:4,fontSize:`0.9em`,opacity:.8},children:`Click to copy session ID`})]}),children:(0,W.jsxs)(Zn,{icon:(0,W.jsx)(dt,{}),color:ys.spawn,style:{...r,cursor:`pointer`},onClick:i,children:[`SPAWNED from `,cn(e),n!==void 0&&` as of message ${n}`]})})},As=({icon:e,color:t,label:n,emoji:r,compact:i=!1,title:a,onClick:o,maxWidth:s=220,code:c=!1,ariaLabel:l,"aria-label":u,style:d})=>{let{token:f}=I.useToken(),p=n!=null&&n!==``,m=!!o,h=u??l;return(0,W.jsx)(Zn,{icon:e,color:t,title:a,"aria-label":h,role:m?`button`:void 0,tabIndex:m?0:void 0,onKeyDown:e=>{!o||e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),o(e))},style:{maxWidth:i?`100%`:void 0,marginInlineEnd:i?0:void 0,cursor:m?`pointer`:`default`,...d},onClick:o,children:p&&(0,W.jsxs)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:r?4:void 0,maxWidth:i?s:void 0,overflow:i?`hidden`:void 0,textOverflow:i?`ellipsis`:void 0,whiteSpace:i?`nowrap`:void 0,verticalAlign:i?`bottom`:void 0,fontFamily:c?f.fontFamilyCode:f.fontFamily},children:[r&&(0,W.jsx)(`span`,{style:{fontFamily:f.fontFamily},children:r}),n]})})},js=({branch:e,compact:t=!1,title:n,emoji:r,onClick:i,style:a})=>(0,W.jsx)(As,{icon:(0,W.jsx)(dt,{}),color:vs.branch,label:e,emoji:r,compact:t,title:n,onClick:i,code:!0,style:a}),Ms=({board:e,compact:t=!1,title:n,onClick:r,style:i})=>(0,W.jsx)(As,{icon:(0,W.jsx)(me,{}),color:vs.board,label:e.name,emoji:e.icon,compact:t,title:n??e.name,onClick:r,style:i}),Ns=({user:e,compact:t=!1,title:n,onClick:r,style:i})=>{let a=e.name||e.email||`Someone`;return(0,W.jsx)(As,{icon:(0,W.jsx)(Be,{}),color:vs.user,label:a,emoji:e.emoji,compact:t,title:n??a,onClick:r,maxWidth:180,style:i})},Ps=({name:e,emoji:t,compact:n=!1,title:r,onClick:i,style:a})=>(0,W.jsx)(As,{icon:(0,W.jsx)(m,{}),color:vs.assistant,label:e,emoji:t,compact:n,title:r??e,onClick:i,code:!0,style:a}),Fs=({label:e,compact:t=!1,title:n,ariaLabel:r,"aria-label":i,onClick:a,style:o})=>(0,W.jsx)(As,{icon:(0,W.jsx)(Ze,{}),color:vs.session,label:e,compact:t,title:n,ariaLabel:i??r,onClick:a,style:o}),Is=({namespace:e,style:t})=>(0,W.jsx)(As,{color:`default`,label:e,compact:!0,title:e,style:t}),Ls=({repoName:e,branchName:t,onClick:n,color:r=`cyan`,size:i,style:a})=>{let{token:o}=I.useToken();return(0,W.jsx)(Zn,{icon:(0,W.jsx)(dt,{}),color:r,style:{...a,cursor:n?`pointer`:`default`},onClick:n,children:(0,W.jsxs)(`span`,{style:{fontFamily:o.fontFamilyCode},children:[e,t&&(0,W.jsxs)(W.Fragment,{children:[` `,(0,W.jsx)(me,{style:{fontSize:`0.85em`,opacity:.7}}),` `,t]})]})})};function Rs(e){return _s(e)?(0,W.jsx)(Se,{}):(0,W.jsx)(s,{})}function zs(e){return _s(e)?(0,W.jsx)(Se,{}):(0,W.jsx)(dt,{})}var Bs={maxWidth:160,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,display:`inline-block`,verticalAlign:`middle`},Vs=({issueUrl:e,issueNumber:t,currentRepo:n,style:r})=>{let i=t||gs(e,{currentRepo:n});return(0,W.jsx)(M,{title:e,children:(0,W.jsx)(Zn,{icon:Rs(e),color:ys.git,style:{...r,cursor:`pointer`,maxWidth:220},onClick:()=>window.open(e,`_blank`),children:(0,W.jsxs)(`span`,{style:Bs,children:[`Issue: `,i]})})})},Hs=({prUrl:e,prNumber:t,currentRepo:n,style:r})=>{let i=t||gs(e,{currentRepo:n});return(0,W.jsx)(M,{title:e,children:(0,W.jsx)(Zn,{icon:zs(e),color:ys.git,style:{...r,cursor:`pointer`,maxWidth:220},onClick:()=>window.open(e,`_blank`),children:(0,W.jsxs)(`span`,{style:Bs,children:[`PR: `,i]})})})},Us=({scheduledRunAt:e,style:t})=>{let n=new Date(e),r=n.toLocaleTimeString(`en-US`,{hour:`2-digit`,minute:`2-digit`,hour12:!1}),i=`Scheduled run at ${n.toLocaleString(`en-US`,{dateStyle:`medium`,timeStyle:`medium`})}\nRun ID: ${e}`;return(0,W.jsx)(bs,{icon:(0,W.jsx)(Ke,{}),color:ys.processing,tooltip:i,children:r})},Ws=({channelType:e,channelName:t,style:n})=>(0,W.jsx)(Zn,{icon:(()=>{switch((e||``).toLowerCase()){case`slack`:return(0,W.jsx)(ht,{});case`discord`:return(0,W.jsx)(g,{});default:return(0,W.jsx)(g,{})}})(),color:ys.success,style:n,children:t});function Gs(e,t={}){let{fallbackChars:n=200,includeAgentFallback:r=!1,includeIdFallback:i=!1}=t;return e.title?e.title:e.description?e.description.length>n?`${e.description.substring(0,n)}...`:e.description:r?e.agentic_tool:i?`Session ${cn(e.session_id)}`:`Untitled Session`}function Ks(e=2,t=1.5){return{display:`-webkit-box`,WebkitLineClamp:e,WebkitBoxOrient:`vertical`,overflow:`hidden`,textOverflow:`ellipsis`,maxHeight:`${e*t}em`,lineHeight:t}}var qs={small:12,default:14,large:18},Js=({user:e,showName:t=!0,size:n=`default`})=>{let r=qs[n],{token:i}=I.useToken();return(0,W.jsx)(M,{title:`${e.name||e.email} (${e.role})`,children:(0,W.jsxs)(z,{size:4,children:[(0,W.jsx)(`span`,{style:{fontSize:r},children:e.emoji||`👤`}),t&&(0,W.jsx)(`span`,{style:{backgroundColor:i.colorBgTextHover,borderRadius:`3px`,padding:`0 2px`,fontWeight:600},children:e.name||e.email.split(`@`)[0]})]})})},Ys=({createdBy:e,currentUserId:t,userById:n,prefix:r=`Created by`})=>{if(e===t)return null;let i=n.get(e);return!i||e===`anonymous`?(0,W.jsx)(Zn,{color:`default`,style:{fontSize:11},children:e===`anonymous`?`Anonymous`:`Unknown User`}):(0,W.jsx)(Zn,{color:`blue`,style:{fontSize:11},children:(0,W.jsx)(Js,{user:i,showName:!0,size:`small`})})},{Text:Xs}=o,Zs=({session:e,branch:t,repo:n,userById:r=new Map,currentUserId:i,compact:a=!0})=>{let{token:o}=I.useToken();return(0,W.jsxs)(`div`,{style:{width:400,maxWidth:`90vw`},children:[(0,W.jsxs)(`div`,{style:{marginBottom:16},children:[(0,W.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:12},children:[(0,W.jsx)(cr,{tool:e.agentic_tool,size:24}),(0,W.jsx)(`div`,{style:{flex:1,minWidth:0},children:(0,W.jsx)(Xs,{strong:!0,style:{fontSize:`1.05em`,display:`block`,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:Gs(e,{fallbackChars:60,includeAgentFallback:!0})})})]}),(0,W.jsx)(`div`,{style:{marginBottom:8},children:(0,W.jsxs)(z,{size:4,children:[(0,W.jsx)(Xs,{type:`secondary`,style:{fontSize:`0.85em`},children:`Status:`}),(0,W.jsx)(Ds,{status:e.status})]})})]}),(0,W.jsx)(`div`,{style:{marginBottom:12,paddingTop:12,borderTop:`1px solid ${o.colorBorderSecondary}`},children:(0,W.jsx)(cs,{session:e})}),(e.genealogy.forked_from_session_id||e.genealogy.parent_session_id)&&(0,W.jsxs)(`div`,{style:{marginBottom:12},children:[(0,W.jsx)(`div`,{style:{fontWeight:600,fontSize:`0.85em`,marginBottom:8},children:`Genealogy`}),(0,W.jsxs)(z,{size:4,children:[e.genealogy.forked_from_session_id&&(0,W.jsx)(Os,{fromSessionId:e.genealogy.forked_from_session_id}),e.genealogy.parent_session_id&&(0,W.jsx)(ks,{fromSessionId:e.genealogy.parent_session_id})]})]}),t&&n&&(0,W.jsxs)(`div`,{style:{marginBottom:12},children:[(0,W.jsx)(`div`,{style:{fontWeight:600,fontSize:`0.85em`,marginBottom:8},children:`Branch`}),(0,W.jsxs)(z,{size:4,wrap:!0,children:[(0,W.jsx)(Ls,{repoName:n.slug}),(0,W.jsx)(Zn,{icon:(0,W.jsx)(de,{}),color:ys.branch,children:(0,W.jsx)(`span`,{style:{fontFamily:o.fontFamilyCode},children:t.name})})]})]}),(0,W.jsxs)(`div`,{style:{fontSize:`0.85em`,color:o.colorTextSecondary,paddingTop:12,borderTop:`1px solid ${o.colorBorderSecondary}`},children:[e.created_by&&(0,W.jsx)(`div`,{style:{marginBottom:4},children:(0,W.jsx)(Ys,{createdBy:e.created_by,currentUserId:i,userById:r,prefix:`Created by`})}),(0,W.jsxs)(`div`,{style:{marginBottom:4},children:[(0,W.jsx)(Xs,{type:`secondary`,children:`Created: `}),new Date(e.created_at).toLocaleString()]}),(0,W.jsxs)(`div`,{style:{marginBottom:4},children:[(0,W.jsx)(Xs,{type:`secondary`,children:`Agent: `}),e.agentic_tool]}),e.permission_config?.mode&&(0,W.jsxs)(`div`,{children:[(0,W.jsx)(Xs,{type:`secondary`,children:`Permission mode: `}),e.permission_config.mode]})]})]})},Qs=[Rt.RUNNING,Rt.STOPPING,Rt.AWAITING_PERMISSION,Rt.AWAITING_INPUT],$s={[Rt.RUNNING]:{icon:(0,W.jsx)(y,{}),color:ys.processing},[Rt.STOPPING]:{icon:(0,W.jsx)(P,{}),color:ys.warning},[Rt.AWAITING_PERMISSION]:{icon:(0,W.jsx)(P,{}),color:ys.warning},[Rt.AWAITING_INPUT]:{icon:(0,W.jsx)(Xe,{}),color:ys.processing},[Rt.COMPLETED]:{icon:(0,W.jsx)(Re,{}),color:ys.success},[Rt.FAILED]:{icon:(0,W.jsx)(Je,{}),color:ys.error},[Rt.STOPPED]:{icon:(0,W.jsx)(qe,{}),color:ys.warning},[zt.IDLE]:{icon:(0,W.jsx)(y,{}),color:ys.session},[Rt.TIMED_OUT]:{icon:(0,W.jsx)(Ke,{}),color:ys.warning},[Rt.CREATED]:{icon:(0,W.jsx)(y,{}),color:ys.session,label:`00:00`},[Rt.QUEUED]:{icon:(0,W.jsx)(Ke,{}),color:ys.session,label:`Queued`},pending:{icon:(0,W.jsx)(y,{}),color:ys.session}};function ec(e){if(!e)return null;if(e instanceof Date)return Number.isNaN(e.getTime())?null:e.getTime();if(typeof e==`number`)return Number.isFinite(e)?e:null;let t=Date.parse(e);return Number.isNaN(t)?null:t}function tc(e){if(!Number.isFinite(e)||e<=0)return`00:00`;let t=Math.floor(e/1e3),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60,a=n.toString().padStart(2,`0`),o=r.toString().padStart(2,`0`),s=i.toString().padStart(2,`0`);return n>0?`${a}:${o}:${s}`:`${o}:${s}`}var nc=({status:e,startedAt:t,endedAt:n,durationMs:r,lastExecutorHeartbeatAt:i,style:a})=>{let{token:o}=I.useToken(),s=(0,U.useMemo)(()=>ec(t),[t]),c=(0,U.useMemo)(()=>ec(n),[n]),l=(0,U.useMemo)(()=>ec(i??void 0),[i]),u=(0,U.useMemo)(()=>typeof r==`number`&&r>=0?r:s&&c&&c>=s?c-s:null,[r,s,c]),[d,f]=(0,U.useState)(()=>u===null?s?Math.max(0,Date.now()-s):0:u);(0,U.useEffect)(()=>{if(u!==null){f(u);return}if(!s){f(0);return}f(Math.max(0,Date.now()-s))},[u,s]),(0,U.useEffect)(()=>{if(!s||!Qs.includes(e))return;let t=window.setInterval(()=>{f(Math.max(0,Date.now()-s))},1e3);return()=>window.clearInterval(t)},[s,e]);let p=Qs.includes(e),m=(0,U.useMemo)(()=>{let e={color:o.colorTextSecondary,minWidth:60},t={fontFamily:o.fontFamilyCode,color:o.colorText},n={display:`flex`,gap:8,alignItems:`baseline`},r=l?Math.max(0,Date.now()-l):null;return(0,W.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4,fontSize:12},children:[s&&(0,W.jsxs)(`div`,{style:n,children:[(0,W.jsx)(`span`,{style:e,children:`Started`}),(0,W.jsx)(`span`,{style:t,children:Qo(new Date(s))})]}),(0,W.jsxs)(`div`,{style:n,children:[(0,W.jsx)(`span`,{style:e,children:`Ended`}),(0,W.jsx)(`span`,{style:t,children:p?`In progress...`:c?Qo(new Date(c)):`—`})]}),(0,W.jsxs)(`div`,{style:n,children:[(0,W.jsx)(`span`,{style:e,children:`Duration`}),(0,W.jsx)(`span`,{style:t,children:tc(d)})]}),l&&(0,W.jsxs)(`div`,{style:n,children:[(0,W.jsx)(`span`,{style:e,children:`Heartbeat`}),(0,W.jsxs)(`span`,{style:t,children:[(0,W.jsx)(D,{style:{marginRight:4}}),r===null?`—`:`${tc(r)} ago`,(0,W.jsx)(`span`,{style:{color:o.colorTextSecondary,marginLeft:6},children:Qo(new Date(l))})]})]})]})},[s,c,p,d,l,o]);if(!s&&u===null)return null;let h=$s[e]||$s.pending,g=h.label??tc(d);return(0,W.jsx)(Ue,{content:m,placement:`bottom`,children:(0,W.jsx)(Zn,{icon:h.icon,color:h.color,style:a,children:(0,W.jsx)(`span`,{style:{fontFamily:o.fontFamilyCode,lineHeight:1},children:g})})})};function rc(e){let t=e-Date.now(),n=Math.floor(Math.abs(t)/1e3),r=Math.floor(n/60),i=Math.floor(r/60),a=Math.floor(i/24),o=n<60?`${n}s`:r<60?`${r}m`:i<24?`${i}h`:`${a}d`;return t>=0?{verb:`Expires`,phrase:`in ${o}`}:{verb:`Expired`,phrase:`${o} ago`}}function ic(e){switch(e){case`missing_token_endpoint`:return`missing OAuth token endpoint — re-authenticate, or ask an admin to save the token URL in this MCP server’s OAuth settings`;case`missing_client_id`:return`missing OAuth client ID for this grant — re-authenticate, or ask an admin to check the MCP server OAuth settings`;case`needs_reauth`:return`refresh token is no longer valid — sign in again`;case`token_refresh_failed`:return`provider token refresh failed — try again, or sign in again if it keeps failing`;default:return e||`unknown error`}}var ac=({server:e,needsAuth:t,client:n})=>{let{showSuccess:r,showInfo:i,showWarning:a,showError:o}=dn(),{isAdmin:s}=to(),[c,l]=(0,U.useState)(!1),[u,d]=(0,U.useState)(!1),[f,p]=(0,U.useState)(void 0),m=e.auth?.type===`oauth`,h=f??e.auth?.oauth_token_expires_at,g=async()=>{if(n)try{let t=await n.service(`mcp-servers/oauth-start`).create({mcp_url:e.url,mcp_server_id:e.mcp_server_id,client_id:e.auth?.oauth_client_id});if(t.success&&t.authorizationUrl){if(window.open(t.authorizationUrl,`_blank`,`noopener,noreferrer`),i(`Complete sign-in in the new tab.`),t.state){let i=a=>{a.state===t.state&&a.success&&(r(`${e.display_name||e.name} authenticated!`),n.io.off(`oauth:completed`,i))};n.io.on(`oauth:completed`,i),setTimeout(()=>n.io.off(`oauth:completed`,i),300*1e3)}}else t.success||o(t.error||`Failed to start OAuth flow`)}catch(e){o(`OAuth error: ${e instanceof Error?e.message:String(e)}`)}},_=async()=>{if(!(!n||c)){l(!0);try{let t=await n.service(`mcp-servers/oauth-refresh`).create({mcp_server_id:e.mcp_server_id});t.success?(p(t.expires_at),r(t.expires_at?`${e.display_name||e.name} refreshed — expires ${rc(t.expires_at).phrase}`:`${e.display_name||e.name} refreshed`)):t.error===`needs_reauth`||t.error===`missing_client_id`?(a(ic(t.error)),await g()):o(`Refresh failed: ${ic(t.error)}`)}catch(e){o(`Refresh error: ${e instanceof Error?e.message:String(e)}`)}finally{l(!1)}}},v;if(!m)v=`${e.transport.toUpperCase()} MCP server`;else if(h){let e=new Date(h),{verb:t,phrase:n}=rc(h);v=(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{children:[t,` `,n]}),(0,W.jsx)(`div`,{style:{opacity:.75,fontSize:12},children:Qo(e)}),(0,W.jsx)(`div`,{style:{opacity:.75,fontSize:12,marginTop:4},children:`Click to refresh now`})]})}else v=(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{children:`Expires in: unknown`}),(0,W.jsx)(`div`,{style:{opacity:.75,fontSize:12},children:`Provider returned no expiry. Token is used until it stops working.`}),(0,W.jsx)(`div`,{style:{opacity:.75,fontSize:12,marginTop:4},children:`Click to refresh now`})]});return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(M,{title:t?`Click to authenticate`:v,children:(0,W.jsxs)(Zn,{color:t?`orange`:vs.mcp,icon:t?(0,W.jsx)(le,{}):c?(0,W.jsx)(x,{spin:!0}):(0,W.jsx)(pt,{}),style:{cursor:c?`wait`:m?`pointer`:`default`},onClick:t?g:m?_:void 0,children:[e.display_name||e.name,s&&(0,W.jsx)(`button`,{type:`button`,"aria-label":`Edit MCP server`,title:`Edit MCP server`,onClick:e=>{e.stopPropagation(),d(!0)},style:{marginLeft:8,padding:0,background:`transparent`,border:`none`,color:`inherit`,fontSize:11,lineHeight:1,opacity:.55,cursor:`pointer`},onMouseEnter:e=>{e.currentTarget.style.opacity=`1`},onMouseLeave:e=>{e.currentTarget.style.opacity=`0.55`},onFocus:e=>{e.currentTarget.style.opacity=`1`},onBlur:e=>{e.currentTarget.style.opacity=`0.55`},children:(0,W.jsx)(N,{})})]})}),s&&(0,W.jsx)(Yo,{server:e,open:u,client:n,onClose:()=>d(!1)})]})},oc=({mcpServerById:e,client:t,onCreate:n,onDelete:r})=>{let{showError:i}=dn(),[a,s]=(0,U.useState)(!1),[c,l]=(0,U.useState)(!1),[u,d]=(0,U.useState)(!1),[f,p]=(0,U.useState)(null),[m,h]=(0,U.useState)(null),[g]=B.useForm(),[_,y]=(0,U.useState)(`stdio`),[b,x]=(0,U.useState)(`none`),[S,C]=(0,U.useState)(!1),[w,T]=(0,U.useState)(!1),[D,O]=(0,U.useState)(null),[k,j]=(0,U.useState)(``);(0,U.useEffect)(()=>{if(f&&e.has(f.mcp_server_id)){let t=e.get(f.mcp_server_id);t&&t!==f&&p(t)}},[e,f]);let M=e=>{let t={name:e.name,display_name:e.display_name,description:e.description,transport:e.transport,scope:e.scope||`global`,enabled:e.enabled??!0,source:`user`};if(e.transport===`stdio`)t.command=e.command,t.args=e.args?.split(`,`).map(e=>e.trim())||[];else{t.url=e.url;let n=Wo(e.headers);n&&(t.headers=n)}let n=Ho(e);n&&(t.auth=n);let r=Uo(e.env);return r&&(t.env=r),t},P=async()=>{if(!t)return null;try{await g.validateFields();let e=M(g.getFieldsValue(!0)),n=await t.service(`mcp-servers`).create(e);return T(!0),n.mcp_server_id||null}catch{return null}},ee=()=>{g.resetFields(),s(!1),y(`stdio`),x(`none`),O(null),T(!1)},ne=()=>{if(w){ee();return}g.validateFields().then(()=>{let e=M(g.getFieldsValue(!0));n?.(e),ee()}).catch(e=>{if(console.error(`Form validation failed:`,e),e.errorFields&&e.errorFields.length>0){let t=e.errorFields[0];i(t.errors[0]||`Please fill in required fields`)}})},ie=async()=>{if(!t){i(`Client not available`);return}let e=g.getFieldsValue(!0);if(!e.url){i(`URL is required to test connection`);return}if(e.transport===`stdio`){i(`Connection test is not available for stdio transport`);return}try{await g.validateFields([`headers`])}catch{i(`Please fix custom HTTP headers before testing`);return}C(!0),O(null);try{let n=await t.service(`mcp-servers/discover`).create({url:e.url,transport:e.transport||`http`,auth:Ho(e),headers:Wo(e.headers)});n.success&&n.capabilities?O({success:!0,toolCount:n.capabilities.tools,resourceCount:n.capabilities.resources,promptCount:n.capabilities.prompts,tools:n.tools,resources:n.resources,prompts:n.prompts}):O({success:!1,toolCount:0,resourceCount:0,promptCount:0,error:n.error||`Connection test failed`})}catch(e){O({success:!1,toolCount:0,resourceCount:0,promptCount:0,error:e instanceof Error?e.message:`Unknown error`})}finally{C(!1)}},ae=e=>{p(e),l(!0)},F=()=>{l(!1),p(null)},I=e=>{h(e),d(!0)},oe=e=>{r?.(e)},se=e=>{let t=e.tools?.length||0;return(e.transport||(e.url?`http`:`stdio`))===`stdio`?{status:`default`,text:`Local process`,color:`#8c8c8c`}:t>0?{status:`success`,text:`${t} tools`,color:`#52c41a`}:{status:`default`,text:`Not tested`,color:`#8c8c8c`}},le=[{title:`Name`,dataIndex:`name`,key:`name`,width:180,render:(e,t)=>(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{children:(0,W.jsx)(No,{text:t.display_name||t.name,query:k})}),(0,W.jsx)(o.Text,{type:`secondary`,style:{fontSize:12},children:(0,W.jsx)(No,{text:t.name,query:k})})]})},{title:`Transport`,dataIndex:`transport`,key:`transport`,width:100,render:e=>(0,W.jsx)(v,{color:e===`stdio`?`blue`:`green`,children:e.toUpperCase()})},{title:`Scope`,dataIndex:`scope`,key:`scope`,width:100,render:e=>(0,W.jsx)(v,{color:{global:`purple`,repo:`cyan`,session:`magenta`}[e],children:e})},{title:`Status`,dataIndex:`enabled`,key:`enabled`,width:80,render:e=>e?(0,W.jsx)(re,{status:`success`,text:`Enabled`}):(0,W.jsx)(re,{status:`default`,text:`Disabled`})},{title:`Health`,key:`health`,width:120,render:(e,t)=>{let n=se(t);return(0,W.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8},children:[(0,W.jsx)(re,{status:n.status}),(0,W.jsx)(o.Text,{style:{fontSize:12,color:n.color},children:n.text})]})}},{title:`Source`,dataIndex:`source`,key:`source`,width:100,render:e=>(0,W.jsx)(o.Text,{type:`secondary`,children:(0,W.jsx)(No,{text:e,query:k})})},{title:`Actions`,key:`actions`,width:140,render:(e,t)=>(0,W.jsxs)(z,{size:`small`,children:[(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(ce,{}),onClick:()=>I(t),title:`View details`}),(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(N,{}),onClick:()=>ae(t),title:`Edit`}),(0,W.jsx)(A,{title:`Delete MCP server?`,description:`Are you sure you want to delete "${t.display_name||t.name}"?`,onConfirm:()=>oe(t.mcp_server_id),okText:`Delete`,cancelText:`Cancel`,okButtonProps:{danger:!0},children:(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(te,{}),danger:!0,title:`Delete`})})]})}],ue=(0,U.useMemo)(()=>Ao(Eo(e,(e,t)=>e.name.localeCompare(t.name,void 0,{sensitivity:`base`})),k,[e=>e.name,e=>e.display_name,e=>e.description,e=>e.transport,e=>e.scope,e=>e.source,e=>e.url,e=>e.command,e=>e.args,e=>e.enabled,e=>e.tools?.flatMap(e=>[e.name,e.description])]),[e,k]);return(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`div`,{style:{marginBottom:16,display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,W.jsx)(o.Text,{type:`secondary`,children:`Configure Model Context Protocol servers for enhanced AI capabilities.`}),(0,W.jsxs)(z,{children:[(0,W.jsx)(L,{allowClear:!0,placeholder:`Search name, URL, command, tools, transport, or scope`,value:k,onChange:e=>j(e.target.value),style:{width:360}}),(0,W.jsx)(V,{type:`primary`,icon:(0,W.jsx)(fe,{}),onClick:()=>s(!0),children:`New MCP Server`})]})]}),(0,W.jsx)(E,{dataSource:ue,columns:le,rowKey:`mcp_server_id`,pagination:{pageSize:10,showSizeChanger:!0},size:`small`}),(0,W.jsx)(nt,{title:`Add MCP Server`,open:a,onOk:ne,onCancel:ee,okText:w?`Done`:`Create`,width:600,children:(0,W.jsx)(B,{form:g,layout:`vertical`,style:{marginTop:16},children:(0,W.jsx)(Jo,{mode:`create`,transport:_,onTransportChange:y,authType:b,onAuthTypeChange:x,form:g,client:t,onTestConnection:ie,testing:S,testResult:D,onSaveFirst:P})})}),(0,W.jsx)(Yo,{server:f,open:c,client:t,onClose:F}),(0,W.jsx)(nt,{title:`MCP Server Details`,open:u,onCancel:()=>{d(!1),h(null)},footer:[(0,W.jsx)(V,{onClick:()=>d(!1),children:`Close`},`close`)],width:700,children:m&&(0,W.jsxs)(R,{bordered:!0,column:1,size:`small`,style:{marginTop:16},children:[(0,W.jsx)(R.Item,{label:`ID`,children:cn(m.mcp_server_id)}),(0,W.jsx)(R.Item,{label:`Name`,children:m.name}),m.display_name&&(0,W.jsx)(R.Item,{label:`Display Name`,children:m.display_name}),m.description&&(0,W.jsx)(R.Item,{label:`Description`,children:m.description}),(0,W.jsx)(R.Item,{label:`Transport`,children:(0,W.jsx)(v,{color:m.transport===`stdio`?`blue`:`green`,children:m.transport.toUpperCase()})}),(0,W.jsx)(R.Item,{label:`Scope`,children:(0,W.jsx)(v,{children:m.scope})}),(0,W.jsx)(R.Item,{label:`Source`,children:m.source}),(0,W.jsx)(R.Item,{label:`Status`,children:m.enabled?(0,W.jsx)(re,{status:`success`,text:`Enabled`}):(0,W.jsx)(re,{status:`default`,text:`Disabled`})}),m.command&&(0,W.jsx)(R.Item,{label:`Command`,children:m.command}),m.args&&m.args.length>0&&(0,W.jsx)(R.Item,{label:`Arguments`,children:m.args.join(`, `)}),m.url&&(0,W.jsx)(R.Item,{label:`URL`,children:m.url}),m.headers&&Object.keys(m.headers).length>0&&(0,W.jsx)(R.Item,{label:`Custom HTTP Headers`,children:(0,W.jsx)(`pre`,{style:{margin:0,fontSize:12},children:JSON.stringify(m.headers,null,2)})}),m.env&&Object.keys(m.env).length>0&&(0,W.jsx)(R.Item,{label:`Environment Variables`,children:(0,W.jsx)(`pre`,{style:{margin:0,fontSize:12},children:JSON.stringify(m.env,null,2)})}),m.tools&&m.tools.length>0&&(0,W.jsxs)(R.Item,{label:`Tools`,children:[m.tools.length,` tools`]}),m.resources&&m.resources.length>0&&(0,W.jsxs)(R.Item,{label:`Resources`,children:[m.resources.length,` resources`]}),m.prompts&&m.prompts.length>0&&(0,W.jsxs)(R.Item,{label:`Prompts`,children:[m.prompts.length,` prompts`]}),(0,W.jsx)(R.Item,{label:`Created`,children:new Date(m.created_at).toLocaleString()}),m.updated_at&&(0,W.jsx)(R.Item,{label:`Updated`,children:new Date(m.updated_at).toLocaleString()})]})})]})},sc=({branch:e,canEdit:t,state:n,setField:r})=>{let i=an(e);return i?(0,W.jsx)(`div`,{style:{width:`100%`,maxHeight:`70vh`,overflowY:`auto`},children:(0,W.jsxs)(z,{orientation:`vertical`,size:`large`,style:{width:`100%`},children:[(0,W.jsxs)(z,{children:[i.emoji?(0,W.jsx)(`span`,{style:{fontSize:20},children:i.emoji}):(0,W.jsx)(m,{style:{fontSize:20}}),(0,W.jsx)(o.Text,{strong:!0,style:{fontSize:16},children:`Assistant Configuration`})]}),(0,W.jsxs)(B,{layout:`horizontal`,colon:!1,children:[(0,W.jsx)(B.Item,{label:`Display Name`,labelCol:{span:6},wrapperCol:{span:18},children:(0,W.jsx)(L,{value:n.displayName,onChange:e=>r(`displayName`,e.target.value),placeholder:`Assistant display name`,disabled:!t})}),(0,W.jsx)(B.Item,{label:`Icon`,labelCol:{span:6},wrapperCol:{span:18},children:(0,W.jsx)(ii,{value:n.emoji,onChange:e=>r(`emoji`,e),defaultEmoji:`🤖`,disabled:!t})}),(0,W.jsx)(B.Item,{label:`Description`,labelCol:{span:6},wrapperCol:{span:18},tooltip:`What does this assistant do? Visible to other agents via MCP.`,children:(0,W.jsx)(L.TextArea,{value:n.description,onChange:e=>r(`description`,e.target.value),placeholder:`What does this assistant do?`,rows:2,disabled:!t})})]}),(0,W.jsxs)(R,{column:1,bordered:!0,size:`small`,children:[i.frameworkRepo&&(0,W.jsx)(R.Item,{label:`Framework Repo`,children:(0,W.jsx)(o.Text,{code:!0,children:i.frameworkRepo})}),i.frameworkVersion&&(0,W.jsx)(R.Item,{label:`Framework Version`,children:(0,W.jsx)(o.Text,{code:!0,children:i.frameworkVersion})}),(0,W.jsx)(R.Item,{label:`Created via`,children:i.createdViaOnboarding?(0,W.jsx)(Zn,{color:`blue`,children:`Onboarding Wizard`}):(0,W.jsx)(Zn,{children:`Manual`})})]})]})}):null},cc=[`start`,`stop`,`nuke`,`logs`],lc=/^https?:\/\//i;function uc(e){return lc.test(e.trim())}function dc(e,t){return e===t||e.endsWith(`.${t}`)}function fc(e){let t=e.split(`.`);if(t.length!==4)return!1;let n=t.map(e=>Number(e));if(n.some(e=>!Number.isInteger(e)||e<0||e>255))return!1;let[r,i]=n;return r===0||r===10||r===127||r===169&&i===254||r===172&&i>=16&&i<=31||r===192&&i===168||r>=224}function pc(e){let t=e.replace(/^\[|\]$/g,``).toLowerCase();if(!t.includes(`:`))return!1;let n=t.match(/:ffff:(\d+\.\d+\.\d+\.\d+)$/);if(n)return fc(n[1]);let r=t.split(`:`).filter(Boolean),i=r.lastIndexOf(`ffff`);if(i>=0&&r.length-i===3){let e=Number.parseInt(r[i+1],16),t=Number.parseInt(r[i+2],16);if(Number.isInteger(e)&&Number.isInteger(t)&&e>=0&&e<=65535&&t>=0&&t<=65535)return fc(`${e>>8}.${e&255}.${t>>8}.${t&255}`)}let a=Number.parseInt(r[0]??``,16);return t===`::1`||t===`::`||Number.isInteger(a)&&a>=65152&&a<=65215||Number.isInteger(a)&&a>=64512&&a<=65023}function mc(e){let t;try{t=At(e,`managed environment webhook`)}catch{return!1}if(!t)return!1;let n=new URL(t),r=n.hostname.toLowerCase();return!(n.username||n.password||r===`localhost`||dc(r,`localhost`)||r===`metadata.google.internal`||dc(r,`internal`)||r.endsWith(`.local`)||fc(r)||pc(r))}function hc(e,t=`environment webhook`){let n=At(e,t);if(!n)throw Error(`${t} must be a valid http(s) URL`);let r=new URL(n);if(r.username||r.password)throw Error(`${t} must not include URL credentials`);if(!mc(n))throw Error(`${t} is blocked by Agor's managed-environment webhook policy`);return n}function gc(e,t,n=`managed environment`){for(let r of cc){let i=e[r];if(i?.trim()){if(uc(i)){hc(i,`${n} ${r} webhook`);continue}if(t===`webhook-only`)throw Error(`${n} ${r} must render to an http(s) URL webhook on this Agor instance`)}}}function _c(e,t,n=`repo environment`){for(let r of Object.keys(e.variants)){let i=Zt(e,r);if(!i)continue;let a={start:i.start,stop:i.stop,nuke:i.nuke,logs:i.logs};for(let e of cc){let i=a[e];i?.includes(`{{`)||gc({[e]:i},t,`${n} variant "${r}"`)}}}function vc(e){if(!e)return`stopped`;if(e.status===`running`){let t=e.last_health_check?.status;return t===`healthy`?`healthy`:t===`unhealthy`?`unhealthy`:`running`}return e.status}function yc(e){switch(e){case`stopped`:return`Stopped`;case`starting`:return`Starting...`;case`healthy`:return`Healthy`;case`unhealthy`:return`Unhealthy`;case`running`:return`Running`;case`stopping`:return`Stopping...`;case`error`:return`Error`;default:return`Unknown`}}var bc=({value:e,onChange:t,readOnly:n=!1,placeholder:r,rows:i=14,height:a,minHeight:o,maxHeight:s})=>(0,W.jsx)(`textarea`,{value:e,onChange:e=>t?.(e.target.value),readOnly:n,placeholder:r,rows:i,style:{width:`100%`,boxSizing:`border-box`,fontFamily:`monospace`,fontSize:12,height:a,minHeight:o??`${i*20}px`,maxHeight:s,padding:8,margin:0,border:`1px solid var(--ant-color-border, #424242)`,borderRadius:6,background:`var(--ant-color-fill-alter, transparent)`,color:`var(--ant-color-text)`,overflow:`auto`,resize:s?`none`:`vertical`}}),xc=(0,U.lazy)(async()=>{try{return await H(()=>import(`./CodeEditor.inner-DBgsP4tn.js`),__vite__mapDeps([0,1,2,3,4]))}catch(e){return console.error(`Failed to load CodeMirror editor; falling back to plain text editor.`,e),{default:bc}}}),Sc=e=>(0,W.jsx)(U.Suspense,{fallback:(0,W.jsx)(bc,{...e,readOnly:!0}),children:(0,W.jsx)(xc,{...e})}),Cc=n(((e,t)=>{t.exports=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/})),wc=n(((e,t)=>{t.exports=/[\0-\x1F\x7F-\x9F]/})),Tc=n(((e,t)=>{t.exports=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/})),Ec=n(((e,t)=>{t.exports=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4E\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDF55-\uDF59]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDF3C-\uDF3E]|\uD806[\uDC3B\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/})),Dc=n(((e,t)=>{t.exports=function(e){var t={};t.src_Any=Cc().source,t.src_Cc=wc().source,t.src_Z=Tc().source,t.src_P=Ec().source,t.src_ZPCc=[t.src_Z,t.src_P,t.src_Cc].join(`|`),t.src_ZCc=[t.src_Z,t.src_Cc].join(`|`);var n=`[><|]`;return t.src_pseudo_letter=`(?:(?!`+n+`|`+t.src_ZPCc+`)`+t.src_Any+`)`,t.src_ip4=`(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)`,t.src_auth=`(?:(?:(?!`+t.src_ZCc+`|[@/\\[\\]()]).)+@)?`,t.src_port=`(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?`,t.src_host_terminator=`(?=$|`+n+`|`+t.src_ZPCc+`)(?!-|_|:\\d|\\.-|\\.(?!$|`+t.src_ZPCc+`))`,t.src_path=`(?:[/?#](?:(?!`+t.src_ZCc+`|`+n+`|[()[\\]{}.,"'?!\\-;]).|\\[(?:(?!`+t.src_ZCc+`|\\]).)*\\]|\\((?:(?!`+t.src_ZCc+`|[)]).)*\\)|\\{(?:(?!`+t.src_ZCc+`|[}]).)*\\}|\\"(?:(?!`+t.src_ZCc+`|["]).)+\\"|\\'(?:(?!`+t.src_ZCc+`|[']).)+\\'|\\'(?=`+t.src_pseudo_letter+`|[-]).|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!`+t.src_ZCc+`|[.]).|`+(e&&e[`---`]?`\\-(?!--(?:[^-]|$))(?:-*)|`:`\\-+|`)+`,(?!`+t.src_ZCc+`).|;(?!`+t.src_ZCc+`).|\\!+(?!`+t.src_ZCc+`|[!]).|\\?(?!`+t.src_ZCc+`|[?]).)+|\\/)?`,t.src_email_name=`[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*`,t.src_xn=`xn--[a-z0-9\\-]{1,59}`,t.src_domain_root=`(?:`+t.src_xn+`|`+t.src_pseudo_letter+`{1,63})`,t.src_domain=`(?:`+t.src_xn+`|(?:`+t.src_pseudo_letter+`)|(?:`+t.src_pseudo_letter+`(?:-|`+t.src_pseudo_letter+`){0,61}`+t.src_pseudo_letter+`))`,t.src_host=`(?:(?:(?:(?:`+t.src_domain+`)\\.)*`+t.src_domain+`))`,t.tpl_host_fuzzy=`(?:`+t.src_ip4+`|(?:(?:(?:`+t.src_domain+`)\\.)+(?:%TLDS%)))`,t.tpl_host_no_ip_fuzzy=`(?:(?:(?:`+t.src_domain+`)\\.)+(?:%TLDS%))`,t.src_host_strict=t.src_host+t.src_host_terminator,t.tpl_host_fuzzy_strict=t.tpl_host_fuzzy+t.src_host_terminator,t.src_host_port_strict=t.src_host+t.src_port+t.src_host_terminator,t.tpl_host_port_fuzzy_strict=t.tpl_host_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_port_no_ip_fuzzy_strict=t.tpl_host_no_ip_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_fuzzy_test=`localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:`+t.src_ZPCc+`|>|$))`,t.tpl_email_fuzzy=`(^|`+n+`|"|\\(|`+t.src_ZCc+`)(`+t.src_email_name+`@`+t.tpl_host_fuzzy_strict+`)`,t.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+t.src_ZPCc+"))((?![$+<=>^`||])"+t.tpl_host_port_fuzzy_strict+t.src_path+`)`,t.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+t.src_ZPCc+"))((?![$+<=>^`||])"+t.tpl_host_port_no_ip_fuzzy_strict+t.src_path+`)`,t}})),Oc=n(((e,t)=>{function n(e){return Array.prototype.slice.call(arguments,1).forEach(function(t){t&&Object.keys(t).forEach(function(n){e[n]=t[n]})}),e}function r(e){return Object.prototype.toString.call(e)}function i(e){return r(e)===`[object String]`}function a(e){return r(e)===`[object Object]`}function o(e){return r(e)===`[object RegExp]`}function s(e){return r(e)===`[object Function]`}function c(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,`\\$&`)}var l={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function u(e){return Object.keys(e||{}).reduce(function(e,t){return e||l.hasOwnProperty(t)},!1)}var d={"http:":{validate:function(e,t,n){var r=e.slice(t);return n.re.http||(n.re.http=RegExp(`^\\/\\/`+n.re.src_auth+n.re.src_host_port_strict+n.re.src_path,`i`)),n.re.http.test(r)?r.match(n.re.http)[0].length:0}},"https:":`http:`,"ftp:":`http:`,"//":{validate:function(e,t,n){var r=e.slice(t);return n.re.no_http||(n.re.no_http=RegExp(`^`+n.re.src_auth+`(?:localhost|(?:(?:`+n.re.src_domain+`)\\.)+`+n.re.src_domain_root+`)`+n.re.src_port+n.re.src_host_terminator+n.re.src_path,`i`)),n.re.no_http.test(r)?t>=3&&e[t-3]===`:`||t>=3&&e[t-3]===`/`?0:r.match(n.re.no_http)[0].length:0}},"mailto:":{validate:function(e,t,n){var r=e.slice(t);return n.re.mailto||(n.re.mailto=RegExp(`^`+n.re.src_email_name+`@`+n.re.src_host_strict,`i`)),n.re.mailto.test(r)?r.match(n.re.mailto)[0].length:0}}},f=`a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]`,p=`biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф`.split(`|`);function m(e){e.__index__=-1,e.__text_cache__=``}function h(e){return function(t,n){var r=t.slice(n);return e.test(r)?r.match(e)[0].length:0}}function g(){return function(e,t){t.normalize(e)}}function _(e){var t=e.re=Dc()(e.__opts__),n=e.__tlds__.slice();e.onCompile(),e.__tlds_replaced__||n.push(f),n.push(t.src_xn),t.src_tlds=n.join(`|`);function r(e){return e.replace(`%TLDS%`,t.src_tlds)}t.email_fuzzy=RegExp(r(t.tpl_email_fuzzy),`i`),t.link_fuzzy=RegExp(r(t.tpl_link_fuzzy),`i`),t.link_no_ip_fuzzy=RegExp(r(t.tpl_link_no_ip_fuzzy),`i`),t.host_fuzzy_test=RegExp(r(t.tpl_host_fuzzy_test),`i`);var l=[];e.__compiled__={};function u(e,t){throw Error(`(LinkifyIt) Invalid schema "`+e+`": `+t)}Object.keys(e.__schemas__).forEach(function(t){var n=e.__schemas__[t];if(n!==null){var r={validate:null,link:null};if(e.__compiled__[t]=r,a(n)){o(n.validate)?r.validate=h(n.validate):s(n.validate)?r.validate=n.validate:u(t,n),s(n.normalize)?r.normalize=n.normalize:n.normalize?u(t,n):r.normalize=g();return}if(i(n)){l.push(t);return}u(t,n)}}),l.forEach(function(t){e.__compiled__[e.__schemas__[t]]&&(e.__compiled__[t].validate=e.__compiled__[e.__schemas__[t]].validate,e.__compiled__[t].normalize=e.__compiled__[e.__schemas__[t]].normalize)}),e.__compiled__[``]={validate:null,normalize:g()};var d=Object.keys(e.__compiled__).filter(function(t){return t.length>0&&e.__compiled__[t]}).map(c).join(`|`);e.re.schema_test=RegExp(`(^|(?!_)(?:[><|]|`+t.src_ZPCc+`))(`+d+`)`,`i`),e.re.schema_search=RegExp(`(^|(?!_)(?:[><|]|`+t.src_ZPCc+`))(`+d+`)`,`ig`),e.re.pretest=RegExp(`(`+e.re.schema_test.source+`)|(`+e.re.host_fuzzy_test.source+`)|@`,`i`),m(e)}function v(e,t){var n=e.__index__,r=e.__last_index__,i=e.__text_cache__.slice(n,r);this.schema=e.__schema__.toLowerCase(),this.index=n+t,this.lastIndex=r+t,this.raw=i,this.text=i,this.url=i}function y(e,t){var n=new v(e,t);return e.__compiled__[n.schema].normalize(n,e),n}function b(e,t){if(!(this instanceof b))return new b(e,t);t||u(e)&&(t=e,e={}),this.__opts__=n({},l,t),this.__index__=-1,this.__last_index__=-1,this.__schema__=``,this.__text_cache__=``,this.__schemas__=n({},d,e),this.__compiled__={},this.__tlds__=p,this.__tlds_replaced__=!1,this.re={},_(this)}b.prototype.add=function(e,t){return this.__schemas__[e]=t,_(this),this},b.prototype.set=function(e){return this.__opts__=n(this.__opts__,e),this},b.prototype.test=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return!1;var t,n,r,i,a,o,s,c,l;if(this.re.schema_test.test(e)){for(s=this.re.schema_search,s.lastIndex=0;(t=s.exec(e))!==null;)if(i=this.testSchemaAt(e,t[2],s.lastIndex),i){this.__schema__=t[2],this.__index__=t.index+t[1].length,this.__last_index__=t.index+t[0].length+i;break}}return this.__opts__.fuzzyLink&&this.__compiled__[`http:`]&&(c=e.search(this.re.host_fuzzy_test),c>=0&&(this.__index__<0||c<this.__index__)&&(n=e.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy))!==null&&(a=n.index+n[1].length,(this.__index__<0||a<this.__index__)&&(this.__schema__=``,this.__index__=a,this.__last_index__=n.index+n[0].length))),this.__opts__.fuzzyEmail&&this.__compiled__[`mailto:`]&&(l=e.indexOf(`@`),l>=0&&(r=e.match(this.re.email_fuzzy))!==null&&(a=r.index+r[1].length,o=r.index+r[0].length,(this.__index__<0||a<this.__index__||a===this.__index__&&o>this.__last_index__)&&(this.__schema__=`mailto:`,this.__index__=a,this.__last_index__=o))),this.__index__>=0},b.prototype.pretest=function(e){return this.re.pretest.test(e)},b.prototype.testSchemaAt=function(e,t,n){return this.__compiled__[t.toLowerCase()]?this.__compiled__[t.toLowerCase()].validate(e,n,this):0},b.prototype.match=function(e){var t=0,n=[];this.__index__>=0&&this.__text_cache__===e&&(n.push(y(this,t)),t=this.__last_index__);for(var r=t?e.slice(t):e;this.test(r);)n.push(y(this,t)),r=r.slice(this.__last_index__),t+=this.__last_index__;return n.length?n:null},b.prototype.tlds=function(e,t){return e=Array.isArray(e)?e:[e],t?(this.__tlds__=this.__tlds__.concat(e).sort().filter(function(e,t,n){return e!==n[t-1]}).reverse(),_(this),this):(this.__tlds__=e.slice(),this.__tlds_replaced__=!0,_(this),this)},b.prototype.normalize=function(e){e.schema||(e.url=`http://`+e.url),e.schema===`mailto:`&&!/^mailto:/i.test(e.url)&&(e.url=`mailto:`+e.url)},b.prototype.onCompile=function(){},t.exports=b})),kc=e(n((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),r=e&&e.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},e(t)};return function(r){if(r&&r.__esModule)return r;var i={};if(r!=null)for(var a=e(r),o=0;o<a.length;o++)a[o]!=="default"&&t(i,r,a[o]);return n(i,r),i}})(),i=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=h;var a=i(Cn()),o=Sn(),s=i(Oc()),c=r(se());function l(e,t=!1){return e=(0,o.escapeCarriageReturn)(g(e)),a.default.ansiToJson(e,{json:!0,remove_empty:!0,use_classes:t})}function u(e){let t=``;return e.bg&&(t+=`${e.bg}-bg `),e.fg&&(t+=`${e.fg}-fg `),e.decoration&&(t+=`ansi-${e.decoration} `),t===``?null:(t=t.substring(0,t.length-1),t)}function d(e){let t={};switch(e.bg&&(t.backgroundColor=`rgb(${e.bg})`),e.fg&&(t.color=`rgb(${e.fg})`),e.decoration){case`bold`:t.fontWeight=`bold`;break;case`dim`:t.opacity=`0.5`;break;case`italic`:t.fontStyle=`italic`;break;case`hidden`:t.visibility=`hidden`;break;case`strikethrough`:t.textDecoration=`line-through`;break;case`underline`:t.textDecoration=`underline`;break;case`blink`:t.textDecoration=`blink`;break;default:break}return t}function f(e,t,n,r){let i=t?null:d(n),a=t?u(n):null;return e?e===`fuzzy`?m(n,r,i,a):p(n,r,i,a):c.createElement(`span`,{style:i,key:r,className:a},n.content)}function p(e,t,n,r){let i=[],a=/(\s|^)(https?:\/\/(?:www\.|(?!www))[^\s.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/g,o=0,s;for(;(s=a.exec(e.content))!==null;){let[,t,n]=s,r=s.index+t.length;r>o&&i.push(e.content.substring(o,r));let l=n.startsWith(`www.`)?`http://${n}`:n;i.push(c.createElement(`a`,{key:o,href:l,target:`_blank`},`${n}`)),o=a.lastIndex}return o<e.content.length&&i.push(e.content.substring(o)),c.createElement(`span`,{style:n,key:t,className:r},i)}function m(e,t,n,r){let i=(0,s.default)({fuzzyEmail:!1}).tlds([`io`],!0);if(!i.pretest(e.content))return c.createElement(`span`,{style:n,key:t,className:r},e.content);let a=i.match(e.content);if(!a)return c.createElement(`span`,{style:n,key:t,className:r},e.content);let o=[e.content.substring(0,a[0]?.index)];return a.forEach((t,n)=>{o.push(c.createElement(`a`,{href:t.url,target:`_blank`,key:n},e.content.substring(t.index,t.lastIndex))),a[n+1]&&o.push(e.content.substring(a[n].lastIndex,a[n+1]?.index))}),a[a.length-1].lastIndex!==e.content.length&&o.push(e.content.substring(a[a.length-1].lastIndex,e.content.length)),c.createElement(`span`,{style:n,key:t,className:r},o)}function h(e){let{className:t,useClasses:n,children:r,linkify:i}=e;return c.createElement(`code`,{className:t},l(r??``,n??!1).map(f.bind(null,i??!1,n??!1)))}function g(e){let t=e;do e=t,t=e.replace(/[^\n]\x08/gm,``);while(t.length<e.length);return e}}))(),1),Ac=kc.default.default,jc=typeof kc.default==`function`?kc.default:Ac??kc.default,{Text:Mc}=o,Nc=1e4,Pc=({open:e,onClose:t,branch:n,client:r})=>{let{token:i}=I.useToken(),[a,o]=(0,U.useState)(null),[s,c]=(0,U.useState)(!1),[l,u]=(0,U.useState)(!0),d=(0,U.useRef)(null),f=(0,U.useRef)(null),p=(0,U.useRef)(null),m=(0,U.useRef)(!1),h=(0,U.useCallback)(async(e=!1,t=!1)=>{if(!r||m.current)return;m.current=!0;let i=d.current,a=i&&Math.abs(i.scrollHeight-i.scrollTop-i.clientHeight)<10;t&&c(!0);try{let t=await r.service(`branches/logs`).find({query:{branch_id:n.branch_id}});o(t),f.current=t;let s=!!f.current;e&&(a||!s)&&setTimeout(()=>{i?.scrollTo({top:i.scrollHeight,behavior:`smooth`})},100)}catch(e){let t={logs:``,timestamp:new Date().toISOString(),error:e instanceof Error?e.message:`Failed to fetch logs`};o(t),f.current=t}finally{m.current=!1,t&&c(!1)}},[r,n.branch_id]);return(0,U.useEffect)(()=>{e?h(!0,!0):(o(null),f.current=null)},[e,h]),(0,U.useEffect)(()=>(p.current&&=(clearInterval(p.current),null),l&&e&&(p.current=setInterval(()=>{h(!0)},Nc)),()=>{p.current&&=(clearInterval(p.current),null)}),[l,e,h]),(0,W.jsx)(nt,{title:`Environment Logs - ${n.name}`,open:e,onCancel:t,width:900,style:{top:20},footer:[(0,W.jsx)(gt,{checked:l,onChange:e=>u(e.target.checked),children:`Auto-refresh`},`auto-refresh`),(0,W.jsx)(V,{icon:(0,W.jsx)(x,{}),onClick:()=>h(!1,!0),loading:s,children:`Refresh`},`refresh`),(0,W.jsx)(V,{onClick:t,children:`Close`},`close`)],children:(0,W.jsx)(Er,{fallbackTitle:`Couldn't render the logs viewer.`,resetKey:a?.timestamp,children:(0,W.jsxs)(z,{orientation:`vertical`,size:`middle`,style:{width:`100%`},children:[a&&!a.error&&(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(Mc,{type:`secondary`,style:{fontSize:12},children:[`Fetched at: `,(e=>new Date(e).toLocaleString())(a.timestamp)]}),a.truncated&&(0,W.jsx)(k,{title:`Logs truncated (showing last 500 lines)`,type:`warning`,showIcon:!0,style:{marginTop:8},banner:!0})]}),a?.error&&(0,W.jsx)(k,{title:`Error fetching logs`,description:(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{children:a.error}),a.error.includes(`No logs command`)&&(0,W.jsx)(`div`,{style:{marginTop:8,fontSize:12},children:`Configure a 'logs' command in .env-config.yaml to view logs.`})]}),type:`error`,showIcon:!0}),a&&!a.error&&(0,W.jsx)(`div`,{ref:d,style:{backgroundColor:`#000`,border:`1px solid ${i.colorBorder}`,borderRadius:i.borderRadius,padding:16,height:`60vh`,overflowY:`auto`,fontFamily:`monospace`,fontSize:12,whiteSpace:`pre-wrap`,wordBreak:`break-word`,color:`#fff`},children:a.logs?(0,W.jsx)(jc,{children:String(a.logs)}):`(no logs)`}),s&&!a&&(0,W.jsx)(`div`,{style:{textAlign:`center`,padding:40,color:i.colorTextSecondary,height:`60vh`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:`Loading logs...`})]})})})},Fc=`https://agor.live/guide/environment-configuration`;function Ic(e){return{start:e.start_command||void 0,stop:e.stop_command||void 0,nuke:e.nuke_command||void 0,logs:e.logs_command||void 0,health:e.health_check_url||void 0,app:e.app_url||void 0}}function Lc(e){try{return mn(e,{indent:2,lineWidth:100,noRefs:!0})}catch{return``}}var Rc=({branch:e,repo:t,client:n,onUpdateRepo:r,onUpdateBranch:i,canControlEnvironment:s})=>{let{token:c}=I.useToken(),{showSuccess:l,showError:d}=dn(),{confirm:f}=Ja(),p=Ya(),{isAdmin:m}=to(),{featuresConfig:h}=Ka(),g=h?.managedEnvsExecutionMode??`hybrid`,_=g===`webhook-only`,y=s??m,b=y?void 0:`Requires branch 'all' permission or admin access`,S=_?`This instance uses webhook-managed environments. Use public http(s) URLs for start, stop, nuke, and logs.`:`This instance supports shell commands and URL webhooks for start, stop, nuke, and logs.`,C=_?`version: 2
|
|
6
|
+
default: remote
|
|
7
|
+
variants:
|
|
8
|
+
remote:
|
|
9
|
+
start: https://env.example.com/start?branch={{branch.name}}
|
|
10
|
+
stop: https://env.example.com/stop?branch={{branch.name}}
|
|
11
|
+
health: https://apps.example.com/{{branch.name}}/health
|
|
12
|
+
app: https://apps.example.com/{{branch.name}}
|
|
13
|
+
`:`version: 2
|
|
14
|
+
default: lean
|
|
15
|
+
variants:
|
|
16
|
+
lean:
|
|
17
|
+
start: docker compose up -d
|
|
18
|
+
stop: docker compose down
|
|
19
|
+
`,[w,T]=(0,U.useState)(!1),[E,D]=(0,U.useState)(()=>t.environment?Lc(t.environment):``),[O,A]=(0,U.useState)(null),[j,P]=(0,U.useState)(!1),[ee,te]=(0,U.useState)(()=>Lc(Ic(e))),[re,ae]=(0,U.useState)(null),oe=t.environment?Object.keys(t.environment.variants):[],[se,ce]=(0,U.useState)(e.environment_variant??t.environment?.default??oe[0]??``),[le,ue]=(0,U.useState)(!1),[de,fe]=(0,U.useState)(e.environment_instance?.status||`stopped`),[pe,me]=(0,U.useState)(e.environment_instance?.last_health_check),[he,ge]=(0,U.useState)(e.environment_instance?.last_error),[_e,ve]=(0,U.useState)(!1),[ye,xe]=(0,U.useState)(!1),[Se,Ce]=(0,U.useState)(!1),[we,Te]=(0,U.useState)(!1),[Ee,L]=(0,U.useState)(!1),Oe=(0,U.useRef)(e),ke=(0,U.useRef)(t);(0,U.useEffect)(()=>{fe(e.environment_instance?.status||`stopped`),me(e.environment_instance?.last_health_check),ge(e.environment_instance?.last_error);let t=Oe.current!==e;Oe.current=e,t&&!j&&(te(Lc(Ic(e))),ae(null)),t&&e.environment_variant&&ce(e.environment_variant)},[e,j]),(0,U.useEffect)(()=>{let e=ke.current!==t;ke.current=t,e&&!w&&(D(t.environment?Lc(t.environment):``),A(null))},[t,w]),(0,U.useEffect)(()=>{if(!n)return;let t=t=>{let n=t;n.branch_id===e.branch_id&&(fe(n.environment_instance?.status||`stopped`),me(n.environment_instance?.last_health_check),ge(n.environment_instance?.last_error))};return n.service(`branches`).on(`patched`,t),()=>n.service(`branches`).removeListener(`patched`,t)},[n,e.branch_id]);let je=async()=>{if(n){ve(!0);try{await n.service(`branches/${e.branch_id}/start`).create({}),l(`Environment start requested`)}catch(e){d(e instanceof Error?e.message:`Failed to start environment`)}finally{ve(!1)}}},Me=async()=>{if(n){xe(!0);try{await n.service(`branches/${e.branch_id}/stop`).create({}),l(`Environment stop requested`)}catch(e){d(e instanceof Error?e.message:`Failed to stop environment`)}finally{xe(!1)}}},R=async()=>{if(n){Ce(!0);try{await n.service(`branches/${e.branch_id}/restart`).create({}),l(`Environment restart requested`)}catch(e){d(e instanceof Error?e.message:`Failed to restart environment`)}finally{Ce(!1)}}},Pe=()=>{n&&p(async()=>{Te(!0);try{await n.service(`branches/${e.branch_id}/nuke`).create({}),l(`Environment nuke requested`)}catch(e){d(e instanceof Error?e.message:`Failed to nuke environment`)}finally{Te(!1)}})},Fe=se!==e.environment_variant,Ie=de===`running`||de===`starting`,Le=!y||!t.environment||!se||Fe&&Ie||le,ze=y?t.environment?Fe&&Ie?`Stop the environment before switching variants (currently ${de})`:void 0:`Configure repo environment variants first`:b,Be=async()=>{if(n){ue(!0);try{let t=await n.service(`branches/${e.branch_id}/render-environment`).create({variant:se});l(Fe?`Rendered variant "${se}" to branch`:`Re-rendered branch environment`),te(Lc(Ic(t))),ae(null),t.environment_variant&&ce(t.environment_variant)}catch(e){d(e instanceof Error?e.message:`Failed to render environment`)}finally{ue(!1)}}},Ve=()=>{if(!Le){if(m&&ee.trim()!==Lc(Ic(e)).trim()){f({title:`Discard local snapshot edits?`,content:`The branch has unsaved manual edits in the snapshot editor. Rendering will overwrite them.`,okText:`Render anyway`,okType:`danger`,cancelText:`Cancel`,onOk:Be});return}Be()}},He=e=>{if(!e.trim())return A(`Empty — paste or write a RepoEnvironment YAML document`),null;let t;try{t=bn(e)}catch(e){return A(e instanceof Error?e.message:`Invalid YAML`),null}try{let e=Vt(t);if(_)try{_c(e,g)}catch(e){return A(e instanceof Error?e.message:`Invalid webhook lifecycle URL`),null}return A(null),e}catch(e){return A(e instanceof Error?e.message:`Invalid RepoEnvironment`),null}},Ue=()=>{if(!r)return;let e=He(E);e&&(r(t.repo_id,{environment:e}),T(!1))},We=()=>{D(t.environment?Lc(t.environment):``),A(null),T(!1)},Ge=e=>{if(!e.trim())return ae("Empty — provide at least `start` and `stop`"),null;let t;try{t=bn(e)}catch(e){return ae(e instanceof Error?e.message:`Invalid YAML`),null}if(typeof t!=`object`||!t)return ae(`Expected a YAML mapping (object)`),null;let n=t;if(!n.start||typeof n.start!=`string`)return ae("`start` is required and must be a string"),null;if(!n.stop||typeof n.stop!=`string`)return ae("`stop` is required and must be a string"),null;if(_)try{gc({start:n.start,stop:n.stop,nuke:n.nuke,logs:n.logs},g,`branch environment`)}catch(e){return ae(e instanceof Error?e.message:`Invalid webhook lifecycle URL`),null}return ae(null),n},Ke=()=>{if(!i)return;let t=Ge(ee);t&&(i(e.branch_id,{start_command:t.start||void 0,stop_command:t.stop||void 0,nuke_command:t.nuke||void 0,logs_command:t.logs||void 0,health_check_url:t.health||void 0,app_url:t.app||void 0}),P(!1))},qe=()=>{te(Lc(Ic(e))),ae(null),P(!1)},Xe=()=>{if(!n||!r)return;let i=t.environment?Object.keys(t.environment.variants):[];f({title:`Import .agor.yml?`,icon:(0,W.jsx)(ie,{}),content:(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`p`,{children:[`This will replace your repo-level variants with the contents of `,(0,W.jsx)(`code`,{children:`.agor.yml`}),` `,`in this branch.`]}),i.length>0&&(0,W.jsxs)(`p`,{style:{marginBottom:4},children:[`Current variants that will be replaced:`,` `,i.map(e=>(0,W.jsx)(v,{style:{marginBottom:4},children:e},e))]}),(0,W.jsxs)(`p`,{style:{marginTop:8},children:[`Your `,(0,W.jsx)(`code`,{children:`template_overrides`}),` and branch-level snapshots are preserved.`]})]}),okText:`Import`,cancelText:`Cancel`,onOk:async()=>{try{let i=await n.service(`repos/${t.repo_id}/import-agor-yml`).create({branch_id:e.branch_id});i.environment&&D(Lc(i.environment)),r(t.repo_id,{environment:i.environment}),l(`Imported .agor.yml`)}catch(e){d(e instanceof Error?e.message:`Failed to import .agor.yml`)}}})},Ze=()=>{n&&f({title:`Export to .agor.yml?`,icon:(0,W.jsx)(Ae,{}),content:(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`p`,{children:[`This will overwrite `,(0,W.jsx)(`code`,{children:`.agor.yml`}),` in the repo root (this branch's working copy).`]}),(0,W.jsxs)(`p`,{children:[(0,W.jsx)(`code`,{children:`template_overrides`}),` stays local and will not be written.`]})]}),okText:`Export`,cancelText:`Cancel`,onOk:async()=>{try{await n.service(`repos/${t.repo_id}/export-agor-yml`).create({branch_id:e.branch_id}),l(`Environment configuration exported to .agor.yml`)}catch(e){d(e instanceof Error?e.message:`Failed to export .agor.yml`)}}})},Qe=vc(e.environment_instance),$e=!!t.environment,tt=!$e,nt=j,it=w,at=(0,W.jsx)(o.Text,{type:`secondary`,style:{fontSize:11},children:(0,W.jsx)(`a`,{href:Fc,target:`_blank`,rel:`noopener noreferrer`,children:`Documentation`})}),ot=(0,U.useMemo)(()=>{let e=yc(Qe);switch(Qe){case`healthy`:return(0,W.jsx)(o.Text,{strong:!0,style:{color:c.colorSuccess},children:e});case`unhealthy`:return(0,W.jsx)(o.Text,{strong:!0,style:{color:c.colorError},children:e});case`running`:return(0,W.jsx)(o.Text,{strong:!0,style:{color:c.colorInfo},children:e});case`starting`:case`stopping`:return(0,W.jsx)(o.Text,{strong:!0,children:e});case`error`:return(0,W.jsx)(o.Text,{strong:!0,type:`danger`,children:e});default:return(0,W.jsx)(o.Text,{type:`secondary`,children:e})}},[Qe,c]),B=pe?pe.status===`healthy`?(0,W.jsx)(Re,{style:{color:c.colorSuccess}}):pe.status===`unhealthy`?(0,W.jsx)(Je,{style:{color:c.colorError}}):(0,W.jsx)(Ye,{style:{color:c.colorWarning}}):null,lt=oe.map(e=>{let n=t.environment?.variants[e]?.description,r=t.environment?.default===e;return{value:e,label:(0,W.jsxs)(`span`,{children:[(0,W.jsx)(`strong`,{children:e}),r&&(0,W.jsx)(v,{color:`blue`,style:{marginLeft:6,fontSize:10},children:`default`}),n&&(0,W.jsx)(o.Text,{type:`secondary`,style:{marginLeft:8,fontSize:11},children:n})]})}});return(0,W.jsxs)(`div`,{style:{width:`100%`,maxHeight:`70vh`,overflowY:`auto`},children:[(0,W.jsxs)(z,{orientation:`vertical`,size:`large`,style:{width:`100%`},children:[$e&&(0,W.jsxs)(Ne,{size:`small`,children:[(0,W.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,flexWrap:`wrap`},children:[de===`running`&&(0,W.jsx)(De,{size:`small`}),B,ot,(0,W.jsx)(`div`,{style:{flex:1}}),(0,W.jsx)(V,{type:`primary`,size:`small`,icon:_e?(0,W.jsx)(be,{}):(0,W.jsx)(a,{}),onClick:je,loading:_e,disabled:!y||de===`running`||de===`starting`||_e||ye||Se,title:b,children:`Start`}),(0,W.jsx)(V,{size:`small`,icon:ye?(0,W.jsx)(be,{}):(0,W.jsx)(ne,{}),onClick:Me,loading:ye,disabled:!y,title:b,danger:!0,children:`Stop`}),(0,W.jsx)(V,{size:`small`,icon:Se?(0,W.jsx)(be,{}):(0,W.jsx)(x,{}),onClick:R,disabled:!y||_e||ye||Se,loading:Se,title:b,children:`Restart`}),e.nuke_command&&(0,W.jsx)(V,{size:`small`,icon:we?(0,W.jsx)(be,{}):(0,W.jsx)(st,{}),onClick:Pe,disabled:!y||_e||ye||Se||we,loading:we,danger:!0,title:b??`Nuke environment (destructive - removes all data and volumes)`,children:`Nuke`}),(0,W.jsx)(V,{size:`small`,icon:(0,W.jsx)(rt,{}),onClick:()=>L(!0),disabled:!y||!e.logs_command,title:y?e.logs_command?void 0:`Configure a logs command in the variant to enable`:b,children:`View Logs`})]}),de===`error`&&(pe?.message||he)&&(0,W.jsx)(k,{style:{marginTop:12,fontSize:11},type:`error`,showIcon:!0,title:pe?.message||`Environment Error`,description:he&&(0,W.jsx)(`pre`,{style:{maxHeight:200,overflow:`auto`,margin:0,fontSize:11,whiteSpace:`pre-wrap`,wordBreak:`break-word`},children:he})})]}),tt&&(0,W.jsx)(k,{type:`info`,showIcon:!0,title:`No environment variants configured`,description:(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`p`,{style:{marginBottom:8},children:m?`Import from an existing .agor.yml or add variants in the repo editor below.`:`Ask an admin to set up environment commands in the repo editor below.`}),m&&(0,W.jsx)(z,{children:(0,W.jsx)(V,{size:`small`,icon:(0,W.jsx)(ie,{}),onClick:Xe,children:`Import from .agor.yml`})}),(0,W.jsx)(`div`,{style:{marginTop:8},children:(0,W.jsx)(`a`,{href:Fc,target:`_blank`,rel:`noopener noreferrer`,children:`Documentation: environment variants`})})]})}),(0,W.jsx)(Ne,{size:`small`,title:(0,W.jsxs)(z,{children:[(0,W.jsx)(et,{}),(0,W.jsx)(`span`,{children:`Repository environment (shared)`}),(0,W.jsx)(v,{color:`orange`,style:{fontSize:10},children:`Affects all branches on this repo`})]}),extra:(0,W.jsxs)(z,{size:`small`,children:[(0,W.jsx)(M,{title:m?`Replace variants with contents of .agor.yml in this branch`:`Only admins can import .agor.yml`,children:(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(ie,{}),onClick:Xe,disabled:!m,children:`Import`})}),(0,W.jsx)(M,{title:$e?m?`Write variants + default to .agor.yml (template_overrides stripped)`:`Only admins can export .agor.yml`:`No configuration to export`,children:(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(Ae,{}),onClick:Ze,disabled:!m||!$e,children:`Export`})}),!w&&(0,W.jsx)(M,{title:m?nt?`Finish editing the branch snapshot first`:void 0:`Only admins can edit repo environment`,children:(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(N,{}),onClick:()=>T(!0),disabled:!m||nt,children:`Edit`})})]}),children:(0,W.jsxs)(z,{orientation:`vertical`,size:`small`,style:{width:`100%`},children:[(0,W.jsx)(k,{type:`info`,showIcon:!0,message:_?`Webhook-managed environments`:`Managed environments`,description:S,style:{fontSize:12}}),(0,W.jsxs)(o.Text,{type:`secondary`,style:{fontSize:11},children:[`YAML representation of `,(0,W.jsx)(`code`,{children:`repo.environment`}),`. Includes `,(0,W.jsx)(`code`,{children:`version`}),`,`,` `,(0,W.jsx)(`code`,{children:`default`}),`, `,(0,W.jsx)(`code`,{children:`variants`}),`, and optional`,` `,(0,W.jsx)(`code`,{children:`template_overrides`}),`. `,at]}),(0,W.jsx)(Sc,{value:E,onChange:e=>{D(e),O&&A(null)},language:`yaml`,placeholder:tt&&m?C:``,readOnly:!w,rows:10,maxHeight:`480px`}),O&&(0,W.jsx)(k,{type:`error`,showIcon:!0,title:`Invalid repo environment: ${O}`}),w&&(0,W.jsxs)(z,{children:[(0,W.jsx)(V,{type:`primary`,size:`small`,icon:(0,W.jsx)(u,{}),onClick:Ue,children:`Save`}),(0,W.jsx)(V,{size:`small`,onClick:We,children:`Cancel`})]})]})}),(0,W.jsx)(Ne,{size:`small`,children:(0,W.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:12,flexWrap:`wrap`},children:[(0,W.jsx)(o.Text,{strong:!0,style:{fontSize:13},children:`Variant:`}),(0,W.jsx)(F,{value:se||void 0,onChange:ce,style:{minWidth:260},size:`small`,options:lt,disabled:!$e,placeholder:tt?`No variants configured — ask an admin`:`Select a variant`}),Fe&&(0,W.jsx)(v,{color:`gold`,style:{fontSize:10},children:`will replace snapshot`}),(0,W.jsx)(`div`,{style:{flex:1}}),(0,W.jsx)(M,{title:ze,children:(0,W.jsx)(V,{type:`primary`,size:`small`,icon:le?(0,W.jsx)(be,{}):(0,W.jsx)(ct,{}),onClick:Ve,loading:le,disabled:Le,children:`Render`})})]})}),(0,W.jsx)(Ne,{size:`small`,title:(0,W.jsxs)(z,{children:[(0,W.jsx)(a,{}),(0,W.jsxs)(`span`,{children:[`Branch environment: `,e.name]}),e.environment_variant&&(0,W.jsxs)(v,{color:`blue`,style:{fontSize:10},children:[`rendered from: `,e.environment_variant]})]}),extra:!j&&(0,W.jsx)(M,{title:m?it?`Finish editing the repo environment first`:`Edit the rendered commands for this branch only`:`Only admins can edit the rendered snapshot directly`,children:(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(N,{}),onClick:()=>P(!0),disabled:!m||it,children:`Edit`})}),children:(0,W.jsxs)(z,{orientation:`vertical`,size:`small`,style:{width:`100%`},children:[(0,W.jsxs)(o.Text,{type:`secondary`,style:{fontSize:11},children:[`Rendered snapshot persisted on this branch (fields: `,(0,W.jsx)(`code`,{children:`start`}),`,`,` `,(0,W.jsx)(`code`,{children:`stop`}),`, `,(0,W.jsx)(`code`,{children:`nuke`}),`, `,(0,W.jsx)(`code`,{children:`logs`}),`, `,(0,W.jsx)(`code`,{children:`health`}),`,`,` `,(0,W.jsx)(`code`,{children:`app`}),`). `,S,` Click Render above to regenerate from the variant.`]}),(0,W.jsx)(Sc,{value:ee,onChange:e=>{te(e),re&&ae(null)},language:`yaml`,readOnly:!j,rows:10,maxHeight:`480px`}),re&&(0,W.jsx)(k,{type:`error`,showIcon:!0,title:`Invalid snapshot: ${re}`}),j&&(0,W.jsxs)(z,{children:[(0,W.jsx)(V,{type:`primary`,size:`small`,icon:(0,W.jsx)(u,{}),onClick:Ke,children:`Save`}),(0,W.jsx)(V,{size:`small`,onClick:qe,children:`Cancel`})]})]})})]}),(0,W.jsx)(Pc,{open:Ee,onClose:()=>L(!1),branch:e,client:n})]})},zc=({children:e,language:t=`typescript`,showLineNumbers:n=!1,customStyle:r,PreTag:i=`pre`,codeTagProps:a})=>{let{token:o}=I.useToken();return(0,W.jsx)(Bn,{language:t,style:Wn(o)?Ln:Hn,showLineNumbers:n,customStyle:{margin:0,borderRadius:o.borderRadius,...r},PreTag:i,codeTagProps:a,children:e})},Bc={js:`javascript`,cjs:`javascript`,mjs:`javascript`,ts:`typescript`,jsx:`jsx`,tsx:`tsx`,py:`python`,rb:`ruby`,go:`go`,rs:`rust`,java:`java`,c:`c`,cpp:`cpp`,h:`c`,hpp:`cpp`,css:`css`,scss:`scss`,html:`html`,xml:`xml`,json:`json`,yaml:`yaml`,yml:`yaml`,sh:`bash`,bash:`bash`,sql:`sql`,graphql:`graphql`,proto:`protobuf`,toml:`toml`,vue:`vue`,svelte:`svelte`,md:`markdown`,markdown:`markdown`,env:`bash`};function Vc(e){return Bc[e.split(`.`).pop()?.toLowerCase()??``]??`text`}var Hc=({file:e,open:t,onClose:n,loading:r})=>{let{showSuccess:i}=dn();if(!e)return null;let a=Vc(e.path);return(0,W.jsx)(nt,{title:e.path,open:t,onCancel:n,width:900,styles:{body:{maxHeight:`70vh`,overflow:`auto`}},footer:[(0,W.jsx)(V,{icon:(0,W.jsx)(We,{}),onClick:async()=>{await on(e.path),i(`Path copied to clipboard!`)},children:`Copy Path`},`copy-path`),(0,W.jsx)(V,{type:`primary`,icon:(0,W.jsx)(We,{}),onClick:async()=>{await on(e.content),i(`Content copied to clipboard!`)},children:`Copy Content`},`copy-content`),(0,W.jsx)(V,{onClick:n,children:`Close`},`close`)],children:r?(0,W.jsx)(De,{style:{display:`block`,padding:`2rem`},description:`Loading file…`}):(0,W.jsx)(zc,{language:a,showLineNumbers:!0,children:e.content})})},{Search:Uc}=L,Wc=300;function Gc(e,t,n,r){let i=t?e.filter(e=>e.title.toLowerCase().includes(t.toLowerCase())||e.path.toLowerCase().includes(t.toLowerCase())):e,a=new Map;for(let e of i){let t=e.path.split(`/`),i=``;for(let e=0;e<t.length-1;e++){let n=t[e],r=i;if(i=i?`${i}/${n}`:n,!a.has(i)&&(a.set(i,{key:i,title:(0,W.jsxs)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:8},children:[(0,W.jsx)(de,{}),(0,W.jsx)(`strong`,{children:n})]}),isLeaf:!1,children:[]}),r&&a.has(r))){let e=a.get(r);e.children=e.children||[],e.children.push(a.get(i))}}let o=e.path.endsWith(`.md`)?it:l,s=t[t.length-1],c=(e=>e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`)(e.size),u=`${e.path} (${c})`,d={key:e.path,title:(0,W.jsx)(M,{title:u,mouseEnterDelay:.5,children:(0,W.jsxs)(`div`,{style:{display:`inline-flex`,justifyContent:`space-between`,alignItems:`center`,width:`100%`},children:[(0,W.jsxs)(`span`,{style:{flex:1,minWidth:0,display:`inline-flex`,alignItems:`center`,gap:8},children:[(0,W.jsx)(o,{}),s]}),(0,W.jsxs)(`span`,{style:{marginLeft:8,whiteSpace:`nowrap`,display:`inline-flex`,gap:4},children:[(0,W.jsx)(M,{title:`Copy path`,children:(0,W.jsx)(V,{size:`small`,type:`text`,icon:(0,W.jsx)(We,{}),onClick:t=>{t.stopPropagation(),r&&r(e)}})}),n&&(0,W.jsx)(M,{title:`Download file`,children:(0,W.jsx)(V,{size:`small`,type:`text`,icon:(0,W.jsx)(ie,{}),onClick:t=>{t.stopPropagation(),n(e)}})})]})]})}),isLeaf:!0,file:e};if(i&&a.has(i)){let e=a.get(i);e.children=e.children||[],e.children.push(d)}else a.set(e.path,d)}let o=[],s=new Set(a.keys());for(let[e,t]of a.entries()){let n=e.split(`/`).slice(0,-1).join(`/`);(!n||!s.has(n))&&o.push(t)}let c=e=>{let t=e.filter(e=>!e.isLeaf),n=e.filter(e=>e.isLeaf);return t.sort((e,t)=>e.key.localeCompare(t.key)),n.sort((e,t)=>e.key.localeCompare(t.key)),t.forEach(e=>{e.children&&=c(e.children)}),[...t,...n]};return c(o)}var Kc=(0,U.memo)(({files:e,onFileClick:t,onDownload:n,loading:r=!1,emptyMessage:i=`No files found`})=>{let[a,o]=(0,U.useState)(``),[s,c]=(0,U.useState)(``),[l,u]=(0,U.useState)([]),{showSuccess:d}=dn(),f=(0,U.useRef)(n);f.current=n;let p=(0,U.useRef)(t);p.current=t;let m=(0,U.useRef)(null),h=(0,U.useRef)(null),g=(0,U.useCallback)(async e=>{await on(e.path),d(`Path copied to clipboard!`)},[d]),_=(0,U.useCallback)(e=>{f.current?.(e)},[]),v=(0,U.useMemo)(()=>Gc(e,a,_,g),[e,a,_,g]),y=(0,U.useCallback)((e,t)=>{t.node.isLeaf&&t.node.file&&p.current(t.node.file)},[]),b=(0,U.useCallback)(e=>{let t=[],n=e=>{e.isLeaf||t.push(e.key),e.children&&e.children.forEach(n)};return e.forEach(n),t},[]),x=(0,U.useCallback)(e=>{let t=e.target.value;c(t),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{o(t),h.current=t},Wc)},[]),S=(0,U.useCallback)(e=>{m.current&&clearTimeout(m.current),c(e),o(e),h.current=e},[]);(0,U.useEffect)(()=>()=>{m.current&&clearTimeout(m.current)},[]);let C=(0,U.useRef)(v);(0,U.useEffect)(()=>{if(C.current!==v&&h.current!==null){let e=h.current;if(h.current=null,e){let e=b(v);u(t=>e.length!==t.length||!e.every(e=>t.includes(e))?e:t)}else u(e=>e.length>0?[]:e)}C.current=v},[v,b]);let w=(0,U.useCallback)(e=>{u(e)},[]);return r?(0,W.jsx)(`div`,{style:{display:`flex`,justifyContent:`center`,padding:48},children:(0,W.jsx)(De,{size:`large`})}):!r&&e.length===0?(0,W.jsx)(`div`,{style:{padding:48},children:(0,W.jsx)(ue,{description:i})}):(0,W.jsxs)(`div`,{style:{padding:`0 24px`},children:[(0,W.jsx)(`div`,{style:{marginBottom:16},children:(0,W.jsx)(Uc,{placeholder:`Search files...`,allowClear:!0,value:s,onSearch:S,onChange:x,style:{width:`100%`}})}),(0,W.jsx)(j,{className:`agor-flat-tree`,treeData:v,onSelect:y,showIcon:!1,expandedKeys:l,onExpand:w,style:{background:`transparent`,borderRadius:0,padding:0},virtual:!0,height:600})]})},(e,t)=>e.loading===t.loading&&e.emptyMessage===t.emptyMessage&&e.files===t.files),qc=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Jc=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Yc={};function Xc(e,t){return((t||Yc).jsx?Jc:qc).test(e)}var Zc=/[ \t\n\f\r]/g;function Qc(e){return typeof e==`object`?e.type===`text`?$c(e.value):!1:$c(e)}function $c(e){return e.replace(Zc,``)===``}var el=n(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g,u=`
|
|
20
|
+
`,d=`/`,f=`*`,p=``,m=`comment`,h=`declaration`;function g(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,g=1;function v(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(u);g=~n?e.length-n:g+e.length}function y(){var e={line:l,column:g};return function(t){return t.position=new b(e),C(),t}}function b(e){this.start=e,this.end={line:l,column:g},this.source=t.source}b.prototype.content=e;function x(n){var r=Error(t.source+`:`+l+`:`+g+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=g,r.source=e,!t.silent)throw r}function S(t){var n=t.exec(e);if(n){var r=n[0];return v(r),e=e.slice(r.length),n}}function C(){S(i)}function w(e){var t;for(e||=[];t=T();)t!==!1&&e.push(t);return e}function T(){var t=y();if(!(d!=e.charAt(0)||f!=e.charAt(1))){for(var n=2;p!=e.charAt(n)&&(f!=e.charAt(n)||d!=e.charAt(n+1));)++n;if(n+=2,p===e.charAt(n-1))return x(`End of comment missing`);var r=e.slice(2,n-2);return g+=2,v(r),e=e.slice(n),g+=2,t({type:m,comment:r})}}function E(){var e=y(),t=S(a);if(t){if(T(),!S(o))return x(`property missing ':'`);var r=S(s),i=e({type:h,property:_(t[0].replace(n,p)),value:r?_(r[0].replace(n,p)):p});return S(c),i}}function D(){var e=[];w(e);for(var t;t=E();)t!==!1&&(e.push(t),w(e));return e}return C(),D()}function _(e){return e?e.replace(l,p):p}t.exports=g})),tl=n((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=r;var n=t(el());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),nl=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),rl=n(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(tl()),r=nl();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),il=ol(`end`),al=ol(`start`);function ol(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function sl(e){let t=al(e),n=il(e);if(t&&n)return{start:t,end:n}}function cl(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?ul(e.position):`start`in e||`end`in e?ul(e):`line`in e||`column`in e?ll(e):``}function ll(e){return dl(e&&e.line)+`:`+dl(e&&e.column)}function ul(e){return ll(e&&e.start)+`-`+ll(e&&e.end)}function dl(e){return e&&typeof e==`number`?e:1}var fl=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=cl(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};fl.prototype.file=``,fl.prototype.name=``,fl.prototype.reason=``,fl.prototype.message=``,fl.prototype.stack=``,fl.prototype.column=void 0,fl.prototype.line=void 0,fl.prototype.ancestors=void 0,fl.prototype.cause=void 0,fl.prototype.fatal=void 0,fl.prototype.place=void 0,fl.prototype.ruleId=void 0,fl.prototype.source=void 0;var pl=e(rl(),1),ml={}.hasOwnProperty,hl=new Map,gl=/[A-Z]/g,_l=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),vl=new Set([`td`,`th`]);function yl(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=Al(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=kl(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?Nn:Un,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=bl(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function bl(e,t,n){if(t.type===`element`)return xl(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return Sl(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return wl(e,t,n);if(t.type===`mdxjsEsm`)return Cl(e,t);if(t.type===`root`)return Tl(e,t,n);if(t.type===`text`)return El(e,t)}function xl(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=Nn,e.schema=i),e.ancestors.push(t);let a=Il(e,t.tagName,!1),o=jl(e,t),s=Nl(e,t);return _l.has(t.tagName)&&(s=s.filter(function(e){return typeof e==`string`?!Qc(e):!0})),Dl(e,o,a,t),Ol(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Sl(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}Ll(e,t.position)}function Cl(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Ll(e,t.position)}function wl(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=Nn,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:Il(e,t.name,!0),o=Ml(e,t),s=Nl(e,t);return Dl(e,o,a,t),Ol(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Tl(e,t,n){let r={};return Ol(r,Nl(e,t)),e.create(t,e.Fragment,r,n)}function El(e,t){return t.value}function Dl(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Ol(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function kl(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function Al(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=al(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function jl(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&ml.call(t.properties,i)){let a=Pl(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&vl.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function Ml(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`)if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else Ll(e,t.position);else{let i=r.name,a;if(r.value&&typeof r.value==`object`)if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else Ll(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function Nl(e,t){let n=[],r=-1,i=e.passKeys?new Map:hl;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=bl(e,a,o);s!==void 0&&n.push(s)}return n}function Pl(e,t,n){let r=Pn(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?In(n):Mn(n)),r.property===`style`){let t=typeof n==`object`?n:Fl(e,String(n));return e.stylePropertyNameCase===`css`&&(t=Rl(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?zn[r.property]||r.property:r.attribute,n]}}function Fl(e,t){try{return(0,pl.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new fl("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=`https://github.com/syntax-tree/hast-util-to-jsx-runtime#cannot-parse-style-attribute`,r}}function Il(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=Xc(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=Xc(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return ml.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);Ll(e)}function Ll(e,t){let n=new fl("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:`mdx-estree`,source:`hast-util-to-jsx-runtime`});throw n.file=e.filePath||void 0,n.url=`https://github.com/syntax-tree/hast-util-to-jsx-runtime#cannot-handle-mdx-estrees-without-createevaluater`,n}function Rl(e){let t={},n;for(n in e)ml.call(e,n)&&(t[zl(n)]=e[n]);return t}function zl(e){let t=e.replace(gl,Bl);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function Bl(e){return`-`+e.toLowerCase()}var Vl={action:[`form`],cite:[`blockquote`,`del`,`ins`,`q`],data:[`object`],formAction:[`button`,`input`],href:[`a`,`area`,`base`,`link`],icon:[`menuitem`],itemId:null,manifest:[`html`],ping:[`a`,`area`],poster:[`video`],src:[`audio`,`embed`,`iframe`,`img`,`input`,`script`,`source`,`track`,`video`]},Hl={};function Ul(e,t){let n=t||Hl;return Wl(e,typeof n.includeImageAlt==`boolean`?n.includeImageAlt:!0,typeof n.includeHtml==`boolean`?n.includeHtml:!0)}function Wl(e,t,n){if(Kl(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return Gl(e.children,t,n)}return Array.isArray(e)?Gl(e,t,n):``}function Gl(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=Wl(e[i],t,n);return r.join(``)}function Kl(e){return!!(e&&typeof e==`object`)}function ql(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function Jl(e,t){return e.length>0?(ql(e,e.length,0,t),e):t}var Yl={}.hasOwnProperty;function Xl(e){let t={},n=-1;for(;++n<e.length;)Zl(t,e[n]);return t}function Zl(e,t){let n;for(n in t){let r=(Yl.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){Yl.call(r,a)||(r[a]=[]);let e=i[a];Ql(r[a],Array.isArray(e)?e:e?[e]:[])}}}function Ql(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);ql(e,0,0,r)}function $l(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function eu(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var tu=pu(/[A-Za-z]/),nu=pu(/[\dA-Za-z]/),ru=pu(/[#-'*+\--9=?A-Z^-~]/);function iu(e){return e!==null&&(e<32||e===127)}var au=pu(/\d/),ou=pu(/[\dA-Fa-f]/),su=pu(/[!-/:-@[-`{-~]/);function cu(e){return e!==null&&e<-2}function lu(e){return e!==null&&(e<0||e===32)}function uu(e){return e===-2||e===-1||e===32}var du=pu(/\p{P}|\p{S}/u),fu=pu(/\s/);function pu(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function mu(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&nu(e.charCodeAt(n+1))&&nu(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function hu(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return uu(r)?(e.enter(n),s(r)):t(r)}function s(r){return uu(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var gu={tokenize:_u};function _u(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),hu(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return cu(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var vu={tokenize:bu},yu={tokenize:xu};function bu(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return ql(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(yu,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(yu,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return cu(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;ql(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-- >r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function xu(e,t,n){return hu(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function Su(e){if(e===null||lu(e)||fu(e))return 1;if(du(e))return 2}function Cu(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var wu={name:`attention`,resolveAll:Tu,tokenize:Eu};function Tu(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};Du(d,-c),Du(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=Jl(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=Jl(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=Jl(l,Cu(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=Jl(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=Jl(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,ql(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function Eu(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Su(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=Su(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function Du(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var Ou={name:`autolink`,tokenize:ku};function ku(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return tu(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||nu(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||nu(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||iu(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):ru(t)?(e.consume(t),l):n(t)}function u(e){return nu(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||nu(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var Au={partial:!0,tokenize:ju};function ju(e,t,n){return r;function r(t){return uu(t)?hu(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||cu(e)?t(e):n(e)}}var Mu={continuation:{tokenize:Pu},exit:Fu,name:`blockQuote`,tokenize:Nu};function Nu(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return uu(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function Pu(e,t,n){let r=this;return i;function i(t){return uu(t)?hu(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(Mu,t,n)(r)}}function Fu(e){e.exit(`blockQuote`)}var Iu={name:`characterEscape`,tokenize:Lu};function Lu(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return su(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var Ru={name:`characterReference`,tokenize:zu};function zu(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=nu,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=ou,u):(e.enter(`characterReferenceValue`),a=7,o=au,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===nu&&!Fn(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var Bu={partial:!0,tokenize:Uu},Vu={concrete:!0,name:`codeFenced`,tokenize:Hu};function Hu(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),uu(t)?hu(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||cu(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(Bu,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||cu(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):uu(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),hu(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||cu(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||cu(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&uu(t)?hu(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||cu(t)?e.check(Bu,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||cu(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),uu(t)?hu(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),uu(t)?hu(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||cu(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function Uu(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var Wu={name:`codeIndented`,tokenize:Ku},Gu={partial:!0,tokenize:qu};function Ku(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),hu(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):cu(t)?e.attempt(Gu,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||cu(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function qu(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):cu(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):hu(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):cu(e)?i(e):n(e)}}var Ju={name:`codeText`,previous:Xu,resolve:Yu,tokenize:Zu};function Yu(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function Xu(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function Zu(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):cu(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||cu(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var Qu=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&$u(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),$u(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),$u(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){let t=this.left.splice(e,1/0);$u(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);$u(this.left,t.reverse())}}};function $u(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function ed(e){let t={},n=-1,r,i,a,o,s,c,l,u=new Qu(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,td(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(!(o[1].type===`linePrefix`||o[1].type===`listItemIndent`))break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return ql(e,0,1/0,u.slice(0)),!l}function td(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var nd={resolve:id,tokenize:ad},rd={partial:!0,tokenize:od};function id(e){return ed(e),e}function ad(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):cu(t)?e.check(rd,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function od(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),hu(e,a,`linePrefix`)}function a(i){if(i===null||cu(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function sd(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||iu(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||cu(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||lu(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||iu(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function cd(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):cu(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||cu(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!uu(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function ld(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):cu(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),hu(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||cu(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function ud(e,t){let n;return r;function r(i){return cu(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):uu(i)?hu(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var dd={name:`definition`,tokenize:pd},fd={partial:!0,tokenize:md};function pd(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return cd.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=eu(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return lu(t)?ud(e,l)(t):l(t)}function l(t){return sd(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(fd,d,d)(t)}function d(t){return uu(t)?hu(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||cu(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function md(e,t,n){return r;function r(t){return lu(t)?ud(e,i)(t):n(t)}function i(t){return ld(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return uu(t)?hu(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||cu(e)?t(e):n(e)}}var hd={name:`hardBreakEscape`,tokenize:gd};function gd(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return cu(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var _d={name:`headingAtx`,resolve:vd,tokenize:yd};function vd(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},ql(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function yd(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||lu(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||cu(n)?(e.exit(`atxHeading`),t(n)):uu(n)?hu(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||lu(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var bd=`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.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),xd=[`pre`,`script`,`style`,`textarea`],Sd={concrete:!0,name:`htmlFlow`,resolveTo:Td,tokenize:Ed},Cd={partial:!0,tokenize:Od},wd={partial:!0,tokenize:Dd};function Td(e){let t=e.length;for(;t--&&!(e[t][0]===`enter`&&e[t][1].type===`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Ed(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:te):tu(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):tu(a)?(e.consume(a),i=4,r.interrupt?t:te):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:te):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return tu(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||lu(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&xd.includes(l)?(i=1,r.interrupt?t(s):O(s)):bd.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||nu(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return uu(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||tu(t)?(e.consume(t),b):uu(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||nu(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):uu(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):uu(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||cu(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||lu(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||uu(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||cu(t)?O(t):uu(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),M):t===60&&i===1?(e.consume(t),N):t===62&&i===4?(e.consume(t),ne):t===63&&i===3?(e.consume(t),te):t===93&&i===5?(e.consume(t),ee):cu(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(Cd,re,k)(t)):t===null||cu(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(wd,A,re)(t)}function A(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),j}function j(t){return t===null||cu(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function M(t){return t===45?(e.consume(t),te):O(t)}function N(t){return t===47?(e.consume(t),o=``,P):O(t)}function P(t){if(t===62){let n=o.toLowerCase();return xd.includes(n)?(e.consume(t),ne):O(t)}return tu(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),P):O(t)}function ee(t){return t===93?(e.consume(t),te):O(t)}function te(t){return t===62?(e.consume(t),ne):t===45&&i===2?(e.consume(t),te):O(t)}function ne(t){return t===null||cu(t)?(e.exit(`htmlFlowData`),re(t)):(e.consume(t),ne)}function re(n){return e.exit(`htmlFlow`),t(n)}}function Dd(e,t,n){let r=this;return i;function i(t){return cu(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function Od(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(Au,t,n)}}var kd={name:`htmlText`,tokenize:Ad};function Ad(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):tu(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):tu(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):cu(t)?(o=d,N(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?M(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):cu(t)?(o=h,N(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?M(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?M(t):cu(t)?(o=v,N(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):cu(t)?(o=y,N(t)):(e.consume(t),y)}function b(e){return e===62?M(e):y(e)}function x(t){return tu(t)?(e.consume(t),S):n(t)}function S(t){return t===45||nu(t)?(e.consume(t),S):C(t)}function C(t){return cu(t)?(o=C,N(t)):uu(t)?(e.consume(t),C):M(t)}function w(t){return t===45||nu(t)?(e.consume(t),w):t===47||t===62||lu(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),M):t===58||t===95||tu(t)?(e.consume(t),E):cu(t)?(o=T,N(t)):uu(t)?(e.consume(t),T):M(t)}function E(t){return t===45||t===46||t===58||t===95||nu(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):cu(t)?(o=D,N(t)):uu(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):cu(t)?(o=O,N(t)):uu(t)?(e.consume(t),O):(e.consume(t),A)}function k(t){return t===i?(e.consume(t),i=void 0,j):t===null?n(t):cu(t)?(o=k,N(t)):(e.consume(t),k)}function A(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||lu(t)?T(t):(e.consume(t),A)}function j(e){return e===47||e===62||lu(e)?T(e):n(e)}function M(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function N(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),P}function P(t){return uu(t)?hu(e,ee,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):ee(t)}function ee(t){return e.enter(`htmlTextData`),o(t)}}var jd={name:`labelEnd`,resolveAll:Fd,resolveTo:Id,tokenize:Ld},Md={tokenize:Rd},Nd={tokenize:zd},Pd={tokenize:Bd};function Fd(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&ql(e,0,e.length,n),e}function Id(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=Jl(s,e.slice(a+1,a+r+3)),s=Jl(s,[[`enter`,u,t]]),s=Jl(s,Cu(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=Jl(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=Jl(s,e.slice(o+1)),s=Jl(s,[[`exit`,c,t]]),ql(e,a,e.length,s),e}function Ld(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(eu(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(Md,u,o?u:d)(t):t===91?e.attempt(Nd,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(Pd,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function Rd(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return lu(t)?ud(e,a)(t):a(t)}function a(t){return t===41?u(t):sd(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return lu(t)?ud(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?ld(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return lu(t)?ud(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function zd(e,t,n){let r=this;return i;function i(t){return cd.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(eu(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function Bd(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var Vd={name:`labelStartImage`,resolveAll:jd.resolveAll,tokenize:Hd};function Hd(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var Ud={name:`labelStartLink`,resolveAll:jd.resolveAll,tokenize:Wd};function Wd(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var Gd={name:`lineEnding`,tokenize:Kd};function Kd(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),hu(e,t,`linePrefix`)}}var qd={name:`thematicBreak`,tokenize:Jd};function Jd(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||cu(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),uu(t)?hu(e,s,`whitespace`)(t):s(t))}}var Yd={continuation:{tokenize:$d},exit:tf,name:`list`,tokenize:Qd},Xd={partial:!0,tokenize:nf},Zd={partial:!0,tokenize:ef};function Qd(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:au(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(qd,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return au(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(Au,r.interrupt?n:u,e.attempt(Xd,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return uu(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function $d(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(Au,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,hu(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!uu(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Zd,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,hu(e,e.attempt(Yd,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function ef(e,t,n){let r=this;return hu(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function tf(e){e.exit(this.containerState.type)}function nf(e,t,n){let r=this;return hu(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!uu(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var rf={name:`setextUnderline`,resolveTo:af,tokenize:of};function af(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function of(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),uu(t)?hu(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||cu(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var sf={tokenize:cf};function cf(e){let t=this,n=e.attempt(Au,r,e.attempt(this.parser.constructs.flowInitial,i,hu(e,e.attempt(this.parser.constructs.flow,i,e.attempt(nd,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var lf={resolveAll:pf()},uf=ff(`string`),df=ff(`text`);function ff(e){return{resolveAll:pf(e===`text`?mf:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function pf(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function mf(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var hf=t({attentionMarkers:()=>Cf,contentInitial:()=>_f,disable:()=>wf,document:()=>gf,flow:()=>yf,flowInitial:()=>vf,insideSpan:()=>Sf,string:()=>bf,text:()=>xf}),gf={42:Yd,43:Yd,45:Yd,48:Yd,49:Yd,50:Yd,51:Yd,52:Yd,53:Yd,54:Yd,55:Yd,56:Yd,57:Yd,62:Mu},_f={91:dd},vf={[-2]:Wu,[-1]:Wu,32:Wu},yf={35:_d,42:qd,45:[rf,qd],60:Sd,61:rf,95:qd,96:Vu,126:Vu},bf={38:Ru,92:Iu},xf={[-5]:Gd,[-4]:Gd,[-3]:Gd,33:Vd,38:Ru,42:wu,60:[Ou,kd],91:Ud,92:[hd,Iu],93:jd,95:wu,96:Ju},Sf={null:[wu,lf]},Cf={null:[42,95]},wf={null:[]};function Tf(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=Jl(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=Cu(a,l.events,l),l.events):[]}function f(e,t){return Df(p(e),t)}function p(e){return Ef(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){cu(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&ql(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Ef(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function Df(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
|
|
21
|
+
`;break;case-3:o=`\r
|
|
22
|
+
`;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function Of(e){let t={constructs:Xl([hf,...(e||{}).extensions||[]]),content:n(gu),defined:[],document:n(vu),flow:n(sf),lazy:{},string:n(uf),text:n(df)};return t;function n(e){return n;function n(n){return Tf(t,e,n)}}}function kf(e){for(;!ed(e););return e}var Af=/[\0\t\n\r]/g;function jf(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){let s=[],c,l,u,d,f;for(i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t=``,n&&=(i.charCodeAt(0)===65279&&u++,void 0);u<i.length;){if(Af.lastIndex=u,c=Af.exec(i),d=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(d),!c){t=i.slice(u);break}if(f===10&&u===d&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),u<d&&(s.push(i.slice(u,d)),e+=d-u),f){case 0:s.push(65533),e++;break;case 9:for(l=Math.ceil(e/4)*4,s.push(-2);e++<l;)s.push(-1);break;case 10:s.push(-4),e=1;break;default:r=!0,e=1}u=d+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var Mf=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Nf(e){return e.replace(Mf,Pf)}function Pf(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return $l(n.slice(t?2:1),t?16:10)}return Fn(n)||e}var Ff={}.hasOwnProperty;function If(e,t,n){return typeof t!=`string`&&(n=t,t=void 0),Lf(n)(kf(Of(n).document().write(jf()(e,t,!0))))}function Lf(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(ve),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(me),blockQuote:a(le),characterEscape:T,characterReference:T,codeFenced:a(ue),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(ue,o),codeText:a(de,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(fe),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(pe),hardBreakEscape:a(he),hardBreakTrailing:a(he),htmlFlow:a(ge,o),htmlFlowData:T,htmlText:a(ge,o),htmlTextData:T,image:a(_e),label:o,link:a(ve),listItem:a(be),listItemValue:f,listOrdered:a(ye,d),listUnordered:a(ye),paragraph:a(xe),reference:ie,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(me),strong:a(Se),thematicBreak:a(we)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:ce,autolinkProtocol:se,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:F,characterReferenceMarkerNumeric:F,characterReferenceValue:I,characterReference:oe,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(j),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(O),hardBreakTrailing:c(O),htmlFlow:c(k),htmlFlowData:E,htmlText:c(A),htmlTextData:E,image:c(N),label:ee,labelText:P,lineEnding:D,link:c(M),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:ae,resourceDestinationString:te,resourceTitleString:ne,resource:re,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};zf(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[]},a={stack:[r],tokenStack:[],config:t,enter:s,exit:l,buffer:o,resume:u,data:n},c=[],d=-1;for(;++d<e.length;)(e[d][1].type===`listOrdered`||e[d][1].type===`listUnordered`)&&(e[d][0]===`enter`?c.push(d):d=i(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];Ff.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||Vf).call(a,void 0,e[0])}for(r.position={start:Rf(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:Rf(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(!(t[1].type===`linePrefix`||t[1].type===`blockQuotePrefix`||t[1].type===`blockQuotePrefixWhitespace`||t[1].type===`blockQuoteMarker`||t[1].type===`listItemIndent`))break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:`fragment`,children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:Rf(t.start),end:void 0}}function c(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||Vf).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+cl({start:e.start,end:e.end})+`): it’s not open`);n.position.end=Rf(e.end)}function u(){return Ul(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=eu(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function x(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function T(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=Ce(),n.position={start:Rf(e.start),end:void 0},t.push(n)),this.stack.push(n)}function E(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=Rf(e.end)}function D(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=Rf(e.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(T.call(this,e),E.call(this,e))}function O(){this.data.atHardBreak=!0}function k(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function A(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function j(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function M(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function N(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function P(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=Nf(t),n.identifier=eu(t).toLowerCase()}function ee(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function te(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function ne(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function re(){this.data.inReference=void 0}function ie(){this.data.referenceType=`collapsed`}function ae(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=eu(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function F(e){this.data.characterReferenceType=e.type}function I(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=$l(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=Fn(t);let i=this.stack[this.stack.length-1];i.value+=r}function oe(e){let t=this.stack.pop();t.position.end=Rf(e.end)}function se(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function ce(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function le(){return{type:`blockquote`,children:[]}}function ue(){return{type:`code`,lang:null,meta:null,value:``}}function de(){return{type:`inlineCode`,value:``}}function fe(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function pe(){return{type:`emphasis`,children:[]}}function me(){return{type:`heading`,depth:0,children:[]}}function he(){return{type:`break`}}function ge(){return{type:`html`,value:``}}function _e(){return{type:`image`,title:null,url:``,alt:null}}function ve(){return{type:`link`,title:null,url:``,children:[]}}function ye(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function be(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function xe(){return{type:`paragraph`,children:[]}}function Se(){return{type:`strong`,children:[]}}function Ce(){return{type:`text`,value:``}}function we(){return{type:`thematicBreak`}}}function Rf(e){return{line:e.line,column:e.column,offset:e.offset}}function zf(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?zf(e,r):Bf(e,r)}}function Bf(e,t){let n;for(n in t)if(Ff.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function Vf(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+cl({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+cl({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+cl({start:t.start,end:t.end})+`) is still open`)}function Hf(e){let t=this;t.parser=n;function n(n){return If(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function Uf(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function Wf(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
|
|
23
|
+
`}]}function Gf(e,t){let n=t.value?t.value+`
|
|
24
|
+
`:``,r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function Kf(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function qf(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Jf(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=mu(r.toLowerCase()),a=e.footnoteOrder.indexOf(r),o,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(r,s);let c={type:`element`,tagName:`a`,properties:{href:`#`+n+`fn-`+i,id:n+`fnref-`+i+(s>1?`-`+s:``),dataFootnoteRef:!0,ariaDescribedBy:[`footnote-label`]},children:[{type:`text`,value:String(o)}]};e.patch(t,c);let l={type:`element`,tagName:`sup`,properties:{},children:[c]};return e.patch(t,l),e.applyData(t,l)}function Yf(e,t){let n={type:`element`,tagName:`h`+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Xf(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Zf(e,t){let n=t.referenceType,r=`]`;if(n===`collapsed`?r+=`[]`:n===`full`&&(r+=`[`+(t.label||t.identifier)+`]`),t.type===`imageReference`)return[{type:`text`,value:`![`+t.alt+r}];let i=e.all(t),a=i[0];a&&a.type===`text`?a.value=`[`+a.value:i.unshift({type:`text`,value:`[`});let o=i[i.length-1];return o&&o.type===`text`?o.value+=r:i.push({type:`text`,value:r}),i}function Qf(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Zf(e,t);let i={src:mu(r.url||``),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`img`,properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function $f(e,t){let n={src:mu(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`img`,properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function ep(e,t){let n={type:`text`,value:t.value.replace(/\r?\n|\r/g,` `)};e.patch(t,n);let r={type:`element`,tagName:`code`,properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function tp(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Zf(e,t);let i={href:mu(r.url||``)};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`a`,properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function np(e,t){let n={href:mu(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`a`,properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function rp(e,t,n){let r=e.all(t),i=n?ip(n):ap(t),a={},o=[];if(typeof t.checked==`boolean`){let e=r[0],n;e&&e.type===`element`&&e.tagName===`p`?n=e:(n={type:`element`,tagName:`p`,properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:`text`,value:` `}),n.children.unshift({type:`element`,tagName:`input`,properties:{type:`checkbox`,checked:t.checked,disabled:!0},children:[]}),a.className=[`task-list-item`]}let s=-1;for(;++s<r.length;){let e=r[s];(i||s!==0||e.type!==`element`||e.tagName!==`p`)&&o.push({type:`text`,value:`
|
|
25
|
+
`}),e.type===`element`&&e.tagName===`p`&&!i?o.push(...e.children):o.push(e)}let c=r[r.length-1];c&&(i||c.type!==`element`||c.tagName!==`p`)&&o.push({type:`text`,value:`
|
|
26
|
+
`});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function ip(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=ap(n[r])}return t}function ap(e){return e.spread??e.children.length>1}function op(e,t){let n={},r=e.all(t),i=-1;for(typeof t.start==`number`&&t.start!==1&&(n.start=t.start);++i<r.length;){let e=r[i];if(e.type===`element`&&e.tagName===`li`&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes(`task-list-item`)){n.className=[`contains-task-list`];break}}let a={type:`element`,tagName:t.ordered?`ol`:`ul`,properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)}function sp(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function cp(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function lp(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function up(e,t){let n=e.all(t),r=n.shift(),i=[];if(r){let n={type:`element`,tagName:`thead`,properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){let r={type:`element`,tagName:`tbody`,properties:{},children:e.wrap(n,!0)},a=al(t.children[1]),o=il(t.children[t.children.length-1]);a&&o&&(r.position={start:a,end:o}),i.push(r)}let a={type:`element`,tagName:`table`,properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function dp(e,t,n){let r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?`th`:`td`,a=n&&n.type===`table`?n.align:void 0,o=a?a.length:t.children.length,s=-1,c=[];for(;++s<o;){let n=t.children[s],r={},o=a?a[s]:void 0;o&&(r.align=o);let l={type:`element`,tagName:i,properties:r,children:[]};n&&(l.children=e.all(n),e.patch(n,l),l=e.applyData(n,l)),c.push(l)}let l={type:`element`,tagName:`tr`,properties:{},children:e.wrap(c,!0)};return e.patch(t,l),e.applyData(t,l)}function fp(e,t){let n={type:`element`,tagName:`td`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}var pp=9,mp=32;function hp(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(gp(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(gp(t.slice(i),i>0,!1)),a.join(``)}function gp(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===pp||t===mp;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===pp||t===mp;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function _p(e,t){let n={type:`text`,value:hp(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function vp(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var yp={blockquote:Uf,break:Wf,code:Gf,delete:Kf,emphasis:qf,footnoteReference:Jf,heading:Yf,html:Xf,imageReference:Qf,image:$f,inlineCode:ep,linkReference:tp,link:np,listItem:rp,list:op,paragraph:sp,root:cp,strong:lp,table:up,tableCell:fp,tableRow:dp,text:_p,thematicBreak:vp,toml:bp,yaml:bp,definition:bp,footnoteDefinition:bp};function bp(){}var xp=typeof self==`object`?self:globalThis,Sp=(e,t)=>{let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o)e[r(t)]=r(n);return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(new xp[e](t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}}return n(new xp[a](o),i)};return r},Cp=e=>Sp(new Map,e)(0),wp=``,{toString:Tp}={},{keys:Ep}=Object,Dp=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=Tp.call(e).slice(8,-1);switch(n){case`Array`:return[1,wp];case`Object`:return[2,wp];case`Date`:return[3,wp];case`RegExp`:return[4,wp];case`Map`:return[5,wp];case`Set`:return[6,wp];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:n.includes(`Error`)?[7,n]:[2,n]},Op=([e,t])=>e===0&&(t===`function`||t===`symbol`),kp=(e,t,n,r)=>{let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=r=>{if(n.has(r))return n.get(r);let[o,s]=Dp(r);switch(o){case 0:{let t=r;switch(s){case`bigint`:o=8,t=r.toString();break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize `+s);t=null;break;case`undefined`:return i([-1],r)}return i([o,t],r)}case 1:{if(s){let e=r;return s===`DataView`?e=new Uint8Array(r.buffer):s===`ArrayBuffer`&&(e=new Uint8Array(r)),i([s,[...e]],r)}let e=[],t=i([o,e],r);for(let t of r)e.push(a(t));return t}case 2:{if(s)switch(s){case`BigInt`:return i([s,r.toString()],r);case`Boolean`:case`Number`:case`String`:return i([s,r.valueOf()],r)}if(t&&`toJSON`in r)return a(r.toJSON());let n=[],c=i([o,n],r);for(let t of Ep(r))(e||!Op(Dp(r[t])))&&n.push([a(t),a(r[t])]);return c}case 3:return i([o,r.toISOString()],r);case 4:{let{source:e,flags:t}=r;return i([o,{source:e,flags:t}],r)}case 5:{let t=[],n=i([o,t],r);for(let[n,i]of r)(e||!(Op(Dp(n))||Op(Dp(i))))&&t.push([a(n),a(i)]);return n}case 6:{let t=[],n=i([o,t],r);for(let n of r)(e||!Op(Dp(n)))&&t.push(a(n));return n}}let{message:c}=r;return i([o,{name:s,message:c}],r)};return a},Ap=(e,{json:t,lossy:n}={})=>{let r=[];return kp(!(t||n),!!t,new Map,r)(e),r},jp=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?Cp(Ap(e,t)):structuredClone(e):(e,t)=>Cp(Ap(e,t));function Mp(e,t){let n=[{type:`text`,value:`↩`}];return t>1&&n.push({type:`element`,tagName:`sup`,properties:{},children:[{type:`text`,value:String(t)}]}),n}function Np(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function Pp(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||Mp,r=e.options.footnoteBackLabel||Np,i=e.options.footnoteLabel||`Footnotes`,a=e.options.footnoteLabelTagName||`h2`,o=e.options.footnoteLabelProperties||{className:[`sr-only`]},s=[],c=-1;for(;++c<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[c]);if(!i)continue;let a=e.all(i),o=String(i.identifier).toUpperCase(),l=mu(o.toLowerCase()),u=0,d=[],f=e.footnoteCounts.get(o);for(;f!==void 0&&++u<=f;){d.length>0&&d.push({type:`text`,value:` `});let e=typeof n==`string`?n:n(c,u);typeof e==`string`&&(e={type:`text`,value:e}),d.push({type:`element`,tagName:`a`,properties:{href:`#`+t+`fnref-`+l+(u>1?`-`+u:``),dataFootnoteBackref:``,ariaLabel:typeof r==`string`?r:r(c,u),className:[`data-footnote-backref`]},children:Array.isArray(e)?e:[e]})}let p=a[a.length-1];if(p&&p.type===`element`&&p.tagName===`p`){let e=p.children[p.children.length-1];e&&e.type===`text`?e.value+=` `:p.children.push({type:`text`,value:` `}),p.children.push(...d)}else a.push(...d);let m={type:`element`,tagName:`li`,properties:{id:t+`fn-`+l},children:e.wrap(a,!0)};e.patch(i,m),s.push(m)}if(s.length!==0)return{type:`element`,tagName:`section`,properties:{dataFootnotes:!0,className:[`footnotes`]},children:[{type:`element`,tagName:a,properties:{...jp(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:`
|
|
27
|
+
`},{type:`element`,tagName:`ol`,properties:{},children:e.wrap(s,!0)},{type:`text`,value:`
|
|
28
|
+
`}]}}var Fp=(function(e){if(e==null)return Bp;if(typeof e==`function`)return zp(e);if(typeof e==`object`)return Array.isArray(e)?Ip(e):Lp(e);if(typeof e==`string`)return Rp(e);throw Error(`Expected function, string, or object as test`)});function Ip(e){let t=[],n=-1;for(;++n<e.length;)t[n]=Fp(e[n]);return zp(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function Lp(e){let t=e;return zp(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function Rp(e){return zp(t);function t(t){return t&&t.type===e}}function zp(e){return t;function t(t,n,r){return!!(Vp(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function Bp(){return!0}function Vp(e){return typeof e==`object`&&!!e&&`type`in e}function Hp(e){return e}var Up=[],Wp=`skip`;function Gp(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=Fp(i),o=r?-1:1;s(e,void 0,[])();function s(e,i,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,"name",{value:`node (`+Hp(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=Up,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=Kp(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=s(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+o}}return l}}}function Kp(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?Up:[e]}function qp(e,t,n,r){let i,a,o;typeof t==`function`&&typeof n!=`function`?(a=void 0,o=t,i=n):(a=t,o=n,i=r),Gp(e,a,s,i);function s(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)}}var Jp={}.hasOwnProperty,Yp={};function Xp(e,t){let n=t||Yp,r=new Map,i=new Map,a={all:s,applyData:Qp,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...yp,...n.handlers},one:o,options:n,patch:Zp,wrap:em};return qp(e,function(e){if(e.type===`definition`||e.type===`footnoteDefinition`){let t=e.type===`definition`?r:i,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),a;function o(e,t){let n=e.type,r=a.handlers[n];if(Jp.call(a.handlers,n)&&r)return r(a,e,t);if(a.options.passThrough&&a.options.passThrough.includes(n)){if(`children`in e){let{children:t,...n}=e,r=jp(n);return r.children=a.all(e),r}return jp(e)}return(a.options.unknownHandler||$p)(a,e,t)}function s(e){let t=[];if(`children`in e){let n=e.children,r=-1;for(;++r<n.length;){let i=a.one(n[r],e);if(i){if(r&&n[r-1].type===`break`&&(!Array.isArray(i)&&i.type===`text`&&(i.value=tm(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=tm(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function Zp(e,t){e.position&&(t.position=sl(e))}function Qp(e,t){let n=t;if(e&&e.data){let t=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;typeof t==`string`&&(n.type===`element`?n.tagName=t:n={type:`element`,tagName:t,properties:{},children:`children`in n?n.children:[n]}),n.type===`element`&&i&&Object.assign(n.properties,jp(i)),`children`in n&&n.children&&r!=null&&(n.children=r)}return n}function $p(e,t){let n=t.data||{},r=`value`in t&&!(Jp.call(n,`hProperties`)||Jp.call(n,`hChildren`))?{type:`text`,value:t.value}:{type:`element`,tagName:`div`,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function em(e,t){let n=[],r=-1;for(t&&n.push({type:`text`,value:`
|
|
29
|
+
`});++r<e.length;)r&&n.push({type:`text`,value:`
|
|
30
|
+
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:`text`,value:`
|
|
31
|
+
`}),n}function tm(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function nm(e,t){let n=Xp(e,t),r=n.one(e,void 0),i=Pp(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:`
|
|
32
|
+
`},i)),a}function rm(e,t){return e&&`run`in e?async function(n,r){let i=nm(n,{file:r,...t});await e.run(i,r)}:function(n,r){return nm(n,{file:r,...e||t})}}function im(e){if(e)throw e}var am=n(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});f<p;++f)if(t=arguments[f],t!=null)for(n in t)r=l(d,n),i=l(t,n),d!==i&&(m&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},c(d,{name:n,newValue:e(m,u,i)})):i!==void 0&&c(d,{name:n,newValue:i}));return d}}));function om(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function sm(){let e=[],t={run:n,use:r};return t;function n(...t){let n=-1,r=t.pop();if(typeof r!=`function`)throw TypeError(`Expected function as last argument, not `+r);i(null,...t);function i(a,...o){let s=e[++n],c=-1;if(a){r(a);return}for(;++c<t.length;)(o[c]===null||o[c]===void 0)&&(o[c]=t[c]);t=o,s?cm(s,i)(...o):r(null,...o)}}function r(n){if(typeof n!=`function`)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}}function cm(e,t){let n;return r;function r(...t){let r=e.length>t.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var lm={basename:um,dirname:dm,extname:fm,join:pm,sep:`/`};function um(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);gm(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function dm(e){if(gm(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function fm(e){gm(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function pm(...e){let t=-1,n;for(;++t<e.length;)gm(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:mm(n)}function mm(e){gm(e);let t=e.codePointAt(0)===47,n=hm(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function hm(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else if(s===47)break;else s=47;if(s===47){if(!(i===o-1||a===1))if(i!==o-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function gm(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var _m={cwd:vm};function vm(){return`/`}function ym(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function bm(e){if(typeof e==`string`)e=new URL(e);else if(!ym(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return xm(e)}function xm(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let e=t.codePointAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}var Sm=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],Cm=class{constructor(e){let t;t=e?ym(e)?{path:e}:typeof e==`string`||Dm(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:_m.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<Sm.length;){let e=Sm[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)Sm.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?lm.basename(this.path):void 0}set basename(e){Tm(e,`basename`),wm(e,`basename`),this.path=lm.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?lm.dirname(this.path):void 0}set dirname(e){Em(this.basename,`dirname`),this.path=lm.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?lm.extname(this.path):void 0}set extname(e){if(wm(e,`extname`),Em(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=lm.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){ym(e)&&(e=bm(e)),Tm(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?lm.basename(this.path,this.extname):void 0}set stem(e){Tm(e,`stem`),wm(e,`stem`),this.path=lm.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new fl(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function wm(e,t){if(e&&e.includes(lm.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+lm.sep+"`")}function Tm(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function Em(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function Dm(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var Om=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),km=e(am(),1),Am={}.hasOwnProperty,jm=new class e extends Om{constructor(){super(`copy`),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=sm()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,km.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(Pm(`data`,this.frozen),this.namespace[e]=t,this):Am.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Pm(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=Lm(e),n=this.parser||this.Parser;return Mm(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),Mm(`process`,this.parser||this.Parser),Nm(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=Lm(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);zm(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),Mm(`processSync`,this.parser||this.Parser),Nm(`processSync`,this.compiler||this.Compiler),this.process(e,r),Im(`processSync`,`process`,t),n;function r(e,r){t=!0,im(e),n=r}}run(e,t,n){Fm(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=Lm(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,r;return this.run(e,t,i),Im(`runSync`,`run`,n),r;function i(e,t){im(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=Lm(t),r=this.compiler||this.Compiler;return Nm(`stringify`,r),Fm(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(Pm(`use`,this.frozen),e!=null)if(typeof e==`function`)s(e,t);else if(typeof e==`object`)Array.isArray(e)?o(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`");return this;function i(e){if(typeof e==`function`)s(e,[]);else if(typeof e==`object`)if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else a(e);else throw TypeError("Expected usable value, not `"+e+"`")}function a(e){if(!(`plugins`in e)&&!(`settings`in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(e.plugins),e.settings&&(r.settings=(0,km.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(e!=null)if(Array.isArray(e))for(;++t<e.length;){let n=e[t];i(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(i===-1)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];om(o)&&om(r)&&(r=(0,km.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function Mm(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function Nm(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function Pm(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Fm(e){if(!om(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function Im(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function Lm(e){return Rm(e)?e:new Cm(e)}function Rm(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function zm(e){return typeof e==`string`||Bm(e)}function Bm(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var Vm=[],Hm={allowDangerousHtml:!0},Um=/^(https?|ircs?|mailto|xmpp)$/i,Wm=[{from:`astPlugins`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowDangerousHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowNode`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowElement`},{from:`allowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowedElements`},{from:`className`,id:`remove-classname`},{from:`disallowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`disallowedElements`},{from:`escapeHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`includeElementIndex`,id:`#remove-includeelementindex`},{from:`includeNodeIndex`,id:`change-includenodeindex-to-includeelementindex`},{from:`linkTarget`,id:`remove-linktarget`},{from:`plugins`,id:`change-plugins-to-remarkplugins`,to:`remarkPlugins`},{from:`rawSourcePos`,id:`#remove-rawsourcepos`},{from:`renderers`,id:`change-renderers-to-components`,to:`components`},{from:`source`,id:`change-source-to-children`,to:`children`},{from:`sourcePos`,id:`#remove-sourcepos`},{from:`transformImageUri`,id:`#add-urltransform`,to:`urlTransform`},{from:`transformLinkUri`,id:`#add-urltransform`,to:`urlTransform`}];function Gm(e){let t=Km(e),n=qm(e);return Jm(t.runSync(t.parse(n),n),e)}function Km(e){let t=e.rehypePlugins||Vm,n=e.remarkPlugins||Vm,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Hm}:Hm;return jm().use(Hf).use(n).use(rm,r).use(t)}function qm(e){let t=e.children||``,n=new Cm;return typeof t==`string`?n.value=t:``+t,n}function Jm(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||Ym;for(let e of Wm)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return qp(e,l),yl(e,{Fragment:W.Fragment,components:i,ignoreInvalidStyle:!0,jsx:W.jsx,jsxs:W.jsxs,passKeys:!0,passNode:!0});function l(e,t,i){if(e.type===`raw`&&i&&typeof t==`number`)return o?i.children.splice(t,1):i.children[t]={type:`text`,value:e.value},t;if(e.type===`element`){let t;for(t in Vl)if(Object.hasOwn(Vl,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=Vl[t];(r===null||r.includes(e.tagName))&&(e.properties[t]=c(String(n||``),t,e))}}if(e.type===`element`){let o=n?!n.includes(e.tagName):a?a.includes(e.tagName):!1;if(!o&&r&&typeof t==`number`&&(o=!r(e,t,i)),o&&i&&typeof t==`number`)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}function Ym(e){let t=e.indexOf(`:`),n=e.indexOf(`?`),r=e.indexOf(`#`),i=e.indexOf(`/`);return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||Um.test(e.slice(0,t))?e:``}function Xm({defaultOrigin:e=``,allowedLinkPrefixes:t=[],allowedImagePrefixes:n=[],allowDataImages:r=!1,blockedImageClass:i=`inline-block bg-gray-200 dark:bg-gray-700 text-gray-600 dark:text-gray-400 px-3 py-1 rounded text-sm`,blockedLinkClass:a=`text-gray-500`}){let o=t.length&&!t.every(e=>e===`*`),s=n.length&&!n.every(e=>e===`*`);if(!e&&(o||s))throw Error(`defaultOrigin is required when allowedLinkPrefixes or allowedImagePrefixes are provided`);return o=>{qp(o,nh(e,t,n,r,i,a))}}function Zm(e,t){if(typeof e!=`string`)return null;try{return new URL(e)}catch{if(t)try{return new URL(e,t)}catch{return null}return null}}function Qm(e){return typeof e==`string`?e.startsWith(`/`):!1}var $m=new Set([`https:`,`http:`,`irc:`,`ircs:`,`mailto:`,`xmpp:`]);function eh(e,t,n,r=!1,i=!1){if(!e)return null;if(typeof e==`string`&&e.startsWith(`#`)&&!i)try{if(new URL(e,`http://example.com`).hash===e)return e}catch{}if(typeof e==`string`&&e.startsWith(`data:`))return i&&r&&e.startsWith(`data:image/`)?e:null;let a=Zm(e,n);if(!a||!$m.has(a.protocol))return null;if(a.protocol===`mailto:`)return a.href;let o=Qm(e);return a&&t.some(e=>{let t=Zm(e,n);return!t||t.origin!==a.origin?!1:a.href.startsWith(t.href)})?o?a.pathname+a.search+a.hash:a.href:t.includes(`*`)?a.protocol!==`https:`&&a.protocol!==`http:`?null:o?a.pathname+a.search+a.hash:a.href:null}var th=Symbol(`node-seen`),nh=(e,t,n,r,i,a)=>{let o=(s,c,l)=>{if(s.type!==`element`||s[th])return!0;if(s.tagName===`a`){let n=eh(s.properties.href,t,e,!1,!1);return n===null?(s[th]=!0,qp(s,o),l&&typeof c==`number`&&(l.children[c]={type:`element`,tagName:`span`,properties:{title:`Blocked URL: `+String(s.properties.href),class:a},children:[...s.children,{type:`text`,value:` [blocked]`}]}),Wp):(s.properties.href=n,s.properties.target=`_blank`,s.properties.rel=`noopener noreferrer`,!0)}if(s.tagName===`img`){let t=eh(s.properties.src,n,e,r,!0);return t===null?(s[th]=!0,qp(s,o),l&&typeof c==`number`&&(l.children[c]={type:`element`,tagName:`span`,properties:{class:i},children:[{type:`text`,value:`[Image blocked: `+String(s.properties.alt||`No description`)+`]`}]}),Wp):(s.properties.src=t,!0)}return!0};return o};function rh(e){let t=String(e),n=[];return{toOffset:i,toPoint:r};function r(e){if(typeof e==`number`&&e>-1&&e<=t.length){let r=0;for(;;){let i=n[r];if(i===void 0){let e=ih(t,n[r-1]);i=e===-1?t.length+1:e+1,n[r]=i}if(i>e)return{line:r+1,column:e-(r>0?n[r-1]:0)+1,offset:e};r++}}}function i(e){if(e&&typeof e.line==`number`&&typeof e.column==`number`&&!Number.isNaN(e.line)&&!Number.isNaN(e.column)){for(;n.length<e.line;){let e=n[n.length-1],r=ih(t,e),i=r===-1?t.length+1:r+1;if(e===i)break;n.push(i)}let r=(e.line>1?n[e.line-2]:0)+e.column-1;if(r<n[e.line-1])return r}}}function ih(e,t){let n=e.indexOf(`\r`,t),r=e.indexOf(`
|
|
33
|
+
`,t);return r===-1?n:n===-1||n+1===r?r:n<r?n:r}var ah={html:`http://www.w3.org/1999/xhtml`,mathml:`http://www.w3.org/1998/Math/MathML`,svg:`http://www.w3.org/2000/svg`,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`},oh={}.hasOwnProperty,sh=Object.prototype;function ch(e,t){let n=t||{};return lh({file:n.file||void 0,location:!1,schema:n.space===`svg`?Nn:Un,verbose:n.verbose||!1},e)}function lh(e,t){let n;switch(t.nodeName){case`#comment`:{let r=t;return n={type:`comment`,value:r.data},fh(e,r,n),n}case`#document`:case`#document-fragment`:{let r=t,i=`mode`in r?r.mode===`quirks`||r.mode===`limited-quirks`:!1;if(n={type:`root`,children:uh(e,t.childNodes),data:{quirksMode:i}},e.file&&e.location){let t=String(e.file),r=rh(t),i=r.toPoint(0),a=r.toPoint(t.length);n.position={start:i,end:a}}return n}case`#documentType`:{let r=t;return n={type:`doctype`},fh(e,r,n),n}case`#text`:{let r=t;return n={type:`text`,value:r.value},fh(e,r,n),n}default:return n=dh(e,t),n}}function uh(e,t){let n=-1,r=[];for(;++n<t.length;){let i=lh(e,t[n]);r.push(i)}return r}function dh(e,t){let n=e.schema;e.schema=t.namespaceURI===ah.svg?Nn:Un;let r=-1,i={};for(;++r<t.attrs.length;){let e=t.attrs[r],n=(e.prefix?e.prefix+`:`:``)+e.name;oh.call(sh,n)||(i[n]=e.value)}let a=(e.schema.space===`svg`?Vn:Rn)(t.tagName,i,uh(e,t.childNodes));if(fh(e,t,a),a.tagName===`template`){let n=t,r=n.sourceCodeLocation,i=r&&r.startTag&&mh(r.startTag),o=r&&r.endTag&&mh(r.endTag),s=lh(e,n.content);i&&o&&e.file&&(s.position={start:i.end,end:o.start}),a.content=s}return e.schema=n,a}function fh(e,t,n){if(`sourceCodeLocation`in t&&t.sourceCodeLocation&&e.file){let r=ph(e,n,t.sourceCodeLocation);r&&(e.location=!0,n.position=r)}}function ph(e,t,n){let r=mh(n);if(t.type===`element`){let i=t.children[t.children.length-1];if(r&&!n.endTag&&i&&i.position&&i.position.end&&(r.end=Object.assign({},i.position.end)),e.verbose){let r={},i;if(n.attrs)for(i in n.attrs)oh.call(n.attrs,i)&&(r[Pn(e.schema,i).property]=mh(n.attrs[i]));n.startTag;let a=mh(n.startTag),o=n.endTag?mh(n.endTag):void 0,s={opening:a};o&&(s.closing=o),s.properties=r,t.data={position:s}}}return r}function mh(e){let t=hh({line:e.startLine,column:e.startCol,offset:e.startOffset}),n=hh({line:e.endLine,column:e.endCol,offset:e.endOffset});return t||n?{start:t,end:n}:void 0}function hh(e){return e.line&&e.column?e:void 0}var gh=new Set([65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111]),G;(function(e){e[e.EOF=-1]=`EOF`,e[e.NULL=0]=`NULL`,e[e.TABULATION=9]=`TABULATION`,e[e.CARRIAGE_RETURN=13]=`CARRIAGE_RETURN`,e[e.LINE_FEED=10]=`LINE_FEED`,e[e.FORM_FEED=12]=`FORM_FEED`,e[e.SPACE=32]=`SPACE`,e[e.EXCLAMATION_MARK=33]=`EXCLAMATION_MARK`,e[e.QUOTATION_MARK=34]=`QUOTATION_MARK`,e[e.AMPERSAND=38]=`AMPERSAND`,e[e.APOSTROPHE=39]=`APOSTROPHE`,e[e.HYPHEN_MINUS=45]=`HYPHEN_MINUS`,e[e.SOLIDUS=47]=`SOLIDUS`,e[e.DIGIT_0=48]=`DIGIT_0`,e[e.DIGIT_9=57]=`DIGIT_9`,e[e.SEMICOLON=59]=`SEMICOLON`,e[e.LESS_THAN_SIGN=60]=`LESS_THAN_SIGN`,e[e.EQUALS_SIGN=61]=`EQUALS_SIGN`,e[e.GREATER_THAN_SIGN=62]=`GREATER_THAN_SIGN`,e[e.QUESTION_MARK=63]=`QUESTION_MARK`,e[e.LATIN_CAPITAL_A=65]=`LATIN_CAPITAL_A`,e[e.LATIN_CAPITAL_Z=90]=`LATIN_CAPITAL_Z`,e[e.RIGHT_SQUARE_BRACKET=93]=`RIGHT_SQUARE_BRACKET`,e[e.GRAVE_ACCENT=96]=`GRAVE_ACCENT`,e[e.LATIN_SMALL_A=97]=`LATIN_SMALL_A`,e[e.LATIN_SMALL_Z=122]=`LATIN_SMALL_Z`})(G||={});var _h={DASH_DASH:`--`,CDATA_START:`[CDATA[`,DOCTYPE:`doctype`,SCRIPT:`script`,PUBLIC:`public`,SYSTEM:`system`};function vh(e){return e>=55296&&e<=57343}function yh(e){return e>=56320&&e<=57343}function bh(e,t){return(e-55296)*1024+9216+t}function xh(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function Sh(e){return e>=64976&&e<=65007||gh.has(e)}var K;(function(e){e.controlCharacterInInputStream=`control-character-in-input-stream`,e.noncharacterInInputStream=`noncharacter-in-input-stream`,e.surrogateInInputStream=`surrogate-in-input-stream`,e.nonVoidHtmlElementStartTagWithTrailingSolidus=`non-void-html-element-start-tag-with-trailing-solidus`,e.endTagWithAttributes=`end-tag-with-attributes`,e.endTagWithTrailingSolidus=`end-tag-with-trailing-solidus`,e.unexpectedSolidusInTag=`unexpected-solidus-in-tag`,e.unexpectedNullCharacter=`unexpected-null-character`,e.unexpectedQuestionMarkInsteadOfTagName=`unexpected-question-mark-instead-of-tag-name`,e.invalidFirstCharacterOfTagName=`invalid-first-character-of-tag-name`,e.unexpectedEqualsSignBeforeAttributeName=`unexpected-equals-sign-before-attribute-name`,e.missingEndTagName=`missing-end-tag-name`,e.unexpectedCharacterInAttributeName=`unexpected-character-in-attribute-name`,e.unknownNamedCharacterReference=`unknown-named-character-reference`,e.missingSemicolonAfterCharacterReference=`missing-semicolon-after-character-reference`,e.unexpectedCharacterAfterDoctypeSystemIdentifier=`unexpected-character-after-doctype-system-identifier`,e.unexpectedCharacterInUnquotedAttributeValue=`unexpected-character-in-unquoted-attribute-value`,e.eofBeforeTagName=`eof-before-tag-name`,e.eofInTag=`eof-in-tag`,e.missingAttributeValue=`missing-attribute-value`,e.missingWhitespaceBetweenAttributes=`missing-whitespace-between-attributes`,e.missingWhitespaceAfterDoctypePublicKeyword=`missing-whitespace-after-doctype-public-keyword`,e.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers=`missing-whitespace-between-doctype-public-and-system-identifiers`,e.missingWhitespaceAfterDoctypeSystemKeyword=`missing-whitespace-after-doctype-system-keyword`,e.missingQuoteBeforeDoctypePublicIdentifier=`missing-quote-before-doctype-public-identifier`,e.missingQuoteBeforeDoctypeSystemIdentifier=`missing-quote-before-doctype-system-identifier`,e.missingDoctypePublicIdentifier=`missing-doctype-public-identifier`,e.missingDoctypeSystemIdentifier=`missing-doctype-system-identifier`,e.abruptDoctypePublicIdentifier=`abrupt-doctype-public-identifier`,e.abruptDoctypeSystemIdentifier=`abrupt-doctype-system-identifier`,e.cdataInHtmlContent=`cdata-in-html-content`,e.incorrectlyOpenedComment=`incorrectly-opened-comment`,e.eofInScriptHtmlCommentLikeText=`eof-in-script-html-comment-like-text`,e.eofInDoctype=`eof-in-doctype`,e.nestedComment=`nested-comment`,e.abruptClosingOfEmptyComment=`abrupt-closing-of-empty-comment`,e.eofInComment=`eof-in-comment`,e.incorrectlyClosedComment=`incorrectly-closed-comment`,e.eofInCdata=`eof-in-cdata`,e.absenceOfDigitsInNumericCharacterReference=`absence-of-digits-in-numeric-character-reference`,e.nullCharacterReference=`null-character-reference`,e.surrogateCharacterReference=`surrogate-character-reference`,e.characterReferenceOutsideUnicodeRange=`character-reference-outside-unicode-range`,e.controlCharacterReference=`control-character-reference`,e.noncharacterCharacterReference=`noncharacter-character-reference`,e.missingWhitespaceBeforeDoctypeName=`missing-whitespace-before-doctype-name`,e.missingDoctypeName=`missing-doctype-name`,e.invalidCharacterSequenceAfterDoctypeName=`invalid-character-sequence-after-doctype-name`,e.duplicateAttribute=`duplicate-attribute`,e.nonConformingDoctype=`non-conforming-doctype`,e.missingDoctype=`missing-doctype`,e.misplacedDoctype=`misplaced-doctype`,e.endTagWithoutMatchingOpenElement=`end-tag-without-matching-open-element`,e.closingOfElementWithOpenChildElements=`closing-of-element-with-open-child-elements`,e.disallowedContentInNoscriptInHead=`disallowed-content-in-noscript-in-head`,e.openElementsLeftAfterEof=`open-elements-left-after-eof`,e.abandonedHeadElementChild=`abandoned-head-element-child`,e.misplacedStartTagForHeadElement=`misplaced-start-tag-for-head-element`,e.nestedNoscriptInHead=`nested-noscript-in-head`,e.eofInElementThatCanContainOnlyText=`eof-in-element-that-can-contain-only-text`})(K||={});var Ch=65536,wh=class{constructor(e){this.handler=e,this.html=``,this.pos=-1,this.lastGapPos=-2,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=Ch,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.line=1,this.lastErrOffset=-1}get col(){return this.pos-this.lineStartPos+Number(this.lastGapPos!==this.pos)}get offset(){return this.droppedBufferSize+this.pos}getError(e,t){let{line:n,col:r,offset:i}=this,a=r+t,o=i+t;return{code:e,startLine:n,endLine:n,startCol:a,endCol:a,startOffset:o,endOffset:o}}_err(e){this.handler.onParseError&&this.lastErrOffset!==this.offset&&(this.lastErrOffset=this.offset,this.handler.onParseError(this.getError(e,0)))}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(e){if(this.pos!==this.html.length-1){let t=this.html.charCodeAt(this.pos+1);if(yh(t))return this.pos++,this._addGap(),bh(e,t)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,G.EOF;return this._err(K.surrogateInInputStream),e}willDropParsedChunk(){return this.pos>this.bufferWaterline}dropParsedChunk(){this.willDropParsedChunk()&&(this.html=this.html.substring(this.pos),this.lineStartPos-=this.pos,this.droppedBufferSize+=this.pos,this.pos=0,this.lastGapPos=-2,this.gapStack.length=0)}write(e,t){this.html.length>0?this.html+=e:this.html=e,this.endOfChunkHit=!1,this.lastChunkWritten=t}insertHtmlAtCurrentPos(e){this.html=this.html.substring(0,this.pos+1)+e+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(e,t){if(this.pos+e.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(t)return this.html.startsWith(e,this.pos);for(let t=0;t<e.length;t++)if((this.html.charCodeAt(this.pos+t)|32)!==e.charCodeAt(t))return!1;return!0}peek(e){let t=this.pos+e;if(t>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,G.EOF;let n=this.html.charCodeAt(t);return n===G.CARRIAGE_RETURN?G.LINE_FEED:n}advance(){if(this.pos++,this.isEol&&(this.isEol=!1,this.line++,this.lineStartPos=this.pos),this.pos>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,G.EOF;let e=this.html.charCodeAt(this.pos);return e===G.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,G.LINE_FEED):e===G.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,vh(e)&&(e=this._processSurrogate(e)),this.handler.onParseError===null||e>31&&e<127||e===G.LINE_FEED||e===G.CARRIAGE_RETURN||e>159&&e<64976||this._checkForProblematicCharacters(e),e)}_checkForProblematicCharacters(e){xh(e)?this._err(K.controlCharacterInInputStream):Sh(e)&&this._err(K.noncharacterInInputStream)}retreat(e){for(this.pos-=e;this.pos<this.lastGapPos;)this.lastGapPos=this.gapStack.pop(),this.pos--;this.isEol=!1}},Th;(function(e){e[e.CHARACTER=0]=`CHARACTER`,e[e.NULL_CHARACTER=1]=`NULL_CHARACTER`,e[e.WHITESPACE_CHARACTER=2]=`WHITESPACE_CHARACTER`,e[e.START_TAG=3]=`START_TAG`,e[e.END_TAG=4]=`END_TAG`,e[e.COMMENT=5]=`COMMENT`,e[e.DOCTYPE=6]=`DOCTYPE`,e[e.EOF=7]=`EOF`,e[e.HIBERNATION=8]=`HIBERNATION`})(Th||={});function Eh(e,t){for(let n=e.attrs.length-1;n>=0;n--)if(e.attrs[n].name===t)return e.attrs[n].value;return null}var Dh=new Uint16Array(`ᵁ<Õıʊҝջאٵ۞ޢߖࠏઑඡ༉༦ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲϏϢϸontourIntegraìȹoɴ\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲy;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱còJTabcdfgorstרׯؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ߂ߐĀiyޱrc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣসে্ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४ĀnrࢃgleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpwਖਛgȀLRlr৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼અઋp;椅y;䐜Ādl੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑඞcy;䐊cute;䅃ƀaeyહાron;䅇dil;䅅;䐝ƀgswે૰ativeƀMTV૨ediumSpace;怋hiĀcn૦ëeryThiîtedĀGLଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷreak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪௫ఄ಄ದൡඅ櫬Āoungruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater;EFGLSTஶஷ扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨setĀ;Eೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂෛ෧ขภยา฿ไlig;䅒cute耻Ó䃓Āiyීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲcr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬืde耻Õ䃕es;樷ml耻Ö䃖erĀBP๋Āar๐๓r;怾acĀek๚;揞et;掴arenthesis;揜ҀacfhilorsງຊຏຒດຝະrtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ檻cedesȀ;EST່້扺qual;檯lantEqual;扼ilde;找me;怳Ādpuct;戏ortionĀ;aȥl;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL憒ar;懥eftArrow;懄eiling;按oǵ\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄቕቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHcቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗ĀeiቻDzኀ\0ኇefore;戴a;䎘ĀcnኘkSpace;쀀 Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtèa;䎖r;愨pf;愤cr;쀀𝒵ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒;Eaeiopᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;eᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;eᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰᝃᝈ០៦ᠹᡐᜍ᥈ᥰot;櫭ĀcrᛶkȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;tbrk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯᝳ;䎲;愶een;扬r;쀀𝔟gcostuvwឍឝឳេ៕៛ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀakoᠦᠵĀcn៲ᠣkƀlst֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ;敛;敘;攘;攔;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģbar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;elƀ;bhᥨᥩᥫ䁜;槅sub;柈ŬᥴlĀ;e怢t»pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭒\0᯽\0ᰌƀcprᦲute;䄇̀;abcdsᦿᧀᧄ᧕᧙戩nd;橄rcup;橉Āau᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r;Ecefms᩠ᩢᩫ᪤᪪旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ\0\0aĀ;t䀬;䁀ƀ;fl戁îᅠeĀmxent»eóɍǧ\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯delprvw᭠᭬᭷ᮂᮬᯔarrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;pᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰻᰿ᱝᱩᱵᲞᲬᲷᴍᵻᶑᶫᶻ᷆᷍ròar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂᳖᳜᳠mƀ;oș᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄĀDoḆᴴoôĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»ṺƀaeiἒἚls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧\0耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₥₰₴⃰℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽ƀ;qsؾٌlanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqrⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0proør;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼ròòΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonóquigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roøurĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻\xA0ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨íistĀ;sடr;쀀𝔫ȀEest⩦⩹⩼ƀ;qs⩭ƀ;qs⩴lanôií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast⭕⭚⭟lleìl;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖchimpqu⮽⯍⯙⬄⯤⯯Ȁ;cerല⯆ഷ⯉uå;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭ååഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñĀ;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;cⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācrir;榿;쀀𝔬ͯ\0\0\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕⶥⶨrò᪀Āirⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔǒr;榷rp;榹;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ\0\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ脀¶;l䂶leìЃɩ\0\0m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳ᤈ⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t⾴ïrel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⋢⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔ABHabcdefhilmnoprstuxけさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstwガクシスゼゾダッデナp;極Ā;fゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ìâヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘rrowĀ;tㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowóarpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓ròaòՑ;怏oustĀ;a㈞掱che»mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì耻䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;qኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫwar;椪lig耻ß䃟㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rëƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproøim»ኬsðኞĀas㚺㚮ðrn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈadempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xôheadĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roðtré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜtré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌`.split(``).map(e=>e.charCodeAt(0))),Oh=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);String.fromCodePoint;function kh(e){return e>=55296&&e<=57343||e>1114111?65533:Oh.get(e)??e}var Ah;(function(e){e[e.NUM=35]=`NUM`,e[e.SEMI=59]=`SEMI`,e[e.EQUALS=61]=`EQUALS`,e[e.ZERO=48]=`ZERO`,e[e.NINE=57]=`NINE`,e[e.LOWER_A=97]=`LOWER_A`,e[e.LOWER_F=102]=`LOWER_F`,e[e.LOWER_X=120]=`LOWER_X`,e[e.LOWER_Z=122]=`LOWER_Z`,e[e.UPPER_A=65]=`UPPER_A`,e[e.UPPER_F=70]=`UPPER_F`,e[e.UPPER_Z=90]=`UPPER_Z`})(Ah||={});var jh=32,Mh;(function(e){e[e.VALUE_LENGTH=49152]=`VALUE_LENGTH`,e[e.BRANCH_LENGTH=16256]=`BRANCH_LENGTH`,e[e.JUMP_TABLE=127]=`JUMP_TABLE`})(Mh||={});function Nh(e){return e>=Ah.ZERO&&e<=Ah.NINE}function Ph(e){return e>=Ah.UPPER_A&&e<=Ah.UPPER_F||e>=Ah.LOWER_A&&e<=Ah.LOWER_F}function Fh(e){return e>=Ah.UPPER_A&&e<=Ah.UPPER_Z||e>=Ah.LOWER_A&&e<=Ah.LOWER_Z||Nh(e)}function Ih(e){return e===Ah.EQUALS||Fh(e)}var Lh;(function(e){e[e.EntityStart=0]=`EntityStart`,e[e.NumericStart=1]=`NumericStart`,e[e.NumericDecimal=2]=`NumericDecimal`,e[e.NumericHex=3]=`NumericHex`,e[e.NamedEntity=4]=`NamedEntity`})(Lh||={});var Rh;(function(e){e[e.Legacy=0]=`Legacy`,e[e.Strict=1]=`Strict`,e[e.Attribute=2]=`Attribute`})(Rh||={});var zh=class{constructor(e,t,n){this.decodeTree=e,this.emitCodePoint=t,this.errors=n,this.state=Lh.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=Rh.Strict}startEntity(e){this.decodeMode=e,this.state=Lh.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(e,t){switch(this.state){case Lh.EntityStart:return e.charCodeAt(t)===Ah.NUM?(this.state=Lh.NumericStart,this.consumed+=1,this.stateNumericStart(e,t+1)):(this.state=Lh.NamedEntity,this.stateNamedEntity(e,t));case Lh.NumericStart:return this.stateNumericStart(e,t);case Lh.NumericDecimal:return this.stateNumericDecimal(e,t);case Lh.NumericHex:return this.stateNumericHex(e,t);case Lh.NamedEntity:return this.stateNamedEntity(e,t)}}stateNumericStart(e,t){return t>=e.length?-1:(e.charCodeAt(t)|jh)===Ah.LOWER_X?(this.state=Lh.NumericHex,this.consumed+=1,this.stateNumericHex(e,t+1)):(this.state=Lh.NumericDecimal,this.stateNumericDecimal(e,t))}addToNumericResult(e,t,n,r){if(t!==n){let i=n-t;this.result=this.result*r**+i+Number.parseInt(e.substr(t,i),r),this.consumed+=i}}stateNumericHex(e,t){let n=t;for(;t<e.length;){let r=e.charCodeAt(t);if(Nh(r)||Ph(r))t+=1;else return this.addToNumericResult(e,n,t,16),this.emitNumericEntity(r,3)}return this.addToNumericResult(e,n,t,16),-1}stateNumericDecimal(e,t){let n=t;for(;t<e.length;){let r=e.charCodeAt(t);if(Nh(r))t+=1;else return this.addToNumericResult(e,n,t,10),this.emitNumericEntity(r,2)}return this.addToNumericResult(e,n,t,10),-1}emitNumericEntity(e,t){var n;if(this.consumed<=t)return(n=this.errors)==null||n.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(e===Ah.SEMI)this.consumed+=1;else if(this.decodeMode===Rh.Strict)return 0;return this.emitCodePoint(kh(this.result),this.consumed),this.errors&&(e!==Ah.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(e,t){let{decodeTree:n}=this,r=n[this.treeIndex],i=(r&Mh.VALUE_LENGTH)>>14;for(;t<e.length;t++,this.excess++){let a=e.charCodeAt(t);if(this.treeIndex=Bh(n,r,this.treeIndex+Math.max(1,i),a),this.treeIndex<0)return this.result===0||this.decodeMode===Rh.Attribute&&(i===0||Ih(a))?0:this.emitNotTerminatedNamedEntity();if(r=n[this.treeIndex],i=(r&Mh.VALUE_LENGTH)>>14,i!==0){if(a===Ah.SEMI)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);this.decodeMode!==Rh.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var e;let{result:t,decodeTree:n}=this,r=(n[t]&Mh.VALUE_LENGTH)>>14;return this.emitNamedEntityData(t,r,this.consumed),(e=this.errors)==null||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,t,n){let{decodeTree:r}=this;return this.emitCodePoint(t===1?r[e]&~Mh.VALUE_LENGTH:r[e+1],n),t===3&&this.emitCodePoint(r[e+2],n),n}end(){var e;switch(this.state){case Lh.NamedEntity:return this.result!==0&&(this.decodeMode!==Rh.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case Lh.NumericDecimal:return this.emitNumericEntity(0,2);case Lh.NumericHex:return this.emitNumericEntity(0,3);case Lh.NumericStart:return(e=this.errors)==null||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case Lh.EntityStart:return 0}}};function Bh(e,t,n,r){let i=(t&Mh.BRANCH_LENGTH)>>7,a=t&Mh.JUMP_TABLE;if(i===0)return a!==0&&r===a?n:-1;if(a){let t=r-a;return t<0||t>=i?-1:e[n+t]-1}let o=n,s=o+i-1;for(;o<=s;){let t=o+s>>>1,n=e[t];if(n<r)o=t+1;else if(n>r)s=t-1;else return e[t+i]}return-1}var q;(function(e){e.HTML=`http://www.w3.org/1999/xhtml`,e.MATHML=`http://www.w3.org/1998/Math/MathML`,e.SVG=`http://www.w3.org/2000/svg`,e.XLINK=`http://www.w3.org/1999/xlink`,e.XML=`http://www.w3.org/XML/1998/namespace`,e.XMLNS=`http://www.w3.org/2000/xmlns/`})(q||={});var Vh;(function(e){e.TYPE=`type`,e.ACTION=`action`,e.ENCODING=`encoding`,e.PROMPT=`prompt`,e.NAME=`name`,e.COLOR=`color`,e.FACE=`face`,e.SIZE=`size`})(Vh||={});var Hh;(function(e){e.NO_QUIRKS=`no-quirks`,e.QUIRKS=`quirks`,e.LIMITED_QUIRKS=`limited-quirks`})(Hh||={});var J;(function(e){e.A=`a`,e.ADDRESS=`address`,e.ANNOTATION_XML=`annotation-xml`,e.APPLET=`applet`,e.AREA=`area`,e.ARTICLE=`article`,e.ASIDE=`aside`,e.B=`b`,e.BASE=`base`,e.BASEFONT=`basefont`,e.BGSOUND=`bgsound`,e.BIG=`big`,e.BLOCKQUOTE=`blockquote`,e.BODY=`body`,e.BR=`br`,e.BUTTON=`button`,e.CAPTION=`caption`,e.CENTER=`center`,e.CODE=`code`,e.COL=`col`,e.COLGROUP=`colgroup`,e.DD=`dd`,e.DESC=`desc`,e.DETAILS=`details`,e.DIALOG=`dialog`,e.DIR=`dir`,e.DIV=`div`,e.DL=`dl`,e.DT=`dt`,e.EM=`em`,e.EMBED=`embed`,e.FIELDSET=`fieldset`,e.FIGCAPTION=`figcaption`,e.FIGURE=`figure`,e.FONT=`font`,e.FOOTER=`footer`,e.FOREIGN_OBJECT=`foreignObject`,e.FORM=`form`,e.FRAME=`frame`,e.FRAMESET=`frameset`,e.H1=`h1`,e.H2=`h2`,e.H3=`h3`,e.H4=`h4`,e.H5=`h5`,e.H6=`h6`,e.HEAD=`head`,e.HEADER=`header`,e.HGROUP=`hgroup`,e.HR=`hr`,e.HTML=`html`,e.I=`i`,e.IMG=`img`,e.IMAGE=`image`,e.INPUT=`input`,e.IFRAME=`iframe`,e.KEYGEN=`keygen`,e.LABEL=`label`,e.LI=`li`,e.LINK=`link`,e.LISTING=`listing`,e.MAIN=`main`,e.MALIGNMARK=`malignmark`,e.MARQUEE=`marquee`,e.MATH=`math`,e.MENU=`menu`,e.META=`meta`,e.MGLYPH=`mglyph`,e.MI=`mi`,e.MO=`mo`,e.MN=`mn`,e.MS=`ms`,e.MTEXT=`mtext`,e.NAV=`nav`,e.NOBR=`nobr`,e.NOFRAMES=`noframes`,e.NOEMBED=`noembed`,e.NOSCRIPT=`noscript`,e.OBJECT=`object`,e.OL=`ol`,e.OPTGROUP=`optgroup`,e.OPTION=`option`,e.P=`p`,e.PARAM=`param`,e.PLAINTEXT=`plaintext`,e.PRE=`pre`,e.RB=`rb`,e.RP=`rp`,e.RT=`rt`,e.RTC=`rtc`,e.RUBY=`ruby`,e.S=`s`,e.SCRIPT=`script`,e.SEARCH=`search`,e.SECTION=`section`,e.SELECT=`select`,e.SOURCE=`source`,e.SMALL=`small`,e.SPAN=`span`,e.STRIKE=`strike`,e.STRONG=`strong`,e.STYLE=`style`,e.SUB=`sub`,e.SUMMARY=`summary`,e.SUP=`sup`,e.TABLE=`table`,e.TBODY=`tbody`,e.TEMPLATE=`template`,e.TEXTAREA=`textarea`,e.TFOOT=`tfoot`,e.TD=`td`,e.TH=`th`,e.THEAD=`thead`,e.TITLE=`title`,e.TR=`tr`,e.TRACK=`track`,e.TT=`tt`,e.U=`u`,e.UL=`ul`,e.SVG=`svg`,e.VAR=`var`,e.WBR=`wbr`,e.XMP=`xmp`})(J||={});var Y;(function(e){e[e.UNKNOWN=0]=`UNKNOWN`,e[e.A=1]=`A`,e[e.ADDRESS=2]=`ADDRESS`,e[e.ANNOTATION_XML=3]=`ANNOTATION_XML`,e[e.APPLET=4]=`APPLET`,e[e.AREA=5]=`AREA`,e[e.ARTICLE=6]=`ARTICLE`,e[e.ASIDE=7]=`ASIDE`,e[e.B=8]=`B`,e[e.BASE=9]=`BASE`,e[e.BASEFONT=10]=`BASEFONT`,e[e.BGSOUND=11]=`BGSOUND`,e[e.BIG=12]=`BIG`,e[e.BLOCKQUOTE=13]=`BLOCKQUOTE`,e[e.BODY=14]=`BODY`,e[e.BR=15]=`BR`,e[e.BUTTON=16]=`BUTTON`,e[e.CAPTION=17]=`CAPTION`,e[e.CENTER=18]=`CENTER`,e[e.CODE=19]=`CODE`,e[e.COL=20]=`COL`,e[e.COLGROUP=21]=`COLGROUP`,e[e.DD=22]=`DD`,e[e.DESC=23]=`DESC`,e[e.DETAILS=24]=`DETAILS`,e[e.DIALOG=25]=`DIALOG`,e[e.DIR=26]=`DIR`,e[e.DIV=27]=`DIV`,e[e.DL=28]=`DL`,e[e.DT=29]=`DT`,e[e.EM=30]=`EM`,e[e.EMBED=31]=`EMBED`,e[e.FIELDSET=32]=`FIELDSET`,e[e.FIGCAPTION=33]=`FIGCAPTION`,e[e.FIGURE=34]=`FIGURE`,e[e.FONT=35]=`FONT`,e[e.FOOTER=36]=`FOOTER`,e[e.FOREIGN_OBJECT=37]=`FOREIGN_OBJECT`,e[e.FORM=38]=`FORM`,e[e.FRAME=39]=`FRAME`,e[e.FRAMESET=40]=`FRAMESET`,e[e.H1=41]=`H1`,e[e.H2=42]=`H2`,e[e.H3=43]=`H3`,e[e.H4=44]=`H4`,e[e.H5=45]=`H5`,e[e.H6=46]=`H6`,e[e.HEAD=47]=`HEAD`,e[e.HEADER=48]=`HEADER`,e[e.HGROUP=49]=`HGROUP`,e[e.HR=50]=`HR`,e[e.HTML=51]=`HTML`,e[e.I=52]=`I`,e[e.IMG=53]=`IMG`,e[e.IMAGE=54]=`IMAGE`,e[e.INPUT=55]=`INPUT`,e[e.IFRAME=56]=`IFRAME`,e[e.KEYGEN=57]=`KEYGEN`,e[e.LABEL=58]=`LABEL`,e[e.LI=59]=`LI`,e[e.LINK=60]=`LINK`,e[e.LISTING=61]=`LISTING`,e[e.MAIN=62]=`MAIN`,e[e.MALIGNMARK=63]=`MALIGNMARK`,e[e.MARQUEE=64]=`MARQUEE`,e[e.MATH=65]=`MATH`,e[e.MENU=66]=`MENU`,e[e.META=67]=`META`,e[e.MGLYPH=68]=`MGLYPH`,e[e.MI=69]=`MI`,e[e.MO=70]=`MO`,e[e.MN=71]=`MN`,e[e.MS=72]=`MS`,e[e.MTEXT=73]=`MTEXT`,e[e.NAV=74]=`NAV`,e[e.NOBR=75]=`NOBR`,e[e.NOFRAMES=76]=`NOFRAMES`,e[e.NOEMBED=77]=`NOEMBED`,e[e.NOSCRIPT=78]=`NOSCRIPT`,e[e.OBJECT=79]=`OBJECT`,e[e.OL=80]=`OL`,e[e.OPTGROUP=81]=`OPTGROUP`,e[e.OPTION=82]=`OPTION`,e[e.P=83]=`P`,e[e.PARAM=84]=`PARAM`,e[e.PLAINTEXT=85]=`PLAINTEXT`,e[e.PRE=86]=`PRE`,e[e.RB=87]=`RB`,e[e.RP=88]=`RP`,e[e.RT=89]=`RT`,e[e.RTC=90]=`RTC`,e[e.RUBY=91]=`RUBY`,e[e.S=92]=`S`,e[e.SCRIPT=93]=`SCRIPT`,e[e.SEARCH=94]=`SEARCH`,e[e.SECTION=95]=`SECTION`,e[e.SELECT=96]=`SELECT`,e[e.SOURCE=97]=`SOURCE`,e[e.SMALL=98]=`SMALL`,e[e.SPAN=99]=`SPAN`,e[e.STRIKE=100]=`STRIKE`,e[e.STRONG=101]=`STRONG`,e[e.STYLE=102]=`STYLE`,e[e.SUB=103]=`SUB`,e[e.SUMMARY=104]=`SUMMARY`,e[e.SUP=105]=`SUP`,e[e.TABLE=106]=`TABLE`,e[e.TBODY=107]=`TBODY`,e[e.TEMPLATE=108]=`TEMPLATE`,e[e.TEXTAREA=109]=`TEXTAREA`,e[e.TFOOT=110]=`TFOOT`,e[e.TD=111]=`TD`,e[e.TH=112]=`TH`,e[e.THEAD=113]=`THEAD`,e[e.TITLE=114]=`TITLE`,e[e.TR=115]=`TR`,e[e.TRACK=116]=`TRACK`,e[e.TT=117]=`TT`,e[e.U=118]=`U`,e[e.UL=119]=`UL`,e[e.SVG=120]=`SVG`,e[e.VAR=121]=`VAR`,e[e.WBR=122]=`WBR`,e[e.XMP=123]=`XMP`})(Y||={});var Uh=new Map([[J.A,Y.A],[J.ADDRESS,Y.ADDRESS],[J.ANNOTATION_XML,Y.ANNOTATION_XML],[J.APPLET,Y.APPLET],[J.AREA,Y.AREA],[J.ARTICLE,Y.ARTICLE],[J.ASIDE,Y.ASIDE],[J.B,Y.B],[J.BASE,Y.BASE],[J.BASEFONT,Y.BASEFONT],[J.BGSOUND,Y.BGSOUND],[J.BIG,Y.BIG],[J.BLOCKQUOTE,Y.BLOCKQUOTE],[J.BODY,Y.BODY],[J.BR,Y.BR],[J.BUTTON,Y.BUTTON],[J.CAPTION,Y.CAPTION],[J.CENTER,Y.CENTER],[J.CODE,Y.CODE],[J.COL,Y.COL],[J.COLGROUP,Y.COLGROUP],[J.DD,Y.DD],[J.DESC,Y.DESC],[J.DETAILS,Y.DETAILS],[J.DIALOG,Y.DIALOG],[J.DIR,Y.DIR],[J.DIV,Y.DIV],[J.DL,Y.DL],[J.DT,Y.DT],[J.EM,Y.EM],[J.EMBED,Y.EMBED],[J.FIELDSET,Y.FIELDSET],[J.FIGCAPTION,Y.FIGCAPTION],[J.FIGURE,Y.FIGURE],[J.FONT,Y.FONT],[J.FOOTER,Y.FOOTER],[J.FOREIGN_OBJECT,Y.FOREIGN_OBJECT],[J.FORM,Y.FORM],[J.FRAME,Y.FRAME],[J.FRAMESET,Y.FRAMESET],[J.H1,Y.H1],[J.H2,Y.H2],[J.H3,Y.H3],[J.H4,Y.H4],[J.H5,Y.H5],[J.H6,Y.H6],[J.HEAD,Y.HEAD],[J.HEADER,Y.HEADER],[J.HGROUP,Y.HGROUP],[J.HR,Y.HR],[J.HTML,Y.HTML],[J.I,Y.I],[J.IMG,Y.IMG],[J.IMAGE,Y.IMAGE],[J.INPUT,Y.INPUT],[J.IFRAME,Y.IFRAME],[J.KEYGEN,Y.KEYGEN],[J.LABEL,Y.LABEL],[J.LI,Y.LI],[J.LINK,Y.LINK],[J.LISTING,Y.LISTING],[J.MAIN,Y.MAIN],[J.MALIGNMARK,Y.MALIGNMARK],[J.MARQUEE,Y.MARQUEE],[J.MATH,Y.MATH],[J.MENU,Y.MENU],[J.META,Y.META],[J.MGLYPH,Y.MGLYPH],[J.MI,Y.MI],[J.MO,Y.MO],[J.MN,Y.MN],[J.MS,Y.MS],[J.MTEXT,Y.MTEXT],[J.NAV,Y.NAV],[J.NOBR,Y.NOBR],[J.NOFRAMES,Y.NOFRAMES],[J.NOEMBED,Y.NOEMBED],[J.NOSCRIPT,Y.NOSCRIPT],[J.OBJECT,Y.OBJECT],[J.OL,Y.OL],[J.OPTGROUP,Y.OPTGROUP],[J.OPTION,Y.OPTION],[J.P,Y.P],[J.PARAM,Y.PARAM],[J.PLAINTEXT,Y.PLAINTEXT],[J.PRE,Y.PRE],[J.RB,Y.RB],[J.RP,Y.RP],[J.RT,Y.RT],[J.RTC,Y.RTC],[J.RUBY,Y.RUBY],[J.S,Y.S],[J.SCRIPT,Y.SCRIPT],[J.SEARCH,Y.SEARCH],[J.SECTION,Y.SECTION],[J.SELECT,Y.SELECT],[J.SOURCE,Y.SOURCE],[J.SMALL,Y.SMALL],[J.SPAN,Y.SPAN],[J.STRIKE,Y.STRIKE],[J.STRONG,Y.STRONG],[J.STYLE,Y.STYLE],[J.SUB,Y.SUB],[J.SUMMARY,Y.SUMMARY],[J.SUP,Y.SUP],[J.TABLE,Y.TABLE],[J.TBODY,Y.TBODY],[J.TEMPLATE,Y.TEMPLATE],[J.TEXTAREA,Y.TEXTAREA],[J.TFOOT,Y.TFOOT],[J.TD,Y.TD],[J.TH,Y.TH],[J.THEAD,Y.THEAD],[J.TITLE,Y.TITLE],[J.TR,Y.TR],[J.TRACK,Y.TRACK],[J.TT,Y.TT],[J.U,Y.U],[J.UL,Y.UL],[J.SVG,Y.SVG],[J.VAR,Y.VAR],[J.WBR,Y.WBR],[J.XMP,Y.XMP]]);function Wh(e){return Uh.get(e)??Y.UNKNOWN}var X=Y,Gh={[q.HTML]:new Set([X.ADDRESS,X.APPLET,X.AREA,X.ARTICLE,X.ASIDE,X.BASE,X.BASEFONT,X.BGSOUND,X.BLOCKQUOTE,X.BODY,X.BR,X.BUTTON,X.CAPTION,X.CENTER,X.COL,X.COLGROUP,X.DD,X.DETAILS,X.DIR,X.DIV,X.DL,X.DT,X.EMBED,X.FIELDSET,X.FIGCAPTION,X.FIGURE,X.FOOTER,X.FORM,X.FRAME,X.FRAMESET,X.H1,X.H2,X.H3,X.H4,X.H5,X.H6,X.HEAD,X.HEADER,X.HGROUP,X.HR,X.HTML,X.IFRAME,X.IMG,X.INPUT,X.LI,X.LINK,X.LISTING,X.MAIN,X.MARQUEE,X.MENU,X.META,X.NAV,X.NOEMBED,X.NOFRAMES,X.NOSCRIPT,X.OBJECT,X.OL,X.P,X.PARAM,X.PLAINTEXT,X.PRE,X.SCRIPT,X.SECTION,X.SELECT,X.SOURCE,X.STYLE,X.SUMMARY,X.TABLE,X.TBODY,X.TD,X.TEMPLATE,X.TEXTAREA,X.TFOOT,X.TH,X.THEAD,X.TITLE,X.TR,X.TRACK,X.UL,X.WBR,X.XMP]),[q.MATHML]:new Set([X.MI,X.MO,X.MN,X.MS,X.MTEXT,X.ANNOTATION_XML]),[q.SVG]:new Set([X.TITLE,X.FOREIGN_OBJECT,X.DESC]),[q.XLINK]:new Set,[q.XML]:new Set,[q.XMLNS]:new Set},Kh=new Set([X.H1,X.H2,X.H3,X.H4,X.H5,X.H6]);new Set([J.STYLE,J.SCRIPT,J.XMP,J.IFRAME,J.NOEMBED,J.NOFRAMES,J.PLAINTEXT]);var Z;(function(e){e[e.DATA=0]=`DATA`,e[e.RCDATA=1]=`RCDATA`,e[e.RAWTEXT=2]=`RAWTEXT`,e[e.SCRIPT_DATA=3]=`SCRIPT_DATA`,e[e.PLAINTEXT=4]=`PLAINTEXT`,e[e.TAG_OPEN=5]=`TAG_OPEN`,e[e.END_TAG_OPEN=6]=`END_TAG_OPEN`,e[e.TAG_NAME=7]=`TAG_NAME`,e[e.RCDATA_LESS_THAN_SIGN=8]=`RCDATA_LESS_THAN_SIGN`,e[e.RCDATA_END_TAG_OPEN=9]=`RCDATA_END_TAG_OPEN`,e[e.RCDATA_END_TAG_NAME=10]=`RCDATA_END_TAG_NAME`,e[e.RAWTEXT_LESS_THAN_SIGN=11]=`RAWTEXT_LESS_THAN_SIGN`,e[e.RAWTEXT_END_TAG_OPEN=12]=`RAWTEXT_END_TAG_OPEN`,e[e.RAWTEXT_END_TAG_NAME=13]=`RAWTEXT_END_TAG_NAME`,e[e.SCRIPT_DATA_LESS_THAN_SIGN=14]=`SCRIPT_DATA_LESS_THAN_SIGN`,e[e.SCRIPT_DATA_END_TAG_OPEN=15]=`SCRIPT_DATA_END_TAG_OPEN`,e[e.SCRIPT_DATA_END_TAG_NAME=16]=`SCRIPT_DATA_END_TAG_NAME`,e[e.SCRIPT_DATA_ESCAPE_START=17]=`SCRIPT_DATA_ESCAPE_START`,e[e.SCRIPT_DATA_ESCAPE_START_DASH=18]=`SCRIPT_DATA_ESCAPE_START_DASH`,e[e.SCRIPT_DATA_ESCAPED=19]=`SCRIPT_DATA_ESCAPED`,e[e.SCRIPT_DATA_ESCAPED_DASH=20]=`SCRIPT_DATA_ESCAPED_DASH`,e[e.SCRIPT_DATA_ESCAPED_DASH_DASH=21]=`SCRIPT_DATA_ESCAPED_DASH_DASH`,e[e.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]=`SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN`,e[e.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]=`SCRIPT_DATA_ESCAPED_END_TAG_OPEN`,e[e.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]=`SCRIPT_DATA_ESCAPED_END_TAG_NAME`,e[e.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]=`SCRIPT_DATA_DOUBLE_ESCAPE_START`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED=26]=`SCRIPT_DATA_DOUBLE_ESCAPED`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]=`SCRIPT_DATA_DOUBLE_ESCAPED_DASH`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]=`SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH`,e[e.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]=`SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN`,e[e.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]=`SCRIPT_DATA_DOUBLE_ESCAPE_END`,e[e.BEFORE_ATTRIBUTE_NAME=31]=`BEFORE_ATTRIBUTE_NAME`,e[e.ATTRIBUTE_NAME=32]=`ATTRIBUTE_NAME`,e[e.AFTER_ATTRIBUTE_NAME=33]=`AFTER_ATTRIBUTE_NAME`,e[e.BEFORE_ATTRIBUTE_VALUE=34]=`BEFORE_ATTRIBUTE_VALUE`,e[e.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]=`ATTRIBUTE_VALUE_DOUBLE_QUOTED`,e[e.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]=`ATTRIBUTE_VALUE_SINGLE_QUOTED`,e[e.ATTRIBUTE_VALUE_UNQUOTED=37]=`ATTRIBUTE_VALUE_UNQUOTED`,e[e.AFTER_ATTRIBUTE_VALUE_QUOTED=38]=`AFTER_ATTRIBUTE_VALUE_QUOTED`,e[e.SELF_CLOSING_START_TAG=39]=`SELF_CLOSING_START_TAG`,e[e.BOGUS_COMMENT=40]=`BOGUS_COMMENT`,e[e.MARKUP_DECLARATION_OPEN=41]=`MARKUP_DECLARATION_OPEN`,e[e.COMMENT_START=42]=`COMMENT_START`,e[e.COMMENT_START_DASH=43]=`COMMENT_START_DASH`,e[e.COMMENT=44]=`COMMENT`,e[e.COMMENT_LESS_THAN_SIGN=45]=`COMMENT_LESS_THAN_SIGN`,e[e.COMMENT_LESS_THAN_SIGN_BANG=46]=`COMMENT_LESS_THAN_SIGN_BANG`,e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]=`COMMENT_LESS_THAN_SIGN_BANG_DASH`,e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]=`COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH`,e[e.COMMENT_END_DASH=49]=`COMMENT_END_DASH`,e[e.COMMENT_END=50]=`COMMENT_END`,e[e.COMMENT_END_BANG=51]=`COMMENT_END_BANG`,e[e.DOCTYPE=52]=`DOCTYPE`,e[e.BEFORE_DOCTYPE_NAME=53]=`BEFORE_DOCTYPE_NAME`,e[e.DOCTYPE_NAME=54]=`DOCTYPE_NAME`,e[e.AFTER_DOCTYPE_NAME=55]=`AFTER_DOCTYPE_NAME`,e[e.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]=`AFTER_DOCTYPE_PUBLIC_KEYWORD`,e[e.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]=`BEFORE_DOCTYPE_PUBLIC_IDENTIFIER`,e[e.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]=`DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED`,e[e.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]=`DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED`,e[e.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]=`AFTER_DOCTYPE_PUBLIC_IDENTIFIER`,e[e.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]=`BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS`,e[e.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]=`AFTER_DOCTYPE_SYSTEM_KEYWORD`,e[e.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]=`BEFORE_DOCTYPE_SYSTEM_IDENTIFIER`,e[e.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]=`DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED`,e[e.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]=`DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED`,e[e.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]=`AFTER_DOCTYPE_SYSTEM_IDENTIFIER`,e[e.BOGUS_DOCTYPE=67]=`BOGUS_DOCTYPE`,e[e.CDATA_SECTION=68]=`CDATA_SECTION`,e[e.CDATA_SECTION_BRACKET=69]=`CDATA_SECTION_BRACKET`,e[e.CDATA_SECTION_END=70]=`CDATA_SECTION_END`,e[e.CHARACTER_REFERENCE=71]=`CHARACTER_REFERENCE`,e[e.AMBIGUOUS_AMPERSAND=72]=`AMBIGUOUS_AMPERSAND`})(Z||={});var qh={DATA:Z.DATA,RCDATA:Z.RCDATA,RAWTEXT:Z.RAWTEXT,SCRIPT_DATA:Z.SCRIPT_DATA,PLAINTEXT:Z.PLAINTEXT,CDATA_SECTION:Z.CDATA_SECTION};function Jh(e){return e>=G.DIGIT_0&&e<=G.DIGIT_9}function Yh(e){return e>=G.LATIN_CAPITAL_A&&e<=G.LATIN_CAPITAL_Z}function Xh(e){return e>=G.LATIN_SMALL_A&&e<=G.LATIN_SMALL_Z}function Zh(e){return Xh(e)||Yh(e)}function Qh(e){return Zh(e)||Jh(e)}function $h(e){return e+32}function eg(e){return e===G.SPACE||e===G.LINE_FEED||e===G.TABULATION||e===G.FORM_FEED}function tg(e){return eg(e)||e===G.SOLIDUS||e===G.GREATER_THAN_SIGN}function ng(e){return e===G.NULL?K.nullCharacterReference:e>1114111?K.characterReferenceOutsideUnicodeRange:vh(e)?K.surrogateCharacterReference:Sh(e)?K.noncharacterCharacterReference:xh(e)||e===G.CARRIAGE_RETURN?K.controlCharacterReference:null}var rg=class{constructor(e,t){this.options=e,this.handler=t,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName=``,this.active=!1,this.state=Z.DATA,this.returnState=Z.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:``,value:``},this.preprocessor=new wh(t),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new zh(Dh,(e,t)=>{this.preprocessor.pos=this.entityStartPos+t-1,this._flushCodePointConsumedAsCharacterReference(e)},t.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(K.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:e=>{this._err(K.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+e)},validateNumericCharacterReference:e=>{let t=ng(e);t&&this._err(t,1)}}:void 0)}_err(e,t=0){var n,r;(r=(n=this.handler).onParseError)==null||r.call(n,this.preprocessor.getError(e,t))}getCurrentLocation(e){return this.options.sourceCodeLocationInfo?{startLine:this.preprocessor.line,startCol:this.preprocessor.col-e,startOffset:this.preprocessor.offset-e,endLine:-1,endCol:-1,endOffset:-1}:null}_runParsingLoop(){if(!this.inLoop){for(this.inLoop=!0;this.active&&!this.paused;){this.consumedAfterSnapshot=0;let e=this._consume();this._ensureHibernation()||this._callState(e)}this.inLoop=!1}}pause(){this.paused=!0}resume(e){if(!this.paused)throw Error(`Parser was already resumed`);this.paused=!1,!this.inLoop&&(this._runParsingLoop(),this.paused||e?.())}write(e,t,n){this.active=!0,this.preprocessor.write(e,t),this._runParsingLoop(),this.paused||n?.()}insertHtmlAtCurrentPos(e){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(e),this._runParsingLoop()}_ensureHibernation(){return this.preprocessor.endOfChunkHit?(this.preprocessor.retreat(this.consumedAfterSnapshot),this.consumedAfterSnapshot=0,this.active=!1,!0):!1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_advanceBy(e){this.consumedAfterSnapshot+=e;for(let t=0;t<e;t++)this.preprocessor.advance()}_consumeSequenceIfMatch(e,t){return this.preprocessor.startsWith(e,t)?(this._advanceBy(e.length-1),!0):!1}_createStartTagToken(){this.currentToken={type:Th.START_TAG,tagName:``,tagID:Y.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(1)}}_createEndTagToken(){this.currentToken={type:Th.END_TAG,tagName:``,tagID:Y.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(2)}}_createCommentToken(e){this.currentToken={type:Th.COMMENT,data:``,location:this.getCurrentLocation(e)}}_createDoctypeToken(e){this.currentToken={type:Th.DOCTYPE,name:e,forceQuirks:!1,publicId:null,systemId:null,location:this.currentLocation}}_createCharacterToken(e,t){this.currentCharacterToken={type:e,chars:t,location:this.currentLocation}}_createAttr(e){this.currentAttr={name:e,value:``},this.currentLocation=this.getCurrentLocation(0)}_leaveAttrName(){var e;let t=this.currentToken;if(Eh(t,this.currentAttr.name)===null){if(t.attrs.push(this.currentAttr),t.location&&this.currentLocation){let n=(e=t.location).attrs??(e.attrs=Object.create(null));n[this.currentAttr.name]=this.currentLocation,this._leaveAttrValue()}}else this._err(K.duplicateAttribute)}_leaveAttrValue(){this.currentLocation&&(this.currentLocation.endLine=this.preprocessor.line,this.currentLocation.endCol=this.preprocessor.col,this.currentLocation.endOffset=this.preprocessor.offset)}prepareToken(e){this._emitCurrentCharacterToken(e.location),this.currentToken=null,e.location&&(e.location.endLine=this.preprocessor.line,e.location.endCol=this.preprocessor.col+1,e.location.endOffset=this.preprocessor.offset+1),this.currentLocation=this.getCurrentLocation(-1)}emitCurrentTagToken(){let e=this.currentToken;this.prepareToken(e),e.tagID=Wh(e.tagName),e.type===Th.START_TAG?(this.lastStartTagName=e.tagName,this.handler.onStartTag(e)):(e.attrs.length>0&&this._err(K.endTagWithAttributes),e.selfClosing&&this._err(K.endTagWithTrailingSolidus),this.handler.onEndTag(e)),this.preprocessor.dropParsedChunk()}emitCurrentComment(e){this.prepareToken(e),this.handler.onComment(e),this.preprocessor.dropParsedChunk()}emitCurrentDoctype(e){this.prepareToken(e),this.handler.onDoctype(e),this.preprocessor.dropParsedChunk()}_emitCurrentCharacterToken(e){if(this.currentCharacterToken){switch(e&&this.currentCharacterToken.location&&(this.currentCharacterToken.location.endLine=e.startLine,this.currentCharacterToken.location.endCol=e.startCol,this.currentCharacterToken.location.endOffset=e.startOffset),this.currentCharacterToken.type){case Th.CHARACTER:this.handler.onCharacter(this.currentCharacterToken);break;case Th.NULL_CHARACTER:this.handler.onNullCharacter(this.currentCharacterToken);break;case Th.WHITESPACE_CHARACTER:this.handler.onWhitespaceCharacter(this.currentCharacterToken);break}this.currentCharacterToken=null}}_emitEOFToken(){let e=this.getCurrentLocation(0);e&&(e.endLine=e.startLine,e.endCol=e.startCol,e.endOffset=e.startOffset),this._emitCurrentCharacterToken(e),this.handler.onEof({type:Th.EOF,location:e}),this.active=!1}_appendCharToCurrentCharacterToken(e,t){if(this.currentCharacterToken)if(this.currentCharacterToken.type===e){this.currentCharacterToken.chars+=t;return}else this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk();this._createCharacterToken(e,t)}_emitCodePoint(e){let t=eg(e)?Th.WHITESPACE_CHARACTER:e===G.NULL?Th.NULL_CHARACTER:Th.CHARACTER;this._appendCharToCurrentCharacterToken(t,String.fromCodePoint(e))}_emitChars(e){this._appendCharToCurrentCharacterToken(Th.CHARACTER,e)}_startCharacterReference(){this.returnState=this.state,this.state=Z.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?Rh.Attribute:Rh.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===Z.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===Z.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===Z.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(e){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(e):this._emitCodePoint(e)}_callState(e){switch(this.state){case Z.DATA:this._stateData(e);break;case Z.RCDATA:this._stateRcdata(e);break;case Z.RAWTEXT:this._stateRawtext(e);break;case Z.SCRIPT_DATA:this._stateScriptData(e);break;case Z.PLAINTEXT:this._statePlaintext(e);break;case Z.TAG_OPEN:this._stateTagOpen(e);break;case Z.END_TAG_OPEN:this._stateEndTagOpen(e);break;case Z.TAG_NAME:this._stateTagName(e);break;case Z.RCDATA_LESS_THAN_SIGN:this._stateRcdataLessThanSign(e);break;case Z.RCDATA_END_TAG_OPEN:this._stateRcdataEndTagOpen(e);break;case Z.RCDATA_END_TAG_NAME:this._stateRcdataEndTagName(e);break;case Z.RAWTEXT_LESS_THAN_SIGN:this._stateRawtextLessThanSign(e);break;case Z.RAWTEXT_END_TAG_OPEN:this._stateRawtextEndTagOpen(e);break;case Z.RAWTEXT_END_TAG_NAME:this._stateRawtextEndTagName(e);break;case Z.SCRIPT_DATA_LESS_THAN_SIGN:this._stateScriptDataLessThanSign(e);break;case Z.SCRIPT_DATA_END_TAG_OPEN:this._stateScriptDataEndTagOpen(e);break;case Z.SCRIPT_DATA_END_TAG_NAME:this._stateScriptDataEndTagName(e);break;case Z.SCRIPT_DATA_ESCAPE_START:this._stateScriptDataEscapeStart(e);break;case Z.SCRIPT_DATA_ESCAPE_START_DASH:this._stateScriptDataEscapeStartDash(e);break;case Z.SCRIPT_DATA_ESCAPED:this._stateScriptDataEscaped(e);break;case Z.SCRIPT_DATA_ESCAPED_DASH:this._stateScriptDataEscapedDash(e);break;case Z.SCRIPT_DATA_ESCAPED_DASH_DASH:this._stateScriptDataEscapedDashDash(e);break;case Z.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:this._stateScriptDataEscapedLessThanSign(e);break;case Z.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:this._stateScriptDataEscapedEndTagOpen(e);break;case Z.SCRIPT_DATA_ESCAPED_END_TAG_NAME:this._stateScriptDataEscapedEndTagName(e);break;case Z.SCRIPT_DATA_DOUBLE_ESCAPE_START:this._stateScriptDataDoubleEscapeStart(e);break;case Z.SCRIPT_DATA_DOUBLE_ESCAPED:this._stateScriptDataDoubleEscaped(e);break;case Z.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:this._stateScriptDataDoubleEscapedDash(e);break;case Z.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:this._stateScriptDataDoubleEscapedDashDash(e);break;case Z.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:this._stateScriptDataDoubleEscapedLessThanSign(e);break;case Z.SCRIPT_DATA_DOUBLE_ESCAPE_END:this._stateScriptDataDoubleEscapeEnd(e);break;case Z.BEFORE_ATTRIBUTE_NAME:this._stateBeforeAttributeName(e);break;case Z.ATTRIBUTE_NAME:this._stateAttributeName(e);break;case Z.AFTER_ATTRIBUTE_NAME:this._stateAfterAttributeName(e);break;case Z.BEFORE_ATTRIBUTE_VALUE:this._stateBeforeAttributeValue(e);break;case Z.ATTRIBUTE_VALUE_DOUBLE_QUOTED:this._stateAttributeValueDoubleQuoted(e);break;case Z.ATTRIBUTE_VALUE_SINGLE_QUOTED:this._stateAttributeValueSingleQuoted(e);break;case Z.ATTRIBUTE_VALUE_UNQUOTED:this._stateAttributeValueUnquoted(e);break;case Z.AFTER_ATTRIBUTE_VALUE_QUOTED:this._stateAfterAttributeValueQuoted(e);break;case Z.SELF_CLOSING_START_TAG:this._stateSelfClosingStartTag(e);break;case Z.BOGUS_COMMENT:this._stateBogusComment(e);break;case Z.MARKUP_DECLARATION_OPEN:this._stateMarkupDeclarationOpen(e);break;case Z.COMMENT_START:this._stateCommentStart(e);break;case Z.COMMENT_START_DASH:this._stateCommentStartDash(e);break;case Z.COMMENT:this._stateComment(e);break;case Z.COMMENT_LESS_THAN_SIGN:this._stateCommentLessThanSign(e);break;case Z.COMMENT_LESS_THAN_SIGN_BANG:this._stateCommentLessThanSignBang(e);break;case Z.COMMENT_LESS_THAN_SIGN_BANG_DASH:this._stateCommentLessThanSignBangDash(e);break;case Z.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:this._stateCommentLessThanSignBangDashDash(e);break;case Z.COMMENT_END_DASH:this._stateCommentEndDash(e);break;case Z.COMMENT_END:this._stateCommentEnd(e);break;case Z.COMMENT_END_BANG:this._stateCommentEndBang(e);break;case Z.DOCTYPE:this._stateDoctype(e);break;case Z.BEFORE_DOCTYPE_NAME:this._stateBeforeDoctypeName(e);break;case Z.DOCTYPE_NAME:this._stateDoctypeName(e);break;case Z.AFTER_DOCTYPE_NAME:this._stateAfterDoctypeName(e);break;case Z.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._stateAfterDoctypePublicKeyword(e);break;case Z.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:this._stateBeforeDoctypePublicIdentifier(e);break;case Z.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:this._stateDoctypePublicIdentifierDoubleQuoted(e);break;case Z.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:this._stateDoctypePublicIdentifierSingleQuoted(e);break;case Z.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:this._stateAfterDoctypePublicIdentifier(e);break;case Z.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:this._stateBetweenDoctypePublicAndSystemIdentifiers(e);break;case Z.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._stateAfterDoctypeSystemKeyword(e);break;case Z.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:this._stateBeforeDoctypeSystemIdentifier(e);break;case Z.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:this._stateDoctypeSystemIdentifierDoubleQuoted(e);break;case Z.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:this._stateDoctypeSystemIdentifierSingleQuoted(e);break;case Z.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:this._stateAfterDoctypeSystemIdentifier(e);break;case Z.BOGUS_DOCTYPE:this._stateBogusDoctype(e);break;case Z.CDATA_SECTION:this._stateCdataSection(e);break;case Z.CDATA_SECTION_BRACKET:this._stateCdataSectionBracket(e);break;case Z.CDATA_SECTION_END:this._stateCdataSectionEnd(e);break;case Z.CHARACTER_REFERENCE:this._stateCharacterReference();break;case Z.AMBIGUOUS_AMPERSAND:this._stateAmbiguousAmpersand(e);break;default:throw Error(`Unknown state`)}}_stateData(e){switch(e){case G.LESS_THAN_SIGN:this.state=Z.TAG_OPEN;break;case G.AMPERSAND:this._startCharacterReference();break;case G.NULL:this._err(K.unexpectedNullCharacter),this._emitCodePoint(e);break;case G.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateRcdata(e){switch(e){case G.AMPERSAND:this._startCharacterReference();break;case G.LESS_THAN_SIGN:this.state=Z.RCDATA_LESS_THAN_SIGN;break;case G.NULL:this._err(K.unexpectedNullCharacter),this._emitChars(`�`);break;case G.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateRawtext(e){switch(e){case G.LESS_THAN_SIGN:this.state=Z.RAWTEXT_LESS_THAN_SIGN;break;case G.NULL:this._err(K.unexpectedNullCharacter),this._emitChars(`�`);break;case G.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptData(e){switch(e){case G.LESS_THAN_SIGN:this.state=Z.SCRIPT_DATA_LESS_THAN_SIGN;break;case G.NULL:this._err(K.unexpectedNullCharacter),this._emitChars(`�`);break;case G.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_statePlaintext(e){switch(e){case G.NULL:this._err(K.unexpectedNullCharacter),this._emitChars(`�`);break;case G.EOF:this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateTagOpen(e){if(Zh(e))this._createStartTagToken(),this.state=Z.TAG_NAME,this._stateTagName(e);else switch(e){case G.EXCLAMATION_MARK:this.state=Z.MARKUP_DECLARATION_OPEN;break;case G.SOLIDUS:this.state=Z.END_TAG_OPEN;break;case G.QUESTION_MARK:this._err(K.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=Z.BOGUS_COMMENT,this._stateBogusComment(e);break;case G.EOF:this._err(K.eofBeforeTagName),this._emitChars(`<`),this._emitEOFToken();break;default:this._err(K.invalidFirstCharacterOfTagName),this._emitChars(`<`),this.state=Z.DATA,this._stateData(e)}}_stateEndTagOpen(e){if(Zh(e))this._createEndTagToken(),this.state=Z.TAG_NAME,this._stateTagName(e);else switch(e){case G.GREATER_THAN_SIGN:this._err(K.missingEndTagName),this.state=Z.DATA;break;case G.EOF:this._err(K.eofBeforeTagName),this._emitChars(`</`),this._emitEOFToken();break;default:this._err(K.invalidFirstCharacterOfTagName),this._createCommentToken(2),this.state=Z.BOGUS_COMMENT,this._stateBogusComment(e)}}_stateTagName(e){let t=this.currentToken;switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:this.state=Z.BEFORE_ATTRIBUTE_NAME;break;case G.SOLIDUS:this.state=Z.SELF_CLOSING_START_TAG;break;case G.GREATER_THAN_SIGN:this.state=Z.DATA,this.emitCurrentTagToken();break;case G.NULL:this._err(K.unexpectedNullCharacter),t.tagName+=`�`;break;case G.EOF:this._err(K.eofInTag),this._emitEOFToken();break;default:t.tagName+=String.fromCodePoint(Yh(e)?$h(e):e)}}_stateRcdataLessThanSign(e){e===G.SOLIDUS?this.state=Z.RCDATA_END_TAG_OPEN:(this._emitChars(`<`),this.state=Z.RCDATA,this._stateRcdata(e))}_stateRcdataEndTagOpen(e){Zh(e)?(this.state=Z.RCDATA_END_TAG_NAME,this._stateRcdataEndTagName(e)):(this._emitChars(`</`),this.state=Z.RCDATA,this._stateRcdata(e))}handleSpecialEndTag(e){if(!this.preprocessor.startsWith(this.lastStartTagName,!1))return!this._ensureHibernation();this._createEndTagToken();let t=this.currentToken;switch(t.tagName=this.lastStartTagName,this.preprocessor.peek(this.lastStartTagName.length)){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:return this._advanceBy(this.lastStartTagName.length),this.state=Z.BEFORE_ATTRIBUTE_NAME,!1;case G.SOLIDUS:return this._advanceBy(this.lastStartTagName.length),this.state=Z.SELF_CLOSING_START_TAG,!1;case G.GREATER_THAN_SIGN:return this._advanceBy(this.lastStartTagName.length),this.emitCurrentTagToken(),this.state=Z.DATA,!1;default:return!this._ensureHibernation()}}_stateRcdataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars(`</`),this.state=Z.RCDATA,this._stateRcdata(e))}_stateRawtextLessThanSign(e){e===G.SOLIDUS?this.state=Z.RAWTEXT_END_TAG_OPEN:(this._emitChars(`<`),this.state=Z.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagOpen(e){Zh(e)?(this.state=Z.RAWTEXT_END_TAG_NAME,this._stateRawtextEndTagName(e)):(this._emitChars(`</`),this.state=Z.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars(`</`),this.state=Z.RAWTEXT,this._stateRawtext(e))}_stateScriptDataLessThanSign(e){switch(e){case G.SOLIDUS:this.state=Z.SCRIPT_DATA_END_TAG_OPEN;break;case G.EXCLAMATION_MARK:this.state=Z.SCRIPT_DATA_ESCAPE_START,this._emitChars(`<!`);break;default:this._emitChars(`<`),this.state=Z.SCRIPT_DATA,this._stateScriptData(e)}}_stateScriptDataEndTagOpen(e){Zh(e)?(this.state=Z.SCRIPT_DATA_END_TAG_NAME,this._stateScriptDataEndTagName(e)):(this._emitChars(`</`),this.state=Z.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars(`</`),this.state=Z.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStart(e){e===G.HYPHEN_MINUS?(this.state=Z.SCRIPT_DATA_ESCAPE_START_DASH,this._emitChars(`-`)):(this.state=Z.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStartDash(e){e===G.HYPHEN_MINUS?(this.state=Z.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars(`-`)):(this.state=Z.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscaped(e){switch(e){case G.HYPHEN_MINUS:this.state=Z.SCRIPT_DATA_ESCAPED_DASH,this._emitChars(`-`);break;case G.LESS_THAN_SIGN:this.state=Z.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case G.NULL:this._err(K.unexpectedNullCharacter),this._emitChars(`�`);break;case G.EOF:this._err(K.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptDataEscapedDash(e){switch(e){case G.HYPHEN_MINUS:this.state=Z.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars(`-`);break;case G.LESS_THAN_SIGN:this.state=Z.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case G.NULL:this._err(K.unexpectedNullCharacter),this.state=Z.SCRIPT_DATA_ESCAPED,this._emitChars(`�`);break;case G.EOF:this._err(K.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=Z.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedDashDash(e){switch(e){case G.HYPHEN_MINUS:this._emitChars(`-`);break;case G.LESS_THAN_SIGN:this.state=Z.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break;case G.GREATER_THAN_SIGN:this.state=Z.SCRIPT_DATA,this._emitChars(`>`);break;case G.NULL:this._err(K.unexpectedNullCharacter),this.state=Z.SCRIPT_DATA_ESCAPED,this._emitChars(`�`);break;case G.EOF:this._err(K.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=Z.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedLessThanSign(e){e===G.SOLIDUS?this.state=Z.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:Zh(e)?(this._emitChars(`<`),this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(e)):(this._emitChars(`<`),this.state=Z.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagOpen(e){Zh(e)?(this.state=Z.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(e)):(this._emitChars(`</`),this.state=Z.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars(`</`),this.state=Z.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscapeStart(e){if(this.preprocessor.startsWith(_h.SCRIPT,!1)&&tg(this.preprocessor.peek(_h.SCRIPT.length))){this._emitCodePoint(e);for(let e=0;e<_h.SCRIPT.length;e++)this._emitCodePoint(this._consume());this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED}else this._ensureHibernation()||(this.state=Z.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscaped(e){switch(e){case G.HYPHEN_MINUS:this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED_DASH,this._emitChars(`-`);break;case G.LESS_THAN_SIGN:this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars(`<`);break;case G.NULL:this._err(K.unexpectedNullCharacter),this._emitChars(`�`);break;case G.EOF:this._err(K.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedDash(e){switch(e){case G.HYPHEN_MINUS:this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH,this._emitChars(`-`);break;case G.LESS_THAN_SIGN:this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars(`<`);break;case G.NULL:this._err(K.unexpectedNullCharacter),this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(`�`);break;case G.EOF:this._err(K.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedDashDash(e){switch(e){case G.HYPHEN_MINUS:this._emitChars(`-`);break;case G.LESS_THAN_SIGN:this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars(`<`);break;case G.GREATER_THAN_SIGN:this.state=Z.SCRIPT_DATA,this._emitChars(`>`);break;case G.NULL:this._err(K.unexpectedNullCharacter),this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(`�`);break;case G.EOF:this._err(K.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break;default:this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedLessThanSign(e){e===G.SOLIDUS?(this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars(`/`)):(this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateScriptDataDoubleEscapeEnd(e){if(this.preprocessor.startsWith(_h.SCRIPT,!1)&&tg(this.preprocessor.peek(_h.SCRIPT.length))){this._emitCodePoint(e);for(let e=0;e<_h.SCRIPT.length;e++)this._emitCodePoint(this._consume());this.state=Z.SCRIPT_DATA_ESCAPED}else this._ensureHibernation()||(this.state=Z.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateBeforeAttributeName(e){switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:break;case G.SOLIDUS:case G.GREATER_THAN_SIGN:case G.EOF:this.state=Z.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break;case G.EQUALS_SIGN:this._err(K.unexpectedEqualsSignBeforeAttributeName),this._createAttr(`=`),this.state=Z.ATTRIBUTE_NAME;break;default:this._createAttr(``),this.state=Z.ATTRIBUTE_NAME,this._stateAttributeName(e)}}_stateAttributeName(e){switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:case G.SOLIDUS:case G.GREATER_THAN_SIGN:case G.EOF:this._leaveAttrName(),this.state=Z.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break;case G.EQUALS_SIGN:this._leaveAttrName(),this.state=Z.BEFORE_ATTRIBUTE_VALUE;break;case G.QUOTATION_MARK:case G.APOSTROPHE:case G.LESS_THAN_SIGN:this._err(K.unexpectedCharacterInAttributeName),this.currentAttr.name+=String.fromCodePoint(e);break;case G.NULL:this._err(K.unexpectedNullCharacter),this.currentAttr.name+=`�`;break;default:this.currentAttr.name+=String.fromCodePoint(Yh(e)?$h(e):e)}}_stateAfterAttributeName(e){switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:break;case G.SOLIDUS:this.state=Z.SELF_CLOSING_START_TAG;break;case G.EQUALS_SIGN:this.state=Z.BEFORE_ATTRIBUTE_VALUE;break;case G.GREATER_THAN_SIGN:this.state=Z.DATA,this.emitCurrentTagToken();break;case G.EOF:this._err(K.eofInTag),this._emitEOFToken();break;default:this._createAttr(``),this.state=Z.ATTRIBUTE_NAME,this._stateAttributeName(e)}}_stateBeforeAttributeValue(e){switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:break;case G.QUOTATION_MARK:this.state=Z.ATTRIBUTE_VALUE_DOUBLE_QUOTED;break;case G.APOSTROPHE:this.state=Z.ATTRIBUTE_VALUE_SINGLE_QUOTED;break;case G.GREATER_THAN_SIGN:this._err(K.missingAttributeValue),this.state=Z.DATA,this.emitCurrentTagToken();break;default:this.state=Z.ATTRIBUTE_VALUE_UNQUOTED,this._stateAttributeValueUnquoted(e)}}_stateAttributeValueDoubleQuoted(e){switch(e){case G.QUOTATION_MARK:this.state=Z.AFTER_ATTRIBUTE_VALUE_QUOTED;break;case G.AMPERSAND:this._startCharacterReference();break;case G.NULL:this._err(K.unexpectedNullCharacter),this.currentAttr.value+=`�`;break;case G.EOF:this._err(K.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueSingleQuoted(e){switch(e){case G.APOSTROPHE:this.state=Z.AFTER_ATTRIBUTE_VALUE_QUOTED;break;case G.AMPERSAND:this._startCharacterReference();break;case G.NULL:this._err(K.unexpectedNullCharacter),this.currentAttr.value+=`�`;break;case G.EOF:this._err(K.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueUnquoted(e){switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:this._leaveAttrValue(),this.state=Z.BEFORE_ATTRIBUTE_NAME;break;case G.AMPERSAND:this._startCharacterReference();break;case G.GREATER_THAN_SIGN:this._leaveAttrValue(),this.state=Z.DATA,this.emitCurrentTagToken();break;case G.NULL:this._err(K.unexpectedNullCharacter),this.currentAttr.value+=`�`;break;case G.QUOTATION_MARK:case G.APOSTROPHE:case G.LESS_THAN_SIGN:case G.EQUALS_SIGN:case G.GRAVE_ACCENT:this._err(K.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=String.fromCodePoint(e);break;case G.EOF:this._err(K.eofInTag),this._emitEOFToken();break;default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAfterAttributeValueQuoted(e){switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:this._leaveAttrValue(),this.state=Z.BEFORE_ATTRIBUTE_NAME;break;case G.SOLIDUS:this._leaveAttrValue(),this.state=Z.SELF_CLOSING_START_TAG;break;case G.GREATER_THAN_SIGN:this._leaveAttrValue(),this.state=Z.DATA,this.emitCurrentTagToken();break;case G.EOF:this._err(K.eofInTag),this._emitEOFToken();break;default:this._err(K.missingWhitespaceBetweenAttributes),this.state=Z.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateSelfClosingStartTag(e){switch(e){case G.GREATER_THAN_SIGN:{let e=this.currentToken;e.selfClosing=!0,this.state=Z.DATA,this.emitCurrentTagToken();break}case G.EOF:this._err(K.eofInTag),this._emitEOFToken();break;default:this._err(K.unexpectedSolidusInTag),this.state=Z.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateBogusComment(e){let t=this.currentToken;switch(e){case G.GREATER_THAN_SIGN:this.state=Z.DATA,this.emitCurrentComment(t);break;case G.EOF:this.emitCurrentComment(t),this._emitEOFToken();break;case G.NULL:this._err(K.unexpectedNullCharacter),t.data+=`�`;break;default:t.data+=String.fromCodePoint(e)}}_stateMarkupDeclarationOpen(e){this._consumeSequenceIfMatch(_h.DASH_DASH,!0)?(this._createCommentToken(_h.DASH_DASH.length+1),this.state=Z.COMMENT_START):this._consumeSequenceIfMatch(_h.DOCTYPE,!1)?(this.currentLocation=this.getCurrentLocation(_h.DOCTYPE.length+1),this.state=Z.DOCTYPE):this._consumeSequenceIfMatch(_h.CDATA_START,!0)?this.inForeignNode?this.state=Z.CDATA_SECTION:(this._err(K.cdataInHtmlContent),this._createCommentToken(_h.CDATA_START.length+1),this.currentToken.data=`[CDATA[`,this.state=Z.BOGUS_COMMENT):this._ensureHibernation()||(this._err(K.incorrectlyOpenedComment),this._createCommentToken(2),this.state=Z.BOGUS_COMMENT,this._stateBogusComment(e))}_stateCommentStart(e){switch(e){case G.HYPHEN_MINUS:this.state=Z.COMMENT_START_DASH;break;case G.GREATER_THAN_SIGN:{this._err(K.abruptClosingOfEmptyComment),this.state=Z.DATA;let e=this.currentToken;this.emitCurrentComment(e);break}default:this.state=Z.COMMENT,this._stateComment(e)}}_stateCommentStartDash(e){let t=this.currentToken;switch(e){case G.HYPHEN_MINUS:this.state=Z.COMMENT_END;break;case G.GREATER_THAN_SIGN:this._err(K.abruptClosingOfEmptyComment),this.state=Z.DATA,this.emitCurrentComment(t);break;case G.EOF:this._err(K.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`-`,this.state=Z.COMMENT,this._stateComment(e)}}_stateComment(e){let t=this.currentToken;switch(e){case G.HYPHEN_MINUS:this.state=Z.COMMENT_END_DASH;break;case G.LESS_THAN_SIGN:t.data+=`<`,this.state=Z.COMMENT_LESS_THAN_SIGN;break;case G.NULL:this._err(K.unexpectedNullCharacter),t.data+=`�`;break;case G.EOF:this._err(K.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=String.fromCodePoint(e)}}_stateCommentLessThanSign(e){let t=this.currentToken;switch(e){case G.EXCLAMATION_MARK:t.data+=`!`,this.state=Z.COMMENT_LESS_THAN_SIGN_BANG;break;case G.LESS_THAN_SIGN:t.data+=`<`;break;default:this.state=Z.COMMENT,this._stateComment(e)}}_stateCommentLessThanSignBang(e){e===G.HYPHEN_MINUS?this.state=Z.COMMENT_LESS_THAN_SIGN_BANG_DASH:(this.state=Z.COMMENT,this._stateComment(e))}_stateCommentLessThanSignBangDash(e){e===G.HYPHEN_MINUS?this.state=Z.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:(this.state=Z.COMMENT_END_DASH,this._stateCommentEndDash(e))}_stateCommentLessThanSignBangDashDash(e){e!==G.GREATER_THAN_SIGN&&e!==G.EOF&&this._err(K.nestedComment),this.state=Z.COMMENT_END,this._stateCommentEnd(e)}_stateCommentEndDash(e){let t=this.currentToken;switch(e){case G.HYPHEN_MINUS:this.state=Z.COMMENT_END;break;case G.EOF:this._err(K.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`-`,this.state=Z.COMMENT,this._stateComment(e)}}_stateCommentEnd(e){let t=this.currentToken;switch(e){case G.GREATER_THAN_SIGN:this.state=Z.DATA,this.emitCurrentComment(t);break;case G.EXCLAMATION_MARK:this.state=Z.COMMENT_END_BANG;break;case G.HYPHEN_MINUS:t.data+=`-`;break;case G.EOF:this._err(K.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`--`,this.state=Z.COMMENT,this._stateComment(e)}}_stateCommentEndBang(e){let t=this.currentToken;switch(e){case G.HYPHEN_MINUS:t.data+=`--!`,this.state=Z.COMMENT_END_DASH;break;case G.GREATER_THAN_SIGN:this._err(K.incorrectlyClosedComment),this.state=Z.DATA,this.emitCurrentComment(t);break;case G.EOF:this._err(K.eofInComment),this.emitCurrentComment(t),this._emitEOFToken();break;default:t.data+=`--!`,this.state=Z.COMMENT,this._stateComment(e)}}_stateDoctype(e){switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:this.state=Z.BEFORE_DOCTYPE_NAME;break;case G.GREATER_THAN_SIGN:this.state=Z.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e);break;case G.EOF:{this._err(K.eofInDoctype),this._createDoctypeToken(null);let e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break}default:this._err(K.missingWhitespaceBeforeDoctypeName),this.state=Z.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e)}}_stateBeforeDoctypeName(e){if(Yh(e))this._createDoctypeToken(String.fromCharCode($h(e))),this.state=Z.DOCTYPE_NAME;else switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:break;case G.NULL:this._err(K.unexpectedNullCharacter),this._createDoctypeToken(`�`),this.state=Z.DOCTYPE_NAME;break;case G.GREATER_THAN_SIGN:{this._err(K.missingDoctypeName),this._createDoctypeToken(null);let e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this.state=Z.DATA;break}case G.EOF:{this._err(K.eofInDoctype),this._createDoctypeToken(null);let e=this.currentToken;e.forceQuirks=!0,this.emitCurrentDoctype(e),this._emitEOFToken();break}default:this._createDoctypeToken(String.fromCodePoint(e)),this.state=Z.DOCTYPE_NAME}}_stateDoctypeName(e){let t=this.currentToken;switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:this.state=Z.AFTER_DOCTYPE_NAME;break;case G.GREATER_THAN_SIGN:this.state=Z.DATA,this.emitCurrentDoctype(t);break;case G.NULL:this._err(K.unexpectedNullCharacter),t.name+=`�`;break;case G.EOF:this._err(K.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.name+=String.fromCodePoint(Yh(e)?$h(e):e)}}_stateAfterDoctypeName(e){let t=this.currentToken;switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:break;case G.GREATER_THAN_SIGN:this.state=Z.DATA,this.emitCurrentDoctype(t);break;case G.EOF:this._err(K.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._consumeSequenceIfMatch(_h.PUBLIC,!1)?this.state=Z.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._consumeSequenceIfMatch(_h.SYSTEM,!1)?this.state=Z.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._ensureHibernation()||(this._err(K.invalidCharacterSequenceAfterDoctypeName),t.forceQuirks=!0,this.state=Z.BOGUS_DOCTYPE,this._stateBogusDoctype(e))}}_stateAfterDoctypePublicKeyword(e){let t=this.currentToken;switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:this.state=Z.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER;break;case G.QUOTATION_MARK:this._err(K.missingWhitespaceAfterDoctypePublicKeyword),t.publicId=``,this.state=Z.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break;case G.APOSTROPHE:this._err(K.missingWhitespaceAfterDoctypePublicKeyword),t.publicId=``,this.state=Z.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break;case G.GREATER_THAN_SIGN:this._err(K.missingDoctypePublicIdentifier),t.forceQuirks=!0,this.state=Z.DATA,this.emitCurrentDoctype(t);break;case G.EOF:this._err(K.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(K.missingQuoteBeforeDoctypePublicIdentifier),t.forceQuirks=!0,this.state=Z.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypePublicIdentifier(e){let t=this.currentToken;switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:break;case G.QUOTATION_MARK:t.publicId=``,this.state=Z.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break;case G.APOSTROPHE:t.publicId=``,this.state=Z.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break;case G.GREATER_THAN_SIGN:this._err(K.missingDoctypePublicIdentifier),t.forceQuirks=!0,this.state=Z.DATA,this.emitCurrentDoctype(t);break;case G.EOF:this._err(K.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(K.missingQuoteBeforeDoctypePublicIdentifier),t.forceQuirks=!0,this.state=Z.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypePublicIdentifierDoubleQuoted(e){let t=this.currentToken;switch(e){case G.QUOTATION_MARK:this.state=Z.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break;case G.NULL:this._err(K.unexpectedNullCharacter),t.publicId+=`�`;break;case G.GREATER_THAN_SIGN:this._err(K.abruptDoctypePublicIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=Z.DATA;break;case G.EOF:this._err(K.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.publicId+=String.fromCodePoint(e)}}_stateDoctypePublicIdentifierSingleQuoted(e){let t=this.currentToken;switch(e){case G.APOSTROPHE:this.state=Z.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break;case G.NULL:this._err(K.unexpectedNullCharacter),t.publicId+=`�`;break;case G.GREATER_THAN_SIGN:this._err(K.abruptDoctypePublicIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=Z.DATA;break;case G.EOF:this._err(K.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.publicId+=String.fromCodePoint(e)}}_stateAfterDoctypePublicIdentifier(e){let t=this.currentToken;switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:this.state=Z.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS;break;case G.GREATER_THAN_SIGN:this.state=Z.DATA,this.emitCurrentDoctype(t);break;case G.QUOTATION_MARK:this._err(K.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),t.systemId=``,this.state=Z.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case G.APOSTROPHE:this._err(K.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),t.systemId=``,this.state=Z.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case G.EOF:this._err(K.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(K.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Z.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBetweenDoctypePublicAndSystemIdentifiers(e){let t=this.currentToken;switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:break;case G.GREATER_THAN_SIGN:this.emitCurrentDoctype(t),this.state=Z.DATA;break;case G.QUOTATION_MARK:t.systemId=``,this.state=Z.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case G.APOSTROPHE:t.systemId=``,this.state=Z.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case G.EOF:this._err(K.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(K.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Z.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateAfterDoctypeSystemKeyword(e){let t=this.currentToken;switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:this.state=Z.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER;break;case G.QUOTATION_MARK:this._err(K.missingWhitespaceAfterDoctypeSystemKeyword),t.systemId=``,this.state=Z.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case G.APOSTROPHE:this._err(K.missingWhitespaceAfterDoctypeSystemKeyword),t.systemId=``,this.state=Z.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case G.GREATER_THAN_SIGN:this._err(K.missingDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Z.DATA,this.emitCurrentDoctype(t);break;case G.EOF:this._err(K.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(K.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Z.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypeSystemIdentifier(e){let t=this.currentToken;switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:break;case G.QUOTATION_MARK:t.systemId=``,this.state=Z.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break;case G.APOSTROPHE:t.systemId=``,this.state=Z.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break;case G.GREATER_THAN_SIGN:this._err(K.missingDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Z.DATA,this.emitCurrentDoctype(t);break;case G.EOF:this._err(K.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(K.missingQuoteBeforeDoctypeSystemIdentifier),t.forceQuirks=!0,this.state=Z.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypeSystemIdentifierDoubleQuoted(e){let t=this.currentToken;switch(e){case G.QUOTATION_MARK:this.state=Z.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break;case G.NULL:this._err(K.unexpectedNullCharacter),t.systemId+=`�`;break;case G.GREATER_THAN_SIGN:this._err(K.abruptDoctypeSystemIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=Z.DATA;break;case G.EOF:this._err(K.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.systemId+=String.fromCodePoint(e)}}_stateDoctypeSystemIdentifierSingleQuoted(e){let t=this.currentToken;switch(e){case G.APOSTROPHE:this.state=Z.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break;case G.NULL:this._err(K.unexpectedNullCharacter),t.systemId+=`�`;break;case G.GREATER_THAN_SIGN:this._err(K.abruptDoctypeSystemIdentifier),t.forceQuirks=!0,this.emitCurrentDoctype(t),this.state=Z.DATA;break;case G.EOF:this._err(K.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:t.systemId+=String.fromCodePoint(e)}}_stateAfterDoctypeSystemIdentifier(e){let t=this.currentToken;switch(e){case G.SPACE:case G.LINE_FEED:case G.TABULATION:case G.FORM_FEED:break;case G.GREATER_THAN_SIGN:this.emitCurrentDoctype(t),this.state=Z.DATA;break;case G.EOF:this._err(K.eofInDoctype),t.forceQuirks=!0,this.emitCurrentDoctype(t),this._emitEOFToken();break;default:this._err(K.unexpectedCharacterAfterDoctypeSystemIdentifier),this.state=Z.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBogusDoctype(e){let t=this.currentToken;switch(e){case G.GREATER_THAN_SIGN:this.emitCurrentDoctype(t),this.state=Z.DATA;break;case G.NULL:this._err(K.unexpectedNullCharacter);break;case G.EOF:this.emitCurrentDoctype(t),this._emitEOFToken();break;default:}}_stateCdataSection(e){switch(e){case G.RIGHT_SQUARE_BRACKET:this.state=Z.CDATA_SECTION_BRACKET;break;case G.EOF:this._err(K.eofInCdata),this._emitEOFToken();break;default:this._emitCodePoint(e)}}_stateCdataSectionBracket(e){e===G.RIGHT_SQUARE_BRACKET?this.state=Z.CDATA_SECTION_END:(this._emitChars(`]`),this.state=Z.CDATA_SECTION,this._stateCdataSection(e))}_stateCdataSectionEnd(e){switch(e){case G.GREATER_THAN_SIGN:this.state=Z.DATA;break;case G.RIGHT_SQUARE_BRACKET:this._emitChars(`]`);break;default:this._emitChars(`]]`),this.state=Z.CDATA_SECTION,this._stateCdataSection(e)}}_stateCharacterReference(){let e=this.entityDecoder.write(this.preprocessor.html,this.preprocessor.pos);if(e<0)if(this.preprocessor.lastChunkWritten)e=this.entityDecoder.end();else{this.active=!1,this.preprocessor.pos=this.preprocessor.html.length-1,this.consumedAfterSnapshot=0,this.preprocessor.endOfChunkHit=!0;return}e===0?(this.preprocessor.pos=this.entityStartPos,this._flushCodePointConsumedAsCharacterReference(G.AMPERSAND),this.state=!this._isCharacterReferenceInAttribute()&&Qh(this.preprocessor.peek(1))?Z.AMBIGUOUS_AMPERSAND:this.returnState):this.state=this.returnState}_stateAmbiguousAmpersand(e){Qh(e)?this._flushCodePointConsumedAsCharacterReference(e):(e===G.SEMICOLON&&this._err(K.unknownNamedCharacterReference),this.state=this.returnState,this._callState(e))}},ig=new Set([Y.DD,Y.DT,Y.LI,Y.OPTGROUP,Y.OPTION,Y.P,Y.RB,Y.RP,Y.RT,Y.RTC]),ag=new Set([...ig,Y.CAPTION,Y.COLGROUP,Y.TBODY,Y.TD,Y.TFOOT,Y.TH,Y.THEAD,Y.TR]),og=new Set([Y.APPLET,Y.CAPTION,Y.HTML,Y.MARQUEE,Y.OBJECT,Y.TABLE,Y.TD,Y.TEMPLATE,Y.TH]),sg=new Set([...og,Y.OL,Y.UL]),cg=new Set([...og,Y.BUTTON]),lg=new Set([Y.ANNOTATION_XML,Y.MI,Y.MN,Y.MO,Y.MS,Y.MTEXT]),ug=new Set([Y.DESC,Y.FOREIGN_OBJECT,Y.TITLE]),dg=new Set([Y.TR,Y.TEMPLATE,Y.HTML]),fg=new Set([Y.TBODY,Y.TFOOT,Y.THEAD,Y.TEMPLATE,Y.HTML]),pg=new Set([Y.TABLE,Y.TEMPLATE,Y.HTML]),mg=new Set([Y.TD,Y.TH]),hg=class{get currentTmplContentOrNode(){return this._isInTemplate()?this.treeAdapter.getTemplateContent(this.current):this.current}constructor(e,t,n){this.treeAdapter=t,this.handler=n,this.items=[],this.tagIDs=[],this.stackTop=-1,this.tmplCount=0,this.currentTagId=Y.UNKNOWN,this.current=e}_indexOf(e){return this.items.lastIndexOf(e,this.stackTop)}_isInTemplate(){return this.currentTagId===Y.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===q.HTML}_updateCurrentElement(){this.current=this.items[this.stackTop],this.currentTagId=this.tagIDs[this.stackTop]}push(e,t){this.stackTop++,this.items[this.stackTop]=e,this.current=e,this.tagIDs[this.stackTop]=t,this.currentTagId=t,this._isInTemplate()&&this.tmplCount++,this.handler.onItemPush(e,t,!0)}pop(){let e=this.current;this.tmplCount>0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!0)}replace(e,t){let n=this._indexOf(e);this.items[n]=t,n===this.stackTop&&(this.current=t)}insertAfter(e,t,n){let r=this._indexOf(e)+1;this.items.splice(r,0,t),this.tagIDs.splice(r,0,n),this.stackTop++,r===this.stackTop&&this._updateCurrentElement(),this.current&&this.currentTagId!==void 0&&this.handler.onItemPush(this.current,this.currentTagId,r===this.stackTop)}popUntilTagNamePopped(e){let t=this.stackTop+1;do t=this.tagIDs.lastIndexOf(e,t-1);while(t>0&&this.treeAdapter.getNamespaceURI(this.items[t])!==q.HTML);this.shortenToLength(Math.max(t,0))}shortenToLength(e){for(;this.stackTop>=e;){let t=this.current;this.tmplCount>0&&this._isInTemplate()&&--this.tmplCount,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,this.stackTop<e)}}popUntilElementPopped(e){let t=this._indexOf(e);this.shortenToLength(Math.max(t,0))}popUntilPopped(e,t){let n=this._indexOfTagNames(e,t);this.shortenToLength(Math.max(n,0))}popUntilNumberedHeaderPopped(){this.popUntilPopped(Kh,q.HTML)}popUntilTableCellPopped(){this.popUntilPopped(mg,q.HTML)}popAllUpToHtmlElement(){this.tmplCount=0,this.shortenToLength(1)}_indexOfTagNames(e,t){for(let n=this.stackTop;n>=0;n--)if(e.has(this.tagIDs[n])&&this.treeAdapter.getNamespaceURI(this.items[n])===t)return n;return-1}clearBackTo(e,t){let n=this._indexOfTagNames(e,t);this.shortenToLength(n+1)}clearBackToTableContext(){this.clearBackTo(pg,q.HTML)}clearBackToTableBodyContext(){this.clearBackTo(fg,q.HTML)}clearBackToTableRowContext(){this.clearBackTo(dg,q.HTML)}remove(e){let t=this._indexOf(e);t>=0&&(t===this.stackTop?this.pop():(this.items.splice(t,1),this.tagIDs.splice(t,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===Y.BODY?this.items[1]:null}contains(e){return this._indexOf(e)>-1}getCommonAncestor(e){let t=this._indexOf(e)-1;return t>=0?this.items[t]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.tagIDs[0]===Y.HTML}hasInDynamicScope(e,t){for(let n=this.stackTop;n>=0;n--){let r=this.tagIDs[n];switch(this.treeAdapter.getNamespaceURI(this.items[n])){case q.HTML:if(r===e)return!0;if(t.has(r))return!1;break;case q.SVG:if(ug.has(r))return!1;break;case q.MATHML:if(lg.has(r))return!1;break}}return!0}hasInScope(e){return this.hasInDynamicScope(e,og)}hasInListItemScope(e){return this.hasInDynamicScope(e,sg)}hasInButtonScope(e){return this.hasInDynamicScope(e,cg)}hasNumberedHeaderInScope(){for(let e=this.stackTop;e>=0;e--){let t=this.tagIDs[e];switch(this.treeAdapter.getNamespaceURI(this.items[e])){case q.HTML:if(Kh.has(t))return!0;if(og.has(t))return!1;break;case q.SVG:if(ug.has(t))return!1;break;case q.MATHML:if(lg.has(t))return!1;break}}return!0}hasInTableScope(e){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===q.HTML)switch(this.tagIDs[t]){case e:return!0;case Y.TABLE:case Y.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let e=this.stackTop;e>=0;e--)if(this.treeAdapter.getNamespaceURI(this.items[e])===q.HTML)switch(this.tagIDs[e]){case Y.TBODY:case Y.THEAD:case Y.TFOOT:return!0;case Y.TABLE:case Y.HTML:return!1}return!0}hasInSelectScope(e){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===q.HTML)switch(this.tagIDs[t]){case e:return!0;case Y.OPTION:case Y.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&ig.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&ag.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(e){for(;this.currentTagId!==void 0&&this.currentTagId!==e&&ag.has(this.currentTagId);)this.pop()}},gg=3,_g;(function(e){e[e.Marker=0]=`Marker`,e[e.Element=1]=`Element`})(_g||={});var vg={type:_g.Marker},yg=class{constructor(e){this.treeAdapter=e,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(e,t){let n=[],r=t.length,i=this.treeAdapter.getTagName(e),a=this.treeAdapter.getNamespaceURI(e);for(let e=0;e<this.entries.length;e++){let t=this.entries[e];if(t.type===_g.Marker)break;let{element:o}=t;if(this.treeAdapter.getTagName(o)===i&&this.treeAdapter.getNamespaceURI(o)===a){let t=this.treeAdapter.getAttrList(o);t.length===r&&n.push({idx:e,attrs:t})}}return n}_ensureNoahArkCondition(e){if(this.entries.length<gg)return;let t=this.treeAdapter.getAttrList(e),n=this._getNoahArkConditionCandidates(e,t);if(n.length<gg)return;let r=new Map(t.map(e=>[e.name,e.value])),i=0;for(let e=0;e<n.length;e++){let t=n[e];t.attrs.every(e=>r.get(e.name)===e.value)&&(i+=1,i>=gg&&this.entries.splice(t.idx,1))}}insertMarker(){this.entries.unshift(vg)}pushElement(e,t){this._ensureNoahArkCondition(e),this.entries.unshift({type:_g.Element,element:e,token:t})}insertElementAfterBookmark(e,t){let n=this.entries.indexOf(this.bookmark);this.entries.splice(n,0,{type:_g.Element,element:e,token:t})}removeEntry(e){let t=this.entries.indexOf(e);t!==-1&&this.entries.splice(t,1)}clearToLastMarker(){let e=this.entries.indexOf(vg);e===-1?this.entries.length=0:this.entries.splice(0,e+1)}getElementEntryInScopeWithTagName(e){let t=this.entries.find(t=>t.type===_g.Marker||this.treeAdapter.getTagName(t.element)===e);return t&&t.type===_g.Element?t:null}getElementEntry(e){return this.entries.find(t=>t.type===_g.Element&&t.element===e)}},bg={createDocument(){return{nodeName:`#document`,mode:Hh.NO_QUIRKS,childNodes:[]}},createDocumentFragment(){return{nodeName:`#document-fragment`,childNodes:[]}},createElement(e,t,n){return{nodeName:e,tagName:e,attrs:n,namespaceURI:t,childNodes:[],parentNode:null}},createCommentNode(e){return{nodeName:`#comment`,data:e,parentNode:null}},createTextNode(e){return{nodeName:`#text`,value:e,parentNode:null}},appendChild(e,t){e.childNodes.push(t),t.parentNode=e},insertBefore(e,t,n){let r=e.childNodes.indexOf(n);e.childNodes.splice(r,0,t),t.parentNode=e},setTemplateContent(e,t){e.content=t},getTemplateContent(e){return e.content},setDocumentType(e,t,n,r){let i=e.childNodes.find(e=>e.nodeName===`#documentType`);if(i)i.name=t,i.publicId=n,i.systemId=r;else{let i={nodeName:`#documentType`,name:t,publicId:n,systemId:r,parentNode:null};bg.appendChild(e,i)}},setDocumentMode(e,t){e.mode=t},getDocumentMode(e){return e.mode},detachNode(e){if(e.parentNode){let t=e.parentNode.childNodes.indexOf(e);e.parentNode.childNodes.splice(t,1),e.parentNode=null}},insertText(e,t){if(e.childNodes.length>0){let n=e.childNodes[e.childNodes.length-1];if(bg.isTextNode(n)){n.value+=t;return}}bg.appendChild(e,bg.createTextNode(t))},insertTextBefore(e,t,n){let r=e.childNodes[e.childNodes.indexOf(n)-1];r&&bg.isTextNode(r)?r.value+=t:bg.insertBefore(e,bg.createTextNode(t),n)},adoptAttributes(e,t){let n=new Set(e.attrs.map(e=>e.name));for(let r=0;r<t.length;r++)n.has(t[r].name)||e.attrs.push(t[r])},getFirstChild(e){return e.childNodes[0]},getChildNodes(e){return e.childNodes},getParentNode(e){return e.parentNode},getAttrList(e){return e.attrs},getTagName(e){return e.tagName},getNamespaceURI(e){return e.namespaceURI},getTextNodeContent(e){return e.value},getCommentNodeContent(e){return e.data},getDocumentTypeNodeName(e){return e.name},getDocumentTypeNodePublicId(e){return e.publicId},getDocumentTypeNodeSystemId(e){return e.systemId},isTextNode(e){return e.nodeName===`#text`},isCommentNode(e){return e.nodeName===`#comment`},isDocumentTypeNode(e){return e.nodeName===`#documentType`},isElementNode(e){return Object.prototype.hasOwnProperty.call(e,`tagName`)},setNodeSourceCodeLocation(e,t){e.sourceCodeLocation=t},getNodeSourceCodeLocation(e){return e.sourceCodeLocation},updateNodeSourceCodeLocation(e,t){e.sourceCodeLocation={...e.sourceCodeLocation,...t}}},xg=`html`,Sg=`about:legacy-compat`,Cg=`http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd`,wg=`+//silmaril//dtd html pro v0r11 19970101//,-//as//dtd html 3.0 aswedit + extensions//,-//advasoft ltd//dtd html 3.0 aswedit + extensions//,-//ietf//dtd html 2.0 level 1//,-//ietf//dtd html 2.0 level 2//,-//ietf//dtd html 2.0 strict level 1//,-//ietf//dtd html 2.0 strict level 2//,-//ietf//dtd html 2.0 strict//,-//ietf//dtd html 2.0//,-//ietf//dtd html 2.1e//,-//ietf//dtd html 3.0//,-//ietf//dtd html 3.2 final//,-//ietf//dtd html 3.2//,-//ietf//dtd html 3//,-//ietf//dtd html level 0//,-//ietf//dtd html level 1//,-//ietf//dtd html level 2//,-//ietf//dtd html level 3//,-//ietf//dtd html strict level 0//,-//ietf//dtd html strict level 1//,-//ietf//dtd html strict level 2//,-//ietf//dtd html strict level 3//,-//ietf//dtd html strict//,-//ietf//dtd html//,-//metrius//dtd metrius presentational//,-//microsoft//dtd internet explorer 2.0 html strict//,-//microsoft//dtd internet explorer 2.0 html//,-//microsoft//dtd internet explorer 2.0 tables//,-//microsoft//dtd internet explorer 3.0 html strict//,-//microsoft//dtd internet explorer 3.0 html//,-//microsoft//dtd internet explorer 3.0 tables//,-//netscape comm. corp.//dtd html//,-//netscape comm. corp.//dtd strict html//,-//o'reilly and associates//dtd html 2.0//,-//o'reilly and associates//dtd html extended 1.0//,-//o'reilly and associates//dtd html extended relaxed 1.0//,-//sq//dtd html 2.0 hotmetal + extensions//,-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//,-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//,-//spyglass//dtd html 2.0 extended//,-//sun microsystems corp.//dtd hotjava html//,-//sun microsystems corp.//dtd hotjava strict html//,-//w3c//dtd html 3 1995-03-24//,-//w3c//dtd html 3.2 draft//,-//w3c//dtd html 3.2 final//,-//w3c//dtd html 3.2//,-//w3c//dtd html 3.2s draft//,-//w3c//dtd html 4.0 frameset//,-//w3c//dtd html 4.0 transitional//,-//w3c//dtd html experimental 19960712//,-//w3c//dtd html experimental 970421//,-//w3c//dtd w3 html//,-//w3o//dtd w3 html 3.0//,-//webtechs//dtd mozilla html 2.0//,-//webtechs//dtd mozilla html//`.split(`,`),Tg=[...wg,`-//w3c//dtd html 4.01 frameset//`,`-//w3c//dtd html 4.01 transitional//`],Eg=new Set([`-//w3o//dtd w3 html strict 3.0//en//`,`-/w3c/dtd html 4.0 transitional/en`,`html`]),Dg=[`-//w3c//dtd xhtml 1.0 frameset//`,`-//w3c//dtd xhtml 1.0 transitional//`],Og=[...Dg,`-//w3c//dtd html 4.01 frameset//`,`-//w3c//dtd html 4.01 transitional//`];function kg(e,t){return t.some(t=>e.startsWith(t))}function Ag(e){return e.name===xg&&e.publicId===null&&(e.systemId===null||e.systemId===Sg)}function jg(e){if(e.name!==xg)return Hh.QUIRKS;let{systemId:t}=e;if(t&&t.toLowerCase()===Cg)return Hh.QUIRKS;let{publicId:n}=e;if(n!==null){if(n=n.toLowerCase(),Eg.has(n))return Hh.QUIRKS;let e=t===null?Tg:wg;if(kg(n,e))return Hh.QUIRKS;if(e=t===null?Dg:Og,kg(n,e))return Hh.LIMITED_QUIRKS}return Hh.NO_QUIRKS}var Mg={TEXT_HTML:`text/html`,APPLICATION_XML:`application/xhtml+xml`},Ng=`definitionurl`,Pg=`definitionURL`,Fg=new Map(`attributeName.attributeType.baseFrequency.baseProfile.calcMode.clipPathUnits.diffuseConstant.edgeMode.filterUnits.glyphRef.gradientTransform.gradientUnits.kernelMatrix.kernelUnitLength.keyPoints.keySplines.keyTimes.lengthAdjust.limitingConeAngle.markerHeight.markerUnits.markerWidth.maskContentUnits.maskUnits.numOctaves.pathLength.patternContentUnits.patternTransform.patternUnits.pointsAtX.pointsAtY.pointsAtZ.preserveAlpha.preserveAspectRatio.primitiveUnits.refX.refY.repeatCount.repeatDur.requiredExtensions.requiredFeatures.specularConstant.specularExponent.spreadMethod.startOffset.stdDeviation.stitchTiles.surfaceScale.systemLanguage.tableValues.targetX.targetY.textLength.viewBox.viewTarget.xChannelSelector.yChannelSelector.zoomAndPan`.split(`.`).map(e=>[e.toLowerCase(),e])),Ig=new Map([[`xlink:actuate`,{prefix:`xlink`,name:`actuate`,namespace:q.XLINK}],[`xlink:arcrole`,{prefix:`xlink`,name:`arcrole`,namespace:q.XLINK}],[`xlink:href`,{prefix:`xlink`,name:`href`,namespace:q.XLINK}],[`xlink:role`,{prefix:`xlink`,name:`role`,namespace:q.XLINK}],[`xlink:show`,{prefix:`xlink`,name:`show`,namespace:q.XLINK}],[`xlink:title`,{prefix:`xlink`,name:`title`,namespace:q.XLINK}],[`xlink:type`,{prefix:`xlink`,name:`type`,namespace:q.XLINK}],[`xml:lang`,{prefix:`xml`,name:`lang`,namespace:q.XML}],[`xml:space`,{prefix:`xml`,name:`space`,namespace:q.XML}],[`xmlns`,{prefix:``,name:`xmlns`,namespace:q.XMLNS}],[`xmlns:xlink`,{prefix:`xmlns`,name:`xlink`,namespace:q.XMLNS}]]),Lg=new Map(`altGlyph.altGlyphDef.altGlyphItem.animateColor.animateMotion.animateTransform.clipPath.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDistantLight.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.foreignObject.glyphRef.linearGradient.radialGradient.textPath`.split(`.`).map(e=>[e.toLowerCase(),e])),Rg=new Set([Y.B,Y.BIG,Y.BLOCKQUOTE,Y.BODY,Y.BR,Y.CENTER,Y.CODE,Y.DD,Y.DIV,Y.DL,Y.DT,Y.EM,Y.EMBED,Y.H1,Y.H2,Y.H3,Y.H4,Y.H5,Y.H6,Y.HEAD,Y.HR,Y.I,Y.IMG,Y.LI,Y.LISTING,Y.MENU,Y.META,Y.NOBR,Y.OL,Y.P,Y.PRE,Y.RUBY,Y.S,Y.SMALL,Y.SPAN,Y.STRONG,Y.STRIKE,Y.SUB,Y.SUP,Y.TABLE,Y.TT,Y.U,Y.UL,Y.VAR]);function zg(e){let t=e.tagID;return t===Y.FONT&&e.attrs.some(({name:e})=>e===Vh.COLOR||e===Vh.SIZE||e===Vh.FACE)||Rg.has(t)}function Bg(e){for(let t=0;t<e.attrs.length;t++)if(e.attrs[t].name===Ng){e.attrs[t].name=Pg;break}}function Vg(e){for(let t=0;t<e.attrs.length;t++){let n=Fg.get(e.attrs[t].name);n!=null&&(e.attrs[t].name=n)}}function Hg(e){for(let t=0;t<e.attrs.length;t++){let n=Ig.get(e.attrs[t].name);n&&(e.attrs[t].prefix=n.prefix,e.attrs[t].name=n.name,e.attrs[t].namespace=n.namespace)}}function Ug(e){let t=Lg.get(e.tagName);t!=null&&(e.tagName=t,e.tagID=Wh(e.tagName))}function Wg(e,t){return t===q.MATHML&&(e===Y.MI||e===Y.MO||e===Y.MN||e===Y.MS||e===Y.MTEXT)}function Gg(e,t,n){if(t===q.MATHML&&e===Y.ANNOTATION_XML){for(let e=0;e<n.length;e++)if(n[e].name===Vh.ENCODING){let t=n[e].value.toLowerCase();return t===Mg.TEXT_HTML||t===Mg.APPLICATION_XML}}return t===q.SVG&&(e===Y.FOREIGN_OBJECT||e===Y.DESC||e===Y.TITLE)}function Kg(e,t,n,r){return(!r||r===q.HTML)&&Gg(e,t,n)||(!r||r===q.MATHML)&&Wg(e,t)}var qg=`hidden`,Jg=8,Yg=3,Q;(function(e){e[e.INITIAL=0]=`INITIAL`,e[e.BEFORE_HTML=1]=`BEFORE_HTML`,e[e.BEFORE_HEAD=2]=`BEFORE_HEAD`,e[e.IN_HEAD=3]=`IN_HEAD`,e[e.IN_HEAD_NO_SCRIPT=4]=`IN_HEAD_NO_SCRIPT`,e[e.AFTER_HEAD=5]=`AFTER_HEAD`,e[e.IN_BODY=6]=`IN_BODY`,e[e.TEXT=7]=`TEXT`,e[e.IN_TABLE=8]=`IN_TABLE`,e[e.IN_TABLE_TEXT=9]=`IN_TABLE_TEXT`,e[e.IN_CAPTION=10]=`IN_CAPTION`,e[e.IN_COLUMN_GROUP=11]=`IN_COLUMN_GROUP`,e[e.IN_TABLE_BODY=12]=`IN_TABLE_BODY`,e[e.IN_ROW=13]=`IN_ROW`,e[e.IN_CELL=14]=`IN_CELL`,e[e.IN_SELECT=15]=`IN_SELECT`,e[e.IN_SELECT_IN_TABLE=16]=`IN_SELECT_IN_TABLE`,e[e.IN_TEMPLATE=17]=`IN_TEMPLATE`,e[e.AFTER_BODY=18]=`AFTER_BODY`,e[e.IN_FRAMESET=19]=`IN_FRAMESET`,e[e.AFTER_FRAMESET=20]=`AFTER_FRAMESET`,e[e.AFTER_AFTER_BODY=21]=`AFTER_AFTER_BODY`,e[e.AFTER_AFTER_FRAMESET=22]=`AFTER_AFTER_FRAMESET`})(Q||={});var Xg={startLine:-1,startCol:-1,startOffset:-1,endLine:-1,endCol:-1,endOffset:-1},Zg=new Set([Y.TABLE,Y.TBODY,Y.TFOOT,Y.THEAD,Y.TR]),Qg={scriptingEnabled:!0,sourceCodeLocationInfo:!1,treeAdapter:bg,onParseError:null},$g=class{constructor(e,t,n=null,r=null){this.fragmentContext=n,this.scriptHandler=r,this.currentToken=null,this.stopped=!1,this.insertionMode=Q.INITIAL,this.originalInsertionMode=Q.INITIAL,this.headElement=null,this.formElement=null,this.currentNotInHTML=!1,this.tmplInsertionModeStack=[],this.pendingCharacterTokens=[],this.hasNonWhitespacePendingCharacterToken=!1,this.framesetOk=!0,this.skipNextNewLine=!1,this.fosterParentingEnabled=!1,this.options={...Qg,...e},this.treeAdapter=this.options.treeAdapter,this.onParseError=this.options.onParseError,this.onParseError&&(this.options.sourceCodeLocationInfo=!0),this.document=t??this.treeAdapter.createDocument(),this.tokenizer=new rg(this.options,this),this.activeFormattingElements=new yg(this.treeAdapter),this.fragmentContextID=n?Wh(this.treeAdapter.getTagName(n)):Y.UNKNOWN,this._setContextModes(n??this.document,this.fragmentContextID),this.openElements=new hg(this.document,this.treeAdapter,this)}static parse(e,t){let n=new this(t);return n.tokenizer.write(e,!0),n.document}static getFragmentParser(e,t){let n={...Qg,...t};e??=n.treeAdapter.createElement(J.TEMPLATE,q.HTML,[]);let r=n.treeAdapter.createElement(`documentmock`,q.HTML,[]),i=new this(n,r,e);return i.fragmentContextID===Y.TEMPLATE&&i.tmplInsertionModeStack.unshift(Q.IN_TEMPLATE),i._initTokenizerForFragmentParsing(),i._insertFakeRootElement(),i._resetInsertionMode(),i._findFormInFragmentContext(),i}getFragment(){let e=this.treeAdapter.getFirstChild(this.document),t=this.treeAdapter.createDocumentFragment();return this._adoptNodes(e,t),t}_err(e,t,n){if(!this.onParseError)return;let r=e.location??Xg,i={code:t,startLine:r.startLine,startCol:r.startCol,startOffset:r.startOffset,endLine:n?r.startLine:r.endLine,endCol:n?r.startCol:r.endCol,endOffset:n?r.startOffset:r.endOffset};this.onParseError(i)}onItemPush(e,t,n){var r,i;(i=(r=this.treeAdapter).onItemPush)==null||i.call(r,e),n&&this.openElements.stackTop>0&&this._setContextModes(e,t)}onItemPop(e,t){var n,r;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(e,this.currentToken),(r=(n=this.treeAdapter).onItemPop)==null||r.call(n,e,this.openElements.current),t){let e,t;this.openElements.stackTop===0&&this.fragmentContext?(e=this.fragmentContext,t=this.fragmentContextID):{current:e,currentTagId:t}=this.openElements,this._setContextModes(e,t)}}_setContextModes(e,t){let n=e===this.document||e&&this.treeAdapter.getNamespaceURI(e)===q.HTML;this.currentNotInHTML=!n,this.tokenizer.inForeignNode=!n&&e!==void 0&&t!==void 0&&!this._isIntegrationPoint(t,e)}_switchToTextParsing(e,t){this._insertElement(e,q.HTML),this.tokenizer.state=t,this.originalInsertionMode=this.insertionMode,this.insertionMode=Q.TEXT}switchToPlaintextParsing(){this.insertionMode=Q.TEXT,this.originalInsertionMode=Q.IN_BODY,this.tokenizer.state=qh.PLAINTEXT}_getAdjustedCurrentElement(){return this.openElements.stackTop===0&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let e=this.fragmentContext;for(;e;){if(this.treeAdapter.getTagName(e)===J.FORM){this.formElement=e;break}e=this.treeAdapter.getParentNode(e)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==q.HTML))switch(this.fragmentContextID){case Y.TITLE:case Y.TEXTAREA:this.tokenizer.state=qh.RCDATA;break;case Y.STYLE:case Y.XMP:case Y.IFRAME:case Y.NOEMBED:case Y.NOFRAMES:case Y.NOSCRIPT:this.tokenizer.state=qh.RAWTEXT;break;case Y.SCRIPT:this.tokenizer.state=qh.SCRIPT_DATA;break;case Y.PLAINTEXT:this.tokenizer.state=qh.PLAINTEXT;break;default:}}_setDocumentType(e){let t=e.name||``,n=e.publicId||``,r=e.systemId||``;if(this.treeAdapter.setDocumentType(this.document,t,n,r),e.location){let t=this.treeAdapter.getChildNodes(this.document).find(e=>this.treeAdapter.isDocumentTypeNode(e));t&&this.treeAdapter.setNodeSourceCodeLocation(t,e.location)}}_attachElementToTree(e,t){if(this.options.sourceCodeLocationInfo){let n=t&&{...t,startTag:t};this.treeAdapter.setNodeSourceCodeLocation(e,n)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(e);else{let t=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(t??this.document,e)}}_appendElement(e,t){let n=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(n,e.location)}_insertElement(e,t){let n=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(n,e.location),this.openElements.push(n,e.tagID)}_insertFakeElement(e,t){let n=this.treeAdapter.createElement(e,q.HTML,[]);this._attachElementToTree(n,null),this.openElements.push(n,t)}_insertTemplate(e){let t=this.treeAdapter.createElement(e.tagName,q.HTML,e.attrs),n=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(t,n),this._attachElementToTree(t,e.location),this.openElements.push(t,e.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(n,null)}_insertFakeRootElement(){let e=this.treeAdapter.createElement(J.HTML,q.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(e,null),this.treeAdapter.appendChild(this.openElements.current,e),this.openElements.push(e,Y.HTML)}_appendCommentNode(e,t){let n=this.treeAdapter.createCommentNode(e.data);this.treeAdapter.appendChild(t,n),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(n,e.location)}_insertCharacters(e){let t,n;if(this._shouldFosterParentOnInsertion()?({parent:t,beforeElement:n}=this._findFosterParentingLocation(),n?this.treeAdapter.insertTextBefore(t,e.chars,n):this.treeAdapter.insertText(t,e.chars)):(t=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(t,e.chars)),!e.location)return;let r=this.treeAdapter.getChildNodes(t),i=r[(n?r.lastIndexOf(n):r.length)-1];if(this.treeAdapter.getNodeSourceCodeLocation(i)){let{endLine:t,endCol:n,endOffset:r}=e.location;this.treeAdapter.updateNodeSourceCodeLocation(i,{endLine:t,endCol:n,endOffset:r})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(i,e.location)}_adoptNodes(e,t){for(let n=this.treeAdapter.getFirstChild(e);n;n=this.treeAdapter.getFirstChild(e))this.treeAdapter.detachNode(n),this.treeAdapter.appendChild(t,n)}_setEndLocation(e,t){if(this.treeAdapter.getNodeSourceCodeLocation(e)&&t.location){let n=t.location,r=this.treeAdapter.getTagName(e),i=t.type===Th.END_TAG&&r===t.tagName?{endTag:{...n},endLine:n.endLine,endCol:n.endCol,endOffset:n.endOffset}:{endLine:n.startLine,endCol:n.startCol,endOffset:n.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(e,i)}}shouldProcessStartTagTokenInForeignContent(e){if(!this.currentNotInHTML)return!1;let t,n;return this.openElements.stackTop===0&&this.fragmentContext?(t=this.fragmentContext,n=this.fragmentContextID):{current:t,currentTagId:n}=this.openElements,e.tagID===Y.SVG&&this.treeAdapter.getTagName(t)===J.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(t)===q.MATHML?!1:this.tokenizer.inForeignNode||(e.tagID===Y.MGLYPH||e.tagID===Y.MALIGNMARK)&&n!==void 0&&!this._isIntegrationPoint(n,t,q.HTML)}_processToken(e){switch(e.type){case Th.CHARACTER:this.onCharacter(e);break;case Th.NULL_CHARACTER:this.onNullCharacter(e);break;case Th.COMMENT:this.onComment(e);break;case Th.DOCTYPE:this.onDoctype(e);break;case Th.START_TAG:this._processStartTag(e);break;case Th.END_TAG:this.onEndTag(e);break;case Th.EOF:this.onEof(e);break;case Th.WHITESPACE_CHARACTER:this.onWhitespaceCharacter(e);break}}_isIntegrationPoint(e,t,n){return Kg(e,this.treeAdapter.getNamespaceURI(t),this.treeAdapter.getAttrList(t),n)}_reconstructActiveFormattingElements(){let e=this.activeFormattingElements.entries.length;if(e){let t=this.activeFormattingElements.entries.findIndex(e=>e.type===_g.Marker||this.openElements.contains(e.element)),n=t===-1?e-1:t-1;for(let e=n;e>=0;e--){let t=this.activeFormattingElements.entries[e];this._insertElement(t.token,this.treeAdapter.getNamespaceURI(t.element)),t.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=Q.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(Y.P),this.openElements.popUntilTagNamePopped(Y.P)}_resetInsertionMode(){for(let e=this.openElements.stackTop;e>=0;e--)switch(e===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[e]){case Y.TR:this.insertionMode=Q.IN_ROW;return;case Y.TBODY:case Y.THEAD:case Y.TFOOT:this.insertionMode=Q.IN_TABLE_BODY;return;case Y.CAPTION:this.insertionMode=Q.IN_CAPTION;return;case Y.COLGROUP:this.insertionMode=Q.IN_COLUMN_GROUP;return;case Y.TABLE:this.insertionMode=Q.IN_TABLE;return;case Y.BODY:this.insertionMode=Q.IN_BODY;return;case Y.FRAMESET:this.insertionMode=Q.IN_FRAMESET;return;case Y.SELECT:this._resetInsertionModeForSelect(e);return;case Y.TEMPLATE:this.insertionMode=this.tmplInsertionModeStack[0];return;case Y.HTML:this.insertionMode=this.headElement?Q.AFTER_HEAD:Q.BEFORE_HEAD;return;case Y.TD:case Y.TH:if(e>0){this.insertionMode=Q.IN_CELL;return}break;case Y.HEAD:if(e>0){this.insertionMode=Q.IN_HEAD;return}break}this.insertionMode=Q.IN_BODY}_resetInsertionModeForSelect(e){if(e>0)for(let t=e-1;t>0;t--){let e=this.openElements.tagIDs[t];if(e===Y.TEMPLATE)break;if(e===Y.TABLE){this.insertionMode=Q.IN_SELECT_IN_TABLE;return}}this.insertionMode=Q.IN_SELECT}_isElementCausesFosterParenting(e){return Zg.has(e)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this.openElements.currentTagId!==void 0&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let e=this.openElements.stackTop;e>=0;e--){let t=this.openElements.items[e];switch(this.openElements.tagIDs[e]){case Y.TEMPLATE:if(this.treeAdapter.getNamespaceURI(t)===q.HTML)return{parent:this.treeAdapter.getTemplateContent(t),beforeElement:null};break;case Y.TABLE:{let n=this.treeAdapter.getParentNode(t);return n?{parent:n,beforeElement:t}:{parent:this.openElements.items[e-1],beforeElement:null}}default:}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(e){let t=this._findFosterParentingLocation();t.beforeElement?this.treeAdapter.insertBefore(t.parent,e,t.beforeElement):this.treeAdapter.appendChild(t.parent,e)}_isSpecialElement(e,t){return Gh[this.treeAdapter.getNamespaceURI(e)].has(t)}onCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){_y(this,e);return}switch(this.insertionMode){case Q.INITIAL:f_(this,e);break;case Q.BEFORE_HTML:h_(this,e);break;case Q.BEFORE_HEAD:v_(this,e);break;case Q.IN_HEAD:S_(this,e);break;case Q.IN_HEAD_NO_SCRIPT:T_(this,e);break;case Q.AFTER_HEAD:O_(this,e);break;case Q.IN_BODY:case Q.IN_CAPTION:case Q.IN_CELL:case Q.IN_TEMPLATE:j_(this,e);break;case Q.TEXT:case Q.IN_SELECT:case Q.IN_SELECT_IN_TABLE:this._insertCharacters(e);break;case Q.IN_TABLE:case Q.IN_TABLE_BODY:case Q.IN_ROW:Ev(this,e);break;case Q.IN_TABLE_TEXT:zv(this,e);break;case Q.IN_COLUMN_GROUP:Kv(this,e);break;case Q.AFTER_BODY:cy(this,e);break;case Q.AFTER_AFTER_BODY:my(this,e);break;default:}}onNullCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){gy(this,e);return}switch(this.insertionMode){case Q.INITIAL:f_(this,e);break;case Q.BEFORE_HTML:h_(this,e);break;case Q.BEFORE_HEAD:v_(this,e);break;case Q.IN_HEAD:S_(this,e);break;case Q.IN_HEAD_NO_SCRIPT:T_(this,e);break;case Q.AFTER_HEAD:O_(this,e);break;case Q.TEXT:this._insertCharacters(e);break;case Q.IN_TABLE:case Q.IN_TABLE_BODY:case Q.IN_ROW:Ev(this,e);break;case Q.IN_COLUMN_GROUP:Kv(this,e);break;case Q.AFTER_BODY:cy(this,e);break;case Q.AFTER_AFTER_BODY:my(this,e);break;default:}}onComment(e){if(this.skipNextNewLine=!1,this.currentNotInHTML){s_(this,e);return}switch(this.insertionMode){case Q.INITIAL:case Q.BEFORE_HTML:case Q.BEFORE_HEAD:case Q.IN_HEAD:case Q.IN_HEAD_NO_SCRIPT:case Q.AFTER_HEAD:case Q.IN_BODY:case Q.IN_TABLE:case Q.IN_CAPTION:case Q.IN_COLUMN_GROUP:case Q.IN_TABLE_BODY:case Q.IN_ROW:case Q.IN_CELL:case Q.IN_SELECT:case Q.IN_SELECT_IN_TABLE:case Q.IN_TEMPLATE:case Q.IN_FRAMESET:case Q.AFTER_FRAMESET:s_(this,e);break;case Q.IN_TABLE_TEXT:Bv(this,e);break;case Q.AFTER_BODY:c_(this,e);break;case Q.AFTER_AFTER_BODY:case Q.AFTER_AFTER_FRAMESET:l_(this,e);break;default:}}onDoctype(e){switch(this.skipNextNewLine=!1,this.insertionMode){case Q.INITIAL:d_(this,e);break;case Q.BEFORE_HEAD:case Q.IN_HEAD:case Q.IN_HEAD_NO_SCRIPT:case Q.AFTER_HEAD:this._err(e,K.misplacedDoctype);break;case Q.IN_TABLE_TEXT:Bv(this,e);break;default:}}onStartTag(e){this.skipNextNewLine=!1,this.currentToken=e,this._processStartTag(e),e.selfClosing&&!e.ackSelfClosing&&this._err(e,K.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(e){this.shouldProcessStartTagTokenInForeignContent(e)?yy(this,e):this._startTagOutsideForeignContent(e)}_startTagOutsideForeignContent(e){switch(this.insertionMode){case Q.INITIAL:f_(this,e);break;case Q.BEFORE_HTML:p_(this,e);break;case Q.BEFORE_HEAD:g_(this,e);break;case Q.IN_HEAD:y_(this,e);break;case Q.IN_HEAD_NO_SCRIPT:C_(this,e);break;case Q.AFTER_HEAD:E_(this,e);break;case Q.IN_BODY:uv(this,e);break;case Q.IN_TABLE:Fv(this,e);break;case Q.IN_TABLE_TEXT:Bv(this,e);break;case Q.IN_CAPTION:Hv(this,e);break;case Q.IN_COLUMN_GROUP:Wv(this,e);break;case Q.IN_TABLE_BODY:qv(this,e);break;case Q.IN_ROW:Yv(this,e);break;case Q.IN_CELL:Zv(this,e);break;case Q.IN_SELECT:$v(this,e);break;case Q.IN_SELECT_IN_TABLE:ty(this,e);break;case Q.IN_TEMPLATE:ry(this,e);break;case Q.AFTER_BODY:oy(this,e);break;case Q.IN_FRAMESET:ly(this,e);break;case Q.AFTER_FRAMESET:dy(this,e);break;case Q.AFTER_AFTER_BODY:py(this,e);break;case Q.AFTER_AFTER_FRAMESET:hy(this,e);break;default:}}onEndTag(e){this.skipNextNewLine=!1,this.currentToken=e,this.currentNotInHTML?by(this,e):this._endTagOutsideForeignContent(e)}_endTagOutsideForeignContent(e){switch(this.insertionMode){case Q.INITIAL:f_(this,e);break;case Q.BEFORE_HTML:m_(this,e);break;case Q.BEFORE_HEAD:__(this,e);break;case Q.IN_HEAD:b_(this,e);break;case Q.IN_HEAD_NO_SCRIPT:w_(this,e);break;case Q.AFTER_HEAD:D_(this,e);break;case Q.IN_BODY:Sv(this,e);break;case Q.TEXT:wv(this,e);break;case Q.IN_TABLE:Iv(this,e);break;case Q.IN_TABLE_TEXT:Bv(this,e);break;case Q.IN_CAPTION:Uv(this,e);break;case Q.IN_COLUMN_GROUP:Gv(this,e);break;case Q.IN_TABLE_BODY:Jv(this,e);break;case Q.IN_ROW:Xv(this,e);break;case Q.IN_CELL:Qv(this,e);break;case Q.IN_SELECT:ey(this,e);break;case Q.IN_SELECT_IN_TABLE:ny(this,e);break;case Q.IN_TEMPLATE:iy(this,e);break;case Q.AFTER_BODY:sy(this,e);break;case Q.IN_FRAMESET:uy(this,e);break;case Q.AFTER_FRAMESET:fy(this,e);break;case Q.AFTER_AFTER_BODY:my(this,e);break;default:}}onEof(e){switch(this.insertionMode){case Q.INITIAL:f_(this,e);break;case Q.BEFORE_HTML:h_(this,e);break;case Q.BEFORE_HEAD:v_(this,e);break;case Q.IN_HEAD:S_(this,e);break;case Q.IN_HEAD_NO_SCRIPT:T_(this,e);break;case Q.AFTER_HEAD:O_(this,e);break;case Q.IN_BODY:case Q.IN_TABLE:case Q.IN_CAPTION:case Q.IN_COLUMN_GROUP:case Q.IN_TABLE_BODY:case Q.IN_ROW:case Q.IN_CELL:case Q.IN_SELECT:case Q.IN_SELECT_IN_TABLE:Cv(this,e);break;case Q.TEXT:Tv(this,e);break;case Q.IN_TABLE_TEXT:Bv(this,e);break;case Q.IN_TEMPLATE:ay(this,e);break;case Q.AFTER_BODY:case Q.IN_FRAMESET:case Q.AFTER_FRAMESET:case Q.AFTER_AFTER_BODY:case Q.AFTER_AFTER_FRAMESET:u_(this,e);break;default:}}onWhitespaceCharacter(e){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,e.chars.charCodeAt(0)===G.LINE_FEED)){if(e.chars.length===1)return;e.chars=e.chars.substr(1)}if(this.tokenizer.inForeignNode){this._insertCharacters(e);return}switch(this.insertionMode){case Q.IN_HEAD:case Q.IN_HEAD_NO_SCRIPT:case Q.AFTER_HEAD:case Q.TEXT:case Q.IN_COLUMN_GROUP:case Q.IN_SELECT:case Q.IN_SELECT_IN_TABLE:case Q.IN_FRAMESET:case Q.AFTER_FRAMESET:this._insertCharacters(e);break;case Q.IN_BODY:case Q.IN_CAPTION:case Q.IN_CELL:case Q.IN_TEMPLATE:case Q.AFTER_BODY:case Q.AFTER_AFTER_BODY:case Q.AFTER_AFTER_FRAMESET:A_(this,e);break;case Q.IN_TABLE:case Q.IN_TABLE_BODY:case Q.IN_ROW:Ev(this,e);break;case Q.IN_TABLE_TEXT:Rv(this,e);break;default:}}};function e_(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(t.tagName);return n?e.openElements.contains(n.element)?e.openElements.hasInScope(t.tagID)||(n=null):(e.activeFormattingElements.removeEntry(n),n=null):xv(e,t),n}function t_(e,t){let n=null,r=e.openElements.stackTop;for(;r>=0;r--){let i=e.openElements.items[r];if(i===t.element)break;e._isSpecialElement(i,e.openElements.tagIDs[r])&&(n=i)}return n||(e.openElements.shortenToLength(Math.max(r,0)),e.activeFormattingElements.removeEntry(t)),n}function n_(e,t,n){let r=t,i=e.openElements.getCommonAncestor(t);for(let a=0,o=i;o!==n;a++,o=i){i=e.openElements.getCommonAncestor(o);let n=e.activeFormattingElements.getElementEntry(o),s=n&&a>=Yg;!n||s?(s&&e.activeFormattingElements.removeEntry(n),e.openElements.remove(o)):(o=r_(e,n),r===t&&(e.activeFormattingElements.bookmark=n),e.treeAdapter.detachNode(r),e.treeAdapter.appendChild(o,r),r=o)}return r}function r_(e,t){let n=e.treeAdapter.getNamespaceURI(t.element),r=e.treeAdapter.createElement(t.token.tagName,n,t.token.attrs);return e.openElements.replace(t.element,r),t.element=r,r}function i_(e,t,n){let r=Wh(e.treeAdapter.getTagName(t));if(e._isElementCausesFosterParenting(r))e._fosterParentElement(n);else{let i=e.treeAdapter.getNamespaceURI(t);r===Y.TEMPLATE&&i===q.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,n)}}function a_(e,t,n){let r=e.treeAdapter.getNamespaceURI(n.element),{token:i}=n,a=e.treeAdapter.createElement(i.tagName,r,i.attrs);e._adoptNodes(t,a),e.treeAdapter.appendChild(t,a),e.activeFormattingElements.insertElementAfterBookmark(a,i),e.activeFormattingElements.removeEntry(n),e.openElements.remove(n.element),e.openElements.insertAfter(t,a,i.tagID)}function o_(e,t){for(let n=0;n<Jg;n++){let n=e_(e,t);if(!n)break;let r=t_(e,n);if(!r)break;e.activeFormattingElements.bookmark=n;let i=n_(e,r,n.element),a=e.openElements.getCommonAncestor(n.element);e.treeAdapter.detachNode(i),a&&i_(e,a,i),a_(e,r,n)}}function s_(e,t){e._appendCommentNode(t,e.openElements.currentTmplContentOrNode)}function c_(e,t){e._appendCommentNode(t,e.openElements.items[0])}function l_(e,t){e._appendCommentNode(t,e.document)}function u_(e,t){if(e.stopped=!0,t.location){let n=e.fragmentContext?0:2;for(let r=e.openElements.stackTop;r>=n;r--)e._setEndLocation(e.openElements.items[r],t);if(!e.fragmentContext&&e.openElements.stackTop>=0){let n=e.openElements.items[0],r=e.treeAdapter.getNodeSourceCodeLocation(n);if(r&&!r.endTag&&(e._setEndLocation(n,t),e.openElements.stackTop>=1)){let n=e.openElements.items[1],r=e.treeAdapter.getNodeSourceCodeLocation(n);r&&!r.endTag&&e._setEndLocation(n,t)}}}}function d_(e,t){e._setDocumentType(t);let n=t.forceQuirks?Hh.QUIRKS:jg(t);Ag(t)||e._err(t,K.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=Q.BEFORE_HTML}function f_(e,t){e._err(t,K.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,Hh.QUIRKS),e.insertionMode=Q.BEFORE_HTML,e._processToken(t)}function p_(e,t){t.tagID===Y.HTML?(e._insertElement(t,q.HTML),e.insertionMode=Q.BEFORE_HEAD):h_(e,t)}function m_(e,t){let n=t.tagID;(n===Y.HTML||n===Y.HEAD||n===Y.BODY||n===Y.BR)&&h_(e,t)}function h_(e,t){e._insertFakeRootElement(),e.insertionMode=Q.BEFORE_HEAD,e._processToken(t)}function g_(e,t){switch(t.tagID){case Y.HTML:uv(e,t);break;case Y.HEAD:e._insertElement(t,q.HTML),e.headElement=e.openElements.current,e.insertionMode=Q.IN_HEAD;break;default:v_(e,t)}}function __(e,t){let n=t.tagID;n===Y.HEAD||n===Y.BODY||n===Y.HTML||n===Y.BR?v_(e,t):e._err(t,K.endTagWithoutMatchingOpenElement)}function v_(e,t){e._insertFakeElement(J.HEAD,Y.HEAD),e.headElement=e.openElements.current,e.insertionMode=Q.IN_HEAD,e._processToken(t)}function y_(e,t){switch(t.tagID){case Y.HTML:uv(e,t);break;case Y.BASE:case Y.BASEFONT:case Y.BGSOUND:case Y.LINK:case Y.META:e._appendElement(t,q.HTML),t.ackSelfClosing=!0;break;case Y.TITLE:e._switchToTextParsing(t,qh.RCDATA);break;case Y.NOSCRIPT:e.options.scriptingEnabled?e._switchToTextParsing(t,qh.RAWTEXT):(e._insertElement(t,q.HTML),e.insertionMode=Q.IN_HEAD_NO_SCRIPT);break;case Y.NOFRAMES:case Y.STYLE:e._switchToTextParsing(t,qh.RAWTEXT);break;case Y.SCRIPT:e._switchToTextParsing(t,qh.SCRIPT_DATA);break;case Y.TEMPLATE:e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=Q.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(Q.IN_TEMPLATE);break;case Y.HEAD:e._err(t,K.misplacedStartTagForHeadElement);break;default:S_(e,t)}}function b_(e,t){switch(t.tagID){case Y.HEAD:e.openElements.pop(),e.insertionMode=Q.AFTER_HEAD;break;case Y.BODY:case Y.BR:case Y.HTML:S_(e,t);break;case Y.TEMPLATE:x_(e,t);break;default:e._err(t,K.endTagWithoutMatchingOpenElement)}}function x_(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==Y.TEMPLATE&&e._err(t,K.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped(Y.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,K.endTagWithoutMatchingOpenElement)}function S_(e,t){e.openElements.pop(),e.insertionMode=Q.AFTER_HEAD,e._processToken(t)}function C_(e,t){switch(t.tagID){case Y.HTML:uv(e,t);break;case Y.BASEFONT:case Y.BGSOUND:case Y.HEAD:case Y.LINK:case Y.META:case Y.NOFRAMES:case Y.STYLE:y_(e,t);break;case Y.NOSCRIPT:e._err(t,K.nestedNoscriptInHead);break;default:T_(e,t)}}function w_(e,t){switch(t.tagID){case Y.NOSCRIPT:e.openElements.pop(),e.insertionMode=Q.IN_HEAD;break;case Y.BR:T_(e,t);break;default:e._err(t,K.endTagWithoutMatchingOpenElement)}}function T_(e,t){let n=t.type===Th.EOF?K.openElementsLeftAfterEof:K.disallowedContentInNoscriptInHead;e._err(t,n),e.openElements.pop(),e.insertionMode=Q.IN_HEAD,e._processToken(t)}function E_(e,t){switch(t.tagID){case Y.HTML:uv(e,t);break;case Y.BODY:e._insertElement(t,q.HTML),e.framesetOk=!1,e.insertionMode=Q.IN_BODY;break;case Y.FRAMESET:e._insertElement(t,q.HTML),e.insertionMode=Q.IN_FRAMESET;break;case Y.BASE:case Y.BASEFONT:case Y.BGSOUND:case Y.LINK:case Y.META:case Y.NOFRAMES:case Y.SCRIPT:case Y.STYLE:case Y.TEMPLATE:case Y.TITLE:e._err(t,K.abandonedHeadElementChild),e.openElements.push(e.headElement,Y.HEAD),y_(e,t),e.openElements.remove(e.headElement);break;case Y.HEAD:e._err(t,K.misplacedStartTagForHeadElement);break;default:O_(e,t)}}function D_(e,t){switch(t.tagID){case Y.BODY:case Y.HTML:case Y.BR:O_(e,t);break;case Y.TEMPLATE:x_(e,t);break;default:e._err(t,K.endTagWithoutMatchingOpenElement)}}function O_(e,t){e._insertFakeElement(J.BODY,Y.BODY),e.insertionMode=Q.IN_BODY,k_(e,t)}function k_(e,t){switch(t.type){case Th.CHARACTER:j_(e,t);break;case Th.WHITESPACE_CHARACTER:A_(e,t);break;case Th.COMMENT:s_(e,t);break;case Th.START_TAG:uv(e,t);break;case Th.END_TAG:Sv(e,t);break;case Th.EOF:Cv(e,t);break;default:}}function A_(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function j_(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function M_(e,t){e.openElements.tmplCount===0&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}function N_(e,t){let n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e.openElements.tmplCount===0&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(n,t.attrs))}function P_(e,t){let n=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&n&&(e.treeAdapter.detachNode(n),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,q.HTML),e.insertionMode=Q.IN_FRAMESET)}function F_(e,t){e.openElements.hasInButtonScope(Y.P)&&e._closePElement(),e._insertElement(t,q.HTML)}function I_(e,t){e.openElements.hasInButtonScope(Y.P)&&e._closePElement(),e.openElements.currentTagId!==void 0&&Kh.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,q.HTML)}function L_(e,t){e.openElements.hasInButtonScope(Y.P)&&e._closePElement(),e._insertElement(t,q.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}function R_(e,t){let n=e.openElements.tmplCount>0;(!e.formElement||n)&&(e.openElements.hasInButtonScope(Y.P)&&e._closePElement(),e._insertElement(t,q.HTML),n||(e.formElement=e.openElements.current))}function z_(e,t){e.framesetOk=!1;let n=t.tagID;for(let t=e.openElements.stackTop;t>=0;t--){let r=e.openElements.tagIDs[t];if(n===Y.LI&&r===Y.LI||(n===Y.DD||n===Y.DT)&&(r===Y.DD||r===Y.DT)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.popUntilTagNamePopped(r);break}if(r!==Y.ADDRESS&&r!==Y.DIV&&r!==Y.P&&e._isSpecialElement(e.openElements.items[t],r))break}e.openElements.hasInButtonScope(Y.P)&&e._closePElement(),e._insertElement(t,q.HTML)}function B_(e,t){e.openElements.hasInButtonScope(Y.P)&&e._closePElement(),e._insertElement(t,q.HTML),e.tokenizer.state=qh.PLAINTEXT}function V_(e,t){e.openElements.hasInScope(Y.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(Y.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,q.HTML),e.framesetOk=!1}function H_(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(J.A);n&&(o_(e,t),e.openElements.remove(n.element),e.activeFormattingElements.removeEntry(n)),e._reconstructActiveFormattingElements(),e._insertElement(t,q.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function U_(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,q.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function W_(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(Y.NOBR)&&(o_(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,q.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function G_(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,q.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}function K_(e,t){e.treeAdapter.getDocumentMode(e.document)!==Hh.QUIRKS&&e.openElements.hasInButtonScope(Y.P)&&e._closePElement(),e._insertElement(t,q.HTML),e.framesetOk=!1,e.insertionMode=Q.IN_TABLE}function q_(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,q.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function J_(e){let t=Eh(e,Vh.TYPE);return t!=null&&t.toLowerCase()===qg}function Y_(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,q.HTML),J_(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}function X_(e,t){e._appendElement(t,q.HTML),t.ackSelfClosing=!0}function Z_(e,t){e.openElements.hasInButtonScope(Y.P)&&e._closePElement(),e._appendElement(t,q.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function Q_(e,t){t.tagName=J.IMG,t.tagID=Y.IMG,q_(e,t)}function $_(e,t){e._insertElement(t,q.HTML),e.skipNextNewLine=!0,e.tokenizer.state=qh.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=Q.TEXT}function ev(e,t){e.openElements.hasInButtonScope(Y.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,qh.RAWTEXT)}function tv(e,t){e.framesetOk=!1,e._switchToTextParsing(t,qh.RAWTEXT)}function nv(e,t){e._switchToTextParsing(t,qh.RAWTEXT)}function rv(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,q.HTML),e.framesetOk=!1,e.insertionMode=e.insertionMode===Q.IN_TABLE||e.insertionMode===Q.IN_CAPTION||e.insertionMode===Q.IN_TABLE_BODY||e.insertionMode===Q.IN_ROW||e.insertionMode===Q.IN_CELL?Q.IN_SELECT_IN_TABLE:Q.IN_SELECT}function iv(e,t){e.openElements.currentTagId===Y.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,q.HTML)}function av(e,t){e.openElements.hasInScope(Y.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,q.HTML)}function ov(e,t){e.openElements.hasInScope(Y.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(Y.RTC),e._insertElement(t,q.HTML)}function sv(e,t){e._reconstructActiveFormattingElements(),Bg(t),Hg(t),t.selfClosing?e._appendElement(t,q.MATHML):e._insertElement(t,q.MATHML),t.ackSelfClosing=!0}function cv(e,t){e._reconstructActiveFormattingElements(),Vg(t),Hg(t),t.selfClosing?e._appendElement(t,q.SVG):e._insertElement(t,q.SVG),t.ackSelfClosing=!0}function lv(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,q.HTML)}function uv(e,t){switch(t.tagID){case Y.I:case Y.S:case Y.B:case Y.U:case Y.EM:case Y.TT:case Y.BIG:case Y.CODE:case Y.FONT:case Y.SMALL:case Y.STRIKE:case Y.STRONG:U_(e,t);break;case Y.A:H_(e,t);break;case Y.H1:case Y.H2:case Y.H3:case Y.H4:case Y.H5:case Y.H6:I_(e,t);break;case Y.P:case Y.DL:case Y.OL:case Y.UL:case Y.DIV:case Y.DIR:case Y.NAV:case Y.MAIN:case Y.MENU:case Y.ASIDE:case Y.CENTER:case Y.FIGURE:case Y.FOOTER:case Y.HEADER:case Y.HGROUP:case Y.DIALOG:case Y.DETAILS:case Y.ADDRESS:case Y.ARTICLE:case Y.SEARCH:case Y.SECTION:case Y.SUMMARY:case Y.FIELDSET:case Y.BLOCKQUOTE:case Y.FIGCAPTION:F_(e,t);break;case Y.LI:case Y.DD:case Y.DT:z_(e,t);break;case Y.BR:case Y.IMG:case Y.WBR:case Y.AREA:case Y.EMBED:case Y.KEYGEN:q_(e,t);break;case Y.HR:Z_(e,t);break;case Y.RB:case Y.RTC:av(e,t);break;case Y.RT:case Y.RP:ov(e,t);break;case Y.PRE:case Y.LISTING:L_(e,t);break;case Y.XMP:ev(e,t);break;case Y.SVG:cv(e,t);break;case Y.HTML:M_(e,t);break;case Y.BASE:case Y.LINK:case Y.META:case Y.STYLE:case Y.TITLE:case Y.SCRIPT:case Y.BGSOUND:case Y.BASEFONT:case Y.TEMPLATE:y_(e,t);break;case Y.BODY:N_(e,t);break;case Y.FORM:R_(e,t);break;case Y.NOBR:W_(e,t);break;case Y.MATH:sv(e,t);break;case Y.TABLE:K_(e,t);break;case Y.INPUT:Y_(e,t);break;case Y.PARAM:case Y.TRACK:case Y.SOURCE:X_(e,t);break;case Y.IMAGE:Q_(e,t);break;case Y.BUTTON:V_(e,t);break;case Y.APPLET:case Y.OBJECT:case Y.MARQUEE:G_(e,t);break;case Y.IFRAME:tv(e,t);break;case Y.SELECT:rv(e,t);break;case Y.OPTION:case Y.OPTGROUP:iv(e,t);break;case Y.NOEMBED:case Y.NOFRAMES:nv(e,t);break;case Y.FRAMESET:P_(e,t);break;case Y.TEXTAREA:$_(e,t);break;case Y.NOSCRIPT:e.options.scriptingEnabled?nv(e,t):lv(e,t);break;case Y.PLAINTEXT:B_(e,t);break;case Y.COL:case Y.TH:case Y.TD:case Y.TR:case Y.HEAD:case Y.FRAME:case Y.TBODY:case Y.TFOOT:case Y.THEAD:case Y.CAPTION:case Y.COLGROUP:break;default:lv(e,t)}}function dv(e,t){if(e.openElements.hasInScope(Y.BODY)&&(e.insertionMode=Q.AFTER_BODY,e.options.sourceCodeLocationInfo)){let n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e._setEndLocation(n,t)}}function fv(e,t){e.openElements.hasInScope(Y.BODY)&&(e.insertionMode=Q.AFTER_BODY,sy(e,t))}function pv(e,t){let n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n))}function mv(e){let t=e.openElements.tmplCount>0,{formElement:n}=e;t||(e.formElement=null),(n||t)&&e.openElements.hasInScope(Y.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(Y.FORM):n&&e.openElements.remove(n))}function hv(e){e.openElements.hasInButtonScope(Y.P)||e._insertFakeElement(J.P,Y.P),e._closePElement()}function gv(e){e.openElements.hasInListItemScope(Y.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(Y.LI),e.openElements.popUntilTagNamePopped(Y.LI))}function _v(e,t){let n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n))}function vv(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}function yv(e,t){let n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker())}function bv(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(J.BR,Y.BR),e.openElements.pop(),e.framesetOk=!1}function xv(e,t){let n=t.tagName,r=t.tagID;for(let t=e.openElements.stackTop;t>0;t--){let i=e.openElements.items[t],a=e.openElements.tagIDs[t];if(r===a&&(r!==Y.UNKNOWN||e.treeAdapter.getTagName(i)===n)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.stackTop>=t&&e.openElements.shortenToLength(t);break}if(e._isSpecialElement(i,a))break}}function Sv(e,t){switch(t.tagID){case Y.A:case Y.B:case Y.I:case Y.S:case Y.U:case Y.EM:case Y.TT:case Y.BIG:case Y.CODE:case Y.FONT:case Y.NOBR:case Y.SMALL:case Y.STRIKE:case Y.STRONG:o_(e,t);break;case Y.P:hv(e);break;case Y.DL:case Y.UL:case Y.OL:case Y.DIR:case Y.DIV:case Y.NAV:case Y.PRE:case Y.MAIN:case Y.MENU:case Y.ASIDE:case Y.BUTTON:case Y.CENTER:case Y.FIGURE:case Y.FOOTER:case Y.HEADER:case Y.HGROUP:case Y.DIALOG:case Y.ADDRESS:case Y.ARTICLE:case Y.DETAILS:case Y.SEARCH:case Y.SECTION:case Y.SUMMARY:case Y.LISTING:case Y.FIELDSET:case Y.BLOCKQUOTE:case Y.FIGCAPTION:pv(e,t);break;case Y.LI:gv(e);break;case Y.DD:case Y.DT:_v(e,t);break;case Y.H1:case Y.H2:case Y.H3:case Y.H4:case Y.H5:case Y.H6:vv(e);break;case Y.BR:bv(e);break;case Y.BODY:dv(e,t);break;case Y.HTML:fv(e,t);break;case Y.FORM:mv(e);break;case Y.APPLET:case Y.OBJECT:case Y.MARQUEE:yv(e,t);break;case Y.TEMPLATE:x_(e,t);break;default:xv(e,t)}}function Cv(e,t){e.tmplInsertionModeStack.length>0?ay(e,t):u_(e,t)}function wv(e,t){var n;t.tagID===Y.SCRIPT&&((n=e.scriptHandler)==null||n.call(e,e.openElements.current)),e.openElements.pop(),e.insertionMode=e.originalInsertionMode}function Tv(e,t){e._err(t,K.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}function Ev(e,t){if(e.openElements.currentTagId!==void 0&&Zg.has(e.openElements.currentTagId))switch(e.pendingCharacterTokens.length=0,e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=Q.IN_TABLE_TEXT,t.type){case Th.CHARACTER:zv(e,t);break;case Th.WHITESPACE_CHARACTER:Rv(e,t);break}else Lv(e,t)}function Dv(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,q.HTML),e.insertionMode=Q.IN_CAPTION}function Ov(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,q.HTML),e.insertionMode=Q.IN_COLUMN_GROUP}function kv(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(J.COLGROUP,Y.COLGROUP),e.insertionMode=Q.IN_COLUMN_GROUP,Wv(e,t)}function Av(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,q.HTML),e.insertionMode=Q.IN_TABLE_BODY}function jv(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(J.TBODY,Y.TBODY),e.insertionMode=Q.IN_TABLE_BODY,qv(e,t)}function Mv(e,t){e.openElements.hasInTableScope(Y.TABLE)&&(e.openElements.popUntilTagNamePopped(Y.TABLE),e._resetInsertionMode(),e._processStartTag(t))}function Nv(e,t){J_(t)?e._appendElement(t,q.HTML):Lv(e,t),t.ackSelfClosing=!0}function Pv(e,t){!e.formElement&&e.openElements.tmplCount===0&&(e._insertElement(t,q.HTML),e.formElement=e.openElements.current,e.openElements.pop())}function Fv(e,t){switch(t.tagID){case Y.TD:case Y.TH:case Y.TR:jv(e,t);break;case Y.STYLE:case Y.SCRIPT:case Y.TEMPLATE:y_(e,t);break;case Y.COL:kv(e,t);break;case Y.FORM:Pv(e,t);break;case Y.TABLE:Mv(e,t);break;case Y.TBODY:case Y.TFOOT:case Y.THEAD:Av(e,t);break;case Y.INPUT:Nv(e,t);break;case Y.CAPTION:Dv(e,t);break;case Y.COLGROUP:Ov(e,t);break;default:Lv(e,t)}}function Iv(e,t){switch(t.tagID){case Y.TABLE:e.openElements.hasInTableScope(Y.TABLE)&&(e.openElements.popUntilTagNamePopped(Y.TABLE),e._resetInsertionMode());break;case Y.TEMPLATE:x_(e,t);break;case Y.BODY:case Y.CAPTION:case Y.COL:case Y.COLGROUP:case Y.HTML:case Y.TBODY:case Y.TD:case Y.TFOOT:case Y.TH:case Y.THEAD:case Y.TR:break;default:Lv(e,t)}}function Lv(e,t){let n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,k_(e,t),e.fosterParentingEnabled=n}function Rv(e,t){e.pendingCharacterTokens.push(t)}function zv(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function Bv(e,t){let n=0;if(e.hasNonWhitespacePendingCharacterToken)for(;n<e.pendingCharacterTokens.length;n++)Lv(e,e.pendingCharacterTokens[n]);else for(;n<e.pendingCharacterTokens.length;n++)e._insertCharacters(e.pendingCharacterTokens[n]);e.insertionMode=e.originalInsertionMode,e._processToken(t)}var Vv=new Set([Y.CAPTION,Y.COL,Y.COLGROUP,Y.TBODY,Y.TD,Y.TFOOT,Y.TH,Y.THEAD,Y.TR]);function Hv(e,t){let n=t.tagID;Vv.has(n)?e.openElements.hasInTableScope(Y.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(Y.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=Q.IN_TABLE,Fv(e,t)):uv(e,t)}function Uv(e,t){let n=t.tagID;switch(n){case Y.CAPTION:case Y.TABLE:e.openElements.hasInTableScope(Y.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(Y.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=Q.IN_TABLE,n===Y.TABLE&&Iv(e,t));break;case Y.BODY:case Y.COL:case Y.COLGROUP:case Y.HTML:case Y.TBODY:case Y.TD:case Y.TFOOT:case Y.TH:case Y.THEAD:case Y.TR:break;default:Sv(e,t)}}function Wv(e,t){switch(t.tagID){case Y.HTML:uv(e,t);break;case Y.COL:e._appendElement(t,q.HTML),t.ackSelfClosing=!0;break;case Y.TEMPLATE:y_(e,t);break;default:Kv(e,t)}}function Gv(e,t){switch(t.tagID){case Y.COLGROUP:e.openElements.currentTagId===Y.COLGROUP&&(e.openElements.pop(),e.insertionMode=Q.IN_TABLE);break;case Y.TEMPLATE:x_(e,t);break;case Y.COL:break;default:Kv(e,t)}}function Kv(e,t){e.openElements.currentTagId===Y.COLGROUP&&(e.openElements.pop(),e.insertionMode=Q.IN_TABLE,e._processToken(t))}function qv(e,t){switch(t.tagID){case Y.TR:e.openElements.clearBackToTableBodyContext(),e._insertElement(t,q.HTML),e.insertionMode=Q.IN_ROW;break;case Y.TH:case Y.TD:e.openElements.clearBackToTableBodyContext(),e._insertFakeElement(J.TR,Y.TR),e.insertionMode=Q.IN_ROW,Yv(e,t);break;case Y.CAPTION:case Y.COL:case Y.COLGROUP:case Y.TBODY:case Y.TFOOT:case Y.THEAD:e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=Q.IN_TABLE,Fv(e,t));break;default:Fv(e,t)}}function Jv(e,t){let n=t.tagID;switch(t.tagID){case Y.TBODY:case Y.TFOOT:case Y.THEAD:e.openElements.hasInTableScope(n)&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=Q.IN_TABLE);break;case Y.TABLE:e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=Q.IN_TABLE,Iv(e,t));break;case Y.BODY:case Y.CAPTION:case Y.COL:case Y.COLGROUP:case Y.HTML:case Y.TD:case Y.TH:case Y.TR:break;default:Iv(e,t)}}function Yv(e,t){switch(t.tagID){case Y.TH:case Y.TD:e.openElements.clearBackToTableRowContext(),e._insertElement(t,q.HTML),e.insertionMode=Q.IN_CELL,e.activeFormattingElements.insertMarker();break;case Y.CAPTION:case Y.COL:case Y.COLGROUP:case Y.TBODY:case Y.TFOOT:case Y.THEAD:case Y.TR:e.openElements.hasInTableScope(Y.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=Q.IN_TABLE_BODY,qv(e,t));break;default:Fv(e,t)}}function Xv(e,t){switch(t.tagID){case Y.TR:e.openElements.hasInTableScope(Y.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=Q.IN_TABLE_BODY);break;case Y.TABLE:e.openElements.hasInTableScope(Y.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=Q.IN_TABLE_BODY,Jv(e,t));break;case Y.TBODY:case Y.TFOOT:case Y.THEAD:(e.openElements.hasInTableScope(t.tagID)||e.openElements.hasInTableScope(Y.TR))&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=Q.IN_TABLE_BODY,Jv(e,t));break;case Y.BODY:case Y.CAPTION:case Y.COL:case Y.COLGROUP:case Y.HTML:case Y.TD:case Y.TH:break;default:Iv(e,t)}}function Zv(e,t){let n=t.tagID;Vv.has(n)?(e.openElements.hasInTableScope(Y.TD)||e.openElements.hasInTableScope(Y.TH))&&(e._closeTableCell(),Yv(e,t)):uv(e,t)}function Qv(e,t){let n=t.tagID;switch(n){case Y.TD:case Y.TH:e.openElements.hasInTableScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=Q.IN_ROW);break;case Y.TABLE:case Y.TBODY:case Y.TFOOT:case Y.THEAD:case Y.TR:e.openElements.hasInTableScope(n)&&(e._closeTableCell(),Xv(e,t));break;case Y.BODY:case Y.CAPTION:case Y.COL:case Y.COLGROUP:case Y.HTML:break;default:Sv(e,t)}}function $v(e,t){switch(t.tagID){case Y.HTML:uv(e,t);break;case Y.OPTION:e.openElements.currentTagId===Y.OPTION&&e.openElements.pop(),e._insertElement(t,q.HTML);break;case Y.OPTGROUP:e.openElements.currentTagId===Y.OPTION&&e.openElements.pop(),e.openElements.currentTagId===Y.OPTGROUP&&e.openElements.pop(),e._insertElement(t,q.HTML);break;case Y.HR:e.openElements.currentTagId===Y.OPTION&&e.openElements.pop(),e.openElements.currentTagId===Y.OPTGROUP&&e.openElements.pop(),e._appendElement(t,q.HTML),t.ackSelfClosing=!0;break;case Y.INPUT:case Y.KEYGEN:case Y.TEXTAREA:case Y.SELECT:e.openElements.hasInSelectScope(Y.SELECT)&&(e.openElements.popUntilTagNamePopped(Y.SELECT),e._resetInsertionMode(),t.tagID!==Y.SELECT&&e._processStartTag(t));break;case Y.SCRIPT:case Y.TEMPLATE:y_(e,t);break;default:}}function ey(e,t){switch(t.tagID){case Y.OPTGROUP:e.openElements.stackTop>0&&e.openElements.currentTagId===Y.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===Y.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===Y.OPTGROUP&&e.openElements.pop();break;case Y.OPTION:e.openElements.currentTagId===Y.OPTION&&e.openElements.pop();break;case Y.SELECT:e.openElements.hasInSelectScope(Y.SELECT)&&(e.openElements.popUntilTagNamePopped(Y.SELECT),e._resetInsertionMode());break;case Y.TEMPLATE:x_(e,t);break;default:}}function ty(e,t){let n=t.tagID;n===Y.CAPTION||n===Y.TABLE||n===Y.TBODY||n===Y.TFOOT||n===Y.THEAD||n===Y.TR||n===Y.TD||n===Y.TH?(e.openElements.popUntilTagNamePopped(Y.SELECT),e._resetInsertionMode(),e._processStartTag(t)):$v(e,t)}function ny(e,t){let n=t.tagID;n===Y.CAPTION||n===Y.TABLE||n===Y.TBODY||n===Y.TFOOT||n===Y.THEAD||n===Y.TR||n===Y.TD||n===Y.TH?e.openElements.hasInTableScope(n)&&(e.openElements.popUntilTagNamePopped(Y.SELECT),e._resetInsertionMode(),e.onEndTag(t)):ey(e,t)}function ry(e,t){switch(t.tagID){case Y.BASE:case Y.BASEFONT:case Y.BGSOUND:case Y.LINK:case Y.META:case Y.NOFRAMES:case Y.SCRIPT:case Y.STYLE:case Y.TEMPLATE:case Y.TITLE:y_(e,t);break;case Y.CAPTION:case Y.COLGROUP:case Y.TBODY:case Y.TFOOT:case Y.THEAD:e.tmplInsertionModeStack[0]=Q.IN_TABLE,e.insertionMode=Q.IN_TABLE,Fv(e,t);break;case Y.COL:e.tmplInsertionModeStack[0]=Q.IN_COLUMN_GROUP,e.insertionMode=Q.IN_COLUMN_GROUP,Wv(e,t);break;case Y.TR:e.tmplInsertionModeStack[0]=Q.IN_TABLE_BODY,e.insertionMode=Q.IN_TABLE_BODY,qv(e,t);break;case Y.TD:case Y.TH:e.tmplInsertionModeStack[0]=Q.IN_ROW,e.insertionMode=Q.IN_ROW,Yv(e,t);break;default:e.tmplInsertionModeStack[0]=Q.IN_BODY,e.insertionMode=Q.IN_BODY,uv(e,t)}}function iy(e,t){t.tagID===Y.TEMPLATE&&x_(e,t)}function ay(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(Y.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):u_(e,t)}function oy(e,t){t.tagID===Y.HTML?uv(e,t):cy(e,t)}function sy(e,t){if(t.tagID===Y.HTML){if(e.fragmentContext||(e.insertionMode=Q.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===Y.HTML){e._setEndLocation(e.openElements.items[0],t);let n=e.openElements.items[1];n&&!e.treeAdapter.getNodeSourceCodeLocation(n)?.endTag&&e._setEndLocation(n,t)}}else cy(e,t)}function cy(e,t){e.insertionMode=Q.IN_BODY,k_(e,t)}function ly(e,t){switch(t.tagID){case Y.HTML:uv(e,t);break;case Y.FRAMESET:e._insertElement(t,q.HTML);break;case Y.FRAME:e._appendElement(t,q.HTML),t.ackSelfClosing=!0;break;case Y.NOFRAMES:y_(e,t);break;default:}}function uy(e,t){t.tagID===Y.FRAMESET&&!e.openElements.isRootHtmlElementCurrent()&&(e.openElements.pop(),!e.fragmentContext&&e.openElements.currentTagId!==Y.FRAMESET&&(e.insertionMode=Q.AFTER_FRAMESET))}function dy(e,t){switch(t.tagID){case Y.HTML:uv(e,t);break;case Y.NOFRAMES:y_(e,t);break;default:}}function fy(e,t){t.tagID===Y.HTML&&(e.insertionMode=Q.AFTER_AFTER_FRAMESET)}function py(e,t){t.tagID===Y.HTML?uv(e,t):my(e,t)}function my(e,t){e.insertionMode=Q.IN_BODY,k_(e,t)}function hy(e,t){switch(t.tagID){case Y.HTML:uv(e,t);break;case Y.NOFRAMES:y_(e,t);break;default:}}function gy(e,t){t.chars=`�`,e._insertCharacters(t)}function _y(e,t){e._insertCharacters(t),e.framesetOk=!1}function vy(e){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==q.HTML&&e.openElements.currentTagId!==void 0&&!e._isIntegrationPoint(e.openElements.currentTagId,e.openElements.current);)e.openElements.pop()}function yy(e,t){if(zg(t))vy(e),e._startTagOutsideForeignContent(t);else{let n=e._getAdjustedCurrentElement(),r=e.treeAdapter.getNamespaceURI(n);r===q.MATHML?Bg(t):r===q.SVG&&(Ug(t),Vg(t)),Hg(t),t.selfClosing?e._appendElement(t,r):e._insertElement(t,r),t.ackSelfClosing=!0}}function by(e,t){if(t.tagID===Y.P||t.tagID===Y.BR){vy(e),e._endTagOutsideForeignContent(t);return}for(let n=e.openElements.stackTop;n>0;n--){let r=e.openElements.items[n];if(e.treeAdapter.getNamespaceURI(r)===q.HTML){e._endTagOutsideForeignContent(t);break}let i=e.treeAdapter.getTagName(r);if(i.toLowerCase()===t.tagName){t.tagName=i,e.openElements.shortenToLength(n);break}}}new Set([J.AREA,J.BASE,J.BASEFONT,J.BGSOUND,J.BR,J.COL,J.EMBED,J.FRAME,J.HR,J.IMG,J.INPUT,J.KEYGEN,J.LINK,J.META,J.PARAM,J.SOURCE,J.TRACK,J.WBR]);function xy(e,t){return $g.parse(e,t)}function Sy(e,t,n){typeof e==`string`&&(n=t,t=e,e=null);let r=$g.getFragmentParser(e,n);return r.tokenizer.write(t,!0),r.getFragment()}var Cy={abandonedHeadElementChild:{reason:`Unexpected metadata element after head`,description:"Unexpected element after head. Expected the element before `</head>`",url:!1},abruptClosingOfEmptyComment:{reason:`Unexpected abruptly closed empty comment`,description:"Unexpected `>` or `->`. Expected `-->` to close comments"},abruptDoctypePublicIdentifier:{reason:`Unexpected abruptly closed public identifier`,description:"Unexpected `>`. Expected a closing `\"` or `'` after the public identifier"},abruptDoctypeSystemIdentifier:{reason:`Unexpected abruptly closed system identifier`,description:"Unexpected `>`. Expected a closing `\"` or `'` after the identifier identifier"},absenceOfDigitsInNumericCharacterReference:{reason:`Unexpected non-digit at start of numeric character reference`,description:"Unexpected `%c`. Expected `[0-9]` for decimal references or `[0-9a-fA-F]` for hexadecimal references"},cdataInHtmlContent:{reason:`Unexpected CDATA section in HTML`,description:"Unexpected `<![CDATA[` in HTML. Remove it, use a comment, or encode special characters instead"},characterReferenceOutsideUnicodeRange:{reason:`Unexpected too big numeric character reference`,description:`Unexpectedly high character reference. Expected character references to be at most hexadecimal 10ffff (or decimal 1114111)`},closingOfElementWithOpenChildElements:{reason:`Unexpected closing tag with open child elements`,description:`Unexpectedly closing tag. Expected other tags to be closed first`,url:!1},controlCharacterInInputStream:{reason:`Unexpected control character`,description:"Unexpected control character `%x`. Expected a non-control code point, 0x00, or ASCII whitespace"},controlCharacterReference:{reason:`Unexpected control character reference`,description:`Unexpectedly control character in reference. Expected a non-control code point, 0x00, or ASCII whitespace`},disallowedContentInNoscriptInHead:{reason:"Disallowed content inside `<noscript>` in `<head>`",description:"Unexpected text character `%c`. Only use text in `<noscript>`s in `<body>`",url:!1},duplicateAttribute:{reason:`Unexpected duplicate attribute`,description:`Unexpectedly double attribute. Expected attributes to occur only once`},endTagWithAttributes:{reason:`Unexpected attribute on closing tag`,description:"Unexpected attribute. Expected `>` instead"},endTagWithTrailingSolidus:{reason:`Unexpected slash at end of closing tag`,description:"Unexpected `%c-1`. Expected `>` instead"},endTagWithoutMatchingOpenElement:{reason:`Unexpected unopened end tag`,description:`Unexpected end tag. Expected no end tag or another end tag`,url:!1},eofBeforeTagName:{reason:`Unexpected end of file`,description:`Unexpected end of file. Expected tag name instead`},eofInCdata:{reason:`Unexpected end of file in CDATA`,description:"Unexpected end of file. Expected `]]>` to close the CDATA"},eofInComment:{reason:`Unexpected end of file in comment`,description:"Unexpected end of file. Expected `-->` to close the comment"},eofInDoctype:{reason:`Unexpected end of file in doctype`,description:"Unexpected end of file. Expected a valid doctype (such as `<!doctype html>`)"},eofInElementThatCanContainOnlyText:{reason:`Unexpected end of file in element that can only contain text`,description:`Unexpected end of file. Expected text or a closing tag`,url:!1},eofInScriptHtmlCommentLikeText:{reason:`Unexpected end of file in comment inside script`,description:"Unexpected end of file. Expected `-->` to close the comment"},eofInTag:{reason:`Unexpected end of file in tag`,description:"Unexpected end of file. Expected `>` to close the tag"},incorrectlyClosedComment:{reason:`Incorrectly closed comment`,description:"Unexpected `%c-1`. Expected `-->` to close the comment"},incorrectlyOpenedComment:{reason:`Incorrectly opened comment`,description:"Unexpected `%c`. Expected `<!--` to open the comment"},invalidCharacterSequenceAfterDoctypeName:{reason:`Invalid sequence after doctype name`,description:"Unexpected sequence at `%c`. Expected `public` or `system`"},invalidFirstCharacterOfTagName:{reason:`Invalid first character in tag name`,description:"Unexpected `%c`. Expected an ASCII letter instead"},misplacedDoctype:{reason:`Misplaced doctype`,description:`Unexpected doctype. Expected doctype before head`,url:!1},misplacedStartTagForHeadElement:{reason:"Misplaced `<head>` start tag",description:"Unexpected start tag `<head>`. Expected `<head>` directly after doctype",url:!1},missingAttributeValue:{reason:`Missing attribute value`,description:"Unexpected `%c-1`. Expected an attribute value or no `%c-1` instead"},missingDoctype:{reason:`Missing doctype before other content`,description:"Expected a `<!doctype html>` before anything else",url:!1},missingDoctypeName:{reason:`Missing doctype name`,description:"Unexpected doctype end at `%c`. Expected `html` instead"},missingDoctypePublicIdentifier:{reason:`Missing public identifier in doctype`,description:"Unexpected `%c`. Expected identifier for `public` instead"},missingDoctypeSystemIdentifier:{reason:`Missing system identifier in doctype`,description:'Unexpected `%c`. Expected identifier for `system` instead (suggested: `"about:legacy-compat"`)'},missingEndTagName:{reason:`Missing name in end tag`,description:"Unexpected `%c`. Expected an ASCII letter instead"},missingQuoteBeforeDoctypePublicIdentifier:{reason:`Missing quote before public identifier in doctype`,description:"Unexpected `%c`. Expected `\"` or `'` instead"},missingQuoteBeforeDoctypeSystemIdentifier:{reason:`Missing quote before system identifier in doctype`,description:"Unexpected `%c`. Expected `\"` or `'` instead"},missingSemicolonAfterCharacterReference:{reason:`Missing semicolon after character reference`,description:"Unexpected `%c`. Expected `;` instead"},missingWhitespaceAfterDoctypePublicKeyword:{reason:`Missing whitespace after public identifier in doctype`,description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceAfterDoctypeSystemKeyword:{reason:`Missing whitespace after system identifier in doctype`,description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBeforeDoctypeName:{reason:`Missing whitespace before doctype name`,description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBetweenAttributes:{reason:`Missing whitespace between attributes`,description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers:{reason:`Missing whitespace between public and system identifiers in doctype`,description:"Unexpected `%c`. Expected ASCII whitespace instead"},nestedComment:{reason:`Unexpected nested comment`,description:"Unexpected `<!--`. Expected `-->`"},nestedNoscriptInHead:{reason:"Unexpected nested `<noscript>` in `<head>`",description:"Unexpected `<noscript>`. Expected a closing tag or a meta element",url:!1},nonConformingDoctype:{reason:`Unexpected non-conforming doctype declaration`,description:'Expected `<!doctype html>` or `<!doctype html system "about:legacy-compat">`',url:!1},nonVoidHtmlElementStartTagWithTrailingSolidus:{reason:`Unexpected trailing slash on start tag of non-void element`,description:"Unexpected `/`. Expected `>` instead"},noncharacterCharacterReference:{reason:`Unexpected noncharacter code point referenced by character reference`,description:`Unexpected code point. Do not use noncharacters in HTML`},noncharacterInInputStream:{reason:`Unexpected noncharacter character`,description:"Unexpected code point `%x`. Do not use noncharacters in HTML"},nullCharacterReference:{reason:`Unexpected NULL character referenced by character reference`,description:`Unexpected code point. Do not use NULL characters in HTML`},openElementsLeftAfterEof:{reason:`Unexpected end of file`,description:`Unexpected end of file. Expected closing tag instead`,url:!1},surrogateCharacterReference:{reason:`Unexpected surrogate character referenced by character reference`,description:`Unexpected code point. Do not use lone surrogate characters in HTML`},surrogateInInputStream:{reason:`Unexpected surrogate character`,description:"Unexpected code point `%x`. Do not use lone surrogate characters in HTML"},unexpectedCharacterAfterDoctypeSystemIdentifier:{reason:`Invalid character after system identifier in doctype`,description:"Unexpected character at `%c`. Expected `>`"},unexpectedCharacterInAttributeName:{reason:`Unexpected character in attribute name`,description:"Unexpected `%c`. Expected whitespace, `/`, `>`, `=`, or probably an ASCII letter"},unexpectedCharacterInUnquotedAttributeValue:{reason:`Unexpected character in unquoted attribute value`,description:"Unexpected `%c`. Quote the attribute value to include it"},unexpectedEqualsSignBeforeAttributeName:{reason:`Unexpected equals sign before attribute name`,description:"Unexpected `%c`. Add an attribute name before it"},unexpectedNullCharacter:{reason:`Unexpected NULL character`,description:"Unexpected code point `%x`. Do not use NULL characters in HTML"},unexpectedQuestionMarkInsteadOfTagName:{reason:`Unexpected question mark instead of tag name`,description:"Unexpected `%c`. Expected an ASCII letter instead"},unexpectedSolidusInTag:{reason:`Unexpected slash in tag`,description:"Unexpected `%c-1`. Expected it followed by `>` or in a quoted attribute value"},unknownNamedCharacterReference:{reason:`Unexpected unknown named character reference`,description:`Unexpected character reference. Expected known named character references`}},wy=`https://html.spec.whatwg.org/multipage/parsing.html#parse-error-`,Ty=/-[a-z]/g,Ey=/%c(?:([-+])(\d+))?/g,Dy=/%x/g,Oy={2:!0,1:!1,0:null},ky={};function Ay(e,t){let n=t||ky,r=n.onerror,i=e instanceof Cm?e:new Cm(e),a=n.fragment?Sy:xy,o=String(i);return ch(a(o,{sourceCodeLocationInfo:!0,onParseError:n.onerror?s:null,scriptingEnabled:!1}),{file:i,space:n.space,verbose:n.verbose});function s(e){let t=e.code,a=jy(t),s=n[a]??!0,c=typeof s==`number`?s:+!!s;if(c){let n=Cy[a],o=new fl(l(n.reason),{place:{start:{line:e.startLine,column:e.startCol,offset:e.startOffset},end:{line:e.endLine,column:e.endCol,offset:e.endOffset}},ruleId:t,source:`hast-util-from-html`});i.path&&(o.file=i.path,o.name=i.path+`:`+o.name),o.fatal=Oy[c],o.note=l(n.description),o.url=n.url===!1?void 0:wy+t,r(o)}function l(t){return t.replace(Ey,n).replace(Dy,r);function n(t,n,r){let i=(r?Number.parseInt(r,10):0)*(n===`-`?-1:1);return Ny(o.charAt(e.startOffset+i))}function r(){return Py(o.charCodeAt(e.startOffset))}}}}function jy(e){return e.replace(Ty,My)}function My(e){return e.charAt(1).toUpperCase()}function Ny(e){return e==="`"?"` ` `":e}function Py(e){return`0x`+e.toString(16).toUpperCase()}function Fy(e,t){let n=(t||{}).force||!1;qp(e,r);function r(e){n?delete e.position:e.position=void 0}}function Iy(e,t){let n=Ay(e,t);return Fy(n,{force:!0}),delete n.data,n}var Ly=(function(e,t,n){let r=Fp(n);if(!e||!e.type||!e.children)throw Error(`Expected parent node`);if(typeof t==`number`){if(t<0||t===1/0)throw Error(`Expected positive finite number as index`)}else if(t=e.children.indexOf(t),t<0)throw Error(`Expected child node or index`);for(;++t<e.children.length;)if(r(e.children[t],t,e))return e.children[t]}),Ry=(function(e){if(e==null)return Hy;if(typeof e==`string`)return By(e);if(typeof e==`object`)return zy(e);if(typeof e==`function`)return Vy(e);throw Error("Expected function, string, or array as `test`")});function zy(e){let t=[],n=-1;for(;++n<e.length;)t[n]=Ry(e[n]);return Vy(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function By(e){return Vy(t);function t(t){return t.tagName===e}}function Vy(e){return t;function t(t,n,r){return!!(Uy(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function Hy(e){return!!(e&&typeof e==`object`&&`type`in e&&e.type===`element`&&`tagName`in e&&typeof e.tagName==`string`)}function Uy(e){return typeof e==`object`&&!!e&&`type`in e&&`tagName`in e}var Wy=/\n/g,Gy=/[\t ]+/g,Ky=Ry(`br`),qy=Ry(ob),Jy=Ry(`p`),Yy=Ry(`tr`),Xy=Ry([`datalist`,`head`,`noembed`,`noframes`,`noscript`,`rp`,`script`,`style`,`template`,`title`,ab,sb]),Zy=Ry(`address.article.aside.blockquote.body.caption.center.dd.dialog.dir.dl.dt.div.figure.figcaption.footer.form,.h1.h2.h3.h4.h5.h6.header.hgroup.hr.html.legend.li.listing.main.menu.nav.ol.p.plaintext.pre.section.ul.xmp`.split(`.`));function Qy(e,t){let n=t||{},r=`children`in e?e.children:[],i=Zy(e),a=ib(e,{whitespace:n.whitespace||`normal`,breakBefore:!1,breakAfter:!1}),o=[];(e.type===`text`||e.type===`comment`)&&o.push(...tb(e,{whitespace:a,breakBefore:!0,breakAfter:!0}));let s=-1;for(;++s<r.length;)o.push(...$y(r[s],e,{whitespace:a,breakBefore:s?void 0:i,breakAfter:s<r.length-1?Ky(r[s+1]):i}));let c=[],l;for(s=-1;++s<o.length;){let e=o[s];typeof e==`number`?l!==void 0&&e>l&&(l=e):e&&(l!==void 0&&l>-1&&c.push(`
|
|
34
|
+
`.repeat(l)||` `),l=-1,c.push(e))}return c.join(``)}function $y(e,t,n){return e.type===`element`?eb(e,t,n):e.type===`text`?n.whitespace===`normal`?tb(e,n):nb(e):[]}function eb(e,t,n){let r=ib(e,n),i=e.children||[],a=-1,o=[];if(Xy(e))return o;let s,c;for(Ky(e)||Yy(e)&&Ly(t,e,Yy)?c=`
|
|
35
|
+
`:Jy(e)?(s=2,c=2):Zy(e)&&(s=1,c=1);++a<i.length;)o=o.concat($y(i[a],e,{whitespace:r,breakBefore:a?void 0:s,breakAfter:a<i.length-1?Ky(i[a+1]):c}));return qy(e)&&Ly(t,e,qy)&&o.push(` `),s&&o.unshift(s),c&&o.push(c),o}function tb(e,t){let n=String(e.value),r=[],i=[],a=0;for(;a<=n.length;){Wy.lastIndex=a;let e=Wy.exec(n),i=e&&`index`in e?e.index:n.length;r.push(rb(n.slice(a,i).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,``),a===0?t.breakBefore:!0,i===n.length?t.breakAfter:!0)),a=i+1}let o=-1,s;for(;++o<r.length;)r[o].charCodeAt(r[o].length-1)===8203||o<r.length-1&&r[o+1].charCodeAt(0)===8203?(i.push(r[o]),s=void 0):r[o]?(typeof s==`number`&&i.push(s),i.push(r[o]),s=0):(o===0||o===r.length-1)&&i.push(0);return i}function nb(e){return[String(e.value)]}function rb(e,t,n){let r=[],i=0,a;for(;i<e.length;){Gy.lastIndex=i;let n=Gy.exec(e);a=n?n.index:e.length,!i&&!a&&n&&!t&&r.push(``),i!==a&&r.push(e.slice(i,a)),i=n?a+n[0].length:a}return i!==a&&!n&&r.push(``),r.join(` `)}function ib(e,t){if(e.type===`element`){let n=e.properties||{};switch(e.tagName){case`listing`:case`plaintext`:case`xmp`:return`pre`;case`nobr`:return`nowrap`;case`pre`:return n.wrap?`pre-wrap`:`pre`;case`td`:case`th`:return n.noWrap?`nowrap`:t.whitespace;case`textarea`:return`pre-wrap`;default:}}return t.whitespace}function ab(e){return!!(e.properties||{}).hidden}function ob(e){return e.tagName===`td`||e.tagName===`th`}function sb(e){return e.tagName===`dialog`&&!(e.properties||{}).open}var cb={},lb=[];function ub(e){let t=e||cb;return function(e,n){Gp(e,`element`,function(e,r){let i=Array.isArray(e.properties.className)?e.properties.className:lb,a=i.includes(`language-math`),o=i.includes(`math-display`),s=i.includes(`math-inline`),c=o;if(!a&&!o&&!s)return;let l=r[r.length-1],u=e;if(e.tagName===`code`&&a&&l&&l.type===`element`&&l.tagName===`pre`&&(u=l,l=r[r.length-2],c=!0),!l)return;let d=Qy(u,{whitespace:`pre`}),f;try{f=Gn.renderToString(d,{...t,displayMode:c,throwOnError:!0})}catch(i){let a=i,o=a.name.toLowerCase();n.message(`Could not render math with KaTeX`,{ancestors:[...r,e],cause:a,place:e.position,ruleId:o,source:`rehype-katex`});try{f=Gn.renderToString(d,{...t,displayMode:c,strict:`ignore`,throwOnError:!1})}catch{f=[{type:`element`,tagName:`span`,properties:{className:[`katex-error`],style:`color:`+(t.errorColor||`#cc0000`),title:String(i)},children:[{type:`text`,value:d}]}]}}typeof f==`string`&&(f=Iy(f,{fragment:!0}).children);let p=l.children.indexOf(u);return l.children.splice(p,1,...f),Wp})}}var db=class{constructor(e,t,n){this.property=e,this.normal=t,n&&(this.space=n)}};db.prototype.property={},db.prototype.normal={},db.prototype.space=null;function fb(e,t){let n={},r={},i=-1;for(;++i<e.length;)Object.assign(n,e[i].property),Object.assign(r,e[i].normal);return new db(n,r,t)}function pb(e){return e.toLowerCase()}var mb=class{constructor(e,t){this.property=e,this.attribute=t}};mb.prototype.space=null,mb.prototype.boolean=!1,mb.prototype.booleanish=!1,mb.prototype.overloadedBoolean=!1,mb.prototype.number=!1,mb.prototype.commaSeparated=!1,mb.prototype.spaceSeparated=!1,mb.prototype.commaOrSpaceSeparated=!1,mb.prototype.mustUseProperty=!1,mb.prototype.defined=!1;var hb=t({boolean:()=>_b,booleanish:()=>vb,commaOrSpaceSeparated:()=>Sb,commaSeparated:()=>xb,number:()=>$,overloadedBoolean:()=>yb,spaceSeparated:()=>bb}),gb=0,_b=Cb(),vb=Cb(),yb=Cb(),$=Cb(),bb=Cb(),xb=Cb(),Sb=Cb();function Cb(){return 2**++gb}var wb=Object.keys(hb),Tb=class extends mb{constructor(e,t,n,r){let i=-1;if(super(e,t),Eb(this,`space`,r),typeof n==`number`)for(;++i<wb.length;){let e=wb[i];Eb(this,wb[i],(n&hb[e])===hb[e])}}};Tb.prototype.defined=!0;function Eb(e,t,n){n&&(e[t]=n)}var Db={}.hasOwnProperty;function Ob(e){let t={},n={},r;for(r in e.properties)if(Db.call(e.properties,r)){let i=e.properties[r],a=new Tb(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[pb(r)]=r,n[pb(a.attribute)]=r}return new db(t,n,e.space)}var kb=Ob({space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()},properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null}}),Ab=Ob({space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()},properties:{xmlLang:null,xmlBase:null,xmlSpace:null}});function jb(e,t){return t in e?e[t]:t}function Mb(e,t){return jb(e,t.toLowerCase())}var Nb=Ob({space:`xmlns`,attributes:{xmlnsxlink:`xmlns:xlink`},transform:Mb,properties:{xmlns:null,xmlnsXLink:null}}),Pb=Ob({transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()},properties:{ariaActiveDescendant:null,ariaAtomic:vb,ariaAutoComplete:null,ariaBusy:vb,ariaChecked:vb,ariaColCount:$,ariaColIndex:$,ariaColSpan:$,ariaControls:bb,ariaCurrent:null,ariaDescribedBy:bb,ariaDetails:null,ariaDisabled:vb,ariaDropEffect:bb,ariaErrorMessage:null,ariaExpanded:vb,ariaFlowTo:bb,ariaGrabbed:vb,ariaHasPopup:null,ariaHidden:vb,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:bb,ariaLevel:$,ariaLive:null,ariaModal:vb,ariaMultiLine:vb,ariaMultiSelectable:vb,ariaOrientation:null,ariaOwns:bb,ariaPlaceholder:null,ariaPosInSet:$,ariaPressed:vb,ariaReadOnly:vb,ariaRelevant:null,ariaRequired:vb,ariaRoleDescription:bb,ariaRowCount:$,ariaRowIndex:$,ariaRowSpan:$,ariaSelected:vb,ariaSetSize:$,ariaSort:null,ariaValueMax:$,ariaValueMin:$,ariaValueNow:$,ariaValueText:null,role:null}}),Fb=Ob({space:`html`,attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},transform:Mb,mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:xb,acceptCharset:bb,accessKey:bb,action:null,allow:null,allowFullScreen:_b,allowPaymentRequest:_b,allowUserMedia:_b,alt:null,as:null,async:_b,autoCapitalize:null,autoComplete:bb,autoFocus:_b,autoPlay:_b,blocking:bb,capture:null,charSet:null,checked:_b,cite:null,className:bb,cols:$,colSpan:null,content:null,contentEditable:vb,controls:_b,controlsList:bb,coords:$|xb,crossOrigin:null,data:null,dateTime:null,decoding:null,default:_b,defer:_b,dir:null,dirName:null,disabled:_b,download:yb,draggable:vb,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:_b,formTarget:null,headers:bb,height:$,hidden:_b,high:$,href:null,hrefLang:null,htmlFor:bb,httpEquiv:bb,id:null,imageSizes:null,imageSrcSet:null,inert:_b,inputMode:null,integrity:null,is:null,isMap:_b,itemId:null,itemProp:bb,itemRef:bb,itemScope:_b,itemType:bb,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:_b,low:$,manifest:null,max:null,maxLength:$,media:null,method:null,min:null,minLength:$,multiple:_b,muted:_b,name:null,nonce:null,noModule:_b,noValidate:_b,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:_b,optimum:$,pattern:null,ping:bb,placeholder:null,playsInline:_b,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:_b,referrerPolicy:null,rel:bb,required:_b,reversed:_b,rows:$,rowSpan:$,sandbox:bb,scope:null,scoped:_b,seamless:_b,selected:_b,shadowRootClonable:_b,shadowRootDelegatesFocus:_b,shadowRootMode:null,shape:null,size:$,sizes:null,slot:null,span:$,spellCheck:vb,src:null,srcDoc:null,srcLang:null,srcSet:null,start:$,step:null,style:null,tabIndex:$,target:null,title:null,translate:null,type:null,typeMustMatch:_b,useMap:null,value:vb,width:$,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:bb,axis:null,background:null,bgColor:null,border:$,borderColor:null,bottomMargin:$,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:_b,declare:_b,event:null,face:null,frame:null,frameBorder:null,hSpace:$,leftMargin:$,link:null,longDesc:null,lowSrc:null,marginHeight:$,marginWidth:$,noResize:_b,noHref:_b,noShade:_b,noWrap:_b,object:null,profile:null,prompt:null,rev:null,rightMargin:$,rules:null,scheme:null,scrolling:vb,standby:null,summary:null,text:null,topMargin:$,valueType:null,version:null,vAlign:null,vLink:null,vSpace:$,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:_b,disableRemotePlayback:_b,prefix:null,property:null,results:$,security:null,unselectable:null}}),Ib=Ob({space:`svg`,attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},transform:jb,properties:{about:Sb,accentHeight:$,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:$,amplitude:$,arabicForm:null,ascent:$,attributeName:null,attributeType:null,azimuth:$,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:$,by:null,calcMode:null,capHeight:$,className:bb,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:$,diffuseConstant:$,direction:null,display:null,dur:null,divisor:$,dominantBaseline:null,download:_b,dx:null,dy:null,edgeMode:null,editable:null,elevation:$,enableBackground:null,end:null,event:null,exponent:$,externalResourcesRequired:null,fill:null,fillOpacity:$,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:xb,g2:xb,glyphName:xb,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:$,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:$,horizOriginX:$,horizOriginY:$,id:null,ideographic:$,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:$,k:$,k1:$,k2:$,k3:$,k4:$,kernelMatrix:Sb,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:$,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:$,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:$,overlineThickness:$,paintOrder:null,panose1:null,path:null,pathLength:$,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:bb,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:$,pointsAtY:$,pointsAtZ:$,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Sb,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Sb,rev:Sb,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Sb,requiredFeatures:Sb,requiredFonts:Sb,requiredFormats:Sb,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:$,specularExponent:$,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:$,strikethroughThickness:$,string:null,stroke:null,strokeDashArray:Sb,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:$,strokeOpacity:$,strokeWidth:null,style:null,surfaceScale:$,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Sb,tabIndex:$,tableValues:null,target:null,targetX:$,targetY:$,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Sb,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:$,underlineThickness:$,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:$,values:null,vAlphabetic:$,vMathematical:$,vectorEffect:null,vHanging:$,vIdeographic:$,version:null,vertAdvY:$,vertOriginX:$,vertOriginY:$,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:$,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null}}),Lb=/^data[-\w.:]+$/i,Rb=/-[a-z]/g,zb=/[A-Z]/g;function Bb(e,t){let n=pb(t),r=t,i=mb;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&Lb.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(Rb,Hb);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!Rb.test(e)){let n=e.replace(zb,Vb);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=Tb}return new i(r,t)}function Vb(e){return`-`+e.toLowerCase()}function Hb(e){return e.charAt(1).toUpperCase()}var Ub=fb([Ab,kb,Nb,Pb,Fb],`html`),Wb=fb([Ab,kb,Nb,Pb,Ib],`svg`),Gb={}.hasOwnProperty;function Kb(e,t){let n=t||{};function r(t,...n){let i=r.invalid,a=r.handlers;if(t&&Gb.call(t,e)){let n=String(t[e]);i=Gb.call(a,n)?a[n]:r.unknown}if(i)return i.call(this,t,...n)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}var qb={},Jb={}.hasOwnProperty,Yb=Kb(`type`,{handlers:{root:Zb,element:nx,text:ex,comment:tx,doctype:$b}});function Xb(e,t){let n=(t||qb).space;return Yb(e,n===`svg`?Wb:Ub)}function Zb(e,t){let n={nodeName:`#document`,mode:(e.data||{}).quirksMode?`quirks`:`no-quirks`,childNodes:[]};return n.childNodes=ix(e.children,n,t),ax(e,n),n}function Qb(e,t){let n={nodeName:`#document-fragment`,childNodes:[]};return n.childNodes=ix(e.children,n,t),ax(e,n),n}function $b(e){let t={nodeName:`#documentType`,name:`html`,publicId:``,systemId:``,parentNode:null};return ax(e,t),t}function ex(e){let t={nodeName:`#text`,value:e.value,parentNode:null};return ax(e,t),t}function tx(e){let t={nodeName:`#comment`,data:e.value,parentNode:null};return ax(e,t),t}function nx(e,t){let n=t,r=n;e.type===`element`&&e.tagName.toLowerCase()===`svg`&&n.space===`html`&&(r=Wb);let i=[],a;if(e.properties){for(a in e.properties)if(a!==`children`&&Jb.call(e.properties,a)){let t=rx(r,a,e.properties[a]);t&&i.push(t)}}let o=r.space,s={nodeName:e.tagName,tagName:e.tagName,attrs:i,namespaceURI:ah[o],childNodes:[],parentNode:null};return s.childNodes=ix(e.children,s,r),ax(e,s),e.tagName===`template`&&e.content&&(s.content=Qb(e.content,r)),s}function rx(e,t,n){let r=Bb(e,t);if(n===!1||n==null||typeof n==`number`&&Number.isNaN(n)||!n&&r.boolean)return;Array.isArray(n)&&(n=r.commaSeparated?In(n):Mn(n));let i={name:r.attribute,value:n===!0?``:String(n)};if(r.space&&r.space!==`html`&&r.space!==`svg`){let e=i.name.indexOf(`:`);e<0?i.prefix=``:(i.name=i.name.slice(e+1),i.prefix=r.attribute.slice(0,e)),i.namespace=ah[r.space]}return i}function ix(e,t,n){let r=-1,i=[];if(e)for(;++r<e.length;){let a=Yb(e[r],n);a.parentNode=t,i.push(a)}return i}function ax(e,t){let n=e.position;n&&n.start&&n.end&&(n.start.offset,n.end.offset,t.sourceCodeLocation={startLine:n.start.line,startCol:n.start.column,startOffset:n.start.offset,endLine:n.end.line,endCol:n.end.column,endOffset:n.end.offset})}var ox=[`area`,`base`,`basefont`,`bgsound`,`br`,`col`,`command`,`embed`,`frame`,`hr`,`image`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`],sx=/<(\/?)(iframe|noembed|noframes|plaintext|script|style|textarea|title|xmp)(?=[\t\n\f\r />])/gi,cx=new Set([`mdxFlowExpression`,`mdxJsxFlowElement`,`mdxJsxTextElement`,`mdxTextExpression`,`mdxjsEsm`]),lx={sourceCodeLocationInfo:!0,scriptingEnabled:!1};function ux(e,t){let n=wx(e),r=Kb(`type`,{handlers:{root:fx,element:px,text:mx,comment:_x,doctype:hx,raw:vx},unknown:yx}),i={parser:n?new $g(lx):$g.getFragmentParser(void 0,lx),handle(e){r(e,i)},stitches:!1,options:t||{}};r(e,i),bx(i,al());let a=ch(n?i.parser.document:i.parser.getFragment(),{file:i.options.file});return i.stitches&&qp(a,`comment`,function(e,t,n){let r=e;if(r.value.stitch&&n&&t!==void 0){let e=n.children;return e[t]=r.value.stitch,t}}),a.type===`root`&&a.children.length===1&&a.children[0].type===e.type?a.children[0]:a}function dx(e,t){let n=-1;if(e)for(;++n<e.length;)t.handle(e[n])}function fx(e,t){dx(e.children,t)}function px(e,t){Sx(e,t),dx(e.children,t),Cx(e,t)}function mx(e,t){t.parser.tokenizer.state>4&&(t.parser.tokenizer.state=0);let n={type:Th.CHARACTER,chars:e.value,location:Tx(e)};bx(t,al(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function hx(e,t){let n={type:Th.DOCTYPE,name:`html`,forceQuirks:!1,publicId:``,systemId:``,location:Tx(e)};bx(t,al(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function gx(e,t){t.stitches=!0;let n=Ex(e);`children`in e&&`children`in n&&(n.children=ux({type:`root`,children:e.children},t.options).children),_x({type:`comment`,value:{stitch:n}},t)}function _x(e,t){let n=e.value,r={type:Th.COMMENT,data:n,location:Tx(e)};bx(t,al(e)),t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken)}function vx(e,t){if(t.parser.tokenizer.preprocessor.html=``,t.parser.tokenizer.preprocessor.pos=-1,t.parser.tokenizer.preprocessor.lastGapPos=-2,t.parser.tokenizer.preprocessor.gapStack=[],t.parser.tokenizer.preprocessor.skipNextNewLine=!1,t.parser.tokenizer.preprocessor.lastChunkWritten=!1,t.parser.tokenizer.preprocessor.endOfChunkHit=!1,t.parser.tokenizer.preprocessor.isEol=!1,xx(t,al(e)),t.parser.tokenizer.write(t.options.tagfilter?e.value.replace(sx,`<$1$2`):e.value,!1),t.parser.tokenizer._runParsingLoop(),t.parser.tokenizer.state===72||t.parser.tokenizer.state===78){t.parser.tokenizer.preprocessor.lastChunkWritten=!0;let e=t.parser.tokenizer._consume();t.parser.tokenizer._callState(e)}}function yx(e,t){let n=e;if(t.options.passThrough&&t.options.passThrough.includes(n.type))gx(n,t);else{let e=``;throw cx.has(n.type)&&(e=". It looks like you are using MDX nodes with `hast-util-raw` (or `rehype-raw`). If you use this because you are using remark or rehype plugins that inject `'html'` nodes, then please raise an issue with that plugin, as its a bad and slow idea. If you use this because you are using markdown syntax, then you have to configure this utility (or plugin) to pass through these nodes (see `passThrough` in docs), but you can also migrate to use the MDX syntax"),Error("Cannot compile `"+n.type+"` node"+e)}}function bx(e,t){xx(e,t);let n=e.parser.tokenizer.currentCharacterToken;n&&n.location&&(n.location.endLine=e.parser.tokenizer.preprocessor.line,n.location.endCol=e.parser.tokenizer.preprocessor.col+1,n.location.endOffset=e.parser.tokenizer.preprocessor.offset+1,e.parser.currentToken=n,e.parser._processToken(e.parser.currentToken)),e.parser.tokenizer.paused=!1,e.parser.tokenizer.inLoop=!1,e.parser.tokenizer.active=!1,e.parser.tokenizer.returnState=qh.DATA,e.parser.tokenizer.charRefCode=-1,e.parser.tokenizer.consumedAfterSnapshot=-1,e.parser.tokenizer.currentLocation=null,e.parser.tokenizer.currentCharacterToken=null,e.parser.tokenizer.currentToken=null,e.parser.tokenizer.currentAttr={name:``,value:``}}function xx(e,t){if(t&&t.offset!==void 0){let n={startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:-1,endCol:-1,endOffset:-1};e.parser.tokenizer.preprocessor.lineStartPos=-t.column+1,e.parser.tokenizer.preprocessor.droppedBufferSize=t.offset,e.parser.tokenizer.preprocessor.line=t.line,e.parser.tokenizer.currentLocation=n}}function Sx(e,t){let n=e.tagName.toLowerCase();if(t.parser.tokenizer.state===qh.PLAINTEXT)return;bx(t,al(e));let r=t.parser.openElements.current,i=`namespaceURI`in r?r.namespaceURI:ah.html;i===ah.html&&n===`svg`&&(i=ah.svg);let a=Xb({...e,children:[]},{space:i===ah.svg?`svg`:`html`}),o={type:Th.START_TAG,tagName:n,tagID:Wh(n),selfClosing:!1,ackSelfClosing:!1,attrs:`attrs`in a?a.attrs:[],location:Tx(e)};t.parser.currentToken=o,t.parser._processToken(t.parser.currentToken),t.parser.tokenizer.lastStartTagName=n}function Cx(e,t){let n=e.tagName.toLowerCase();if(!t.parser.tokenizer.inForeignNode&&ox.includes(n)||t.parser.tokenizer.state===qh.PLAINTEXT)return;bx(t,il(e));let r={type:Th.END_TAG,tagName:n,tagID:Wh(n),selfClosing:!1,ackSelfClosing:!1,attrs:[],location:Tx(e)};t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken),n===t.parser.tokenizer.lastStartTagName&&(t.parser.tokenizer.state===qh.RCDATA||t.parser.tokenizer.state===qh.RAWTEXT||t.parser.tokenizer.state===qh.SCRIPT_DATA)&&(t.parser.tokenizer.state=qh.DATA)}function wx(e){let t=e.type===`root`?e.children[0]:e;return!!(t&&(t.type===`doctype`||t.type===`element`&&t.tagName.toLowerCase()===`html`))}function Tx(e){let t=al(e)||{line:void 0,column:void 0,offset:void 0},n=il(e)||{line:void 0,column:void 0,offset:void 0};return{startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:n.line,endCol:n.column,endOffset:n.offset}}function Ex(e){return`children`in e?jp({...e,children:[]}):jp(e)}function Dx(e){return function(t,n){return ux(t,{...e,file:n})}}var Ox={carriageReturn:-5,lineFeed:-4,carriageReturnLineFeed:-3,horizontalTab:-2,virtualSpace:-1,eof:null,nul:0,soh:1,stx:2,etx:3,eot:4,enq:5,ack:6,bel:7,bs:8,ht:9,lf:10,vt:11,ff:12,cr:13,so:14,si:15,dle:16,dc1:17,dc2:18,dc3:19,dc4:20,nak:21,syn:22,etb:23,can:24,em:25,sub:26,esc:27,fs:28,gs:29,rs:30,us:31,space:32,exclamationMark:33,quotationMark:34,numberSign:35,dollarSign:36,percentSign:37,ampersand:38,apostrophe:39,leftParenthesis:40,rightParenthesis:41,asterisk:42,plusSign:43,comma:44,dash:45,dot:46,slash:47,digit0:48,digit1:49,digit2:50,digit3:51,digit4:52,digit5:53,digit6:54,digit7:55,digit8:56,digit9:57,colon:58,semicolon:59,lessThan:60,equalsTo:61,greaterThan:62,questionMark:63,atSign:64,uppercaseA:65,uppercaseB:66,uppercaseC:67,uppercaseD:68,uppercaseE:69,uppercaseF:70,uppercaseG:71,uppercaseH:72,uppercaseI:73,uppercaseJ:74,uppercaseK:75,uppercaseL:76,uppercaseM:77,uppercaseN:78,uppercaseO:79,uppercaseP:80,uppercaseQ:81,uppercaseR:82,uppercaseS:83,uppercaseT:84,uppercaseU:85,uppercaseV:86,uppercaseW:87,uppercaseX:88,uppercaseY:89,uppercaseZ:90,leftSquareBracket:91,backslash:92,rightSquareBracket:93,caret:94,underscore:95,graveAccent:96,lowercaseA:97,lowercaseB:98,lowercaseC:99,lowercaseD:100,lowercaseE:101,lowercaseF:102,lowercaseG:103,lowercaseH:104,lowercaseI:105,lowercaseJ:106,lowercaseK:107,lowercaseL:108,lowercaseM:109,lowercaseN:110,lowercaseO:111,lowercaseP:112,lowercaseQ:113,lowercaseR:114,lowercaseS:115,lowercaseT:116,lowercaseU:117,lowercaseV:118,lowercaseW:119,lowercaseX:120,lowercaseY:121,lowercaseZ:122,leftCurlyBrace:123,verticalBar:124,rightCurlyBrace:125,tilde:126,del:127,byteOrderMarker:65279,replacementCharacter:65533},kx={attentionSideAfter:2,attentionSideBefore:1,atxHeadingOpeningFenceSizeMax:6,autolinkDomainSizeMax:63,autolinkSchemeSizeMax:32,cdataOpeningString:`CDATA[`,characterGroupPunctuation:2,characterGroupWhitespace:1,characterReferenceDecimalSizeMax:7,characterReferenceHexadecimalSizeMax:6,characterReferenceNamedSizeMax:31,codeFencedSequenceSizeMin:3,contentTypeContent:`content`,contentTypeDocument:`document`,contentTypeFlow:`flow`,contentTypeString:`string`,contentTypeText:`text`,hardBreakPrefixSizeMin:2,htmlBasic:6,htmlCdata:5,htmlComment:2,htmlComplete:7,htmlDeclaration:4,htmlInstruction:3,htmlRawSizeMax:8,htmlRaw:1,linkResourceDestinationBalanceMax:32,linkReferenceSizeMax:999,listItemValueSizeMax:10,numericBaseDecimal:10,numericBaseHexadecimal:16,tabSize:4,thematicBreakMarkerCountMin:3,v8MaxSafeChunkSize:1e4},Ax={data:`data`,whitespace:`whitespace`,lineEnding:`lineEnding`,lineEndingBlank:`lineEndingBlank`,linePrefix:`linePrefix`,lineSuffix:`lineSuffix`,atxHeading:`atxHeading`,atxHeadingSequence:`atxHeadingSequence`,atxHeadingText:`atxHeadingText`,autolink:`autolink`,autolinkEmail:`autolinkEmail`,autolinkMarker:`autolinkMarker`,autolinkProtocol:`autolinkProtocol`,characterEscape:`characterEscape`,characterEscapeValue:`characterEscapeValue`,characterReference:`characterReference`,characterReferenceMarker:`characterReferenceMarker`,characterReferenceMarkerNumeric:`characterReferenceMarkerNumeric`,characterReferenceMarkerHexadecimal:`characterReferenceMarkerHexadecimal`,characterReferenceValue:`characterReferenceValue`,codeFenced:`codeFenced`,codeFencedFence:`codeFencedFence`,codeFencedFenceSequence:`codeFencedFenceSequence`,codeFencedFenceInfo:`codeFencedFenceInfo`,codeFencedFenceMeta:`codeFencedFenceMeta`,codeFlowValue:`codeFlowValue`,codeIndented:`codeIndented`,codeText:`codeText`,codeTextData:`codeTextData`,codeTextPadding:`codeTextPadding`,codeTextSequence:`codeTextSequence`,content:`content`,definition:`definition`,definitionDestination:`definitionDestination`,definitionDestinationLiteral:`definitionDestinationLiteral`,definitionDestinationLiteralMarker:`definitionDestinationLiteralMarker`,definitionDestinationRaw:`definitionDestinationRaw`,definitionDestinationString:`definitionDestinationString`,definitionLabel:`definitionLabel`,definitionLabelMarker:`definitionLabelMarker`,definitionLabelString:`definitionLabelString`,definitionMarker:`definitionMarker`,definitionTitle:`definitionTitle`,definitionTitleMarker:`definitionTitleMarker`,definitionTitleString:`definitionTitleString`,emphasis:`emphasis`,emphasisSequence:`emphasisSequence`,emphasisText:`emphasisText`,escapeMarker:`escapeMarker`,hardBreakEscape:`hardBreakEscape`,hardBreakTrailing:`hardBreakTrailing`,htmlFlow:`htmlFlow`,htmlFlowData:`htmlFlowData`,htmlText:`htmlText`,htmlTextData:`htmlTextData`,image:`image`,label:`label`,labelText:`labelText`,labelLink:`labelLink`,labelImage:`labelImage`,labelMarker:`labelMarker`,labelImageMarker:`labelImageMarker`,labelEnd:`labelEnd`,link:`link`,paragraph:`paragraph`,reference:`reference`,referenceMarker:`referenceMarker`,referenceString:`referenceString`,resource:`resource`,resourceDestination:`resourceDestination`,resourceDestinationLiteral:`resourceDestinationLiteral`,resourceDestinationLiteralMarker:`resourceDestinationLiteralMarker`,resourceDestinationRaw:`resourceDestinationRaw`,resourceDestinationString:`resourceDestinationString`,resourceMarker:`resourceMarker`,resourceTitle:`resourceTitle`,resourceTitleMarker:`resourceTitleMarker`,resourceTitleString:`resourceTitleString`,setextHeading:`setextHeading`,setextHeadingText:`setextHeadingText`,setextHeadingLine:`setextHeadingLine`,setextHeadingLineSequence:`setextHeadingLineSequence`,strong:`strong`,strongSequence:`strongSequence`,strongText:`strongText`,thematicBreak:`thematicBreak`,thematicBreakSequence:`thematicBreakSequence`,blockQuote:`blockQuote`,blockQuotePrefix:`blockQuotePrefix`,blockQuoteMarker:`blockQuoteMarker`,blockQuotePrefixWhitespace:`blockQuotePrefixWhitespace`,listOrdered:`listOrdered`,listUnordered:`listUnordered`,listItemIndent:`listItemIndent`,listItemMarker:`listItemMarker`,listItemPrefix:`listItemPrefix`,listItemPrefixWhitespace:`listItemPrefixWhitespace`,listItemValue:`listItemValue`,chunkDocument:`chunkDocument`,chunkContent:`chunkContent`,chunkFlow:`chunkFlow`,chunkText:`chunkText`,chunkString:`chunkString`};function jx(e){return e===161||e===164||e===167||e===168||e===170||e===173||e===174||e>=176&&e<=180||e>=182&&e<=186||e>=188&&e<=191||e===198||e===208||e===215||e===216||e>=222&&e<=225||e===230||e>=232&&e<=234||e===236||e===237||e===240||e===242||e===243||e>=247&&e<=250||e===252||e===254||e===257||e===273||e===275||e===283||e===294||e===295||e===299||e>=305&&e<=307||e===312||e>=319&&e<=322||e===324||e>=328&&e<=331||e===333||e===338||e===339||e===358||e===359||e===363||e===462||e===464||e===466||e===468||e===470||e===472||e===474||e===476||e===593||e===609||e===708||e===711||e>=713&&e<=715||e===717||e===720||e>=728&&e<=731||e===733||e===735||e>=768&&e<=879||e>=913&&e<=929||e>=931&&e<=937||e>=945&&e<=961||e>=963&&e<=969||e===1025||e>=1040&&e<=1103||e===1105||e===8208||e>=8211&&e<=8214||e===8216||e===8217||e===8220||e===8221||e>=8224&&e<=8226||e>=8228&&e<=8231||e===8240||e===8242||e===8243||e===8245||e===8251||e===8254||e===8308||e===8319||e>=8321&&e<=8324||e===8364||e===8451||e===8453||e===8457||e===8467||e===8470||e===8481||e===8482||e===8486||e===8491||e===8531||e===8532||e>=8539&&e<=8542||e>=8544&&e<=8555||e>=8560&&e<=8569||e===8585||e>=8592&&e<=8601||e===8632||e===8633||e===8658||e===8660||e===8679||e===8704||e===8706||e===8707||e===8711||e===8712||e===8715||e===8719||e===8721||e===8725||e===8730||e>=8733&&e<=8736||e===8739||e===8741||e>=8743&&e<=8748||e===8750||e>=8756&&e<=8759||e===8764||e===8765||e===8776||e===8780||e===8786||e===8800||e===8801||e>=8804&&e<=8807||e===8810||e===8811||e===8814||e===8815||e===8834||e===8835||e===8838||e===8839||e===8853||e===8857||e===8869||e===8895||e===8978||e>=9312&&e<=9449||e>=9451&&e<=9547||e>=9552&&e<=9587||e>=9600&&e<=9615||e>=9618&&e<=9621||e===9632||e===9633||e>=9635&&e<=9641||e===9650||e===9651||e===9654||e===9655||e===9660||e===9661||e===9664||e===9665||e>=9670&&e<=9672||e===9675||e>=9678&&e<=9681||e>=9698&&e<=9701||e===9711||e===9733||e===9734||e===9737||e===9742||e===9743||e===9756||e===9758||e===9792||e===9794||e===9824||e===9825||e>=9827&&e<=9829||e>=9831&&e<=9834||e===9836||e===9837||e===9839||e===9886||e===9887||e===9919||e>=9926&&e<=9933||e>=9935&&e<=9939||e>=9941&&e<=9953||e===9955||e===9960||e===9961||e>=9963&&e<=9969||e===9972||e>=9974&&e<=9977||e===9979||e===9980||e===9982||e===9983||e===10045||e>=10102&&e<=10111||e>=11094&&e<=11097||e>=12872&&e<=12879||e>=57344&&e<=63743||e>=65024&&e<=65039||e===65533||e>=127232&&e<=127242||e>=127248&&e<=127277||e>=127280&&e<=127337||e>=127344&&e<=127373||e===127375||e===127376||e>=127387&&e<=127404||e>=917760&&e<=917999||e>=983040&&e<=1048573||e>=1048576&&e<=1114109}function Mx(e){return e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510}function Nx(e){return e>=4352&&e<=4447||e===8986||e===8987||e===9001||e===9002||e>=9193&&e<=9196||e===9200||e===9203||e===9725||e===9726||e===9748||e===9749||e>=9776&&e<=9783||e>=9800&&e<=9811||e===9855||e>=9866&&e<=9871||e===9875||e===9889||e===9898||e===9899||e===9917||e===9918||e===9924||e===9925||e===9934||e===9940||e===9962||e===9970||e===9971||e===9973||e===9978||e===9981||e===9989||e===9994||e===9995||e===10024||e===10060||e===10062||e>=10067&&e<=10069||e===10071||e>=10133&&e<=10135||e===10160||e===10175||e===11035||e===11036||e===11088||e===11093||e>=11904&&e<=11929||e>=11931&&e<=12019||e>=12032&&e<=12245||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12353&&e<=12438||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12773||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=42124||e>=42128&&e<=42182||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=94176&&e<=94180||e>=94192&&e<=94198||e>=94208&&e<=101589||e>=101631&&e<=101662||e>=101760&&e<=101874||e>=110576&&e<=110579||e>=110581&&e<=110587||e===110589||e===110590||e>=110592&&e<=110882||e===110898||e>=110928&&e<=110930||e===110933||e>=110948&&e<=110951||e>=110960&&e<=111355||e>=119552&&e<=119638||e>=119648&&e<=119670||e===126980||e===127183||e===127374||e>=127377&&e<=127386||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e===127568||e===127569||e>=127584&&e<=127589||e>=127744&&e<=127776||e>=127789&&e<=127797||e>=127799&&e<=127868||e>=127870&&e<=127891||e>=127904&&e<=127946||e>=127951&&e<=127955||e>=127968&&e<=127984||e===127988||e>=127992&&e<=128062||e===128064||e>=128066&&e<=128252||e>=128255&&e<=128317||e>=128331&&e<=128334||e>=128336&&e<=128359||e===128378||e===128405||e===128406||e===128420||e>=128507&&e<=128591||e>=128640&&e<=128709||e===128716||e>=128720&&e<=128722||e>=128725&&e<=128728||e>=128732&&e<=128735||e===128747||e===128748||e>=128756&&e<=128764||e>=128992&&e<=129003||e===129008||e>=129292&&e<=129338||e>=129340&&e<=129349||e>=129351&&e<=129535||e>=129648&&e<=129660||e>=129664&&e<=129674||e>=129678&&e<=129734||e===129736||e>=129741&&e<=129756||e>=129759&&e<=129770||e>=129775&&e<=129784||e>=131072&&e<=196605||e>=196608&&e<=262141}function Px(e){return jx(e)?`ambiguous`:Mx(e)?`fullwidth`:e===8361||e>=65377&&e<=65470||e>=65474&&e<=65479||e>=65482&&e<=65487||e>=65490&&e<=65495||e>=65498&&e<=65500||e>=65512&&e<=65518?`halfwidth`:e>=32&&e<=126||e===162||e===163||e===165||e===166||e===172||e===175||e>=10214&&e<=10221||e===10629||e===10630?`narrow`:Nx(e)?`wide`:`neutral`}function Fx(e){if(!Number.isSafeInteger(e))throw TypeError(`Expected a code point, got \`${typeof e}\`.`)}function Ix(e){return Fx(e),Px(e)}var Lx=Object.defineProperty,Rx=(e,t,n)=>t in e?Lx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zx=(e,t,n)=>Rx(e,typeof t==`symbol`?t:t+``,n);function Bx(e){return/^\p{Emoji_Presentation}/u.test(String.fromCodePoint(e))}function Vx(e){if(!e||e<4352)return!1;switch(Ix(e)){case`fullwidth`:case`halfwidth`:return!0;case`wide`:return!Bx(e);case`narrow`:return!1;case`ambiguous`:return 917760<=e&&e<=917999?null:!1;case`neutral`:return/^\p{sc=Hangul}/u.test(String.fromCodePoint(e))}}function Hx(e,t){return t!==65025||!e||e<8216?!1:e===8216||e===8217||e===8220||e===8221}function Ux(e){return e!==null&&e>=65024&&e<=65038}var Wx=Kx(/\p{P}|\p{S}/u),Gx=Kx(/\s/);function Kx(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCodePoint(t))}}var qx;(e=>{e.spaceOrPunctuation=3,e.cjk=4096,e.cjkPunctuation=4098,e.ivs=8192,e.cjkOrIvs=12288,e.nonEmojiGeneralUseVS=16384,e.variationSelector=24576,e.ivsToCjkRightShift=1})(qx||={});function Jx(e){if(e===Ox.eof||lu(e)||Gx(e))return kx.characterGroupWhitespace;let t=0;if(e>=4352){if(Ux(e))return qx.nonEmojiGeneralUseVS;switch(Vx(e)){case null:return qx.ivs;case!0:t|=qx.cjk;break}}return Wx(e)&&(t|=kx.characterGroupPunctuation),t}function Yx(e,t,n){if(!nS(e))return e;let r=t(),i=Jx(r);return!r||Zx(i)?e:Hx(r,n)?qx.cjkPunctuation:Xx(i)}function Xx(e){return e&~qx.ivs}function Zx(e){return!!(e&kx.characterGroupWhitespace)}function Qx(e){return(e&qx.cjkPunctuation)===kx.characterGroupPunctuation}function $x(e){return!!(e&qx.cjk)}function eS(e){return e===qx.ivs}function tS(e){return!!(e&qx.cjkOrIvs)}function nS(e){return e===qx.nonEmojiGeneralUseVS}function rS(e){return!!(e&qx.spaceOrPunctuation)}function iS(e){return!!(e&&e>=55296&&e<=56319)}function aS(e){return!!(e&&e>=56320&&e<=57343)}function oS(e,t,n){if(t._bufferIndex<2)return e;let r=n({start:{...t,_bufferIndex:t._bufferIndex-2},end:t}).codePointAt(0);return r&&r>=65536?r:e}function sS(e,t,n){let r=e>=65536?2:1;if(t._bufferIndex<1+r)return null;let i=t._bufferIndex-r-2,a=n({start:{...t,_bufferIndex:i>=0?i:0},end:{...t,_bufferIndex:t._bufferIndex-r}}),o=a.charCodeAt(a.length-1);if(Number.isNaN(o))return null;if(a.length<2||o<56320||57343<o)return o;let s=a.codePointAt(0);return s&&s>=65536?s:o}var cS=class{constructor(e,t,n){this.previousCode=e,this.nowPoint=t,this.sliceSerialize=n,zx(this,`cachedValue`)}value(){return this.cachedValue===void 0&&(this.cachedValue=sS(this.previousCode,this.nowPoint,this.sliceSerialize)),this.cachedValue}};function lS(e,t,n){let r=n({start:t,end:{...t,_bufferIndex:t._bufferIndex+2}}).codePointAt(0);return r&&r>=65536?r:e}var uS={name:`attention`,resolveAll:dS,tokenize:fS};function dS(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};pS(d,-c),pS(f,c),o={type:c>1?Ax.strongSequence:Ax.emphasisSequence,start:d,end:{...e[r][1].end}},s={type:c>1?Ax.strongSequence:Ax.emphasisSequence,start:{...e[n][1].start},end:f},a={type:c>1?Ax.strongText:Ax.emphasisText,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?Ax.strong:Ax.emphasis,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=Jl(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=Jl(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),t.parser.constructs.insideSpan.null,l=Jl(l,Cu(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=Jl(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=Jl(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,ql(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function fS(e,t){let n=this.parser.constructs.attentionMarkers.null,{now:r,sliceSerialize:i,previous:a}=this,o=aS(a)?oS(a,r(),i):a,s=Jx(o),c=new cS(o,r(),i),l=Yx(s,c.value.bind(c),o),u;return d;function d(t){return t===Ox.asterisk||Ox.underscore,u=t,e.enter(`attentionSequence`),f(t)}function f(a){if(a===u)return e.consume(a),f;let s=e.exit(`attentionSequence`),c=Jx(iS(a)?lS(a,r(),i):a),d=Qx(l),p=d||Zx(l),m=Qx(c),h=m||Zx(c),g=tS(l),_=!h||m&&(p||g)||n.includes(a),v=!p||d&&(h||$x(c))||n.includes(o);return s._open=!!(u===Ox.asterisk?_:_&&(rS(l)||!v)),s._close=!!(u===Ox.asterisk?v:v&&(rS(c)||!_)),t(a)}}function pS(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}function mS(){return{text:{[Ox.asterisk]:uS,[Ox.underscore]:uS},insideSpan:{null:[uS]}}}function hS(){let e=this.data();(e.micromarkExtensions||=[]).push(mS())}function gS(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{[Ox.tilde]:n},insideSpan:{null:[n]},attentionMarkers:{null:[Ox.tilde]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&ql(o,o.length,0,Cu(s,e.slice(r+1,n),t)),ql(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),ql(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=Ax.data);return e}function i(e,n,r){let{now:i,sliceSerialize:a,previous:o}=this,s=aS(o)?oS(o,i(),a):o,c=Jx(s),l=new cS(s,i(),a),u=Yx(c,l.value.bind(l),s),d=this.events,f=0;return p;function p(t){return Ox.tilde,s===Ox.tilde&&d[d.length-1][1].type!==Ax.characterEscape?r(t):(e.enter(`strikethroughSequenceTemporary`),m(t))}function m(o){let c=Jx(s);if(o===Ox.tilde)return f>1?r(o):(e.consume(o),f++,m);if(f<2&&!t)return r(o);let l=e.exit(`strikethroughSequenceTemporary`),d=Jx(iS(o)?lS(o,i(),a):o),p=Qx(u)||Zx(u),h=Qx(d)||Zx(d),g=$x(u)||eS(c);return l._open=!h||d===kx.attentionSideAfter&&(p||g),l._close=!p||c===kx.attentionSideAfter&&(h||$x(d)),n(o)}}}function _S(e){let t=this.data();(t.micromarkExtensions||=[]).push(gS(e))}function vS(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function yS(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function bS(e,t,n){let r=Fp((n||{}).ignore||[]),i=xS(t),a=-1;for(;++a<i.length;)Gp(e,`text`,o);function o(e,t){let n=-1,i;for(;++n<t.length;){let e=t[n],a=i?i.children:void 0;if(r(e,a?a.indexOf(e):void 0,i))return;i=e}if(i)return s(e,t)}function s(e,t){let n=t[t.length-1],r=i[a][0],o=i[a][1],s=0,c=n.children.indexOf(e),l=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,i={index:d.index,input:d.input,stack:[...t,e]},a=o(...d,i);if(typeof a==`string`&&(a=a.length>0?{type:`text`,value:a}:void 0),a===!1?r.lastIndex=n+1:(s!==n&&u.push({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,l=!0),!r.global)break;d=r.exec(e.value)}return l?(s<e.value.length&&u.push({type:`text`,value:e.value.slice(s)}),n.children.splice(c,1,...u)):u=[e],c+u.length}}function xS(e){let t=[];if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){let e=n[r];t.push([SS(e[0]),CS(e[1])])}return t}function SS(e){return typeof e==`string`?new RegExp(yS(e),`g`):e}function CS(e){return typeof e==`function`?e:function(){return e}}var wS=`phrasing`,TS=[`autolink`,`link`,`image`,`label`];function ES(){return{transforms:[PS],enter:{literalAutolink:OS,literalAutolinkEmail:kS,literalAutolinkHttp:kS,literalAutolinkWww:kS},exit:{literalAutolink:NS,literalAutolinkEmail:MS,literalAutolinkHttp:AS,literalAutolinkWww:jS}}}function DS(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:wS,notInConstruct:TS},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:wS,notInConstruct:TS},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:wS,notInConstruct:TS}]}}function OS(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function kS(e){this.config.enter.autolinkProtocol.call(this,e)}function AS(e){this.config.exit.autolinkProtocol.call(this,e)}function jS(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url=`http://`+this.sliceSerialize(e)}function MS(e){this.config.exit.autolinkEmail.call(this,e)}function NS(e){this.exit(e)}function PS(e){bS(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,FS],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,IS]],{ignore:[`link`,`linkReference`]})}function FS(e,t,n,r,i){let a=``;if(!zS(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!LS(n)))return!1;let o=RS(n+r);if(!o[0])return!1;let s={type:`link`,title:null,url:a+t+o[0],children:[{type:`text`,value:t+o[0]}]};return o[1]?[s,{type:`text`,value:o[1]}]:s}function IS(e,t,n,r){return!zS(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function LS(e){let t=e.split(`.`);return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function RS(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=vS(e,`(`),a=vS(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function zS(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||fu(n)||du(n))&&(!t||n!==47)}YS.peek=JS;function BS(){this.buffer()}function VS(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function HS(){this.buffer()}function US(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function WS(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=eu(this.sliceSerialize(e)).toLowerCase(),n.label=t}function GS(e){this.exit(e)}function KS(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=eu(this.sliceSerialize(e)).toLowerCase(),n.label=t}function qS(e){this.exit(e)}function JS(){return`[`}function YS(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function XS(){return{enter:{gfmFootnoteCallString:BS,gfmFootnoteCall:VS,gfmFootnoteDefinitionLabelString:HS,gfmFootnoteDefinition:US},exit:{gfmFootnoteCallString:WS,gfmFootnoteCall:GS,gfmFootnoteDefinitionLabelString:KS,gfmFootnoteDefinition:qS}}}function ZS(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:YS},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?`
|
|
36
|
+
`:` `)+r.indentLines(r.containerFlow(e,a.current()),t?$S:QS))),s(),o}}function QS(e,t,n){return t===0?e:$S(e,t,n)}function $S(e,t,n){return(n?``:` `)+e}var eC=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];aC.peek=oC;function tC(){return{canContainEols:[`delete`],enter:{strikethrough:rC},exit:{strikethrough:iC}}}function nC(){return{unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:eC}],handlers:{delete:aC}}}function rC(e){this.enter({type:`delete`,children:[]},e)}function iC(e){this.exit(e)}function aC(e,t,n,r){let i=n.createTracker(r),a=n.enter(`strikethrough`),o=i.move(`~~`);return o+=n.containerPhrasing(e,{...i.current(),before:o,after:`~`}),o+=i.move(`~~`),a(),o}function oC(){return`~`}function sC(e){return e.length}function cC(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||sC,a=[],o=[],s=[],c=[],l=0,u=-1;for(;++u<e.length;){let t=[],r=[],a=-1;for(e[u].length>l&&(l=e[u].length);++a<e[u].length;){let o=lC(e[u][a]);if(n.alignDelimiters!==!1){let e=i(o);r[a]=e,(c[a]===void 0||e>c[a])&&(c[a]=e)}t.push(o)}o[u]=t,s[u]=r}let d=-1;if(typeof r==`object`&&`length`in r)for(;++d<l;)a[d]=uC(r[d]);else{let e=uC(r);for(;++d<l;)a[d]=e}d=-1;let f=[],p=[];for(;++d<l;){let e=a[d],t=``,r=``;e===99?(t=`:`,r=`:`):e===108?t=`:`:e===114&&(r=`:`);let i=n.alignDelimiters===!1?1:Math.max(1,c[d]-t.length-r.length),o=t+`-`.repeat(i)+r;n.alignDelimiters!==!1&&(i=t.length+i+r.length,i>c[d]&&(c[d]=i),p[d]=i),f[d]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let m=[];for(;++u<o.length;){let e=o[u],t=s[u];d=-1;let r=[];for(;++d<l;){let i=e[d]||``,o=``,s=``;if(n.alignDelimiters!==!1){let e=c[d]-(t[d]||0),n=a[d];n===114?o=` `.repeat(e):n===99?e%2?(o=` `.repeat(e/2+.5),s=` `.repeat(e/2-.5)):(o=` `.repeat(e/2),s=o):s=` `.repeat(e)}n.delimiterStart!==!1&&!d&&r.push(`|`),n.padding!==!1&&!(n.alignDelimiters===!1&&i===``)&&(n.delimiterStart!==!1||d)&&r.push(` `),n.alignDelimiters!==!1&&r.push(o),r.push(i),n.alignDelimiters!==!1&&r.push(s),n.padding!==!1&&r.push(` `),(n.delimiterEnd!==!1||d!==l-1)&&r.push(`|`)}m.push(n.delimiterEnd===!1?r.join(``).replace(/ +$/,``):r.join(``))}return m.join(`
|
|
37
|
+
`)}function lC(e){return e==null?``:String(e)}function uC(e){let t=typeof e==`string`?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function dC(e,t,n,r){let i=n.enter(`blockquote`),a=n.createTracker(r);a.move(`> `),a.shift(2);let o=n.indentLines(n.containerFlow(e,a.current()),fC);return i(),o}function fC(e,t,n){return`>`+(n?``:` `)+e}function pC(e,t){return mC(e,t.inConstruct,!0)&&!mC(e,t.notInConstruct,!1)}function mC(e,t,n){if(typeof t==`string`&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function hC(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
|
|
38
|
+
`&&pC(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?``:` `;return`\\
|
|
39
|
+
`}function gC(e,t){let n=String(e),r=n.indexOf(t),i=r,a=0,o=0;if(typeof t!=`string`)throw TypeError(`Expected substring`);for(;r!==-1;)r===i?++a>o&&(o=a):a=1,i=r+t.length,r=n.indexOf(t,i);return o}function _C(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function vC(e){let t=e.options.fence||"`";if(t!=="`"&&t!==`~`)throw Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function yC(e,t,n,r){let i=vC(n),a=e.value||``,o=i==="`"?`GraveAccent`:`Tilde`;if(_C(e,n)){let e=n.enter(`codeIndented`),t=n.indentLines(a,bC);return e(),t}let s=n.createTracker(r),c=i.repeat(Math.max(gC(a,i)+1,3)),l=n.enter(`codeFenced`),u=s.move(c);if(e.lang){let t=n.enter(`codeFencedLang${o}`);u+=s.move(n.safe(e.lang,{before:u,after:` `,encode:["`"],...s.current()})),t()}if(e.lang&&e.meta){let t=n.enter(`codeFencedMeta${o}`);u+=s.move(` `),u+=s.move(n.safe(e.meta,{before:u,after:`
|
|
40
|
+
`,encode:["`"],...s.current()})),t()}return u+=s.move(`
|
|
41
|
+
`),a&&(u+=s.move(a+`
|
|
42
|
+
`)),u+=s.move(c),l(),u}function bC(e,t,n){return(n?``:` `)+e}function xC(e){let t=e.options.quote||`"`;if(t!==`"`&&t!==`'`)throw Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function SC(e,t,n,r){let i=xC(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`definition`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`[`);return l+=c.move(n.safe(n.associationId(e),{before:l,after:`]`,...c.current()})),l+=c.move(`]: `),s(),!e.url||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`
|
|
43
|
+
`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),o(),l}function CC(e){let t=e.options.emphasis||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function wC(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function TC(e,t,n){let r=Su(e),i=Su(t);return r===void 0?i===void 0?n===`_`?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}EC.peek=DC;function EC(e,t,n,r){let i=CC(n),a=n.enter(`emphasis`),o=n.createTracker(r),s=o.move(i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=TC(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=wC(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=TC(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+wC(d));let p=o.move(i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function DC(e,t,n){return n.options.emphasis||`*`}function OC(e,t){let n=!1;return qp(e,function(e){if(`value`in e&&/\r?\n|\r/.test(e.value)||e.type===`break`)return n=!0,!1}),!!((!e.depth||e.depth<3)&&Ul(e)&&(t.options.setext||n))}function kC(e,t,n,r){let i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(OC(e,n)){let t=n.enter(`headingSetext`),r=n.enter(`phrasing`),o=n.containerPhrasing(e,{...a.current(),before:`
|
|
44
|
+
`,after:`
|
|
45
|
+
`});return r(),t(),o+`
|
|
46
|
+
`+(i===1?`=`:`-`).repeat(o.length-(Math.max(o.lastIndexOf(`\r`),o.lastIndexOf(`
|
|
47
|
+
`))+1))}let o=`#`.repeat(i),s=n.enter(`headingAtx`),c=n.enter(`phrasing`);a.move(o+` `);let l=n.containerPhrasing(e,{before:`# `,after:`
|
|
48
|
+
`,...a.current()});return/^[\t ]/.test(l)&&(l=wC(l.charCodeAt(0))+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}AC.peek=jC;function AC(e){return e.value||``}function jC(){return`<`}MC.peek=NC;function MC(e,t,n,r){let i=xC(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`image`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`![`);return l+=c.move(n.safe(e.alt,{before:l,after:`]`,...c.current()})),l+=c.move(`](`),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),l+=c.move(`)`),o(),l}function NC(){return`!`}PC.peek=FC;function PC(e,t,n,r){let i=e.referenceType,a=n.enter(`imageReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`![`),l=n.safe(e.alt,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function FC(){return`!`}IC.peek=LC;function IC(e,t,n){let r=e.value||``,i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=` `+r+` `);++a<n.unsafe.length;){let e=n.unsafe[a],t=n.compilePattern(e),i;if(e.atBreak)for(;i=t.exec(r);){let e=i.index;r.charCodeAt(e)===10&&r.charCodeAt(e-1)===13&&e--,r=r.slice(0,e)+` `+r.slice(i.index+1)}}return i+r+i}function LC(){return"`"}function RC(e,t){let n=Ul(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type===`text`&&(n===e.url||`mailto:`+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}zC.peek=BC;function zC(e,t,n,r){let i=xC(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r),s,c;if(RC(e,n)){let t=n.stack;n.stack=[],s=n.enter(`autolink`);let r=o.move(`<`);return r+=o.move(n.containerPhrasing(e,{before:r,after:`>`,...o.current()})),r+=o.move(`>`),s(),n.stack=t,r}s=n.enter(`link`),c=n.enter(`label`);let l=o.move(`[`);return l+=o.move(n.containerPhrasing(e,{before:l,after:`](`,...o.current()})),l+=o.move(`](`),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter(`destinationLiteral`),l+=o.move(`<`),l+=o.move(n.safe(e.url,{before:l,after:`>`,...o.current()})),l+=o.move(`>`)):(c=n.enter(`destinationRaw`),l+=o.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...o.current()}))),c(),e.title&&(c=n.enter(`title${a}`),l+=o.move(` `+i),l+=o.move(n.safe(e.title,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(`)`),s(),l}function BC(e,t,n){return RC(e,n)?`<`:`[`}VC.peek=HC;function VC(e,t,n,r){let i=e.referenceType,a=n.enter(`linkReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`[`),l=n.containerPhrasing(e,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function HC(){return`[`}function UC(e){let t=e.options.bullet||`*`;if(t!==`*`&&t!==`+`&&t!==`-`)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function WC(e){let t=UC(e),n=e.options.bulletOther;if(!n)return t===`*`?`-`:`*`;if(n!==`*`&&n!==`+`&&n!==`-`)throw Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function GC(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function KC(e){let t=e.options.rule||`*`;if(t!==`*`&&t!==`-`&&t!==`_`)throw Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function qC(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?GC(n):UC(n),s=e.ordered?o===`.`?`)`:`.`:WC(n),c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){let t=e.children?e.children[0]:void 0;if((o===`*`||o===`-`)&&t&&(!t.children||!t.children[0])&&n.stack[n.stack.length-1]===`list`&&n.stack[n.stack.length-2]===`listItem`&&n.stack[n.stack.length-3]===`list`&&n.stack[n.stack.length-4]===`listItem`&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),KC(n)===o&&t){let t=-1;for(;++t<e.children.length;){let n=e.children[t];if(n&&n.type===`listItem`&&n.children&&n.children[0]&&n.children[0].type===`thematicBreak`){c=!0;break}}}}c&&(o=s),n.bulletCurrent=o;let l=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=a,i(),l}function JC(e){let t=e.options.listItemIndent||`one`;if(t!==`tab`&&t!==`one`&&t!==`mixed`)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function YC(e,t,n,r){let i=JC(n),a=n.bulletCurrent||UC(n);t&&t.type===`list`&&t.ordered&&(a=(typeof t.start==`number`&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i===`tab`||i===`mixed`&&(t&&t.type===`list`&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);let s=n.createTracker(r);s.move(a+` `.repeat(o-a.length)),s.shift(o);let c=n.enter(`listItem`),l=n.indentLines(n.containerFlow(e,s.current()),u);return c(),l;function u(e,t,n){return t?(n?``:` `.repeat(o))+e:(n?a:a+` `.repeat(o-a.length))+e}}function XC(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}var ZC=Fp([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function QC(e,t,n,r){return(e.children.some(function(e){return ZC(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function $C(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}ew.peek=tw;function ew(e,t,n,r){let i=$C(n),a=n.enter(`strong`),o=n.createTracker(r),s=o.move(i+i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=TC(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=wC(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=TC(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+wC(d));let p=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function tw(e,t,n){return n.options.strong||`*`}function nw(e,t,n,r){return n.safe(e.value,r)}function rw(e){let t=e.options.ruleRepetition||3;if(t<3)throw Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function iw(e,t,n){let r=(KC(n)+(n.options.ruleSpaces?` `:``)).repeat(rw(n));return n.options.ruleSpaces?r.slice(0,-1):r}var aw={blockquote:dC,break:hC,code:yC,definition:SC,emphasis:EC,hardBreak:hC,heading:kC,html:AC,image:MC,imageReference:PC,inlineCode:IC,link:zC,linkReference:VC,list:qC,listItem:YC,paragraph:XC,root:QC,strong:ew,text:nw,thematicBreak:iw};function ow(){return{enter:{table:sw,tableData:dw,tableHeader:dw,tableRow:lw},exit:{codeText:fw,table:cw,tableData:uw,tableHeader:uw,tableRow:uw}}}function sw(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function cw(e){this.exit(e),this.data.inTable=void 0}function lw(e){this.enter({type:`tableRow`,children:[]},e)}function uw(e){this.exit(e)}function dw(e){this.enter({type:`tableCell`,children:[]},e)}function fw(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,pw));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function pw(e,t){return t===`|`?t:e}function mw(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:`
|
|
49
|
+
`,inConstruct:`tableCell`},{atBreak:!0,character:`|`,after:`[ :-]`},{character:`|`,inConstruct:`tableCell`},{atBreak:!0,character:`:`,after:`-`},{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{inlineCode:f,table:o,tableCell:c,tableRow:s}};function o(e,t,n,r){return l(u(e,n,r),e.align)}function s(e,t,n,r){let i=l([d(e,n,r)]);return i.slice(0,i.indexOf(`
|
|
50
|
+
`))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return cC(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=d(r[i],t,n);return o(),a}function d(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=c(r[i],e,t,n);return o(),a}function f(e,t,n){let r=aw.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function hw(){return{exit:{taskListCheckValueChecked:_w,taskListCheckValueUnchecked:_w,paragraph:vw}}}function gw(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:yw}}}function _w(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function vw(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function yw(e,t,n,r){let i=e.children[0],a=typeof e.checked==`boolean`&&i&&i.type===`paragraph`,o=`[`+(e.checked?`x`:` `)+`] `,s=n.createTracker(r);a&&s.move(o);let c=aw.listItem(e,t,n,{...r,...s.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),c;function l(e){return e+o}}function bw(){return[ES(),XS(),tC(),ow(),hw()]}function xw(e){return{extensions:[DS(),ZS(e),nC(),mw(e),gw()]}}var Sw={tokenize:Iw,partial:!0},Cw={tokenize:Lw,partial:!0},ww={tokenize:Rw,partial:!0},Tw={tokenize:zw,partial:!0},Ew={tokenize:Bw,partial:!0},Dw={name:`wwwAutolink`,tokenize:Pw,previous:Vw},Ow={name:`protocolAutolink`,tokenize:Fw,previous:Hw},kw={name:`emailAutolink`,tokenize:Nw,previous:Uw},Aw={};function jw(){return{text:Aw}}for(var Mw=48;Mw<123;)Aw[Mw]=kw,Mw++,Mw===58?Mw=65:Mw===91&&(Mw=97);Aw[43]=kw,Aw[45]=kw,Aw[46]=kw,Aw[95]=kw,Aw[72]=[kw,Ow],Aw[104]=[kw,Ow],Aw[87]=[kw,Dw],Aw[119]=[kw,Dw];function Nw(e,t,n){let r=this,i,a;return o;function o(t){return!Ww(t)||!Uw.call(r,r.previous)||Gw(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return Ww(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(Ew,u,l)(t):t===45||t===95||nu(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&tu(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function Pw(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!Vw.call(r,r.previous)||Gw(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(Sw,e.attempt(Cw,e.attempt(ww,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function Fw(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&Hw.call(r,r.previous)&&!Gw(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(tu(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||iu(t)||lu(t)||fu(t)||du(t)?n(t):e.attempt(Cw,e.attempt(ww,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function Iw(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function Lw(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(Tw,c,s)(t):t===null||lu(t)||fu(t)||t!==45&&du(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function Rw(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(Tw,t,a)(o):o===null||lu(o)||fu(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function zw(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||lu(o)||fu(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||lu(e)||fu(e)?t(e):r(e)}function a(e){return tu(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):tu(t)?(e.consume(t),o):n(t)}}function Bw(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return nu(e)?n(e):t(e)}}function Vw(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||lu(e)}function Hw(e){return!tu(e)}function Uw(e){return!(e===47||Ww(e))}function Ww(e){return e===43||e===45||e===46||e===95||nu(e)}function Gw(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var Kw={tokenize:eT,partial:!0};function qw(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:Zw,continuation:{tokenize:Qw},exit:$w}},text:{91:{name:`gfmFootnoteCall`,tokenize:Xw},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:Jw,resolveTo:Yw}}}}function Jw(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=eu(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function Yw(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function Xw(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||lu(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(eu(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return lu(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function Zw(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||lu(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=eu(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return lu(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),hu(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function Qw(e,t,n){return e.check(Au,t,e.attempt(Kw,t,n))}function $w(e){e.exit(`gfmFootnoteDefinition`)}function eT(e,t,n){let r=this;return hu(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function tT(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&ql(o,o.length,0,Cu(s,e.slice(r+1,n),t)),ql(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),ql(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=Su(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=Su(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var nT=class{constructor(){this.map=[]}add(e,t,n){rT(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}};function rT(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function iT(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function aT(){return{flow:{null:{name:`table`,tokenize:oT,resolveAll:sT}}}}function oT(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124?u(e):(o=!0,a+=1,u(e))}function u(t){return t===null?n(t):cu(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):uu(t)?hu(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||lu(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,uu(t)?hu(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return uu(t)?hu(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||cu(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return uu(t)?hu(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||cu(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||cu(n)?(e.exit(`tableRow`),t(n)):uu(n)?hu(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||lu(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function sT(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new nT;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(lT(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=cT(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=cT(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=cT(f,t,o,i,n,d)):(o[0]=o[1],d=cT(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&lT(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=iT(t.events,n))}return e}function cT(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},uT(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=uT(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=uT(t.events,n[2]),a=uT(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},uT(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function lT(e,t,n,r,i){let a=[],o=uT(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function uT(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var dT={name:`tasklistCheck`,tokenize:pT};function fT(){return{text:{91:dT}}}function pT(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return lu(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return cu(r)?t(r):uu(r)?e.check({tokenize:mT},t,n)(r):n(r)}}function mT(e,t,n){return hu(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function hT(e){return Xl([jw(),qw(),tT(e),aT(),fT()])}var gT={};function _T(e){let t=this,n=e||gT,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(hT(n)),a.push(bw()),o.push(xw(n))}function vT(){return{enter:{mathFlow:e,mathFlowFenceMeta:t,mathText:a},exit:{mathFlow:i,mathFlowFence:r,mathFlowFenceMeta:n,mathFlowValue:s,mathText:o,mathTextData:s}};function e(e){this.enter({type:`math`,meta:null,value:``,data:{hName:`pre`,hChildren:[{type:`element`,tagName:`code`,properties:{className:[`language-math`,`math-display`]},children:[]}]}},e)}function t(){this.buffer()}function n(){let e=this.resume(),t=this.stack[this.stack.length-1];t.type,t.meta=e}function r(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function i(e){let t=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),n=this.stack[this.stack.length-1];n.type,this.exit(e),n.value=t;let r=n.data.hChildren[0];r.type,r.tagName,r.children.push({type:`text`,value:t}),this.data.mathFlowInside=void 0}function a(e){this.enter({type:`inlineMath`,value:``,data:{hName:`code`,hProperties:{className:[`language-math`,`math-inline`]},hChildren:[]}},e),this.buffer()}function o(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,this.exit(e),n.value=t,n.data.hChildren.push({type:`text`,value:t})}function s(e){this.config.enter.data.call(this,e),this.config.exit.data.call(this,e)}}function yT(e){let t=(e||{}).singleDollarTextMath;return t??=!0,r.peek=i,{unsafe:[{character:`\r`,inConstruct:`mathFlowMeta`},{character:`
|
|
51
|
+
`,inConstruct:`mathFlowMeta`},{character:`$`,after:t?void 0:`\\$`,inConstruct:`phrasing`},{character:`$`,inConstruct:`mathFlowMeta`},{atBreak:!0,character:`$`,after:`\\$`}],handlers:{math:n,inlineMath:r}};function n(e,t,n,r){let i=e.value||``,a=n.createTracker(r),o=`$`.repeat(Math.max(gC(i,`$`)+1,2)),s=n.enter(`mathFlow`),c=a.move(o);if(e.meta){let t=n.enter(`mathFlowMeta`);c+=a.move(n.safe(e.meta,{after:`
|
|
52
|
+
`,before:c,encode:[`$`],...a.current()})),t()}return c+=a.move(`
|
|
53
|
+
`),i&&(c+=a.move(i+`
|
|
54
|
+
`)),c+=a.move(o),s(),c}function r(e,n,r){let i=e.value||``,a=1;for(t||a++;RegExp(`(^|[^$])`+`\\$`.repeat(a)+`([^$]|$)`).test(i);)a++;let o=`$`.repeat(a);/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^\$|\$$/.test(i))&&(i=` `+i+` `);let s=-1;for(;++s<r.unsafe.length;){let e=r.unsafe[s];if(!e.atBreak)continue;let t=r.compilePattern(e),n;for(;n=t.exec(i);){let e=n.index;i.codePointAt(e)===10&&i.codePointAt(e-1)===13&&e--,i=i.slice(0,e)+` `+i.slice(n.index+1)}}return o+i+o}function i(){return`$`}}var bT={tokenize:ST,concrete:!0,name:`mathFlow`},xT={tokenize:CT,partial:!0};function ST(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){return e.enter(`mathFlow`),e.enter(`mathFlowFence`),e.enter(`mathFlowFenceSequence`),c(t)}function c(t){return t===36?(e.consume(t),o++,c):o<2?n(t):(e.exit(`mathFlowFenceSequence`),hu(e,l,`whitespace`)(t))}function l(t){return t===null||cu(t)?d(t):(e.enter(`mathFlowFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===null||cu(t)?(e.exit(`chunkString`),e.exit(`mathFlowFenceMeta`),d(t)):t===36?n(t):(e.consume(t),u)}function d(n){return e.exit(`mathFlowFence`),r.interrupt?t(n):e.attempt(xT,f,g)(n)}function f(t){return e.attempt({tokenize:_,partial:!0},g,p)(t)}function p(t){return(a?hu(e,m,`linePrefix`,a+1):m)(t)}function m(t){return t===null?g(t):cu(t)?e.attempt(xT,f,g)(t):(e.enter(`mathFlowValue`),h(t))}function h(t){return t===null||cu(t)?(e.exit(`mathFlowValue`),m(t)):(e.consume(t),h)}function g(n){return e.exit(`mathFlow`),t(n)}function _(e,t,n){let i=0;return hu(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4);function a(t){return e.enter(`mathFlowFence`),e.enter(`mathFlowFenceSequence`),s(t)}function s(t){return t===36?(i++,e.consume(t),s):i<o?n(t):(e.exit(`mathFlowFenceSequence`),hu(e,c,`whitespace`)(t))}function c(r){return r===null||cu(r)?(e.exit(`mathFlowFence`),t(r)):n(r)}}}function CT(e,t,n){let r=this;return i;function i(n){return n===null?t(n):(e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function wT(e){let t=(e||{}).singleDollarTextMath;return t??=!0,{tokenize:n,resolve:TT,previous:ET,name:`mathText`};function n(e,n,r){let i=0,a,o;return s;function s(t){return e.enter(`mathText`),e.enter(`mathTextSequence`),c(t)}function c(n){return n===36?(e.consume(n),i++,c):i<2&&!t?r(n):(e.exit(`mathTextSequence`),l(n))}function l(t){return t===null?r(t):t===36?(o=e.enter(`mathTextSequence`),a=0,d(t)):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),l):cu(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),l):(e.enter(`mathTextData`),u(t))}function u(t){return t===null||t===32||t===36||cu(t)?(e.exit(`mathTextData`),l(t)):(e.consume(t),u)}function d(t){return t===36?(e.consume(t),a++,d):a===i?(e.exit(`mathTextSequence`),e.exit(`mathText`),n(t)):(o.type=`mathTextData`,u(t))}}}function TT(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`mathTextData`){e[t][1].type=`mathTextPadding`,e[n][1].type=`mathTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`mathTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function ET(e){return e!==36||this.events[this.events.length-1][1].type===`characterEscape`}function DT(e){return{flow:{36:bT},text:{36:wT(e)}}}var OT={};function kT(e){let t=this,n=e||OT,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(DT(n)),a.push(vT()),o.push(yT(n))}var AT=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),jT=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),MT=e=>{let t=jT(e);return t.charAt(0).toUpperCase()+t.slice(1)},NT=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),PT=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0},FT={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},IT=(0,U.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,U.createElement)(`svg`,{ref:c,...FT,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:NT(`lucide`,i),...!a&&!PT(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,U.createElement)(e,t)),...Array.isArray(a)?a:[a]])),LT=(e,t)=>{let n=(0,U.forwardRef)(({className:n,...r},i)=>(0,U.createElement)(IT,{ref:i,iconNode:t,className:NT(`lucide-${AT(MT(e))}`,`lucide-${e}`,n),...r}));return n.displayName=MT(e),n},RT=LT(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),zT=LT(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),BT=LT(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),VT=LT(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),HT=LT(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),UT=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function WT(e){return GT(e)}function GT(e){return Array.isArray(e)?KT(e):e instanceof RegExp?e:typeof e==`object`?qT(e):e}function KT(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=GT(e[n]);return t}function qT(e){let t={};for(let n in e)t[n]=GT(e[n]);return t}function JT(e,...t){return t.forEach(t=>{for(let n in t)e[n]=t[n]}),e}function YT(e){let t=~e.lastIndexOf(`/`)||~e.lastIndexOf(`\\`);return t===0?e:~t===e.length-1?YT(e.substring(0,e.length-1)):e.substr(~t+1)}var XT=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,ZT=class{static hasCaptures(e){return e===null?!1:(XT.lastIndex=0,XT.test(e))}static replaceCaptures(e,t,n){return e.replace(XT,(e,r,i,a)=>{let o=n[parseInt(r||i,10)];if(o){let e=t.substring(o.start,o.end);for(;e[0]===`.`;)e=e.substring(1);switch(a){case`downcase`:return e.toLowerCase();case`upcase`:return e.toUpperCase();default:return e}}else return e})}};function QT(e,t){return e<t?-1:+(e>t)}function $T(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let r=0;r<n;r++){let n=QT(e[r],t[r]);if(n!==0)return n}return 0}return n-r}function eE(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function tE(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,`\\$&`)}var nE=class{constructor(e){this.fn=e}cache=new Map;get(e){if(this.cache.has(e))return this.cache.get(e);let t=this.fn(e);return this.cache.set(e,t),t}},rE=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(cE(e),t)}static createFromParsedTheme(e,t){return dE(e,t)}_cachedMatchRoot=new nE(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;let t=e.scopeName,n=this._cachedMatchRoot.get(t).find(t=>aE(e.parent,t.parentScopes));return n?new sE(n.fontStyle,n.foreground,n.background):null}},iE=class e{constructor(e,t){this.parent=e,this.scopeName=t}static push(t,n){for(let r of n)t=new e(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new e(n,t[r]);return n}push(t){return new e(this,t)}getSegments(){let e=this,t=[];for(;e;)t.push(e.scopeName),e=e.parent;return t.reverse(),t}toString(){return this.getSegments().join(` `)}extends(e){return this===e?!0:this.parent===null?!1:this.parent.extends(e)}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push(n.scopeName),n=n.parent;return n===e?t.reverse():void 0}};function aE(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let r=t[n],i=!1;if(r===`>`){if(n===t.length-1)return!1;r=t[++n],i=!0}for(;e&&!oE(e.scopeName,r);){if(i)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function oE(e,t){return t===e||e.startsWith(t)&&e[t.length]===`.`}var sE=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function cE(e){if(!e||!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let e=0,i=t.length;e<i;e++){let i=t[e];if(!i.settings)continue;let a;if(typeof i.scope==`string`){let e=i.scope;e=e.replace(/^[,]+/,``),e=e.replace(/[,]+$/,``),a=e.split(`,`)}else a=Array.isArray(i.scope)?i.scope:[``];let o=-1;if(typeof i.settings.fontStyle==`string`){o=0;let e=i.settings.fontStyle.split(` `);for(let t=0,n=e.length;t<n;t++)switch(e[t]){case`italic`:o|=1;break;case`bold`:o|=2;break;case`underline`:o|=4;break;case`strikethrough`:o|=8;break}}let s=null;typeof i.settings.foreground==`string`&&eE(i.settings.foreground)&&(s=i.settings.foreground);let c=null;typeof i.settings.background==`string`&&eE(i.settings.background)&&(c=i.settings.background);for(let t=0,i=a.length;t<i;t++){let i=a[t].trim().split(` `),l=i[i.length-1],u=null;i.length>1&&(u=i.slice(0,i.length-1),u.reverse()),n[r++]=new lE(l,u,e,o,s,c)}}return n}var lE=class{constructor(e,t,n,r,i,a){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=i,this.background=a}},uE=(e=>(e[e.NotSet=-1]=`NotSet`,e[e.None=0]=`None`,e[e.Italic=1]=`Italic`,e[e.Bold=2]=`Bold`,e[e.Underline=4]=`Underline`,e[e.Strikethrough=8]=`Strikethrough`,e))(uE||{});function dE(e,t){e.sort((e,t)=>{let n=QT(e.scope,t.scope);return n!==0||(n=$T(e.parentScopes,t.parentScopes),n!==0)?n:e.index-t.index});let n=0,r=`#000000`,i=`#ffffff`;for(;e.length>=1&&e[0].scope===``;){let t=e.shift();t.fontStyle!==-1&&(n=t.fontStyle),t.foreground!==null&&(r=t.foreground),t.background!==null&&(i=t.background)}let a=new fE(t),o=new sE(n,a.getId(r),a.getId(i)),s=new hE(new mE(0,null,-1,0,0),[]);for(let t=0,n=e.length;t<n;t++){let n=e[t];s.insert(0,n.scope,n.parentScopes,n.fontStyle,a.getId(n.foreground),a.getId(n.background))}return new rE(a,o,s)}var fE=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(e){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},pE=Object.freeze([]),mE=class e{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,n,r,i){this.scopeDepth=e,this.parentScopes=t||pE,this.fontStyle=n,this.foreground=r,this.background=i}clone(){return new e(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=e[n].clone();return t}acceptOverwrite(e,t,n,r){this.scopeDepth>e?console.log(`how did this happen?`):this.scopeDepth=e,t!==-1&&(this.fontStyle=t),n!==0&&(this.foreground=n),r!==0&&(this.background=r)}},hE=class e{constructor(e,t=[],n={}){this._mainRule=e,this._children=n,this._rulesWithParentScopes=t}_rulesWithParentScopes;static _cmpBySpecificity(e,t){if(e.scopeDepth!==t.scopeDepth)return t.scopeDepth-e.scopeDepth;let n=0,r=0;for(;e.parentScopes[n]===`>`&&n++,t.parentScopes[r]===`>`&&r++,!(n>=e.parentScopes.length||r>=t.parentScopes.length);){let i=t.parentScopes[r].length-e.parentScopes[n].length;if(i!==0)return i;n++,r++}return t.parentScopes.length-e.parentScopes.length}match(t){if(t!==``){let e=t.indexOf(`.`),n,r;if(e===-1?(n=t,r=``):(n=t.substring(0,e),r=t.substring(e+1)),this._children.hasOwnProperty(n))return this._children[n].match(r)}let n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(e._cmpBySpecificity),n}insert(t,n,r,i,a,o){if(n===``){this._doInsertHere(t,r,i,a,o);return}let s=n.indexOf(`.`),c,l;s===-1?(c=n,l=``):(c=n.substring(0,s),l=n.substring(s+1));let u;this._children.hasOwnProperty(c)?u=this._children[c]:(u=new e(this._mainRule.clone(),mE.cloneArr(this._rulesWithParentScopes)),this._children[c]=u),u.insert(t+1,l,r,i,a,o)}_doInsertHere(e,t,n,r,i){if(t===null){this._mainRule.acceptOverwrite(e,n,r,i);return}for(let a=0,o=this._rulesWithParentScopes.length;a<o;a++){let o=this._rulesWithParentScopes[a];if($T(o.parentScopes,t)===0){o.acceptOverwrite(e,n,r,i);return}}n===-1&&(n=this._mainRule.fontStyle),r===0&&(r=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new mE(e,t,n,r,i))}},gE=class e{static toBinaryStr(e){return e.toString(2).padStart(32,`0`)}static print(t){let n=e.getLanguageId(t),r=e.getTokenType(t),i=e.getFontStyle(t),a=e.getForeground(t),o=e.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:i,foreground:a,background:o})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return(e&1024)!=0}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(t,n,r,i,a,o,s){let c=e.getLanguageId(t),l=e.getTokenType(t),u=+!!e.containsBalancedBrackets(t),d=e.getFontStyle(t),f=e.getForeground(t),p=e.getBackground(t);return n!==0&&(c=n),r!==8&&(l=vE(r)),i!==null&&(u=+!!i),a!==-1&&(d=a),o!==0&&(f=o),s!==0&&(p=s),(c<<0|l<<8|u<<10|d<<11|f<<15|p<<24)>>>0}};function _E(e){return e}function vE(e){return e}function yE(e,t){let n=[],r=xE(e),i=r.next();for(;i!==null;){let e=0;if(i.length===2&&i.charAt(1)===`:`){switch(i.charAt(0)){case`R`:e=1;break;case`L`:e=-1;break;default:console.log(`Unknown priority ${i} in scope selector`)}i=r.next()}let t=o();if(n.push({matcher:t,priority:e}),i!==`,`)break;i=r.next()}return n;function a(){if(i===`-`){i=r.next();let e=a();return t=>!!e&&!e(t)}if(i===`(`){i=r.next();let e=s();return i===`)`&&(i=r.next()),e}if(bE(i)){let e=[];do e.push(i),i=r.next();while(bE(i));return n=>t(e,n)}return null}function o(){let e=[],t=a();for(;t;)e.push(t),t=a();return t=>e.every(e=>e(t))}function s(){let e=[],t=o();for(;t&&(e.push(t),i===`|`||i===`,`);){do i=r.next();while(i===`|`||i===`,`);t=o()}return t=>e.some(e=>e(t))}}function bE(e){return!!e&&!!e.match(/[\w\.:]+/)}function xE(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;let r=n[0];return n=t.exec(e),r}}}function SE(e){typeof e.dispose==`function`&&e.dispose()}var CE=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},wE=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},TE=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(e){let t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},EE=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new CE(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let e=this.Q;this.Q=[];let t=new TE;for(let n of e)DE(n,this.initialScopeName,this.repo,t);for(let e of t.references)if(e instanceof CE){if(this.seenFullScopeRequests.has(e.scopeName))continue;this.seenFullScopeRequests.add(e.scopeName),this.Q.push(e)}else{if(this.seenFullScopeRequests.has(e.scopeName)||this.seenPartialScopeRequests.has(e.toKey()))continue;this.seenPartialScopeRequests.add(e.toKey()),this.Q.push(e)}}};function DE(e,t,n,r){let i=n.lookup(e.scopeName);if(!i){if(e.scopeName===t)throw Error(`No grammar provided for <${t}>`);return}let a=n.lookup(t);e instanceof CE?kE({baseGrammar:a,selfGrammar:i},r):OE(e.ruleName,{baseGrammar:a,selfGrammar:i,repository:i.repository},r);let o=n.injections(e.scopeName);if(o)for(let e of o)r.add(new CE(e))}function OE(e,t,n){if(t.repository&&t.repository[e]){let r=t.repository[e];AE([r],t,n)}}function kE(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&AE(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&AE(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function AE(e,t,n){for(let r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);let e=r.repository?JT({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&AE(r.patterns,{...t,repository:e},n);let i=r.include;if(!i)continue;let a=IE(i);switch(a.kind){case 0:kE({...t,selfGrammar:t.baseGrammar},n);break;case 1:kE(t,n);break;case 2:OE(a.ruleName,{...t,repository:e},n);break;case 3:case 4:let r=a.scopeName===t.selfGrammar.scopeName?t.selfGrammar:a.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(r){let i={baseGrammar:t.baseGrammar,selfGrammar:r,repository:e};a.kind===4?OE(a.ruleName,i,n):kE(i,n)}else a.kind===4?n.add(new wE(a.scopeName,a.ruleName)):n.add(new CE(a.scopeName));break}}}var jE=class{kind=0},ME=class{kind=1},NE=class{constructor(e){this.ruleName=e}kind=2},PE=class{constructor(e){this.scopeName=e}kind=3},FE=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function IE(e){if(e===`$base`)return new jE;if(e===`$self`)return new ME;let t=e.indexOf(`#`);return t===-1?new PE(e):t===0?new NE(e.substring(1)):new FE(e.substring(0,t),e.substring(t+1))}var LE=/\\(\d+)/,RE=/\\(\d+)/g,zE=-1,BE=-2;function VE(e){return e}function HE(e){return e}var UE=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=ZT.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=ZT.hasCaptures(this._contentName)}get debugName(){let e=this.$location?`${YT(this.$location.filename)}:${this.$location.line}`:`unknown`;return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:ZT.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:ZT.replaceCaptures(this._contentName,e,t)}},WE=class extends UE{retokenizeCapturedWithRuleId;constructor(e,t,n,r,i){super(e,t,n,r),this.retokenizeCapturedWithRuleId=i}dispose(){}collectPatterns(e,t){throw Error(`Not supported!`)}compile(e,t){throw Error(`Not supported!`)}compileAG(e,t,n,r){throw Error(`Not supported!`)}},GE=class extends UE{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,null),this._match=new XE(r,this.id),this.captures=i,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new ZE,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},KE=class extends UE{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,r),this.patterns=i.patterns,this.hasMissingPatterns=i.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}collectPatterns(e,t){for(let n of this.patterns)e.getRule(n).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new ZE,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},qE=class extends UE{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i,a,o,s,c,l){super(e,t,n,r),this._begin=new XE(i,this.id),this.beginCaptures=a,this._end=new XE(o||``,-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=s,this.applyEndPatternLast=c||!1,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,r)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new ZE;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},JE=class extends UE{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,n,r,i,a,o,s,c){super(e,t,n,r),this._begin=new XE(i,this.id),this.beginCaptures=a,this.whileCaptures=s,this._while=new XE(o,BE),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null),this._cachedCompiledWhilePatterns&&=(this._cachedCompiledWhilePatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new ZE;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,n,r){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,r)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new ZE,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||``),this._cachedCompiledWhilePatterns}},YE=class e{static createCaptureRule(e,t,n,r,i){return e.registerRule(e=>new WE(t,e,n,r,i))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(i=>{if(t.id=i,t.match)return new GE(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,n,r));if(t.begin===void 0){t.repository&&(r=JT({},r,t.repository));let i=t.patterns;return i===void 0&&t.include&&(i=[{include:t.include}]),new KE(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(i,n,r))}return t.while?new JE(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,e._compileCaptures(t.whileCaptures||t.captures,n,r),e._compilePatterns(t.patterns,n,r)):new qE(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,e._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,e._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let i=[];if(t){let a=0;for(let e in t){if(e===`$vscodeTextmateLocation`)continue;let t=parseInt(e,10);t>a&&(a=t)}for(let e=0;e<=a;e++)i[e]=null;for(let a in t){if(a===`$vscodeTextmateLocation`)continue;let o=parseInt(a,10),s=0;t[a].patterns&&(s=e.getCompiledRuleId(t[a],n,r)),i[o]=e.createCaptureRule(n,t[a].$vscodeTextmateLocation,t[a].name,t[a].contentName,s)}}return i}static _compilePatterns(t,n,r){let i=[];if(t)for(let a=0,o=t.length;a<o;a++){let o=t[a],s=-1;if(o.include){let t=IE(o.include);switch(t.kind){case 0:case 1:s=e.getCompiledRuleId(r[o.include],n,r);break;case 2:let i=r[t.ruleName];i&&(s=e.getCompiledRuleId(i,n,r));break;case 3:case 4:let a=t.scopeName,c=t.kind===4?t.ruleName:null,l=n.getExternalGrammar(a,r);if(l)if(c){let t=l.repository[c];t&&(s=e.getCompiledRuleId(t,n,l.repository))}else s=e.getCompiledRuleId(l.repository.$self,n,l.repository);break}}else s=e.getCompiledRuleId(o,n,r);if(s!==-1){let e=n.getRule(s),t=!1;if((e instanceof KE||e instanceof qE||e instanceof JE)&&e.hasMissingPatterns&&e.patterns.length===0&&(t=!0),t)continue;i.push(s)}}return{patterns:i,hasMissingPatterns:(t?t.length:0)!==i.length}}},XE=class e{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,t){if(e&&typeof e==`string`){let t=e.length,n=0,r=[],i=!1;for(let a=0;a<t;a++)if(e.charAt(a)===`\\`&&a+1<t){let t=e.charAt(a+1);t===`z`?(r.push(e.substring(n,a)),r.push(`$(?!\\n)(?<!\\n)`),n=a+2):(t===`A`||t===`G`)&&(i=!0),a++}this.hasAnchor=i,n===0?this.source=e:(r.push(e.substring(n,t)),this.source=r.join(``))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=t,typeof this.source==`string`?this.hasBackReferences=LE.test(this.source):this.hasBackReferences=!1}clone(){return new e(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,t){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let n=t.map(t=>e.substring(t.start,t.end));return RE.lastIndex=0,this.source.replace(RE,(e,t)=>tE(n[parseInt(t,10)]||``))}_buildAnchorCache(){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let e=[],t=[],n=[],r=[],i,a,o,s;for(i=0,a=this.source.length;i<a;i++)o=this.source.charAt(i),e[i]=o,t[i]=o,n[i]=o,r[i]=o,o===`\\`&&i+1<a&&(s=this.source.charAt(i+1),s===`A`?(e[i+1]=``,t[i+1]=``,n[i+1]=`A`,r[i+1]=`A`):s===`G`?(e[i+1]=``,t[i+1]=`G`,n[i+1]=``,r[i+1]=`G`):(e[i+1]=s,t[i+1]=s,n[i+1]=s,r[i+1]=s),i++);return{A0_G0:e.join(``),A0_G1:t.join(``),A1_G0:n.join(``),A1_G1:r.join(``)}}resolveAnchors(e,t){return!this.hasAnchor||!this._anchorCache||typeof this.source!=`string`?this.source:e?t?this._anchorCache.A1_G1:this._anchorCache.A1_G0:t?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},ZE=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&=(this._cached.dispose(),null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(e=>e.source);this._cached=new QE(e,t,this._items.map(e=>e.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){return new QE(e,this._items.map(e=>e.resolveAnchors(t,n)),this._items.map(e=>e.ruleId))}},QE=class{constructor(e,t,n){this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}scanner;dispose(){typeof this.scanner.dispose==`function`&&this.scanner.dispose()}toString(){let e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(` - `+this.rules[t]+`: `+this.regExps[t]);return e.join(`
|
|
55
|
+
`)}findNextMatchSync(e,t,n){let r=this.scanner.findNextMatchSync(e,t,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},$E=class{constructor(e,t){this.languageId=e,this.tokenType=t}},eD=class e{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,t){this._defaultAttributes=new $E(e,8),this._embeddedLanguagesMatcher=new tD(Object.entries(t||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?e._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}static _NULL_SCOPE_METADATA=new $E(0,0);_getBasicScopeAttributes=new nE(e=>new $E(this._scopeToLanguage(e),this._toStandardTokenType(e)));_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(t){let n=t.match(e.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case`comment`:return 1;case`string`:return 2;case`regex`:return 3;case`meta.embedded`:return 0}throw Error(`Unexpected match for standard token type!`)}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},tD=class{values;scopesRegExp;constructor(e){if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);let t=e.map(([e,t])=>tE(e));t.sort(),t.reverse(),this.scopesRegExp=RegExp(`^((${t.join(`)|(`)}))($|\\.)`,``)}}match(e){if(!this.scopesRegExp)return;let t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}};typeof process<`u`&&{}.VSCODE_TEXTMATE_DEBUG;var nD=!1,rD=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function iD(e,t,n,r,i,a,o,s){let c=t.content.length,l=!1,u=-1;if(o){let o=aD(e,t,n,r,i,a);i=o.stack,r=o.linePos,n=o.isFirstLine,u=o.anchorPosition}let d=Date.now();for(;!l;){if(s!==0&&Date.now()-d>s)return new rD(i,!0);f()}return new rD(i,!1);function f(){let o=oD(e,t,n,r,i,u);if(!o){a.produce(i,c),l=!0;return}let s=o.captureIndices,d=o.matchedRuleId,f=s&&s.length>0?s[0].end>r:!1;if(d===zE){let o=i.getRule(e);a.produce(i,s[0].start),i=i.withContentNameScopesList(i.nameScopesList),fD(e,t,n,i,a,o.endCaptures,s),a.produce(i,s[0].end);let d=i;if(i=i.parent,u=d.getAnchorPos(),!f&&d.getEnterPos()===r){i=d,a.produce(i,c),l=!0;return}}else{let o=e.getRule(d);a.produce(i,s[0].start);let p=i,m=o.getName(t.content,s),h=i.contentNameScopesList.pushAttributed(m,e);if(i=i.push(d,r,u,s[0].end===c,null,h,h),o instanceof qE){let r=o;fD(e,t,n,i,a,r.beginCaptures,s),a.produce(i,s[0].end),u=s[0].end;let d=r.getContentName(t.content,s),m=h.pushAttributed(d,e);if(i=i.withContentNameScopesList(m),r.endHasBackReferences&&(i=i.withEndRule(r.getEndWithResolvedBackReferences(t.content,s))),!f&&p.hasSameRuleAs(i)){i=i.pop(),a.produce(i,c),l=!0;return}}else if(o instanceof JE){let r=o;fD(e,t,n,i,a,r.beginCaptures,s),a.produce(i,s[0].end),u=s[0].end;let d=r.getContentName(t.content,s),m=h.pushAttributed(d,e);if(i=i.withContentNameScopesList(m),r.whileHasBackReferences&&(i=i.withEndRule(r.getWhileWithResolvedBackReferences(t.content,s))),!f&&p.hasSameRuleAs(i)){i=i.pop(),a.produce(i,c),l=!0;return}}else if(fD(e,t,n,i,a,o.captures,s),a.produce(i,s[0].end),i=i.pop(),!f){i=i.safePop(),a.produce(i,c),l=!0;return}}s[0].end>r&&(r=s[0].end,n=!1)}}function aD(e,t,n,r,i,a){let o=i.beginRuleCapturedEOL?0:-1,s=[];for(let t=i;t;t=t.pop()){let n=t.getRule(e);n instanceof JE&&s.push({rule:n,stack:t})}for(let c=s.pop();c;c=s.pop()){let{ruleScanner:s,findOptions:l}=uD(c.rule,e,c.stack.endRule,n,r===o),u=s.findNextMatchSync(t,r,l);if(u){if(u.ruleId!==BE){i=c.stack.pop();break}u.captureIndices&&u.captureIndices.length&&(a.produce(c.stack,u.captureIndices[0].start),fD(e,t,n,c.stack,a,c.rule.whileCaptures,u.captureIndices),a.produce(c.stack,u.captureIndices[0].end),o=u.captureIndices[0].end,u.captureIndices[0].end>r&&(r=u.captureIndices[0].end,n=!1))}else{i=c.stack.pop();break}}return{stack:i,linePos:r,anchorPosition:o,isFirstLine:n}}function oD(e,t,n,r,i,a){let o=sD(e,t,n,r,i,a),s=e.getInjections();if(s.length===0)return o;let c=cD(s,e,t,n,r,i,a);if(!c)return o;if(!o)return c;let l=o.captureIndices[0].start,u=c.captureIndices[0].start;return u<l||c.priorityMatch&&u===l?c:o}function sD(e,t,n,r,i,a){let{ruleScanner:o,findOptions:s}=lD(i.getRule(e),e,i.endRule,n,r===a),c=o.findNextMatchSync(t,r,s);return c?{captureIndices:c.captureIndices,matchedRuleId:c.ruleId}:null}function cD(e,t,n,r,i,a,o){let s=Number.MAX_VALUE,c=null,l,u=0,d=a.contentNameScopesList.getScopeNames();for(let a=0,f=e.length;a<f;a++){let f=e[a];if(!f.matcher(d))continue;let{ruleScanner:p,findOptions:m}=lD(t.getRule(f.ruleId),t,null,r,i===o),h=p.findNextMatchSync(n,i,m);if(!h)continue;let g=h.captureIndices[0].start;if(!(g>=s)&&(s=g,c=h.captureIndices,l=h.ruleId,u=f.priority,s===i))break}return c?{priorityMatch:u===-1,captureIndices:c,matchedRuleId:l}:null}function lD(e,t,n,r,i){return nD?{ruleScanner:e.compile(t,n),findOptions:dD(r,i)}:{ruleScanner:e.compileAG(t,n,r,i),findOptions:0}}function uD(e,t,n,r,i){return nD?{ruleScanner:e.compileWhile(t,n),findOptions:dD(r,i)}:{ruleScanner:e.compileWhileAG(t,n,r,i),findOptions:0}}function dD(e,t){let n=0;return e||(n|=1),t||(n|=4),n}function fD(e,t,n,r,i,a,o){if(a.length===0)return;let s=t.content,c=Math.min(a.length,o.length),l=[],u=o[0].end;for(let t=0;t<c;t++){let c=a[t];if(c===null)continue;let d=o[t];if(d.length===0)continue;if(d.start>u)break;for(;l.length>0&&l[l.length-1].endPos<=d.start;)i.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop();if(l.length>0?i.produceFromScopes(l[l.length-1].scopes,d.start):i.produce(r,d.start),c.retokenizeCapturedWithRuleId){let t=c.getName(s,o),a=r.contentNameScopesList.pushAttributed(t,e),l=c.getContentName(s,o),u=a.pushAttributed(l,e),f=r.push(c.retokenizeCapturedWithRuleId,d.start,-1,!1,null,a,u),p=e.createOnigString(s.substring(0,d.end));iD(e,p,n&&d.start===0,d.start,f,i,!1,0),SE(p);continue}let f=c.getName(s,o);if(f!==null){let t=(l.length>0?l[l.length-1].scopes:r.contentNameScopesList).pushAttributed(f,e);l.push(new pD(t,d.end))}}for(;l.length>0;)i.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}var pD=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function mD(e,t,n,r,i,a,o,s){return new vD(e,t,n,r,i,a,o,s)}function hD(e,t,n,r,i){let a=yE(t,gD),o=YE.getCompiledRuleId(n,r,i.repository);for(let n of a)e.push({debugSelector:t,matcher:n.matcher,ruleId:o,grammar:i,priority:n.priority})}function gD(e,t){if(t.length<e.length)return!1;let n=0;return e.every(e=>{for(let r=n;r<t.length;r++)if(_D(t[r],e))return n=r+1,!0;return!1})}function _D(e,t){if(!e)return!1;if(e===t)return!0;let n=t.length;return e.length>n&&e.substr(0,n)===t&&e[n]===`.`}var vD=class{constructor(e,t,n,r,i,a,o,s){if(this._rootScopeName=e,this.balancedBracketSelectors=a,this._onigLib=s,this._basicScopeAttributesProvider=new eD(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=yD(t,null),this._injections=null,this._tokenTypeMatchers=[],i)for(let e of Object.keys(i)){let t=yE(e,gD);for(let n of t)this._tokenTypeMatchers.push({matcher:n.matcher,type:i[e]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(let e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){let e={lookup:e=>e===this._rootScopeName?this._grammar:this.getExternalGrammar(e),injections:e=>this._grammarRepository.injections(e)},t=[],n=this._rootScopeName,r=e.lookup(n);if(r){let e=r.injections;if(e)for(let n in e)hD(t,n,e[n],this,r);let i=this._grammarRepository.injections(n);i&&i.forEach(e=>{let n=this.getExternalGrammar(e);if(n){let e=n.injectionSelector;e&&hD(t,e,n,this,n)}})}return t.sort((e,t)=>e.priority-t.priority),t}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(e){let t=++this._lastRuleId,n=e(VE(t));return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[HE(e)]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){let n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=yD(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){let r=this._tokenize(e,t,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(e,t,n=0){let r=this._tokenize(e,t,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(e,t,n,r){this._rootId===-1&&(this._rootId=YE.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let i;if(!t||t===xD.NULL){i=!0;let e=this._basicScopeAttributesProvider.getDefaultAttributes(),n=this.themeProvider.getDefaults(),r=gE.set(0,e.languageId,e.tokenType,null,n.fontStyle,n.foregroundId,n.backgroundId),a=this.getRule(this._rootId).getName(null,null),o;o=a?bD.createRootAndLookUpScopeName(a,r,this):bD.createRoot(`unknown`,r),t=new xD(null,this._rootId,-1,-1,!1,null,o,o)}else i=!1,t.reset();e+=`
|
|
56
|
+
`;let a=this.createOnigString(e),o=a.content.length,s=new CD(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=iD(this,a,i,0,t,s,!0,r);return SE(a),{lineLength:o,lineTokens:s,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function yD(e,t){return e=WT(e),e.repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var bD=class e{constructor(e,t,n){this.parent=e,this.scopePath=t,this.tokenAttributes=n}static fromExtension(t,n){let r=t,i=t?.scopePath??null;for(let t of n)i=iE.push(i,t.scopeNames),r=new e(r,i,t.encodedTokenAttributes);return r}static createRoot(t,n){return new e(null,new iE(null,t),n)}static createRootAndLookUpScopeName(t,n,r){let i=r.getMetadataForScope(t),a=new iE(null,t),o=r.themeProvider.themeMatch(a);return new e(null,a,e.mergeAttributes(n,i,o))}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(` `)}equals(t){return e.equals(this,t)}static equals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.scopeName!==t.scopeName||e.tokenAttributes!==t.tokenAttributes)return!1;e=e.parent,t=t.parent}while(!0)}static mergeAttributes(e,t,n){let r=-1,i=0,a=0;return n!==null&&(r=n.fontStyle,i=n.foregroundId,a=n.backgroundId),gE.set(e,t.languageId,t.tokenType,null,r,i,a)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(` `)===-1)return e._pushAttributed(this,t,n);let r=t.split(/ /g),i=this;for(let t of r)i=e._pushAttributed(i,t,n);return i}static _pushAttributed(t,n,r){let i=r.getMetadataForScope(n),a=t.scopePath.push(n),o=r.themeProvider.themeMatch(a);return new e(t,a,e.mergeAttributes(t.tokenAttributes,i,o))}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push({encodedTokenAttributes:n.tokenAttributes,scopeNames:n.scopePath.getExtensionIfDefined(n.parent?.scopePath??null)}),n=n.parent;return n===e?t.reverse():void 0}},xD=class e{constructor(e,t,n,r,i,a,o,s){this.parent=e,this.ruleId=t,this.beginRuleCapturedEOL=i,this.endRule=a,this.nameScopesList=o,this.contentNameScopesList=s,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=n,this._anchorPos=r}_stackElementBrand=void 0;static NULL=new e(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){return t===null?!1:e._equals(this,t)}static _equals(e,t){return e===t?!0:this._structuralEquals(e,t)?bD.equals(e.contentNameScopesList,t.contentNameScopesList):!1}static _structuralEquals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.depth!==t.depth||e.ruleId!==t.ruleId||e.endRule!==t.endRule)return!1;e=e.parent,t=t.parent}while(!0)}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){e._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,i,a,o,s){return new e(this,t,n,r,i,a,o,s)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){let e=[];return this._writeString(e,0),`[`+e.join(`,`)+`]`}_writeString(e,t){return this.parent&&(t=this.parent._writeString(e,t)),e[t++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,t}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(t){return this.endRule===t?this:new e(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let t=this;for(;t&&t._enterPos===e._enterPos;){if(t.ruleId===e.ruleId)return!0;t=t.parent}return!1}toStateStackFrame(){return{ruleId:HE(this.ruleId),beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(t,n){let r=bD.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new e(t,VE(n.ruleId),n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,bD.fromExtension(r,n.contentNameScopesList))}},SD=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(e=>e===`*`?(this.allowAny=!0,[]):yE(e,gD).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>yE(e,gD).map(e=>e.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(let t of this.unbalancedBracketScopes)if(t(e))return!1;for(let t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},CD=class{constructor(e,t,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let n=e?.tokenAttributes??0,r=!1;if(this.balancedBracketSelectors?.matchesAlways&&(r=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){let t=e?.getScopeNames()??[];for(let e of this._tokenTypeOverrides)e.matcher(t)&&(n=gE.set(n,0,_E(e.type),null,-1,0,0));this.balancedBracketSelectors&&(r=this.balancedBracketSelectors.match(t))}if(r&&(n=gE.set(n,0,8,r,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===n){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(n),this._lastTokenEndIndex=t;return}let n=e?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);let n=new Uint32Array(this._binaryTokens.length);for(let e=0,t=this._binaryTokens.length;e<t;e++)n[e]=this._binaryTokens[e];return n}},wD=class{constructor(e,t){this._onigLib=t,this._theme=e}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(let e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,n,r,i){if(!this._grammars.has(e)){let a=this._rawGrammars.get(e);if(!a)return null;this._grammars.set(e,mD(e,a,t,n,r,i,this,this._onigLib))}return this._grammars.get(e)}},TD=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new wD(rE.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(rE.createFromRawTheme(e,t))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,t,n){return this.loadGrammarWithConfiguration(e,t,{embeddedLanguages:n})}loadGrammarWithConfiguration(e,t,n){return this._loadGrammar(e,t,n.embeddedLanguages,n.tokenTypes,new SD(n.balancedBracketSelectors||[],n.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,n,r,i){let a=new EE(this._syncRegistry,e);for(;a.Q.length>0;)a.Q.map(e=>this._loadSingleGrammar(e.scopeName)),a.processQueue();return this._grammarForScopeName(e,t,n,r,i)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){let t=this._options.loadGrammar(e);if(t){let n=typeof this._options.getInjections==`function`?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(t,n)}}addGrammar(e,t=[],n=0,r=null){return this._syncRegistry.addGrammar(e,t),this._grammarForScopeName(e.scopeName,n,r)}_grammarForScopeName(e,t=0,n=null,r=null,i=null){return this._syncRegistry.grammarForScopeName(e,t,n,r,i)}},ED=xD.NULL,DD=/["&'<>`]/g,OD=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,kD=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,AD=/[|\\{}()[\]^$+*?.]/g,jD=new WeakMap;function MD(e,t){if(e=e.replace(t.subset?ND(t.subset):DD,r),t.subset||t.escapeOnly)return e;return e.replace(OD,n).replace(kD,r);function n(e,n,r){return t.format((e.charCodeAt(0)-55296)*1024+e.charCodeAt(1)-56320+65536,r.charCodeAt(n+2),t)}function r(e,n,r){return t.format(e.charCodeAt(0),r.charCodeAt(n+1),t)}}function ND(e){let t=jD.get(e);return t||(t=PD(e),jD.set(e,t)),t}function PD(e){let t=[],n=-1;for(;++n<e.length;)t.push(e[n].replace(AD,`\\$&`));return RegExp(`(?:`+t.join(`|`)+`)`,`g`)}var FD=/[\dA-Fa-f]/;function ID(e,t,n){let r=`&#x`+e.toString(16).toUpperCase();return n&&t&&!FD.test(String.fromCharCode(t))?r:r+`;`}var LD=/\d/;function RD(e,t,n){let r=`&#`+String(e);return n&&t&&!LD.test(String.fromCharCode(t))?r:r+`;`}var zD={nbsp:`\xA0`,iexcl:`¡`,cent:`¢`,pound:`£`,curren:`¤`,yen:`¥`,brvbar:`¦`,sect:`§`,uml:`¨`,copy:`©`,ordf:`ª`,laquo:`«`,not:`¬`,shy:``,reg:`®`,macr:`¯`,deg:`°`,plusmn:`±`,sup2:`²`,sup3:`³`,acute:`´`,micro:`µ`,para:`¶`,middot:`·`,cedil:`¸`,sup1:`¹`,ordm:`º`,raquo:`»`,frac14:`¼`,frac12:`½`,frac34:`¾`,iquest:`¿`,Agrave:`À`,Aacute:`Á`,Acirc:`Â`,Atilde:`Ã`,Auml:`Ä`,Aring:`Å`,AElig:`Æ`,Ccedil:`Ç`,Egrave:`È`,Eacute:`É`,Ecirc:`Ê`,Euml:`Ë`,Igrave:`Ì`,Iacute:`Í`,Icirc:`Î`,Iuml:`Ï`,ETH:`Ð`,Ntilde:`Ñ`,Ograve:`Ò`,Oacute:`Ó`,Ocirc:`Ô`,Otilde:`Õ`,Ouml:`Ö`,times:`×`,Oslash:`Ø`,Ugrave:`Ù`,Uacute:`Ú`,Ucirc:`Û`,Uuml:`Ü`,Yacute:`Ý`,THORN:`Þ`,szlig:`ß`,agrave:`à`,aacute:`á`,acirc:`â`,atilde:`ã`,auml:`ä`,aring:`å`,aelig:`æ`,ccedil:`ç`,egrave:`è`,eacute:`é`,ecirc:`ê`,euml:`ë`,igrave:`ì`,iacute:`í`,icirc:`î`,iuml:`ï`,eth:`ð`,ntilde:`ñ`,ograve:`ò`,oacute:`ó`,ocirc:`ô`,otilde:`õ`,ouml:`ö`,divide:`÷`,oslash:`ø`,ugrave:`ù`,uacute:`ú`,ucirc:`û`,uuml:`ü`,yacute:`ý`,thorn:`þ`,yuml:`ÿ`,fnof:`ƒ`,Alpha:`Α`,Beta:`Β`,Gamma:`Γ`,Delta:`Δ`,Epsilon:`Ε`,Zeta:`Ζ`,Eta:`Η`,Theta:`Θ`,Iota:`Ι`,Kappa:`Κ`,Lambda:`Λ`,Mu:`Μ`,Nu:`Ν`,Xi:`Ξ`,Omicron:`Ο`,Pi:`Π`,Rho:`Ρ`,Sigma:`Σ`,Tau:`Τ`,Upsilon:`Υ`,Phi:`Φ`,Chi:`Χ`,Psi:`Ψ`,Omega:`Ω`,alpha:`α`,beta:`β`,gamma:`γ`,delta:`δ`,epsilon:`ε`,zeta:`ζ`,eta:`η`,theta:`θ`,iota:`ι`,kappa:`κ`,lambda:`λ`,mu:`μ`,nu:`ν`,xi:`ξ`,omicron:`ο`,pi:`π`,rho:`ρ`,sigmaf:`ς`,sigma:`σ`,tau:`τ`,upsilon:`υ`,phi:`φ`,chi:`χ`,psi:`ψ`,omega:`ω`,thetasym:`ϑ`,upsih:`ϒ`,piv:`ϖ`,bull:`•`,hellip:`…`,prime:`′`,Prime:`″`,oline:`‾`,frasl:`⁄`,weierp:`℘`,image:`ℑ`,real:`ℜ`,trade:`™`,alefsym:`ℵ`,larr:`←`,uarr:`↑`,rarr:`→`,darr:`↓`,harr:`↔`,crarr:`↵`,lArr:`⇐`,uArr:`⇑`,rArr:`⇒`,dArr:`⇓`,hArr:`⇔`,forall:`∀`,part:`∂`,exist:`∃`,empty:`∅`,nabla:`∇`,isin:`∈`,notin:`∉`,ni:`∋`,prod:`∏`,sum:`∑`,minus:`−`,lowast:`∗`,radic:`√`,prop:`∝`,infin:`∞`,ang:`∠`,and:`∧`,or:`∨`,cap:`∩`,cup:`∪`,int:`∫`,there4:`∴`,sim:`∼`,cong:`≅`,asymp:`≈`,ne:`≠`,equiv:`≡`,le:`≤`,ge:`≥`,sub:`⊂`,sup:`⊃`,nsub:`⊄`,sube:`⊆`,supe:`⊇`,oplus:`⊕`,otimes:`⊗`,perp:`⊥`,sdot:`⋅`,lceil:`⌈`,rceil:`⌉`,lfloor:`⌊`,rfloor:`⌋`,lang:`〈`,rang:`〉`,loz:`◊`,spades:`♠`,clubs:`♣`,hearts:`♥`,diams:`♦`,quot:`"`,amp:`&`,lt:`<`,gt:`>`,OElig:`Œ`,oelig:`œ`,Scaron:`Š`,scaron:`š`,Yuml:`Ÿ`,circ:`ˆ`,tilde:`˜`,ensp:` `,emsp:` `,thinsp:` `,zwnj:``,zwj:``,lrm:``,rlm:``,ndash:`–`,mdash:`—`,lsquo:`‘`,rsquo:`’`,sbquo:`‚`,ldquo:`“`,rdquo:`”`,bdquo:`„`,dagger:`†`,Dagger:`‡`,permil:`‰`,lsaquo:`‹`,rsaquo:`›`,euro:`€`},BD=[`cent`,`copy`,`divide`,`gt`,`lt`,`not`,`para`,`times`],VD={}.hasOwnProperty,HD={},UD;for(UD in zD)VD.call(zD,UD)&&(HD[zD[UD]]=UD);var WD=/[^\dA-Za-z]/;function GD(e,t,n,r){let i=String.fromCharCode(e);if(VD.call(HD,i)){let e=HD[i],a=`&`+e;return n&&jn.includes(e)&&!BD.includes(e)&&(!r||t&&t!==61&&WD.test(String.fromCharCode(t)))?a:a+`;`}return``}function KD(e,t,n){let r=ID(e,t,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=GD(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){let i=RD(e,t,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return i&&(!n.useShortestReferences||i.length<r.length)?i:r}function qD(e,t){return MD(e,Object.assign({format:KD},t))}var JD=/^>|^->|<!--|-->|--!>|<!-$/g,YD=[`>`],XD=[`<`,`>`];function ZD(e,t,n,r){return r.settings.bogusComments?`<?`+qD(e.value,Object.assign({},r.settings.characterReferences,{subset:YD}))+`>`:`<!--`+e.value.replace(JD,i)+`-->`;function i(e){return qD(e,Object.assign({},r.settings.characterReferences,{subset:XD}))}}function QD(e,t,n,r){return`<!`+(r.settings.upperDoctype?`DOCTYPE`:`doctype`)+(r.settings.tightDoctype?``:` `)+`html>`}var $D=nO(1),eO=nO(-1),tO=[];function nO(e){return t;function t(t,n,r){let i=t?t.children:tO,a=(n||0)+e,o=i[a];if(!r)for(;o&&Qc(o);)a+=e,o=i[a];return o}}var rO={}.hasOwnProperty;function iO(e){return t;function t(t,n,r){return rO.call(e,t.tagName)&&e[t.tagName](t,n,r)}}var aO=iO({body:cO,caption:oO,colgroup:oO,dd:fO,dt:dO,head:oO,html:sO,li:uO,optgroup:mO,option:hO,p:lO,rp:pO,rt:pO,tbody:_O,td:bO,tfoot:vO,th:bO,thead:gO,tr:yO});function oO(e,t,n){let r=$D(n,t,!0);return!r||r.type!==`comment`&&!(r.type===`text`&&Qc(r.value.charAt(0)))}function sO(e,t,n){let r=$D(n,t);return!r||r.type!==`comment`}function cO(e,t,n){let r=$D(n,t);return!r||r.type!==`comment`}function lO(e,t,n){let r=$D(n,t);return r?r.type===`element`&&(r.tagName===`address`||r.tagName===`article`||r.tagName===`aside`||r.tagName===`blockquote`||r.tagName===`details`||r.tagName===`div`||r.tagName===`dl`||r.tagName===`fieldset`||r.tagName===`figcaption`||r.tagName===`figure`||r.tagName===`footer`||r.tagName===`form`||r.tagName===`h1`||r.tagName===`h2`||r.tagName===`h3`||r.tagName===`h4`||r.tagName===`h5`||r.tagName===`h6`||r.tagName===`header`||r.tagName===`hgroup`||r.tagName===`hr`||r.tagName===`main`||r.tagName===`menu`||r.tagName===`nav`||r.tagName===`ol`||r.tagName===`p`||r.tagName===`pre`||r.tagName===`section`||r.tagName===`table`||r.tagName===`ul`):!n||!(n.type===`element`&&(n.tagName===`a`||n.tagName===`audio`||n.tagName===`del`||n.tagName===`ins`||n.tagName===`map`||n.tagName===`noscript`||n.tagName===`video`))}function uO(e,t,n){let r=$D(n,t);return!r||r.type===`element`&&r.tagName===`li`}function dO(e,t,n){let r=$D(n,t);return!!(r&&r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`))}function fO(e,t,n){let r=$D(n,t);return!r||r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`)}function pO(e,t,n){let r=$D(n,t);return!r||r.type===`element`&&(r.tagName===`rp`||r.tagName===`rt`)}function mO(e,t,n){let r=$D(n,t);return!r||r.type===`element`&&r.tagName===`optgroup`}function hO(e,t,n){let r=$D(n,t);return!r||r.type===`element`&&(r.tagName===`option`||r.tagName===`optgroup`)}function gO(e,t,n){let r=$D(n,t);return!!(r&&r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`))}function _O(e,t,n){let r=$D(n,t);return!r||r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`)}function vO(e,t,n){return!$D(n,t)}function yO(e,t,n){let r=$D(n,t);return!r||r.type===`element`&&r.tagName===`tr`}function bO(e,t,n){let r=$D(n,t);return!r||r.type===`element`&&(r.tagName===`td`||r.tagName===`th`)}var xO=iO({body:wO,colgroup:TO,head:CO,html:SO,tbody:EO});function SO(e){let t=$D(e,-1);return!t||t.type!==`comment`}function CO(e){let t=new Set;for(let n of e.children)if(n.type===`element`&&(n.tagName===`base`||n.tagName===`title`)){if(t.has(n.tagName))return!1;t.add(n.tagName)}let n=e.children[0];return!n||n.type===`element`}function wO(e){let t=$D(e,-1,!0);return!t||t.type!==`comment`&&!(t.type===`text`&&Qc(t.value.charAt(0)))&&!(t.type===`element`&&(t.tagName===`meta`||t.tagName===`link`||t.tagName===`script`||t.tagName===`style`||t.tagName===`template`))}function TO(e,t,n){let r=eO(n,t),i=$D(e,-1,!0);return n&&r&&r.type===`element`&&r.tagName===`colgroup`&&aO(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`col`)}function EO(e,t,n){let r=eO(n,t),i=$D(e,-1);return n&&r&&r.type===`element`&&(r.tagName===`thead`||r.tagName===`tbody`)&&aO(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`tr`)}var DO={name:[[`
|
|
57
|
+
\f\r &/=>`.split(``),`
|
|
58
|
+
\f\r "&'/=>\``.split(``)],[`\0
|
|
59
|
+
\f\r "&'/<=>`.split(``),`\0
|
|
60
|
+
\f\r "&'/<=>\``.split(``)]],unquoted:[[`
|
|
61
|
+
\f\r &>`.split(``),`\0
|
|
62
|
+
\f\r "&'<=>\``.split(``)],[`\0
|
|
63
|
+
\f\r "&'<=>\``.split(``),`\0
|
|
64
|
+
\f\r "&'<=>\``.split(``)]],single:[[`&'`.split(``),`"&'\``.split(``)],[`\0&'`.split(``),`\0"&'\``.split(``)]],double:[[`"&`.split(``),`"&'\``.split(``)],[`\0"&`.split(``),`\0"&'\``.split(``)]]};function OO(e,t,n,r){let i=r.schema,a=i.space===`svg`?!1:r.settings.omitOptionalTags,o=i.space===`svg`?r.settings.closeEmptyElements:r.settings.voids.includes(e.tagName.toLowerCase()),s=[],c;i.space===`html`&&e.tagName===`svg`&&(r.schema=Nn);let l=kO(r,e.properties),u=r.all(i.space===`html`&&e.tagName===`template`?e.content:e);return r.schema=i,u&&(o=!1),(l||!a||!xO(e,t,n))&&(s.push(`<`,e.tagName,l?` `+l:``),o&&(i.space===`svg`||r.settings.closeSelfClosing)&&(c=l.charAt(l.length-1),(!r.settings.tightSelfClosing||c===`/`||c&&c!==`"`&&c!==`'`)&&s.push(` `),s.push(`/`)),s.push(`>`)),s.push(u),!o&&(!a||!aO(e,t,n))&&s.push(`</`+e.tagName+`>`),s.join(``)}function kO(e,t){let n=[],r=-1,i;if(t){for(i in t)if(t[i]!==null&&t[i]!==void 0){let r=AO(e,i,t[i]);r&&n.push(r)}}for(;++r<n.length;){let t=e.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&t!==`"`&&t!==`'`&&(n[r]+=` `)}return n.join(``)}function AO(e,t,n){let r=Pn(e.schema,t),i=e.settings.allowParseErrors&&e.schema.space===`html`?0:1,a=+!e.settings.allowDangerousCharacters,o=e.quote,s;if(r.overloadedBoolean&&(n===r.attribute||n===``)?n=!0:(r.boolean||r.overloadedBoolean)&&(typeof n!=`string`||n===r.attribute||n===``)&&(n=!!n),n==null||n===!1||typeof n==`number`&&Number.isNaN(n))return``;let c=qD(r.attribute,Object.assign({},e.settings.characterReferences,{subset:DO.name[i][a]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?In:Mn)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?c:(e.settings.preferUnquoted&&(s=qD(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:DO.unquoted[i][a]}))),s!==n&&(e.settings.quoteSmart&&vS(n,o)>vS(n,e.alternative)&&(o=e.alternative),s=o+qD(n,Object.assign({},e.settings.characterReferences,{subset:(o===`'`?DO.single:DO.double)[i][a],attribute:!0}))+o),c+(s&&`=`+s))}var jO=[`<`,`&`];function MO(e,t,n,r){return n&&n.type===`element`&&(n.tagName===`script`||n.tagName===`style`)?e.value:qD(e.value,Object.assign({},r.settings.characterReferences,{subset:jO}))}function NO(e,t,n,r){return r.settings.allowDangerousHtml?e.value:MO(e,t,n,r)}function PO(e,t,n,r){return r.all(e)}var FO=Kb(`type`,{invalid:IO,unknown:LO,handlers:{comment:ZD,doctype:QD,element:OO,raw:NO,root:PO,text:MO}});function IO(e){throw Error("Expected node, not `"+e+"`")}function LO(e){throw Error("Cannot compile unknown node `"+e.type+"`")}var RO={},zO={},BO=[];function VO(e,t){let n=t||RO,r=n.quote||`"`,i=r===`"`?`'`:`"`;if(r!==`"`&&r!==`'`)throw Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:HO,all:UO,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||ox,characterReferences:n.characterReferences||zO,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space===`svg`?Nn:Un,quote:r,alternative:i}.one(Array.isArray(e)?{type:`root`,children:e}:e,void 0,void 0)}function HO(e,t,n){return FO(e,t,n,this)}function UO(e){let t=[],n=e&&e.children||BO,r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join(``)}function WO(e,t){let n=typeof e==`string`?{}:{...e.colorReplacements},r=typeof e==`string`?e:e.name;for(let[e,i]of Object.entries(t?.colorReplacements||{}))typeof i==`string`?n[e]=i:e===r&&Object.assign(n,i);return n}function GO(e,t){return e&&(t?.[e?.toLowerCase()]||e)}function KO(e){return Array.isArray(e)?e:[e]}async function qO(e){return Promise.resolve(typeof e==`function`?e():e).then(e=>e.default||e)}function JO(e){return!e||[`plaintext`,`txt`,`text`,`plain`].includes(e)}function YO(e){return e===`ansi`||JO(e)}function XO(e){return e===`none`}function ZO(e){return XO(e)}function QO(e,t){if(!t)return e;e.properties||={},e.properties.class||=[],typeof e.properties.class==`string`&&(e.properties.class=e.properties.class.split(/\s+/g)),Array.isArray(e.properties.class)||(e.properties.class=[]);let n=Array.isArray(t)?t:t.split(/\s+/g);for(let t of n)t&&!e.properties.class.includes(t)&&e.properties.class.push(t);return e}function $O(e,t=!1){let n=e.split(/(\r?\n)/g),r=0,i=[];for(let e=0;e<n.length;e+=2){let a=t?n[e]+(n[e+1]||``):n[e];i.push([a,r]),r+=n[e].length,r+=n[e+1]?.length||0}return i}function ek(e){let t=$O(e,!0).map(([e])=>e);function n(n){if(n===e.length)return{line:t.length-1,character:t[t.length-1].length};let r=n,i=0;for(let e of t){if(r<e.length)break;r-=e.length,i++}return{line:i,character:r}}function r(e,n){let r=0;for(let n=0;n<e;n++)r+=t[n].length;return r+=n,r}return{lines:t,indexToPos:n,posToIndex:r}}function tk(e,t,n){let r=new Set;for(let t of e.matchAll(/lang=["']([\w-]+)["']/g))r.add(t[1]);for(let t of e.matchAll(/(?:```|~~~)([\w-]+)/g))r.add(t[1]);for(let t of e.matchAll(/\\begin\{([\w-]+)\}/g))r.add(t[1]);if(!n)return Array.from(r);let i=n.getBundledLanguages();return Array.from(r).filter(e=>e&&i[e])}var nk=`light-dark()`,rk=[`color`,`background-color`];function ik(e,t){let n=0,r=[];for(let i of t)i>n&&r.push({...e,content:e.content.slice(n,i),offset:e.offset+n}),n=i;return n<e.content.length&&r.push({...e,content:e.content.slice(n),offset:e.offset+n}),r}function ak(e,t){let n=Array.from(t instanceof Set?t:new Set(t)).sort((e,t)=>e-t);return n.length?e.map(e=>e.flatMap(e=>{let t=n.filter(t=>e.offset<t&&t<e.offset+e.content.length).map(t=>t-e.offset).sort((e,t)=>e-t);return t.length?ik(e,t):e})):e}function ok(e,t,n,r,i=`css-vars`){let a={content:e.content,explanation:e.explanation,offset:e.offset},o=t.map(t=>sk(e.variants[t])),s=new Set(o.flatMap(e=>Object.keys(e))),c={},l=(e,r)=>{let i=r===`color`?``:r===`background-color`?`-bg`:`-${r}`;return n+t[e]+(r===`color`?``:i)};return o.forEach((e,n)=>{for(let a of s){let s=e[a]||`inherit`;if(n===0&&r&&rk.includes(a))if(r===nk&&o.length>1){let e=t.findIndex(e=>e===`light`),r=t.findIndex(e=>e===`dark`);if(e===-1||r===-1)throw new UT('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');c[a]=`light-dark(${o[e][a]||`inherit`}, ${o[r][a]||`inherit`})`,i===`css-vars`&&(c[l(n,a)]=s)}else c[a]=s;else i===`css-vars`&&(c[l(n,a)]=s)}}),a.htmlStyle=c,a}function sk(e){let t={};if(e.color&&(t.color=e.color),e.bgColor&&(t[`background-color`]=e.bgColor),e.fontStyle){e.fontStyle&uE.Italic&&(t[`font-style`]=`italic`),e.fontStyle&uE.Bold&&(t[`font-weight`]=`bold`);let n=[];e.fontStyle&uE.Underline&&n.push(`underline`),e.fontStyle&uE.Strikethrough&&n.push(`line-through`),n.length&&(t[`text-decoration`]=n.join(` `))}return t}function ck(e){return typeof e==`string`?e:Object.entries(e).map(([e,t])=>`${e}:${t}`).join(`;`)}var lk=new WeakMap;function uk(e,t){lk.set(e,t)}function dk(e){return lk.get(e)}var fk=class e{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(t,n){return new e(Object.fromEntries(KO(n).map(e=>[e,ED])),t)}constructor(...e){if(e.length===2){let[t,n]=e;this.lang=n,this._stacks=t}else{let[t,n,r]=e;this.lang=n,this._stacks={[r]:t}}}getInternalStack(e=this.theme){return this._stacks[e]}getScopes(e=this.theme){return pk(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function pk(e){let t=[],n=new Set;function r(e){if(n.has(e))return;n.add(e);let i=e?.nameScopesList?.scopeName;i&&t.push(i),e.parent&&r(e.parent)}return r(e),t}function mk(e,t){if(!(e instanceof fk))throw new UT(`Invalid grammar state`);return e.getInternalStack(t)}function hk(){let e=new WeakMap;function t(t){if(!e.has(t.meta)){let n=function(e){if(typeof e==`number`){if(e<0||e>t.source.length)throw new UT(`Invalid decoration offset: ${e}. Code length: ${t.source.length}`);return{...r.indexToPos(e),offset:e}}else{let t=r.lines[e.line];if(t===void 0)throw new UT(`Invalid decoration position ${JSON.stringify(e)}. Lines length: ${r.lines.length}`);let n=e.character;if(n<0&&(n=t.length+n),n<0||n>t.length)throw new UT(`Invalid decoration position ${JSON.stringify(e)}. Line ${e.line} length: ${t.length}`);return{...e,character:n,offset:r.posToIndex(e.line,n)}}},r=ek(t.source),i=(t.options.decorations||[]).map(e=>({...e,start:n(e.start),end:n(e.end)}));gk(i),e.set(t.meta,{decorations:i,converter:r,source:t.source})}return e.get(t.meta)}return{name:`shiki:decorations`,tokens(e){if(this.options.decorations?.length)return ak(e,t(this).decorations.flatMap(e=>[e.start.offset,e.end.offset]))},code(e){if(!this.options.decorations?.length)return;let n=t(this),r=Array.from(e.children).filter(e=>e.type===`element`&&e.tagName===`span`);if(r.length!==n.converter.lines.length)throw new UT(`Number of lines in code element (${r.length}) does not match the number of lines in the source (${n.converter.lines.length}). Failed to apply decorations.`);function i(e,t,n,i){let a=r[e],s=``,c=-1,l=-1;if(t===0&&(c=0),n===0&&(l=0),n===1/0&&(l=a.children.length),c===-1||l===-1)for(let e=0;e<a.children.length;e++)s+=_k(a.children[e]),c===-1&&s.length===t&&(c=e+1),l===-1&&s.length===n&&(l=e+1);if(c===-1)throw new UT(`Failed to find start index for decoration ${JSON.stringify(i.start)}`);if(l===-1)throw new UT(`Failed to find end index for decoration ${JSON.stringify(i.end)}`);let u=a.children.slice(c,l);if(!i.alwaysWrap&&u.length===a.children.length)o(a,i,`line`);else if(!i.alwaysWrap&&u.length===1&&u[0].type===`element`)o(u[0],i,`token`);else{let e={type:`element`,tagName:`span`,properties:{},children:u};o(e,i,`wrapper`),a.children.splice(c,u.length,e)}}function a(e,t){r[e]=o(r[e],t,`line`)}function o(e,t,n){let r=t.properties||{},i=t.transform||(e=>e);return e.tagName=t.tagName||`span`,e.properties={...e.properties,...r,class:e.properties.class},t.properties?.class&&QO(e,t.properties.class),e=i(e,n)||e,e}let s=[],c=n.decorations.sort((e,t)=>t.start.offset-e.start.offset||e.end.offset-t.end.offset);for(let e of c){let{start:t,end:n}=e;if(t.line===n.line)i(t.line,t.character,n.character,e);else if(t.line<n.line){i(t.line,t.character,1/0,e);for(let r=t.line+1;r<n.line;r++)s.unshift(()=>a(r,e));i(n.line,0,n.character,e)}}s.forEach(e=>e())}}}function gk(e){for(let t=0;t<e.length;t++){let n=e[t];if(n.start.offset>n.end.offset)throw new UT(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=t+1;r<e.length;r++){let t=e[r],i=n.start.offset<=t.start.offset&&t.start.offset<n.end.offset,a=n.start.offset<t.end.offset&&t.end.offset<=n.end.offset,o=t.start.offset<=n.start.offset&&n.start.offset<t.end.offset,s=t.start.offset<n.end.offset&&n.end.offset<=t.end.offset;if(i||a||o||s){if(i&&a||o&&s||o&&n.start.offset===n.end.offset||a&&t.start.offset===t.end.offset)continue;throw new UT(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(t.start)} intersect.`)}}}}function _k(e){return e.type===`text`?e.value:e.type===`element`?e.children.map(_k).join(``):``}var vk=[hk()];function yk(e){let t=bk(e.transformers||[]);return[...t.pre,...t.normal,...t.post,...vk]}function bk(e){let t=[],n=[],r=[];for(let i of e)switch(i.enforce){case`pre`:t.push(i);break;case`post`:n.push(i);break;default:r.push(i)}return{pre:t,post:n,normal:r}}var xk=[`black`,`red`,`green`,`yellow`,`blue`,`magenta`,`cyan`,`white`,`brightBlack`,`brightRed`,`brightGreen`,`brightYellow`,`brightBlue`,`brightMagenta`,`brightCyan`,`brightWhite`],Sk={1:`bold`,2:`dim`,3:`italic`,4:`underline`,7:`reverse`,8:`hidden`,9:`strikethrough`};function Ck(e,t){let n=e.indexOf(`\x1B`,t);if(n!==-1&&e[n+1]===`[`){let t=e.indexOf(`m`,n);if(t!==-1)return{sequence:e.substring(n+2,t).split(`;`),startPosition:n,position:t+1}}return{position:e.length}}function wk(e){let t=e.shift();if(t===`2`){let t=e.splice(0,3).map(e=>Number.parseInt(e));return t.length!==3||t.some(e=>Number.isNaN(e))?void 0:{type:`rgb`,rgb:t}}else if(t===`5`){let t=e.shift();if(t)return{type:`table`,index:Number(t)}}}function Tk(e){let t=[];for(;e.length>0;){let n=e.shift();if(!n)continue;let r=Number.parseInt(n);if(!Number.isNaN(r))if(r===0)t.push({type:`resetAll`});else if(r<=9)Sk[r]&&t.push({type:`setDecoration`,value:Sk[r]});else if(r<=29){let e=Sk[r-20];e&&(t.push({type:`resetDecoration`,value:e}),e===`dim`&&t.push({type:`resetDecoration`,value:`bold`}))}else if(r<=37)t.push({type:`setForegroundColor`,value:{type:`named`,name:xk[r-30]}});else if(r===38){let n=wk(e);n&&t.push({type:`setForegroundColor`,value:n})}else if(r===39)t.push({type:`resetForegroundColor`});else if(r<=47)t.push({type:`setBackgroundColor`,value:{type:`named`,name:xk[r-40]}});else if(r===48){let n=wk(e);n&&t.push({type:`setBackgroundColor`,value:n})}else r===49?t.push({type:`resetBackgroundColor`}):r===53?t.push({type:`setDecoration`,value:`overline`}):r===55?t.push({type:`resetDecoration`,value:`overline`}):r>=90&&r<=97?t.push({type:`setForegroundColor`,value:{type:`named`,name:xk[r-90+8]}}):r>=100&&r<=107&&t.push({type:`setBackgroundColor`,value:{type:`named`,name:xk[r-100+8]}})}return t}function Ek(){let e=null,t=null,n=new Set;return{parse(r){let i=[],a=0;do{let o=Ck(r,a),s=o.sequence?r.substring(a,o.startPosition):r.substring(a);if(s.length>0&&i.push({value:s,foreground:e,background:t,decorations:new Set(n)}),o.sequence){let r=Tk(o.sequence);for(let i of r)i.type===`resetAll`?(e=null,t=null,n.clear()):i.type===`resetForegroundColor`?e=null:i.type===`resetBackgroundColor`?t=null:i.type===`resetDecoration`&&n.delete(i.value);for(let i of r)i.type===`setForegroundColor`?e=i.value:i.type===`setBackgroundColor`?t=i.value:i.type===`setDecoration`&&n.add(i.value)}a=o.position}while(a<r.length);return i}}}var Dk={black:`#000000`,red:`#bb0000`,green:`#00bb00`,yellow:`#bbbb00`,blue:`#0000bb`,magenta:`#ff00ff`,cyan:`#00bbbb`,white:`#eeeeee`,brightBlack:`#555555`,brightRed:`#ff5555`,brightGreen:`#00ff00`,brightYellow:`#ffff55`,brightBlue:`#5555ff`,brightMagenta:`#ff55ff`,brightCyan:`#55ffff`,brightWhite:`#ffffff`};function Ok(e=Dk){function t(t){return e[t]}function n(e){return`#${e.map(e=>Math.max(0,Math.min(e,255)).toString(16).padStart(2,`0`)).join(``)}`}let r;function i(){if(r)return r;r=[];for(let e=0;e<xk.length;e++)r.push(t(xk[e]));let e=[0,95,135,175,215,255];for(let t=0;t<6;t++)for(let i=0;i<6;i++)for(let a=0;a<6;a++)r.push(n([e[t],e[i],e[a]]));let i=8;for(let e=0;e<24;e++,i+=10)r.push(n([i,i,i]));return r}function a(e){return i()[e]}function o(e){switch(e.type){case`named`:return t(e.name);case`rgb`:return n(e.rgb);case`table`:return a(e.index)}}return{value:o}}var kk={black:`#000000`,red:`#cd3131`,green:`#0DBC79`,yellow:`#E5E510`,blue:`#2472C8`,magenta:`#BC3FBC`,cyan:`#11A8CD`,white:`#E5E5E5`,brightBlack:`#666666`,brightRed:`#F14C4C`,brightGreen:`#23D18B`,brightYellow:`#F5F543`,brightBlue:`#3B8EEA`,brightMagenta:`#D670D6`,brightCyan:`#29B8DB`,brightWhite:`#FFFFFF`};function Ak(e,t,n){let r=WO(e,n),i=$O(t),a=Ok(Object.fromEntries(xk.map(t=>{let n=`terminal.ansi${t[0].toUpperCase()}${t.substring(1)}`;return[t,e.colors?.[n]||kk[t]]}))),o=Ek();return i.map(t=>o.parse(t[0]).map(n=>{let i,o;n.decorations.has(`reverse`)?(i=n.background?a.value(n.background):e.bg,o=n.foreground?a.value(n.foreground):e.fg):(i=n.foreground?a.value(n.foreground):e.fg,o=n.background?a.value(n.background):void 0),i=GO(i,r),o=GO(o,r),n.decorations.has(`dim`)&&(i=jk(i));let s=uE.None;return n.decorations.has(`bold`)&&(s|=uE.Bold),n.decorations.has(`italic`)&&(s|=uE.Italic),n.decorations.has(`underline`)&&(s|=uE.Underline),n.decorations.has(`strikethrough`)&&(s|=uE.Strikethrough),{content:n.value,offset:t[1],color:i,bgColor:o,fontStyle:s}}))}function jk(e){let t=e.match(/#([0-9a-f]{3})([0-9a-f]{3})?([0-9a-f]{2})?/i);if(t)if(t[3]){let e=Math.round(Number.parseInt(t[3],16)/2).toString(16).padStart(2,`0`);return`#${t[1]}${t[2]}${e}`}else if(t[2])return`#${t[1]}${t[2]}80`;else return`#${Array.from(t[1]).map(e=>`${e}${e}`).join(``)}80`;let n=e.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return n?`var(${n[1]}-dim)`:e}function Mk(e,t,n={}){let{lang:r=`text`,theme:i=e.getLoadedThemes()[0]}=n;if(JO(r)||XO(i))return $O(t).map(e=>[{content:e[0],offset:e[1]}]);let{theme:a,colorMap:o}=e.setTheme(i);if(r===`ansi`)return Ak(a,t,n);let s=e.getLanguage(r);if(n.grammarState){if(n.grammarState.lang!==s.name)throw new UT(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${s.name}"`);if(!n.grammarState.themes.includes(a.name))throw new UT(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${a.name}"`)}return Pk(t,s,a,o,n)}function Nk(...e){if(e.length===2)return dk(e[1]);let[t,n,r={}]=e,{lang:i=`text`,theme:a=t.getLoadedThemes()[0]}=r;if(JO(i)||XO(a))throw new UT(`Plain language does not have grammar state`);if(i===`ansi`)throw new UT(`ANSI language does not have grammar state`);let{theme:o,colorMap:s}=t.setTheme(a),c=t.getLanguage(i);return new fk(Fk(n,c,o,s,r).stateStack,c.name,o.name)}function Pk(e,t,n,r,i){let a=Fk(e,t,n,r,i),o=new fk(Fk(e,t,n,r,i).stateStack,t.name,n.name);return uk(a.tokens,o),a.tokens}function Fk(e,t,n,r,i){let a=WO(n,i),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:s=500}=i,c=$O(e),l=i.grammarState?mk(i.grammarState,n.name)??ED:i.grammarContextCode==null?ED:Fk(i.grammarContextCode,t,n,r,{...i,grammarState:void 0,grammarContextCode:void 0}).stateStack,u=[],d=[];for(let e=0,f=c.length;e<f;e++){let[f,p]=c[e];if(f===``){u=[],d.push([]);continue}if(o>0&&f.length>=o){u=[],d.push([{content:f,offset:p,color:``,fontStyle:0}]);continue}let m,h,g;i.includeExplanation&&(m=t.tokenizeLine(f,l,s),h=m.tokens,g=0);let _=t.tokenizeLine2(f,l,s),v=_.tokens.length/2;for(let e=0;e<v;e++){let t=_.tokens[2*e],o=e+1<v?_.tokens[2*e+2]:f.length;if(t===o)continue;let s=_.tokens[2*e+1],c=GO(r[gE.getForeground(s)],a),l=gE.getFontStyle(s),d={content:f.substring(t,o),offset:p+t,color:c,fontStyle:l};if(i.includeExplanation){let e=[];if(i.includeExplanation!==`scopeName`)for(let t of n.settings){let n;switch(typeof t.scope){case`string`:n=t.scope.split(/,/).map(e=>e.trim());break;case`object`:n=t.scope;break;default:continue}e.push({settings:t,selectors:n.map(e=>e.split(/ /))})}d.explanation=[];let r=0;for(;t+r<o;){let t=h[g],n=f.substring(t.startIndex,t.endIndex);r+=n.length,d.explanation.push({content:n,scopes:i.includeExplanation===`scopeName`?Ik(t.scopes):Lk(e,t.scopes)}),g+=1}}u.push(d)}d.push(u),u=[],l=_.ruleStack}return{tokens:d,stateStack:l}}function Ik(e){return e.map(e=>({scopeName:e}))}function Lk(e,t){let n=[];for(let r=0,i=t.length;r<i;r++){let i=t[r];n[r]={scopeName:i,themeMatches:Bk(e,i,t.slice(0,r))}}return n}function Rk(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]===`.`}function zk(e,t,n){if(!Rk(e[e.length-1],t))return!1;let r=e.length-2,i=n.length-1;for(;r>=0&&i>=0;)Rk(e[r],n[i])&&--r,--i;return r===-1}function Bk(e,t,n){let r=[];for(let{selectors:i,settings:a}of e)for(let e of i)if(zk(e,t,n)){r.push(a);break}return r}function Vk(e,t,n){let r=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})),i=r.map(r=>{let i=Mk(e,t,{...n,theme:r.theme});return{tokens:i,state:dk(i),theme:typeof r.theme==`string`?r.theme:r.theme.name}}),a=Hk(...i.map(e=>e.tokens)),o=a[0].map((e,t)=>e.map((e,i)=>{let o={content:e.content,variants:{},offset:e.offset};return`includeExplanation`in n&&n.includeExplanation&&(o.explanation=e.explanation),a.forEach((e,n)=>{let{content:a,explanation:s,offset:c,...l}=e[t][i];o.variants[r[n].color]=l}),o})),s=i[0].state?new fk(Object.fromEntries(i.map(e=>[e.theme,e.state?.getInternalStack(e.theme)])),i[0].state.lang):void 0;return s&&uk(o,s),o}function Hk(...e){let t=e.map(()=>[]),n=e.length;for(let r=0;r<e[0].length;r++){let i=e.map(e=>e[r]),a=t.map(()=>[]);t.forEach((e,t)=>e.push(a[t]));let o=i.map(()=>0),s=i.map(e=>e[0]);for(;s.every(e=>e);){let e=Math.min(...s.map(e=>e.content.length));for(let t=0;t<n;t++){let n=s[t];n.content.length===e?(a[t].push(n),o[t]+=1,s[t]=i[t][o[t]]):(a[t].push({...n,content:n.content.slice(0,e)}),s[t]={...n,content:n.content.slice(e),offset:n.offset+e})}}}return t}function Uk(e,t,n){let r,i,a,o,s,c;if(`themes`in n){let{defaultColor:l=`light`,cssVariablePrefix:u=`--shiki-`,colorsRendering:d=`css-vars`}=n,f=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})).sort((e,t)=>e.color===l?-1:+(t.color===l));if(f.length===0)throw new UT("`themes` option must not be empty");let p=Vk(e,t,n);if(c=dk(p),l&&nk!==l&&!f.find(e=>e.color===l))throw new UT(`\`themes\` option must contain the defaultColor key \`${l}\``);let m=f.map(t=>e.getTheme(t.theme)),h=f.map(e=>e.color);a=p.map(e=>e.map(e=>ok(e,h,u,l,d))),c&&uk(a,c);let g=f.map(e=>WO(e.theme,n));i=Wk(f,m,g,u,l,`fg`,d),r=Wk(f,m,g,u,l,`bg`,d),o=`shiki-themes ${m.map(e=>e.name).join(` `)}`,s=l?void 0:[i,r].join(`;`)}else if(`theme`in n){let s=WO(n.theme,n);a=Mk(e,t,n);let l=e.getTheme(n.theme);r=GO(l.bg,s),i=GO(l.fg,s),o=l.name,c=dk(a)}else throw new UT("Invalid options, either `theme` or `themes` must be provided");return{tokens:a,fg:i,bg:r,themeName:o,rootStyle:s,grammarState:c}}function Wk(e,t,n,r,i,a,o){return e.map((s,c)=>{let l=GO(t[c][a],n[c])||`inherit`,u=`${r+s.color}${a===`bg`?`-bg`:``}:${l}`;if(c===0&&i){if(i===nk&&e.length>1){let r=e.findIndex(e=>e.color===`light`),i=e.findIndex(e=>e.color===`dark`);if(r===-1||i===-1)throw new UT('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');return`light-dark(${GO(t[r][a],n[r])||`inherit`}, ${GO(t[i][a],n[i])||`inherit`});${u}`}return l}return o===`css-vars`?u:null}).filter(e=>!!e).join(`;`)}function Gk(e,t,n,r={meta:{},options:n,codeToHast:(t,n)=>Gk(e,t,n),codeToTokens:(t,n)=>Uk(e,t,n)}){let i=t;for(let e of yk(n))i=e.preprocess?.call(r,i,n)||i;let{tokens:a,fg:o,bg:s,themeName:c,rootStyle:l,grammarState:u}=Uk(e,i,n),{mergeWhitespaces:d=!0,mergeSameStyleTokens:f=!1}=n;d===!0?a=qk(a):d===`never`&&(a=Jk(a)),f&&(a=Yk(a));let p={...r,get source(){return i}};for(let e of yk(n))a=e.tokens?.call(p,a)||a;return Kk(a,{...n,fg:o,bg:s,themeName:c,rootStyle:l},p,u)}function Kk(e,t,n,r=dk(e)){let i=yk(t),a=[],o={type:`root`,children:[]},{structure:s=`classic`,tabindex:c=`0`}=t,l={type:`element`,tagName:`pre`,properties:{class:`shiki ${t.themeName||``}`,style:t.rootStyle||`background-color:${t.bg};color:${t.fg}`,...c!==!1&&c!=null?{tabindex:c.toString()}:{},...Object.fromEntries(Array.from(Object.entries(t.meta||{})).filter(([e])=>!e.startsWith(`_`)))},children:[]},u={type:`element`,tagName:`code`,properties:{},children:a},d=[],f={...n,structure:s,addClassToHast:QO,get source(){return n.source},get tokens(){return e},get options(){return t},get root(){return o},get pre(){return l},get code(){return u},get lines(){return d}};if(e.forEach((e,t)=>{t&&(s===`inline`?o.children.push({type:`element`,tagName:`br`,properties:{},children:[]}):s===`classic`&&a.push({type:`text`,value:`
|
|
65
|
+
`}));let n={type:`element`,tagName:`span`,properties:{class:`line`},children:[]},r=0;for(let a of e){let e={type:`element`,tagName:`span`,properties:{...a.htmlAttrs},children:[{type:`text`,value:a.content}]},c=ck(a.htmlStyle||sk(a));c&&(e.properties.style=c);for(let o of i)e=o?.span?.call(f,e,t+1,r,n,a)||e;s===`inline`?o.children.push(e):s===`classic`&&n.children.push(e),r+=a.content.length}if(s===`classic`){for(let e of i)n=e?.line?.call(f,n,t+1)||n;d.push(n),a.push(n)}}),s===`classic`){for(let e of i)u=e?.code?.call(f,u)||u;l.children.push(u);for(let e of i)l=e?.pre?.call(f,l)||l;o.children.push(l)}let p=o;for(let e of i)p=e?.root?.call(f,p)||p;return r&&uk(p,r),p}function qk(e){return e.map(e=>{let t=[],n=``,r=0;return e.forEach((i,a)=>{let o=!(i.fontStyle&&(i.fontStyle&uE.Underline||i.fontStyle&uE.Strikethrough));o&&i.content.match(/^\s+$/)&&e[a+1]?(r||=i.offset,n+=i.content):n?(o?t.push({...i,offset:r,content:n+i.content}):t.push({content:n,offset:r},i),r=0,n=``):t.push(i)}),t})}function Jk(e){return e.map(e=>e.flatMap(e=>{if(e.content.match(/^\s+$/))return e;let t=e.content.match(/^(\s*)(.*?)(\s*)$/);if(!t)return e;let[,n,r,i]=t;if(!n&&!i)return e;let a=[{...e,offset:e.offset+n.length,content:r}];return n&&a.unshift({content:n,offset:e.offset}),i&&a.push({content:i,offset:e.offset+n.length+r.length}),a}))}function Yk(e){return e.map(e=>{let t=[];for(let n of e){if(t.length===0){t.push({...n});continue}let e=t[t.length-1],r=ck(e.htmlStyle||sk(e)),i=ck(n.htmlStyle||sk(n)),a=e.fontStyle&&(e.fontStyle&uE.Underline||e.fontStyle&uE.Strikethrough),o=n.fontStyle&&(n.fontStyle&uE.Underline||n.fontStyle&uE.Strikethrough);!a&&!o&&r===i?e.content+=n.content:t.push({...n})}return t})}var Xk=VO;function Zk(e,t,n){let r={meta:{},options:n,codeToHast:(t,n)=>Gk(e,t,n),codeToTokens:(t,n)=>Uk(e,t,n)},i=Xk(Gk(e,t,n,r));for(let e of yk(n))i=e.postprocess?.call(r,i,n)||i;return i}var Qk={light:`#333333`,dark:`#bbbbbb`},$k={light:`#fffffe`,dark:`#1e1e1e`},eA=`__shiki_resolved`;function tA(e){if(e?.[eA])return e;let t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||=`dark`,t.colorReplacements={...t.colorReplacements},t.settings||=[];let{bg:n,fg:r}=t;if(!n||!r){let e=t.settings?t.settings.find(e=>!e.name&&!e.scope):void 0;e?.settings?.foreground&&(r=e.settings.foreground),e?.settings?.background&&(n=e.settings.background),!r&&t?.colors?.[`editor.foreground`]&&(r=t.colors[`editor.foreground`]),!n&&t?.colors?.[`editor.background`]&&(n=t.colors[`editor.background`]),r||=t.type===`light`?Qk.light:Qk.dark,n||=t.type===`light`?$k.light:$k.dark,t.fg=r,t.bg=n}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let i=0,a=new Map;function o(e){if(a.has(e))return a.get(e);i+=1;let n=`#${i.toString(16).padStart(8,`0`).toLowerCase()}`;return t.colorReplacements?.[`#${n}`]?o(e):(a.set(e,n),n)}t.settings=t.settings.map(e=>{let n=e.settings?.foreground&&!e.settings.foreground.startsWith(`#`),r=e.settings?.background&&!e.settings.background.startsWith(`#`);if(!n&&!r)return e;let i={...e,settings:{...e.settings}};if(n){let n=o(e.settings.foreground);t.colorReplacements[n]=e.settings.foreground,i.settings.foreground=n}if(r){let n=o(e.settings.background);t.colorReplacements[n]=e.settings.background,i.settings.background=n}return i});for(let e of Object.keys(t.colors||{}))if((e===`editor.foreground`||e===`editor.background`||e.startsWith(`terminal.ansi`))&&!t.colors[e]?.startsWith(`#`)){let n=o(t.colors[e]);t.colorReplacements[n]=t.colors[e],t.colors[e]=n}return Object.defineProperty(t,eA,{enumerable:!1,writable:!1,value:!0}),t}async function nA(e){return Array.from(new Set((await Promise.all(e.filter(e=>!YO(e)).map(async e=>await qO(e).then(e=>Array.isArray(e)?e:[e])))).flat()))}async function rA(e){return(await Promise.all(e.map(async e=>ZO(e)?null:tA(await qO(e))))).filter(e=>!!e)}var iA=3,aA=!1;function oA(e,t=3){if(iA&&!(typeof iA==`number`&&t>iA)){if(aA)throw Error(`[SHIKI DEPRECATE]: ${e}`);console.trace(`[SHIKI DEPRECATE]: ${e}`)}}var sA=class extends Error{constructor(e){super(e),this.name=`ShikiError`}},cA=class extends TD{constructor(e,t,n,r={}){super(e),this._resolver=e,this._themes=t,this._langs=n,this._alias=r,this._themes.map(e=>this.loadTheme(e)),this.loadLanguages(this._langs)}_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;getTheme(e){return typeof e==`string`?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){let t=tA(e);return t.name&&(this._resolvedThemes.set(t.name,t),this._loadedThemesCache=null),t}getLoadedThemes(){return this._loadedThemesCache||=[...this._resolvedThemes.keys()],this._loadedThemesCache}setTheme(e){let t=this._textmateThemeCache.get(e);t||(t=rE.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){if(this._alias[e]){let t=new Set([e]);for(;this._alias[e];){if(e=this._alias[e],t.has(e))throw new sA(`Circular alias \`${Array.from(t).join(` -> `)} -> ${e}\``);t.add(e)}}return this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;let t=new Set([...this._langMap.values()].filter(t=>t.embeddedLangsLazy?.includes(e.name)));this._resolver.addLanguage(e);let n={balancedBracketSelectors:e.balancedBracketSelectors||[`*`],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);let r=this.loadGrammarWithConfiguration(e.scopeName,1,n);if(r.name=e.name,this._resolvedGrammars.set(e.name,r),e.aliases&&e.aliases.forEach(t=>{this._alias[t]=e.name}),this._loadedLanguagesCache=null,t.size)for(let e of t)this._resolvedGrammars.delete(e.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(e.scopeName),this._syncRegistry?._grammars?.delete(e.scopeName),this.loadLanguage(this._langMap.get(e.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(let t of e)this.resolveEmbeddedLanguages(t);let t=Array.from(this._langGraph.entries()),n=t.filter(([e,t])=>!t);if(n.length){let e=t.filter(([e,t])=>t&&t.embeddedLangs?.some(e=>n.map(([e])=>e).includes(e))).filter(e=>!n.includes(e));throw new sA(`Missing languages ${n.map(([e])=>`\`${e}\``).join(`, `)}, required by ${e.map(([e])=>`\`${e}\``).join(`, `)}`)}for(let[e,n]of t)this._resolver.addLanguage(n);for(let[e,n]of t)this.loadLanguage(n)}getLoadedLanguages(){return this._loadedLanguagesCache||=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])],this._loadedLanguagesCache}resolveEmbeddedLanguages(e){if(this._langMap.set(e.name,e),this._langGraph.set(e.name,e),e.embeddedLangs)for(let t of e.embeddedLangs)this._langGraph.set(t,this._langMap.get(t))}},lA=class{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(e,t){this._onigLib={createOnigScanner:t=>e.createScanner(t),createOnigString:t=>e.createString(t)},t.forEach(e=>this.addLanguage(e))}get onigLib(){return this._onigLib}getLangRegistration(e){return this._langs.get(e)}loadGrammar(e){return this._scopeToLang.get(e)}addLanguage(e){this._langs.set(e.name,e),e.aliases&&e.aliases.forEach(t=>{this._langs.set(t,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(t=>{this._injections.get(t)||this._injections.set(t,[]),this._injections.get(t).push(e.scopeName)})}getInjections(e){let t=e.split(`.`),n=[];for(let e=1;e<=t.length;e++){let r=t.slice(0,e).join(`.`);n=[...n,...this._injections.get(r)||[]]}return n}},uA=0;function dA(e){uA+=1,e.warnings!==!1&&uA>=10&&uA%10==0&&console.warn(`[Shiki] ${uA} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let t=!1;if(!e.engine)throw new sA("`engine` option is required for synchronous mode");let n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(tA),i=new cA(new lA(e.engine,n),r,n,e.langAlias),a;function o(e){h();let t=i.getGrammar(typeof e==`string`?e:e.name);if(!t)throw new sA(`Language \`${e}\` not found, you may need to load it first`);return t}function s(e){if(e===`none`)return{bg:``,fg:``,name:`none`,settings:[],type:`dark`};h();let t=i.getTheme(e);if(!t)throw new sA(`Theme \`${e}\` not found, you may need to load it first`);return t}function c(e){h();let t=s(e);return a!==e&&(i.setTheme(t),a=e),{theme:t,colorMap:i.getColorMap()}}function l(){return h(),i.getLoadedThemes()}function u(){return h(),i.getLoadedLanguages()}function d(...e){h(),i.loadLanguages(e.flat(1))}async function f(...e){return d(await nA(e))}function p(...e){h();for(let t of e.flat(1))i.loadTheme(t)}async function m(...e){return h(),p(await rA(e))}function h(){if(t)throw new sA(`Shiki instance has been disposed`)}function g(){t||(t=!0,i.dispose(),--uA)}return{setTheme:c,getTheme:s,getLanguage:o,getLoadedThemes:l,getLoadedLanguages:u,loadLanguage:f,loadLanguageSync:d,loadTheme:m,loadThemeSync:p,dispose:g,[Symbol.dispose]:g}}async function fA(e){e.engine||oA("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");let[t,n,r]=await Promise.all([rA(e.themes||[]),nA(e.langs||[]),e.engine]);return dA({...e,themes:t,langs:n,engine:r})}async function pA(e){let t=await fA(e);return{getLastGrammarState:(...e)=>Nk(t,...e),codeToTokensBase:(e,n)=>Mk(t,e,n),codeToTokensWithThemes:(e,n)=>Vk(t,e,n),codeToTokens:(e,n)=>Uk(t,e,n),codeToHast:(e,n)=>Gk(t,e,n),codeToHtml:(e,n)=>Zk(t,e,n),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}function mA(e){let t=e.langs,n=e.themes,r=e.engine;async function i(e){function i(n){if(typeof n==`string`){if(YO(n))return[];n=e.langAlias?.[n]||n;let r=t[n];if(!r)throw new UT(`Language \`${n}\` is not included in this bundle. You may want to load it from external source.`);return r}return n}function a(e){if(ZO(e))return`none`;if(typeof e==`string`){let t=n[e];if(!t)throw new UT(`Theme \`${e}\` is not included in this bundle. You may want to load it from external source.`);return t}return e}let o=(e.themes??[]).map(e=>a(e)),s=(e.langs??[]).map(e=>i(e)),c=await pA({engine:e.engine??r(),...e,themes:o,langs:s});return{...c,loadLanguage(...e){return c.loadLanguage(...e.map(i))},loadTheme(...e){return c.loadTheme(...e.map(a))},getBundledLanguages(){return t},getBundledThemes(){return n}}}return i}function hA(e){let t;async function n(n={}){if(t){let e=await t;return await Promise.all([e.loadTheme(...n.themes||[]),e.loadLanguage(...n.langs||[])]),e}else{t=e({...n,themes:[],langs:[]});let r=await t;return await Promise.all([r.loadTheme(...n.themes||[]),r.loadLanguage(...n.langs||[])]),r}}return n}function gA(e,t){let n=hA(e);async function r(e,r){let i=await n({langs:[r.lang],themes:`theme`in r?[r.theme]:Object.values(r.themes)}),a=await t?.guessEmbeddedLanguages?.(e,r.lang,i);return a&&await i.loadLanguage(...a),i}return{getSingletonHighlighter(e){return n(e)},async codeToHtml(e,t){return(await r(e,t)).codeToHtml(e,t)},async codeToHast(e,t){return(await r(e,t)).codeToHast(e,t)},async codeToTokens(e,t){return(await r(e,t)).codeToTokens(e,t)},async codeToTokensBase(e,t){return(await r(e,t)).codeToTokensBase(e,t)},async codeToTokensWithThemes(e,t){return(await r(e,t)).codeToTokensWithThemes(e,t)},async getLastGrammarState(e,t){return(await n({langs:[t.lang],themes:[t.theme]})).getLastGrammarState(e,t)}}}var _A=[{id:`abap`,name:`ABAP`,import:(()=>H(()=>import(`./abap-CLvhMVsD.js`),[]))},{id:`actionscript-3`,name:`ActionScript`,import:(()=>H(()=>import(`./actionscript-3-CzQY2Bug.js`),[]))},{id:`ada`,name:`Ada`,import:(()=>H(()=>import(`./ada-C5qYipkI.js`),[]))},{id:`angular-html`,name:`Angular HTML`,import:(()=>H(()=>import(`./angular-html-HOxwNvyT.js`).then(e=>e.n),__vite__mapDeps([5,1,6,7,8])))},{id:`angular-ts`,name:`Angular TypeScript`,import:(()=>H(()=>import(`./angular-ts-Ov9R9Ljq.js`),__vite__mapDeps([9,5,1,6,7,8,10])))},{id:`apache`,name:`Apache Conf`,import:(()=>H(()=>import(`./apache-U0d_L8uA.js`),[]))},{id:`apex`,name:`Apex`,import:(()=>H(()=>import(`./apex-BNbugBKF.js`),[]))},{id:`apl`,name:`APL`,import:(()=>H(()=>import(`./apl-CXOUvgw5.js`),__vite__mapDeps([11,7,1,6,8,12,13,14])))},{id:`applescript`,name:`AppleScript`,import:(()=>H(()=>import(`./applescript-CCn79oCD.js`),[]))},{id:`ara`,name:`Ara`,import:(()=>H(()=>import(`./ara-4CJ0cIlV.js`),[]))},{id:`asciidoc`,name:`AsciiDoc`,aliases:[`adoc`],import:(()=>H(()=>import(`./asciidoc-CmcyU4-6.js`),[]))},{id:`asm`,name:`Assembly`,import:(()=>H(()=>import(`./asm-Cmm7eHzH.js`),[]))},{id:`astro`,name:`Astro`,import:(()=>H(()=>import(`./astro-CVgXjgWt.js`),__vite__mapDeps([15,7,1,8,12,16,17,18])))},{id:`awk`,name:`AWK`,import:(()=>H(()=>import(`./awk-BWXHIvNe.js`),[]))},{id:`ballerina`,name:`Ballerina`,import:(()=>H(()=>import(`./ballerina-B7ZEbQpA.js`),[]))},{id:`bat`,name:`Batch File`,aliases:[`batch`],import:(()=>H(()=>import(`./bat-Bo4NYOV-.js`),[]))},{id:`beancount`,name:`Beancount`,import:(()=>H(()=>import(`./beancount-D-usSTwE.js`),[]))},{id:`berry`,name:`Berry`,aliases:[`be`],import:(()=>H(()=>import(`./berry-jid5E5RX.js`),[]))},{id:`bibtex`,name:`BibTeX`,import:(()=>H(()=>import(`./bibtex-Ci_nEsc7.js`),[]))},{id:`bicep`,name:`Bicep`,import:(()=>H(()=>import(`./bicep-CUHmPFLl.js`),[]))},{id:`blade`,name:`Blade`,import:(()=>H(()=>import(`./blade-BoqMnz_b.js`),__vite__mapDeps([19,7,1,20,6,8,12,21,13,14])))},{id:`bsl`,name:`1C (Enterprise)`,aliases:[`1c`],import:(()=>H(()=>import(`./bsl-BkkzgIyY.js`),__vite__mapDeps([22,23])))},{id:`c`,name:`C`,import:(()=>H(()=>import(`./c-DOayRvVf.js`).then(e=>e.n),__vite__mapDeps([24,1])))},{id:`cadence`,name:`Cadence`,aliases:[`cdc`],import:(()=>H(()=>import(`./cadence-CQ2zXKGN.js`),[]))},{id:`cairo`,name:`Cairo`,import:(()=>H(()=>import(`./cairo-DLTphjLi.js`),__vite__mapDeps([25,26])))},{id:`clarity`,name:`Clarity`,import:(()=>H(()=>import(`./clarity-SemFz856.js`),[]))},{id:`clojure`,name:`Clojure`,aliases:[`clj`],import:(()=>H(()=>import(`./clojure-DqKBuwfJ.js`),[]))},{id:`cmake`,name:`CMake`,import:(()=>H(()=>import(`./cmake-Bj61d0ZC.js`),[]))},{id:`cobol`,name:`COBOL`,import:(()=>H(()=>import(`./cobol-Xel1q7J4.js`),__vite__mapDeps([27,6,1,7,8,14])))},{id:`codeowners`,name:`CODEOWNERS`,import:(()=>H(()=>import(`./codeowners-C8r90Shi.js`),[]))},{id:`codeql`,name:`CodeQL`,aliases:[`ql`],import:(()=>H(()=>import(`./codeql-oeQT6MSM.js`),[]))},{id:`coffee`,name:`CoffeeScript`,aliases:[`coffeescript`],import:(()=>H(()=>import(`./coffee-CPGd8RFL.js`),__vite__mapDeps([28,8,1])))},{id:`common-lisp`,name:`Common Lisp`,aliases:[`lisp`],import:(()=>H(()=>import(`./common-lisp-Cv5bFMCO.js`),[]))},{id:`coq`,name:`Coq`,import:(()=>H(()=>import(`./coq-BrsZFFmf.js`),[]))},{id:`cpp`,name:`C++`,aliases:[`c++`],import:(()=>H(()=>import(`./cpp-DcSExVLf.js`).then(e=>e.n),__vite__mapDeps([29,1,30,24,31,21])))},{id:`crystal`,name:`Crystal`,import:(()=>H(()=>import(`./crystal-DSuicNBl.js`),__vite__mapDeps([32,24,1,7,6,8,33,21])))},{id:`csharp`,name:`C#`,aliases:[`c#`,`cs`],import:(()=>H(()=>import(`./csharp-BEKXm5hI.js`),[]))},{id:`css`,name:`CSS`,import:(()=>H(()=>import(`./css-DoNhQY6j.js`).then(e=>e.n),__vite__mapDeps([7,1])))},{id:`csv`,name:`CSV`,import:(()=>H(()=>import(`./csv-Dx-8-gkx.js`),[]))},{id:`cue`,name:`CUE`,import:(()=>H(()=>import(`./cue-CE9AQfxI.js`),[]))},{id:`cypher`,name:`Cypher`,aliases:[`cql`],import:(()=>H(()=>import(`./cypher-ClKdZ_lG.js`),[]))},{id:`d`,name:`D`,import:(()=>H(()=>import(`./d-qD-0Kul2.js`),[]))},{id:`dart`,name:`Dart`,import:(()=>H(()=>import(`./dart-DkHntEIa.js`),[]))},{id:`dax`,name:`DAX`,import:(()=>H(()=>import(`./dax-BkyTk9wS.js`),[]))},{id:`desktop`,name:`Desktop`,import:(()=>H(()=>import(`./desktop-Dlh5hvp9.js`),[]))},{id:`diff`,name:`Diff`,import:(()=>H(()=>import(`./diff-woXpYk--.js`),[]))},{id:`docker`,name:`Dockerfile`,aliases:[`dockerfile`],import:(()=>H(()=>import(`./docker-IyjqRm3v.js`),[]))},{id:`dotenv`,name:`dotEnv`,import:(()=>H(()=>import(`./dotenv-_5a1GRtc.js`),[]))},{id:`dream-maker`,name:`Dream Maker`,import:(()=>H(()=>import(`./dream-maker-DW3nJb8Q.js`),[]))},{id:`edge`,name:`Edge`,import:(()=>H(()=>import(`./edge-193c5yJY.js`),__vite__mapDeps([34,20,1,6,7,8,18])))},{id:`elixir`,name:`Elixir`,import:(()=>H(()=>import(`./elixir-ND4M129Z.js`),__vite__mapDeps([35,6,1,7,8])))},{id:`elm`,name:`Elm`,import:(()=>H(()=>import(`./elm-2Xpf1qa1.js`),__vite__mapDeps([36,30,1,24])))},{id:`emacs-lisp`,name:`Emacs Lisp`,aliases:[`elisp`],import:(()=>H(()=>import(`./emacs-lisp-C9PiwqqW.js`),[]))},{id:`erb`,name:`ERB`,import:(()=>H(()=>import(`./erb-B3CzWkDu.js`),__vite__mapDeps([37,6,1,7,8,38,24,29,30,31,21,39,40,17,18,41,42,33,13,14,43])))},{id:`erlang`,name:`Erlang`,aliases:[`erl`],import:(()=>H(()=>import(`./erlang-Cphh6RMH.js`),__vite__mapDeps([44,45])))},{id:`fennel`,name:`Fennel`,import:(()=>H(()=>import(`./fennel-DQxkIbk2.js`),[]))},{id:`fish`,name:`Fish`,import:(()=>H(()=>import(`./fish-BJitypiv.js`),[]))},{id:`fluent`,name:`Fluent`,aliases:[`ftl`],import:(()=>H(()=>import(`./fluent-C03EYrpw.js`),[]))},{id:`fortran-fixed-form`,name:`Fortran (Fixed Form)`,aliases:[`f`,`for`,`f77`],import:(()=>H(()=>import(`./fortran-fixed-form-BJLMMyj_.js`),__vite__mapDeps([46,47])))},{id:`fortran-free-form`,name:`Fortran (Free Form)`,aliases:[`f90`,`f95`,`f03`,`f08`,`f18`],import:(()=>H(()=>import(`./fortran-free-form-B3N2jM_P.js`),[]))},{id:`fsharp`,name:`F#`,aliases:[`f#`,`fs`],import:(()=>H(()=>import(`./fsharp-D13ZGOAj.js`),__vite__mapDeps([48,45])))},{id:`gdresource`,name:`GDResource`,import:(()=>H(()=>import(`./gdresource-DJtKbqXX.js`),__vite__mapDeps([49,50,51])))},{id:`gdscript`,name:`GDScript`,import:(()=>H(()=>import(`./gdscript-CtYHxktr.js`),[]))},{id:`gdshader`,name:`GDShader`,import:(()=>H(()=>import(`./gdshader-CBce3t8t.js`),[]))},{id:`genie`,name:`Genie`,import:(()=>H(()=>import(`./genie-CV2tkWYe.js`),[]))},{id:`gherkin`,name:`Gherkin`,import:(()=>H(()=>import(`./gherkin-DExj1W_8.js`),[]))},{id:`git-commit`,name:`Git Commit Message`,import:(()=>H(()=>import(`./git-commit-BSykSTBG.js`),__vite__mapDeps([52,53])))},{id:`git-rebase`,name:`Git Rebase Message`,import:(()=>H(()=>import(`./git-rebase-CPlAfnUu.js`),__vite__mapDeps([54,33,1])))},{id:`gleam`,name:`Gleam`,import:(()=>H(()=>import(`./gleam-CSRkHgEL.js`),[]))},{id:`glimmer-js`,name:`Glimmer JS`,aliases:[`gjs`],import:(()=>H(()=>import(`./glimmer-js-CxAZE7iu.js`),__vite__mapDeps([55,7,1,6,8,18])))},{id:`glimmer-ts`,name:`Glimmer TS`,aliases:[`gts`],import:(()=>H(()=>import(`./glimmer-ts-CNJweuJS.js`),__vite__mapDeps([56,7,1,6,8,18])))},{id:`glsl`,name:`GLSL`,import:(()=>H(()=>import(`./glsl-CDvScVSv.js`).then(e=>e.n),__vite__mapDeps([30,1,24])))},{id:`gnuplot`,name:`Gnuplot`,import:(()=>H(()=>import(`./gnuplot-7GGW24-e.js`),[]))},{id:`go`,name:`Go`,import:(()=>H(()=>import(`./go-DNk2CfY5.js`),[]))},{id:`graphql`,name:`GraphQL`,aliases:[`gql`],import:(()=>H(()=>import(`./graphql-CLdnI2jj.js`).then(e=>e.n),__vite__mapDeps([39,1,8,40,17,18])))},{id:`groovy`,name:`Groovy`,import:(()=>H(()=>import(`./groovy-CacY0gHj.js`),[]))},{id:`hack`,name:`Hack`,import:(()=>H(()=>import(`./hack-U_u3qiXF.js`),__vite__mapDeps([57,6,1,7,8,21])))},{id:`haml`,name:`Ruby Haml`,import:(()=>H(()=>import(`./haml-B_7gR2-C.js`).then(e=>e.n),__vite__mapDeps([41,1,7,8])))},{id:`handlebars`,name:`Handlebars`,aliases:[`hbs`],import:(()=>H(()=>import(`./handlebars-CIGlWSZz.js`),__vite__mapDeps([58,7,1,6,8,43])))},{id:`haskell`,name:`Haskell`,aliases:[`hs`],import:(()=>H(()=>import(`./haskell-D8IpX4py.js`),[]))},{id:`haxe`,name:`Haxe`,import:(()=>H(()=>import(`./haxe-OTjmBuCE.js`),[]))},{id:`hcl`,name:`HashiCorp HCL`,import:(()=>H(()=>import(`./hcl-Dh228itO.js`),[]))},{id:`hjson`,name:`Hjson`,import:(()=>H(()=>import(`./hjson-CxZEssPk.js`),[]))},{id:`hlsl`,name:`HLSL`,import:(()=>H(()=>import(`./hlsl-Cvrh5tZx.js`),[]))},{id:`html`,name:`HTML`,import:(()=>H(()=>import(`./html-B2jixUwZ.js`).then(e=>e.n),__vite__mapDeps([6,1,7,8])))},{id:`html-derivative`,name:`HTML (Derivative)`,import:(()=>H(()=>import(`./html-derivative-DDwnamny.js`).then(e=>e.n),__vite__mapDeps([20,1,6,7,8])))},{id:`http`,name:`HTTP`,import:(()=>H(()=>import(`./http-BEmBIeh2.js`),__vite__mapDeps([59,39,1,8,40,17,18,12,33,13,14])))},{id:`hurl`,name:`Hurl`,import:(()=>H(()=>import(`./hurl-BoVPi727.js`),__vite__mapDeps([60,61,39,1,8,40,17,18,13,14])))},{id:`hxml`,name:`HXML`,import:(()=>H(()=>import(`./hxml-B0Qn7Nwc.js`),__vite__mapDeps([62,63])))},{id:`hy`,name:`Hy`,import:(()=>H(()=>import(`./hy-CZbG8q4J.js`),[]))},{id:`imba`,name:`Imba`,import:(()=>H(()=>import(`./imba-DsUTQ-LC.js`),[]))},{id:`ini`,name:`INI`,aliases:[`properties`],import:(()=>H(()=>import(`./ini-B5eOa1yu.js`),[]))},{id:`java`,name:`Java`,import:(()=>H(()=>import(`./java-DUjKRM5T.js`).then(e=>e.n),__vite__mapDeps([14,1])))},{id:`javascript`,name:`JavaScript`,aliases:[`js`,`cjs`,`mjs`],import:(()=>H(()=>import(`./javascript-B0z-AXw4.js`).then(e=>e.n),__vite__mapDeps([8,1])))},{id:`jinja`,name:`Jinja`,import:(()=>H(()=>import(`./jinja-DHg7q1DE.js`),__vite__mapDeps([64,6,1,7,8])))},{id:`jison`,name:`Jison`,import:(()=>H(()=>import(`./jison-Bi4c9iNP.js`),__vite__mapDeps([65,8,1])))},{id:`json`,name:`JSON`,import:(()=>H(()=>import(`./json-DXfqaPEF.js`).then(e=>e.n),__vite__mapDeps([12,1])))},{id:`json5`,name:`JSON5`,import:(()=>H(()=>import(`./json5-BR5RXkoi.js`),[]))},{id:`jsonc`,name:`JSON with Comments`,import:(()=>H(()=>import(`./jsonc-CYpm1nAK.js`),[]))},{id:`jsonl`,name:`JSON Lines`,import:(()=>H(()=>import(`./jsonl-CmCQp5Yx.js`),[]))},{id:`jsonnet`,name:`Jsonnet`,import:(()=>H(()=>import(`./jsonnet-CJTPZ8u_.js`),[]))},{id:`jssm`,name:`JSSM`,aliases:[`fsl`],import:(()=>H(()=>import(`./jssm-DXw9l8Rf.js`),[]))},{id:`jsx`,name:`JSX`,import:(()=>H(()=>import(`./jsx-xIBTuBAZ.js`).then(e=>e.n),__vite__mapDeps([40,1])))},{id:`julia`,name:`Julia`,aliases:[`jl`],import:(()=>H(()=>import(`./julia-w0S0kN7z.js`),__vite__mapDeps([66,29,1,30,24,31,21,8,26,67])))},{id:`kdl`,name:`KDL`,import:(()=>H(()=>import(`./kdl-CsD5j6eV.js`),[]))},{id:`kotlin`,name:`Kotlin`,aliases:[`kt`,`kts`],import:(()=>H(()=>import(`./kotlin-DhhofPvG.js`),[]))},{id:`kusto`,name:`Kusto`,aliases:[`kql`],import:(()=>H(()=>import(`./kusto-DZOoy8cc.js`),[]))},{id:`latex`,name:`LaTeX`,import:(()=>H(()=>import(`./latex-ed26ywxS.js`),__vite__mapDeps([68,69,67,1])))},{id:`lean`,name:`Lean 4`,aliases:[`lean4`],import:(()=>H(()=>import(`./lean-CRnrS228.js`),[]))},{id:`less`,name:`Less`,import:(()=>H(()=>import(`./less-DVTAwKKz.js`),[]))},{id:`liquid`,name:`Liquid`,import:(()=>H(()=>import(`./liquid-CAruNf-N.js`),__vite__mapDeps([70,7,1,6,8,12])))},{id:`llvm`,name:`LLVM IR`,import:(()=>H(()=>import(`./llvm-gMuDX7E9.js`),[]))},{id:`log`,name:`Log file`,import:(()=>H(()=>import(`./log-BNLmms1o.js`),[]))},{id:`logo`,name:`Logo`,import:(()=>H(()=>import(`./logo-Cluzi2Zq.js`),[]))},{id:`lua`,name:`Lua`,import:(()=>H(()=>import(`./lua-CdPd6TdG.js`).then(e=>e.n),__vite__mapDeps([42,1,24])))},{id:`luau`,name:`Luau`,import:(()=>H(()=>import(`./luau-BVYDJs9u.js`),[]))},{id:`make`,name:`Makefile`,aliases:[`makefile`],import:(()=>H(()=>import(`./make-Dixweg8N.js`),[]))},{id:`markdown`,name:`Markdown`,aliases:[`md`],import:(()=>H(()=>import(`./markdown-BYOwaDjH.js`),[]))},{id:`marko`,name:`Marko`,import:(()=>H(()=>import(`./marko-DJQST3lL.js`),__vite__mapDeps([71,7,1,72,10,18])))},{id:`matlab`,name:`MATLAB`,import:(()=>H(()=>import(`./matlab-D7qyCx1q.js`),[]))},{id:`mdc`,name:`MDC`,import:(()=>H(()=>import(`./mdc-BpPhzEd0.js`),__vite__mapDeps([73,20,1,6,7,8,45,43])))},{id:`mdx`,name:`MDX`,import:(()=>H(()=>import(`./mdx-DQZ5AkYe.js`),[]))},{id:`mermaid`,name:`Mermaid`,aliases:[`mmd`],import:(()=>H(()=>import(`./mermaid-CVB5KUjh.js`),[]))},{id:`mipsasm`,name:`MIPS Assembly`,aliases:[`mips`],import:(()=>H(()=>import(`./mipsasm-BMqwQI7S.js`),[]))},{id:`mojo`,name:`Mojo`,import:(()=>H(()=>import(`./mojo-BMVD-x3l.js`),[]))},{id:`move`,name:`Move`,import:(()=>H(()=>import(`./move-DAfwgNoA.js`),[]))},{id:`narrat`,name:`Narrat Language`,aliases:[`nar`],import:(()=>H(()=>import(`./narrat-_X_XdTYD.js`),[]))},{id:`nextflow`,name:`Nextflow`,aliases:[`nf`],import:(()=>H(()=>import(`./nextflow-CKcj7-Pb.js`),[]))},{id:`nginx`,name:`Nginx`,import:(()=>H(()=>import(`./nginx-D0L6l3UG.js`),__vite__mapDeps([74,42,1,24])))},{id:`nim`,name:`Nim`,import:(()=>H(()=>import(`./nim-CXwZWzWk.js`),__vite__mapDeps([75,24,1,7,30,6,8,45,13,14])))},{id:`nix`,name:`Nix`,import:(()=>H(()=>import(`./nix-BMeD4hpW.js`),[]))},{id:`nushell`,name:`nushell`,aliases:[`nu`],import:(()=>H(()=>import(`./nushell-BRQfS1u5.js`),[]))},{id:`objective-c`,name:`Objective-C`,aliases:[`objc`],import:(()=>H(()=>import(`./objective-c-D1A_Heim.js`),[]))},{id:`objective-cpp`,name:`Objective-C++`,import:(()=>H(()=>import(`./objective-cpp-BsSzOQcm.js`),[]))},{id:`ocaml`,name:`OCaml`,import:(()=>H(()=>import(`./ocaml-O90oeIOV.js`),[]))},{id:`pascal`,name:`Pascal`,import:(()=>H(()=>import(`./pascal-4ZHwLPI5.js`),[]))},{id:`perl`,name:`Perl`,import:(()=>H(()=>import(`./perl-Bu8Q5Bv6.js`),__vite__mapDeps([76,7,1,6,8,21,13,14])))},{id:`php`,name:`PHP`,import:(()=>H(()=>import(`./php-B4SpY2t5.js`),__vite__mapDeps([77,7,1,6,8,12,21,13,14])))},{id:`pkl`,name:`Pkl`,import:(()=>H(()=>import(`./pkl-ot-7Btpt.js`),[]))},{id:`plsql`,name:`PL/SQL`,import:(()=>H(()=>import(`./plsql-DGHpHOYJ.js`),[]))},{id:`po`,name:`Gettext PO`,aliases:[`pot`,`potx`],import:(()=>H(()=>import(`./po-BiJDBrnU.js`),[]))},{id:`polar`,name:`Polar`,import:(()=>H(()=>import(`./polar-C7UOKdEL.js`),[]))},{id:`postcss`,name:`PostCSS`,import:(()=>H(()=>import(`./postcss-BXeXVLqQ.js`),[]))},{id:`powerquery`,name:`PowerQuery`,import:(()=>H(()=>import(`./powerquery-DNMTfnFr.js`),[]))},{id:`powershell`,name:`PowerShell`,aliases:[`ps`,`ps1`],import:(()=>H(()=>import(`./powershell-DshXNtvi.js`),[]))},{id:`prisma`,name:`Prisma`,import:(()=>H(()=>import(`./prisma-BsRQq5mF.js`),[]))},{id:`prolog`,name:`Prolog`,import:(()=>H(()=>import(`./prolog-iXnhIJG7.js`),[]))},{id:`proto`,name:`Protocol Buffer 3`,aliases:[`protobuf`],import:(()=>H(()=>import(`./proto-9sO0eQ3y.js`),[]))},{id:`pug`,name:`Pug`,aliases:[`jade`],import:(()=>H(()=>import(`./pug-BaOpKkdB.js`),__vite__mapDeps([78,7,1,6,8])))},{id:`puppet`,name:`Puppet`,import:(()=>H(()=>import(`./puppet-CDv2pdJW.js`),[]))},{id:`purescript`,name:`PureScript`,import:(()=>H(()=>import(`./purescript-9MfHhQsQ.js`),[]))},{id:`python`,name:`Python`,aliases:[`py`],import:(()=>H(()=>import(`./python-gzcpVVnB.js`),[]))},{id:`qml`,name:`QML`,import:(()=>H(()=>import(`./qml-sjeCigfm.js`),__vite__mapDeps([79,8,1])))},{id:`qmldir`,name:`QML Directory`,import:(()=>H(()=>import(`./qmldir-DCQb3MpD.js`),[]))},{id:`qss`,name:`Qt Style Sheets`,import:(()=>H(()=>import(`./qss-Fe1Jh2GI.js`),[]))},{id:`r`,name:`R`,import:(()=>H(()=>import(`./r-D6SIBEiO.js`).then(e=>e.n),__vite__mapDeps([67,1])))},{id:`racket`,name:`Racket`,import:(()=>H(()=>import(`./racket-DcIDlBhZ.js`),[]))},{id:`raku`,name:`Raku`,aliases:[`perl6`],import:(()=>H(()=>import(`./raku-B3gFvitq.js`),[]))},{id:`razor`,name:`ASP.NET Razor`,import:(()=>H(()=>import(`./razor-BDd5S6a7.js`),__vite__mapDeps([80,81,6,1,7,8])))},{id:`reg`,name:`Windows Registry Script`,import:(()=>H(()=>import(`./reg-CRGYupPL.js`),[]))},{id:`regexp`,name:`RegExp`,aliases:[`regex`],import:(()=>H(()=>import(`./regexp-B9Q6kuZt.js`).then(e=>e.n),__vite__mapDeps([31,1])))},{id:`rel`,name:`Rel`,import:(()=>H(()=>import(`./rel-BtDbiS_P.js`),[]))},{id:`riscv`,name:`RISC-V`,import:(()=>H(()=>import(`./riscv-Ckw8ddFX.js`),[]))},{id:`rosmsg`,name:`ROS Interface`,import:(()=>H(()=>import(`./rosmsg-CAekHB0j.js`),[]))},{id:`rst`,name:`reStructuredText`,import:(()=>H(()=>import(`./rst-BIVXRxMh.js`),__vite__mapDeps([82,83,29,1,30,24,31,21,20,6,7,8,26,38,39,40,17,18,41,42,33,13,14,43])))},{id:`ruby`,name:`Ruby`,aliases:[`rb`],import:(()=>H(()=>import(`./ruby-BGs-nVm6.js`),__vite__mapDeps([38,24,1,29,30,31,21,7,39,8,40,17,18,41,6,42,33,13,14,43])))},{id:`rust`,name:`Rust`,aliases:[`rs`],import:(()=>H(()=>import(`./rust-Cfkwpbl8.js`),[]))},{id:`sas`,name:`SAS`,import:(()=>H(()=>import(`./sas-B2Nr8S2D.js`),__vite__mapDeps([84,21,1])))},{id:`sass`,name:`Sass`,import:(()=>H(()=>import(`./sass-DXrisJhu.js`),[]))},{id:`scala`,name:`Scala`,import:(()=>H(()=>import(`./scala-DKOlJaKm.js`),[]))},{id:`scheme`,name:`Scheme`,import:(()=>H(()=>import(`./scheme-DQCgrYNe.js`),[]))},{id:`scss`,name:`SCSS`,import:(()=>H(()=>import(`./scss-DbrHP5dI.js`).then(e=>e.n),__vite__mapDeps([10,1,7])))},{id:`sdbl`,name:`1C (Query)`,aliases:[`1c-query`],import:(()=>H(()=>import(`./sdbl-bTVj8UrX.js`),[]))},{id:`shaderlab`,name:`ShaderLab`,aliases:[`shader`],import:(()=>H(()=>import(`./shaderlab-TOUzSsQk.js`),__vite__mapDeps([85,86])))},{id:`shellscript`,name:`Shell`,aliases:[`bash`,`sh`,`shell`,`zsh`],import:(()=>H(()=>import(`./shellscript-DmsGrsQL.js`).then(e=>e.n),__vite__mapDeps([33,1])))},{id:`shellsession`,name:`Shell Session`,aliases:[`console`],import:(()=>H(()=>import(`./shellsession-BLlGThAF.js`),__vite__mapDeps([87,33,1])))},{id:`smalltalk`,name:`Smalltalk`,import:(()=>H(()=>import(`./smalltalk-B16xEiuN.js`),[]))},{id:`solidity`,name:`Solidity`,import:(()=>H(()=>import(`./solidity-DawnnwS6.js`),[]))},{id:`soy`,name:`Closure Templates`,aliases:[`closure-templates`],import:(()=>H(()=>import(`./soy-y67J1JBf.js`),__vite__mapDeps([88,6,1,7,8])))},{id:`sparql`,name:`SPARQL`,import:(()=>H(()=>import(`./sparql-D_iOobhT.js`),__vite__mapDeps([89,90])))},{id:`splunk`,name:`Splunk Query Language`,aliases:[`spl`],import:(()=>H(()=>import(`./splunk-BC2Px7Mm.js`),[]))},{id:`sql`,name:`SQL`,import:(()=>H(()=>import(`./sql-DF8Xc7bQ.js`).then(e=>e.n),__vite__mapDeps([21,1])))},{id:`ssh-config`,name:`SSH Config`,import:(()=>H(()=>import(`./ssh-config-BgfXC-Er.js`),[]))},{id:`stata`,name:`Stata`,import:(()=>H(()=>import(`./stata-DWwtR4o7.js`),__vite__mapDeps([91,21,1])))},{id:`stylus`,name:`Stylus`,aliases:[`styl`],import:(()=>H(()=>import(`./stylus-B6D30XZt.js`),[]))},{id:`svelte`,name:`Svelte`,import:(()=>H(()=>import(`./svelte-BVXg4aFm.js`),__vite__mapDeps([92,7,1,8,16,18])))},{id:`swift`,name:`Swift`,import:(()=>H(()=>import(`./swift-C5OpMdXo.js`),[]))},{id:`system-verilog`,name:`SystemVerilog`,import:(()=>H(()=>import(`./system-verilog-DJ5XKQeo.js`),[]))},{id:`systemd`,name:`Systemd Units`,import:(()=>H(()=>import(`./systemd-BxMlprV5.js`),[]))},{id:`talonscript`,name:`TalonScript`,aliases:[`talon`],import:(()=>H(()=>import(`./talonscript-CohzipZa.js`),[]))},{id:`tasl`,name:`Tasl`,import:(()=>H(()=>import(`./tasl-DMoTqEGO.js`),[]))},{id:`tcl`,name:`Tcl`,import:(()=>H(()=>import(`./tcl-CZd0xW_V.js`),[]))},{id:`templ`,name:`Templ`,import:(()=>H(()=>import(`./templ-B35jE-cr.js`),__vite__mapDeps([93,7,1,94,8])))},{id:`terraform`,name:`Terraform`,aliases:[`tf`,`tfvars`],import:(()=>H(()=>import(`./terraform-DswuEJGm.js`),[]))},{id:`tex`,name:`TeX`,import:(()=>H(()=>import(`./tex-C_btdDbR.js`),__vite__mapDeps([69,67,1])))},{id:`toml`,name:`TOML`,import:(()=>H(()=>import(`./toml-CcmNWLt0.js`),[]))},{id:`ts-tags`,name:`TypeScript with Tags`,aliases:[`lit`],import:(()=>H(()=>import(`./ts-tags-B1RVrAVr.js`),__vite__mapDeps([95,7,1,30,24,6,8,21,18,13,14])))},{id:`tsv`,name:`TSV`,import:(()=>H(()=>import(`./tsv-sltzmVWM.js`),[]))},{id:`tsx`,name:`TSX`,import:(()=>H(()=>import(`./tsx-37JSciWV.js`).then(e=>e.n),__vite__mapDeps([17,1])))},{id:`turtle`,name:`Turtle`,import:(()=>H(()=>import(`./turtle-ByJddavk.js`),[]))},{id:`twig`,name:`Twig`,import:(()=>H(()=>import(`./twig-BaTGNYMW.js`),__vite__mapDeps([96,7,1,8,77,6,12,21,13,14,26,38,24,29,30,31,39,40,17,18,41,42,33,43,10])))},{id:`typescript`,name:`TypeScript`,aliases:[`ts`,`cts`,`mts`],import:(()=>H(()=>import(`./typescript-CdMIlDjx.js`).then(e=>e.n),__vite__mapDeps([18,1])))},{id:`typespec`,name:`TypeSpec`,aliases:[`tsp`],import:(()=>H(()=>import(`./typespec-M5HnuNy0.js`),[]))},{id:`typst`,name:`Typst`,aliases:[`typ`],import:(()=>H(()=>import(`./typst-DI99ib-x.js`),[]))},{id:`v`,name:`V`,import:(()=>H(()=>import(`./v-DETTlOr0.js`),[]))},{id:`vala`,name:`Vala`,import:(()=>H(()=>import(`./vala-zf12oZj6.js`),[]))},{id:`vb`,name:`Visual Basic`,aliases:[`cmd`],import:(()=>H(()=>import(`./vb-Djn5o6TS.js`),[]))},{id:`verilog`,name:`Verilog`,import:(()=>H(()=>import(`./verilog-CiiDBU1e.js`),[]))},{id:`vhdl`,name:`VHDL`,import:(()=>H(()=>import(`./vhdl-BroJfC0k.js`),[]))},{id:`viml`,name:`Vim Script`,aliases:[`vim`,`vimscript`],import:(()=>H(()=>import(`./viml-DvXPmvsu.js`),[]))},{id:`vue`,name:`Vue`,import:(()=>H(()=>import(`./vue-C1368MUJ.js`),__vite__mapDeps([97,7,1,20,6,8,12,18])))},{id:`vue-html`,name:`Vue HTML`,import:(()=>H(()=>import(`./vue-html-CMU60TJw.js`),__vite__mapDeps([98,8,1,97,7,20,6,12,18])))},{id:`vue-vine`,name:`Vue Vine`,import:(()=>H(()=>import(`./vue-vine-B0ZobtBU.js`),__vite__mapDeps([99,7,1,8,72,97,20,6,12,18,16,10,100])))},{id:`vyper`,name:`Vyper`,aliases:[`vy`],import:(()=>H(()=>import(`./vyper-CgoNMtux.js`),[]))},{id:`wasm`,name:`WebAssembly`,import:(()=>H(()=>import(`./wasm-ByWQv1Qj.js`),[]))},{id:`wenyan`,name:`Wenyan`,aliases:[`文言`],import:(()=>H(()=>import(`./wenyan-C8pVoKbM.js`),[]))},{id:`wgsl`,name:`WGSL`,import:(()=>H(()=>import(`./wgsl-BsKzXJz4.js`),[]))},{id:`wikitext`,name:`Wikitext`,aliases:[`mediawiki`,`wiki`],import:(()=>H(()=>import(`./wikitext-ClFFjSW2.js`),[]))},{id:`wit`,name:`WebAssembly Interface Types`,import:(()=>H(()=>import(`./wit-DdvCle-K.js`),[]))},{id:`wolfram`,name:`Wolfram`,aliases:[`wl`],import:(()=>H(()=>import(`./wolfram-DLL8P-h_.js`),[]))},{id:`xml`,name:`XML`,import:(()=>H(()=>import(`./xml-BGEfOfoz.js`).then(e=>e.n),__vite__mapDeps([13,1,14])))},{id:`xsl`,name:`XSL`,import:(()=>H(()=>import(`./xsl-D3QHn1W2.js`),__vite__mapDeps([101,13,1,14])))},{id:`yaml`,name:`YAML`,aliases:[`yml`],import:(()=>H(()=>import(`./yaml-Ce3AqKtC.js`).then(e=>e.n),__vite__mapDeps([43,1])))},{id:`zenscript`,name:`ZenScript`,import:(()=>H(()=>import(`./zenscript-BnlCZFoB.js`),[]))},{id:`zig`,name:`Zig`,import:(()=>H(()=>import(`./zig-CMLA9XwU.js`),[]))}],vA=Object.fromEntries(_A.map(e=>[e.id,e.import])),yA=Object.fromEntries(_A.flatMap(e=>e.aliases?.map(t=>[t,e.import])||[])),bA={...vA,...yA},xA=Object.fromEntries([{id:`andromeeda`,displayName:`Andromeeda`,type:`dark`,import:(()=>H(()=>import(`./andromeeda-C5osXYoj.js`),[]))},{id:`aurora-x`,displayName:`Aurora X`,type:`dark`,import:(()=>H(()=>import(`./aurora-x-CDeNXAV0.js`),[]))},{id:`ayu-dark`,displayName:`Ayu Dark`,type:`dark`,import:(()=>H(()=>import(`./ayu-dark-CXHoNUfW.js`),[]))},{id:`catppuccin-frappe`,displayName:`Catppuccin Frappé`,type:`dark`,import:(()=>H(()=>import(`./catppuccin-frappe-3VR1Za6u.js`),[]))},{id:`catppuccin-latte`,displayName:`Catppuccin Latte`,type:`light`,import:(()=>H(()=>import(`./catppuccin-latte-DwIHMF0Q.js`),[]))},{id:`catppuccin-macchiato`,displayName:`Catppuccin Macchiato`,type:`dark`,import:(()=>H(()=>import(`./catppuccin-macchiato-DYnBP6_5.js`),[]))},{id:`catppuccin-mocha`,displayName:`Catppuccin Mocha`,type:`dark`,import:(()=>H(()=>import(`./catppuccin-mocha-DYhrFGRu.js`),[]))},{id:`dark-plus`,displayName:`Dark Plus`,type:`dark`,import:(()=>H(()=>import(`./dark-plus-AMoNTmtj.js`),[]))},{id:`dracula`,displayName:`Dracula Theme`,type:`dark`,import:(()=>H(()=>import(`./dracula-BHWKrbxM.js`),[]))},{id:`dracula-soft`,displayName:`Dracula Theme Soft`,type:`dark`,import:(()=>H(()=>import(`./dracula-soft-5eyTD99u.js`),[]))},{id:`everforest-dark`,displayName:`Everforest Dark`,type:`dark`,import:(()=>H(()=>import(`./everforest-dark-sB-x3p7T.js`),[]))},{id:`everforest-light`,displayName:`Everforest Light`,type:`light`,import:(()=>H(()=>import(`./everforest-light-Df2xbC6M.js`),[]))},{id:`github-dark`,displayName:`GitHub Dark`,type:`dark`,import:(()=>H(()=>import(`./github-dark-C-LZuMrd.js`),[]))},{id:`github-dark-default`,displayName:`GitHub Dark Default`,type:`dark`,import:(()=>H(()=>import(`./github-dark-default-DXG-b-1a.js`),[]))},{id:`github-dark-dimmed`,displayName:`GitHub Dark Dimmed`,type:`dark`,import:(()=>H(()=>import(`./github-dark-dimmed-Bx1FflLF.js`),[]))},{id:`github-dark-high-contrast`,displayName:`GitHub Dark High Contrast`,type:`dark`,import:(()=>H(()=>import(`./github-dark-high-contrast-B_tTalzw.js`),[]))},{id:`github-light`,displayName:`GitHub Light`,type:`light`,import:(()=>H(()=>import(`./github-light-EUqPIrTm.js`),[]))},{id:`github-light-default`,displayName:`GitHub Light Default`,type:`light`,import:(()=>H(()=>import(`./github-light-default-BXViO-2h.js`),[]))},{id:`github-light-high-contrast`,displayName:`GitHub Light High Contrast`,type:`light`,import:(()=>H(()=>import(`./github-light-high-contrast-B68TUdTA.js`),[]))},{id:`gruvbox-dark-hard`,displayName:`Gruvbox Dark Hard`,type:`dark`,import:(()=>H(()=>import(`./gruvbox-dark-hard-C820rvS2.js`),[]))},{id:`gruvbox-dark-medium`,displayName:`Gruvbox Dark Medium`,type:`dark`,import:(()=>H(()=>import(`./gruvbox-dark-medium-BPjhmG05.js`),[]))},{id:`gruvbox-dark-soft`,displayName:`Gruvbox Dark Soft`,type:`dark`,import:(()=>H(()=>import(`./gruvbox-dark-soft-MrdJrrXF.js`),[]))},{id:`gruvbox-light-hard`,displayName:`Gruvbox Light Hard`,type:`light`,import:(()=>H(()=>import(`./gruvbox-light-hard-BC_s9l72.js`),[]))},{id:`gruvbox-light-medium`,displayName:`Gruvbox Light Medium`,type:`light`,import:(()=>H(()=>import(`./gruvbox-light-medium-BAWPOn9u.js`),[]))},{id:`gruvbox-light-soft`,displayName:`Gruvbox Light Soft`,type:`light`,import:(()=>H(()=>import(`./gruvbox-light-soft-BSMLrYjP.js`),[]))},{id:`houston`,displayName:`Houston`,type:`dark`,import:(()=>H(()=>import(`./houston-CsvMBhTu.js`),[]))},{id:`kanagawa-dragon`,displayName:`Kanagawa Dragon`,type:`dark`,import:(()=>H(()=>import(`./kanagawa-dragon-CXtmUGW6.js`),[]))},{id:`kanagawa-lotus`,displayName:`Kanagawa Lotus`,type:`light`,import:(()=>H(()=>import(`./kanagawa-lotus-BN08jTvb.js`),[]))},{id:`kanagawa-wave`,displayName:`Kanagawa Wave`,type:`dark`,import:(()=>H(()=>import(`./kanagawa-wave-CTweb8Dz.js`),[]))},{id:`laserwave`,displayName:`LaserWave`,type:`dark`,import:(()=>H(()=>import(`./laserwave-C_8bwKvT.js`),[]))},{id:`light-plus`,displayName:`Light Plus`,type:`light`,import:(()=>H(()=>import(`./light-plus-DVQuIRkW.js`),[]))},{id:`material-theme`,displayName:`Material Theme`,type:`dark`,import:(()=>H(()=>import(`./material-theme-Bm3Qr25_.js`),[]))},{id:`material-theme-darker`,displayName:`Material Theme Darker`,type:`dark`,import:(()=>H(()=>import(`./material-theme-darker-2IIEA8gg.js`),[]))},{id:`material-theme-lighter`,displayName:`Material Theme Lighter`,type:`light`,import:(()=>H(()=>import(`./material-theme-lighter-uhdI0v04.js`),[]))},{id:`material-theme-ocean`,displayName:`Material Theme Ocean`,type:`dark`,import:(()=>H(()=>import(`./material-theme-ocean-CHQ94UKr.js`),[]))},{id:`material-theme-palenight`,displayName:`Material Theme Palenight`,type:`dark`,import:(()=>H(()=>import(`./material-theme-palenight-B5W6OYN7.js`),[]))},{id:`min-dark`,displayName:`Min Dark`,type:`dark`,import:(()=>H(()=>import(`./min-dark-BSWPekZh.js`),[]))},{id:`min-light`,displayName:`Min Light`,type:`light`,import:(()=>H(()=>import(`./min-light-DDpmG2fV.js`),[]))},{id:`monokai`,displayName:`Monokai`,type:`dark`,import:(()=>H(()=>import(`./monokai-CdkpiU2Y.js`),[]))},{id:`night-owl`,displayName:`Night Owl`,type:`dark`,import:(()=>H(()=>import(`./night-owl-DhmEMT88.js`),[]))},{id:`nord`,displayName:`Nord`,type:`dark`,import:(()=>H(()=>import(`./nord-Cb4Vim4T.js`),[]))},{id:`one-dark-pro`,displayName:`One Dark Pro`,type:`dark`,import:(()=>H(()=>import(`./one-dark-pro-CLwyXe_n.js`),[]))},{id:`one-light`,displayName:`One Light`,type:`light`,import:(()=>H(()=>import(`./one-light-DpTtcPZs.js`),[]))},{id:`plastic`,displayName:`Plastic`,type:`dark`,import:(()=>H(()=>import(`./plastic-DQwYfKfQ.js`),[]))},{id:`poimandres`,displayName:`Poimandres`,type:`dark`,import:(()=>H(()=>import(`./poimandres-DRFjx7u4.js`),[]))},{id:`red`,displayName:`Red`,type:`dark`,import:(()=>H(()=>import(`./red-CJ3rzSJv.js`),[]))},{id:`rose-pine`,displayName:`Rosé Pine`,type:`dark`,import:(()=>H(()=>import(`./rose-pine-CtiaJAjZ.js`),[]))},{id:`rose-pine-dawn`,displayName:`Rosé Pine Dawn`,type:`light`,import:(()=>H(()=>import(`./rose-pine-dawn-6gSzoyYH.js`),[]))},{id:`rose-pine-moon`,displayName:`Rosé Pine Moon`,type:`dark`,import:(()=>H(()=>import(`./rose-pine-moon-C94p5VwC.js`),[]))},{id:`slack-dark`,displayName:`Slack Dark`,type:`dark`,import:(()=>H(()=>import(`./slack-dark-DnToyrRv.js`),[]))},{id:`slack-ochin`,displayName:`Slack Ochin`,type:`light`,import:(()=>H(()=>import(`./slack-ochin-B2OO5cIa.js`),[]))},{id:`snazzy-light`,displayName:`Snazzy Light`,type:`light`,import:(()=>H(()=>import(`./snazzy-light-4G7pJPwS.js`),[]))},{id:`solarized-dark`,displayName:`Solarized Dark`,type:`dark`,import:(()=>H(()=>import(`./solarized-dark-DV17i1UV.js`),[]))},{id:`solarized-light`,displayName:`Solarized Light`,type:`light`,import:(()=>H(()=>import(`./solarized-light-DSh2HLQt.js`),[]))},{id:`synthwave-84`,displayName:`Synthwave '84`,type:`dark`,import:(()=>H(()=>import(`./synthwave-84-nFMaYfgc.js`),[]))},{id:`tokyo-night`,displayName:`Tokyo Night`,type:`dark`,import:(()=>H(()=>import(`./tokyo-night-oM2G3aXe.js`),[]))},{id:`vesper`,displayName:`Vesper`,type:`dark`,import:(()=>H(()=>import(`./vesper-D5bVUKB1.js`),[]))},{id:`vitesse-black`,displayName:`Vitesse Black`,type:`dark`,import:(()=>H(()=>import(`./vitesse-black-fwtXNY1n.js`),[]))},{id:`vitesse-dark`,displayName:`Vitesse Dark`,type:`dark`,import:(()=>H(()=>import(`./vitesse-dark-BZCL-v6S.js`),[]))},{id:`vitesse-light`,displayName:`Vitesse Light`,type:`light`,import:(()=>H(()=>import(`./vitesse-light-VbXTXTou.js`),[]))}].map(e=>[e.id,e.import])),SA=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function CA(){return 2147483648}function wA(){return typeof performance<`u`?performance.now():Date.now()}var TA=(e,t)=>e+(t-e%t)%t;async function EA(e){let t,n,r={};function i(e){n=e,r.HEAPU8=new Uint8Array(e),r.HEAPU32=new Uint32Array(e)}function a(e,t,n){r.HEAPU8.copyWithin(e,t,t+n)}function o(e){try{return t.grow(e-n.byteLength+65535>>>16),i(t.buffer),1}catch{}}function s(e){let t=r.HEAPU8.length;e>>>=0;let n=CA();if(e>n)return!1;for(let r=1;r<=4;r*=2){let i=t*(1+.2/r);if(i=Math.min(i,e+100663296),o(Math.min(n,TA(Math.max(e,i),65536))))return!0}return!1}let c=typeof TextDecoder<`u`?new TextDecoder(`utf8`):void 0;function l(e,t,n=1024){let r=t+n,i=t;for(;e[i]&&!(i>=r);)++i;if(i-t>16&&e.buffer&&c)return c.decode(e.subarray(t,i));let a=``;for(;t<i;){let n=e[t++];if(!(n&128)){a+=String.fromCharCode(n);continue}let r=e[t++]&63;if((n&224)==192){a+=String.fromCharCode((n&31)<<6|r);continue}let i=e[t++]&63;if(n=(n&240)==224?(n&15)<<12|r<<6|i:(n&7)<<18|r<<12|i<<6|e[t++]&63,n<65536)a+=String.fromCharCode(n);else{let e=n-65536;a+=String.fromCharCode(55296|e>>10,56320|e&1023)}}return a}function u(e,t){return e?l(r.HEAPU8,e,t):``}let d={emscripten_get_now:wA,emscripten_memcpy_big:a,emscripten_resize_heap:s,fd_write:()=>0};async function f(){let n=await e({env:d,wasi_snapshot_preview1:d});t=n.memory,i(t.buffer),Object.assign(r,n),r.UTF8ToString=u}return await f(),r}var DA=Object.defineProperty,OA=(e,t,n)=>t in e?DA(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,kA=(e,t,n)=>OA(e,typeof t==`symbol`?t:t+``,n),AA=null;function jA(e){throw new SA(e.UTF8ToString(e.getLastOnigError()))}var MA=class e{constructor(t){kA(this,`utf16Length`),kA(this,`utf8Length`),kA(this,`utf16Value`),kA(this,`utf8Value`),kA(this,`utf16OffsetToUtf8`),kA(this,`utf8OffsetToUtf16`);let n=t.length,r=e._utf8ByteLength(t),i=r!==n,a=i?new Uint32Array(n+1):null;i&&(a[n]=r);let o=i?new Uint32Array(r+1):null;i&&(o[r]=n);let s=new Uint8Array(r),c=0;for(let e=0;e<n;e++){let r=t.charCodeAt(e),l=r,u=!1;if(r>=55296&&r<=56319&&e+1<n){let n=t.charCodeAt(e+1);n>=56320&&n<=57343&&(l=(r-55296<<10)+65536|n-56320,u=!0)}i&&(a[e]=c,u&&(a[e+1]=c),l<=127?o[c+0]=e:l<=2047?(o[c+0]=e,o[c+1]=e):l<=65535?(o[c+0]=e,o[c+1]=e,o[c+2]=e):(o[c+0]=e,o[c+1]=e,o[c+2]=e,o[c+3]=e)),l<=127?s[c++]=l:l<=2047?(s[c++]=192|(l&1984)>>>6,s[c++]=128|(l&63)>>>0):l<=65535?(s[c++]=224|(l&61440)>>>12,s[c++]=128|(l&4032)>>>6,s[c++]=128|(l&63)>>>0):(s[c++]=240|(l&1835008)>>>18,s[c++]=128|(l&258048)>>>12,s[c++]=128|(l&4032)>>>6,s[c++]=128|(l&63)>>>0),u&&e++}this.utf16Length=n,this.utf8Length=r,this.utf16Value=t,this.utf8Value=s,this.utf16OffsetToUtf8=a,this.utf8OffsetToUtf16=o}static _utf8ByteLength(e){let t=0;for(let n=0,r=e.length;n<r;n++){let i=e.charCodeAt(n),a=i,o=!1;if(i>=55296&&i<=56319&&n+1<r){let t=e.charCodeAt(n+1);t>=56320&&t<=57343&&(a=(i-55296<<10)+65536|t-56320,o=!0)}a<=127?t+=1:a<=2047?t+=2:a<=65535?t+=3:t+=4,o&&n++}return t}createString(e){let t=e.omalloc(this.utf8Length);return e.HEAPU8.set(this.utf8Value,t),t}},NA=class e{constructor(t){if(kA(this,`id`,++e.LAST_ID),kA(this,`_onigBinding`),kA(this,`content`),kA(this,`utf16Length`),kA(this,`utf8Length`),kA(this,`utf16OffsetToUtf8`),kA(this,`utf8OffsetToUtf16`),kA(this,`ptr`),!AA)throw new SA(`Must invoke loadWasm first.`);this._onigBinding=AA,this.content=t;let n=new MA(t);this.utf16Length=n.utf16Length,this.utf8Length=n.utf8Length,this.utf16OffsetToUtf8=n.utf16OffsetToUtf8,this.utf8OffsetToUtf16=n.utf8OffsetToUtf16,this.utf8Length<1e4&&!e._sharedPtrInUse?(e._sharedPtr||=AA.omalloc(1e4),e._sharedPtrInUse=!0,AA.HEAPU8.set(n.utf8Value,e._sharedPtr),this.ptr=e._sharedPtr):this.ptr=n.createString(AA)}convertUtf8OffsetToUtf16(e){return this.utf8OffsetToUtf16?e<0?0:e>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[e]:e}convertUtf16OffsetToUtf8(e){return this.utf16OffsetToUtf8?e<0?0:e>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[e]:e}dispose(){this.ptr===e._sharedPtr?e._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};kA(NA,`LAST_ID`,0),kA(NA,`_sharedPtr`,0),kA(NA,`_sharedPtrInUse`,!1);var PA=NA,FA=class{constructor(e){if(kA(this,`_onigBinding`),kA(this,`_ptr`),!AA)throw new SA(`Must invoke loadWasm first.`);let t=[],n=[];for(let r=0,i=e.length;r<i;r++){let i=new MA(e[r]);t[r]=i.createString(AA),n[r]=i.utf8Length}let r=AA.omalloc(4*e.length);AA.HEAPU32.set(t,r/4);let i=AA.omalloc(4*e.length);AA.HEAPU32.set(n,i/4);let a=AA.createOnigScanner(r,i,e.length);for(let n=0,r=e.length;n<r;n++)AA.ofree(t[n]);AA.ofree(i),AA.ofree(r),a===0&&jA(AA),this._onigBinding=AA,this._ptr=a}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(e,t,n){let r=0;if(typeof n==`number`&&(r=n),typeof e==`string`){e=new PA(e);let n=this._findNextMatchSync(e,t,!1,r);return e.dispose(),n}return this._findNextMatchSync(e,t,!1,r)}_findNextMatchSync(e,t,n,r){let i=this._onigBinding,a=i.findNextOnigScannerMatch(this._ptr,e.id,e.ptr,e.utf8Length,e.convertUtf16OffsetToUtf8(t),r);if(a===0)return null;let o=i.HEAPU32,s=a/4,c=o[s++],l=o[s++],u=[];for(let t=0;t<l;t++){let n=e.convertUtf8OffsetToUtf16(o[s++]),r=e.convertUtf8OffsetToUtf16(o[s++]);u[t]={start:n,end:r,length:r-n}}return{index:c,captureIndices:u}}};function IA(e){return typeof e.instantiator==`function`}function LA(e){return typeof e.default==`function`}function RA(e){return e.data!==void 0}function zA(e){return typeof Response<`u`&&e instanceof Response}function BA(e){return typeof ArrayBuffer<`u`&&(e instanceof ArrayBuffer||ArrayBuffer.isView(e))||typeof Buffer<`u`&&Buffer.isBuffer?.(e)||typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer||typeof Uint32Array<`u`&&e instanceof Uint32Array}var VA;function HA(e){if(VA)return VA;async function t(){AA=await EA(async t=>{let n=e;return n=await n,typeof n==`function`&&(n=await n(t)),typeof n==`function`&&(n=await n(t)),IA(n)?n=await n.instantiator(t):LA(n)?n=await n.default(t):(RA(n)&&(n=n.data),zA(n)?n=typeof WebAssembly.instantiateStreaming==`function`?await WA(n)(t):await GA(n)(t):BA(n)||n instanceof WebAssembly.Module?n=await UA(n)(t):`default`in n&&n.default instanceof WebAssembly.Module&&(n=await UA(n.default)(t))),`instance`in n&&(n=n.instance),`exports`in n&&(n=n.exports),n})}return VA=t(),VA}function UA(e){return t=>WebAssembly.instantiate(e,t)}function WA(e){return t=>WebAssembly.instantiateStreaming(e,t)}function GA(e){return async t=>{let n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}async function KA(e){return e&&await HA(e),{createScanner(e){return new FA(e.map(e=>typeof e==`string`?e:e.source))},createString(e){return new PA(e)}}}var qA=mA({langs:bA,themes:xA,engine:()=>KA(H(()=>import(`./wasm-BnjxR4X6.js`),[]))}),{codeToHtml:JA,codeToHast:YA,codeToTokens:XA,codeToTokensBase:ZA,codeToTokensWithThemes:QA,getSingletonHighlighter:$A,getLastGrammarState:ej}=gA(qA,{guessEmbeddedLanguages:tk});function tj(e){if([...e].length!==1)throw Error(`Expected "${e}" to be a single code point`);return e.codePointAt(0)}function nj(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}var rj=new Set([`alnum`,`alpha`,`ascii`,`blank`,`cntrl`,`digit`,`graph`,`lower`,`print`,`punct`,`space`,`upper`,`word`,`xdigit`]),ij=String.raw;function aj(e,t){if(e==null)throw Error(t??`Value expected`);return e}var oj=ij`\[\^?`,sj=`c.? | C(?:-.?)?|${ij`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${ij`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${ij`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${ij`o\{[^\}]*\}?`}|${ij`\d{1,3}`}`,cj=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,lj=new RegExp(ij`
|
|
66
|
+
\\ (?:
|
|
67
|
+
${sj}
|
|
68
|
+
| [gk]<[^>]*>?
|
|
69
|
+
| [gk]'[^']*'?
|
|
70
|
+
| .
|
|
71
|
+
)
|
|
72
|
+
| \( (?:
|
|
73
|
+
\? (?:
|
|
74
|
+
[:=!>({]
|
|
75
|
+
| <[=!]
|
|
76
|
+
| <[^>]*>
|
|
77
|
+
| '[^']*'
|
|
78
|
+
| ~\|?
|
|
79
|
+
| #(?:[^)\\]|\\.?)*
|
|
80
|
+
| [^:)]*[:)]
|
|
81
|
+
)?
|
|
82
|
+
| \*[^\)]*\)?
|
|
83
|
+
)?
|
|
84
|
+
| (?:${cj.source})+
|
|
85
|
+
| ${oj}
|
|
86
|
+
| .
|
|
87
|
+
`.replace(/\s+/g,``),`gsu`),uj=new RegExp(ij`
|
|
88
|
+
\\ (?:
|
|
89
|
+
${sj}
|
|
90
|
+
| .
|
|
91
|
+
)
|
|
92
|
+
| \[:(?:\^?\p{Alpha}+|\^):\]
|
|
93
|
+
| ${oj}
|
|
94
|
+
| &&
|
|
95
|
+
| .
|
|
96
|
+
`.replace(/\s+/g,``),`gsu`);function dj(e,t={}){let n={flags:``,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}};if(typeof e!=`string`)throw Error(`String expected as pattern`);let r=Vj(n.flags),i=[r.extended],a={captureGroup:n.rules.captureGroup,getCurrentModX(){return i.at(-1)},numOpenGroups:0,popModX(){i.pop()},pushModX(e){i.push(e)},replaceCurrentModX(e){i[i.length-1]=e},singleline:n.rules.singleline},o=[],s;for(lj.lastIndex=0;s=lj.exec(e);){let t=fj(a,e,s[0],lj.lastIndex);t.tokens?o.push(...t.tokens):t.token&&o.push(t.token),t.lastIndex!==void 0&&(lj.lastIndex=t.lastIndex)}let c=[],l=0;o.filter(e=>e.type===`GroupOpen`).forEach(e=>{e.kind===`capturing`?e.number=++l:e.raw===`(`&&c.push(e)}),l||c.forEach((e,t)=>{e.kind=`capturing`,e.number=t+1});let u=l||c.length;return{tokens:o.map(e=>e.type===`EscapedNumber`?Uj(e,u):e).flat(),flags:r}}function fj(e,t,n,r){let[i,a]=n;if(n===`[`||n===`[^`){let e=pj(t,n,r);return{tokens:e.tokens,lastIndex:e.lastIndex}}if(i===`\\`){if(`AbBGyYzZ`.includes(a))return{token:_j(n,n)};if(/^\\g[<']/.test(n)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(n))throw Error(`Invalid group name "${n}"`);return{token:jj(n)}}if(/^\\k[<']/.test(n)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(n))throw Error(`Invalid group name "${n}"`);return{token:vj(n)}}if(a===`K`)return{token:Tj(`keep`,n)};if(a===`N`||a===`R`)return{token:wj(`newline`,n,{negate:a===`N`})};if(a===`O`)return{token:wj(`any`,n)};if(a===`X`)return{token:wj(`text_segment`,n)};let e=hj(n,{inCharClass:!1});return Array.isArray(e)?{tokens:e}:{token:e}}if(i===`(`){if(a===`*`)return{token:Ij(n)};if(n===`(?{`)throw Error(`Unsupported callout "${n}"`);if(n.startsWith(`(?#`)){if(t[r]!==`)`)throw Error(`Unclosed comment group "(?#"`);return{lastIndex:r+1}}if(/^\(\?[-imx]+[:)]$/.test(n))return{token:Fj(n,e)};if(e.pushModX(e.getCurrentModX()),e.numOpenGroups++,n===`(`&&!e.captureGroup||n===`(?:`)return{token:Oj(`group`,n)};if(n===`(?>`)return{token:Oj(`atomic`,n)};if(n===`(?=`||n===`(?!`||n===`(?<=`||n===`(?<!`)return{token:Oj(n[2]===`<`?`lookbehind`:`lookahead`,n,{negate:n.endsWith(`!`)})};if(n===`(`&&e.captureGroup||n.startsWith(`(?<`)&&n.endsWith(`>`)||n.startsWith(`(?'`)&&n.endsWith(`'`))return{token:Oj(`capturing`,n,{...n!==`(`&&{name:n.slice(3,-1)}})};if(n.startsWith(`(?~`)){if(n===`(?~|`)throw Error(`Unsupported absence function kind "${n}"`);return{token:Oj(`absence_repeater`,n)}}throw Error(n===`(?(`?`Unsupported conditional "${n}"`:`Invalid or unsupported group option "${n}"`)}if(n===`)`){if(e.popModX(),e.numOpenGroups--,e.numOpenGroups<0)throw Error(`Unmatched ")"`);return{token:Dj(n)}}if(e.getCurrentModX()){if(n===`#`){let e=t.indexOf(`
|
|
97
|
+
`,r);return{lastIndex:e===-1?t.length:e}}if(/^\s$/.test(n)){let e=/\s+/y;return e.lastIndex=r,{lastIndex:e.exec(t)?e.lastIndex:r}}}return n===`.`?{token:wj(`dot`,n)}:n===`^`||n===`$`?{token:_j(e.singleline?{"^":ij`\A`,$:ij`\Z`}[n]:n,n)}:n===`|`?{token:gj(n)}:cj.test(n)?{tokens:Wj(n)}:{token:yj(tj(n),n)}}function pj(e,t,n){let r=[Cj(t[1]===`^`,t)],i=1,a;for(uj.lastIndex=n;a=uj.exec(e);){let e=a[0];if(e[0]===`[`&&e[1]!==`:`)i++,r.push(Cj(e[1]===`^`,e));else if(e===`]`){if(r.at(-1).type===`CharacterClassOpen`)r.push(yj(93,e));else if(i--,r.push(bj(e)),!i)break}else{let t=mj(e);Array.isArray(t)?r.push(...t):r.push(t)}}return{tokens:r,lastIndex:uj.lastIndex||e.length}}function mj(e){if(e[0]===`\\`)return hj(e,{inCharClass:!0});if(e[0]===`[`){let t=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(e);if(!t||!rj.has(t.groups.name))throw Error(`Invalid POSIX class "${e}"`);return wj(`posix`,e,{value:t.groups.name,negate:!!t.groups.negate})}return e===`-`?xj(e):e===`&&`?Sj(e):yj(tj(e),e)}function hj(e,{inCharClass:t}){let n=e[1];if(n===`c`||n===`C`)return Pj(e);if(`dDhHsSwW`.includes(n))return Rj(e);if(e.startsWith(ij`\o{`))throw Error(`Incomplete, invalid, or unsupported octal code point "${e}"`);if(/^\\[pP]\{/.test(e)){if(e.length===3)throw Error(`Incomplete or invalid Unicode property "${e}"`);return zj(e)}if(/^\\x[89A-Fa-f]\p{AHex}/u.test(e))try{let t=e.split(/\\x/).slice(1).map(e=>parseInt(e,16)),n=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}).decode(new Uint8Array(t)),r=new TextEncoder;return[...n].map(e=>{let t=[...r.encode(e)].map(e=>`\\x${e.toString(16)}`).join(``);return yj(tj(e),t)})}catch{throw Error(`Multibyte code "${e}" incomplete or invalid in Oniguruma`)}if(n===`u`||n===`x`)return yj(Hj(e),e);if(Nj.has(n))return yj(Nj.get(n),e);if(/\d/.test(n))return Ej(t,e);if(e===`\\`)throw Error(ij`Incomplete escape "\"`);if(n===`M`)throw Error(`Unsupported meta "${e}"`);if([...e].length===2)return yj(e.codePointAt(1),e);throw Error(`Unexpected escape "${e}"`)}function gj(e){return{type:`Alternator`,raw:e}}function _j(e,t){return{type:`Assertion`,kind:e,raw:t}}function vj(e){return{type:`Backreference`,raw:e}}function yj(e,t){return{type:`Character`,value:e,raw:t}}function bj(e){return{type:`CharacterClassClose`,raw:e}}function xj(e){return{type:`CharacterClassHyphen`,raw:e}}function Sj(e){return{type:`CharacterClassIntersector`,raw:e}}function Cj(e,t){return{type:`CharacterClassOpen`,negate:e,raw:t}}function wj(e,t,n={}){return{type:`CharacterSet`,kind:e,...n,raw:t}}function Tj(e,t,n={}){return e===`keep`?{type:`Directive`,kind:e,raw:t}:{type:`Directive`,kind:e,flags:aj(n.flags),raw:t}}function Ej(e,t){return{type:`EscapedNumber`,inCharClass:e,raw:t}}function Dj(e){return{type:`GroupClose`,raw:e}}function Oj(e,t,n={}){return{type:`GroupOpen`,kind:e,...n,raw:t}}function kj(e,t,n,r){return{type:`NamedCallout`,kind:e,tag:t,arguments:n,raw:r}}function Aj(e,t,n,r){return{type:`Quantifier`,kind:e,min:t,max:n,raw:r}}function jj(e){return{type:`Subroutine`,raw:e}}var Mj=new Set([`COUNT`,`CMP`,`ERROR`,`FAIL`,`MAX`,`MISMATCH`,`SKIP`,`TOTAL_COUNT`]),Nj=new Map([[`a`,7],[`b`,8],[`e`,27],[`f`,12],[`n`,10],[`r`,13],[`t`,9],[`v`,11]]);function Pj(e){let t=e[1]===`c`?e[2]:e[3];if(!t||!/[A-Za-z]/.test(t))throw Error(`Unsupported control character "${e}"`);return yj(tj(t.toUpperCase())-64,e)}function Fj(e,t){let{on:n,off:r}=/^\(\?(?<on>[imx]*)(?:-(?<off>[-imx]*))?/.exec(e).groups;r??=``;let i=(t.getCurrentModX()||n.includes(`x`))&&!r.includes(`x`),a=Bj(n),o=Bj(r),s={};if(a&&(s.enable=a),o&&(s.disable=o),e.endsWith(`)`))return t.replaceCurrentModX(i),Tj(`flags`,e,{flags:s});if(e.endsWith(`:`))return t.pushModX(i),t.numOpenGroups++,Oj(`group`,e,{...(a||o)&&{flags:s}});throw Error(`Unexpected flag modifier "${e}"`)}function Ij(e){let t=/\(\*(?<name>[A-Za-z_]\w*)?(?:\[(?<tag>(?:[A-Za-z_]\w*)?)\])?(?:\{(?<args>[^}]*)\})?\)/.exec(e);if(!t)throw Error(`Incomplete or invalid named callout "${e}"`);let{name:n,tag:r,args:i}=t.groups;if(!n)throw Error(`Invalid named callout "${e}"`);if(r===``)throw Error(`Named callout tag with empty value not allowed "${e}"`);let a=i?i.split(`,`).filter(e=>e!==``).map(e=>/^[+-]?\d+$/.test(e)?+e:e):[],[o,s,c]=a,l=Mj.has(n)?n.toLowerCase():`custom`;switch(l){case`fail`:case`mismatch`:case`skip`:if(a.length>0)throw Error(`Named callout arguments not allowed "${a}"`);break;case`error`:if(a.length>1)throw Error(`Named callout allows only one argument "${a}"`);if(typeof o==`string`)throw Error(`Named callout argument must be a number "${o}"`);break;case`max`:if(!a.length||a.length>2)throw Error(`Named callout must have one or two arguments "${a}"`);if(typeof o==`string`&&!/^[A-Za-z_]\w*$/.test(o))throw Error(`Named callout argument one must be a tag or number "${o}"`);if(a.length===2&&(typeof s==`number`||!/^[<>X]$/.test(s)))throw Error(`Named callout optional argument two must be '<', '>', or 'X' "${s}"`);break;case`count`:case`total_count`:if(a.length>1)throw Error(`Named callout allows only one argument "${a}"`);if(a.length===1&&(typeof o==`number`||!/^[<>X]$/.test(o)))throw Error(`Named callout optional argument must be '<', '>', or 'X' "${o}"`);break;case`cmp`:if(a.length!==3)throw Error(`Named callout must have three arguments "${a}"`);if(typeof o==`string`&&!/^[A-Za-z_]\w*$/.test(o))throw Error(`Named callout argument one must be a tag or number "${o}"`);if(typeof s==`number`||!/^(?:[<>!=]=|[<>])$/.test(s))throw Error(`Named callout argument two must be '==', '!=', '>', '<', '>=', or '<=' "${s}"`);if(typeof c==`string`&&!/^[A-Za-z_]\w*$/.test(c))throw Error(`Named callout argument three must be a tag or number "${c}"`);break;case`custom`:throw Error(`Undefined callout name "${n}"`);default:throw Error(`Unexpected named callout kind "${l}"`)}return kj(l,r??null,i?.split(`,`)??null,e)}function Lj(e){let t=null,n,r;if(e[0]===`{`){let{minStr:i,maxStr:a}=/^\{(?<minStr>\d*)(?:,(?<maxStr>\d*))?/.exec(e).groups,o=1e5;if(+i>o||a&&+a>o)throw Error(`Quantifier value unsupported in Oniguruma`);if(n=+i,r=a===void 0?+i:a===``?1/0:+a,n>r&&(t=`possessive`,[n,r]=[r,n]),e.endsWith(`?`)){if(t===`possessive`)throw Error(`Unsupported possessive interval quantifier chain with "?"`);t=`lazy`}else t||=`greedy`}else n=+(e[0]===`+`),r=e[0]===`?`?1:1/0,t=e[1]===`+`?`possessive`:e[1]===`?`?`lazy`:`greedy`;return Aj(t,n,r,e)}function Rj(e){let t=e[1].toLowerCase();return wj({d:`digit`,h:`hex`,s:`space`,w:`word`}[t],e,{negate:e[1]!==t})}function zj(e){let{p:t,neg:n,value:r}=/^\\(?<p>[pP])\{(?<neg>\^?)(?<value>[^}]+)/.exec(e).groups;return wj(`property`,e,{value:r,negate:t===`P`&&!n||t===`p`&&!!n})}function Bj(e){let t={};return e.includes(`i`)&&(t.ignoreCase=!0),e.includes(`m`)&&(t.dotAll=!0),e.includes(`x`)&&(t.extended=!0),Object.keys(t).length?t:null}function Vj(e){let t={ignoreCase:!1,dotAll:!1,extended:!1,digitIsAscii:!1,posixIsAscii:!1,spaceIsAscii:!1,wordIsAscii:!1,textSegmentMode:null};for(let n=0;n<e.length;n++){let r=e[n];if(!`imxDPSWy`.includes(r))throw Error(`Invalid flag "${r}"`);if(r===`y`){if(!/^y{[gw]}/.test(e.slice(n)))throw Error(`Invalid or unspecified flag "y" mode`);t.textSegmentMode=e[n+2]===`g`?`grapheme`:`word`,n+=3;continue}t[{i:`ignoreCase`,m:`dotAll`,x:`extended`,D:`digitIsAscii`,P:`posixIsAscii`,S:`spaceIsAscii`,W:`wordIsAscii`}[r]]=!0}return t}function Hj(e){if(/^(?:\\u(?!\p{AHex}{4})|\\x(?!\p{AHex}{1,2}|\{\p{AHex}{1,8}\}))/u.test(e))throw Error(`Incomplete or invalid escape "${e}"`);let t=e[2]===`{`?/^\\x\{\s*(?<hex>\p{AHex}+)/u.exec(e).groups.hex:e.slice(2);return parseInt(t,16)}function Uj(e,t){let{raw:n,inCharClass:r}=e,i=n.slice(1);if(!r&&(i!==`0`&&i.length===1||i[0]!==`0`&&+i<=t))return[vj(n)];let a=[],o=i.match(/^[0-7]+|\d/g);for(let e=0;e<o.length;e++){let t=o[e],r;if(e===0&&t!==`8`&&t!==`9`){if(r=parseInt(t,8),r>127)throw Error(ij`Octal encoded byte above 177 unsupported "${n}"`)}else r=tj(t);a.push(yj(r,(e===0?`\\`:``)+t))}return a}function Wj(e){let t=[],n=new RegExp(cj,`gy`),r;for(;r=n.exec(e);){let e=r[0];if(e[0]===`{`){let r=/^\{(?<min>\d+),(?<max>\d+)\}\??$/.exec(e);if(r){let{min:i,max:a}=r.groups;if(+i>+a&&e.endsWith(`?`)){n.lastIndex--,t.push(Lj(e.slice(0,-1)));continue}}}t.push(Lj(e))}return t}function Gj(e,t){if(!Array.isArray(e.body))throw Error(`Expected node with body array`);if(e.body.length!==1)return!1;let n=e.body[0];return!t||Object.keys(t).every(e=>t[e]===n[e])}function Kj(e){return qj.has(e.type)}var qj=new Set([`AbsenceFunction`,`Backreference`,`CapturingGroup`,`Character`,`CharacterClass`,`CharacterSet`,`Group`,`Quantifier`,`Subroutine`]);function Jj(e,t={}){let n={flags:``,normalizeUnknownPropertyNames:!1,skipBackrefValidation:!1,skipLookbehindValidation:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}},r=dj(e,{flags:n.flags,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline}}),i=(e,t)=>{let n=r.tokens[a.nextIndex];switch(a.parent=e,a.nextIndex++,n.type){case`Alternator`:return iM();case`Assertion`:return Yj(n);case`Backreference`:return Xj(n,a);case`Character`:return cM(n.value,{useLastValid:!!t.isCheckingRangeEnd});case`CharacterClassHyphen`:return Zj(n,a,t);case`CharacterClassOpen`:return Qj(n,a,t);case`CharacterSet`:return $j(n,a);case`Directive`:return fM(n.kind,{flags:n.flags});case`GroupOpen`:return eM(n,a,t);case`NamedCallout`:return gM(n.kind,n.tag,n.arguments);case`Quantifier`:return tM(n,a);case`Subroutine`:return nM(n,a);default:throw Error(`Unexpected token type "${n.type}"`)}},a={capturingGroups:[],hasNumberedRef:!1,namedGroupsByName:new Map,nextIndex:0,normalizeUnknownPropertyNames:n.normalizeUnknownPropertyNames,parent:null,skipBackrefValidation:n.skipBackrefValidation,skipLookbehindValidation:n.skipLookbehindValidation,skipPropertyNameValidation:n.skipPropertyNameValidation,subroutines:[],tokens:r.tokens,unicodePropertyMap:n.unicodePropertyMap,walk:i},o=yM(pM(r.flags)),s=o.body[0];for(;a.nextIndex<r.tokens.length;){let e=i(s,{});e.type===`Alternative`?(o.body.push(e),s=e):s.body.push(e)}let{capturingGroups:c,hasNumberedRef:l,namedGroupsByName:u,subroutines:d}=a;if(l&&u.size&&!n.rules.captureGroup)throw Error(`Numbered backref/subroutine not allowed when using named capture`);for(let{ref:e}of d)if(typeof e==`number`){if(e>c.length)throw Error(`Subroutine uses a group number that's not defined`);e&&(c[e-1].isSubroutined=!0)}else if(u.has(e)){if(u.get(e).length>1)throw Error(ij`Subroutine uses a duplicate group name "\g<${e}>"`);u.get(e)[0].isSubroutined=!0}else throw Error(ij`Subroutine uses a group name that's not defined "\g<${e}>"`);return o}function Yj({kind:e}){return aM(aj({"^":`line_start`,$:`line_end`,"\\A":`string_start`,"\\b":`word_boundary`,"\\B":`word_boundary`,"\\G":`search_start`,"\\y":`text_segment_boundary`,"\\Y":`text_segment_boundary`,"\\z":`string_end`,"\\Z":`string_end_newline`}[e],`Unexpected assertion kind "${e}"`),{negate:e===ij`\B`||e===ij`\Y`})}function Xj({raw:e},t){let n=/^\\k[<']/.test(e),r=n?e.slice(3,-1):e.slice(1),i=(n,r=!1)=>{let i=t.capturingGroups.length,a=!1;if(n>i)if(t.skipBackrefValidation)a=!0;else throw Error(`Not enough capturing groups defined to the left "${e}"`);return t.hasNumberedRef=!0,oM(r?i+1-n:n,{orphan:a})};if(n){let n=/^(?<sign>-?)0*(?<num>[1-9]\d*)$/.exec(r);if(n)return i(+n.groups.num,!!n.groups.sign);if(/[-+]/.test(r))throw Error(`Invalid backref name "${e}"`);if(!t.namedGroupsByName.has(r))throw Error(`Group name not defined to the left "${e}"`);return oM(r)}return i(+r)}function Zj(e,t,n){let{tokens:r,walk:i}=t,a=t.parent,o=a.body.at(-1),s=r[t.nextIndex];if(!n.isCheckingRangeEnd&&o&&o.type!==`CharacterClass`&&o.type!==`CharacterClassRange`&&s&&s.type!==`CharacterClassOpen`&&s.type!==`CharacterClassClose`&&s.type!==`CharacterClassIntersector`){let e=i(a,{...n,isCheckingRangeEnd:!0});if(o.type===`Character`&&e.type===`Character`)return a.body.pop(),uM(o,e);throw Error(`Invalid character class range`)}return cM(tj(`-`))}function Qj({negate:e},t,n){let{tokens:r,walk:i}=t,a=r[t.nextIndex],o=[lM()],s=AM(a);for(;s.type!==`CharacterClassClose`;){if(s.type===`CharacterClassIntersector`)o.push(lM()),t.nextIndex++;else{let e=o.at(-1);e.body.push(i(e,n))}s=AM(r[t.nextIndex],a)}let c=lM({negate:e});return o.length===1?c.body=o[0].body:(c.kind=`intersection`,c.body=o.map(e=>e.body.length===1?e.body[0]:e)),t.nextIndex++,c}function $j({kind:e,negate:t,value:n},r){let{normalizeUnknownPropertyNames:i,skipPropertyNameValidation:a,unicodePropertyMap:o}=r;if(e===`property`){let r=kM(n);if(rj.has(r)&&!o?.has(r))e=`posix`,n=r;else return xM(n,{negate:t,normalizeUnknownPropertyNames:i,skipPropertyNameValidation:a,unicodePropertyMap:o})}return e===`posix`?_M(n,{negate:t}):dM(e,{negate:t})}function eM(e,t,n){let{tokens:r,capturingGroups:i,namedGroupsByName:a,skipLookbehindValidation:o,walk:s}=t,c=SM(e),l=c.type===`AbsenceFunction`,u=EM(c),d=u&&c.negate;if(c.type===`CapturingGroup`&&(i.push(c),c.name&&nj(a,c.name,[]).push(c)),l&&n.isInAbsenceFunction)throw Error(`Nested absence function not supported by Oniguruma`);let f=jM(r[t.nextIndex]);for(;f.type!==`GroupClose`;){if(f.type===`Alternator`)c.body.push(iM()),t.nextIndex++;else{let e=c.body.at(-1),t=s(e,{...n,isInAbsenceFunction:n.isInAbsenceFunction||l,isInLookbehind:n.isInLookbehind||u,isInNegLookbehind:n.isInNegLookbehind||d});if(e.body.push(t),(u||n.isInLookbehind)&&!o){let e=`Lookbehind includes a pattern not allowed by Oniguruma`;if(d||n.isInNegLookbehind){if(TM(t)||t.type===`CapturingGroup`)throw Error(e)}else if(TM(t)||EM(t)&&t.negate)throw Error(e)}}f=jM(r[t.nextIndex])}return t.nextIndex++,c}function tM({kind:e,min:t,max:n},r){let i=r.parent,a=i.body.at(-1);if(!a||!Kj(a))throw Error(`Quantifier requires a repeatable token`);let o=vM(e,t,n,a);return i.body.pop(),o}function nM({raw:e},t){let{capturingGroups:n,subroutines:r}=t,i=e.slice(3,-1),a=/^(?<sign>[-+]?)0*(?<num>[1-9]\d*)$/.exec(i);if(a){let e=+a.groups.num,r=n.length;if(t.hasNumberedRef=!0,i={"":e,"+":r+e,"-":r+1-e}[a.groups.sign],i<1)throw Error(`Invalid subroutine number`)}else i===`0`&&(i=0);let o=bM(i);return r.push(o),o}function rM(e,t){if(e!==`repeater`)throw Error(`Unexpected absence function kind "${e}"`);return{type:`AbsenceFunction`,kind:e,body:CM(t?.body)}}function iM(e){return{type:`Alternative`,body:wM(e?.body)}}function aM(e,t){let n={type:`Assertion`,kind:e};return(e===`word_boundary`||e===`text_segment_boundary`)&&(n.negate=!!t?.negate),n}function oM(e,t){let n=!!t?.orphan;return{type:`Backreference`,ref:e,...n&&{orphan:n}}}function sM(e,t){let n={name:void 0,isSubroutined:!1,...t};if(n.name!==void 0&&!DM(n.name))throw Error(`Group name "${n.name}" invalid in Oniguruma`);return{type:`CapturingGroup`,number:e,...n.name&&{name:n.name},...n.isSubroutined&&{isSubroutined:n.isSubroutined},body:CM(t?.body)}}function cM(e,t){let n={useLastValid:!1,...t};if(e>1114111){let t=e.toString(16);if(n.useLastValid)e=1114111;else throw Error(e>1310719?`Invalid code point out of range "\\x{${t}}"`:`Invalid code point out of range in JS "\\x{${t}}"`)}return{type:`Character`,value:e}}function lM(e){let t={kind:`union`,negate:!1,...e};return{type:`CharacterClass`,kind:t.kind,negate:t.negate,body:wM(e?.body)}}function uM(e,t){if(t.value<e.value)throw Error(`Character class range out of order`);return{type:`CharacterClassRange`,min:e,max:t}}function dM(e,t){let n=!!t?.negate,r={type:`CharacterSet`,kind:e};return(e===`digit`||e===`hex`||e===`newline`||e===`space`||e===`word`)&&(r.negate=n),(e===`text_segment`||e===`newline`&&!n)&&(r.variableLength=!0),r}function fM(e,t={}){if(e===`keep`)return{type:`Directive`,kind:e};if(e===`flags`)return{type:`Directive`,kind:e,flags:aj(t.flags)};throw Error(`Unexpected directive kind "${e}"`)}function pM(e){return{type:`Flags`,...e}}function mM(e){let t=e?.atomic,n=e?.flags;if(t&&n)throw Error(`Atomic group cannot have flags`);return{type:`Group`,...t&&{atomic:t},...n&&{flags:n},body:CM(e?.body)}}function hM(e){let t={behind:!1,negate:!1,...e};return{type:`LookaroundAssertion`,kind:t.behind?`lookbehind`:`lookahead`,negate:t.negate,body:CM(e?.body)}}function gM(e,t,n){return{type:`NamedCallout`,kind:e,tag:t,arguments:n}}function _M(e,t){let n=!!t?.negate;if(!rj.has(e))throw Error(`Invalid POSIX class "${e}"`);return{type:`CharacterSet`,kind:`posix`,value:e,negate:n}}function vM(e,t,n,r){if(t>n)throw Error(`Invalid reversed quantifier range`);return{type:`Quantifier`,kind:e,min:t,max:n,body:r}}function yM(e,t){return{type:`Regex`,body:CM(t?.body),flags:e}}function bM(e){return{type:`Subroutine`,ref:e}}function xM(e,t){let n={negate:!1,normalizeUnknownPropertyNames:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t},r=n.unicodePropertyMap?.get(kM(e));if(!r){if(n.normalizeUnknownPropertyNames)r=OM(e);else if(n.unicodePropertyMap&&!n.skipPropertyNameValidation)throw Error(ij`Invalid Unicode property "\p{${e}}"`)}return{type:`CharacterSet`,kind:`property`,value:r??e,negate:n.negate}}function SM({flags:e,kind:t,name:n,negate:r,number:i}){switch(t){case`absence_repeater`:return rM(`repeater`);case`atomic`:return mM({atomic:!0});case`capturing`:return sM(i,{name:n});case`group`:return mM({flags:e});case`lookahead`:case`lookbehind`:return hM({behind:t===`lookbehind`,negate:r});default:throw Error(`Unexpected group kind "${t}"`)}}function CM(e){if(e===void 0)e=[iM()];else if(!Array.isArray(e)||!e.length||!e.every(e=>e.type===`Alternative`))throw Error(`Invalid body; expected array of one or more Alternative nodes`);return e}function wM(e){if(e===void 0)e=[];else if(!Array.isArray(e)||!e.every(e=>!!e.type))throw Error(`Invalid body; expected array of nodes`);return e}function TM(e){return e.type===`LookaroundAssertion`&&e.kind===`lookahead`}function EM(e){return e.type===`LookaroundAssertion`&&e.kind===`lookbehind`}function DM(e){return/^[\p{Alpha}\p{Pc}][^)]*$/u.test(e)}function OM(e){return e.trim().replace(/[- _]+/g,`_`).replace(/[A-Z][a-z]+(?=[A-Z])/g,`$&_`).replace(/[A-Za-z]+/g,e=>e[0].toUpperCase()+e.slice(1).toLowerCase())}function kM(e){return e.replace(/[- _]+/g,``).toLowerCase()}function AM(e,t){return aj(e,`${t?.type===`Character`&&t.value===93?`Empty`:`Unclosed`} character class`)}function jM(e){return aj(e,`Unclosed group`)}function MM(e,t,n=null){function r(e,t){for(let n=0;n<e.length;n++){let r=i(e[n],t,n,e);n=Math.max(-1,n+r)}}function i(a,o=null,s=null,c=null){let l=0,u=!1,d={node:a,parent:o,key:s,container:c,root:e,remove(){NM(c).splice(Math.max(0,PM(s)+l),1),l--,u=!0},removeAllNextSiblings(){return NM(c).splice(PM(s)+1)},removeAllPrevSiblings(){let e=PM(s)+l;return l-=e,NM(c).splice(0,Math.max(0,e))},replaceWith(e,t={}){let n=!!t.traverse;c?c[Math.max(0,PM(s)+l)]=e:aj(o,`Can't replace root node`)[s]=e,n&&i(e,o,s,c),u=!0},replaceWithMultiple(e,t={}){let n=!!t.traverse;if(NM(c).splice(Math.max(0,PM(s)+l),1,...e),l+=e.length-1,n){let t=0;for(let n=0;n<e.length;n++)t+=i(e[n],o,PM(s)+n+t,c)}u=!0},skip(){u=!0}},{type:f}=a,p=t[`*`],m=t[f],h=typeof p==`function`?p:p?.enter,g=typeof m==`function`?m:m?.enter;if(h?.(d,n),g?.(d,n),!u)switch(f){case`AbsenceFunction`:case`CapturingGroup`:case`Group`:r(a.body,a);break;case`Alternative`:case`CharacterClass`:r(a.body,a);break;case`Assertion`:case`Backreference`:case`Character`:case`CharacterSet`:case`Directive`:case`Flags`:case`NamedCallout`:case`Subroutine`:break;case`CharacterClassRange`:i(a.min,a,`min`),i(a.max,a,`max`);break;case`LookaroundAssertion`:r(a.body,a);break;case`Quantifier`:i(a.body,a,`body`);break;case`Regex`:r(a.body,a),i(a.flags,a,`flags`);break;default:throw Error(`Unexpected node type "${f}"`)}return m?.exit?.(d,n),p?.exit?.(d,n),l}return i(e),e}function NM(e){if(!Array.isArray(e))throw Error(`Container expected`);return e}function PM(e){if(typeof e!=`number`)throw Error(`Numeric key expected`);return e}var FM=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;function IM(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function LM(e,t,n,r){return e.slice(0,t)+r+e.slice(t+n.length)}var RM=Object.freeze({DEFAULT:`DEFAULT`,CHAR_CLASS:`CHAR_CLASS`});function zM(e,t,n,r){let i=new RegExp(String.raw`${t}|(?<$skip>\[\^?|\\?.)`,`gsu`),a=[!1],o=0,s=``;for(let t of e.matchAll(i)){let{0:e,groups:{$skip:i}}=t;if(!i&&(!r||r===RM.DEFAULT==!o)){n instanceof Function?s+=n(t,{context:o?RM.CHAR_CLASS:RM.DEFAULT,negated:a[a.length-1]}):s+=n;continue}e[0]===`[`?(o++,a.push(e[1]===`^`)):e===`]`&&o&&(o--,a.pop()),s+=e}return s}function BM(e,t,n,r){zM(e,t,n,r)}function VM(e,t,n=0,r){if(!new RegExp(t,`su`).test(e))return null;let i=RegExp(`${t}|(?<$skip>\\\\?.)`,`gsu`);i.lastIndex=n;let a=0,o;for(;o=i.exec(e);){let{0:e,groups:{$skip:t}}=o;if(!t&&(!r||r===RM.DEFAULT==!a))return o;e===`[`?a++:e===`]`&&a&&a--,i.lastIndex==o.index&&i.lastIndex++}return null}function HM(e,t,n){return!!VM(e,t,0,n)}function UM(e,t){let n=/\\?./gsu;n.lastIndex=t;let r=e.length,i=0,a=1,o;for(;o=n.exec(e);){let[e]=o;if(e===`[`)i++;else if(i)e===`]`&&i--;else if(e===`(`)a++;else if(e===`)`&&(a--,!a)){r=o.index;break}}return e.slice(t,r)}var WM=new RegExp(String.raw`(?<noncapturingStart>${FM})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,`gsu`);function GM(e,t){let n=t?.hiddenCaptures??[],r=t?.captureTransfers??new Map;if(!/\(\?>/.test(e))return{pattern:e,captureTransfers:r,hiddenCaptures:n};let i=[0],a=[],o=0,s=0,c=NaN,l;do{l=!1;let t=0,u=0,d=!1,f;for(WM.lastIndex=Number.isNaN(c)?0:c+7;f=WM.exec(e);){let{0:p,index:m,groups:{capturingStart:h,noncapturingStart:g}}=f;if(p===`[`)t++;else if(t)p===`]`&&t--;else if(p===`(?>`&&!d)c=m,d=!0;else if(d&&g)u++;else if(h)d?u++:(o++,i.push(o+s));else if(p===`)`&&d){if(!u){s++;let t=o+s;if(e=`${e.slice(0,c)}(?:(?=(${e.slice(c+3,m)}))<$$${t}>)${e.slice(m+1)}`,l=!0,a.push(t),IM(n,t),r.size){let e=new Map;r.forEach((n,r)=>{e.set(r>=t?r+1:r,n.map(e=>e>=t?e+1:e))}),r=e}break}u--}}}while(l);return n.push(...a),e=zM(e,String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,({0:e,groups:{backrefNum:t,wrappedBackrefNum:n}})=>{if(t){let n=+t;if(n>i.length-1)throw Error(`Backref "${e}" greater than number of captures`);return`\\${i[n]}`}return`\\${n}`},RM.DEFAULT),{pattern:e,captureTransfers:r,hiddenCaptures:n}}var KM=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,qM=new RegExp(String.raw`
|
|
98
|
+
\\(?: \d+
|
|
99
|
+
| c[A-Za-z]
|
|
100
|
+
| [gk]<[^>]+>
|
|
101
|
+
| [pPu]\{[^\}]+\}
|
|
102
|
+
| u[A-Fa-f\d]{4}
|
|
103
|
+
| x[A-Fa-f\d]{2}
|
|
104
|
+
)
|
|
105
|
+
| \((?: \? (?: [:=!>]
|
|
106
|
+
| <(?:[=!]|[^>]+>)
|
|
107
|
+
| [A-Za-z\-]+:
|
|
108
|
+
| \(DEFINE\)
|
|
109
|
+
))?
|
|
110
|
+
| (?<qBase>${KM})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?)
|
|
111
|
+
| \\?.
|
|
112
|
+
`.replace(/\s+/g,``),`gsu`);function JM(e){if(!RegExp(`${KM}\\+`).test(e))return{pattern:e};let t=[],n=null,r=null,i=``,a=0,o;for(qM.lastIndex=0;o=qM.exec(e);){let{0:s,index:c,groups:{qBase:l,qMod:u,invalidQ:d}}=o;if(s===`[`)a||(r=c),a++;else if(s===`]`)a?a--:r=null;else if(!a)if(u===`+`&&i&&!i.startsWith(`(`)){if(d)throw Error(`Invalid quantifier "${s}"`);let t=-1;if(/^\{\d+\}$/.test(l))e=LM(e,c+l.length,u,``);else{if(i===`)`||i===`]`){let t=i===`)`?n:r;if(t===null)throw Error(`Invalid unmatched "${i}"`);e=`${e.slice(0,t)}(?>${e.slice(t,c)}${l})${e.slice(c+s.length)}`}else e=`${e.slice(0,c-i.length)}(?>${i}${l})${e.slice(c+s.length)}`;t+=4}qM.lastIndex+=t}else s[0]===`(`?t.push(c):s===`)`&&(n=t.length?t.pop():null);i=s}return{pattern:e}}var YM=String.raw,XM=YM`\(\?R=(?<rDepth>[^\)]+)\)|${YM`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`}`,ZM=YM`\(\?<(?![=!])(?<captureName>[^>]+)>`,QM=YM`${ZM}|(?<unnamed>\()(?!\?)`,$M=new RegExp(YM`${ZM}|${XM}|\(\?|\\?.`,`gsu`),eN=`Cannot use multiple overlapping recursions`;function tN(e,t){let{hiddenCaptures:n,mode:r}={hiddenCaptures:[],mode:`plugin`,...t},i=t?.captureTransfers??new Map;if(!new RegExp(XM,`su`).test(e))return{pattern:e,captureTransfers:i,hiddenCaptures:n};if(r===`plugin`&&HM(e,YM`\(\?\(DEFINE\)`,RM.DEFAULT))throw Error(`DEFINE groups cannot be used with recursion`);let a=[],o=HM(e,YM`\\[1-9]`,RM.DEFAULT),s=new Map,c=[],l=!1,u=0,d=0,f;for($M.lastIndex=0;f=$M.exec(e);){let{0:t,groups:{captureName:p,rDepth:m,gRNameOrNum:h,gRDepth:g}}=f;if(t===`[`)u++;else if(u)t===`]`&&u--;else if(m){if(nN(m),l)throw Error(eN);if(o)throw Error(`${r===`external`?`Backrefs`:`Numbered backrefs`} cannot be used with global recursion`);let t=e.slice(0,f.index),s=e.slice($M.lastIndex);if(HM(s,XM,RM.DEFAULT))throw Error(eN);let c=m-1;e=rN(t,s,c,!1,n,a,d),i=oN(i,t,c,a.length,0,d);break}else if(h){nN(g);let u=!1;for(let e of c)if(e.name===h||e.num===+h){if(u=!0,e.hasRecursedWithin)throw Error(eN);break}if(!u)throw Error(YM`Recursive \g cannot be used outside the referenced group "${r===`external`?h:YM`\g<${h}&R=${g}>`}"`);let p=s.get(h),m=UM(e,p);if(o&&HM(m,YM`${ZM}|\((?!\?)`,RM.DEFAULT))throw Error(`${r===`external`?`Backrefs`:`Numbered backrefs`} cannot be used with recursion of capturing groups`);let _=e.slice(p,f.index),v=m.slice(_.length+t.length),y=a.length,b=g-1,x=rN(_,v,b,!0,n,a,d);i=oN(i,_,b,a.length-y,y,d),e=`${e.slice(0,p)}${x}${e.slice(p+m.length)}`,$M.lastIndex+=x.length-t.length-_.length-v.length,c.forEach(e=>e.hasRecursedWithin=!0),l=!0}else if(p)d++,s.set(String(d),$M.lastIndex),s.set(p,$M.lastIndex),c.push({num:d,name:p});else if(t[0]===`(`){let e=t===`(`;e&&(d++,s.set(String(d),$M.lastIndex)),c.push(e?{num:d}:{})}else t===`)`&&c.pop()}return n.push(...a),{pattern:e,captureTransfers:i,hiddenCaptures:n}}function nN(e){let t=`Max depth must be integer between 2 and 100; used ${e}`;if(!/^[1-9]\d*$/.test(e)||(e=+e,e<2||e>100))throw Error(t)}function rN(e,t,n,r,i,a,o){let s=new Set;r&&BM(e+t,ZM,({groups:{captureName:e}})=>{s.add(e)},RM.DEFAULT);let c=[n,r?s:null,i,a,o];return`${e}${iN(`(?:${e}`,`forward`,...c)}(?:)${iN(`${t})`,`backward`,...c)}${t}`}function iN(e,t,n,r,i,a,o){let s=e=>t===`forward`?e+2:n-e+2-1,c=``;for(let t=0;t<n;t++){let n=s(t);c+=zM(e,YM`${QM}|\\k<(?<backref>[^>]+)>`,({0:e,groups:{captureName:t,unnamed:s,backref:c}})=>{if(c&&r&&!r.has(c))return e;let l=`_$${n}`;if(s||t){let n=o+a.length+1;return a.push(n),aN(i,n),s?e:`(?<${t}${l}>`}return YM`\k<${c}${l}>`},RM.DEFAULT)}return c}function aN(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function oN(e,t,n,r,i,a){if(e.size&&r){let o=0;BM(t,QM,()=>o++,RM.DEFAULT);let s=a-o+i,c=new Map;return e.forEach((e,t)=>{let i=(r-o*n)/n,a=o*n,l=t>s+o?t+r:t,u=[];for(let t of e)if(t<=s)u.push(t);else if(t>s+o+i)u.push(t+r);else if(t<=s+o)for(let e=0;e<=n;e++)u.push(t+o*e);else for(let e=0;e<=n;e++)u.push(t+a+i*e);c.set(l,u)}),c}return e}var sN=String.fromCodePoint,cN=String.raw,lN={flagGroups:!0,unicodeSets:!0};lN.bugFlagVLiteralHyphenIsRange=lN.unicodeSets?(()=>{try{new RegExp(cN`[\d\-a]`,`v`)}catch{return!0}return!1})():!1,lN.bugNestedClassIgnoresNegation=lN.unicodeSets&&RegExp(`[[^a]]`,`v`).test(`a`);function uN(e,{enable:t,disable:n}){return{dotAll:!n?.dotAll&&!!(t?.dotAll||e.dotAll),ignoreCase:!n?.ignoreCase&&!!(t?.ignoreCase||e.ignoreCase)}}function dN(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}function fN(e,t){return mN[e]>=mN[t]}function pN(e,t){if(e==null)throw Error(t??`Value expected`);return e}var mN={ES2025:2025,ES2024:2024,ES2018:2018},hN={auto:`auto`,ES2025:`ES2025`,ES2024:`ES2024`,ES2018:`ES2018`};function gN(e={}){if({}.toString.call(e)!==`[object Object]`)throw Error(`Unexpected options`);if(e.target!==void 0&&!hN[e.target])throw Error(`Unexpected target "${e.target}"`);let t={accuracy:`default`,avoidSubclass:!1,flags:``,global:!1,hasIndices:!1,lazyCompileLength:1/0,target:`auto`,verbose:!1,...e,rules:{allowOrphanBackrefs:!1,asciiWordBoundaries:!1,captureGroup:!1,recursionLimit:20,singleline:!1,...e.rules}};return t.target===`auto`&&(t.target=lN.flagGroups?`ES2025`:lN.unicodeSets?`ES2024`:`ES2018`),t}var _N=`[ -\r ]`,vN=new Set([sN(304),sN(305)]),yN=cN`[\p{L}\p{M}\p{N}\p{Pc}]`;function bN(e){if(vN.has(e))return[e];let t=new Set,n=e.toLowerCase(),r=n.toUpperCase(),i=wN.get(n),a=SN.get(n),o=CN.get(n);return[...r].length===1&&t.add(r),o&&t.add(o),i&&t.add(i),t.add(n),a&&t.add(a),[...t]}var xN=new Map(`C Other
|
|
113
|
+
Cc Control cntrl
|
|
114
|
+
Cf Format
|
|
115
|
+
Cn Unassigned
|
|
116
|
+
Co Private_Use
|
|
117
|
+
Cs Surrogate
|
|
118
|
+
L Letter
|
|
119
|
+
LC Cased_Letter
|
|
120
|
+
Ll Lowercase_Letter
|
|
121
|
+
Lm Modifier_Letter
|
|
122
|
+
Lo Other_Letter
|
|
123
|
+
Lt Titlecase_Letter
|
|
124
|
+
Lu Uppercase_Letter
|
|
125
|
+
M Mark Combining_Mark
|
|
126
|
+
Mc Spacing_Mark
|
|
127
|
+
Me Enclosing_Mark
|
|
128
|
+
Mn Nonspacing_Mark
|
|
129
|
+
N Number
|
|
130
|
+
Nd Decimal_Number digit
|
|
131
|
+
Nl Letter_Number
|
|
132
|
+
No Other_Number
|
|
133
|
+
P Punctuation punct
|
|
134
|
+
Pc Connector_Punctuation
|
|
135
|
+
Pd Dash_Punctuation
|
|
136
|
+
Pe Close_Punctuation
|
|
137
|
+
Pf Final_Punctuation
|
|
138
|
+
Pi Initial_Punctuation
|
|
139
|
+
Po Other_Punctuation
|
|
140
|
+
Ps Open_Punctuation
|
|
141
|
+
S Symbol
|
|
142
|
+
Sc Currency_Symbol
|
|
143
|
+
Sk Modifier_Symbol
|
|
144
|
+
Sm Math_Symbol
|
|
145
|
+
So Other_Symbol
|
|
146
|
+
Z Separator
|
|
147
|
+
Zl Line_Separator
|
|
148
|
+
Zp Paragraph_Separator
|
|
149
|
+
Zs Space_Separator
|
|
150
|
+
ASCII
|
|
151
|
+
ASCII_Hex_Digit AHex
|
|
152
|
+
Alphabetic Alpha
|
|
153
|
+
Any
|
|
154
|
+
Assigned
|
|
155
|
+
Bidi_Control Bidi_C
|
|
156
|
+
Bidi_Mirrored Bidi_M
|
|
157
|
+
Case_Ignorable CI
|
|
158
|
+
Cased
|
|
159
|
+
Changes_When_Casefolded CWCF
|
|
160
|
+
Changes_When_Casemapped CWCM
|
|
161
|
+
Changes_When_Lowercased CWL
|
|
162
|
+
Changes_When_NFKC_Casefolded CWKCF
|
|
163
|
+
Changes_When_Titlecased CWT
|
|
164
|
+
Changes_When_Uppercased CWU
|
|
165
|
+
Dash
|
|
166
|
+
Default_Ignorable_Code_Point DI
|
|
167
|
+
Deprecated Dep
|
|
168
|
+
Diacritic Dia
|
|
169
|
+
Emoji
|
|
170
|
+
Emoji_Component EComp
|
|
171
|
+
Emoji_Modifier EMod
|
|
172
|
+
Emoji_Modifier_Base EBase
|
|
173
|
+
Emoji_Presentation EPres
|
|
174
|
+
Extended_Pictographic ExtPict
|
|
175
|
+
Extender Ext
|
|
176
|
+
Grapheme_Base Gr_Base
|
|
177
|
+
Grapheme_Extend Gr_Ext
|
|
178
|
+
Hex_Digit Hex
|
|
179
|
+
IDS_Binary_Operator IDSB
|
|
180
|
+
IDS_Trinary_Operator IDST
|
|
181
|
+
ID_Continue IDC
|
|
182
|
+
ID_Start IDS
|
|
183
|
+
Ideographic Ideo
|
|
184
|
+
Join_Control Join_C
|
|
185
|
+
Logical_Order_Exception LOE
|
|
186
|
+
Lowercase Lower
|
|
187
|
+
Math
|
|
188
|
+
Noncharacter_Code_Point NChar
|
|
189
|
+
Pattern_Syntax Pat_Syn
|
|
190
|
+
Pattern_White_Space Pat_WS
|
|
191
|
+
Quotation_Mark QMark
|
|
192
|
+
Radical
|
|
193
|
+
Regional_Indicator RI
|
|
194
|
+
Sentence_Terminal STerm
|
|
195
|
+
Soft_Dotted SD
|
|
196
|
+
Terminal_Punctuation Term
|
|
197
|
+
Unified_Ideograph UIdeo
|
|
198
|
+
Uppercase Upper
|
|
199
|
+
Variation_Selector VS
|
|
200
|
+
White_Space space
|
|
201
|
+
XID_Continue XIDC
|
|
202
|
+
XID_Start XIDS`.split(/\s/).map(e=>[kM(e),e])),SN=new Map([[`s`,sN(383)],[sN(383),`s`]]),CN=new Map([[sN(223),sN(7838)],[sN(107),sN(8490)],[sN(229),sN(8491)],[sN(969),sN(8486)]]),wN=new Map([DN(453),DN(456),DN(459),DN(498),...ON(8072,8079),...ON(8088,8095),...ON(8104,8111),DN(8124),DN(8140),DN(8188)]),TN=new Map([[`alnum`,cN`[\p{Alpha}\p{Nd}]`],[`alpha`,cN`\p{Alpha}`],[`ascii`,cN`\p{ASCII}`],[`blank`,cN`[\p{Zs}\t]`],[`cntrl`,cN`\p{Cc}`],[`digit`,cN`\p{Nd}`],[`graph`,cN`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],[`lower`,cN`\p{Lower}`],[`print`,cN`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],[`punct`,cN`[\p{P}\p{S}]`],[`space`,cN`\p{space}`],[`upper`,cN`\p{Upper}`],[`word`,cN`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],[`xdigit`,cN`\p{AHex}`]]);function EN(e,t){let n=[];for(let r=e;r<=t;r++)n.push(r);return n}function DN(e){let t=sN(e);return[t.toLowerCase(),t]}function ON(e,t){return EN(e,t).map(e=>DN(e))}var kN=new Set([`Lower`,`Lowercase`,`Upper`,`Uppercase`,`Ll`,`Lowercase_Letter`,`Lt`,`Titlecase_Letter`,`Lu`,`Uppercase_Letter`]);function AN(e,t){let n={accuracy:`default`,asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:`ES2025`,...t};PN(e);let r={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:fN(n.bestEffortTarget,`ES2024`),passedLookbehind:!1,strategy:null,subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:e.flags.digitIsAscii,spaceIsAscii:e.flags.spaceIsAscii,wordIsAscii:e.flags.wordIsAscii};MM(e,jN,r);let i={dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},a={currentFlags:i,prevFlags:null,globalFlags:i,groupOriginByCopy:new Map,groupsByName:new Map,multiplexCapturesToLeftByRef:new Map,openRefs:new Map,reffedNodesByReferencer:new Map,subroutineRefMap:r.subroutineRefMap};return MM(e,MN,a),MM(e,NN,{groupsByName:a.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:a.reffedNodesByReferencer}),e._originMap=a.groupOriginByCopy,e._strategy=r.strategy,e}var jN={AbsenceFunction({node:e,parent:t,replaceWith:n}){let{body:r,kind:i}=e;if(i===`repeater`){let e=mM();e.body[0].body.push(hM({negate:!0,body:r}),xM(`Any`));let i=mM();i.body[0].body.push(vM(`greedy`,0,1/0,e)),n($N(i,t),{traverse:!0})}else throw Error(`Unsupported absence function "(?~|"`)},Alternative:{enter({node:e,parent:t,key:n},{flagDirectivesByAlt:r}){let i=e.body.filter(e=>e.kind===`flags`);for(let e=n+1;e<t.body.length;e++){let n=t.body[e];dN(r,n,[]).push(...i)}},exit({node:e},{flagDirectivesByAlt:t}){if(t.get(e)?.length){let n=VN(t.get(e));if(n){let t=mM({flags:n});t.body[0].body=e.body,e.body=[$N(t,e)]}}}},Assertion({node:e,parent:t,key:n,container:r,root:i,remove:a,replaceWith:o},s){let{kind:c,negate:l}=e,{asciiWordBoundaries:u,avoidSubclass:d,supportedGNodes:f,wordIsAscii:p}=s;if(c===`text_segment_boundary`)throw Error(`Unsupported text segment boundary "\\${l?`Y`:`y`}"`);if(c===`line_end`)o($N(hM({body:[iM({body:[aM(`string_end`)]}),iM({body:[cM(10)]})]}),t));else if(c===`line_start`)o($N(XN(cN`(?<=\A|\n(?!\z))`,{skipLookbehindValidation:!0}),t));else if(c===`search_start`)if(f.has(e))i.flags.sticky=!0,a();else{let e=r[n-1];if(e&&qN(e))o($N(hM({negate:!0}),t));else if(d)throw Error(cN`Uses "\G" in a way that requires a subclass`);else o(QN(aM(`string_start`),t)),s.strategy=`clip_search`}else if(!(c===`string_end`||c===`string_start`))if(c===`string_end_newline`)o($N(XN(cN`(?=\n?\z)`),t));else if(c===`word_boundary`){if(!p&&!u){let e=`(?:(?<=${yN})(?!${yN})|(?<!${yN})(?=${yN}))`,n=`(?:(?<=${yN})(?=${yN})|(?<!${yN})(?!${yN}))`;o($N(XN(l?n:e),t))}}else throw Error(`Unexpected assertion kind "${c}"`)},Backreference({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n==`string`&&!YN(n)&&(n=BN(n,t),e.ref=n)},CapturingGroup({node:e},{jsGroupNameMap:t,subroutineRefMap:n}){let{name:r}=e;r&&!YN(r)&&(r=BN(r,t),e.name=r),n.set(e.number,e),r&&n.set(r,e)},CharacterClassRange({node:e,parent:t,replaceWith:n}){t.kind===`intersection`&&n($N(lM({body:[e]}),t),{traverse:!0})},CharacterSet({node:e,parent:t,replaceWith:n},{accuracy:r,minTargetEs2024:i,digitIsAscii:a,spaceIsAscii:o,wordIsAscii:s}){let{kind:c,negate:l,value:u}=e;if(a&&(c===`digit`||u===`digit`)){n(QN(dM(`digit`,{negate:l}),t));return}if(o&&(c===`space`||u===`space`)){n($N(ZN(XN(_N),l),t));return}if(s&&(c===`word`||u===`word`)){n(QN(dM(`word`,{negate:l}),t));return}if(c===`any`)n(QN(xM(`Any`),t));else if(c===`digit`)n(QN(xM(`Nd`,{negate:l}),t));else if(c!==`dot`)if(c===`text_segment`){if(r===`strict`)throw Error(cN`Use of "\X" requires non-strict accuracy`);let e=`\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?`,a=cN`\p{RI}{2}|${e}(?:\u200D${e})*`;n($N(XN(cN`(?>\r\n|${i?cN`\p{RGI_Emoji}`:a}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),t))}else if(c===`hex`)n(QN(xM(`AHex`,{negate:l}),t));else if(c===`newline`)n($N(XN(l?`[^
|
|
203
|
+
]`:`(?>\r
|
|
204
|
+
?|[
|
|
205
|
+
\v\f
\u2028\u2029])`),t));else if(c===`posix`)if(!i&&(u===`graph`||u===`print`)){if(r===`strict`)throw Error(`POSIX class "${u}" requires min target ES2024 or non-strict accuracy`);let e={graph:`!-~`,print:` -~`}[u];l&&(e=`\0-${sN(e.codePointAt(0)-1)}${sN(e.codePointAt(2)+1)}-\u{10FFFF}`),n($N(XN(`[${e}]`),t))}else n($N(ZN(XN(TN.get(u)),l),t));else if(c===`property`)xN.has(kM(u))||(e.key=`sc`);else if(c===`space`)n(QN(xM(`space`,{negate:l}),t));else if(c===`word`)n($N(ZN(XN(yN),l),t));else throw Error(`Unexpected character set kind "${c}"`)},Directive({node:e,parent:t,root:n,remove:r,replaceWith:i,removeAllPrevSiblings:a,removeAllNextSiblings:o}){let{kind:s,flags:c}=e;if(s===`flags`)if(!c.enable&&!c.disable)r();else{let e=mM({flags:c});e.body[0].body=o(),i($N(e,t),{traverse:!0})}else if(s===`keep`){let e=n.body[0],r=n.body.length===1&&Gj(e,{type:`Group`})&&e.body[0].body.length===1?e.body[0]:n;if(t.parent!==r||r.body.length>1)throw Error(cN`Uses "\K" in a way that's unsupported`);let o=hM({behind:!0});o.body[0].body=a(),i($N(o,t))}else throw Error(`Unexpected directive kind "${s}"`)},Flags({node:e,parent:t}){if(e.posixIsAscii)throw Error(`Unsupported flag "P"`);if(e.textSegmentMode===`word`)throw Error(`Unsupported flag "y{w}"`);[`digitIsAscii`,`extended`,`posixIsAscii`,`spaceIsAscii`,`wordIsAscii`,`textSegmentMode`].forEach(t=>delete e[t]),Object.assign(e,{global:!1,hasIndices:!1,multiline:!1,sticky:e.sticky??!1}),t.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:e}){if(!e.flags)return;let{enable:t,disable:n}=e.flags;t?.extended&&delete t.extended,n?.extended&&delete n.extended,t?.dotAll&&n?.dotAll&&delete t.dotAll,t?.ignoreCase&&n?.ignoreCase&&delete t.ignoreCase,t&&!Object.keys(t).length&&delete e.flags.enable,n&&!Object.keys(n).length&&delete e.flags.disable,!e.flags.enable&&!e.flags.disable&&delete e.flags},LookaroundAssertion({node:e},t){let{kind:n}=e;n===`lookbehind`&&(t.passedLookbehind=!0)},NamedCallout({node:e,parent:t,replaceWith:n}){let{kind:r}=e;if(r===`fail`)n($N(hM({negate:!0}),t));else throw Error(`Unsupported named callout "(*${r.toUpperCase()}"`)},Quantifier({node:e}){if(e.body.type===`Quantifier`){let t=mM();t.body[0].body.push(e.body),e.body=$N(t,e)}},Regex:{enter({node:e},{supportedGNodes:t}){let n=[],r=!1,i=!1;for(let t of e.body)if(t.body.length===1&&t.body[0].kind===`search_start`)t.body.pop();else{let e=WN(t.body);e?(r=!0,Array.isArray(e)?n.push(...e):n.push(e)):i=!0}r&&!i&&n.forEach(e=>t.add(e))},exit(e,{accuracy:t,passedLookbehind:n,strategy:r}){if(t===`strict`&&n&&r)throw Error(cN`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n==`string`&&!YN(n)&&(n=BN(n,t),e.ref=n)}},MN={Backreference({node:e},{multiplexCapturesToLeftByRef:t,reffedNodesByReferencer:n}){let{orphan:r,ref:i}=e;r||n.set(e,[...t.get(i).map(({node:e})=>e)])},CapturingGroup:{enter({node:e,parent:t,replaceWith:n,skip:r},{groupOriginByCopy:i,groupsByName:a,multiplexCapturesToLeftByRef:o,openRefs:s,reffedNodesByReferencer:c}){let l=i.get(e);if(l&&s.has(e.number)){let r=QN(RN(e.number),t);c.set(r,s.get(e.number)),n(r);return}s.set(e.number,e),o.set(e.number,[]),e.name&&dN(o,e.name,[]);let u=o.get(e.name??e.number);for(let t=0;t<u.length;t++){let n=u[t];if(l===n.node||l&&l===n.origin||e===n.origin){u.splice(t,1);break}}if(o.get(e.number).push({node:e,origin:l}),e.name&&o.get(e.name).push({node:e,origin:l}),e.name){let t=dN(a,e.name,new Map),n=!1;if(l)n=!0;else for(let e of t.values())if(!e.hasDuplicateNameToRemove){n=!0;break}a.get(e.name).set(e,{node:e,hasDuplicateNameToRemove:n})}},exit({node:e},{openRefs:t}){t.delete(e.number)}},Group:{enter({node:e},t){t.prevFlags=t.currentFlags,e.flags&&(t.currentFlags=uN(t.currentFlags,e.flags))},exit(e,t){t.currentFlags=t.prevFlags}},Subroutine({node:e,parent:t,replaceWith:n},r){let{isRecursive:i,ref:a}=e;if(i){let n=t;for(;(n=n.parent)&&!(n.type===`CapturingGroup`&&(n.name===a||n.number===a)););r.reffedNodesByReferencer.set(e,n);return}let o=r.subroutineRefMap.get(a),s=a===0,c=s?RN(0):LN(o,r.groupOriginByCopy,null),l=c;if(!s){let e=VN(zN(o,e=>e.type===`Group`&&!!e.flags)),t=e?uN(r.globalFlags,e):r.globalFlags;FN(t,r.currentFlags)||(l=mM({flags:HN(t)}),l.body[0].body.push(c))}n($N(l,t),{traverse:!s})}},NN={Backreference({node:e,parent:t,replaceWith:n},r){if(e.orphan){r.highestOrphanBackref=Math.max(r.highestOrphanBackref,e.ref);return}let i=r.reffedNodesByReferencer.get(e).filter(t=>IN(t,e));i.length?i.length>1?n($N(mM({atomic:!0,body:i.reverse().map(e=>iM({body:[oM(e.number)]}))}),t)):e.ref=i[0].number:n($N(hM({negate:!0}),t))},CapturingGroup({node:e},t){e.number=++t.numCapturesToLeft,e.name&&t.groupsByName.get(e.name).get(e).hasDuplicateNameToRemove&&delete e.name},Regex:{exit({node:e},t){let n=Math.max(t.highestOrphanBackref-t.numCapturesToLeft,0);for(let t=0;t<n;t++){let t=sM();e.body.at(-1).body.push(t)}}},Subroutine({node:e},t){!e.isRecursive||e.ref===0||(e.ref=t.reffedNodesByReferencer.get(e).number)}};function PN(e){MM(e,{"*"({node:e,parent:t}){e.parent=t}})}function FN(e,t){return e.dotAll===t.dotAll&&e.ignoreCase===t.ignoreCase}function IN(e,t){let n=t;do{if(n.type===`Regex`)return!1;if(n.type===`Alternative`)continue;if(n===e)return!1;let t=UN(n.parent);for(let r of t){if(r===n)break;if(r===e||GN(r,e))return!0}}while(n=n.parent);throw Error(`Unexpected path`)}function LN(e,t,n,r){let i=Array.isArray(e)?[]:{};for(let[a,o]of Object.entries(e))a===`parent`?i.parent=Array.isArray(n)?r:n:o&&typeof o==`object`?i[a]=LN(o,t,i,n):(a===`type`&&o===`CapturingGroup`&&t.set(i,t.get(e)??e),i[a]=o);return i}function RN(e){let t=bM(e);return t.isRecursive=!0,t}function zN(e,t){let n=[];for(;e=e.parent;)(!t||t(e))&&n.push(e);return n}function BN(e,t){if(t.has(e))return t.get(e);let n=`$${t.size}_${e.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/gu,`_`)}`;return t.set(e,n),n}function VN(e){let t=[`dotAll`,`ignoreCase`],n={enable:{},disable:{}};return e.forEach(({flags:e})=>{t.forEach(t=>{e.enable?.[t]&&(delete n.disable[t],n.enable[t]=!0),e.disable?.[t]&&(n.disable[t]=!0)})}),Object.keys(n.enable).length||delete n.enable,Object.keys(n.disable).length||delete n.disable,n.enable||n.disable?n:null}function HN({dotAll:e,ignoreCase:t}){let n={};return(e||t)&&(n.enable={},e&&(n.enable.dotAll=!0),t&&(n.enable.ignoreCase=!0)),(!e||!t)&&(n.disable={},!e&&(n.disable.dotAll=!0),!t&&(n.disable.ignoreCase=!0)),n}function UN(e){if(!e)throw Error(`Node expected`);let{body:t}=e;return Array.isArray(t)?t:t?[t]:null}function WN(e){let t=e.find(e=>e.kind===`search_start`||JN(e,{negate:!1})||!KN(e));if(!t)return null;if(t.kind===`search_start`)return t;if(t.type===`LookaroundAssertion`)return t.body[0].body[0];if(t.type===`CapturingGroup`||t.type===`Group`){let e=[];for(let n of t.body){let t=WN(n.body);if(!t)return null;Array.isArray(t)?e.push(...t):e.push(t)}return e}return null}function GN(e,t){let n=UN(e)??[];for(let e of n)if(e===t||GN(e,t))return!0;return!1}function KN({type:e}){return e===`Assertion`||e===`Directive`||e===`LookaroundAssertion`}function qN(e){let t=[`Character`,`CharacterClass`,`CharacterSet`];return t.includes(e.type)||e.type===`Quantifier`&&e.min&&t.includes(e.body.type)}function JN(e,t){let n={negate:null,...t};return e.type===`LookaroundAssertion`&&(n.negate===null||e.negate===n.negate)&&e.body.length===1&&Gj(e.body[0],{type:`Assertion`,kind:`search_start`})}function YN(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function XN(e,t){let n=Jj(e,{...t,unicodePropertyMap:xN}).body;return n.length>1||n[0].body.length>1?mM({body:n}):n[0].body[0]}function ZN(e,t){return e.negate=t,e}function QN(e,t){return e.parent=t,e}function $N(e,t){return PN(e),e.parent=t,e}function eP(e,t){let n=gN(t),r=fN(n.target,`ES2024`),i=fN(n.target,`ES2025`),a=n.rules.recursionLimit;if(!Number.isInteger(a)||a<2||a>20)throw Error(`Invalid recursionLimit; use 2-20`);let o=null,s=null;if(!i){let t=[e.flags.ignoreCase];MM(e,tP,{getCurrentModI:()=>t.at(-1),popModI(){t.pop()},pushModI(e){t.push(e)},setHasCasedChar(){t.at(-1)?o=!0:s=!0}})}let c={dotAll:e.flags.dotAll,ignoreCase:!!((e.flags.ignoreCase||o)&&!s)},l=e,u={accuracy:n.accuracy,appliedGlobalFlags:c,captureMap:new Map,currentFlags:{dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},inCharClass:!1,lastNode:l,originMap:e._originMap,recursionLimit:a,useAppliedIgnoreCase:!!(!i&&o&&s),useFlagMods:i,useFlagV:r,verbose:n.verbose};function d(e){return u.lastNode=l,l=e,pN(nP[e.type],`Unexpected node type "${e.type}"`)(e,u,d)}let f={pattern:e.body.map(d).join(`|`),flags:d(e.flags),options:{...e.options}};return r||(delete f.options.force.v,f.options.disable.v=!0,f.options.unicodeSetsPlugin=null),f._captureTransfers=new Map,f._hiddenCaptures=[],u.captureMap.forEach((e,t)=>{e.hidden&&f._hiddenCaptures.push(t),e.transferTo&&dN(f._captureTransfers,e.transferTo,[]).push(t)}),f}var tP={"*":{enter({node:e},t){if(mP(e)){let n=t.getCurrentModI();t.pushModI(e.flags?uN({ignoreCase:n},e.flags).ignoreCase:n)}},exit({node:e},t){mP(e)&&t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){cP(sN(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},n){t(),lP(e,{firstOnly:!0}).length&&n.setHasCasedChar()},CharacterSet({node:e},t){e.kind===`property`&&kN.has(e.value)&&t.setHasCasedChar()}},nP={Alternative({body:e},t,n){return e.map(n).join(``)},Assertion({kind:e,negate:t}){if(e===`string_end`)return`$`;if(e===`string_start`)return`^`;if(e===`word_boundary`)return t?cN`\B`:cN`\b`;throw Error(`Unexpected assertion kind "${e}"`)},Backreference({ref:e},t){if(typeof e!=`number`)throw Error(`Unexpected named backref in transformed AST`);if(!t.useFlagMods&&t.accuracy===`strict`&&t.currentFlags.ignoreCase&&!t.captureMap.get(e).ignoreCase)throw Error(`Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy`);return`\\`+e},CapturingGroup(e,t,n){let{body:r,name:i,number:a}=e,o={ignoreCase:t.currentFlags.ignoreCase},s=t.originMap.get(e);return s&&(o.hidden=!0,a>s.number&&(o.transferTo=s.number)),t.captureMap.set(a,o),`(${i?`?<${i}>`:``}${r.map(n).join(`|`)})`},Character({value:e},t){let n=sN(e),r=uP(e,{escDigit:t.lastNode.type===`Backreference`,inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(r!==n)return r;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&cP(n)){let e=bN(n);return t.inCharClass?e.join(``):e.length>1?`[${e.join(``)}]`:e[0]}return n},CharacterClass(e,t,n){let{kind:r,negate:i,parent:a}=e,{body:o}=e;if(r===`intersection`&&!t.useFlagV)throw Error(`Use of class intersection requires min target ES2024`);lN.bugFlagVLiteralHyphenIsRange&&t.useFlagV&&o.some(gP)&&(o=[cM(45),...o.filter(e=>!gP(e))]);let s=()=>`[${i?`^`:``}${o.map(n).join(r===`intersection`?`&&`:``)}]`;if(!t.inCharClass){if((!t.useFlagV||lN.bugNestedClassIgnoresNegation)&&!i){let t=o.filter(e=>e.type===`CharacterClass`&&e.kind===`union`&&e.negate);if(t.length){let r=mM(),i=r.body[0];return r.parent=a,i.parent=r,o=o.filter(e=>!t.includes(e)),e.body=o,o.length?(e.parent=i,i.body.push(e)):r.body.pop(),t.forEach(e=>{let t=iM({body:[e]});e.parent=t,t.parent=r,r.body.push(t)}),n(r)}}t.inCharClass=!0;let r=s();return t.inCharClass=!1,r}let c=o[0];if(r===`union`&&!i&&c&&((!t.useFlagV||!t.verbose)&&a.kind===`union`&&!(lN.bugFlagVLiteralHyphenIsRange&&t.useFlagV)||!t.verbose&&a.kind===`intersection`&&o.length===1&&c.type!==`CharacterClassRange`))return o.map(n).join(``);if(!t.useFlagV&&a.type===`CharacterClass`)throw Error(`Use of nested character class requires min target ES2024`);return s()},CharacterClassRange(e,t){let n=e.min.value,r=e.max.value,i={escDigit:!1,inCharClass:!0,useFlagV:t.useFlagV},a=uP(n,i),o=uP(r,i),s=new Set;return t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&dP(lP(e)).forEach(e=>{s.add(Array.isArray(e)?`${uP(e[0],i)}-${uP(e[1],i)}`:uP(e,i))}),`${a}-${o}${[...s].join(``)}`},CharacterSet({kind:e,negate:t,value:n,key:r},i){if(e===`dot`)return i.currentFlags.dotAll?i.appliedGlobalFlags.dotAll||i.useFlagMods?`.`:`[^]`:cN`[^\n]`;if(e===`digit`)return t?cN`\D`:cN`\d`;if(e===`property`){if(i.useAppliedIgnoreCase&&i.currentFlags.ignoreCase&&kN.has(n))throw Error(`Unicode property "${n}" can't be case-insensitive when other chars have specific case`);return`${t?cN`\P`:cN`\p`}{${r?`${r}=`:``}${n}}`}if(e===`word`)return t?cN`\W`:cN`\w`;throw Error(`Unexpected character set kind "${e}"`)},Flags(e,t){return(t.appliedGlobalFlags.ignoreCase?`i`:``)+(e.dotAll?`s`:``)+(e.sticky?`y`:``)},Group({atomic:e,body:t,flags:n,parent:r},i,a){let o=i.currentFlags;n&&(i.currentFlags=uN(o,n));let s=t.map(a).join(`|`),c=!i.verbose&&t.length===1&&r.type!==`Quantifier`&&!e&&(!i.useFlagMods||!n)?s:`(?${fP(e,n,i.useFlagMods)}${s})`;return i.currentFlags=o,c},LookaroundAssertion({body:e,kind:t,negate:n},r,i){return`(?${`${t===`lookahead`?``:`<`}${n?`!`:`=`}`}${e.map(i).join(`|`)})`},Quantifier(e,t,n){return n(e.body)+pP(e)},Subroutine({isRecursive:e,ref:t},n){if(!e)throw Error(`Unexpected non-recursive subroutine in transformed AST`);let r=n.recursionLimit;return t===0?`(?R=${r})`:cN`\g<${t}&R=${r}>`}},rP=new Set([`$`,`(`,`)`,`*`,`+`,`.`,`?`,`[`,`\\`,`]`,`^`,`{`,`|`,`}`]),iP=new Set([`-`,`\\`,`]`,`^`,`[`]),aP=new Set("()-/[\\]^{|}!#$%&*+,.:;<=>?@`~".split(``)),oP=new Map([[9,cN`\t`],[10,cN`\n`],[11,cN`\v`],[12,cN`\f`],[13,cN`\r`],[8232,cN`\u2028`],[8233,cN`\u2029`],[65279,cN`\uFEFF`]]),sP=/^\p{Cased}$/u;function cP(e){return sP.test(e)}function lP(e,t){let n=!!t?.firstOnly,r=e.min.value,i=e.max.value,a=[];if(r<65&&(i===65535||i>=131071)||r===65536&&i>=131071)return a;for(let e=r;e<=i;e++){let t=sN(e);if(!cP(t))continue;let o=bN(t).filter(e=>{let t=e.codePointAt(0);return t<r||t>i});if(o.length&&(a.push(...o),n))break}return a}function uP(e,{escDigit:t,inCharClass:n,useFlagV:r}){if(oP.has(e))return oP.get(e);if(e<32||e>126&&e<160||e>262143||t&&hP(e))return e>255?`\\u{${e.toString(16).toUpperCase()}}`:`\\x${e.toString(16).toUpperCase().padStart(2,`0`)}`;let i=n?r?aP:iP:rP,a=sN(e);return(i.has(a)?`\\`:``)+a}function dP(e){let t=e.map(e=>e.codePointAt(0)).sort((e,t)=>e-t),n=[],r=null;for(let e=0;e<t.length;e++)t[e+1]===t[e]+1?r??=t[e]:r===null?n.push(t[e]):(n.push([r,t[e]]),r=null);return n}function fP(e,t,n){if(e)return`>`;let r=``;if(t&&n){let{enable:e,disable:n}=t;r=(e?.ignoreCase?`i`:``)+(e?.dotAll?`s`:``)+(n?`-`:``)+(n?.ignoreCase?`i`:``)+(n?.dotAll?`s`:``)}return`${r}:`}function pP({kind:e,max:t,min:n}){let r;return r=!n&&t===1?`?`:!n&&t===1/0?`*`:n===1&&t===1/0?`+`:n===t?`{${n}}`:`{${n},${t===1/0?``:t}}`,r+{greedy:``,lazy:`?`,possessive:`+`}[e]}function mP({type:e}){return e===`CapturingGroup`||e===`Group`||e===`LookaroundAssertion`}function hP(e){return e>47&&e<58}function gP({type:e,value:t}){return e===`Character`&&t===45}var _P=class e extends RegExp{#e=new Map;#t=null;#n;#r=null;#i=null;rawOptions={};get source(){return this.#n||`(?:)`}constructor(t,n,r){let i=!!r?.lazyCompile;if(t instanceof RegExp){if(r)throw Error(`Cannot provide options when copying a regexp`);let i=t;super(i,n),this.#n=i.source,i instanceof e&&(this.#e=i.#e,this.#r=i.#r,this.#i=i.#i,this.rawOptions=i.rawOptions)}else{let e={hiddenCaptures:[],strategy:null,transfers:[],...r};super(i?``:t,n),this.#n=t,this.#e=yP(e.hiddenCaptures,e.transfers),this.#i=e.strategy,this.rawOptions=r??{}}i||(this.#t=this)}exec(t){if(!this.#t){let{lazyCompile:t,...n}=this.rawOptions;this.#t=new e(this.#n,this.flags,n)}let n=this.global||this.sticky,r=this.lastIndex;if(this.#i===`clip_search`&&n&&r){this.lastIndex=0;let e=this.#a(t.slice(r));return e&&(vP(e,r,t,this.hasIndices),this.lastIndex+=r),e}return this.#a(t)}#a(e){this.#t.lastIndex=this.lastIndex;let t=super.exec.call(this.#t,e);if(this.lastIndex=this.#t.lastIndex,!t||!this.#e.size)return t;let n=[...t];t.length=1;let r;this.hasIndices&&(r=[...t.indices],t.indices.length=1);let i=[0];for(let e=1;e<n.length;e++){let{hidden:a,transferTo:o}=this.#e.get(e)??{};if(a?i.push(null):(i.push(t.length),t.push(n[e]),this.hasIndices&&t.indices.push(r[e])),o&&n[e]!==void 0){let a=i[o];if(!a)throw Error(`Invalid capture transfer to "${a}"`);if(t[a]=n[e],this.hasIndices&&(t.indices[a]=r[e]),t.groups){this.#r||=bP(this.source);let i=this.#r.get(o);i&&(t.groups[i]=n[e],this.hasIndices&&(t.indices.groups[i]=r[e]))}}}return t}};function vP(e,t,n,r){if(e.index+=t,e.input=n,r){let n=e.indices;for(let e=0;e<n.length;e++){let r=n[e];r&&(n[e]=[r[0]+t,r[1]+t])}let r=n.groups;r&&Object.keys(r).forEach(e=>{let n=r[e];n&&(r[e]=[n[0]+t,n[1]+t])})}}function yP(e,t){let n=new Map;for(let t of e)n.set(t,{hidden:!0});for(let[e,r]of t)for(let t of r)dN(n,t,{}).transferTo=e;return n}function bP(e){let t=/(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu,n=new Map,r=0,i=0,a;for(;a=t.exec(e);){let{0:e,groups:{capture:t,name:o}}=a;e===`[`?r++:r?e===`]`&&r--:t&&(i++,o&&n.set(i,o))}return n}function xP(e,t){let n=SP(e,t);return n.options?new _P(n.pattern,n.flags,n.options):new RegExp(n.pattern,n.flags)}function SP(e,t){let n=gN(t),r=AN(Jj(e,{flags:n.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline},skipBackrefValidation:n.rules.allowOrphanBackrefs,unicodePropertyMap:xN}),{accuracy:n.accuracy,asciiWordBoundaries:n.rules.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,bestEffortTarget:n.target}),i=eP(r,n),a=tN(i.pattern,{captureTransfers:i._captureTransfers,hiddenCaptures:i._hiddenCaptures,mode:`external`}),o=GM(JM(a.pattern).pattern,{captureTransfers:a.captureTransfers,hiddenCaptures:a.hiddenCaptures}),s={pattern:o.pattern,flags:`${n.hasIndices?`d`:``}${n.global?`g`:``}${i.flags}${i.options.disable.v?`u`:`v`}`};if(n.avoidSubclass){if(n.lazyCompileLength!==1/0)throw Error(`Lazy compilation requires subclass`)}else{let e=o.hiddenCaptures.sort((e,t)=>e-t),t=Array.from(o.captureTransfers),i=r._strategy,a=s.pattern.length>=n.lazyCompileLength;(e.length||t.length||i||a)&&(s.options={...e.length&&{hiddenCaptures:e},...t.length&&{transfers:t},...i&&{strategy:i},...a&&{lazyCompile:a}})}return s}var CP=4294967295,wP=class{constructor(e,t={}){this.patterns=e,this.options=t;let{forgiving:n=!1,cache:r,regexConstructor:i}=t;if(!i)throw Error("Option `regexConstructor` is not provided");this.regexps=e.map(e=>{if(typeof e!=`string`)return e;let t=r?.get(e);if(t){if(t instanceof RegExp)return t;if(n)return null;throw t}try{let t=i(e);return r?.set(e,t),t}catch(t){if(r?.set(e,t),n)return null;throw t}})}regexps;findNextMatchSync(e,t,n){let r=typeof e==`string`?e:e.content,i=[];function a(e,t,n=0){return{index:e,captureIndices:t.indices.map(e=>e==null?{start:CP,end:CP,length:0}:{start:e[0]+n,end:e[1]+n,length:e[1]-e[0]})}}for(let e=0;e<this.regexps.length;e++){let n=this.regexps[e];if(n)try{n.lastIndex=t;let o=n.exec(r);if(!o)continue;if(o.index===t)return a(e,o,0);i.push([e,o,0])}catch(e){if(this.options.forgiving)continue;throw e}}if(i.length){let e=Math.min(...i.map(e=>e[1].index));for(let[t,n,r]of i)if(n.index===e)return a(t,n,r)}return null}};function TP(e,t){return xP(e,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...t})}function EP(e={}){let t=Object.assign({target:`auto`,cache:new Map},e);return t.regexConstructor||=e=>TP(e,{target:t.target}),{createScanner(e){return new wP(e,t)},createString(e){return{content:e}}}}var DP=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},OP=(e,t)=>({classGroupId:e,validator:t}),kP=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),AP=`-`,jP=[],MP=`arbitrary..`,NP=e=>{let t=IP(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return FP(e);let n=e.split(AP);return PP(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?DP(i,t):t:i||jP}return n[e]||jP}}},PP=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=PP(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(AP):e.slice(t).join(AP),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},FP=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?MP+r:void 0})(),IP=e=>{let{theme:t,classGroups:n}=e;return LP(n,t)},LP=(e,t)=>{let n=kP();for(let r in e){let i=e[r];RP(i,n,r,t)}return n},RP=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];zP(i,t,n,r)}},zP=(e,t,n,r)=>{if(typeof e==`string`){BP(e,t,n);return}if(typeof e==`function`){VP(e,t,n,r);return}HP(e,t,n,r)},BP=(e,t,n)=>{let r=e===``?t:UP(t,e);r.classGroupId=n},VP=(e,t,n,r)=>{if(WP(e)){RP(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(OP(n,e))},HP=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];RP(o,UP(t,a),n,r)}},UP=(e,t)=>{let n=e,r=t.split(AP),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=kP(),n.nextPart.set(t,i)),n=i}return n},WP=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,GP=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},KP=`!`,qP=`:`,JP=[],YP=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),XP=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===qP){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(KP)?(c=s.slice(0,-1),l=!0):s.startsWith(KP)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return YP(t,l,c,u)};if(t){let e=t+qP,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):YP(JP,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},ZP=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},QP=e=>({cache:GP(e.cacheSize),parseClassName:XP(e),sortModifiers:ZP(e),...NP(e)}),$P=/\s+/,eF=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split($P),c=``;for(let e=s.length-1;e>=0;--e){let t=s[e],{isExternal:l,modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=n(t);if(l){c=t+(c.length>0?` `+c:c);continue}let m=!!p,h=r(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?` `+c:c);continue}if(h=r(f),!h){c=t+(c.length>0?` `+c:c);continue}m=!1}let g=u.length===0?``:u.length===1?u[0]:a(u).join(`:`),_=d?g+KP:g,v=_+h;if(o.indexOf(v)>-1)continue;o.push(v);let y=i(h,m);for(let e=0;e<y.length;++e){let t=y[e];o.push(_+t)}c=t+(c.length>0?` `+c:c)}return c},tF=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=nF(n))&&(i&&(i+=` `),i+=r);return i},nF=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=nF(e[r]))&&(n&&(n+=` `),n+=t);return n},rF=(e,...t)=>{let n,r,i,a,o=o=>(n=QP(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=eF(e,n);return i(e,a),a};return a=o,(...e)=>a(tF(...e))},iF=[],aF=e=>{let t=t=>t[e]||iF;return t.isThemeGetter=!0,t},oF=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,sF=/^\((?:(\w[\w-]*):)?(.+)\)$/i,cF=/^\d+\/\d+$/,lF=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,uF=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,dF=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,fF=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,pF=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,mF=e=>cF.test(e),hF=e=>!!e&&!Number.isNaN(Number(e)),gF=e=>!!e&&Number.isInteger(Number(e)),_F=e=>e.endsWith(`%`)&&hF(e.slice(0,-1)),vF=e=>lF.test(e),yF=()=>!0,bF=e=>uF.test(e)&&!dF.test(e),xF=()=>!1,SF=e=>fF.test(e),CF=e=>pF.test(e),wF=e=>!EF(e)&&!MF(e),TF=e=>zF(e,UF,xF),EF=e=>oF.test(e),DF=e=>zF(e,WF,bF),OF=e=>zF(e,GF,hF),kF=e=>zF(e,VF,xF),AF=e=>zF(e,HF,CF),jF=e=>zF(e,qF,SF),MF=e=>sF.test(e),NF=e=>BF(e,WF),PF=e=>BF(e,KF),FF=e=>BF(e,VF),IF=e=>BF(e,UF),LF=e=>BF(e,HF),RF=e=>BF(e,qF,!0),zF=(e,t,n)=>{let r=oF.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},BF=(e,t,n=!1)=>{let r=sF.exec(e);return r?r[1]?t(r[1]):n:!1},VF=e=>e===`position`||e===`percentage`,HF=e=>e===`image`||e===`url`,UF=e=>e===`length`||e===`size`||e===`bg-size`,WF=e=>e===`length`,GF=e=>e===`number`,KF=e=>e===`family-name`,qF=e=>e===`shadow`,JF=rF(()=>{let e=aF(`color`),t=aF(`font`),n=aF(`text`),r=aF(`font-weight`),i=aF(`tracking`),a=aF(`leading`),o=aF(`breakpoint`),s=aF(`container`),c=aF(`spacing`),l=aF(`radius`),u=aF(`shadow`),d=aF(`inset-shadow`),f=aF(`text-shadow`),p=aF(`drop-shadow`),m=aF(`blur`),h=aF(`perspective`),g=aF(`aspect`),_=aF(`ease`),v=aF(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),MF,EF],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[MF,EF,c],T=()=>[mF,`full`,`auto`,...w()],E=()=>[gF,`none`,`subgrid`,MF,EF],D=()=>[`auto`,{span:[`full`,gF,MF,EF]},gF,MF,EF],O=()=>[gF,`auto`,MF,EF],k=()=>[`auto`,`min`,`max`,`fr`,MF,EF],A=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],j=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],M=()=>[`auto`,...w()],N=()=>[mF,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[e,MF,EF],ee=()=>[...b(),FF,kF,{position:[MF,EF]}],te=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],ne=()=>[`auto`,`cover`,`contain`,IF,TF,{size:[MF,EF]}],re=()=>[_F,NF,DF],ie=()=>[``,`none`,`full`,l,MF,EF],ae=()=>[``,hF,NF,DF],F=()=>[`solid`,`dashed`,`dotted`,`double`],I=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],oe=()=>[hF,_F,FF,kF],se=()=>[``,`none`,m,MF,EF],ce=()=>[`none`,hF,MF,EF],le=()=>[`none`,hF,MF,EF],ue=()=>[hF,MF,EF],de=()=>[mF,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[vF],breakpoint:[vF],color:[yF],container:[vF],"drop-shadow":[vF],ease:[`in`,`out`,`in-out`],font:[wF],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[vF],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[vF],shadow:[vF],spacing:[`px`,hF],text:[vF],"text-shadow":[vF],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,mF,EF,MF,g]}],container:[`container`],columns:[{columns:[hF,EF,MF,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{start:T()}],end:[{end:T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[gF,`auto`,MF,EF]}],basis:[{basis:[mF,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[hF,mF,`auto`,`initial`,`none`,EF]}],grow:[{grow:[``,hF,MF,EF]}],shrink:[{shrink:[``,hF,MF,EF]}],order:[{order:[gF,`first`,`last`,`none`,MF,EF]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...A(),`normal`]}],"justify-items":[{"justify-items":[...j(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...j()]}],"align-content":[{content:[`normal`,...A()]}],"align-items":[{items:[...j(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...j(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...j(),`baseline`]}],"place-self":[{"place-self":[`auto`,...j()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:N()}],w:[{w:[s,`screen`,...N()]}],"min-w":[{"min-w":[s,`screen`,`none`,...N()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...N()]}],h:[{h:[`screen`,`lh`,...N()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...N()]}],"max-h":[{"max-h":[`screen`,`lh`,...N()]}],"font-size":[{text:[`base`,n,NF,DF]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,MF,OF]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,_F,EF]}],"font-family":[{font:[PF,EF,t]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,MF,EF]}],"line-clamp":[{"line-clamp":[hF,`none`,MF,OF]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,MF,EF]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,MF,EF]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:P()}],"text-color":[{text:P()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...F(),`wavy`]}],"text-decoration-thickness":[{decoration:[hF,`from-font`,`auto`,MF,DF]}],"text-decoration-color":[{decoration:P()}],"underline-offset":[{"underline-offset":[hF,`auto`,MF,EF]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,MF,EF]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,MF,EF]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:ee()}],"bg-repeat":[{bg:te()}],"bg-size":[{bg:ne()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},gF,MF,EF],radial:[``,MF,EF],conic:[gF,MF,EF]},LF,AF]}],"bg-color":[{bg:P()}],"gradient-from-pos":[{from:re()}],"gradient-via-pos":[{via:re()}],"gradient-to-pos":[{to:re()}],"gradient-from":[{from:P()}],"gradient-via":[{via:P()}],"gradient-to":[{to:P()}],rounded:[{rounded:ie()}],"rounded-s":[{"rounded-s":ie()}],"rounded-e":[{"rounded-e":ie()}],"rounded-t":[{"rounded-t":ie()}],"rounded-r":[{"rounded-r":ie()}],"rounded-b":[{"rounded-b":ie()}],"rounded-l":[{"rounded-l":ie()}],"rounded-ss":[{"rounded-ss":ie()}],"rounded-se":[{"rounded-se":ie()}],"rounded-ee":[{"rounded-ee":ie()}],"rounded-es":[{"rounded-es":ie()}],"rounded-tl":[{"rounded-tl":ie()}],"rounded-tr":[{"rounded-tr":ie()}],"rounded-br":[{"rounded-br":ie()}],"rounded-bl":[{"rounded-bl":ie()}],"border-w":[{border:ae()}],"border-w-x":[{"border-x":ae()}],"border-w-y":[{"border-y":ae()}],"border-w-s":[{"border-s":ae()}],"border-w-e":[{"border-e":ae()}],"border-w-t":[{"border-t":ae()}],"border-w-r":[{"border-r":ae()}],"border-w-b":[{"border-b":ae()}],"border-w-l":[{"border-l":ae()}],"divide-x":[{"divide-x":ae()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":ae()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...F(),`hidden`,`none`]}],"divide-style":[{divide:[...F(),`hidden`,`none`]}],"border-color":[{border:P()}],"border-color-x":[{"border-x":P()}],"border-color-y":[{"border-y":P()}],"border-color-s":[{"border-s":P()}],"border-color-e":[{"border-e":P()}],"border-color-t":[{"border-t":P()}],"border-color-r":[{"border-r":P()}],"border-color-b":[{"border-b":P()}],"border-color-l":[{"border-l":P()}],"divide-color":[{divide:P()}],"outline-style":[{outline:[...F(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[hF,MF,EF]}],"outline-w":[{outline:[``,hF,NF,DF]}],"outline-color":[{outline:P()}],shadow:[{shadow:[``,`none`,u,RF,jF]}],"shadow-color":[{shadow:P()}],"inset-shadow":[{"inset-shadow":[`none`,d,RF,jF]}],"inset-shadow-color":[{"inset-shadow":P()}],"ring-w":[{ring:ae()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:P()}],"ring-offset-w":[{"ring-offset":[hF,DF]}],"ring-offset-color":[{"ring-offset":P()}],"inset-ring-w":[{"inset-ring":ae()}],"inset-ring-color":[{"inset-ring":P()}],"text-shadow":[{"text-shadow":[`none`,f,RF,jF]}],"text-shadow-color":[{"text-shadow":P()}],opacity:[{opacity:[hF,MF,EF]}],"mix-blend":[{"mix-blend":[...I(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":I()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[hF]}],"mask-image-linear-from-pos":[{"mask-linear-from":oe()}],"mask-image-linear-to-pos":[{"mask-linear-to":oe()}],"mask-image-linear-from-color":[{"mask-linear-from":P()}],"mask-image-linear-to-color":[{"mask-linear-to":P()}],"mask-image-t-from-pos":[{"mask-t-from":oe()}],"mask-image-t-to-pos":[{"mask-t-to":oe()}],"mask-image-t-from-color":[{"mask-t-from":P()}],"mask-image-t-to-color":[{"mask-t-to":P()}],"mask-image-r-from-pos":[{"mask-r-from":oe()}],"mask-image-r-to-pos":[{"mask-r-to":oe()}],"mask-image-r-from-color":[{"mask-r-from":P()}],"mask-image-r-to-color":[{"mask-r-to":P()}],"mask-image-b-from-pos":[{"mask-b-from":oe()}],"mask-image-b-to-pos":[{"mask-b-to":oe()}],"mask-image-b-from-color":[{"mask-b-from":P()}],"mask-image-b-to-color":[{"mask-b-to":P()}],"mask-image-l-from-pos":[{"mask-l-from":oe()}],"mask-image-l-to-pos":[{"mask-l-to":oe()}],"mask-image-l-from-color":[{"mask-l-from":P()}],"mask-image-l-to-color":[{"mask-l-to":P()}],"mask-image-x-from-pos":[{"mask-x-from":oe()}],"mask-image-x-to-pos":[{"mask-x-to":oe()}],"mask-image-x-from-color":[{"mask-x-from":P()}],"mask-image-x-to-color":[{"mask-x-to":P()}],"mask-image-y-from-pos":[{"mask-y-from":oe()}],"mask-image-y-to-pos":[{"mask-y-to":oe()}],"mask-image-y-from-color":[{"mask-y-from":P()}],"mask-image-y-to-color":[{"mask-y-to":P()}],"mask-image-radial":[{"mask-radial":[MF,EF]}],"mask-image-radial-from-pos":[{"mask-radial-from":oe()}],"mask-image-radial-to-pos":[{"mask-radial-to":oe()}],"mask-image-radial-from-color":[{"mask-radial-from":P()}],"mask-image-radial-to-color":[{"mask-radial-to":P()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[hF]}],"mask-image-conic-from-pos":[{"mask-conic-from":oe()}],"mask-image-conic-to-pos":[{"mask-conic-to":oe()}],"mask-image-conic-from-color":[{"mask-conic-from":P()}],"mask-image-conic-to-color":[{"mask-conic-to":P()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:ee()}],"mask-repeat":[{mask:te()}],"mask-size":[{mask:ne()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,MF,EF]}],filter:[{filter:[``,`none`,MF,EF]}],blur:[{blur:se()}],brightness:[{brightness:[hF,MF,EF]}],contrast:[{contrast:[hF,MF,EF]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,RF,jF]}],"drop-shadow-color":[{"drop-shadow":P()}],grayscale:[{grayscale:[``,hF,MF,EF]}],"hue-rotate":[{"hue-rotate":[hF,MF,EF]}],invert:[{invert:[``,hF,MF,EF]}],saturate:[{saturate:[hF,MF,EF]}],sepia:[{sepia:[``,hF,MF,EF]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,MF,EF]}],"backdrop-blur":[{"backdrop-blur":se()}],"backdrop-brightness":[{"backdrop-brightness":[hF,MF,EF]}],"backdrop-contrast":[{"backdrop-contrast":[hF,MF,EF]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,hF,MF,EF]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[hF,MF,EF]}],"backdrop-invert":[{"backdrop-invert":[``,hF,MF,EF]}],"backdrop-opacity":[{"backdrop-opacity":[hF,MF,EF]}],"backdrop-saturate":[{"backdrop-saturate":[hF,MF,EF]}],"backdrop-sepia":[{"backdrop-sepia":[``,hF,MF,EF]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,MF,EF]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[hF,`initial`,MF,EF]}],ease:[{ease:[`linear`,`initial`,_,MF,EF]}],delay:[{delay:[hF,MF,EF]}],animate:[{animate:[`none`,v,MF,EF]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,MF,EF]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:ce()}],"rotate-x":[{"rotate-x":ce()}],"rotate-y":[{"rotate-y":ce()}],"rotate-z":[{"rotate-z":ce()}],scale:[{scale:le()}],"scale-x":[{"scale-x":le()}],"scale-y":[{"scale-y":le()}],"scale-z":[{"scale-z":le()}],"scale-3d":[`scale-3d`],skew:[{skew:ue()}],"skew-x":[{"skew-x":ue()}],"skew-y":[{"skew-y":ue()}],transform:[{transform:[MF,EF,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:de()}],"translate-x":[{"translate-x":de()}],"translate-y":[{"translate-y":de()}],"translate-z":[{"translate-z":de()}],"translate-none":[`translate-none`],accent:[{accent:P()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:P()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,MF,EF]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,MF,EF]}],fill:[{fill:[`none`,...P()]}],"stroke-w":[{stroke:[hF,NF,DF,OF]}],stroke:[{stroke:[`none`,...P()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function YF(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var XF=YF();function ZF(e){XF=e}var QF={exec:()=>null};function $F(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(eI.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var eI={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+));?/gi,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,`i`)},tI=/^(?:[ \t]*(?:\n|$))+/,nI=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,rI=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,iI=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,aI=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,oI=/(?:[*+-]|\d{1,9}[.)])/,sI=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,cI=$F(sI).replace(/bull/g,oI).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(),lI=$F(sI).replace(/bull/g,oI).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(),uI=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,dI=/^[^\n]+/,fI=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,pI=$F(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,fI).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),mI=$F(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,oI).getRegex(),hI=`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`,gI=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,_I=$F(`^ {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`,gI).replace(`tag`,hI).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),vI=$F(uI).replace(`hr`,iI).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`,hI).getRegex(),yI={blockquote:$F(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,vI).getRegex(),code:nI,def:pI,fences:rI,heading:aI,hr:iI,html:_I,lheading:cI,list:mI,newline:tI,paragraph:vI,table:QF,text:dI},bI=$F(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,iI).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`,hI).getRegex(),xI={...yI,lheading:lI,table:bI,paragraph:$F(uI).replace(`hr`,iI).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,bI).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`,hI).getRegex()},SI={...yI,html:$F(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,gI).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:QF,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:$F(uI).replace(`hr`,iI).replace(`heading`,` *#{1,6} *[^
|
|
206
|
+
]`).replace(`lheading`,cI).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},CI=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,wI=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,TI=/^( {2,}|\\)\n(?!\s*$)/,EI=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,DI=/[\p{P}\p{S}]/u,OI=/[\s\p{P}\p{S}]/u,kI=/[^\s\p{P}\p{S}]/u,AI=$F(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,OI).getRegex(),jI=/(?!~)[\p{P}\p{S}]/u,MI=/(?!~)[\s\p{P}\p{S}]/u,NI=/(?:[^\s\p{P}\p{S}]|~)/u,PI=$F(/link|code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<!`)(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`code`,/(?<!`)(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),FI=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,II=$F(FI,`u`).replace(/punct/g,DI).getRegex(),LI=$F(FI,`u`).replace(/punct/g,jI).getRegex(),RI=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,zI=$F(RI,`gu`).replace(/notPunctSpace/g,kI).replace(/punctSpace/g,OI).replace(/punct/g,DI).getRegex(),BI=$F(RI,`gu`).replace(/notPunctSpace/g,NI).replace(/punctSpace/g,MI).replace(/punct/g,jI).getRegex(),VI=$F(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,kI).replace(/punctSpace/g,OI).replace(/punct/g,DI).getRegex(),HI=$F(/\\(punct)/,`gu`).replace(/punct/g,DI).getRegex(),UI=$F(/^<(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(),WI=$F(gI).replace(`(?:-->|$)`,`-->`).getRegex(),GI=$F(`^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`,WI).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),KI=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,qI=$F(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace(`label`,KI).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),JI=$F(/^!?\[(label)\]\[(ref)\]/).replace(`label`,KI).replace(`ref`,fI).getRegex(),YI=$F(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,fI).getRegex(),XI=$F(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,JI).replace(`nolink`,YI).getRegex(),ZI=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,QI={_backpedal:QF,anyPunctuation:HI,autolink:UI,blockSkip:PI,br:TI,code:wI,del:QF,emStrongLDelim:II,emStrongRDelimAst:zI,emStrongRDelimUnd:VI,escape:CI,link:qI,nolink:YI,punctuation:AI,reflink:JI,reflinkSearch:XI,tag:GI,text:EI,url:QF},$I={...QI,link:$F(/^!?\[(label)\]\((.*?)\)/).replace(`label`,KI).getRegex(),reflink:$F(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,KI).getRegex()},eL={...QI,emStrongRDelimAst:BI,emStrongLDelim:LI,url:$F(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,ZI).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\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:$F(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,ZI).getRegex()},tL={...eL,br:$F(TI).replace(`{2,}`,`*`).getRegex(),text:$F(eL.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},nL={normal:yI,gfm:xI,pedantic:SI},rL={normal:QI,gfm:eL,breaks:tL,pedantic:$I},iL={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},aL=e=>iL[e];function oL(e,t){if(t){if(eI.escapeTest.test(e))return e.replace(eI.escapeReplace,aL)}else if(eI.escapeTestNoEncode.test(e))return e.replace(eI.escapeReplaceNoEncode,aL);return e}function sL(e){try{e=encodeURI(e).replace(eI.percentDecode,`%`)}catch{return null}return e}function cL(e,t){let n=e.replace(eI.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(eI.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``);for(;r<n.length;r++)n[r]=n[r].trim().replace(eI.slashPipe,`|`);return n}function lL(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function uL(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function dL(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`);r.state.inLink=!0;let c={type:e[0].charAt(0)===`!`?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,c}function fL(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
|
|
207
|
+
`).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e}).join(`
|
|
208
|
+
`)}var pL=class{options;rules;lexer;constructor(e){this.options=e||XF}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=t[0].replace(this.rules.other.codeRemoveIndent,``);return{type:`code`,raw:t[0],codeBlockStyle:`indented`,text:this.options.pedantic?e:lL(e,`
|
|
209
|
+
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=fL(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=lL(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:lL(t[0],`
|
|
210
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=lL(t[0],`
|
|
211
|
+
`).split(`
|
|
212
|
+
`),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o;for(o=0;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
|
|
213
|
+
`),c=s.replace(this.rules.other.blockquoteSetextReplace,`
|
|
214
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
|
|
215
|
+
${s}`:s,r=r?`${r}
|
|
216
|
+
${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`)break;if(u?.type===`blockquote`){let t=u,a=t.raw+`
|
|
217
|
+
`+e.join(`
|
|
218
|
+
`),o=this.blockquote(a);i[i.length-1]=o,n=n.substring(0,n.length-t.raw.length)+o.raw,r=r.substring(0,r.length-t.text.length)+o.text;break}else if(u?.type===`list`){let t=u,a=t.raw+`
|
|
219
|
+
`+e.join(`
|
|
220
|
+
`),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
|
|
221
|
+
`);continue}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=t[2].split(`
|
|
222
|
+
`,1)[0].replace(this.rules.other.listReplaceTabs,e=>` `.repeat(3*e.length)),l=e.split(`
|
|
223
|
+
`,1)[0],u=!c.trim(),d=0;if(this.options.pedantic?(d=2,s=c.trimStart()):u?d=t[1].length+1:(d=t[2].search(this.rules.other.nonSpaceChar),d=d>4?1:d,s=c.slice(d),d+=t[1].length),u&&this.rules.other.blankLine.test(l)&&(r+=l+`
|
|
224
|
+
`,e=e.substring(l.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),a=this.rules.other.headingBeginRegex(d),o=this.rules.other.htmlBeginRegex(d);for(;e;){let f=e.split(`
|
|
225
|
+
`,1)[0],p;if(l=f,this.options.pedantic?(l=l.replace(this.rules.other.listReplaceNesting,` `),p=l):p=l.replace(this.rules.other.tabCharGlobal,` `),i.test(l)||a.test(l)||o.test(l)||t.test(l)||n.test(l))break;if(p.search(this.rules.other.nonSpaceChar)>=d||!l.trim())s+=`
|
|
226
|
+
`+p.slice(d);else{if(u||c.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(c)||a.test(c)||n.test(c))break;s+=`
|
|
227
|
+
`+l}!u&&!l.trim()&&(u=!0),r+=f+`
|
|
228
|
+
`,e=e.substring(f.length+1),c=p.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0));let f=null,p;this.options.gfm&&(f=this.rules.other.listIsTask.exec(s),f&&(p=f[0]!==`[ ] `,s=s.replace(this.rules.other.listReplaceTask,``))),i.items.push({type:`list_item`,raw:r,task:!!f,checked:p,loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e=0;e<i.items.length;e++)if(this.lexer.state.top=!1,i.items[e].tokens=this.lexer.blockTokens(i.items[e].text,[]),!i.loose){let t=i.items[e].tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}if(i.loose)for(let e=0;e<i.items.length;e++)i.items[e].loose=!0;return i}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:`html`,block:!0,raw:t[0],pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:t[0],href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=cL(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
|
|
229
|
+
`):[],a={type:`table`,raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(cL(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:`heading`,raw:t[0],depth:t[2].charAt(0)===`=`?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
|
|
230
|
+
`?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=lL(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=uL(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let n=t[2],r=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):``;return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),dL(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,`$1`),title:r&&r.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `).toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return dL(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||r[3]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[2])||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=0,c=r[0][0]===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+n);(r=c.exec(t))!=null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){o+=a;continue}else if((r[5]||r[6])&&n%3&&!((n+a)%3)){s+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+s);let t=[...r[0]][0].length,c=e.slice(0,n+r.index+t+a);if(Math.min(n,a)%2){let e=c.slice(1,-1);return{type:`em`,raw:c,text:e,tokens:this.lexer.inlineTokens(e)}}let l=c.slice(2,-2);return{type:`strong`,raw:c,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:`del`,raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:t[0],escaped:e}}}},mL=class e{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||XF,this.options.tokenizer=this.options.tokenizer||new pL,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:eI,block:nL.normal,inline:rL.normal};this.options.pedantic?(t.block=nL.pedantic,t.inline=rL.pedantic):this.options.gfm&&(t.block=nL.gfm,this.options.breaks?t.inline=rL.breaks:t.inline=rL.gfm),this.tokenizer.rules=t}static get rules(){return{block:nL,inline:rL}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(eI.carriageReturn,`
|
|
231
|
+
`),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){for(this.options.pedantic&&(e=e.replace(eI.tabCharGlobal,` `).replace(eI.spaceLine,``));e;){let r;if(this.options.extensions?.block?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let n=t.at(-1);r.raw.length===1&&n!==void 0?n.raw+=`
|
|
232
|
+
`:t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
233
|
+
`)?``:`
|
|
234
|
+
`)+r.raw,n.text+=`
|
|
235
|
+
`+r.text,this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if(r=this.tokenizer.fences(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.heading(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.hr(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.blockquote(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.list(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.html(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
236
|
+
`)?``:`
|
|
237
|
+
`)+r.raw,n.text+=`
|
|
238
|
+
`+r.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},t.push(r));continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(this.state.top&&(r=this.tokenizer.paragraph(i))){let a=t.at(-1);n&&a?.type===`paragraph`?(a.raw+=(a.raw.endsWith(`
|
|
239
|
+
`)?``:`
|
|
240
|
+
`)+r.raw,a.text+=`
|
|
241
|
+
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(r),n=i.length!==e.length,e=e.substring(r.raw.length);continue}if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
242
|
+
`)?``:`
|
|
243
|
+
`)+r.raw,n.text+=`
|
|
244
|
+
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}else throw Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n=e,r=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!=null;)e.includes(r[0].slice(r[0].lastIndexOf(`[`)+1,-1))&&(n=n.slice(0,r.index)+`[`+`a`.repeat(r[0].length-2)+`]`+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!=null;)n=n.slice(0,r.index)+`++`+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!=null;)n=n.slice(0,r.index)+`[`+`a`.repeat(r[0].length-2)+`]`+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let i=!1,a=``;for(;e;){i||(a=``),i=!1;let r;if(this.options.extensions?.inline?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.escape(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.tag(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.link(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length);let n=t.at(-1);r.type===`text`&&n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(r=this.tokenizer.emStrong(e,n,a)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.codespan(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.br(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.del(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.autolink(e)){e=e.substring(r.raw.length),t.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(e))){e=e.substring(r.raw.length),t.push(r);continue}let o=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(o=e.substring(0,t+1))}if(r=this.tokenizer.inlineText(o)){e=e.substring(r.raw.length),r.raw.slice(-1)!==`_`&&(a=r.raw.slice(-1)),i=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}else throw Error(t)}}return t}},hL=class{options;parser;constructor(e){this.options=e||XF}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(eI.notSpaceStart)?.[0],i=e.replace(eI.endingNewline,``)+`
|
|
245
|
+
`;return r?`<pre><code class="language-`+oL(r)+`">`+(n?i:oL(i,!0))+`</code></pre>
|
|
246
|
+
`:`<pre><code>`+(n?i:oL(i,!0))+`</code></pre>
|
|
247
|
+
`}blockquote({tokens:e}){return`<blockquote>
|
|
248
|
+
${this.parser.parse(e)}</blockquote>
|
|
249
|
+
`}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
250
|
+
`}hr(e){return`<hr>
|
|
251
|
+
`}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
|
|
252
|
+
`+r+`</`+i+`>
|
|
253
|
+
`}listitem(e){let t=``;if(e.task){let n=this.checkbox({checked:!!e.checked});e.loose?e.tokens[0]?.type===`paragraph`?(e.tokens[0].text=n+` `+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type===`text`&&(e.tokens[0].tokens[0].text=n+` `+oL(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:`text`,raw:n+` `,text:n+` `,escaped:!0}):t+=n+` `}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>
|
|
254
|
+
`}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox">`}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
255
|
+
`}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&=`<tbody>${r}</tbody>`,`<table>
|
|
256
|
+
<thead>
|
|
257
|
+
`+t+`</thead>
|
|
258
|
+
`+r+`</table>
|
|
259
|
+
`}tablerow({text:e}){return`<tr>
|
|
260
|
+
${e}</tr>
|
|
261
|
+
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
262
|
+
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${oL(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=sL(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+oL(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=sL(e);if(i===null)return oL(n);e=i;let a=`<img src="${e}" alt="${n}"`;return t&&(a+=` title="${oL(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:oL(e.text)}},gL=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}},_L=class e{options;renderer;textRenderer;constructor(e){this.options=e||XF,this.options.renderer=this.options.renderer||new hL,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new gL}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e,t=!0){let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=i,t=this.options.extensions.renderers[e.type].call({parser:this},e);if(t!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`html`,`def`,`paragraph`,`text`].includes(e.type)){n+=t||``;continue}}let a=i;switch(a.type){case`space`:n+=this.renderer.space(a);continue;case`hr`:n+=this.renderer.hr(a);continue;case`heading`:n+=this.renderer.heading(a);continue;case`code`:n+=this.renderer.code(a);continue;case`table`:n+=this.renderer.table(a);continue;case`blockquote`:n+=this.renderer.blockquote(a);continue;case`list`:n+=this.renderer.list(a);continue;case`html`:n+=this.renderer.html(a);continue;case`def`:n+=this.renderer.def(a);continue;case`paragraph`:n+=this.renderer.paragraph(a);continue;case`text`:{let i=a,o=this.renderer.text(i);for(;r+1<e.length&&e[r+1].type===`text`;)i=e[++r],o+=`
|
|
263
|
+
`+this.renderer.text(i);t?n+=this.renderer.paragraph({type:`paragraph`,raw:o,text:o,tokens:[{type:`text`,raw:o,text:o,escaped:!0}]}):n+=o;continue}default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}parseInline(e,t=this.renderer){let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},vL=class{options;block;constructor(e){this.options=e||XF}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(){return this.block?mL.lex:mL.lexInline}provideParser(){return this.block?_L.parse:_L.parseInline}},yL=new class{defaults=YF();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=_L;Renderer=hL;TextRenderer=gL;Lexer=mL;Tokenizer=pL;Hooks=vL;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new hL(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new pL(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new vL;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];vL.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&vL.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:t[r]=(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return mL.lex(e,t??this.defaults)}parser(e,t){return _L.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(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 t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer():e?mL.lex:mL.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser():e?_L.parse:_L.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer():e?mL.lex:mL.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser():e?_L.parse:_L.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
|
|
264
|
+
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+oL(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function bL(e,t){return yL.parse(e,t)}bL.options=bL.setOptions=function(e){return yL.setOptions(e),bL.defaults=yL.defaults,ZF(bL.defaults),bL},bL.getDefaults=YF,bL.defaults=XF,bL.use=function(...e){return yL.use(...e),bL.defaults=yL.defaults,ZF(bL.defaults),bL},bL.walkTokens=function(e,t){return yL.walkTokens(e,t)},bL.parseInline=yL.parseInline,bL.Parser=_L,bL.parser=_L.parse,bL.Renderer=hL,bL.TextRenderer=gL,bL.Lexer=mL,bL.lexer=mL.lex,bL.Tokenizer=pL,bL.Hooks=vL,bL.parse=bL,bL.options,bL.setOptions,bL.use,bL.walkTokens,bL.parseInline,_L.parse,mL.lex;var xL=(...e)=>JF(Ee(e)),SL=(e,t,n)=>{let r=typeof t==`string`?new Blob([t],{type:n}):t,i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=e,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i)},CL=(0,U.createContext)({code:``});function wL(e,t=200,n=50){let[r,i]=(0,U.useState)(e),a=(0,U.useRef)(0),o=(0,U.useRef)(null);return(0,U.useEffect)(()=>{let r=Date.now(),s=r-a.current;return o.current&&window.clearTimeout(o.current),s>=t?(i(e),a.current=r):o.current=window.setTimeout(()=>{i(e),a.current=Date.now()},n),()=>{o.current&&window.clearTimeout(o.current)}},[e,t,n]),r}var TL=e=>e<50?{minHighlightInterval:100,debounceMs:500}:e<150?{minHighlightInterval:500,debounceMs:800}:e<300?{minHighlightInterval:1500,debounceMs:1200}:{minHighlightInterval:1/0,debounceMs:1500},EL=e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`),DL=e=>{let t=e.lastIndexOf(`
|
|
265
|
+
`);return[t>=0?e.slice(0,t+1):``,t>=0?e.slice(t+1):e]},OL=e=>e?[{pre(t){return this.addClassToHast(t,e),t}}]:[],kL=new class{constructor(){this.lightHighlighter=null,this.darkHighlighter=null,this.lightTheme=null,this.darkTheme=null,this.loadedLanguages=new Set,this.initializationPromise=null,this.loadLanguagePromise=null,this.cache=new Map,this.cacheKeys=[],this.MAX_CACHE_SIZE=50,this.highlightQueue=new Map}isLanguageSupported(e){return Object.hasOwn(bA,e)}getFallbackLanguage(){return`text`}getCacheKey(e,t,n){return`${t}::${n||``}::${e}`}addToCache(e,t){if(this.cache.size>=this.MAX_CACHE_SIZE){let e=this.cacheKeys.shift();e&&this.cache.delete(e)}this.cache.set(e,t),this.cacheKeys.push(e)}needsHighlightersInitialization(e){let[t,n]=e;return[!this.lightHighlighter||this.lightTheme!==t,!this.darkHighlighter||this.darkTheme!==n]}async ensureHighlightersInitialized(e,t){let[n,r]=t,[i,a]=e,o=EP({forgiving:!0});this.loadedLanguages.clear(),this.cache.clear(),this.cacheKeys=[],this.highlightQueue.clear(),n&&(this.lightHighlighter=await qA({themes:[i],langs:[],engine:o}),this.lightTheme=i),r&&(this.darkHighlighter=await qA({themes:[a],langs:[],engine:o}),this.darkTheme=a)}async loadLanguage(e){await this.darkHighlighter?.loadLanguage(e),await this.lightHighlighter?.loadLanguage(e),this.loadedLanguages.add(e)}async initializeHighlighters(e){this.initializationPromise&&await this.initializationPromise;let t=this.needsHighlightersInitialization(e),[n,r]=t;(n||r)&&(this.initializationPromise=this.ensureHighlightersInitialized(e,t),await this.initializationPromise,this.initializationPromise=null)}performHighlights(e,t,n){let r=this.isLanguageSupported(t)?t:this.getFallbackLanguage();if(this.lightHighlighter===null||this.darkHighlighter===null||this.lightTheme===null||this.darkTheme===null)throw Error(`highlightCode must be called after initializeHighlighters.`);let i=OL(n);return[this.lightHighlighter.codeToHtml(e,{lang:r,theme:this.lightTheme,transformers:i}),this.darkHighlighter.codeToHtml(e,{lang:r,theme:this.darkTheme,transformers:i})]}async highlightCode(e,t,n,r){let i=this.getCacheKey(e,t,n),a=this.cache.get(i);if(a)return this.cacheKeys=this.cacheKeys.filter(e=>e!==i),this.cacheKeys.push(i),a;let o=this.highlightQueue.get(i);if(o)return o;let s=()=>{if(r!=null&&r.aborted)throw new DOMException(`Aborted`,`AbortError`)},c=(async()=>{try{await new Promise(e=>setTimeout(e,0)),s(),this.initializationPromise&&await this.initializationPromise,s(),this.loadLanguagePromise&&await this.loadLanguagePromise,s(),!this.loadedLanguages.has(t)&&this.isLanguageSupported(t)&&(this.loadLanguagePromise=this.loadLanguage(t),await this.loadLanguagePromise,this.loadLanguagePromise=null),s();let r=this.performHighlights(e,t,n);return this.addToCache(i,r),r}finally{this.highlightQueue.delete(i)}})();return this.highlightQueue.set(i,c),c}},AL=({code:e,language:t,className:n,children:r,preClassName:i,...a})=>{let[o,s]=(0,U.useState)(``),[c,l]=(0,U.useState)(``),[u,d]=(0,U.useState)(``),[f,p]=(0,U.useState)(``),m=wL(e),h=(0,U.useRef)(0),g=(0,U.useRef)(!1),_=(0,U.useRef)(null),v=(0,U.useRef)(0),[y,b]=(0,U.useContext)(uz);(0,U.useEffect)(()=>{kL.initializeHighlighters([y,b])},[y,b]),(0,U.useEffect)(()=>{g.current=!0,_.current&&_.current.abort(),_.current=new AbortController;let e=_.current.signal;h.current&&clearTimeout(h.current);let[n,r]=DL(m),a=m.split(`
|
|
266
|
+
`).length,{minHighlightInterval:o,debounceMs:c}=TL(a);if(n&&n!==u){let a=Date.now();a-v.current>o||!r?(v.current=a,kL.highlightCode(n,t,i,e).then(([t,i])=>{g.current&&!e.aborted&&(0,U.startTransition)(()=>{s(t),l(i),d(n),p(r)})}).catch(e=>{if(e.name!==`AbortError`)throw e})):p(r)}else p(r);return h.current=window.setTimeout(()=>{r&&m!==u&&!e.aborted&&kL.highlightCode(m,t,i,e).then(([t,n])=>{g.current&&!e.aborted&&(0,U.startTransition)(()=>{s(t),l(n),d(m),p(``)})}).catch(e=>{if(e.name!==`AbortError`)throw e})},c),()=>{var e;g.current=!1,(e=_.current)==null||e.abort()}},[m,t,i]);let x=f?`<span class="line"><span>${EL(f)}</span></span>`:``;return(0,W.jsx)(CL.Provider,{value:{code:e},children:(0,W.jsxs)(`div`,{className:`my-4 w-full overflow-hidden rounded-xl border border-border`,"data-code-block-container":!0,"data-language":t,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between bg-muted/80 p-3 text-muted-foreground text-xs`,"data-code-block-header":!0,"data-language":t,children:[(0,W.jsx)(`span`,{className:`ml-1 font-mono lowercase`,children:t}),(0,W.jsx)(`div`,{className:`flex items-center gap-2`,children:r})]}),(0,W.jsx)(`div`,{className:`w-full`,children:(0,W.jsxs)(`div`,{className:`min-w-full`,children:[(0,W.jsx)(`div`,{className:xL(`overflow-x-auto dark:hidden`,n),dangerouslySetInnerHTML:{__html:x?o+x:o},"data-code-block":!0,"data-language":t,...a}),(0,W.jsx)(`div`,{className:xL(`hidden overflow-x-auto dark:block`,n),dangerouslySetInnerHTML:{__html:x?c+x:c},"data-code-block":!0,"data-language":t,...a})]})})]})})},jL={"1c":`1c`,"1c-query":`1cq`,abap:`abap`,"actionscript-3":`as`,ada:`ada`,adoc:`adoc`,"angular-html":`html`,"angular-ts":`ts`,apache:`conf`,apex:`cls`,apl:`apl`,applescript:`applescript`,ara:`ara`,asciidoc:`adoc`,asm:`asm`,astro:`astro`,awk:`awk`,ballerina:`bal`,bash:`sh`,bat:`bat`,batch:`bat`,be:`be`,beancount:`beancount`,berry:`berry`,bibtex:`bib`,bicep:`bicep`,blade:`blade.php`,bsl:`bsl`,c:`c`,"c#":`cs`,"c++":`cpp`,cadence:`cdc`,cairo:`cairo`,cdc:`cdc`,clarity:`clar`,clj:`clj`,clojure:`clj`,"closure-templates":`soy`,cmake:`cmake`,cmd:`cmd`,cobol:`cob`,codeowners:`CODEOWNERS`,codeql:`ql`,coffee:`coffee`,coffeescript:`coffee`,"common-lisp":`lisp`,console:`sh`,coq:`v`,cpp:`cpp`,cql:`cql`,crystal:`cr`,cs:`cs`,csharp:`cs`,css:`css`,csv:`csv`,cue:`cue`,cypher:`cql`,d:`d`,dart:`dart`,dax:`dax`,desktop:`desktop`,diff:`diff`,docker:`dockerfile`,dockerfile:`dockerfile`,dotenv:`env`,"dream-maker":`dm`,edge:`edge`,elisp:`el`,elixir:`ex`,elm:`elm`,"emacs-lisp":`el`,erb:`erb`,erl:`erl`,erlang:`erl`,f:`f`,"f#":`fs`,f03:`f03`,f08:`f08`,f18:`f18`,f77:`f77`,f90:`f90`,f95:`f95`,fennel:`fnl`,fish:`fish`,fluent:`ftl`,for:`for`,"fortran-fixed-form":`f`,"fortran-free-form":`f90`,fs:`fs`,fsharp:`fs`,fsl:`fsl`,ftl:`ftl`,gdresource:`tres`,gdscript:`gd`,gdshader:`gdshader`,genie:`gs`,gherkin:`feature`,"git-commit":`gitcommit`,"git-rebase":`gitrebase`,gjs:`js`,gleam:`gleam`,"glimmer-js":`js`,"glimmer-ts":`ts`,glsl:`glsl`,gnuplot:`plt`,go:`go`,gql:`gql`,graphql:`graphql`,groovy:`groovy`,gts:`gts`,hack:`hack`,haml:`haml`,handlebars:`hbs`,haskell:`hs`,haxe:`hx`,hbs:`hbs`,hcl:`hcl`,hjson:`hjson`,hlsl:`hlsl`,hs:`hs`,html:`html`,"html-derivative":`html`,http:`http`,hxml:`hxml`,hy:`hy`,imba:`imba`,ini:`ini`,jade:`jade`,java:`java`,javascript:`js`,jinja:`jinja`,jison:`jison`,jl:`jl`,js:`js`,json:`json`,json5:`json5`,jsonc:`jsonc`,jsonl:`jsonl`,jsonnet:`jsonnet`,jssm:`jssm`,jsx:`jsx`,julia:`jl`,kotlin:`kt`,kql:`kql`,kt:`kt`,kts:`kts`,kusto:`kql`,latex:`tex`,lean:`lean`,lean4:`lean`,less:`less`,liquid:`liquid`,lisp:`lisp`,lit:`lit`,llvm:`ll`,log:`log`,logo:`logo`,lua:`lua`,luau:`luau`,make:`mak`,makefile:`mak`,markdown:`md`,marko:`marko`,matlab:`m`,md:`md`,mdc:`mdc`,mdx:`mdx`,mediawiki:`wiki`,mermaid:`mmd`,mips:`s`,mipsasm:`s`,mmd:`mmd`,mojo:`mojo`,move:`move`,nar:`nar`,narrat:`narrat`,nextflow:`nf`,nf:`nf`,nginx:`conf`,nim:`nim`,nix:`nix`,nu:`nu`,nushell:`nu`,objc:`m`,"objective-c":`m`,"objective-cpp":`mm`,ocaml:`ml`,pascal:`pas`,perl:`pl`,perl6:`p6`,php:`php`,plsql:`pls`,po:`po`,polar:`polar`,postcss:`pcss`,pot:`pot`,potx:`potx`,powerquery:`pq`,powershell:`ps1`,prisma:`prisma`,prolog:`pl`,properties:`properties`,proto:`proto`,protobuf:`proto`,ps:`ps`,ps1:`ps1`,pug:`pug`,puppet:`pp`,purescript:`purs`,py:`py`,python:`py`,ql:`ql`,qml:`qml`,qmldir:`qmldir`,qss:`qss`,r:`r`,racket:`rkt`,raku:`raku`,razor:`cshtml`,rb:`rb`,reg:`reg`,regex:`regex`,regexp:`regexp`,rel:`rel`,riscv:`s`,rs:`rs`,rst:`rst`,ruby:`rb`,rust:`rs`,sas:`sas`,sass:`sass`,scala:`scala`,scheme:`scm`,scss:`scss`,sdbl:`sdbl`,sh:`sh`,shader:`shader`,shaderlab:`shader`,shell:`sh`,shellscript:`sh`,shellsession:`sh`,smalltalk:`st`,solidity:`sol`,soy:`soy`,sparql:`rq`,spl:`spl`,splunk:`spl`,sql:`sql`,"ssh-config":`config`,stata:`do`,styl:`styl`,stylus:`styl`,svelte:`svelte`,swift:`swift`,"system-verilog":`sv`,systemd:`service`,talon:`talon`,talonscript:`talon`,tasl:`tasl`,tcl:`tcl`,templ:`templ`,terraform:`tf`,tex:`tex`,tf:`tf`,tfvars:`tfvars`,toml:`toml`,ts:`ts`,"ts-tags":`ts`,tsp:`tsp`,tsv:`tsv`,tsx:`tsx`,turtle:`ttl`,twig:`twig`,typ:`typ`,typescript:`ts`,typespec:`tsp`,typst:`typ`,v:`v`,vala:`vala`,vb:`vb`,verilog:`v`,vhdl:`vhdl`,vim:`vim`,viml:`vim`,vimscript:`vim`,vue:`vue`,"vue-html":`html`,"vue-vine":`vine`,vy:`vy`,vyper:`vy`,wasm:`wasm`,wenyan:`wy`,wgsl:`wgsl`,wiki:`wiki`,wikitext:`wiki`,wit:`wit`,wl:`wl`,wolfram:`wl`,xml:`xml`,xsl:`xsl`,yaml:`yaml`,yml:`yml`,zenscript:`zs`,zig:`zig`,zsh:`zsh`,文言:`wy`},ML=({onDownload:e,onError:t,language:n,children:r,className:i,code:a,...o})=>{let{code:s}=(0,U.useContext)(CL),{isAnimating:c}=(0,U.useContext)(pz),l=a??s,u=`file.${n&&n in jL?jL[n]:`txt`}`;return(0,W.jsx)(`button`,{className:xL(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,i),disabled:c,onClick:()=>{try{SL(u,l,`text/plain`),e?.()}catch(e){t?.(e)}},title:`Download file`,type:`button`,...o,children:r??(0,W.jsx)(BT,{size:14})})},NL=({onCopy:e,onError:t,timeout:n=2e3,children:r,className:i,code:a,...o})=>{let[s,c]=(0,U.useState)(!1),l=(0,U.useRef)(0),{code:u}=(0,U.useContext)(CL),{isAnimating:d}=(0,U.useContext)(pz),f=a??u,p=async()=>{var r;if(typeof window>`u`||!((r=navigator==null?void 0:navigator.clipboard)!=null&&r.writeText)){t?.(Error(`Clipboard API not available`));return}try{s||(await navigator.clipboard.writeText(f),c(!0),e?.(),l.current=window.setTimeout(()=>c(!1),n))}catch(e){t?.(e)}};(0,U.useEffect)(()=>()=>{window.clearTimeout(l.current)},[]);let m=s?RT:zT;return(0,W.jsx)(`button`,{className:xL(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,i),disabled:d,onClick:p,type:`button`,...o,children:r??(0,W.jsx)(m,{size:14})})},PL=/\.[^/.]+$/,FL=({node:e,className:t,src:n,alt:r,...i})=>{let a=async()=>{if(n)try{let e=await(await fetch(n)).blob(),t=new URL(n,window.location.origin).pathname.split(`/`).pop()||``,i=t.split(`.`).pop(),a=t.includes(`.`)&&i!==void 0&&i.length<=4,o=``;if(a)o=t;else{let n=e.type,i=`png`;n.includes(`jpeg`)||n.includes(`jpg`)?i=`jpg`:n.includes(`png`)?i=`png`:n.includes(`svg`)?i=`svg`:n.includes(`gif`)?i=`gif`:n.includes(`webp`)&&(i=`webp`),o=`${(r||t||`image`).replace(PL,``)}.${i}`}SL(o,e,e.type)}catch(e){console.error(`Failed to download image:`,e)}};return n?(0,W.jsxs)(`div`,{className:`group relative my-4 inline-block`,"data-streamdown":`image-wrapper`,children:[(0,W.jsx)(`img`,{alt:r,className:xL(`max-w-full rounded-lg`,t),"data-streamdown":`image`,src:n,...i}),(0,W.jsx)(`div`,{className:`pointer-events-none absolute inset-0 hidden rounded-lg bg-black/10 group-hover:block`}),(0,W.jsx)(`button`,{className:xL(`absolute right-2 bottom-2 flex h-8 w-8 cursor-pointer items-center justify-center rounded-md border border-border bg-background/90 shadow-sm backdrop-blur-sm transition-all duration-200 hover:bg-background`,`opacity-0 group-hover:opacity-100`),onClick:a,title:`Download image`,type:`button`,children:(0,W.jsx)(BT,{size:14})})]}):null},IL=0,LL=()=>{IL+=1,IL===1&&(document.body.style.overflow=`hidden`)},RL=()=>{IL=Math.max(0,IL-1),IL===0&&(document.body.style.overflow=``)},zL=async e=>{let t={startOnLoad:!1,theme:`default`,securityLevel:`strict`,fontFamily:`monospace`,suppressErrorRendering:!0,...e},n=(await H(async()=>{let{default:e}=await import(`./mermaid.core-D6GS9mU-.js`);return{default:e}},__vite__mapDeps([102,2,1,3,4,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124]))).default;return n.initialize(t),n},BL=({chart:e,config:t,onFullscreen:n,onExit:r,className:i,...a})=>{let[o,s]=(0,U.useState)(!1),{isAnimating:c}=(0,U.useContext)(pz),l=()=>{s(!o)};return(0,U.useEffect)(()=>{if(o){LL();let e=e=>{e.key===`Escape`&&s(!1)};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e),RL()}}},[o]),(0,U.useEffect)(()=>{o?n?.():r&&r()},[o,n,r]),(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`button`,{className:xL(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,i),disabled:c,onClick:l,title:`View fullscreen`,type:`button`,...a,children:(0,W.jsx)(VT,{size:14})}),o&&(0,W.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-background/95 backdrop-blur-sm`,onClick:l,onKeyDown:e=>{e.key===`Escape`&&l()},role:`button`,tabIndex:0,children:[(0,W.jsx)(`button`,{className:`absolute top-4 right-4 z-10 rounded-md p-2 text-muted-foreground transition-all hover:bg-muted hover:text-foreground`,onClick:l,title:`Exit fullscreen`,type:`button`,children:(0,W.jsx)(HT,{size:20})}),(0,W.jsx)(`div`,{className:`flex h-full w-full items-center justify-center p-12`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),role:`presentation`,children:(0,W.jsx)(`div`,{className:`max-h-full max-w-full`,children:(0,W.jsx)(VL,{chart:e,className:`[&>div]:my-0 [&_svg]:h-auto [&_svg]:min-h-[60vh] [&_svg]:w-auto [&_svg]:min-w-[60vw]`,config:t})})})]})]})},VL=({chart:e,className:t,config:n})=>{let[r,i]=(0,U.useState)(null),[a,o]=(0,U.useState)(!0),[s,c]=(0,U.useState)(``),[l,u]=(0,U.useState)(``);if((0,U.useEffect)(()=>{(async()=>{try{i(null),o(!0);let t=await zL(n),r=e.split(``).reduce((e,t)=>(e<<5)-e+t.charCodeAt(0)|0,0),a=`mermaid-${Math.abs(r)}-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,{svg:s}=await t.render(a,e);c(s),u(s)}catch(e){l||s||i(e instanceof Error?e.message:`Failed to render Mermaid chart`)}finally{o(!1)}})()},[e,n]),a&&!s&&!l)return(0,W.jsx)(`div`,{className:xL(`my-4 flex justify-center p-4`,t),children:(0,W.jsxs)(`div`,{className:`flex items-center space-x-2 text-muted-foreground`,children:[(0,W.jsx)(`div`,{className:`h-4 w-4 animate-spin rounded-full border-current border-b-2`}),(0,W.jsx)(`span`,{className:`text-sm`,children:`Loading diagram...`})]})});if(r&&!s&&!l)return(0,W.jsxs)(`div`,{className:xL(`rounded-lg border border-red-200 bg-red-50 p-4`,t),children:[(0,W.jsxs)(`p`,{className:`font-mono text-red-700 text-sm`,children:[`Mermaid Error: `,r]}),(0,W.jsxs)(`details`,{className:`mt-2`,children:[(0,W.jsx)(`summary`,{className:`cursor-pointer text-red-600 text-xs`,children:`Show Code`}),(0,W.jsx)(`pre`,{className:`mt-2 overflow-x-auto rounded bg-red-100 p-2 text-red-800 text-xs`,children:e})]})]});let d=s||l;return(0,W.jsx)(`div`,{"aria-label":`Mermaid chart`,className:xL(`my-4 flex justify-center`,t),dangerouslySetInnerHTML:{__html:d},role:`img`})};function HL(e){let t=[],n=[],r=e.querySelectorAll(`thead th`);for(let e of r)t.push(e.textContent?.trim()||``);let i=e.querySelectorAll(`tbody tr`);for(let e of i){let t=[],r=e.querySelectorAll(`td`);for(let e of r)t.push(e.textContent?.trim()||``);n.push(t)}return{headers:t,rows:n}}function UL(e){let{headers:t,rows:n}=e,r=e=>e.includes(`,`)||e.includes(`"`)||e.includes(`
|
|
267
|
+
`)?`"${e.replace(/"/g,`""`)}"`:e,i=[];t.length>0&&i.push(t.map(r).join(`,`));for(let e of n)i.push(e.map(r).join(`,`));return i.join(`
|
|
268
|
+
`)}function WL(e){let{headers:t,rows:n}=e,r=e=>e.replace(/\t/g,`\\t`).replace(/\n/g,`\\n`).replace(/\r/g,`\\r`),i=[];t.length>0&&i.push(t.map(r).join(` `));for(let e of n)i.push(e.map(r).join(` `));return i.join(`
|
|
269
|
+
`)}function GL(e){let{headers:t,rows:n}=e;if(t.length===0)return``;let r=[],i=t.map(e=>e.replace(/\|/g,`\\|`));r.push(`| ${i.join(` | `)} |`),r.push(`| ${t.map(()=>`---`).join(` | `)} |`);for(let e of n){let n=[...e];for(;n.length<t.length;)n.push(``);let i=n.map(e=>e.replace(/\|/g,`\\|`));r.push(`| ${i.join(` | `)} |`)}return r.join(`
|
|
270
|
+
`)}var KL=({children:e,className:t,onCopy:n,onError:r,timeout:i=2e3})=>{let[a,o]=(0,U.useState)(!1),[s,c]=(0,U.useState)(!1),l=(0,U.useRef)(null),u=(0,U.useRef)(0),{isAnimating:d}=(0,U.useContext)(pz),f=async e=>{var t;if(typeof window>`u`||!((t=navigator==null?void 0:navigator.clipboard)!=null&&t.write)){r?.(Error(`Clipboard API not available`));return}try{let t=(l.current?.closest(`[data-streamdown="table-wrapper"]`))?.querySelector(`table`);if(!t){r?.(Error(`Table not found`));return}let a=HL(t),s=e===`csv`?UL(a):WL(a),d=new ClipboardItem({"text/plain":new Blob([s],{type:`text/plain`}),"text/html":new Blob([t.outerHTML],{type:`text/html`})});await navigator.clipboard.write([d]),c(!0),o(!1),n?.(e),u.current=window.setTimeout(()=>c(!1),i)}catch(e){r?.(e)}};(0,U.useEffect)(()=>{let e=e=>{l.current&&!l.current.contains(e.target)&&o(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e),window.clearTimeout(u.current)}},[]);let p=s?RT:zT;return(0,W.jsxs)(`div`,{className:`relative`,ref:l,children:[(0,W.jsx)(`button`,{className:xL(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:d,onClick:()=>o(!a),title:`Copy table`,type:`button`,children:e??(0,W.jsx)(p,{size:14})}),a&&(0,W.jsxs)(`div`,{className:`absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg`,children:[(0,W.jsx)(`button`,{className:`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`,onClick:()=>f(`csv`),type:`button`,children:`CSV`}),(0,W.jsx)(`button`,{className:`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`,onClick:()=>f(`tsv`),type:`button`,children:`TSV`})]})]})},qL=({children:e,className:t,onDownload:n,onError:r})=>{let[i,a]=(0,U.useState)(!1),o=(0,U.useRef)(null),{isAnimating:s}=(0,U.useContext)(pz),c=e=>{try{let t=(o.current?.closest(`[data-streamdown="table-wrapper"]`))?.querySelector(`table`);if(!t){r?.(Error(`Table not found`));return}let i=HL(t),s=e===`csv`?UL(i):GL(i);SL(`table.${e===`csv`?`csv`:`md`}`,s,e===`csv`?`text/csv`:`text/markdown`),a(!1),n?.(e)}catch(e){r?.(e)}};return(0,U.useEffect)(()=>{let e=e=>{o.current&&!o.current.contains(e.target)&&a(!1)};return document.addEventListener(`mousedown`,e),()=>{document.removeEventListener(`mousedown`,e)}},[]),(0,W.jsxs)(`div`,{className:`relative`,ref:o,children:[(0,W.jsx)(`button`,{className:xL(`cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,t),disabled:s,onClick:()=>a(!i),title:`Download table`,type:`button`,children:e??(0,W.jsx)(BT,{size:14})}),i&&(0,W.jsxs)(`div`,{className:`absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg`,children:[(0,W.jsx)(`button`,{className:`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`,onClick:()=>c(`csv`),type:`button`,children:`CSV`}),(0,W.jsx)(`button`,{className:`w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40`,onClick:()=>c(`markdown`),type:`button`,children:`Markdown`})]})]})},JL=/language-([^\s]+)/;function YL(e,t){if(!(e!=null&&e.position||t!=null&&t.position))return!0;if(!(e!=null&&e.position&&t!=null&&t.position))return!1;let n=e.position.start,r=t.position.start,i=e.position.end,a=t.position.end;return n?.line===r?.line&&n?.column===r?.column&&i?.line===a?.line&&i?.column===a?.column}function XL(e,t){return e.className===t.className&&YL(e.node,t.node)}var ZL=(e,t)=>typeof e==`boolean`?e:e[t]!==!1,QL=(e,t)=>{if(typeof e==`boolean`)return e;let n=e.mermaid;return n===!1?!1:n===!0||n===void 0?!0:n[t]!==!1},$L=(0,U.memo)(({children:e,className:t,node:n,...r})=>(0,W.jsx)(`ol`,{className:xL(`ml-4 list-outside list-decimal whitespace-normal`,t),"data-streamdown":`ordered-list`,...r,children:e}),(e,t)=>XL(e,t));$L.displayName=`MarkdownOl`;var eR=(0,U.memo)(({children:e,className:t,node:n,...r})=>(0,W.jsx)(`li`,{className:xL(`py-1`,t),"data-streamdown":`list-item`,...r,children:e}),(e,t)=>e.className===t.className&&YL(e.node,t.node));eR.displayName=`MarkdownLi`;var tR=(0,U.memo)(({children:e,className:t,node:n,...r})=>(0,W.jsx)(`ul`,{className:xL(`ml-4 list-outside list-disc whitespace-normal`,t),"data-streamdown":`unordered-list`,...r,children:e}),(e,t)=>XL(e,t));tR.displayName=`MarkdownUl`;var nR=(0,U.memo)(({className:e,node:t,...n})=>(0,W.jsx)(`hr`,{className:xL(`my-6 border-border`,e),"data-streamdown":`horizontal-rule`,...n}),(e,t)=>XL(e,t));nR.displayName=`MarkdownHr`;var rR=(0,U.memo)(({children:e,className:t,node:n,...r})=>(0,W.jsx)(`span`,{className:xL(`font-semibold`,t),"data-streamdown":`strong`,...r,children:e}),(e,t)=>XL(e,t));rR.displayName=`MarkdownStrong`;var iR=(0,U.memo)(({children:e,className:t,href:n,node:r,...i})=>{let a=n===`streamdown:incomplete-link`;return(0,W.jsx)(`a`,{className:xL(`wrap-anywhere font-medium text-primary underline`,t),"data-incomplete":a,"data-streamdown":`link`,href:n,rel:`noreferrer`,target:`_blank`,...i,children:e})},(e,t)=>XL(e,t)&&e.href===t.href);iR.displayName=`MarkdownA`;var aR=(0,U.memo)(({children:e,className:t,node:n,...r})=>(0,W.jsx)(`h1`,{className:xL(`mt-6 mb-2 font-semibold text-3xl`,t),"data-streamdown":`heading-1`,...r,children:e}),(e,t)=>XL(e,t));aR.displayName=`MarkdownH1`;var oR=(0,U.memo)(({children:e,className:t,node:n,...r})=>(0,W.jsx)(`h2`,{className:xL(`mt-6 mb-2 font-semibold text-2xl`,t),"data-streamdown":`heading-2`,...r,children:e}),(e,t)=>XL(e,t));oR.displayName=`MarkdownH2`;var sR=(0,U.memo)(({children:e,className:t,node:n,...r})=>(0,W.jsx)(`h3`,{className:xL(`mt-6 mb-2 font-semibold text-xl`,t),"data-streamdown":`heading-3`,...r,children:e}),(e,t)=>XL(e,t));sR.displayName=`MarkdownH3`;var cR=(0,U.memo)(({children:e,className:t,node:n,...r})=>(0,W.jsx)(`h4`,{className:xL(`mt-6 mb-2 font-semibold text-lg`,t),"data-streamdown":`heading-4`,...r,children:e}),(e,t)=>XL(e,t));cR.displayName=`MarkdownH4`;var lR=(0,U.memo)(({children:e,className:t,node:n,...r})=>(0,W.jsx)(`h5`,{className:xL(`mt-6 mb-2 font-semibold text-base`,t),"data-streamdown":`heading-5`,...r,children:e}),(e,t)=>XL(e,t));lR.displayName=`MarkdownH5`;var uR=(0,U.memo)(({children:e,className:t,node:n,...r})=>(0,W.jsx)(`h6`,{className:xL(`mt-6 mb-2 font-semibold text-sm`,t),"data-streamdown":`heading-6`,...r,children:e}),(e,t)=>XL(e,t));uR.displayName=`MarkdownH6`;var dR=(0,U.memo)(({children:e,className:t,node:n,...r})=>(0,W.jsxs)(`div`,{className:`my-4 flex flex-col space-y-2`,"data-streamdown":`table-wrapper`,children:[ZL((0,U.useContext)(fz),`table`)&&(0,W.jsxs)(`div`,{className:`flex items-center justify-end gap-1`,children:[(0,W.jsx)(KL,{}),(0,W.jsx)(qL,{})]}),(0,W.jsx)(`div`,{className:`overflow-x-auto`,children:(0,W.jsx)(`table`,{className:xL(`w-full border-collapse border border-border`,t),"data-streamdown":`table`,...r,children:e})})]}),(e,t)=>XL(e,t));dR.displayName=`MarkdownTable`;var fR=(0,U.memo)(({children:e,className:t,node:n,...r})=>(0,W.jsx)(`thead`,{className:xL(`bg-muted/80`,t),"data-streamdown":`table-header`,...r,children:e}),(e,t)=>XL(e,t));fR.displayName=`MarkdownThead`;var pR=(0,U.memo)(({children:e,className:t,node:n,...r})=>(0,W.jsx)(`tbody`,{className:xL(`divide-y divide-border bg-muted/40`,t),"data-streamdown":`table-body`,...r,children:e}),(e,t)=>XL(e,t));pR.displayName=`MarkdownTbody`;var mR=(0,U.memo)(({children:e,className:t,node:n,...r})=>(0,W.jsx)(`tr`,{className:xL(`border-border border-b`,t),"data-streamdown":`table-row`,...r,children:e}),(e,t)=>XL(e,t));mR.displayName=`MarkdownTr`;var hR=(0,U.memo)(({children:e,className:t,node:n,...r})=>(0,W.jsx)(`th`,{className:xL(`whitespace-nowrap px-4 py-2 text-left font-semibold text-sm`,t),"data-streamdown":`table-header-cell`,...r,children:e}),(e,t)=>XL(e,t));hR.displayName=`MarkdownTh`;var gR=(0,U.memo)(({children:e,className:t,node:n,...r})=>(0,W.jsx)(`td`,{className:xL(`px-4 py-2 text-sm`,t),"data-streamdown":`table-cell`,...r,children:e}),(e,t)=>XL(e,t));gR.displayName=`MarkdownTd`;var _R=(0,U.memo)(({children:e,className:t,node:n,...r})=>(0,W.jsx)(`blockquote`,{className:xL(`my-4 border-muted-foreground/30 border-l-4 pl-4 text-muted-foreground italic`,t),"data-streamdown":`blockquote`,...r,children:e}),(e,t)=>XL(e,t));_R.displayName=`MarkdownBlockquote`;var vR=(0,U.memo)(({children:e,className:t,node:n,...r})=>(0,W.jsx)(`sup`,{className:xL(`text-sm`,t),"data-streamdown":`superscript`,...r,children:e}),(e,t)=>XL(e,t));vR.displayName=`MarkdownSup`;var yR=(0,U.memo)(({children:e,className:t,node:n,...r})=>(0,W.jsx)(`sub`,{className:xL(`text-sm`,t),"data-streamdown":`subscript`,...r,children:e}),(e,t)=>XL(e,t));yR.displayName=`MarkdownSub`;var bR=(0,U.memo)(({children:e,className:t,node:n,...r})=>{if(`data-footnotes`in r){let n=e=>{if(!(0,U.isValidElement)(e))return!1;let t=Array.isArray(e.props.children)?e.props.children:[e.props.children],n=!1,r=!1;for(let e of t)if(e){if(typeof e==`string`)e.trim()!==``&&(n=!0);else if((0,U.isValidElement)(e))if(e.props?.[`data-footnote-backref`]!==void 0)r=!0;else{let t=Array.isArray(e.props.children)?e.props.children:[e.props.children];for(let e of t){if(typeof e==`string`&&e.trim()!==``){n=!0;break}if((0,U.isValidElement)(e)&&e.props?.[`data-footnote-backref`]===void 0){n=!0;break}}}}return r&&!n},i=Array.isArray(e)?e.map(e=>{if(!(0,U.isValidElement)(e))return e;if(e.type===$L){let t=(Array.isArray(e.props.children)?e.props.children:[e.props.children]).filter(e=>!n(e));return t.length===0?null:{...e,props:{...e.props,children:t}}}return e}):e;return(Array.isArray(i)?i.some(e=>e!==null):i!==null)?(0,W.jsx)(`section`,{className:t,...r,children:i}):null}return(0,W.jsx)(`section`,{className:t,...r,children:e})},(e,t)=>XL(e,t));bR.displayName=`MarkdownSection`;var xR=(0,U.memo)(({node:e,className:t,children:n,...r})=>{let i=(e?.position)?.start.line===(e?.position)?.end.line,a=(0,U.useContext)(dz),o=(0,U.useContext)(fz);if(i)return(0,W.jsx)(`code`,{className:xL(`rounded bg-muted px-1.5 py-0.5 font-mono text-sm`,t),"data-streamdown":`inline-code`,...r,children:n});let s=(t?.match(JL))?.at(1)??``,c=``;if((0,U.isValidElement)(n)&&n.props&&typeof n.props==`object`&&`children`in n.props&&typeof n.props.children==`string`?c=n.props.children:typeof n==`string`&&(c=n),s===`mermaid`){let e=ZL(o,`mermaid`),n=QL(o,`download`),r=QL(o,`copy`),i=QL(o,`fullscreen`);return(0,W.jsxs)(`div`,{className:xL(`group relative my-4 h-auto rounded-xl border p-4`,t),"data-streamdown":`mermaid-block`,children:[e&&(n||r||i)&&(0,W.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[n&&(0,W.jsx)(ML,{code:c,language:s}),r&&(0,W.jsx)(NL,{code:c}),i&&(0,W.jsx)(BL,{chart:c,config:a})]}),(0,W.jsx)(VL,{chart:c,config:a})]})}let l=ZL(o,`code`);return(0,W.jsx)(AL,{className:xL(`overflow-x-auto border-border border-t`,t),code:c,"data-language":s,"data-streamdown":`code-block`,language:s,preClassName:`overflow-x-auto font-mono text-xs p-4 bg-muted/40`,children:l&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(ML,{code:c,language:s}),(0,W.jsx)(NL,{})]})})},(e,t)=>e.className===t.className&&YL(e.node,t.node));xR.displayName=`MarkdownCode`;var SR=(0,U.memo)(FL,(e,t)=>e.className===t.className&&YL(e.node,t.node));SR.displayName=`MarkdownImg`;var CR=(0,U.memo)(({children:e,className:t,node:n,...r})=>{let i=(Array.isArray(e)?e:[e]).filter(e=>e!=null&&e!==``);return i.length===1&&(0,U.isValidElement)(i[0])&&i[0].props.node?.tagName===`img`?(0,W.jsx)(W.Fragment,{children:e}):(0,W.jsx)(`p`,{className:t,...r,children:e})},(e,t)=>XL(e,t));CR.displayName=`MarkdownParagraph`;var wR={ol:$L,li:eR,ul:tR,hr:nR,strong:rR,a:iR,h1:aR,h2:oR,h3:sR,h4:cR,h5:lR,h6:uR,table:dR,thead:fR,tbody:pR,tr:mR,th:hR,td:gR,blockquote:_R,code:xR,img:SR,pre:({children:e})=>e,sup:vR,sub:yR,p:CR,section:bR},TR=/\[\^[^\]\s]{1,200}\](?!:)/,ER=/\[\^[^\]\s]{1,200}\]:/,DR=/<\/(\w+)>/,OR=/<(\w+)[\s>]/,kR=e=>{let t=TR.test(e),n=ER.test(e);if(t||n)return[e];let r=mL.lex(e,{gfm:!0}),i=[],a=[];for(let e of r){let t=e.raw;if(a.length>0){if(i[i.length-1]+=t,e.type===`html`){let e=t.match(DR);if(e){let t=e[1];a.at(-1)===t&&a.pop()}}continue}if(e.type===`html`&&e.block){let e=t.match(OR);if(e){let n=e[1];t.includes(`</${n}>`)||a.push(n)}}if(t.trim()===`$$`&&i.length>0){let e=i.at(-1);if(!e){i.push(t);continue}let n=e.trimStart().startsWith(`$$`),r=(e.match(/\$\$/g)||[]).length;if(n&&r%2==1){i[i.length-1]=e+t;continue}}if(i.length>0&&t.trimEnd().endsWith(`$$`)){let e=i.at(-1);if(!e){i.push(t);continue}let n=e.trimStart().startsWith(`$$`),r=(e.match(/\$\$/g)||[]).length,a=(t.match(/\$\$/g)||[]).length;if(n&&r%2==1&&!t.trimStart().startsWith(`$$`)&&a===1){i[i.length-1]=e+t;continue}}i.push(t)}return i},AR=/(!?\[)([^\]]*?)$/,jR=/(\*\*)([^*]*?)$/,MR=/(__)([^_]*?)$/,NR=/(\*\*\*)([^*]*?)$/,PR=/(\*)([^*]*?)$/,FR=/(_)([^_]*?)$/,IR=/(`)([^`]*?)$/,LR=/(~~)([^~]*?)$/,RR=/(!?)\[([^\]]+)\]\(([^)]+)$/,zR=/^[\s_~*`]*$/,BR=/^[\s]*[-*+][\s]+$/,VR=/[\p{L}\p{N}_]/u,HR=/\n+$/,UR=/^```[^`\n]*```?$/,WR=/^\*{4,}$/,GR=e=>{let t=(e.match(/```/g)||[]).length;return t>0&&t%2==0&&e.includes(`
|
|
271
|
+
`)},KR=e=>{let t=e.match(RR);if(t){let n=t[1]===`!`,r=t[2],i=t[3],a=e.lastIndexOf(`${n?`!`:``}[${r}](${i}`),o=e.substring(0,a);return n?o:`${o}[${r}](streamdown:incomplete-link)`}let n=e.match(AR);if(n){if(n[1].startsWith(`!`)){let t=e.lastIndexOf(n[1]);return e.substring(0,t)}return`${e}](streamdown:incomplete-link)`}return e},qR=e=>{if(GR(e))return e;let t=e.match(jR);if(t){let n=t[2];if(!n||zR.test(n))return e;let r=e.lastIndexOf(t[1]),i=e.substring(0,r).lastIndexOf(`
|
|
272
|
+
`),a=i===-1?0:i+1,o=e.substring(a,r);if(BR.test(o)&&n.includes(`
|
|
273
|
+
`))return e;if((e.match(/\*\*/g)||[]).length%2==1)return`${e}**`}return e},JR=e=>{let t=e.match(MR);if(t){let n=t[2];if(!n||zR.test(n))return e;let r=e.lastIndexOf(t[1]),i=e.substring(0,r).lastIndexOf(`
|
|
274
|
+
`),a=i===-1?0:i+1,o=e.substring(a,r);if(BR.test(o)&&n.includes(`
|
|
275
|
+
`))return e;if((e.match(/__/g)||[]).length%2==1)return`${e}__`}return e},YR=e=>e.split(``).reduce((t,n,r)=>{if(n===`*`){let n=e[r-1],i=e[r+1];if(n===`\\`||n&&i&&VR.test(n)&&VR.test(i))return t;let a=r;for(let t=r-1;t>=0;t--){if(e[t]===`
|
|
276
|
+
`){a=t+1;break}if(t===0){a=0;break}}if(e.substring(a,r).trim()===``&&(i===` `||i===` `))return t;if(n!==`*`&&i!==`*`)return t+1}return t},0),XR=e=>{if(GR(e))return e;if(e.match(PR)){let t=-1;for(let n=0;n<e.length;n++)if(e[n]===`*`&&e[n-1]!==`*`&&e[n+1]!==`*`&&e[n-1]!==`\\`){let r=n>0?e[n-1]:``,i=n<e.length-1?e[n+1]:``;if(r&&i&&VR.test(r)&&VR.test(i))continue;t=n;break}if(t===-1)return e;let n=e.substring(t+1);if(!n||zR.test(n))return e;if(YR(e)%2==1)return`${e}*`}return e},ZR=(e,t)=>{let n=!1,r=!1;for(let i=0;i<e.length&&i<t;i+=1){if(e[i]===`\\`&&e[i+1]===`$`){i+=1;continue}e[i]===`$`&&(e[i+1]===`$`?(r=!r,i+=1,n=!1):r||(n=!n))}return n||r},QR=e=>e.split(``).reduce((t,n,r)=>{if(n===`_`){let n=e[r-1],i=e[r+1];if(n===`\\`||ZR(e,r)||n&&i&&VR.test(n)&&VR.test(i))return t;if(n!==`_`&&i!==`_`)return t+1}return t},0),$R=e=>{if(GR(e))return e;if(e.match(FR)){let t=-1;for(let n=0;n<e.length;n++)if(e[n]===`_`&&e[n-1]!==`_`&&e[n+1]!==`_`&&e[n-1]!==`\\`&&!ZR(e,n)){let r=n>0?e[n-1]:``,i=n<e.length-1?e[n+1]:``;if(r&&i&&VR.test(r)&&VR.test(i))continue;t=n;break}if(t===-1)return e;let n=e.substring(t+1);if(!n||zR.test(n))return e;if(QR(e)%2==1){let t=e.match(HR);return t?`${e.slice(0,-t[0].length)}_${t[0]}`:`${e}_`}}return e},ez=(e,t)=>{let n=e.substring(t,t+3)==="```",r=t>0&&e.substring(t-1,t+2)==="```",i=t>1&&e.substring(t-2,t+1)==="```";return n||r||i},tz=e=>{let t=0;for(let n=0;n<e.length;n+=1)e[n]==="`"&&!ez(e,n)&&(t+=1);return t},nz=e=>{if(e.match(UR)&&!e.includes(`
|
|
277
|
+
`))return e.endsWith("``")&&!e.endsWith("```")?`${e}\``:e;let t=(e.match(/```/g)||[]).length,n=t%2==1;if(t>0&&t%2==0&&e.includes(`
|
|
278
|
+
`)||(e.endsWith("```\n")||e.endsWith("```"))&&t%2==0)return e;let r=e.match(IR);if(r&&!n){let t=r[2];if(!t||zR.test(t))return e;if(tz(e)%2==1)return`${e}\``}return e},rz=e=>{let t=e.match(LR);if(t){let n=t[2];if(!n||zR.test(n))return e;if((e.match(/~~/g)||[]).length%2==1)return`${e}~~`}return e},iz=e=>{if((e.match(/\$\$/g)||[]).length%2==0)return e;let t=e.indexOf(`$$`);return t!==-1&&e.indexOf(`
|
|
279
|
+
`,t)!==-1&&!e.endsWith(`
|
|
280
|
+
`)?`${e}
|
|
281
|
+
$$`:`${e}$$`},az=e=>{let t=0,n=e.match(/\*+/g)||[];for(let e of n){let n=e.length;n>=3&&(t+=Math.floor(n/3))}return t},oz=e=>{if(GR(e)||WR.test(e))return e;let t=e.match(NR);if(t){let n=t[2];if(!n||zR.test(n))return e;if(az(e)%2==1)return`${e}***`}return e},sz=e=>{if(!e||typeof e!=`string`)return e;let t=e,n=KR(t);return n.endsWith(`](streamdown:incomplete-link)`)?n:(t=n,t=oz(t),t=qR(t),t=JR(t),t=XR(t),t=$R(t),t=nz(t),t=rz(t),t=iz(t),t)},cz={harden:[Xm,{allowedImagePrefixes:[`*`],allowedLinkPrefixes:[`*`],defaultOrigin:void 0,allowDataImages:!0}],raw:Dx,katex:[ub,{errorColor:`var(--color-muted-foreground)`}]},lz={gfm:[_T,{}],math:[kT,{singleDollarTextMath:!1}],cjkFriendly:[hS,{}],cjkFriendlyGfmStrikethrough:[_S,{}]},uz=(0,U.createContext)([`github-light`,`github-dark`]),dz=(0,U.createContext)(void 0),fz=(0,U.createContext)(!0),pz=(0,U.createContext)({isAnimating:!1}),mz=(0,U.memo)(({content:e,shouldParseIncompleteMarkdown:t,...n})=>{let r=(0,U.useMemo)(()=>typeof e==`string`&&t?sz(e.trim()):e,[e,t]);return(0,W.jsx)(Gm,{...n,children:r})},(e,t)=>e.content===t.content);mz.displayName=`Block`;var hz=[`github-light`,`github-dark`],gz=(0,U.memo)(({children:e,parseIncompleteMarkdown:t=!0,components:n,rehypePlugins:r=Object.values(cz),remarkPlugins:i=Object.values(lz),className:a,shikiTheme:o=hz,mermaidConfig:s,controls:c=!0,isAnimating:l=!1,urlTransform:u=e=>e,BlockComponent:d=mz,parseMarkdownIntoBlocksFn:f=kR,...p})=>{let m=(0,U.useId)(),h=(0,U.useMemo)(()=>f(typeof e==`string`?e:``),[e,f]);(0,U.useEffect)(()=>{Array.isArray(r)&&r.some(e=>Array.isArray(e)?e[0]===ub:e===ub)&&H(()=>Promise.resolve({}),__vite__mapDeps([125]))},[r]);let g=(0,U.useMemo)(()=>({isAnimating:l}),[l]);return(0,W.jsx)(uz.Provider,{value:o,children:(0,W.jsx)(dz.Provider,{value:s,children:(0,W.jsx)(fz.Provider,{value:c,children:(0,W.jsx)(pz.Provider,{value:g,children:(0,W.jsx)(`div`,{className:xL(`space-y-4`,a),children:h.map((e,a)=>(0,W.jsx)(d,{components:{...wR,...n},content:e,index:a,rehypePlugins:r,remarkPlugins:i,shouldParseIncompleteMarkdown:t,urlTransform:u,...p},`${m}-block-${a}`))})})})})})},(e,t)=>e.children===t.children&&e.shikiTheme===t.shikiTheme&&e.isAnimating===t.isAnimating);gz.displayName=`Streamdown`;var _z=/^h[1-6]$/;function vz(e){return e.trim().toLowerCase().normalize(`NFKD`).replace(/[\u0300-\u036f]/g,``).replace(/[^\p{Letter}\p{Number}\s_-]/gu,``).replace(/[\s_]+/g,`-`).replace(/-+/g,`-`).replace(/^-|-$/g,``)||`heading`}function yz(){let e={seen:new Map};return t=>{let n=vz(t),r=e.seen.get(n)??0;return e.seen.set(n,r+1),r===0?n:`${n}-${r}`}}function bz(e){return e?e.type===`text`||e.type===`inlineCode`?typeof e.value==`string`?e.value:``:(e.children??[]).map(bz).join(``):``}function xz(e,t){t(e);for(let n of e.children??[])xz(n,t)}function Sz(){return e=>{let t=yz();xz(e,e=>{if(e.type!==`element`||!e.tagName||!_z.test(e.tagName))return;let n=bz(e),r=t(n);e.properties={...e.properties??{},id:r},e.children=[...e.children??[],{type:`element`,tagName:`a`,properties:{className:[`markdown-heading-anchor`],href:`#${r}`,ariaLabel:`Link to ${n||`heading`}`},children:[{type:`text`,value:`#`}]}]})}}function Cz(e){let t=/@(?:"[^"]*"|[^\s]+)/g,n=[],r=/^ {0,3}```[\s\S]*?^ {0,3}```|^ {0,3}~~~[\s\S]*?^ {0,3}~~~/gm,i=r.exec(e);for(;i!==null;)n.push({start:i.index,end:i.index+i[0].length}),i=r.exec(e);let a=/`[^`\n]+`|``[^`\n]+``/g;for(i=a.exec(e);i!==null;)n.push({start:i.index,end:i.index+i[0].length}),i=a.exec(e);n.sort((e,t)=>e.start-t.start);let o=e=>n.some(t=>e>=t.start&&e<t.end);return e.replace(t,(e,t)=>o(t)?e:`<span style="background-color: rgba(22, 119, 255, 0.15); border-radius: 3px; padding: 0 2px; font-weight: 600;">${e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}</span>`)}var wz=U.memo(({content:e,inline:t=!1,style:n,isStreaming:r=!1,compact:i=!1,showControls:a=!0,headingAnchors:s=!1})=>{let{token:c}=I.useToken(),l=Array.isArray(e)?e.filter(e=>e.trim()).join(`
|
|
282
|
+
|
|
283
|
+
`):e,u=l;u=Cz(u);let d={theme:Wn(c)?`dark`:`default`},f=i?{maxHeight:`200px`,overflowY:`auto`,fontSize:`12px`,lineHeight:`1.5`}:{},p={...n,...f},m=(0,U.useMemo)(()=>s?[...Object.values(cz),Sz]:void 0,[s]),h=(0,U.useMemo)(()=>s?{a:Dz}:void 0,[s]);return(0,W.jsx)(o,{style:p,className:i?`markdown-compact`:void 0,children:(0,W.jsx)(gz,{parseIncompleteMarkdown:r,className:t?`inline-markdown`:`markdown-content`,isAnimating:r,controls:a,mermaidConfig:d,components:h,rehypePlugins:m,parseMarkdownIntoBlocksFn:s?Ez:void 0,children:u},r?void 0:Tz(l,{headingAnchors:s}))})});wz.displayName=`MarkdownRenderer`;function Tz(e,t={}){let n=2166136261;for(let t=0;t<e.length;t+=1)n^=e.charCodeAt(t),n=Math.imul(n,16777619);return`${t.headingAnchors?`anchors`:`plain`}:${e.length}:${(n>>>0).toString(36)}`}var Ez=e=>[e];function Dz({children:e,className:t,href:n,node:r,...i}){return t?.split(/\s+/).includes(`markdown-heading-anchor`)&&n?.startsWith(`#`)?(0,W.jsx)(`a`,{className:t,href:n,...i,children:e}):(0,W.jsx)(`a`,{className:[`wrap-anywhere font-medium text-primary underline`,t].filter(Boolean).join(` `),"data-streamdown":`link`,href:n,rel:`noreferrer`,target:`_blank`,...i,children:e})}function Oz(e){return e.split(`/`).map(e=>({title:e}))}var kz=({open:e,onClose:t,title:n,content:r,filePath:i})=>{Oz(i);let{showSuccess:a}=dn();return(0,W.jsx)(nt,{title:n,open:e,onCancel:t,width:900,styles:{body:{maxHeight:`70vh`,overflowY:`auto`,padding:`24px`}},footer:[(0,W.jsx)(V,{icon:(0,W.jsx)(We,{}),onClick:async()=>{await on(i),a(`Path copied to clipboard!`)},children:`Copy Path`},`copy-path`),(0,W.jsx)(V,{type:`primary`,icon:(0,W.jsx)(We,{}),onClick:async()=>{await on(r),a(`Content copied to clipboard!`)},children:`Copy Content`},`copy-content`),(0,W.jsx)(V,{onClick:t,children:`Close`},`close`)],children:(0,W.jsx)(wz,{content:r})})},Az=5e4,jz=(0,U.memo)(({branch:e,client:t})=>{let[n,r]=(0,U.useState)([]),[i,a]=(0,U.useState)(!0),[o,s]=(0,U.useState)(null),[c,l]=(0,U.useState)(null),[u,d]=(0,U.useState)(!1),[f,p]=(0,U.useState)(!1),m=(0,U.useRef)(t);m.current=t;let h=(0,U.useRef)(e.branch_id);h.current=e.branch_id;let{showLoading:g,showSuccess:_,showError:v}=dn();(0,U.useEffect)(()=>{if(!t){a(!1);return}(async()=>{try{a(!0),s(null),r(await t.service(`file`).findAll({query:{branch_id:e.branch_id}}))}catch(e){console.error(`Failed to fetch files:`,e),s(e instanceof Error?e.message:String(e))}finally{a(!1)}})()},[t,e.branch_id]);let y=(0,U.useCallback)(async e=>{let t=m.current;if(t)try{g(`Downloading file...`,{key:`download`});let n=await t.service(`file`).get(e.path,{query:{branch_id:h.current}}),r,i=`mimeType`in e?e.mimeType:void 0;if(n.encoding===`base64`){let e=atob(n.content),t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);r=new Blob([t],{type:i||`application/octet-stream`})}else r=new Blob([n.content],{type:i||`text/plain`});let a=URL.createObjectURL(r),o=document.createElement(`a`);o.href=a,o.download=e.path.split(`/`).pop()||`download`,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(a),_(`Downloaded!`,{key:`download`})}catch(e){console.error(`Failed to download file:`,e),v(`Failed to download file`,{key:`download`})}},[g,_,v]),b=(0,U.useCallback)(async e=>{let t=m.current;if(t)if(`isText`in e&&e.isText&&e.size<1024*1024)try{p(!0),d(!0),l(await t.service(`file`).get(e.path,{query:{branch_id:h.current}}))}catch(e){console.error(`Failed to fetch file detail:`,e),v(`Failed to load file`),d(!1)}finally{p(!1)}else y(e)},[y,v]),x=(0,U.useCallback)(()=>{d(!1),l(null)},[]),S=c?.path.endsWith(`.md`),C=n.length>=Az;return(0,W.jsx)(`div`,{style:{width:`100%`,maxHeight:`70vh`,overflowY:`auto`},children:(0,W.jsxs)(z,{orientation:`vertical`,size:`large`,style:{width:`100%`},children:[C&&(0,W.jsx)(k,{type:`warning`,title:`Woah! Big repo alert!`,description:`Only ${Az.toLocaleString()} files were loaded to prevent your browser from crashing. Use git/IDE for full repo browsing.`,showIcon:!0}),!C&&n.length>1e4&&(0,W.jsx)(k,{type:`info`,title:`Large repository: ${n.length.toLocaleString()} files loaded.`,description:`Use search to find files quickly.`,showIcon:!0}),o&&(0,W.jsx)(k,{title:`Error`,description:o,type:`error`,showIcon:!0}),(0,W.jsx)(Kc,{files:n,loading:i,onFileClick:b,onDownload:y,emptyMessage:`No files found in branch`}),S?(0,W.jsx)(kz,{open:u,title:c?.title||``,content:c?.content||``,filePath:c?.path||``,onClose:x}):(0,W.jsx)(Hc,{file:c,open:u,onClose:x,loading:f})]})})},(e,t)=>{let n=e.client===null!=(t.client===null);return e.branch.branch_id===t.branch.branch_id&&!n}),Mz=e=>(0,W.jsx)(he,{...e}),Nz=e=>typeof e==`string`&&e.trim().length>0?e:void 0,Pz=({archived:e,loading:t=!1,onToggle:n,tooltip:r,stopPropagation:i=!0,ariaLabel:a,"aria-label":o,size:s=`small`,type:c=`text`,...l})=>{let u=r??(e?`Archived • Click to unarchive`:`Archive`),d=Nz(u),f=o??a;return(0,W.jsx)(M,{title:u,children:(0,W.jsx)(V,{...l,type:c,size:s,icon:(0,W.jsx)(Mz,{}),loading:t,"aria-label":f??d,title:l.title??d,onClick:t=>{i&&t.stopPropagation(),n(!e)}})})},Fz=({tooltip:e,stopPropagation:t=!0,ariaLabel:n,"aria-label":r,size:i=`small`,type:a=`text`,onClick:o,onMouseEnter:s,onMouseLeave:c,children:l,...u})=>{let d=l==null,f=e??(d?`Archive`:void 0),p=Nz(f),m=r??n,h=(0,W.jsx)(V,{...u,type:a,size:i,icon:(0,W.jsx)(Mz,{}),"aria-label":m??(d?p:void 0),title:u.title??(d?p:void 0),onMouseEnter:s,onMouseLeave:c,onClick:e=>{t&&e.stopPropagation(),o?.(e)},children:l});return f?(0,W.jsx)(M,{title:f,children:h}):h},{Text:Iz}=o,Lz=({open:e,branch:t,sessionCount:n=0,environmentRunning:r=!1,initialMetadataAction:i=`archive`,onConfirm:a,onCancel:o})=>{let[s,c]=(0,U.useState)(`cleaned`),[l,u]=(0,U.useState)(i);return(0,U.useEffect)(()=>{e&&u(i)},[i,e]),(0,W.jsx)(nt,{title:`Archive or Delete Branch`,open:e,onOk:()=>{a({metadataAction:l,filesystemAction:s})},onCancel:o,okText:l===`archive`?`Archive Branch`:`Delete Permanently`,okButtonProps:l===`delete`?{danger:!0}:{},cancelText:`Cancel`,width:600,children:(0,W.jsxs)(z,{orientation:`vertical`,size:`large`,style:{width:`100%`},children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(Iz,{strong:!0,children:`Name: `}),(0,W.jsx)(Iz,{code:!0,children:t.name}),(0,W.jsx)(`br`,{}),(0,W.jsx)(Iz,{strong:!0,children:`Git ref: `}),(0,W.jsx)(Iz,{children:t.ref})]}),r&&(0,W.jsx)(k,{title:`Environment is running and will be stopped`,type:`warning`,showIcon:!0,style:{marginBottom:0}}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(Iz,{strong:!0,style:{display:`block`,marginBottom:8},children:`Filesystem`}),(0,W.jsx)(d.Group,{value:s,onChange:e=>c(e.target.value),children:(0,W.jsxs)(z,{orientation:`vertical`,children:[(0,W.jsx)(d,{value:`preserved`,children:(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{children:`Leave untouched`}),(0,W.jsx)(Iz,{type:`secondary`,style:{fontSize:12},children:`No changes to disk`})]})}),(0,W.jsx)(d,{value:`cleaned`,children:(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{children:`Clean workspace (git clean -fdx)`}),(0,W.jsx)(Iz,{type:`secondary`,style:{fontSize:12},children:`Removes node_modules, builds, untracked files`})]})}),(0,W.jsx)(d,{value:`deleted`,children:(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{children:`Delete completely`}),(0,W.jsx)(Iz,{type:`secondary`,style:{fontSize:12},children:`Removes entire branch directory from disk`})]})})]})})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(Iz,{strong:!0,style:{display:`block`,marginBottom:8},children:`Metadata & Sessions`}),(0,W.jsx)(d.Group,{value:l,onChange:e=>u(e.target.value),children:(0,W.jsxs)(z,{orientation:`vertical`,children:[(0,W.jsx)(d,{value:`archive`,children:(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{children:`Archive (recommended)`}),(0,W.jsx)(Iz,{type:`secondary`,style:{fontSize:12},children:`Hidden from board, data preserved for analytics and history`})]})}),(0,W.jsx)(d,{value:`delete`,children:(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{children:`Delete permanently`}),(0,W.jsx)(Iz,{type:`secondary`,style:{fontSize:12},children:`All data deleted - no undo`})]})})]})})]}),l===`delete`&&(0,W.jsx)(k,{title:`Warning`,description:(0,W.jsxs)(z,{orientation:`vertical`,size:`small`,style:{width:`100%`},children:[(0,W.jsxs)(Iz,{children:[`• All `,n,` session(s), messages, and history will be permanently deleted`]}),(0,W.jsx)(Iz,{children:`• Token usage data will be lost - prevents analytics and cost tracking`}),(0,W.jsx)(Iz,{children:`• Links to issues/PRs will be removed forever`}),(0,W.jsx)(Iz,{children:`• This action cannot be undone`}),(0,W.jsx)(Iz,{strong:!0,style:{marginTop:8,display:`block`},children:`💡 Consider archiving instead - keeps data for history but hides from board`})]}),type:`error`,showIcon:!0}),(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(Iz,{type:`secondary`,style:{fontSize:12},children:[`Path:`,` `]}),(0,W.jsx)(Iz,{code:!0,copyable:!0,style:{fontSize:11},children:t.path})]})]})})},Rz=({mcpServers:e,value:t,onChange:n,placeholder:r=`Select MCP servers...`,filterByScope:i,...a})=>(0,W.jsx)(F,{mode:`multiple`,placeholder:r,allowClear:!0,showSearch:!0,optionFilterProp:`label`,value:t,onChange:n,options:(i?e.filter(e=>e.scope===i):e).filter(e=>e.enabled).map(e=>{let t=e.display_name||e.name,n=e.auth?.type===`oauth`?` · OAuth ${e.auth.oauth_mode===`shared`?`(shared)`:`(per-user)`}`:e.auth?.type===`bearer`||e.auth?.token?` · Token`:``;return{label:`${t} (${e.transport})${n}`,value:e.mcp_server_id,disabled:!e.enabled}}).sort((e,t)=>e.label.localeCompare(t.label)),...a}),zz=({mcpServerById:e,showHelpText:t=!1})=>uo(`mcp_servers`)?(0,W.jsx)(B.Item,{name:`mcpServerIds`,label:`MCP Servers`,help:t?`Select MCP servers to make available in this session`:void 0,children:(0,W.jsx)(Rz,{mcpServers:To(e),placeholder:`No MCP servers attached`})}):null,{TextArea:Bz}=L,Vz=({branch:e,repo:t,sessions:n,boards:r=[],mcpServers:i=[],canEdit:a,state:c,setField:l,onArchiveOrDelete:u})=>{let[d,f]=(0,U.useState)(!1),p=t=>{u?.(e.branch_id,t)},m=$t(e);return(0,W.jsx)(`div`,{style:{width:`100%`,maxHeight:`70vh`,overflowY:`auto`},children:(0,W.jsxs)(z,{orientation:`vertical`,size:`large`,style:{width:`100%`},children:[(0,W.jsxs)(R,{column:1,bordered:!0,size:`small`,children:[(0,W.jsxs)(R.Item,{label:`Name`,children:[(0,W.jsx)(o.Text,{strong:!0,children:e.name}),e.new_branch&&(0,W.jsx)(Zn,{color:`green`,style:{marginLeft:8,fontSize:11},children:`New Branch`})]}),(0,W.jsx)(R.Item,{label:`Repository`,children:(0,W.jsxs)(z,{children:[(0,W.jsx)(de,{}),(0,W.jsx)(o.Text,{children:t.name})]})}),(0,W.jsx)(R.Item,{label:`Branch`,children:(0,W.jsx)(o.Text,{code:!0,children:e.ref})}),e.base_ref&&(0,W.jsx)(R.Item,{label:e.ref_type===`tag`?`Base Tag`:`Base Branch`,children:(0,W.jsxs)(o.Text,{code:!0,children:[e.base_ref,e.base_sha&&` (${e.base_sha.substring(0,7)})`]})}),e.tracking_branch&&(0,W.jsx)(R.Item,{label:`Tracking`,children:(0,W.jsx)(o.Text,{code:!0,children:e.tracking_branch})}),e.last_commit_sha&&(0,W.jsx)(R.Item,{label:`Current SHA`,children:(0,W.jsx)(o.Text,{code:!0,children:e.last_commit_sha.substring(0,7)})}),(0,W.jsx)(R.Item,{label:`Path`,children:(0,W.jsx)(o.Text,{code:!0,style:{fontSize:11},copyable:{text:e.path,tooltips:[`Copy path`,`Copied!`]},children:e.path})})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(o.Text,{strong:!0,style:{fontSize:14,display:`block`,marginBottom:16},children:`Work Context`}),(0,W.jsxs)(B,{layout:`horizontal`,colon:!1,children:[(0,W.jsx)(B.Item,{label:`Board`,labelCol:{span:6},wrapperCol:{span:18},children:(0,W.jsx)(F,{value:c.boardId,onChange:e=>l(`boardId`,e),placeholder:`Select board (optional)...`,allowClear:!0,disabled:!a,options:r.sort((e,t)=>e.name.localeCompare(t.name)).map(e=>({value:e.board_id,label:`${e.icon||`📋`} ${e.name}`}))})}),(0,W.jsx)(B.Item,{label:`Issue`,labelCol:{span:6},wrapperCol:{span:18},children:(0,W.jsx)(L,{value:c.issueUrl,onChange:e=>l(`issueUrl`,e.target.value),placeholder:`https://github.com/user/repo/issues/42`,prefix:(0,W.jsx)(s,{}),disabled:!a})}),(0,W.jsx)(B.Item,{label:`Pull Request`,labelCol:{span:6},wrapperCol:{span:18},children:(0,W.jsx)(L,{value:c.prUrl,onChange:e=>l(`prUrl`,e.target.value),placeholder:`https://github.com/user/repo/pull/43`,prefix:(0,W.jsx)(s,{}),disabled:!a})}),!m&&(0,W.jsx)(B.Item,{label:(0,W.jsxs)(z,{size:4,children:[(0,W.jsx)(`span`,{children:`Notes`}),(0,W.jsx)(M,{title:`Markdown formatting supported (headings, bold, italic, lists, code blocks, etc.)`,children:(0,W.jsx)(`span`,{style:{fontSize:`10px`,fontWeight:`bold`,fontFamily:`monospace`,opacity:.6,cursor:`help`},children:`MD`})})]}),labelCol:{span:6},wrapperCol:{span:18},children:(0,W.jsx)(Bz,{value:c.notes,onChange:e=>l(`notes`,e.target.value),placeholder:`Freeform notes about this branch...`,rows:4,disabled:!a})}),(0,W.jsx)(B.Item,{label:`MCP Servers`,labelCol:{span:6},wrapperCol:{span:18},extra:`Default MCP servers for new sessions in this branch`,children:(0,W.jsx)(Rz,{mcpServers:i,value:c.mcpServerIds,onChange:e=>l(`mcpServerIds`,e),placeholder:`Select default MCP servers...`,disabled:!a})})]})]}),(0,W.jsxs)(R,{column:2,bordered:!0,size:`small`,children:[(0,W.jsx)(R.Item,{label:`Created`,children:new Date(e.created_at).toLocaleString()}),(0,W.jsx)(R.Item,{label:`Last Used`,children:e.last_used?new Date(e.last_used).toLocaleString():`Never`})]}),(0,W.jsx)(z,{children:(0,W.jsx)(Fz,{tooltip:``,size:`middle`,onClick:()=>f(!0),disabled:!a,children:`Archive or Delete Branch`})}),(0,W.jsx)(Lz,{open:d,branch:e,sessionCount:n.length,environmentRunning:e.environment_instance?.status===`running`,onConfirm:e=>{p(e),f(!1)},onCancel:()=>f(!1)})]})})},Hz=[{label:`No access`,value:`none`},{label:`Read`,value:`read`},{label:`Write`,value:`write`}],Uz=new Set([`write`,`own`]);function Wz(){return{memory_path_template:`memory/{{YYYY-MM-DD}}.md`,default_visibility:`public`,global_access:`write`,grants:[]}}function Gz(e){return e.namespace_id||e.namespace_slug}function Kz(e){let t=e.effective_permission??`unknown`;return`${e.display_name} (${e.slug}) · ${t}`}function qz(e,t){return{custom_context:{[e.custom_context?.assistant?`assistant`:`agent`]:{kb:t}}}}var Jz=({branch:e,client:t,canEdit:n})=>{let{showSuccess:r,showError:i}=dn(),a=(0,U.useMemo)(()=>an(e),[e]),s=a?.kb,[c,l]=(0,U.useState)(s??Wz()),[u,d]=(0,U.useState)(null),[f,p]=(0,U.useState)([]),[m,h]=(0,U.useState)(!1),[g,_]=(0,U.useState)(!1),[y,b]=(0,U.useState)(!1),[x,S]=(0,U.useState)(null);(0,U.useEffect)(()=>{l(s??Wz())},[s]),(0,U.useEffect)(()=>{let e=!1;return(async()=>{if(d(null),S(null),t){h(!0);try{let n=await t.service(`kb/namespaces`).find({query:{archived:!1,$limit:1e3}});if(e||p(Array.isArray(n)?n:n.data??[]),c.primary_namespace_id){let n=await t.service(`kb/namespaces`).get(c.primary_namespace_id);e||d(n)}}catch(t){e||S(t instanceof Error?t.message:String(t))}finally{e||h(!1)}}})(),()=>{e=!0}},[t,c.primary_namespace_id]);let C=(0,U.useMemo)(()=>(c.grants??[]).map(e=>({...e,key:Gz(e)})),[c.grants]),w=(0,U.useMemo)(()=>new Map(f.map(e=>[String(e.namespace_id),e])),[f]),T=async()=>{if(t){_(!0),S(null);try{let n=await t.service(`branches`).ensureAssistantKnowledgeNamespace({branchId:e.branch_id});d(n.namespace),l(an(n.branch)?.kb??c),r(`Assistant Knowledge namespace is ready`)}catch(e){let t=e instanceof Error?e.message:String(e);S(t),i(t)}finally{_(!1)}}},D=async n=>{if(t){b(!0);try{l(an(await t.service(`branches`).patch(e.branch_id,qz(e,n)))?.kb??n),r(`Assistant Knowledge policy saved`)}catch(e){i(e instanceof Error?e.message:String(e))}finally{b(!1)}}},O=e=>{let t=w.get(e);t&&(l(e=>({...e,primary_namespace_id:t.namespace_id,primary_namespace_slug:t.slug,default_visibility:t.visibility_default,memory_path_template:e.memory_path_template??`memory/{{YYYY-MM-DD}}.md`})),d(t))},A=(e,t)=>{l(n=>({...n,grants:(n.grants??[]).map(n=>Gz(n)===e?{...n,...t}:n)}))},j=e=>{let t=w.get(e);t&&l(e=>{let n=e.grants??[];return n.some(e=>e.namespace_id===t.namespace_id)?e:{...e,grants:[...n,{namespace_id:t.namespace_id,namespace_slug:t.slug,access:`read`}]}})},M=e=>{l(t=>({...t,grants:(t.grants??[]).filter(t=>Gz(t)!==e)}))};if(!a)return(0,W.jsx)(ue,{description:`Knowledge memory is only available for assistant branches.`});let N=!u&&(!c.primary_namespace_id||x),P=new Set((c.grants??[]).map(e=>e.namespace_id));return c.primary_namespace_id&&P.add(c.primary_namespace_id),(0,W.jsx)(`div`,{style:{padding:16},children:(0,W.jsxs)(z,{direction:`vertical`,size:`middle`,style:{width:`100%`},children:[(0,W.jsx)(k,{type:`info`,showIcon:!0,message:`Assistant Knowledge`,description:`Assistant tools always use the home namespace for memory. Beyond that, this policy controls which Knowledge namespaces assistant-specific MCP tools may search. Effective access is still limited by the current user's namespace permissions.`}),(0,W.jsx)(Ne,{title:`Home namespace`,extra:(0,W.jsxs)(z,{children:[u?.slug&&(0,W.jsx)(V,{href:`/kb/${encodeURIComponent(u.slug)}/`,target:`_blank`,children:`Open in Knowledge`}),n&&(0,W.jsx)(V,{onClick:T,loading:g,disabled:!t,children:c.primary_namespace_id?`Repair namespace`:`Create namespace`})]}),children:(0,W.jsxs)(z,{direction:`vertical`,size:`middle`,style:{width:`100%`},children:[(0,W.jsx)(o.Paragraph,{type:`secondary`,style:{marginBottom:0},children:`The home namespace is where this assistant stores its memory and where assistant-specific Knowledge tools start by default. Choose a namespace you can write to.`}),n&&(0,W.jsxs)(z.Compact,{style:{width:`100%`},children:[(0,W.jsx)(F,{showSearch:!0,"aria-label":`Home Knowledge namespace`,placeholder:`Select home Knowledge namespace`,value:c.primary_namespace_id,loading:m,disabled:!t||g,optionFilterProp:`label`,onChange:O,style:{minWidth:360,flex:1},options:f.map(e=>{let t=Uz.has(e.effective_permission??`none`);return{label:Kz(e),value:e.namespace_id,disabled:!t&&e.namespace_id!==c.primary_namespace_id}})}),(0,W.jsx)(V,{type:`primary`,onClick:()=>D(c),loading:y,disabled:!t||!c.primary_namespace_id,children:`Save home`})]}),m?(0,W.jsx)(De,{}):N?(0,W.jsx)(k,{type:`warning`,showIcon:!0,message:`Home namespace is missing or unavailable`,description:x||`namespace for this agent is not set up`}):(0,W.jsxs)(R,{column:1,size:`small`,children:[(0,W.jsx)(R.Item,{label:`Name`,children:u?.display_name}),(0,W.jsx)(R.Item,{label:`Slug`,children:(0,W.jsx)(o.Text,{code:!0,children:u?.slug??c.primary_namespace_slug})}),(0,W.jsx)(R.Item,{label:`Your permission`,children:(0,W.jsx)(v,{children:u?.effective_permission??`unknown`})}),(0,W.jsx)(R.Item,{label:`Default document visibility`,children:(0,W.jsx)(v,{children:u?.visibility_default??c.default_visibility})}),(0,W.jsx)(R.Item,{label:`Others can`,children:(0,W.jsx)(v,{children:u?.others_can??`unknown`})}),(0,W.jsx)(R.Item,{label:`Memory path`,children:(0,W.jsx)(o.Text,{code:!0,children:c.memory_path_template??`memory/{{YYYY-MM-DD}}.md`})})]})]})}),(0,W.jsx)(Ne,{title:`Assistant Knowledge access`,extra:n?(0,W.jsx)(V,{type:`primary`,onClick:()=>D(c),loading:y,disabled:!t||!c.primary_namespace_id,children:`Save policy`}):null,children:(0,W.jsxs)(z,{direction:`vertical`,size:`middle`,style:{width:`100%`},children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(o.Text,{strong:!0,children:`Entire Knowledge Base fallback`}),(0,W.jsx)(o.Paragraph,{type:`secondary`,style:{marginBottom:8},children:`Applies to any namespace that is not listed below. Choose none for a locked-down assistant, read for broad context, or write for assistant tools that may update any namespace the current user can write.`}),(0,W.jsx)(F,{value:c.global_access??`write`,options:Hz,disabled:!n,style:{width:220},onChange:e=>l(t=>({...t,global_access:e}))})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(o.Text,{strong:!0,children:`Per-namespace overrides`}),(0,W.jsx)(o.Paragraph,{type:`secondary`,style:{marginBottom:8},children:`Add namespaces to narrow or expand the fallback policy for specific spaces. The home namespace is always available to assistant memory tools.`}),n&&(0,W.jsx)(F,{showSearch:!0,placeholder:`Add namespace override`,style:{minWidth:320,marginBottom:12},disabled:!t,value:void 0,optionFilterProp:`label`,onChange:j,options:f.filter(e=>!P.has(e.namespace_id)).map(e=>({label:`${e.display_name} (${e.slug})`,value:e.namespace_id}))}),(0,W.jsx)(E,{size:`small`,pagination:!1,rowKey:`key`,dataSource:C,locale:{emptyText:`No per-namespace overrides`},columns:[{title:`Namespace`,dataIndex:`namespace_slug`,render:(e,t)=>{let n=w.get(t.namespace_id);return(0,W.jsxs)(z,{direction:`vertical`,size:0,children:[(0,W.jsx)(o.Text,{children:n?.display_name??t.namespace_slug}),(0,W.jsx)(o.Text,{type:`secondary`,code:!0,children:t.namespace_slug})]})}},{title:`Access`,dataIndex:`access`,width:150,render:(e,t)=>(0,W.jsx)(F,{value:t.access,options:Hz,disabled:!n,style:{width:130},onChange:e=>A(t.key,{access:e})})},{title:`Effective now`,width:150,render:(e,t)=>(0,W.jsx)(v,{children:w.get(t.namespace_id)?.effective_permission??`unknown`})},{title:``,width:90,render:(e,t)=>n?(0,W.jsx)(V,{type:`link`,danger:!0,onClick:()=>M(t.key),children:`Remove`}):null}]})]})]})})]})})},Yz=e=>String(e??``).trim().toLowerCase(),Xz=e=>e.filter(Boolean).join(` `).toLowerCase(),Zz=e=>{let t=e.name?.trim();return t&&t!==e.email?`${t} (${e.email})`:e.email},Qz=e=>{let t=e.slug?.trim();return t&&t!==e.name?`${e.name} (${t})`:e.name},$z=e=>Yz(e),eB=e=>{let t=Zz(e);return{value:e.user_id,label:t,searchText:$z(t)}},tB=e=>{let t=Qz(e);return{value:e.group_id,label:t,searchText:$z(t)}},nB={showSearch:!0,optionFilterProp:`searchText`,optionLabelProp:`label`,filterOption:(e,t)=>{let n=Yz(e);if(!n)return!0;let r=typeof t?.label==`string`?t.label:``;return Xz([t?.searchText,r]).includes(n)}},rB={none:`No access`,view:`View only`,session:`Create and prompt own sessions`,prompt:`Prompt any session`,all:`Full control`},iB={none:`No filesystem access`,read:`Read-only`,write:`Read/write`},aB=e=>e===`none`?`private`:`shared`,oB=(e,t)=>e===`private`?`none`:t===`none`?`session`:t||`session`,sB=({value:e,onChange:t,allUsers:n,allGroups:r,currentUser:i,canEdit:a,canEditOwners:s=a,canEditGroups:c=a,loadingOwners:l=!1,groupGrantsLoading:u=!1,groupGrantsUnavailable:f=!1,groupGrantsError:p,ownersLoadError:m,ownerHelp:h=`Full access`,groupsHelp:g=`Group access`,visibilityLabel:_=`Visibility`,othersCanLabel:v=`Others Can`,othersFsAccessLabel:y=`Filesystem Access`,showLegacySessionSharing:b=!0})=>{let{showError:x}=dn(),[S,C]=(0,U.useState)(0),w=i?.user_id,T=e.visibility===`shared`,E=e.ownerIds.length===1?`Private (${(e=>{let t=n.find(t=>t.user_id===e),r=t?.name||t?.email||e;return e===w?`${r} (You)`:r})(e.ownerIds[0])})`:`Private`,D=e=>{if(e.length===0){x(`At least one owner is required`),C(e=>e+1);return}t(`ownerIds`,e)},O=n=>{if(t(`visibility`,n),t(`othersCan`,oB(n,e.othersCan)),n===`private`){let n=e.ownerIds.length===1?e.ownerIds[0]:w&&e.ownerIds.includes(w)?w:e.ownerIds[0]||w;n&&t(`ownerIds`,[n]),t(`groupGrants`,[]),t(`othersFsAccess`,`none`),t(`allowSessionSharing`,!1)}};return(0,W.jsxs)(W.Fragment,{children:[m&&(0,W.jsx)(k,{type:`error`,showIcon:!0,message:`Permissions unavailable`,description:`${m.message}. Close and reopen the modal to retry.`,style:{marginBottom:16}}),(0,W.jsx)(B.Item,{label:_,labelCol:{span:8},wrapperCol:{span:16},help:T?`Group and fallback access.`:`Owner-only access.`,children:(0,W.jsx)(d.Group,{value:e.visibility,disabled:!a,onChange:e=>O(e.target.value),options:[{value:`private`,label:E},{value:`shared`,label:`Shared`}]})}),T&&(0,W.jsx)(B.Item,{label:`Owners`,labelCol:{span:8},wrapperCol:{span:16},help:h,children:(0,W.jsx)(F,{mode:`multiple`,style:{width:`100%`},placeholder:`Select owners...`,value:e.ownerIds,onChange:D,loading:l,disabled:!s,...nB,options:n.map(e=>{let t=e.user_id===w,n=eB(e),r=t?`${n.label} (You)`:n.label;return{...n,label:r,searchText:$z(r)}}).sort((e,t)=>e.label.localeCompare(t.label)),tagRender:e=>{let t=n.find(t=>t.user_id===e.value)?.user_id===w;return(0,W.jsx)(Zn,{...e,color:t?`green`:`default`,closable:e.closable,onClose:e.onClose,style:{marginRight:3},children:(0,W.jsxs)(z,{size:4,children:[(0,W.jsx)(Be,{style:{fontSize:11}}),(0,W.jsx)(`span`,{children:e.label})]})})}},S)}),T&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(B.Item,{label:`Groups`,labelCol:{span:8},wrapperCol:{span:16},help:g,children:(0,W.jsxs)(z,{direction:`vertical`,style:{width:`100%`},children:[f&&(0,W.jsx)(k,{type:`warning`,showIcon:!0,message:`Group permissions unavailable`,description:p?.message?`Group permissions could not be loaded: ${p.message}`:`Group grants may not be enabled.`}),(0,W.jsx)(F,{mode:`multiple`,style:{width:`100%`},placeholder:`Select groups...`,value:e.groupGrants.map(e=>e.group_id),loading:u,disabled:!c,options:r.map(tB).sort((e,t)=>e.label.localeCompare(t.label)),...nB,onChange:n=>{let r=new Map(e.groupGrants.map(e=>[e.group_id,e]));t(`groupGrants`,n.map(e=>r.get(e)||{group_id:e,can:`view`}))}}),e.groupGrants.map(n=>{let i=r.find(e=>e.group_id===n.group_id);return(0,W.jsxs)(z,{style:{width:`100%`,justifyContent:`space-between`},children:[(0,W.jsx)(o.Text,{children:i?.name||n.group_id}),(0,W.jsxs)(z,{children:[(0,W.jsx)(F,{size:`small`,style:{width:140},value:n.can,disabled:!c,options:[{value:`view`,label:`View`},{value:`session`,label:`Own Sessions`},{value:`prompt`,label:`Prompt`},{value:`all`,label:`All`}],onChange:r=>t(`groupGrants`,e.groupGrants.map(e=>e.group_id===n.group_id?{...e,can:r}:e))}),(0,W.jsx)(F,{size:`small`,style:{width:110},value:n.fs_access||`read`,disabled:!c,options:[{value:`none`,label:`No FS`},{value:`read`,label:`Read FS`},{value:`write`,label:`Write FS`}],onChange:r=>t(`groupGrants`,e.groupGrants.map(e=>e.group_id===n.group_id?{...e,fs_access:r}:e))})]})]},n.group_id)})]})}),(0,W.jsx)(B.Item,{label:v,labelCol:{span:8},wrapperCol:{span:16},help:rB[e.othersCan],children:(0,W.jsx)(F,{value:e.othersCan,onChange:e=>t(`othersCan`,e),disabled:!a,options:[{value:`view`,label:`View`},{value:`session`,label:`Own Sessions`},{value:`prompt`,label:`Prompt`},{value:`all`,label:`All`}]})}),e.othersCan===`prompt`&&(0,W.jsx)(B.Item,{wrapperCol:{offset:8,span:16},children:(0,W.jsx)(k,{type:`warning`,showIcon:!0,icon:(0,W.jsx)(Ye,{}),message:`Unix identity risk`,description:`Allows prompting sessions created by others; use only with trusted collaborators.`})}),(0,W.jsx)(B.Item,{label:y,labelCol:{span:8},wrapperCol:{span:16},help:iB[e.othersFsAccess],children:(0,W.jsx)(F,{value:e.othersFsAccess,onChange:e=>t(`othersFsAccess`,e),disabled:!a,options:[{value:`none`,label:`None`},{value:`read`,label:`Read`},{value:`write`,label:`Write`}]})}),b&&(0,W.jsx)(B.Item,{label:`Allow legacy session sharing`,labelCol:{span:8},wrapperCol:{span:16},help:`When on, spawned/forked sessions keep the original creator's identity.`,children:(0,W.jsx)(ve,{checked:e.allowSessionSharing,onChange:e=>t(`allowSessionSharing`,e),disabled:!a})}),b&&e.allowSessionSharing&&(0,W.jsx)(B.Item,{wrapperCol:{offset:8,span:16},children:(0,W.jsx)(k,{type:`error`,showIcon:!0,icon:(0,W.jsx)(Ye,{}),message:`Dangerous: identity borrowing`,description:`Use only for trusted collaborators or legacy automation.`})})]})]})},cB=({loadingOwners:e,canEdit:t,allUsers:n,allGroups:r=[],groupGrantsStatus:i=`loaded`,groupGrantsError:a,currentUser:s,client:c,board:l,state:u,setField:f,ownersLoadError:p})=>{let[m,h]=(0,U.useState)([]),[g,_]=(0,U.useState)([]),[v,y]=(0,U.useState)(!1),[b,x]=(0,U.useState)(null),S=u.permissionSource??`override`,C=t&&S===`override`,w={visibility:aB(u.othersCan),ownerIds:u.selectedOwnerIds,groupGrants:u.groupGrants??[],othersCan:u.othersCan,othersFsAccess:u.othersFsAccess,allowSessionSharing:u.allowSessionSharing},T=(e,t)=>{e===`ownerIds`&&f(`selectedOwnerIds`,t),e===`groupGrants`&&f(`groupGrants`,t),e===`othersCan`&&f(`othersCan`,t),e===`othersFsAccess`&&f(`othersFsAccess`,t),e===`allowSessionSharing`&&f(`allowSessionSharing`,t)};(0,U.useEffect)(()=>{if(!c||!l?.board_id||S!==`board`){h([]),_([]),x(null);return}let e=!1;return y(!0),x(null),Promise.all([c.service(`boards/:id/owners`).find({route:{id:l.board_id}}),c.service(`boards/:id/group-grants`).find({route:{id:l.board_id}})]).then(([t,n])=>{e||(h(t),_(n))}).catch(t=>{e||(h([]),_([]),x(t instanceof Error?t:Error(String(t))))}).finally(()=>{e||y(!1)}),()=>{e=!0}},[c,l?.board_id,S]);let E=m.map(e=>e.name||e.email||e.user_id),D=g.map(e=>{let t=r.find(t=>t.group_id===e.group_id),n=e.group?.name||t?.name||e.group_id,i=e.fs_access?`, FS: ${e.fs_access}`:``;return`${n}: ${e.can}${i}`});return(0,W.jsx)(`div`,{style:{width:`100%`,maxHeight:`70vh`,overflowY:`auto`},children:(0,W.jsxs)(B,{layout:`horizontal`,colon:!1,children:[(0,W.jsx)(B.Item,{label:`Permission Mode`,labelCol:{span:8},wrapperCol:{span:16},help:S===`board`?`Uses board-level defaults for non-owner access.`:`Uses branch-level permission overrides.`,children:(0,W.jsx)(d.Group,{value:S,disabled:!t,onChange:e=>f(`permissionSource`,e.target.value),options:[{value:`board`,label:`Align with board permissions`},{value:`override`,label:`Override board-level permissions`}]})}),S===`board`&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(B.Item,{wrapperCol:{offset:8,span:16},children:(0,W.jsx)(k,{type:`info`,showIcon:!0,message:`Aligned with board permissions`,description:`This branch inherits board-level visibility, board owners, board groups, and board fallback permissions. Switch to Override to edit branch-level private/shared permissions directly.`})}),(0,W.jsx)(B.Item,{label:`Board defaults`,labelCol:{span:8},wrapperCol:{span:16},children:l?(0,W.jsxs)(R,{size:`small`,column:1,bordered:!0,style:{width:`100%`},children:[(0,W.jsx)(R.Item,{label:`Visibility`,children:l.access_mode===`private`?`Private`:`Shared`}),(0,W.jsx)(R.Item,{label:`Owners`,children:v?`Loading…`:E.length>0?E.join(`, `):`None`}),b&&(0,W.jsx)(R.Item,{label:`Owner/group details`,children:(0,W.jsxs)(o.Text,{type:`danger`,children:[`Could not load: `,b.message]})}),l.access_mode!==`private`&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(R.Item,{label:`Groups`,children:v?`Loading…`:D.length>0?D.join(`, `):`None`}),(0,W.jsx)(R.Item,{label:`Others can`,children:l.default_others_can||`session`}),(0,W.jsx)(R.Item,{label:`Filesystem access`,children:l.default_others_fs_access||`read`}),(0,W.jsx)(R.Item,{label:`Legacy session sharing`,children:l.default_dangerously_allow_session_sharing?`Allowed`:`Off`})]})]}):(0,W.jsx)(o.Text,{type:`secondary`,children:`Board defaults are unavailable for this branch.`})})]}),S===`override`&&(0,W.jsx)(sB,{value:w,onChange:T,allUsers:n,allGroups:r,currentUser:s,canEdit:C,canEditGroups:C&&i===`loaded`,loadingOwners:e,groupGrantsLoading:i===`loading`,groupGrantsUnavailable:i===`unavailable`,groupGrantsError:a,ownersLoadError:p,groupsHelp:`Grant explicit branch access to user groups`})]})})},lB=function(){return lB=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},lB.apply(this,arguments)};function uB(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function dB(e,t,n){if(n||arguments.length===2)for(var r,i=0,a=t.length;i<a;i++)!r&&i in t||(r||=Array.prototype.slice.call(t,0,i),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}var fB=[{name:`@yearly`,value:`0 0 1 1 *`},{name:`@annually`,value:`0 0 1 1 *`},{name:`@monthly`,value:`0 0 1 * *`},{name:`@weekly`,value:`0 0 * * 0`},{name:`@daily`,value:`0 0 * * *`},{name:`@midnight`,value:`0 0 * * *`},{name:`@hourly`,value:`0 * * * *`}],pB=[{type:`minutes`,min:0,max:59,total:60},{type:`hours`,min:0,max:23,total:24},{type:`month-days`,min:1,max:31,total:31},{type:`months`,min:1,max:12,total:12,alt:[`JAN`,`FEB`,`MAR`,`APR`,`MAY`,`JUN`,`JUL`,`AUG`,`SEP`,`OCT`,`NOV`,`DEC`]},{type:`week-days`,min:0,max:6,total:7,alt:[`SUN`,`MON`,`TUE`,`WED`,`THU`,`FRI`,`SAT`]}],mB={everyText:`every`,emptyMonths:`every month`,emptyMonthDays:`every day of the month`,emptyMonthDaysShort:`day of the month`,emptyWeekDays:`every day of the week`,emptyWeekDaysShort:`day of the week`,emptyHours:`every hour`,emptyMinutes:`every minute`,emptyMinutesForHourPeriod:`every`,yearOption:`year`,monthOption:`month`,weekOption:`week`,dayOption:`day`,hourOption:`hour`,minuteOption:`minute`,rebootOption:`reboot`,prefixPeriod:`Every`,prefixMonths:`in`,prefixMonthDays:`on`,prefixWeekDays:`on`,prefixWeekDaysForMonthAndYearPeriod:`and`,prefixHours:`at`,prefixMinutes:`:`,prefixMinutesForHourPeriod:`at`,suffixMinutesForHourPeriod:`minute(s)`,errorInvalidCron:`Invalid cron expression`,clearButtonText:`Clear`,weekDays:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],months:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],altWeekDays:[`SUN`,`MON`,`TUE`,`WED`,`THU`,`FRI`,`SAT`],altMonths:[`JAN`,`FEB`,`MAR`,`APR`,`MAY`,`JUN`,`JUL`,`AUG`,`SEP`,`OCT`,`NOV`,`DEC`]};function hB(e,t){for(var n=[],r=e;r<=t;r++)n.push(r);return n}function gB(e){return e.sort((function(e,t){return e-t})),e}function _B(e){var t=[];return e.forEach((function(e){t.indexOf(e)<0&&t.push(e)})),t}function vB(e){return Object.entries(e).filter((function(e){var t=e[0],n=e[1];return t&&n})).map((function(e){return e[0]})).join(` `)}function yB(e,t){e&&e({type:`invalid_cron`,description:t.errorInvalidCron||mB.errorInvalidCron})}function bB(e){var t=parseInt(e,10),n=Number(e);return t===n?n:NaN}function xB(e,t,n,r,i,a,o,s,c,l,u,d,f,p){n&&n(void 0),t(!1);var m=!1;if(!e){if(r===`always`||a&&r===`for-default-value`)return;m=!0}if(!m){if(s&&(!0===s||s.includes(e))){if(e===`@reboot`)return void p(`reboot`);var h=fB.find((function(t){return t.name===e}));h&&(e=h.value)}try{var g=EB(e);p(function(e){return e[3].length>0?`year`:e[2].length>0?`month`:e[4].length>0?`week`:e[1].length>0?`day`:e[0].length>0?`hour`:`minute`}(g)),c(g[0]),l(g[1]),u(g[2]),d(g[3]),f(g[4])}catch{m=!0}}m&&(i.current=e,t(!0),yB(n,o))}function SB(e,t,n,r,i,a,o,s){return e===`reboot`?`@reboot`:function(e,t,n){return e.map((function(e,r){var i=pB[r],a=TB(e,i),o=n?.[i.type];return CB(a,i,o?.humanizeValue??t)}))}([e!==`minute`&&a?a:[],e!==`minute`&&e!==`hour`&&i?i:[],e!==`year`&&e!==`month`||!n?[]:n,e===`year`&&t?t:[],e!==`year`&&e!==`month`&&e!==`week`||!r?[]:r],o,s).join(` `)}function CB(e,t,n,r,i){var a=``;if(function(e,t){return e.length===t.max-t.min+1}(e,t)||e.length===0)a=`*`;else{var o=function(e){if(e.length>2){var t=e[1]-e[0];if(t>1)return t}}(e);a=o&&function(e,t){for(var n=1;n<e.length;n++){var r=e[n-1];if(e[n]-r!==t)return!1}return!0}(e,o)?function(e,t,n){var r=kB(e),i=AB(e),a=e.length===(i-r)/n+1;return!!(r===t.min&&i+n>t.max&&a)}(e,t,o)?`*/${o}`:`${wB(kB(e),t,n,r,i)}-${wB(AB(e),t,n,r,i)}/${o}`:function(e){var t=[],n=null;return e.forEach((function(e,r,i){e===i[r+1]-1?n===null&&(n=e):n===null?t.push(e):(t.push([n,e]),n=null)})),t}(e).map((function(e){return Array.isArray(e)?`${wB(e[0],t,n,r,i)}-${wB(e[1],t,n,r,i)}`:wB(e,t,n,r,i)})).join(`,`)}return a}function wB(e,t,n,r,i){var a=e.toString(),o=t.type,s=t.alt,c=t.min,l=r&&(!0===r||r.includes(o));if(n&&o===`week-days`||n&&o===`months`?a=s[e-c]:e<10&&(l||i===`24-hour-clock`&&(o===`hours`||o===`minutes`))&&(a=a.padStart(2,`0`)),o===`hours`&&i===`12-hour-clock`){var u=e>=12?`PM`:`AM`,d=e%12||12;d<10&&l&&(d=d.toString().padStart(2,`0`)),a=`${d}${u}`}return a}function TB(e,t){var n=gB(_B(DB(e,t)));if(n.length===0)return n;var r=OB(n,t);if(r!==void 0)throw Error(`Value "${r}" out of range for ${t.type}`);return n}function EB(e){if(typeof e!=`string`)throw Error(`Invalid cron string`);var t=e.replace(/\s+/g,` `).trim().split(` `);if(t.length===5)return t.map((function(e,t){return function(e,t){if(e===`*`||e===`*/1`)return[];var n=gB(_B(DB(function(e,t,n){if(n){e=e.toUpperCase();for(var r=0;r<n.length;r++)e=e.replace(n[r],`${r+t}`)}return e}(e,t.min,t.alt).split(`,`).map((function(n){var r,i=n.split(`/`);if(i.length>2)throw Error(`Invalid value "${e} for "${t.type}"`);var a=i[0],o=i[1];r=a===`*`?hB(t.min,t.max):function(e,t,n){var r=e.split(`-`);if(r.length===1){var i=bB(r[0]);if(isNaN(i))throw Error(`Invalid value "${t}" for ${n.type}`);return[i]}if(r.length===2){var a=bB(r[0]),o=bB(r[1]);if(isNaN(a)||isNaN(o))throw Error(`Invalid value "${t}" for ${n.type}`);if(o<a)throw Error(`Max range is less than min range in "${e}" for ${n.type}`);return hB(a,o)}throw Error(`Invalid value "${e}" for ${n.type}`)}(a,e,t);var s=function(e,t){if(e!==void 0){var n=bB(e);if(isNaN(n)||n<1)throw Error(`Invalid interval step value "${e}" for ${t.type}`);return n}}(o,t);return function(e,t){if(t){var n=e[0];e=e.filter((function(e){return e%t==n%t||e===n}))}return e}(r,s)})).flat(),t))),r=OB(n,t);if(r!==void 0)throw Error(`Value "${r}" out of range for ${t.type}`);return n.length===t.total?[]:n}(e,pB[t])}));throw Error(`Invalid cron string format`)}function DB(e,t){return t.type===`week-days`&&(e=e.map((function(e){return e===7?0:e}))),e}function OB(e,t){var n=e[0],r=e[e.length-1];return n<t.min?n:r>t.max?r:void 0}function kB(e){return e[0]}function AB(e){return e[e.length-1]}Object.freeze({__proto__:null,setValuesFromCronString:xB,getCronStringFromValues:SB,partToString:CB,formatValue:wB,parsePartArray:TB,parseCronString:EB});function jB(e){var t=e.value,n=e.grid,r=n===void 0||n,i=e.optionsList,a=e.setValue,o=e.locale,s=e.className,c=e.humanizeLabels,l=e.disabled,u=e.readOnly,d=e.leadingZero,f=e.clockFormat,p=e.period,m=e.unit,h=e.periodicityOnDoubleClick,g=e.mode,_=e.allowClear,v=e.filterOption,y=v===void 0?function(){return!0}:v,b=e.getPopupContainer,x=uB(e,[`value`,`grid`,`optionsList`,`setValue`,`locale`,`className`,`humanizeLabels`,`disabled`,`readOnly`,`leadingZero`,`clockFormat`,`period`,`unit`,`periodicityOnDoubleClick`,`mode`,`allowClear`,`filterOption`,`getPopupContainer`]),S=(0,U.useMemo)((function(){if(t&&Array.isArray(t))return t.map((function(e){return e.toString()}))}),[t]),C=(0,U.useMemo)((function(){return i?i.map((function(e,t){return{value:(m.min===0?t:t+1).toString(),label:e}})).filter(y):dB([],Array(m.total),!0).map((function(e,t){var n=m.min===0?t:t+1;return{value:n.toString(),label:wB(n,m,c,d,f)}})).filter(y)}),[i,d,c,f]),w=(0,U.useCallback)((function(e){var n=e.value;if(!t||t[0]!==Number(n))return(0,W.jsx)(W.Fragment,{});var r=CB(TB(t,m),m,c,d,f),i=r.match(/^\*\/([0-9]+),?/)||[];return(0,W.jsx)(`div`,{children:i[1]?`${o.everyText||mB.everyText} ${i[1]}`:r})}),[t,JSON.stringify(o),c,d,f]),T=(0,U.useCallback)((function(e){var n=Array.isArray(e)?gB(e):[e],r=n;t&&(r=g===`single`?[]:dB([],t,!0),n.forEach((function(e){var n=Number(e);r=t.some((function(e){return e===n}))?r.filter((function(e){return e!==n})):gB(dB(dB([],r,!0),[n],!1))}))),r.length===m.total?a([]):a(r)}),[a,t]),E=(0,U.useCallback)((function(e){if(e!==0&&e!==1){for(var n=m.total+m.min,r=[],i=m.min;i<n;i++)i%e==0&&r.push(i);var o=t&&r&&t.length===r.length&&t.every((function(e,t){return e===r[t]}));a(r.length===C.length||o?[]:r)}else a([])}),[t,C,a]),D=(0,U.useRef)([]),O=(0,U.useCallback)((function(e){if(!u){var t=D.current;t.push({time:new Date().getTime(),value:Number(e)});var n=window.setTimeout((function(){h&&t.length>1&&t[t.length-1].time-t[t.length-2].time<300?t[t.length-1].value===t[t.length-2].value?E(Number(e)):T([t[t.length-2].value,t[t.length-1].value]):T(Number(e)),D.current=[]}),300);return function(){window.clearTimeout(n)}}}),[D,T,E,u,h]),k=(0,U.useCallback)((function(){u||a([])}),[a,u]),A=(0,U.useMemo)((function(){var e;return vB(((e={"react-js-cron-select":!0,"react-js-cron-custom-select":!0})[`${s}-select`]=!!s,e))}),[s]),j=(0,U.useMemo)((function(){var e;return vB(((e={"react-js-cron-select-dropdown":!0})[`react-js-cron-select-dropdown-${m.type}`]=!0,e[`react-js-cron-custom-select-dropdown`]=!0,e[`react-js-cron-custom-select-dropdown-${m.type}`]=!0,e[`react-js-cron-custom-select-dropdown-minutes-large`]=m.type===`minutes`&&p!==`hour`&&p!==`day`,e[`react-js-cron-custom-select-dropdown-minutes-medium`]=m.type===`minutes`&&(p===`day`||p===`hour`),e[`react-js-cron-custom-select-dropdown-hours-twelve-hour-clock`]=m.type===`hours`&&f===`12-hour-clock`,e[`react-js-cron-custom-select-dropdown-grid`]=!!r,e[`${s}-select-dropdown`]=!!s,e[`${s}-select-dropdown-${m.type}`]=!!s,e))}),[s,r,f,p]);return(0,W.jsx)(F,lB({mode:g!==`single`||h?`multiple`:void 0,allowClear:_??!u,virtual:!1,open:!u&&void 0,value:S,onClear:k,tagRender:w,className:A,popupClassName:j,options:C,showSearch:!1,suffixIcon:u?null:void 0,menuItemSelectedIcon:null,popupMatchSelectWidth:!1,onSelect:O,onDeselect:O,disabled:l,dropdownAlign:m.type!==`minutes`&&m.type!==`hours`||p===`day`||p===`hour`?void 0:{points:[`tr`,`br`]},"data-testid":`custom-select-${m.type}`,getPopupContainer:b},x))}function MB(e){var t=e.value,n=e.setValue,r=e.locale,i=e.className,a=e.disabled,o=e.readOnly,s=e.leadingZero,c=e.clockFormat,l=e.period,u=e.periodicityOnDoubleClick,d=e.mode,f=e.allowClear,p=e.filterOption,m=e.getPopupContainer,h=(0,U.useMemo)((function(){var e;return vB(((e={"react-js-cron-field":!0,"react-js-cron-hours":!0})[`${i}-field`]=!!i,e[`${i}-hours`]=!!i,e))}),[i]);return(0,W.jsxs)(`div`,lB({className:h},{children:[r.prefixHours!==``&&(0,W.jsx)(`span`,{children:r.prefixHours||mB.prefixHours}),(0,W.jsx)(jB,{placeholder:r.emptyHours||mB.emptyHours,value:t,unit:pB[1],setValue:n,locale:r,className:i,disabled:a,readOnly:o,leadingZero:s,clockFormat:c,period:l,periodicityOnDoubleClick:u,mode:d,allowClear:f,filterOption:p,getPopupContainer:m})]}))}function NB(e){var t=e.value,n=e.setValue,r=e.locale,i=e.className,a=e.disabled,o=e.readOnly,s=e.leadingZero,c=e.clockFormat,l=e.period,u=e.periodicityOnDoubleClick,d=e.mode,f=e.allowClear,p=e.filterOption,m=e.getPopupContainer,h=(0,U.useMemo)((function(){var e;return vB(((e={"react-js-cron-field":!0,"react-js-cron-minutes":!0})[`${i}-field`]=!!i,e[`${i}-minutes`]=!!i,e))}),[i]);return(0,W.jsxs)(`div`,lB({className:h},{children:[l===`hour`?r.prefixMinutesForHourPeriod!==``&&(0,W.jsx)(`span`,{children:r.prefixMinutesForHourPeriod||mB.prefixMinutesForHourPeriod}):r.prefixMinutes!==``&&(0,W.jsx)(`span`,{children:r.prefixMinutes||mB.prefixMinutes}),(0,W.jsx)(jB,{placeholder:l===`hour`?r.emptyMinutesForHourPeriod||mB.emptyMinutesForHourPeriod:r.emptyMinutes||mB.emptyMinutes,value:t,unit:pB[0],setValue:n,locale:r,className:i,disabled:a,readOnly:o,leadingZero:s,clockFormat:c,period:l,periodicityOnDoubleClick:u,mode:d,allowClear:f,filterOption:p,getPopupContainer:m}),l===`hour`&&r.suffixMinutesForHourPeriod!==``&&(0,W.jsx)(`span`,{children:r.suffixMinutesForHourPeriod||mB.suffixMinutesForHourPeriod})]}))}function PB(e){var t=e.value,n=e.setValue,r=e.locale,i=e.className,a=e.weekDays,o=e.disabled,s=e.readOnly,c=e.leadingZero,l=e.period,u=e.periodicityOnDoubleClick,d=e.mode,f=e.allowClear,p=e.filterOption,m=e.getPopupContainer,h=!a||a.length===0,g=(0,U.useMemo)((function(){var e;return vB(((e={"react-js-cron-field":!0,"react-js-cron-month-days":!0,"react-js-cron-month-days-placeholder":!h})[`${i}-field`]=!!i,e[`${i}-month-days`]=!!i,e))}),[i,h]),_=(0,U.useMemo)((function(){return h?r.emptyMonthDays||mB.emptyMonthDays:r.emptyMonthDaysShort||mB.emptyMonthDaysShort}),[h,JSON.stringify(r)]);return!s||t&&t.length>0||(!t||t.length===0)&&(!a||a.length===0)?(0,W.jsxs)(`div`,lB({className:g},{children:[r.prefixMonthDays!==``&&(0,W.jsx)(`span`,{children:r.prefixMonthDays||mB.prefixMonthDays}),(0,W.jsx)(jB,{placeholder:_,value:t,setValue:n,unit:pB[2],locale:r,className:i,disabled:o,readOnly:s,leadingZero:c,period:l,periodicityOnDoubleClick:u,mode:d,allowClear:f,filterOption:p,getPopupContainer:m})]})):null}function FB(e){var t=e.value,n=e.setValue,r=e.locale,i=e.className,a=e.humanizeLabels,o=e.disabled,s=e.readOnly,c=e.period,l=e.periodicityOnDoubleClick,u=e.mode,d=e.allowClear,f=e.filterOption,p=e.getPopupContainer,m=r.months||mB.months,h=(0,U.useMemo)((function(){var e;return vB(((e={"react-js-cron-field":!0,"react-js-cron-months":!0})[`${i}-field`]=!!i,e[`${i}-months`]=!!i,e))}),[i]);return(0,W.jsxs)(`div`,lB({className:h},{children:[r.prefixMonths!==``&&(0,W.jsx)(`span`,{children:r.prefixMonths||mB.prefixMonths}),(0,W.jsx)(jB,{placeholder:r.emptyMonths||mB.emptyMonths,optionsList:m,grid:!1,value:t,unit:lB(lB({},pB[3]),{alt:r.altMonths||mB.altMonths}),setValue:n,locale:r,className:i,humanizeLabels:a,disabled:o,readOnly:s,period:c,periodicityOnDoubleClick:l,mode:u,allowClear:d,filterOption:f,getPopupContainer:p})]}))}function IB(e){var t=e.value,n=e.setValue,r=e.locale,i=e.className,a=e.disabled,o=e.readOnly,s=e.shortcuts,c=e.allowedPeriods,l=e.allowClear,u=e.getPopupContainer,d=[];c.includes(`year`)&&d.push({value:`year`,label:r.yearOption||mB.yearOption}),c.includes(`month`)&&d.push({value:`month`,label:r.monthOption||mB.monthOption}),c.includes(`week`)&&d.push({value:`week`,label:r.weekOption||mB.weekOption}),c.includes(`day`)&&d.push({value:`day`,label:r.dayOption||mB.dayOption}),c.includes(`hour`)&&d.push({value:`hour`,label:r.hourOption||mB.hourOption}),c.includes(`minute`)&&d.push({value:`minute`,label:r.minuteOption||mB.minuteOption}),c.includes(`reboot`)&&s&&(!0===s||s.includes(`@reboot`))&&d.push({value:`reboot`,label:r.rebootOption||mB.rebootOption});var f=(0,U.useCallback)((function(e){o||n(e)}),[n,o]),p=(0,U.useMemo)((function(){var e;return vB(((e={"react-js-cron-field":!0,"react-js-cron-period":!0})[`${i}-field`]=!!i,e[`${i}-period`]=!!i,e))}),[i]),m=(0,U.useMemo)((function(){var e;return vB(((e={"react-js-cron-select":!0,"react-js-cron-select-no-prefix":r.prefixPeriod===``})[`${i}-select`]=!!i,e))}),[i,r.prefixPeriod]),h=(0,U.useMemo)((function(){var e;return vB(((e={"react-js-cron-select-dropdown":!0,"react-js-cron-select-dropdown-period":!0})[`${i}-select-dropdown`]=!!i,e[`${i}-select-dropdown-period`]=!!i,e))}),[i]);return(0,W.jsxs)(`div`,lB({className:p},{children:[r.prefixPeriod!==``&&(0,W.jsx)(`span`,{children:r.prefixPeriod||mB.prefixPeriod}),(0,W.jsx)(F,{defaultValue:t,value:t,onChange:f,options:d,className:m,popupClassName:h,disabled:a,suffixIcon:o?null:void 0,open:!o&&void 0,"data-testid":`select-period`,allowClear:l,getPopupContainer:u},JSON.stringify(r))]}))}function LB(e){var t=e.value,n=e.setValue,r=e.locale,i=e.className,a=e.humanizeLabels,o=e.monthDays,s=e.disabled,c=e.readOnly,l=e.period,u=e.periodicityOnDoubleClick,d=e.mode,f=e.allowClear,p=e.filterOption,m=e.getPopupContainer,h=r.weekDays||mB.weekDays,g=l===`week`||!o||o.length===0,_=(0,U.useMemo)((function(){var e;return vB(((e={"react-js-cron-field":!0,"react-js-cron-week-days":!0,"react-js-cron-week-days-placeholder":!g})[`${i}-field`]=!!i,e[`${i}-week-days`]=!!i,e))}),[i,g]),v=(0,U.useMemo)((function(){return g?r.emptyWeekDays||mB.emptyWeekDays:r.emptyWeekDaysShort||mB.emptyWeekDaysShort}),[g,JSON.stringify(r)]),y=l===`week`||!c||t&&t.length>0||(!t||t.length===0)&&(!o||o.length===0),b=!c||o&&o.length>0||(!o||o.length===0)&&(!t||t.length===0);return y?(0,W.jsxs)(`div`,lB({className:_},{children:[r.prefixWeekDays!==``&&(l===`week`||!b)&&(0,W.jsx)(`span`,{children:r.prefixWeekDays||mB.prefixWeekDays}),r.prefixWeekDaysForMonthAndYearPeriod!==``&&l!==`week`&&b&&(0,W.jsx)(`span`,{children:r.prefixWeekDaysForMonthAndYearPeriod||mB.prefixWeekDaysForMonthAndYearPeriod}),(0,W.jsx)(jB,{placeholder:v,optionsList:h,grid:!1,value:t,unit:lB(lB({},pB[4]),{alt:r.altWeekDays||mB.altWeekDays}),setValue:n,locale:r,className:i,humanizeLabels:a,disabled:s,readOnly:c,period:l,periodicityOnDoubleClick:u,mode:d,allowClear:f,filterOption:p,getPopupContainer:m})]})):null}function RB(e){var t=e.clearButton,n=t===void 0||t,r=e.clearButtonProps,i=r===void 0?{}:r,a=e.clearButtonAction,o=a===void 0?`fill-with-every`:a,s=e.locale,c=s===void 0?mB:s,l=e.value,u=l===void 0?``:l,d=e.setValue,f=e.displayError,p=f===void 0||f,m=e.onError,h=e.className,g=e.defaultPeriod,_=g===void 0?`day`:g,v=e.allowEmpty,y=v===void 0?`for-default-value`:v,b=e.humanizeLabels,x=b===void 0||b,S=e.humanizeValue,C=S!==void 0&&S,w=e.disabled,T=w!==void 0&&w,E=e.readOnly,D=E!==void 0&&E,O=e.leadingZero,k=O!==void 0&&O,A=e.shortcuts,j=A===void 0?[`@yearly`,`@annually`,`@monthly`,`@weekly`,`@daily`,`@midnight`,`@hourly`]:A,M=e.clockFormat,N=e.periodicityOnDoubleClick,P=N===void 0||N,ee=e.mode,te=ee===void 0?`multiple`:ee,ne=e.allowedDropdowns,re=ne===void 0?[`period`,`months`,`month-days`,`week-days`,`hours`,`minutes`]:ne,ie=e.allowedPeriods,ae=ie===void 0?[`year`,`month`,`week`,`day`,`hour`,`minute`,`reboot`]:ie,F=e.allowClear,I=e.dropdownsConfig,oe=e.getPopupContainer,se=(0,U.useRef)(u),ce=(0,U.useRef)(_),le=(0,U.useState)(),ue=le[0],de=le[1],fe=(0,U.useState)(),pe=fe[0],me=fe[1],he=(0,U.useState)(),ge=he[0],_e=he[1],ve=(0,U.useState)(),ye=ve[0],be=ve[1],xe=(0,U.useState)(),Se=xe[0],Ce=xe[1],we=(0,U.useState)(),Te=we[0],Ee=we[1],De=(0,U.useState)(!1),L=De[0],Oe=De[1],ke=(0,U.useState)(!1),Ae=ke[0],je=ke[1],Me=function(e){var t=(0,U.useRef)(e);return(0,U.useEffect)((function(){t.current=e}),[e]),t.current}(Ae),Ne=JSON.stringify(c);(0,U.useEffect)((function(){xB(u,Oe,m,y,se,!0,c,j,Ee,Ce,me,_e,be,de)}),[]),(0,U.useEffect)((function(){u!==se.current&&xB(u,Oe,m,y,se,!1,c,j,Ee,Ce,me,_e,be,de)}),[u,se,Ne,y,j]),(0,U.useEffect)((function(){if(!(ue||Te||ge||pe||ye||Se)||Ae||Me)Ae&&je(!1);else{var e=ue||ce.current,t=SB(e,ge,pe,ye,Se,Te,C,I);d(t,{selectedPeriod:e}),se.current=t,m&&m(void 0),Oe(!1)}}),[ue,pe,ge,ye,Se,Te,C,Ae,I]);var R=(0,U.useCallback)((function(){me(void 0),_e(void 0),be(void 0),Ce(void 0),Ee(void 0);var e=``,t=ue!==`reboot`&&ue?ue:ce.current;(t!==ue&&de(t),o===`fill-with-every`)&&(e=SB(t,void 0,void 0,void 0,void 0,void 0,void 0,void 0)),d(e,{selectedPeriod:t}),se.current=e,je(!0),y===`never`&&o===`empty`?(Oe(!0),yB(m,c)):(m&&m(void 0),Oe(!1))}),[ue,d,m,o]),Pe=(0,U.useMemo)((function(){var e;return vB(((e={"react-js-cron":!0,"react-js-cron-error":L&&p,"react-js-cron-disabled":T,"react-js-cron-read-only":D})[`${h}`]=!!h,e[`${h}-error`]=L&&p&&!!h,e[`${h}-disabled`]=T&&!!h,e[`${h}-read-only`]=D&&!!h,e))}),[h,L,p,T,D]),Fe=i.className,Ie=uB(i,[`className`]),Le=(0,U.useMemo)((function(){var e;return vB(((e={"react-js-cron-clear-button":!0})[`${h}-clear-button`]=!!h,e[`${Fe}`]=!!Fe,e))}),[h,Fe]),Re=(0,U.useMemo)((function(){return n&&!D?(0,W.jsx)(V,lB({className:Le,danger:!0,type:`primary`,disabled:T},Ie,{onClick:R},{children:c.clearButtonText||mB.clearButtonText})):null}),[n,D,Ne,Le,T,JSON.stringify(Ie),R]),ze=ue||ce.current;return(0,W.jsxs)(`div`,lB({className:Pe},{children:[re.includes(`period`)&&(0,W.jsx)(IB,{value:ze,setValue:de,locale:c,className:h,disabled:I?.period?.disabled??T,readOnly:I?.period?.readOnly??D,shortcuts:j,allowedPeriods:ae,allowClear:I?.period?.allowClear??F,getPopupContainer:oe}),ze===`reboot`?Re:(0,W.jsxs)(W.Fragment,{children:[ze===`year`&&re.includes(`months`)&&(0,W.jsx)(FB,{value:ge,setValue:_e,locale:c,className:h,humanizeLabels:I?.months?.humanizeLabels??x,disabled:I?.months?.disabled??T,readOnly:I?.months?.readOnly??D,period:ze,periodicityOnDoubleClick:I?.months?.periodicityOnDoubleClick??P,mode:I?.months?.mode??te,allowClear:I?.months?.allowClear??F,filterOption:I?.months?.filterOption,getPopupContainer:oe}),(ze===`year`||ze===`month`)&&re.includes(`month-days`)&&(0,W.jsx)(PB,{value:pe,setValue:me,locale:c,className:h,weekDays:ye,disabled:I?.[`month-days`]?.disabled??T,readOnly:I?.[`month-days`]?.readOnly??D,leadingZero:I?.[`month-days`]?.leadingZero??k,period:ze,periodicityOnDoubleClick:I?.[`month-days`]?.periodicityOnDoubleClick??P,mode:I?.[`month-days`]?.mode??te,allowClear:I?.[`month-days`]?.allowClear??F,filterOption:I?.[`month-days`]?.filterOption,getPopupContainer:oe}),(ze===`year`||ze===`month`||ze===`week`)&&re.includes(`week-days`)&&(0,W.jsx)(LB,{value:ye,setValue:be,locale:c,className:h,humanizeLabels:I?.[`week-days`]?.humanizeLabels??x,monthDays:pe,disabled:I?.[`week-days`]?.disabled??T,readOnly:I?.[`week-days`]?.readOnly??D,period:ze,periodicityOnDoubleClick:I?.[`week-days`]?.periodicityOnDoubleClick??P,mode:I?.[`week-days`]?.mode??te,allowClear:I?.[`week-days`]?.allowClear??F,filterOption:I?.[`week-days`]?.filterOption,getPopupContainer:oe}),(0,W.jsxs)(`div`,{children:[ze!==`minute`&&ze!==`hour`&&re.includes(`hours`)&&(0,W.jsx)(MB,{value:Se,setValue:Ce,locale:c,className:h,disabled:I?.hours?.disabled??T,readOnly:I?.hours?.readOnly??D,leadingZero:I?.hours?.leadingZero??k,clockFormat:M,period:ze,periodicityOnDoubleClick:I?.hours?.periodicityOnDoubleClick??P,mode:I?.hours?.mode??te,allowClear:I?.hours?.allowClear??F,filterOption:I?.hours?.filterOption,getPopupContainer:oe}),ze!==`minute`&&re.includes(`minutes`)&&(0,W.jsx)(NB,{value:Te,setValue:Ee,locale:c,period:ze,className:h,disabled:I?.minutes?.disabled??T,readOnly:I?.minutes?.readOnly??D,leadingZero:I?.minutes?.leadingZero??k,clockFormat:M,periodicityOnDoubleClick:I?.minutes?.periodicityOnDoubleClick??P,mode:I?.minutes?.mode??te,allowClear:I?.minutes?.allowClear??F,filterOption:I?.minutes?.filterOption,getPopupContainer:oe}),Re]})]})]}))}var zB=({value:e,checked:t,onChange:n,showWarning:r=!0})=>{let i=typeof t==`boolean`?t:!!e;return(0,W.jsxs)(z,{orientation:`vertical`,style:{width:`100%`},children:[(0,W.jsxs)(z,{children:[(0,W.jsx)(ve,{checked:i,onChange:n,checkedChildren:(0,W.jsx)(Te,{}),unCheckedChildren:(0,W.jsx)(Te,{})}),(0,W.jsx)(o.Text,{strong:!0,children:`Enable Network Access`}),(0,W.jsx)(o.Text,{type:`secondary`,children:`(workspace-write sandbox only)`})]}),(0,W.jsx)(o.Text,{type:`secondary`,style:{fontSize:12,display:`block`},children:i?`Allows outbound HTTP/HTTPS requests for package installation and API calls`:`Network access disabled (default, most secure)`}),r&&i&&(0,W.jsx)(k,{title:`Security Warning`,description:(0,W.jsxs)(`div`,{children:[`Enabling network access exposes your environment to:`,(0,W.jsxs)(`ul`,{style:{marginTop:8,marginBottom:0,paddingLeft:20},children:[(0,W.jsx)(`li`,{children:`Prompt injection attacks`}),(0,W.jsx)(`li`,{children:`Data exfiltration of code/secrets`}),(0,W.jsx)(`li`,{children:`Inclusion of malware or vulnerable dependencies`})]}),`Only enable for trusted tasks.`]}),type:`warning`,icon:(0,W.jsx)(Ye,{}),showIcon:!0,style:{marginTop:8}})]})},BB=[{value:`low`,shortLabel:`Lo`,label:`Low`,description:`Minimal thinking, fastest responses`},{value:`medium`,shortLabel:`Md`,label:`Medium`,description:`Moderate thinking`},{value:`high`,shortLabel:`Hi`,label:`High`,description:`Deep reasoning (default)`},{value:`max`,shortLabel:`Mx`,label:`Max`,description:`Maximum effort (Opus only)`}],VB=({value:e=`high`,onChange:t,size:n=`middle`,compact:r=!1,plain:i=!1,fullWidth:a=!1})=>{let{token:s}=I.useToken();return(0,W.jsx)(M,{title:`Reasoning effort level`,children:(0,W.jsx)(F,{value:e,onChange:t,size:n,style:{width:a?`100%`:r?void 0:160,fontSize:r?s.fontSizeSM:void 0},popupMatchSelectWidth:!1,optionLabelProp:`label`,options:BB.map(e=>({value:e.value,label:i?e.label:r?(0,W.jsxs)(`span`,{style:{fontSize:s.fontSizeSM},children:[(0,W.jsx)(ke,{style:{fontSize:s.fontSizeSM-1,marginRight:2}}),e.shortLabel]}):(0,W.jsxs)(`span`,{children:[(0,W.jsx)(ke,{style:{fontSize:12,marginRight:6}}),e.label,` effort`]})})),optionRender:e=>{let t=BB.find(t=>t.value===e.value);return(0,W.jsxs)(z,{size:6,align:`start`,children:[(0,W.jsx)(ke,{style:{marginTop:3}}),(0,W.jsxs)(`div`,{style:{lineHeight:1.3},children:[(0,W.jsx)(`div`,{children:t?.label}),(0,W.jsx)(o.Text,{type:`secondary`,style:{fontSize:11},children:t?.description})]})]})}})})};function HB(e,t,n){return!t||e.some(e=>e.id===t)?e:[n(t),...e]}function UB(e,t,n={}){return e===`cursor`?n.cursorDefaultModel||`composer-latest`:e===`copilot`?n.copilotDefaultModel||Xt(e)||`claude-sonnet-4.6`:Xt(e)||t[0]?.id||``}var{Text:WB}=o,GB=({value:e,onChange:t})=>{let[n,r]=(0,U.useState)([]),[i,a]=(0,U.useState)(!0),[o,s]=(0,U.useState)(null),[c,l]=(0,U.useState)(!1);(0,U.useEffect)(()=>{(async()=>{try{a(!0),s(null),r((await(await Qt(Ki())).service(`opencode/models`).find()).providers||[])}catch(e){console.error(`Failed to fetch OpenCode models:`,e),s(e instanceof Error?e.message:`Failed to fetch models. Is OpenCode server running?`)}finally{a(!1)}})()},[]),(0,U.useEffect)(()=>{if(!e&&n.length>0&&!c&&t){let e=n[0],r=e.models?.[0];e&&r&&(t({provider:e.id,model:r.id}),l(!0))}},[e,n,c,t]);let u=n.find(t=>t.id===e?.provider),d=u?.models||[],f=e=>{let r=n.find(t=>t.id===e);r&&r.models.length>0&&t&&t({provider:e,model:r.models[0].id})},p=n=>{t&&e?.provider&&t({provider:e.provider,model:n})};return i?(0,W.jsxs)(z,{children:[(0,W.jsx)(De,{size:`small`}),(0,W.jsx)(WB,{type:`secondary`,children:`Loading OpenCode models...`})]}):o?(0,W.jsx)(k,{title:`OpenCode Unavailable`,description:o,type:`warning`,showIcon:!0,icon:(0,W.jsx)(S,{}),action:(0,W.jsxs)(WB,{type:`secondary`,style:{fontSize:12},children:[`Start OpenCode server: `,(0,W.jsx)(`code`,{children:`opencode serve --port 4096`})]})}):n.length===0?(0,W.jsx)(k,{title:`No Providers Available`,description:`OpenCode server returned no providers. Check your OpenCode installation.`,type:`info`,showIcon:!0}):(0,W.jsxs)(z,{orientation:`vertical`,style:{width:`100%`},children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(WB,{strong:!0,style:{display:`block`,marginBottom:8},children:`Provider`}),(0,W.jsx)(F,{style:{width:`100%`},value:e?.provider,onChange:f,placeholder:`Select provider`,children:[...n].sort((e,t)=>e.name.localeCompare(t.name)).map(e=>(0,W.jsx)(F.Option,{value:e.id,children:(0,W.jsxs)(z,{children:[(0,W.jsx)(`span`,{children:e.name}),(0,W.jsxs)(WB,{type:`secondary`,style:{fontSize:12},children:[`(`,e.models.length,` models)`]})]})},e.id))})]}),u&&(0,W.jsxs)(`div`,{children:[(0,W.jsx)(WB,{strong:!0,style:{display:`block`,marginBottom:8},children:`Model`}),(0,W.jsx)(F,{style:{width:`100%`},value:e?.model,onChange:p,placeholder:`Select model`,showSearch:!0,optionFilterProp:`children`,children:[...d].sort((e,t)=>e.name.localeCompare(t.name)).map(e=>(0,W.jsx)(F.Option,{value:e.id,children:e.name},e.id))})]}),(0,W.jsxs)(WB,{type:`secondary`,style:{fontSize:12},children:[(0,W.jsx)(S,{}),` Models available based on your OpenCode configuration`]})]})},KB=Object.entries(Pt).map(([e,t])=>({id:e,label:t.name,description:t.description})),qB=Object.entries(Bt).map(([e,t])=>({id:e,label:t.name,description:t.description})),JB=Object.entries(Ut).map(([e,t])=>({id:e,label:t.name,description:t.description})),YB=[{id:yn,label:pn[yn].displayName,description:pn[yn].description}];function XB(e,t){let n=e.findIndex(e=>e.id===t);return n<=0?e:[e[n],...e.slice(0,n),...e.slice(n+1)]}var ZB=({value:e,onChange:t,agent:n,agentic_tool:r,client:i,compact:a=!1})=>{let{token:o}=I.useToken(),s=r||n||`claude-code`,[c,l]=(0,U.useState)(null),[u,f]=(0,U.useState)(null),[p,m]=(0,U.useState)(null),[h,g]=(0,U.useState)(null),[_,v]=(0,U.useState)(null),[y,b]=(0,U.useState)(null),[x,C]=(0,U.useState)(_n),[w,T]=(0,U.useState)(yn);(0,U.useEffect)(()=>{if(s!==`claude-code`&&s!==`claude-code-cli`||!i)return;let e=!1;return(async()=>{try{let t=await i.service(`claude-models`).find();if(e||!t?.models?.length)return;l(t.models.map(e=>({id:e.id,label:e.displayName,description:e.description}))),f(t.source)}catch{}})(),()=>{e=!0}},[s,i]),(0,U.useEffect)(()=>{if(s!==`copilot`||!i)return;let e=!1;return(async()=>{try{let t=await i.service(`copilot-models`).find();if(e||!t?.models?.length)return;let n=t.default||`claude-sonnet-4.6`;m(XB(HB(t.models.map(e=>({id:e.id,label:e.displayName,description:e.description})),n,e=>({id:e,label:e,description:`Default model`})),n)),C(n),g(t.source)}catch{}})(),()=>{e=!0}},[s,i]),(0,U.useEffect)(()=>{if(s!==`cursor`||!i)return;let e=!1;return(async()=>{try{let t=await i.service(`cursor-models`).find();if(e||!t?.models?.length)return;let n=t.default||`composer-latest`;v(XB(HB(t.models.map(e=>({id:e.id,label:e.displayName,description:e.description})),n,e=>({id:e,label:e,description:`Default model`})),n)),T(n),b(t.source)}catch{}})(),()=>{e=!0}},[s,i]);let E=s===`codex`?KB:s===`gemini`?qB:s===`opencode`?[]:s===`copilot`?p??JB:s===`cursor`?XB(_??YB,w):c??hn,D=e?.model?E.some(t=>t.id===e.model):!0,[O,k]=(0,U.useState)(e?.mode||(D?`alias`:`exact`));if(s===`opencode`)return(0,W.jsx)(GB,{value:e?.provider||e?.model?{provider:e.provider||``,model:e.model||``}:void 0,onChange:e=>{t&&t({mode:`exact`,model:e.model,provider:e.provider})}});let A=UB(s,E,{copilotDefaultModel:x,cursorDefaultModel:w}),j=n=>{k(n),t&&t({...e,mode:n,model:e?.model||A})},N=n=>{t&&t({...e,mode:O,model:n})},P=n=>{t&&t({...e,mode:O,model:e?.model||A,advisorModel:n})};if(a){let t=e?.model||A,n=E.map(e=>({value:e.id,label:e.id}));t&&!n.some(e=>e.value===t)&&n.unshift({value:t,label:t});let r=(0,W.jsx)(F,{value:t,onChange:N,size:`small`,showSearch:!0,optionFilterProp:`label`,popupMatchSelectWidth:!1,style:{width:`100%`,fontSize:o.fontSizeSM},options:n});return s===`claude-code`||s===`claude-code-cli`?(0,W.jsxs)(z,{orientation:`vertical`,size:6,style:{width:`100%`},children:[r,(0,W.jsx)(F,{allowClear:!0,showSearch:!0,size:`small`,optionFilterProp:`label`,placeholder:`Advisor model: off`,value:e?.advisorModel,onChange:P,popupMatchSelectWidth:!1,style:{width:`100%`,fontSize:o.fontSizeSM},options:(c??hn).map(e=>({value:e.id,label:`Advisor: ${e.id}`}))})]}):r}return(0,W.jsxs)(z,{orientation:`vertical`,style:{width:`100%`},children:[(0,W.jsx)(d.Group,{value:O,onChange:e=>j(e.target.value),children:(0,W.jsxs)(z,{orientation:`vertical`,children:[(0,W.jsx)(d,{value:`alias`,children:(0,W.jsxs)(z,{children:[`Use model alias (recommended)`,(0,W.jsx)(M,{title:`Automatically uses the latest version of the model`,children:(0,W.jsx)(S,{})})]})}),O===`alias`&&(0,W.jsxs)(`div`,{style:{marginLeft:24,marginTop:8},children:[(0,W.jsx)(F,{showSearch:!0,optionFilterProp:`label`,value:e?.model||A,onChange:N,style:{width:`100%`,minWidth:400},options:E.map(e=>({value:e.id,label:e.id}))}),(s===`claude-code`||s===`claude-code-cli`)&&u&&(0,W.jsx)(`div`,{style:{marginTop:6,fontSize:12,color:o.colorTextTertiary},children:u===`dynamic`?(0,W.jsx)(W.Fragment,{children:`Live list from the Anthropic Models API.`}):(0,W.jsxs)(W.Fragment,{children:[`Showing static fallback. Set `,(0,W.jsx)(`code`,{children:`ANTHROPIC_API_KEY`}),` to see the live model list.`]})}),s===`copilot`&&h&&(0,W.jsx)(`div`,{style:{marginTop:6,fontSize:12,color:o.colorTextTertiary},children:h===`dynamic`?(0,W.jsxs)(W.Fragment,{children:[`Live list from your Copilot account (via SDK `,(0,W.jsx)(`code`,{children:`listModels()`}),`).`]}):(0,W.jsxs)(W.Fragment,{children:[`Showing static fallback. Set `,(0,W.jsx)(`code`,{children:`COPILOT_GITHUB_TOKEN`}),` on the daemon to see your account's live list (including BYOK models).`]})}),s===`cursor`&&y&&(0,W.jsx)(`div`,{style:{marginTop:6,fontSize:12,color:o.colorTextTertiary},children:y===`dynamic`?(0,W.jsxs)(W.Fragment,{children:[`Live list from your Cursor account (via SDK `,(0,W.jsx)(`code`,{children:`Cursor.models.list()`}),`).`]}):(0,W.jsxs)(W.Fragment,{children:[`Showing static fallback. Set `,(0,W.jsx)(`code`,{children:`CURSOR_API_KEY`}),` to see your account's live Cursor model list.`]})})]}),(0,W.jsx)(d,{value:`exact`,children:(0,W.jsxs)(z,{children:[`Specify exact model ID`,(0,W.jsx)(M,{title:`Pin to a specific model release for reproducibility`,children:(0,W.jsx)(S,{})})]})}),O===`exact`&&(0,W.jsxs)(`div`,{style:{marginLeft:24,marginTop:8},children:[(0,W.jsx)(L,{value:e?.model,onChange:e=>N(e.target.value),placeholder:s===`codex`?`e.g., gpt-5.5`:s===`gemini`?`e.g., gemini-2.5-pro`:s===`copilot`?`e.g., gpt-4o or claude-3.5-sonnet`:s===`cursor`?`e.g., composer-latest`:`e.g., claude-opus-4-20250514`,style:{width:`100%`,minWidth:400}}),(0,W.jsxs)(`div`,{style:{marginTop:8,fontSize:12,color:o.colorTextTertiary},children:[`Enter any model ID to pin to a specific version.`,` `,(0,W.jsx)(`a`,{href:s===`codex`?`https://platform.openai.com/docs/models`:s===`gemini`?`https://ai.google.dev/gemini-api/docs/models`:s===`copilot`?`https://github.com/features/copilot`:s===`cursor`?`https://cursor.com/docs/api/sdk/typescript`:`https://platform.claude.com/docs/en/about-claude/models`,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>e.stopPropagation(),style:{fontSize:12,color:`#1677ff`},children:`View available models`})]})]})]})}),(s===`claude-code`||s===`claude-code-cli`)&&(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(z,{size:4,children:[(0,W.jsx)(`span`,{children:`Advisor model`}),(0,W.jsx)(M,{title:`Optional Claude Code advisor tool model. Leave unset to use existing Claude settings or disable session-level override.`,children:(0,W.jsx)(S,{})})]}),(0,W.jsx)(F,{allowClear:!0,showSearch:!0,optionFilterProp:`label`,placeholder:`Not set`,value:e?.advisorModel,onChange:P,style:{width:`100%`,minWidth:400,marginTop:8},options:(c??hn).map(e=>({value:e.id,label:e.id}))})]})]})},QB=[{mode:`default`,label:`default`,description:`Prompt for each tool use (most restrictive)`,icon:(0,W.jsx)(_t,{}),color:`#f5222d`},{mode:`acceptEdits`,label:`acceptEdits`,description:`Auto-accept file edits, ask for other tools (recommended)`,icon:(0,W.jsx)(N,{}),color:`#52c41a`},{mode:`auto`,label:`auto`,description:`Model classifier approves/denies prompts, asks only when unsure`,icon:(0,W.jsx)(ft,{}),color:`#13c2c2`},{mode:`bypassPermissions`,label:`bypassPermissions`,description:`Allow all operations without prompting`,icon:(0,W.jsx)(at,{}),color:`#faad14`},{mode:`plan`,label:`plan`,description:`Generate plan without executing`,icon:(0,W.jsx)(Qe,{}),color:`#1890ff`}],$B=[{mode:`ask`,label:`untrusted`,description:`Only run trusted commands (ls, cat, sed) without approval`,icon:(0,W.jsx)(_t,{}),color:`#f5222d`},{mode:`auto`,label:`on-request`,description:`Model decides when to ask for approval`,icon:(0,W.jsx)(ft,{}),color:`#52c41a`},{mode:`on-failure`,label:`on-failure`,description:`Run all commands, ask only when they fail`,icon:(0,W.jsx)(N,{}),color:`#faad14`},{mode:`allow-all`,label:`never`,description:`Never ask for approval, failures returned to model`,icon:(0,W.jsx)(at,{}),color:`#722ed1`}],eV=[{mode:`default`,label:`default`,description:`Prompt for each tool use (most restrictive)`,icon:(0,W.jsx)(_t,{}),color:`#f5222d`},{mode:`autoEdit`,label:`autoEdit`,description:`Auto-approve file edits, ask for shell/web tools`,icon:(0,W.jsx)(N,{}),color:`#52c41a`},{mode:`yolo`,label:`yolo`,description:`Allow all operations without prompting`,icon:(0,W.jsx)(at,{}),color:`#faad14`}],tV=[{mode:`default`,label:`default`,description:`Proxy all permission requests to Agor UI for approval`,icon:(0,W.jsx)(_t,{}),color:`#f5222d`},{mode:`acceptEdits`,label:`acceptEdits`,description:`Auto-approve read/write operations, ask for shell/MCP (recommended)`,icon:(0,W.jsx)(N,{}),color:`#52c41a`},{mode:`bypassPermissions`,label:`bypassPermissions`,description:`Auto-approve all operations without prompting`,icon:(0,W.jsx)(at,{}),color:`#faad14`}],nV=[{mode:`bypassPermissions`,label:`Autonomous`,description:`Cursor SDK runs autonomously; Agor cannot intercept permission requests yet`,icon:(0,W.jsx)(at,{}),color:`#faad14`}],rV=[{mode:`default`,label:`default`,description:`Prompt for approval before each operation`,icon:(0,W.jsx)(_t,{}),color:`#f5222d`},{mode:`autoEdit`,label:`autoEdit`,description:`Auto-approve all operations (recommended)`,icon:(0,W.jsx)(N,{}),color:`#52c41a`},{mode:`yolo`,label:`yolo`,description:`Fully bypass all permission checks`,icon:(0,W.jsx)(at,{}),color:`#faad14`}],iV=[{value:`read-only`,label:`read-only`,description:`No filesystem writes`},{value:`workspace-write`,label:`workspace-write`,description:`Workspace files only (blocks .git/)`},{value:`danger-full-access`,label:`full-access`,description:`Full filesystem (including .git/)`}],aV=[{value:`untrusted`,label:`untrusted`,description:`Ask for every operation`},{value:`on-request`,label:`on-request`,description:`Model decides when to ask`},{value:`on-failure`,label:`on-failure`,description:`Ask only on failures`},{value:`never`,label:`never`,description:`Auto-approve everything`}],oV=e=>{switch(e){case`codex`:return $B;case`gemini`:return eV;case`opencode`:return rV;case`copilot`:return tV;case`cursor`:return nV;default:return QB}},sV=({value:e,onChange:t,agentic_tool:n=`claude-code`,compact:r=!1,iconOnly:i=!1,plain:a=!1,fullWidth:s=!1,size:c=`middle`,codexSandboxMode:l,codexApprovalPolicy:u,onCodexChange:f})=>{let{token:p}=I.useToken(),m=oV(n),h=n===`cursor`?`bypassPermissions`:e||Tt(n),g=wt(h),_=l??g.sandboxMode,v=u??g.approvalPolicy;if(r){if(n===`codex`&&f)return(0,W.jsxs)(z,{size:4,direction:s?`vertical`:`horizontal`,style:{width:`100%`},children:[(0,W.jsx)(F,{value:_,onChange:e=>f(e,v),size:c,placeholder:`Sandbox`,popupMatchSelectWidth:!1,style:{minWidth:70,width:s?`100%`:void 0,fontSize:p.fontSizeSM},optionLabelProp:`label`,options:iV.map(({value:e,label:t,description:n})=>({label:t,value:e,title:n})),optionRender:e=>(0,W.jsxs)(`div`,{style:{lineHeight:1.3},children:[(0,W.jsx)(`div`,{children:e.label}),(0,W.jsx)(o.Text,{type:`secondary`,style:{fontSize:11},children:e.data.title})]})}),(0,W.jsx)(F,{value:v,onChange:e=>f(_,e),size:c,placeholder:`Approval`,popupMatchSelectWidth:!1,style:{minWidth:70,width:s?`100%`:void 0,fontSize:p.fontSizeSM},optionLabelProp:`label`,options:aV.map(({value:e,label:t,description:n})=>({label:t,value:e,title:n})),optionRender:e=>(0,W.jsxs)(`div`,{style:{lineHeight:1.3},children:[(0,W.jsx)(`div`,{children:e.label}),(0,W.jsx)(o.Text,{type:`secondary`,style:{fontSize:11},children:e.data.title})]})})]});let e=m.find(e=>e.mode===h);return(0,W.jsx)(M,{title:e?`${e.label} — ${e.description}`:`Permission mode`,children:(0,W.jsx)(F,{value:h,onChange:t,style:{fontSize:p.fontSizeSM,width:s?`100%`:void 0},size:c,popupMatchSelectWidth:!1,optionLabelProp:`label`,options:m.map(({mode:e,label:t,description:n,icon:r,color:o})=>({label:a?t:i?(0,W.jsx)(`span`,{style:{color:o,fontSize:p.fontSizeSM},children:r}):(0,W.jsxs)(z,{size:4,style:{fontSize:p.fontSizeSM},children:[(0,W.jsx)(`span`,{style:{color:o},children:r}),(0,W.jsx)(`span`,{children:t})]}),value:e,title:n,icon:r,color:o})),optionRender:e=>{let t=m.find(t=>t.mode===e.value);return(0,W.jsxs)(z,{size:6,align:`start`,children:[t&&(0,W.jsx)(`span`,{style:{color:t.color},children:t.icon}),(0,W.jsxs)(`div`,{style:{lineHeight:1.3},children:[(0,W.jsx)(`div`,{children:t?.label}),(0,W.jsx)(o.Text,{type:`secondary`,style:{fontSize:11},children:t?.description})]})]})}})})}return(0,W.jsx)(d.Group,{value:h,onChange:e=>t?.(e.target.value),children:(0,W.jsx)(z,{orientation:`vertical`,style:{width:`100%`},children:m.map(({mode:e,label:t,description:n,icon:r,color:i})=>(0,W.jsx)(d,{value:e,children:(0,W.jsxs)(z,{children:[(0,W.jsx)(`span`,{style:{color:i},children:r}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(o.Text,{strong:!0,children:t}),(0,W.jsx)(`br`,{}),(0,W.jsx)(o.Text,{type:`secondary`,style:{fontSize:12},children:n})]})]})},e))})})},cV={codex:`Codex Model`,gemini:`Gemini Model`,opencode:`OpenCode LLM Provider`,copilot:`Copilot Model`,cursor:`Cursor Model`},lV=({agenticTool:e,mcpServerById:t,showHelpText:n=!0,compact:r=!1,hideMcpServers:i=!1,client:a})=>{let o=cV[e]??`Claude Model`,s=e===`codex`&&!r;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(B.Item,{name:`modelConfig`,label:o,help:n&&e===`claude-code`?`Choose which Claude model to use (defaults to ${It})`:void 0,children:(0,W.jsx)(ZB,{agentic_tool:e,client:a})}),(0,W.jsx)(B.Item,{name:`permissionMode`,label:`Permission Mode`,help:n?`Control how the agent handles tool execution approvals`:void 0,children:(0,W.jsx)(sV,{agentic_tool:e,compact:r})}),(e===`claude-code`||e===`claude-code-cli`)&&(0,W.jsx)(B.Item,{name:`effort`,label:`Reasoning Effort`,help:n?`Control how much reasoning Claude applies (low = fast, high = thorough, max = Opus only)`:void 0,children:(0,W.jsx)(VB,{})}),s&&(0,W.jsx)(B.Item,{name:`codexSandboxMode`,label:`Sandbox Mode`,help:n?`Controls where Codex can write files (workspace vs. full access)`:void 0,children:(0,W.jsx)(F,{placeholder:`Select sandbox mode`,options:iV.map(({value:e,label:t,description:n})=>({value:e,label:`${t} · ${n}`}))})}),s&&(0,W.jsx)(B.Item,{name:`codexApprovalPolicy`,label:`Approval Policy`,help:n?`Controls whether Codex must ask before executing commands`:void 0,children:(0,W.jsx)(F,{placeholder:`Select approval policy`,options:aV.map(({value:e,label:t,description:n})=>({value:e,label:`${t} · ${n}`}))})}),s&&(0,W.jsx)(B.Item,{name:`codexNetworkAccess`,label:`Network Access`,help:n?`Allow outbound HTTP/HTTPS requests (workspace-write sandbox only)`:void 0,valuePropName:`checked`,children:(0,W.jsx)(zB,{showWarning:n})}),!i&&(0,W.jsx)(zz,{mcpServerById:t,showHelpText:n})]})};function uV(e,t){return t?{modelConfig:t.modelConfig,effort:t.modelConfig?.effort,permissionMode:t.permissionMode||Tt(e),mcpServerIds:t.mcpServerIds||[],...e===`codex`&&{codexSandboxMode:t.codexSandboxMode,codexApprovalPolicy:t.codexApprovalPolicy,codexNetworkAccess:t.codexNetworkAccess}}:{permissionMode:Tt(e),mcpServerIds:[]}}function dV(e,t){return{modelConfig:t.modelConfig?{...t.modelConfig,effort:t.effort}:t.effort?{effort:t.effort}:void 0,permissionMode:t.permissionMode,mcpServerIds:t.mcpServerIds,...e===`codex`&&{codexSandboxMode:t.codexSandboxMode,codexApprovalPolicy:t.codexApprovalPolicy,codexNetworkAccess:t.codexNetworkAccess}}}function fV(e){if(e)return{modelConfig:e.model_config,permissionMode:e.permission_mode,mcpServerIds:e.mcp_server_ids,...e.agentic_tool===`codex`&&{codexSandboxMode:e.codex_sandbox_mode,codexApprovalPolicy:e.codex_approval_policy,codexNetworkAccess:e.codex_network_access}}}function pV(e,t,n){let r=dV(e,t);return{...n,agentic_tool:e,permission_mode:r.permissionMode,model_config:r.modelConfig,mcp_server_ids:r.mcpServerIds,context_files:n?.context_files,codex_sandbox_mode:e===`codex`?r.codexSandboxMode:void 0,codex_approval_policy:e===`codex`?r.codexApprovalPolicy:void 0,codex_network_access:e===`codex`?r.codexNetworkAccess:void 0}}function mV(e){return{modelConfig:void 0,effort:void 0,permissionMode:Tt(e),mcpServerIds:[],...e===`codex`&&{codexSandboxMode:void 0,codexApprovalPolicy:void 0,codexNetworkAccess:void 0}}}var{TextArea:hV}=L,{Text:gV}=o,_V=[`America/Los_Angeles`,`America/Denver`,`America/Chicago`,`America/New_York`,`America/Sao_Paulo`,`Europe/London`,`Europe/Paris`,`Europe/Berlin`,`Asia/Dubai`,`Asia/Kolkata`,`Asia/Shanghai`,`Asia/Tokyo`,`Australia/Sydney`,`Pacific/Auckland`];function vV(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`}catch{return`UTC`}}var yV=`0 * * * *`,bV=({open:e,onClose:t,branchId:n,branchName:r,schedule:i,mcpServerById:a,client:s,onSaved:l})=>{let u=!!i?.schedule_id,{showError:f,showSuccess:p}=dn(),[m]=B.useForm(),[h,g]=(0,U.useState)(i?.agentic_tool_config?.agentic_tool??`claude-code`),[_,v]=(0,U.useState)(!1),[y,b]=(0,U.useState)(!1);(0,U.useEffect)(()=>{if(!e)return;let t=i?.agentic_tool_config?.agentic_tool??`claude-code`,n=uV(t,fV(i?.agentic_tool_config));g(t),v(!1),m.resetFields(),m.setFieldsValue({name:i?.name??``,description:i?.description??``,prompt:i?.prompt??``,cron_expression:i?.cron_expression??yV,timezone_mode:i?.timezone_mode??`local`,timezone:i?.timezone??vV(),agenticTool:t,enabled:i?.enabled??!0,retention:i?.retention??5,allow_concurrent_runs:i?.allow_concurrent_runs??!1,...n})},[e,i,m]);let x=e=>{if(e===h)return;g(e);let t=uV(e);m.setFieldsValue({...t,agenticTool:e,...e!==`codex`&&{codexSandboxMode:void 0,codexApprovalPolicy:void 0,codexNetworkAccess:void 0}})},S=B.useWatch(`cron_expression`,m)??yV,C=B.useWatch(`timezone_mode`,m)??`local`,w=(0,U.useMemo)(()=>{try{return Dt(S)}catch{return null}},[S]);return(0,W.jsx)(nt,{title:u?`Edit schedule — ${i?.name}`:`New schedule for ${r}`,open:e,onCancel:t,width:760,destroyOnClose:!0,footer:[(0,W.jsx)(V,{onClick:t,disabled:y,children:`Cancel`},`cancel`),(0,W.jsx)(V,{type:`primary`,loading:y,onClick:async()=>{if(!s){f(`Not connected to daemon`);return}let e;try{e=await m.validateFields()}catch{return}if(e.timezone_mode===`local`&&!e.timezone){f(`Timezone is required when mode is 'local'`);return}let r={...m.getFieldsValue(!0),...e};b(!0);try{let e={branch_id:n,name:(r.name??``).trim(),description:r.description?.trim()||void 0,prompt:(r.prompt??``).trim(),cron_expression:r.cron_expression??yV,timezone_mode:r.timezone_mode??`local`,timezone:r.timezone_mode===`local`?r.timezone:void 0,agentic_tool_config:pV(h,{modelConfig:r.modelConfig,effort:r.effort,permissionMode:r.permissionMode,mcpServerIds:r.mcpServerIds,codexSandboxMode:r.codexSandboxMode,codexApprovalPolicy:r.codexApprovalPolicy,codexNetworkAccess:r.codexNetworkAccess},i?.agentic_tool_config),enabled:r.enabled??!0,retention:r.retention??5,allow_concurrent_runs:r.allow_concurrent_runs??!1},a;a=u&&i?.schedule_id?await s.service(`schedules`).patch(i.schedule_id,e):await s.service(`schedules`).create(e),p(u?`Schedule updated`:`Schedule created`),l?.(a),t()}catch(e){f(e instanceof Error?e.message:`Failed to save schedule`)}finally{b(!1)}},children:u?`Save`:`Create`},`save`)],children:(0,W.jsxs)(B,{form:m,layout:`vertical`,preserve:!1,style:{marginTop:16},children:[(0,W.jsx)(B.Item,{name:`enabled`,label:`Enabled`,valuePropName:`checked`,children:(0,W.jsx)(ve,{})}),(0,W.jsx)(B.Item,{name:`name`,label:`Name`,rules:[{required:!0,message:`Name is required`}],children:(0,W.jsx)(L,{placeholder:`Hourly heartbeat`})}),(0,W.jsx)(B.Item,{name:`description`,label:`Description (optional)`,children:(0,W.jsx)(L,{placeholder:`What this schedule does`})}),(0,W.jsx)(B.Item,{name:`prompt`,label:`Prompt template`,rules:[{required:!0,message:`Prompt is required`}],help:(0,W.jsxs)(gV,{type:`secondary`,style:{fontSize:12},children:[`Handlebars: `,(0,W.jsx)(`code`,{children:`{{branch.*}}`}),` `,(0,W.jsx)(`code`,{children:`{{schedule.*}}`})]}),children:(0,W.jsx)(hV,{placeholder:`Review the current state of {{branch.name}} and post a status update.`,rows:6})}),(0,W.jsx)(B.Item,{name:`cron_expression`,label:`Cron expression`,rules:[{required:!0,message:`Cron is required`}],extra:(0,W.jsxs)(W.Fragment,{children:[w&&(0,W.jsxs)(gV,{type:`secondary`,style:{fontSize:12},children:[`ⓘ `,w]}),_&&(0,W.jsx)(`div`,{style:{marginTop:12},children:(0,W.jsx)(RB,{value:S,setValue:e=>m.setFieldValue(`cron_expression`,e),clearButton:!1})})]}),children:(0,W.jsxs)(z.Compact,{style:{width:`100%`},children:[(0,W.jsx)(L,{value:S,onChange:e=>m.setFieldValue(`cron_expression`,e.target.value),placeholder:`0 * * * *`}),(0,W.jsx)(V,{onClick:()=>v(e=>!e),children:_?`Hide picker`:`Edit visually`})]})}),(0,W.jsx)(B.Item,{name:`timezone_mode`,label:`Timezone mode`,children:(0,W.jsxs)(d.Group,{children:[(0,W.jsx)(d,{value:`local`,children:`Local time`}),(0,W.jsx)(d,{value:`utc`,children:`UTC`})]})}),C===`local`&&(0,W.jsx)(B.Item,{name:`timezone`,label:`Timezone`,rules:[{required:!0,message:`Timezone is required in local mode`}],children:(0,W.jsx)(ee,{options:_V.map(e=>({value:e,label:e})),filterOption:(e,t)=>(t?.value??``).toLowerCase().includes(e.toLowerCase()),placeholder:`Type or pick an IANA zone (e.g. America/Los_Angeles, Asia/Bangkok)`})}),(0,W.jsx)(B.Item,{label:`Agentic tool`,children:(0,W.jsx)(dr,{agents:pr,selectedAgentId:h,onSelect:e=>x(e),variant:`select`})}),(0,W.jsx)(zz,{mcpServerById:a}),(0,W.jsx)(c,{ghost:!0,destroyOnHidden:!1,expandIcon:({isActive:e})=>(0,W.jsx)(T,{rotate:e?180:0}),items:[{key:`agentic-tool-config`,label:(0,W.jsx)(o.Text,{strong:!0,children:`Agentic Tool Configuration`}),children:(0,W.jsx)(lV,{agenticTool:h,mcpServerById:a,hideMcpServers:!0,client:s})},{key:`schedule-settings`,label:(0,W.jsx)(o.Text,{strong:!0,children:`Schedule Settings`}),children:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(B.Item,{name:`retention`,label:`Retention (sessions to keep; 0 = keep all)`,children:(0,W.jsx)($e,{min:0})}),(0,W.jsx)(B.Item,{name:`allow_concurrent_runs`,label:`Concurrency`,children:(0,W.jsxs)(d.Group,{children:[(0,W.jsx)(d,{value:!1,children:`Block (default)`}),(0,W.jsx)(d,{value:!0,children:`Allow concurrent runs`})]})})]})}],style:{marginTop:16}}),!u&&(0,W.jsx)(k,{style:{marginTop:16},type:`info`,showIcon:!0,message:`Catchup is disabled by default.`,description:`If the daemon is down when a fire is due, only the most recent missed run within the 2-minute grace window will fire. No backfill.`})]})})},xV=20,SV=e=>{switch(e){case`completed`:return`green`;case`failed`:case`timed_out`:return`red`;case`running`:case`stopping`:case`awaiting_permission`:case`awaiting_input`:return`blue`;default:return`default`}},CV=e=>e?new Date(e).toLocaleString():`—`,wV=e=>{let t=e.scheduled_run_at,n=e.last_updated?Date.parse(e.last_updated):null;if(!t||!n||n<=t)return`—`;let r=Math.round((n-t)/1e3);return r<60?`${r}s`:`${Math.floor(r/60)}m ${r%60}s`},TV=({open:e,onClose:t,schedule:n,client:r,onOpenSession:i})=>{let[a,o]=(0,U.useState)([]),[s,c]=(0,U.useState)(!1),l=(0,U.useCallback)(async()=>{if(!(!r||!n?.schedule_id)){c(!0);try{let e=await r.service(`sessions`).find({query:{schedule_id:n.schedule_id,$sort:{scheduled_run_at:-1},$limit:xV}});o(Array.isArray(e)?e:e.data)}catch(e){console.error(`Failed to load schedule runs:`,e)}finally{c(!1)}}},[r,n?.schedule_id]);return(0,U.useEffect)(()=>{e&&l()},[e,l]),(0,W.jsx)(ot,{title:n?`Runs — ${n.name}`:`Runs`,open:e,onClose:t,width:640,destroyOnClose:!0,children:s?(0,W.jsx)(De,{}):a.length===0?(0,W.jsx)(ue,{description:`No runs yet.`}):(0,W.jsx)(E,{rowKey:`session_id`,dataSource:a,columns:[{title:`Scheduled`,key:`scheduled_run_at`,render:e=>CV(e.scheduled_run_at)},{title:`Status`,key:`status`,render:e=>(0,W.jsx)(v,{color:SV(e.status),children:e.status})},{title:`Duration`,key:`duration`,render:e=>wV(e)},{title:``,key:`open`,render:e=>i?(0,W.jsx)(V,{type:`link`,size:`small`,onClick:()=>i(e.session_id),children:`Open`}):null}],pagination:!1,size:`small`})})},{Text:EV}=o,DV=e=>e?new Date(e).toLocaleString():`—`,OV=e=>{try{return Dt(e)}catch{return e}},kV=({branch:e,client:t,mcpServerById:n=new Map,currentUser:r,userById:i=new Map,onOpenSession:o})=>{let{showError:s,showSuccess:c}=dn(),[l,u]=(0,U.useState)([]),[d,f]=(0,U.useState)(!1),[p,m]=(0,U.useState)(!1),[h,g]=(0,U.useState)(null),[_,v]=(0,U.useState)(null),[y,b]=(0,U.useState)(null),x=(0,U.useCallback)(async()=>{if(t){f(!0);try{let n=await t.service(`schedules`).find({query:{branch_id:e.branch_id,$sort:{created_at:-1}}});u(Array.isArray(n)?n:n.data)}catch(e){console.error(`Failed to load schedules:`,e),s(`Failed to load schedules`)}finally{f(!1)}}},[t,e.branch_id,s]);(0,U.useEffect)(()=>{x()},[x]),(0,U.useEffect)(()=>{if(!t)return;let n=t.service(`schedules`),r=t=>t.branch_id===e.branch_id,i=e=>{r(e)&&u(t=>[e,...t])},a=e=>{r(e)&&u(t=>t.map(t=>t.schedule_id===e.schedule_id?e:t))},o=e=>{u(t=>t.filter(t=>t.schedule_id!==e.schedule_id))};return n.on(`created`,i),n.on(`patched`,a),n.on(`removed`,o),()=>{n.off(`created`,i),n.off(`patched`,a),n.off(`removed`,o)}},[t,e.branch_id]);let S=()=>{g(null),m(!0)},C=e=>{g(e),m(!0)},w=async e=>{if(t)try{await t.service(`schedules`).remove(e.schedule_id),c(`Schedule "${e.name}" deleted`)}catch(e){s(e instanceof Error?e.message:`Failed to delete schedule`)}},T=async e=>{if(t){b(e.schedule_id);try{await t.service(`schedules/${e.schedule_id}/run-now`).create({}),c(`Triggered "${e.name}"`)}catch(e){s(e instanceof Error?e.message:`Failed to trigger run`)}finally{b(null)}}},D=async(e,n)=>{if(t)try{await t.service(`schedules`).patch(e.schedule_id,{enabled:n})}catch(e){s(e instanceof Error?e.message:`Failed to update schedule`)}};return(0,W.jsxs)(`div`,{style:{padding:16},children:[(0,W.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,marginBottom:12},children:[(0,W.jsxs)(EV,{strong:!0,children:[`Schedules for `,e.name]}),(0,W.jsx)(V,{type:`primary`,icon:(0,W.jsx)(fe,{}),onClick:S,children:`New`})]}),d?(0,W.jsx)(De,{}):l.length===0?(0,W.jsx)(ue,{description:(0,W.jsx)(`span`,{children:`No schedules yet. Schedule a prompt to fire on a cadence — hourly heartbeats, daily summaries, weekly retros.`}),children:(0,W.jsx)(V,{type:`primary`,icon:(0,W.jsx)(fe,{}),onClick:S,children:`New schedule`})}):(0,W.jsx)(E,{rowKey:`schedule_id`,dataSource:l,columns:[{title:`On`,key:`enabled`,width:60,render:e=>(0,W.jsx)(ve,{checked:e.enabled,onChange:t=>D(e,t),size:`small`})},{title:`Name`,key:`name`,render:e=>(0,W.jsx)(V,{type:`link`,onClick:()=>v(e),style:{padding:0},children:e.name})},{title:`When`,key:`cron`,render:e=>(0,W.jsx)(EV,{children:OV(e.cron_expression)})},{title:`Scheduled by / run as`,key:`created_by`,render:e=>{let t=i.get(e.created_by);return t?(0,W.jsxs)(z,{size:4,children:[(0,W.jsx)(Js,{user:t,showName:!0,size:`small`}),r?.user_id===e.created_by&&(0,W.jsx)(EV,{type:`secondary`,children:`(you)`})]}):(0,W.jsx)(EV,{type:`secondary`,children:e.created_by?cn(e.created_by):`—`})}},{title:`Last run`,key:`last_run_at`,render:e=>e.last_run_session_id&&o?(0,W.jsx)(V,{type:`link`,size:`small`,onClick:()=>o(e.last_run_session_id),children:DV(e.last_run_at)}):DV(e.last_run_at)},{title:`Actions`,key:`actions`,width:160,render:e=>(0,W.jsxs)(z,{size:`small`,children:[(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(a,{}),loading:y===e.schedule_id,disabled:y===e.schedule_id,onClick:()=>T(e),title:`Run now`}),(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(Ze,{}),onClick:()=>v(e),title:`View runs`}),(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(N,{}),onClick:()=>C(e),title:`Edit`}),(0,W.jsx)(A,{title:`Delete schedule?`,description:`Are you sure you want to delete "${e.name}"?`,onConfirm:()=>w(e),okText:`Delete`,cancelText:`Cancel`,okButtonProps:{danger:!0},children:(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(te,{}),danger:!0,title:`Delete`})})]})}],pagination:!1,size:`small`}),(0,W.jsx)(bV,{open:p,onClose:()=>m(!1),branchId:e.branch_id,branchName:e.name,schedule:h,mcpServerById:n,client:t,onSaved:()=>x()}),(0,W.jsx)(TV,{open:_!==null,onClose:()=>v(null),schedule:_,client:t,onOpenSession:o})]})};function AV(e){switch(e){case`running`:case`awaiting_input`:return`processing`;case`stopping`:case`awaiting_permission`:case`timed_out`:return`warning`;case`failed`:return`error`;case`completed`:return`success`;default:return`default`}}var jV=({status:e,size:t=16})=>{let{token:n}=I.useToken(),r={fontSize:t},i=t<=14?`small`:t>=24?`large`:`default`;switch(e){case Rt.COMPLETED:case`completed`:return(0,W.jsx)(Re,{style:{...r,color:n.colorSuccess}});case Rt.RUNNING:case`running`:return(0,W.jsx)(De,{size:i});case Rt.STOPPING:case`stopping`:return(0,W.jsx)(be,{style:{...r,color:n.colorWarning}});case Rt.AWAITING_PERMISSION:case`awaiting_permission`:return(0,W.jsx)(P,{style:{...r,color:n.colorWarning}});case Rt.AWAITING_INPUT:case`awaiting_input`:return(0,W.jsx)(Xe,{style:{...r,color:n.colorPrimary}});case Rt.FAILED:case`failed`:return(0,W.jsx)(Je,{style:{...r,color:n.colorError}});case Rt.STOPPED:return(0,W.jsx)(ae,{style:{...r,color:n.colorWarning}});case Rt.TIMED_OUT:case`timed_out`:return(0,W.jsx)(Ke,{style:{...r,color:n.colorWarning}});case`idle`:return(0,W.jsx)(Ke,{style:{...r,color:n.colorTextDisabled}});default:return(0,W.jsx)(Ke,{style:{...r,color:n.colorTextDisabled}})}},MV=({branch:e,sessions:t,client:n,onSessionClick:r})=>{let{token:a}=I.useToken(),{showSuccess:s,showError:c}=dn(),[l,u]=(0,U.useState)(``),[d,f]=(0,U.useState)(!1),[p,m]=(0,U.useState)([]),[h,g]=(0,U.useState)(!1),[y,b]=(0,U.useState)([]),[x,S]=(0,U.useState)(!1),[C,w]=(0,U.useState)(!1),[T,D]=(0,U.useState)(new Set),O=(0,U.useMemo)(()=>t.filter(e=>!e.archived),[t]),k=(0,U.useRef)(n);k.current=n;let A=(0,U.useCallback)((e,t)=>{let n=e.findIndex(e=>e.session_id===t.session_id);if(n===-1)return[t,...e];if(e[n]===t)return e;let r=[...e];return r[n]=t,r},[]),j=(0,U.useCallback)(async()=>{let t=k.current;if(t){g(!0);try{m(await t.service(`sessions`).findAll({query:{branch_id:e.branch_id,archived:!1,$limit:1e3,$sort:{created_at:-1}}}))}catch{}finally{g(!1)}}},[e.branch_id]),N=(0,U.useCallback)(async()=>{let t=k.current;if(t){w(!0);try{b(await t.service(`sessions`).findAll({query:{branch_id:e.branch_id,archived:!0,$limit:1e3,$sort:{created_at:-1}}})),S(!0)}catch{}finally{w(!1)}}},[e.branch_id]);(0,U.useEffect)(()=>{m(O),g(!1),f(e.archived),b([]),S(!1),w(!1),j()},[O,j,e.archived]),(0,U.useEffect)(()=>{d&&!x&&!C&&N()},[d,x,C,N]),(0,U.useEffect)(()=>{if(!n)return;let t=n.service(`sessions`),r=t=>{t.branch_id===e.branch_id&&(t.archived?b(e=>A(e,t)):m(e=>A(e,t)))},i=t=>{t.branch_id===e.branch_id&&(m(e=>e.filter(e=>e.session_id!==t.session_id)),b(e=>e.filter(e=>e.session_id!==t.session_id)),t.archived?b(e=>A(e,t)):m(e=>A(e,t)))},a=t=>{t.branch_id===e.branch_id&&(m(e=>e.filter(e=>e.session_id!==t.session_id)),b(e=>e.filter(e=>e.session_id!==t.session_id)))};return t.on(`created`,r),t.on(`patched`,i),t.on(`updated`,i),t.on(`removed`,a),()=>{t.removeListener(`created`,r),t.removeListener(`patched`,i),t.removeListener(`updated`,i),t.removeListener(`removed`,a)}},[n,A,e.branch_id]);let P=(0,U.useCallback)(async(e,t)=>{let n=k.current;if(n){D(t=>new Set(t).add(e));try{if(await n.service(`sessions`).patch(e,{archived:t,archived_reason:t?`manual`:void 0}),t){let t=p.find(t=>t.session_id===e);t?(m(t=>t.filter(t=>t.session_id!==e)),b(n=>n.some(t=>t.session_id===e)?n:[{...t,archived:!0},...n])):d&&N()}else{let t=y.find(t=>t.session_id===e);t&&m(e=>A(e,{...t,archived:!1})),b(t=>t.filter(t=>t.session_id!==e))}s(t?`Session archived`:`Session unarchived`)}catch(e){c(e instanceof Error?e.message:`Failed to update session`)}finally{D(t=>{let n=new Set(t);return n.delete(e),n})}}},[p,y,N,d,s,c,A]),ee=(0,U.useMemo)(()=>{if(!d)return p;let e=new Set,t=[];for(let n of p)e.add(n.session_id),t.push(n);for(let n of y)e.has(n.session_id)||t.push(n);return t},[p,y,d]),te=(0,U.useMemo)(()=>{let e=ee;if(d||(e=e.filter(e=>!e.archived)),l.trim()){let t=l.toLowerCase();e=e.filter(e=>Gs(e,{includeAgentFallback:!0}).toLowerCase().includes(t)||e.session_id.toLowerCase().includes(t)||e.agentic_tool.toLowerCase().includes(t)||e.status.toLowerCase().includes(t))}return[...e].sort((e,t)=>{let n=+(e.status===`running`||e.status===`stopping`),r=+(t.status===`running`||t.status===`stopping`);return n===r?new Date(t.created_at).getTime()-new Date(e.created_at).getTime():r-n})},[ee,d,l]),ne=p.length,ie=y.length;return(0,W.jsx)(`div`,{style:{width:`100%`,maxHeight:`70vh`,overflowY:`auto`},children:(0,W.jsxs)(z,{orientation:`vertical`,size:`middle`,style:{width:`100%`},children:[(0,W.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,gap:12,flexWrap:`wrap`},children:[(0,W.jsx)(L,{placeholder:`Search sessions...`,prefix:(0,W.jsx)(_,{}),value:l,onChange:e=>u(e.target.value),allowClear:!0,style:{maxWidth:300}}),(0,W.jsxs)(z,{size:12,children:[(0,W.jsxs)(z,{size:4,children:[(0,W.jsx)(re,{count:ne,showZero:!0,style:{backgroundColor:a.colorPrimary}}),(0,W.jsx)(o.Text,{type:`secondary`,style:{fontSize:12},children:`active`})]}),ie>0&&(0,W.jsxs)(z,{size:4,children:[(0,W.jsx)(re,{count:ie,showZero:!0,style:{backgroundColor:a.colorTextQuaternary}}),(0,W.jsx)(o.Text,{type:`secondary`,style:{fontSize:12},children:`archived`})]}),(0,W.jsxs)(z,{size:4,children:[(0,W.jsx)(ve,{size:`small`,checked:d,onChange:f,loading:C||h,checkedChildren:(0,W.jsx)(ce,{}),unCheckedChildren:(0,W.jsx)(i,{})}),(0,W.jsx)(o.Text,{type:`secondary`,style:{fontSize:12},children:`Show archived`})]})]})]}),(0,W.jsx)(E,{columns:[{title:`Session`,key:`title`,ellipsis:!0,render:(e,t)=>(0,W.jsxs)(z,{size:8,align:`center`,style:{minWidth:0},children:[(0,W.jsx)(cr,{tool:t.agentic_tool,size:18}),(0,W.jsx)(o.Link,{onClick:e=>{e.stopPropagation(),r?.(t.session_id)},style:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,display:`block`},children:Gs(t,{includeAgentFallback:!0})}),t.archived&&(0,W.jsx)(v,{color:`default`,style:{fontSize:10,lineHeight:`16px`,padding:`0 4px`},children:`archived`})]})},{title:`Status`,key:`status`,width:130,render:(e,t)=>(0,W.jsxs)(z,{size:4,children:[(0,W.jsx)(jV,{status:t.status,size:14}),(0,W.jsx)(v,{color:AV(t.status),style:{margin:0,fontSize:11},children:t.status})]}),filters:[{text:`Idle`,value:`idle`},{text:`Running`,value:`running`},{text:`Completed`,value:`completed`},{text:`Failed`,value:`failed`},{text:`Awaiting Permission`,value:`awaiting_permission`},{text:`Awaiting Input`,value:`awaiting_input`},{text:`Timed Out`,value:`timed_out`}],onFilter:(e,t)=>t.status===e},{title:`Created`,key:`created_at`,width:150,render:(e,t)=>(0,W.jsx)(M,{title:new Date(t.created_at).toLocaleString(),children:(0,W.jsx)(o.Text,{type:`secondary`,style:{fontSize:12},children:NV(t.created_at)})}),sorter:(e,t)=>new Date(e.created_at).getTime()-new Date(t.created_at).getTime()},{title:``,key:`actions`,width:40,render:(e,t)=>(0,W.jsx)(Pz,{archived:t.archived,loading:T.has(t.session_id),tooltip:t.archived?`Archived • Click to unarchive`:`Archive session`,onToggle:e=>P(t.session_id,e)})}],dataSource:te,rowKey:`session_id`,size:`small`,pagination:te.length>20?{pageSize:20,showSizeChanger:!1}:!1,locale:{emptyText:d?`No sessions match your search`:ee.length>0?`All sessions are archived. Toggle "Show archived" to see them.`:`No sessions yet`},onRow:e=>({style:{cursor:r?`pointer`:void 0,opacity:e.archived?.6:1},onClick:()=>r?.(e.session_id)})})]})})};function NV(e){let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/1e3);if(n<60)return`just now`;let r=Math.floor(n/60);if(r<60)return`${r}m ago`;let i=Math.floor(r/60);if(i<24)return`${i}h ago`;let a=Math.floor(i/24);if(a<30)return`${a}d ago`;let o=Math.floor(a/30);return o<12?`${o}mo ago`:`${Math.floor(a/365)}y ago`}var PV=(0,U.memo)(MV,(e,t)=>{let n=e.client===null!=(t.client===null);return e.branch.branch_id===t.branch.branch_id&&e.sessions===t.sessions&&!n}),FV=e=>({boardId:e?.board_id||void 0,issueUrl:e?.issue_url||``,prUrl:e?.pull_request_url||``,notes:e?.notes||``,mcpServerIds:e?.mcp_server_ids||[]}),IV=e=>{let t=e?an(e):null;return{displayName:t?.displayName||``,emoji:t?.emoji||``,description:e?.notes||``}},LV=(e,t)=>({permissionSource:e?.permission_source||`override`,selectedOwnerIds:t.length>0?t.map(e=>e.user_id):e?.created_by?[e.created_by]:[],othersCan:e?.others_can||`session`,othersFsAccess:e?.others_fs_access||`read`,allowSessionSharing:!!e?.dangerously_allow_session_sharing,groupGrants:[]}),RV=e=>JSON.stringify([...e].sort());function zV({branch:e,client:t,currentUser:n,open:r}){let[i,a]=(0,U.useState)([]),[o,s]=(0,U.useState)([]),[c,l]=(0,U.useState)([]),[u,d]=(0,U.useState)(!0),[f,p]=(0,U.useState)(!0),[m,h]=(0,U.useState)(`loading`),[g,_]=(0,U.useState)(null),[v,y]=(0,U.useState)(null),[b,x]=(0,U.useState)(null),[S,C]=(0,U.useState)(!1),[w,T]=(0,U.useState)(()=>FV(e)),[E,D]=(0,U.useState)(()=>IV(e)),[O,k]=(0,U.useState)(()=>LV(e,[])),A=(0,U.useRef)(null),j=(0,U.useRef)(!1),M=(0,U.useRef)(!1),N=(0,U.useRef)(!1),P=(0,U.useCallback)((e,t)=>{j.current=!0,T(n=>({...n,[e]:t}))},[]),ee=(0,U.useCallback)((e,t)=>{M.current=!0,D(n=>({...n,[e]:t}))},[]),te=(0,U.useCallback)((e,t)=>{N.current=!0,k(n=>({...n,[e]:t}))},[]);(0,U.useEffect)(()=>{if(!r||!e){A.current=null,j.current=!1,M.current=!1,N.current=!1;return}if(A.current!==e.branch_id){A.current=e.branch_id,j.current=!1,M.current=!1,N.current=!1,T(FV(e)),D(IV(e)),k(LV(e,[])),a([]),s([]),l([]),d(!0),h(`loading`),_(null),p(!0);return}j.current||T(FV(e)),M.current||D(IV(e)),N.current||k(t=>({...t,othersCan:e.others_can||`session`,othersFsAccess:e.others_fs_access||`read`,allowSessionSharing:!!e.dangerously_allow_session_sharing}))},[r,e]),(0,U.useEffect)(()=>{if(!r||!t||!e)return;let n=e.branch_id,i=!1;return(async()=>{try{p(!0),x(null),h(`loading`),_(null),y(null);let r=t.service(`branches/:id/effective-access`).find({route:{id:n}}).catch(e=>(console.warn(`Failed to load effective branch access:`,e),null)),o=await t.service(`branches/:id/owners`).find({route:{id:n}});if(i)return;let c=await r;if(i)return;y(c);let u=o;if(a(u),d(!0),!N.current){let t=u.length>0?u.map(e=>e.user_id):e.created_by?[e.created_by]:[];k(e=>({...e,selectedOwnerIds:t}))}try{let e=await t.service(`users`).findAll({});i||s(e)}catch(e){i||console.warn(`Failed to load users for branch permissions:`,e)}i||p(!1);try{let[e,r]=await Promise.all([t.service(`groups`).findAll({query:{archived:!1}}),t.service(`branches/:id/group-grants`).find({route:{id:n}})]);if(i)return;l(e);let a=r.map(e=>({group_id:e.group_id,can:e.can,fs_access:e.fs_access}));h(`loaded`),_(null),N.current||k(e=>({...e,groupGrants:a}))}catch(e){i||(l([]),h(`unavailable`),_(e instanceof Error?e:Error(String(e))),console.warn(`Failed to load branch group permissions:`,e))}}catch(e){if(i)return;if(e?.code===404||e?.message?.includes(`not found`))d(!1),a([]),s([]),l([]),h(`unavailable`),_(e instanceof Error?e:Error(String(e)));else{let t=e instanceof Error?e:Error(String(e));console.error(`Failed to load branch owners:`,t),x(t),l([]),h(`unavailable`),_(t)}}i||p(!1)})(),()=>{i=!0}},[r,t,e]);let ne=e?$t(e):!1,re=(0,U.useMemo)(()=>{if(!e)return!1;let t=!ne&&w.notes!==(e.notes||``);return w.boardId!==(e.board_id||void 0)||w.issueUrl!==(e.issue_url||``)||w.prUrl!==(e.pull_request_url||``)||t||RV(w.mcpServerIds)!==RV(e.mcp_server_ids||[])},[e,w,ne]),ie=(0,U.useMemo)(()=>{if(!e||!ne)return!1;let t=an(e);return t?E.displayName.trim()!==t.displayName||E.emoji!==(t.emoji||``)||E.description.trim()!==(e.notes||``):!1},[e,E,ne]),ae=(0,U.useMemo)(()=>{if(!e||!u)return!1;let t=i.map(e=>e.user_id);return O.selectedOwnerIds.length!==t.length||O.selectedOwnerIds.some(e=>!t.includes(e))},[e,u,i,O.selectedOwnerIds]),F=(0,U.useMemo)(()=>!e||!u?!1:O.othersCan!==(e.others_can||`session`)||O.othersFsAccess!==(e.others_fs_access||`read`)||O.allowSessionSharing!==!!e.dangerously_allow_session_sharing||O.permissionSource!==(e.permission_source||`override`),[e,u,O]),I=!!(e&&u&&m===`loaded`&&N.current),oe=ae||F||I,se=re||ie||oe,ce=n?.user_id,le=bt(n?.role,Nt.ADMIN),ue=bt(n?.role,Nt.SUPERADMIN),de=i.some(e=>e.user_id===ce),fe=e?.created_by===ce,pe=le||v?.can===`all`||de||e?.others_can===`all`||!u&&fe,me=u&&(le||f||de),he=f?ue:!u||ue||de,ge=ue||!f&&de,_e=(0,U.useCallback)(()=>{T(FV(e)),D(IV(e)),k(LV(e,i)),j.current=!1,M.current=!1,N.current=!1},[e,i]);return{general:w,setGeneral:P,generalChanged:re,assistant:E,setAssistant:ee,assistantChanged:ie,permissions:O,setPermissions:te,permissionsChanged:oe,owners:i,allUsers:o,allGroups:c,groupGrantsStatus:m,groupGrantsError:g,rbacEnabled:u,loadingOwners:f,canViewPermissions:me,ownersLoadError:b,canEditGeneral:he,canEditPermissions:ge,canControlEnvironment:pe,hasChanges:se,saving:S,save:(0,U.useCallback)(async()=>{if(!e||!t)return{ok:!1,error:Error(`Modal not ready`)};C(!0);try{let n=i.map(e=>e.user_id),r=O.selectedOwnerIds.filter(e=>!n.includes(e)),o=n.filter(e=>!O.selectedOwnerIds.includes(e));if(u&&ae&&O.selectedOwnerIds.length===0)throw Error(`At least one owner is required`);if(u&&O.permissionSource===`override`&&O.othersCan===`none`&&O.selectedOwnerIds.length!==1)throw Error(`Private branches must have exactly one private user`);if(u&&ae&&ge)for(let n of r)await t.service(`branches/:id/owners`).create({user_id:n},{route:{id:e.branch_id}});let s={};if(re&&he&&(s.board_id=w.boardId||void 0,s.issue_url=w.issueUrl.trim()===``?null:w.issueUrl,s.pull_request_url=w.prUrl.trim()===``?null:w.prUrl,ne||(s.notes=w.notes.trim()===``?null:w.notes),RV(w.mcpServerIds)!==RV(e.mcp_server_ids||[])&&(s.mcp_server_ids=w.mcpServerIds)),ie&&ne&&he){let t=an(e);t&&(s.custom_context={assistant:{...t,kind:`assistant`,displayName:E.displayName.trim(),emoji:E.emoji||void 0}},s.notes=E.description.trim()||null)}if(u&&F&&ge&&(s.others_can=O.othersCan,s.others_fs_access=O.othersFsAccess,s.dangerously_allow_session_sharing=O.allowSessionSharing,s.permission_source=O.permissionSource),Object.keys(s).length>0&&await t.service(`branches`).patch(e.branch_id,s),u&&ge&&m===`loaded`){let n=await t.service(`branches/:id/group-grants`).find({route:{id:e.branch_id}}),r=O.groupGrants,i=new Set(r.map(e=>e.group_id));for(let i of r){let r=n.find(e=>e.group_id===i.group_id);(!r||r.can!==i.can||(r.fs_access||void 0)!==(i.fs_access||void 0))&&await t.service(`branches/:id/group-grants`).create({group_id:i.group_id,can:i.can,fs_access:i.fs_access},{route:{id:e.branch_id}})}for(let r of n)i.has(r.group_id)||await t.service(`branches/:id/group-grants`).remove(r.group_id,{route:{id:e.branch_id}})}if(u&&ae&&ge)for(let n of o)await t.service(`branches/:id/owners`).remove(n,{route:{id:e.branch_id}});if(ie&&ne&&he&&e.board_id){let n=an(e);if(n&&E.emoji!==(n.emoji||``))try{await t.service(`boards`).patch(e.board_id,{icon:E.emoji||`🤖`})}catch(e){console.error(`Failed to update board icon:`,e)}}if(u&&oe)try{let n=await t.service(`branches/:id/owners`).find({route:{id:e.branch_id}});a(n),k(e=>({...e,selectedOwnerIds:n.map(e=>e.user_id)}))}catch(e){console.error(`Failed to reload owners after save:`,e)}return j.current=!1,M.current=!1,N.current=!1,{ok:!0}}catch(e){return{ok:!1,error:e instanceof Error?e:Error(String(e))}}finally{C(!1)}},[e,t,u,ae,F,oe,ge,m,i,O,re,he,w,ne,ie,E]),reset:_e}}var BV=({open:e,onClose:t,branch:n,repo:r,sessions:i,boardById:a=new Map,boardObjects:o=[],mcpServerById:s=new Map,client:c,currentUser:l,onUpdateBranch:u,onUpdateRepo:d,onArchiveOrDelete:f,onOpenSettings:p,onSessionClick:m,onExecuteScheduleNow:h,defaultTab:g})=>{let{token:_}=I.useToken(),{showSuccess:v,showError:y}=dn(),[b,x]=(0,U.useState)(`general`),S=zV({branch:n,client:c,currentUser:l,open:e}),C=(0,U.useMemo)(()=>new Map(S.allUsers.map(e=>[e.user_id,e])),[S.allUsers]),w=a.get(S.general.boardId||n?.board_id||``);(0,U.useEffect)(()=>{e&&x(g||`general`)},[e,g]),(0,U.useEffect)(()=>{S.ownersLoadError&&y(`Failed to load branch permissions: ${S.ownersLoadError.message}`)},[S.ownersLoadError,y]);let T=n?$t(n):!1,E=(0,U.useMemo)(()=>n?an(n):null,[n]);if(!n||!r)return null;let D=T?`Assistant: ${E?.displayName??n.name}`:`Branch: ${n.name}`,O=async()=>{let e=await S.save();e.ok?(v(T?`Assistant updated`:`Branch updated`),t()):y(e.error.message||`Failed to save changes`)},k=[...T?[{key:`assistant`,label:`Assistant`,children:(0,W.jsx)(sc,{branch:n,canEdit:S.canEditGeneral,state:S.assistant,setField:S.setAssistant})}]:[],{key:`general`,label:`General`,children:(0,W.jsx)(Vz,{branch:n,repo:r,sessions:i,boards:To(a),mcpServers:To(s),canEdit:S.canEditGeneral,state:S.general,setField:S.setGeneral,onArchiveOrDelete:f})},{key:`sessions`,label:(0,W.jsxs)(`span`,{children:[`Sessions`,` `,(0,W.jsx)(re,{count:i.length,showZero:!0,size:`small`,style:{backgroundColor:_.colorPrimaryBgHover}})]}),children:(0,W.jsx)(PV,{branch:n,sessions:i,client:c,onSessionClick:e=>{m?.(e),t()}})},{key:`environment`,label:`Environment`,children:(0,W.jsx)(Rc,{branch:n,repo:r,client:c,onUpdateRepo:d,onUpdateBranch:u,canControlEnvironment:S.canControlEnvironment})},{key:`files`,label:`Files`,children:(0,W.jsx)(jz,{branch:n,client:c})},...S.canViewPermissions?[{key:`permissions`,label:`Permissions`,children:(0,W.jsx)(cB,{loadingOwners:S.loadingOwners,canEdit:S.canEditPermissions,allUsers:S.allUsers,allGroups:S.allGroups,groupGrantsStatus:S.groupGrantsStatus,groupGrantsError:S.groupGrantsError,currentUser:l,client:c,board:w,state:S.permissions,setField:S.setPermissions,ownersLoadError:S.ownersLoadError})}]:[],{key:`schedule`,label:`Schedules`,children:(0,W.jsx)(kV,{branch:n,client:c,mcpServerById:s,currentUser:l,userById:C,onOpenSession:e=>{m?.(e),t()}})},...T?[{key:`knowledge`,label:`Knowledge`,children:(0,W.jsx)(Jz,{branch:n,client:c,canEdit:S.canEditGeneral})}]:[]],A=(S.canEditGeneral||S.canEditPermissions)&&S.hasChanges&&!S.saving;return(0,W.jsx)(nt,{title:D,open:e,onCancel:t,footer:(0,W.jsxs)(z,{children:[S.hasChanges&&(0,W.jsx)(V,{onClick:S.reset,disabled:S.saving,"aria-label":`Reset changes`,children:`Reset`}),(0,W.jsx)(V,{onClick:t,disabled:S.saving,children:`Close`}),(0,W.jsx)(V,{type:`primary`,onClick:O,loading:S.saving,disabled:!A,"aria-label":`Save changes`,children:`Save Changes`})]}),width:900,mask:{closable:!1},styles:{body:{padding:0,maxHeight:`80vh`,overflowY:`auto`}},children:(0,W.jsx)(mt,{activeKey:b,onChange:e=>x(e),items:k})})},VV=(0,U.lazy)(()=>H(()=>Promise.resolve().then(()=>Lr).then(e=>({default:e.ParticleBackground})),void 0));function HV(){throw Error(`Crash test: this is a synthetic render-phase error from About → Crash Test. If you're seeing the friendly crash screen, the global ErrorBoundary works.`)}var UV=({client:e,connected:t,connectionError:n,isAdmin:r=!1})=>{let i=Ki(),[a,s]=(0,U.useState)(``),[c,l]=(0,U.useState)(null),[u,d]=(0,U.useState)(!1),{capturedSha:f}=Ii();return(0,U.useEffect)(()=>{window.AGOR_DAEMON_URL?s(`Runtime injection (window.AGOR_DAEMON_URL)`):typeof window<`u`&&window.location.pathname.startsWith(`/ui`)?s(`Same-host detection (served from /ui)`):s(`Dev mode (explicit port)`),e&&e.service(`health`).find().then(e=>{l(e)}).catch(e=>console.error(`Failed to fetch health info:`,e))},[e]),(0,W.jsxs)(`div`,{style:{position:`relative`,minHeight:500,padding:`24px 0`},children:[(0,W.jsx)(U.Suspense,{fallback:null,children:(0,W.jsx)(VV,{})}),(0,W.jsx)(`div`,{style:{position:`relative`,zIndex:1},children:(0,W.jsxs)(z,{orientation:`vertical`,size:`large`,style:{width:`100%`},children:[(0,W.jsx)(Ne,{title:`Connection Info`,variant:`borderless`,style:{maxWidth:800,margin:`0 auto`},children:(0,W.jsxs)(R,{column:1,bordered:!0,size:`small`,children:[(0,W.jsx)(R.Item,{label:`Status`,children:t?(0,W.jsx)(`span`,{style:{color:`#52c41a`},children:`✓ Connected`}):(0,W.jsx)(`span`,{style:{color:`#ff4d4f`},children:`✗ Disconnected`})}),n&&(0,W.jsx)(R.Item,{label:`Error`,children:(0,W.jsx)(o.Text,{type:`danger`,children:n})}),c?.version&&(0,W.jsx)(R.Item,{label:`Version`,children:c.version}),c?.buildSha&&(0,W.jsxs)(R.Item,{label:`Daemon Build`,children:[(0,W.jsx)(`code`,{children:c.buildSha}),c.builtAt&&(0,W.jsxs)(o.Text,{type:`secondary`,style:{marginLeft:8},children:[`built `,c.builtAt]})]}),f&&(0,W.jsxs)(R.Item,{label:`Tab Captured`,children:[(0,W.jsx)(`code`,{children:f}),oo(f,c?.buildSha)&&(0,W.jsx)(o.Text,{type:`warning`,style:{marginLeft:8},children:`⚠️ out of sync — refresh to load the latest UI`})]}),c?.encryption&&(0,W.jsx)(R.Item,{label:`Encryption`,children:c.encryption.enabled?(0,W.jsxs)(`span`,{style:{color:`#52c41a`},children:[`🔐 Enabled (`,c.encryption.method,`)`]}):(0,W.jsx)(`span`,{style:{color:`#faad14`},children:`🔓 Disabled`})})]})}),r&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Ne,{title:`Daemon Config (Admin Only)`,variant:`borderless`,style:{maxWidth:800,margin:`0 auto`},children:(0,W.jsxs)(R,{column:1,bordered:!0,size:`small`,children:[(0,W.jsx)(R.Item,{label:`Daemon URL`,children:(0,W.jsx)(`code`,{children:i})}),(0,W.jsx)(R.Item,{label:`Detection Method`,children:a}),c?.database&&(typeof c.database==`string`?(0,W.jsx)(R.Item,{label:`Database`,children:(0,W.jsx)(`code`,{children:c.database})}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(R.Item,{label:`Database Type`,children:c.database.dialect===`postgresql`?(0,W.jsx)(`span`,{children:`🐘 PostgreSQL`}):(0,W.jsx)(`span`,{children:`💾 SQLite`})}),c.database.dialect===`postgresql`&&c.database.url&&(0,W.jsx)(R.Item,{label:`Database URL`,children:(0,W.jsx)(`code`,{children:c.database.url})}),c.database.dialect===`sqlite`&&c.database.path&&(0,W.jsx)(R.Item,{label:`Database Path`,children:(0,W.jsx)(`code`,{children:c.database.path})})]})),c?.auth&&(0,W.jsx)(R.Item,{label:`Authentication`,children:`🔐 Required`}),c?.execution&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(R.Item,{label:`Branch RBAC`,children:c.execution.branchRbac?(0,W.jsx)(`span`,{style:{color:`#52c41a`},children:`🛡️ Enabled`}):(0,W.jsx)(`span`,{style:{color:`#faad14`},children:`⚠️ Disabled (open access)`})}),(0,W.jsxs)(R.Item,{label:`Unix User Mode`,children:[(0,W.jsx)(`code`,{children:c.execution.unixUserMode}),c.execution.unixUserMode===`simple`&&(0,W.jsx)(o.Text,{type:`secondary`,style:{marginLeft:8},children:`(no OS isolation)`}),c.execution.unixUserMode===`insulated`&&(0,W.jsx)(o.Text,{type:`secondary`,style:{marginLeft:8},children:`(branch groups)`}),c.execution.unixUserMode===`strict`&&(0,W.jsx)(o.Text,{type:`secondary`,style:{marginLeft:8},children:`(per-user impersonation)`})]})]})]})}),c?.security&&(0,W.jsxs)(Ne,{title:`Security Headers (Admin Only)`,variant:`borderless`,style:{maxWidth:800,margin:`0 auto`},children:[(0,W.jsxs)(R,{column:1,bordered:!0,size:`small`,children:[(0,W.jsxs)(R.Item,{label:`CSP`,children:[c.security.csp.enabled?c.security.csp.reportOnly?(0,W.jsx)(v,{color:`warning`,children:`Report-Only`}):(0,W.jsx)(v,{color:`success`,children:`Enforced`}):(0,W.jsx)(v,{color:`error`,children:`Disabled`}),c.security.csp.reportUri&&(0,W.jsxs)(o.Text,{type:`secondary`,style:{marginLeft:8},children:[`Reports → `,(0,W.jsx)(`code`,{children:c.security.csp.reportUri})]})]}),(0,W.jsx)(R.Item,{label:`CSP Header`,children:(0,W.jsx)(M,{title:`Full Content-Security-Policy header the daemon is emitting. If a resource is blocked, check which directive matches.`,children:(0,W.jsx)(o.Paragraph,{copyable:{text:c.security.csp.header},style:{margin:0,fontFamily:`monospace`,fontSize:12,whiteSpace:`pre-wrap`,wordBreak:`break-all`},children:c.security.csp.header})})}),(0,W.jsxs)(R.Item,{label:`CORS Mode`,children:[(0,W.jsx)(`code`,{children:c.security.cors.mode}),c.security.cors.mode===`wildcard`&&(0,W.jsx)(o.Text,{type:`danger`,style:{marginLeft:8},children:`⚠️ Any origin accepted`}),c.security.cors.mode===`reflect`&&(0,W.jsx)(o.Text,{type:`warning`,style:{marginLeft:8},children:`⚠️ Origin header echoed`})]}),(0,W.jsx)(R.Item,{label:`CORS Credentials`,children:c.security.cors.credentials?(0,W.jsx)(v,{color:`success`,children:`Enabled`}):(0,W.jsx)(v,{color:`default`,children:`Disabled`})}),(0,W.jsxs)(R.Item,{label:`Allowed Origins`,children:[c.security.cors.originCount,` configured`,` `,(0,W.jsxs)(o.Text,{type:`secondary`,children:[`(+ localhost dev ports`,c.security.cors.allowSandpack&&`, + Sandpack`,`)`]})]})]}),(0,W.jsxs)(o.Paragraph,{type:`secondary`,style:{marginTop:12,marginBottom:0,fontSize:12},children:[`Configure via `,(0,W.jsx)(`code`,{children:`security.csp`}),` and `,(0,W.jsx)(`code`,{children:`security.cors`}),` in`,` `,(0,W.jsx)(`code`,{children:`~/.agor/config.yaml`}),`. See`,` `,(0,W.jsx)(`a`,{href:`https://github.com/preset-io/agor/blob/main/context/concepts/security.md`,target:`_blank`,rel:`noopener noreferrer`,children:`context/concepts/security.md`}),`.`]})]}),(0,W.jsx)(Ne,{title:`System Debug Info (Admin Only)`,variant:`borderless`,style:{maxWidth:800,margin:`0 auto`},children:(0,W.jsxs)(R,{column:1,bordered:!0,size:`small`,children:[(0,W.jsx)(R.Item,{label:`Mode`,children:window.location.pathname.startsWith(`/ui`)?(0,W.jsx)(`span`,{children:`npm package (agor-live)`}):(0,W.jsx)(`span`,{children:`Source code (dev)`})}),(0,W.jsx)(R.Item,{label:`UI Location`,children:(0,W.jsx)(`code`,{children:window.location.href})}),(0,W.jsx)(R.Item,{label:`Origin`,children:(0,W.jsx)(`code`,{children:window.location.origin})}),(0,W.jsx)(R.Item,{label:`Path`,children:(0,W.jsx)(`code`,{children:window.location.pathname})}),(0,W.jsxs)(R.Item,{label:`Crash Test`,children:[(0,W.jsxs)(z,{children:[(0,W.jsx)(V,{danger:!0,size:`small`,onClick:()=>d(!0),children:`Trigger render crash`}),(0,W.jsx)(o.Text,{type:`secondary`,style:{fontSize:12},children:`Throws during render to verify the global error boundary. Reload to recover.`})]}),u&&(0,W.jsx)(HV,{})]})]})})]}),(0,W.jsx)(Ne,{variant:`borderless`,style:{maxWidth:800,margin:`0 auto`,textAlign:`center`},children:(0,W.jsxs)(z,{size:`large`,children:[(0,W.jsx)(`a`,{href:`https://github.com/preset-io/agor`,target:`_blank`,rel:`noopener noreferrer`,children:`GitHub`}),(0,W.jsx)(`a`,{href:`https://agor.live`,target:`_blank`,rel:`noopener noreferrer`,children:`Documentation`})]})})]})})]})},{Text:WV,Link:GV}=o,KV={"claude-code":[{field:`ANTHROPIC_API_KEY`,label:`Anthropic API Key`,description:`(pay-as-you-go / Console)`,placeholder:`sk-ant-api03-...`,docUrl:`https://platform.claude.com/settings/keys`,helper:(0,W.jsx)(WV,{type:`secondary`,style:{fontSize:12},children:`If you use a Claude subscription, use the Claude Subscription Token below instead.`})},{field:`CLAUDE_CODE_OAUTH_TOKEN`,label:`Claude Subscription Token`,description:`(Pro / Max plan)`,placeholder:`sk-ant-oat01-...`,docUrl:`https://docs.claude.com/en/docs/claude-code/setup`},{field:`ANTHROPIC_AUTH_TOKEN`,label:`Anthropic Auth Token`,description:`(optional — proxy / enterprise)`,placeholder:`token...`},{field:`ANTHROPIC_BASE_URL`,label:`Anthropic Base URL`,description:`(optional — gateway / proxy)`,placeholder:`https://api.anthropic.com`,type:`text`}],codex:[{field:`OPENAI_API_KEY`,label:`OpenAI API Key`,description:`(Codex)`,placeholder:`sk-proj-...`,docUrl:`https://platform.openai.com/api-keys`,helper:(0,W.jsxs)(WV,{type:`secondary`,style:{fontSize:12},children:[`Alternative: on the machine Agor runs sessions on, run`,` `,(0,W.jsx)(WV,{code:!0,style:{fontSize:12},children:`codex login --device-auth`}),` `,`to use Codex CLI account auth without storing an OpenAI key in Agor.`,` `,(0,W.jsx)(GV,{href:`https://agor.live/guide/extended-install#authentication`,target:`_blank`,children:`Learn more →`})]})},{field:`OPENAI_BASE_URL`,label:`OpenAI Base URL`,description:`(optional — gateway / proxy / self-hosted)`,placeholder:`https://api.openai.com/v1`,type:`text`}],gemini:[{field:`GEMINI_API_KEY`,label:`Gemini API Key`,placeholder:`AIza...`,docUrl:`https://aistudio.google.com/app/apikey`}],copilot:[{field:`COPILOT_GITHUB_TOKEN`,label:`GitHub Token`,description:`(Copilot)`,placeholder:`ghp_...`,docUrl:`https://github.com/settings/tokens`}],cursor:[{field:`CURSOR_API_KEY`,label:`Cursor API Key`,description:`(experimental SDK)`,placeholder:`key_...`,docUrl:`https://cursor.com/dashboard/integrations`}],opencode:[],"claude-code-cli":[{field:`ANTHROPIC_API_KEY`,label:`Anthropic API Key`,description:`(pay-as-you-go / Console)`,placeholder:`sk-ant-api03-...`,docUrl:`https://platform.claude.com/settings/keys`,helper:(0,W.jsx)(WV,{type:`secondary`,style:{fontSize:12},children:`If you use a Claude subscription, use the Claude Subscription Token below instead.`})},{field:`CLAUDE_CODE_OAUTH_TOKEN`,label:`Claude Subscription Token`,description:`(Pro / Max plan)`,placeholder:`sk-ant-oat01-...`,docUrl:`https://docs.claude.com/en/docs/claude-code/setup`}]},qV=({tool:e,fieldStatus:t,onSave:n,onClear:r,saving:i={},disabled:a=!1,fields:o,publicValues:s})=>{let{token:c}=I.useToken(),[l,u]=(0,U.useState)({}),d=o??KV[e]??[],f=async e=>{let t=l[e]?.trim();t&&(await n(e,t),u(t=>({...t,[e]:``})))},p=n=>{let{field:o,label:d,description:p,placeholder:m,docUrl:h,helper:g,type:_=`password`}=n,v=!!t[o],y=_===`password`?L.Password:L,b=_===`text`&&v?s?.[o]:void 0;return(0,W.jsx)(`div`,{style:{marginBottom:c.marginLG},children:(0,W.jsxs)(z,{orientation:`vertical`,size:`small`,style:{width:`100%`},children:[(0,W.jsxs)(z,{wrap:!0,children:[(0,W.jsx)(WV,{strong:!0,children:d}),p&&(0,W.jsx)(WV,{type:`secondary`,children:p}),(0,W.jsx)(M,{title:(0,W.jsxs)(`span`,{children:[`Passed to the `,e,` SDK as `,(0,W.jsx)(`code`,{children:o})]}),children:(0,W.jsx)(S,{style:{color:c.colorTextSecondary,cursor:`help`}})}),v?(0,W.jsx)(Zn,{icon:(0,W.jsx)(Re,{}),color:`success`,children:`Set`}):(0,W.jsx)(Zn,{icon:(0,W.jsx)(Je,{}),color:`default`,children:`Not Set`})]}),v?(0,W.jsxs)(z,{wrap:!0,size:`small`,style:{width:`100%`},children:[b&&(0,W.jsx)(WV,{code:!0,copyable:!0,style:{fontSize:c.fontSizeSM,wordBreak:`break-all`},children:b}),(0,W.jsx)(V,{danger:!0,icon:(0,W.jsx)(te,{}),onClick:()=>r(o),loading:i[o],disabled:a,children:`Clear`})]}):(0,W.jsxs)(z.Compact,{style:{width:`100%`},children:[(0,W.jsx)(y,{placeholder:m,value:l[o]||``,onChange:e=>u(t=>({...t,[o]:e.target.value})),onPressEnter:()=>f(o),style:{flex:1},disabled:a}),(0,W.jsx)(V,{type:`primary`,onClick:()=>f(o),loading:i[o],disabled:a||!l[o]?.trim(),children:`Save`})]}),h&&(0,W.jsxs)(WV,{type:`secondary`,style:{fontSize:c.fontSizeSM},children:[`Get your key at:`,` `,(0,W.jsx)(GV,{href:h,target:`_blank`,children:h})]}),g,o===`CLAUDE_CODE_OAUTH_TOKEN`&&!v&&(0,W.jsxs)(WV,{type:`secondary`,style:{fontSize:c.fontSizeSM},children:[`On the machine Agor runs sessions on, run`,` `,(0,W.jsx)(WV,{code:!0,style:{fontSize:c.fontSizeSM},children:`claude setup-token`}),` `,`and paste the printed token here. This uses Claude subscription auth instead of a raw API key.`]}),o===`ANTHROPIC_AUTH_TOKEN`&&(0,W.jsx)(WV,{type:`secondary`,style:{fontSize:c.fontSizeSM},children:`Alternative to the API key for token-based auth (AWS Bedrock, OAuth proxies, custom auth flows). Leave empty unless your gateway requires it.`}),o===`ANTHROPIC_BASE_URL`&&(0,W.jsx)(WV,{type:`secondary`,style:{fontSize:c.fontSizeSM},children:`Override only when routing Claude Code through an internal gateway, proxy, or regional endpoint. Leave empty to use Anthropic's default API.`}),o===`OPENAI_BASE_URL`&&(0,W.jsx)(WV,{type:`secondary`,style:{fontSize:c.fontSizeSM},children:`Point Codex at any OpenAI-compatible endpoint (internal gateway, corporate proxy, or a localhost server like vLLM / Ollama / LM Studio). Leave empty to use OpenAI's default API. The OpenAI API Key above is sent as the bearer token.`}),o===`COPILOT_GITHUB_TOKEN`&&(0,W.jsxs)(WV,{type:`secondary`,style:{fontSize:c.fontSizeSM},children:[`Falls back to`,` `,(0,W.jsx)(WV,{code:!0,style:{fontSize:c.fontSizeSM},children:`GH_TOKEN`}),` `,`/`,` `,(0,W.jsx)(WV,{code:!0,style:{fontSize:c.fontSizeSM},children:`GITHUB_TOKEN`}),` `,`if unset. Set this explicitly to point Copilot at a different account (e.g. one with an active Copilot subscription) or to limit blast radius — the global git token often has broader scopes than Copilot needs.`]})]})},o)};return d.length===0?null:(0,W.jsx)(z,{orientation:`vertical`,size:`large`,style:{width:`100%`},children:d.map(e=>p(e))})},JV={"claude-code":KV[`claude-code`].filter(e=>e.field!==`CLAUDE_CODE_OAUTH_TOKEN`),"claude-code-cli":KV[`claude-code-cli`].filter(e=>e.field!==`CLAUDE_CODE_OAUTH_TOKEN`),codex:KV.codex.filter(e=>e.field!==`OPENAI_BASE_URL`),gemini:KV.gemini,copilot:KV.copilot,cursor:KV.cursor,opencode:KV.opencode},YV=({tool:e,fieldStatus:t,keysError:n,savingKeys:r,onSave:i,onClear:a,onClearError:o})=>{let{token:s}=I.useToken();return(0,W.jsxs)(`div`,{style:{paddingTop:s.paddingMD},children:[(0,W.jsx)(k,{title:(0,W.jsxs)(`span`,{children:[`This is the `,(0,W.jsx)(`strong`,{children:`global API key`}),` fallback for users without their own credentials. CLI login alternatives are configured on the machine Agor runs sessions on.`,` `,(0,W.jsx)(`a`,{href:`https://agor.live/guide/extended-install#authentication`,target:`_blank`,rel:`noopener noreferrer`,children:`Learn more →`})]}),type:`info`,showIcon:!0,style:{marginBottom:s.marginLG}}),n&&(0,W.jsx)(k,{title:n,type:`error`,icon:(0,W.jsx)(Ye,{}),showIcon:!0,closable:!0,onClose:o,style:{marginBottom:s.marginLG}}),(0,W.jsx)(qV,{tool:e,fields:JV[e],fieldStatus:t,onSave:i,onClear:a,saving:r})]})},XV=({client:e})=>{let{token:t}=I.useToken(),{showSuccess:n,showError:r}=dn(),[i,a]=(0,U.useState)(!0),[o,s]=(0,U.useState)({}),[c,l]=(0,U.useState)(null),[u,d]=(0,U.useState)({}),[f]=B.useForm(),[p,m]=(0,U.useState)(!1),[h,g]=(0,U.useState)(`http://localhost:4096`),[_,v]=(0,U.useState)(null),[y,b]=(0,U.useState)(!1),[x,C]=(0,U.useState)(!0);(0,U.useEffect)(()=>{e&&(async()=>{try{a(!0),l(null);let t=await e.service(`config`).get(`credentials`),n={};for(let e of Object.values(JV))for(let{field:r}of e)n[r]=!!t?.[r];d(n)}catch(e){console.error(`Failed to load API keys:`,e),l(e instanceof Error?e.message:`Failed to load API keys`)}finally{a(!1)}})()},[e]),(0,U.useEffect)(()=>{e&&(async()=>{try{C(!0);let t=await e.service(`config`).get(`opencode`);t&&(m(t.enabled||!1),g(t.serverUrl||`http://localhost:4096`))}catch(e){console.error(`Failed to load OpenCode config:`,e)}finally{C(!1)}})()},[e]);let w=async(t,n)=>{if(e)try{s(e=>({...e,[t]:!0})),l(null),await e.service(`config`).patch(null,{credentials:{[t]:n}}),d(e=>({...e,[t]:!0}))}catch(e){throw console.error(`Failed to save ${t}:`,e),l(e instanceof Error?e.message:`Failed to save ${t}`),e}finally{s(e=>({...e,[t]:!1}))}},T=async t=>{if(e)try{s(e=>({...e,[t]:!0})),l(null),await e.service(`config`).patch(null,{credentials:{[t]:null}}),d(e=>({...e,[t]:!1}))}catch(e){throw console.error(`Failed to clear ${t}:`,e),l(e instanceof Error?e.message:`Failed to clear ${t}`),e}finally{s(e=>({...e,[t]:!1}))}};return i||x?(0,W.jsx)(`div`,{style:{textAlign:`center`,padding:t.paddingLG},children:(0,W.jsx)(De,{size:`large`})}):(0,W.jsx)(`div`,{style:{padding:t.paddingMD},children:(0,W.jsx)(mt,{defaultActiveKey:`claude-code`,items:[{key:`claude-code`,label:`Claude Code`,children:(0,W.jsx)(YV,{tool:`claude-code`,fieldStatus:u,keysError:c,savingKeys:o,onSave:w,onClear:T,onClearError:()=>l(null)})},{key:`codex`,label:`Codex`,children:(0,W.jsx)(YV,{tool:`codex`,fieldStatus:u,keysError:c,savingKeys:o,onSave:w,onClear:T,onClearError:()=>l(null)})},{key:`gemini`,label:`Gemini`,children:(0,W.jsx)(YV,{tool:`gemini`,fieldStatus:u,keysError:c,savingKeys:o,onSave:w,onClear:T,onClearError:()=>l(null)})},{key:`copilot`,label:`GitHub Copilot`,children:(0,W.jsx)(YV,{tool:`copilot`,fieldStatus:u,keysError:c,savingKeys:o,onSave:w,onClear:T,onClearError:()=>l(null)})},{key:`cursor`,label:`Cursor SDK`,children:(0,W.jsx)(YV,{tool:`cursor`,fieldStatus:u,keysError:c,savingKeys:o,onSave:w,onClear:T,onClearError:()=>l(null)})},{key:`opencode`,label:`OpenCode`,children:(0,W.jsxs)(`div`,{style:{paddingTop:t.paddingMD},children:[(0,W.jsx)(k,{title:`OpenCode.ai Integration`,description:(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`p`,{style:{marginBottom:t.marginXS},children:[`OpenCode provides access to `,(0,W.jsx)(`strong`,{children:`75+ LLM providers`}),` including local models, custom endpoints, and privacy-focused options.`]}),(0,W.jsxs)(`p`,{style:{marginBottom:0},children:[`To use OpenCode sessions, you must run the OpenCode server separately.`,` `,(0,W.jsx)(`a`,{href:`https://agor.live/guide/opencode-setup`,target:`_blank`,rel:`noopener noreferrer`,children:`Setup Guide →`})]})]}),type:`info`,icon:(0,W.jsx)(S,{}),showIcon:!0,style:{marginBottom:t.marginLG}}),(0,W.jsxs)(B,{form:f,layout:`vertical`,children:[(0,W.jsx)(B.Item,{label:`Enable OpenCode Integration`,children:(0,W.jsxs)(z,{children:[(0,W.jsx)(ve,{checked:p,onChange:m,checkedChildren:`Enabled`,unCheckedChildren:`Disabled`}),(0,W.jsx)(`span`,{style:{color:t.colorTextSecondary,fontSize:12},children:`Enable OpenCode as an agentic tool option in Agor`})]})}),p&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(B.Item,{label:`OpenCode Server URL`,help:`URL where OpenCode server is running (started with 'opencode serve')`,children:(0,W.jsxs)(z.Compact,{style:{width:`100%`},children:[(0,W.jsx)(L,{placeholder:`http://localhost:4096`,value:h,onChange:e=>g(e.target.value)}),(0,W.jsx)(M,{title:`Test connection to OpenCode server`,children:(0,W.jsx)(V,{loading:y,icon:y?(0,W.jsx)(be,{}):void 0,onClick:async()=>{if(e){b(!0);try{v((await e.service(`opencode/health`).find()).connected===!0)}catch(e){console.error(`[OpenCode] Health check error:`,e),v(!1)}finally{b(!1)}}},children:`Test`})})]})}),_!==null&&(0,W.jsx)(k,{title:_?(0,W.jsxs)(z,{children:[(0,W.jsx)(Re,{style:{color:t.colorSuccess}}),(0,W.jsx)(`span`,{children:`Connected to OpenCode server`})]}):(0,W.jsxs)(z,{children:[(0,W.jsx)(Je,{style:{color:t.colorError}}),(0,W.jsx)(`span`,{children:`Cannot connect to OpenCode server`})]}),type:_?`success`:`error`,showIcon:!1,style:{marginBottom:t.marginLG}}),_===!1&&(0,W.jsx)(k,{title:`Server Not Running`,description:(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`p`,{style:{marginBottom:t.marginXS},children:`Start OpenCode server in a separate terminal:`}),(0,W.jsx)(`pre`,{style:{background:t.colorBgContainer,padding:t.paddingXS,borderRadius:t.borderRadius,border:`1px solid ${t.colorBorder}`,overflowX:`auto`,marginBottom:t.marginXS,fontSize:12},children:`opencode serve --port 4096`}),(0,W.jsxs)(`p`,{style:{marginBottom:0,fontSize:12},children:[`Don't have OpenCode?`,` `,(0,W.jsx)(`a`,{href:`https://opencode.ai/docs`,target:`_blank`,rel:`noopener noreferrer`,children:`Installation Guide →`})]})]}),type:`warning`,showIcon:!0,style:{marginBottom:t.marginLG}}),_===!0&&(0,W.jsx)(k,{title:`Ready to use!`,description:`You can now create sessions with OpenCode as the agentic tool.`,type:`success`,showIcon:!0,style:{marginBottom:t.marginLG}})]}),(0,W.jsx)(B.Item,{children:(0,W.jsx)(V,{type:`primary`,onClick:async()=>{if(e)try{await e.service(`config`).patch(null,{opencode:{enabled:p,serverUrl:h}}),n(`OpenCode settings saved successfully`)}catch(e){r(e instanceof Error?e.message:`Failed to save OpenCode settings`),console.error(`Failed to save OpenCode settings:`,e)}},children:`Save OpenCode Settings`})})]}),(0,W.jsxs)(`div`,{style:{marginTop:t.marginLG},children:[(0,W.jsx)(`h4`,{children:`About OpenCode`}),(0,W.jsxs)(`ul`,{style:{fontSize:12,lineHeight:1.8,color:t.colorTextSecondary},children:[(0,W.jsxs)(`li`,{children:[(0,W.jsx)(`strong`,{children:`Multi-Provider Support:`}),` Access Claude, GPT-4, Gemini, and 70+ other models`]}),(0,W.jsxs)(`li`,{children:[(0,W.jsx)(`strong`,{children:`Privacy-First:`}),` All code and context stays local - no cloud storage`]}),(0,W.jsxs)(`li`,{children:[(0,W.jsx)(`strong`,{children:`Local Models:`}),` Support for Ollama, LM Studio, and custom endpoints`]}),(0,W.jsxs)(`li`,{children:[(0,W.jsx)(`strong`,{children:`Open Source:`}),` 30K+ GitHub stars, active community`]})]})]})]})}]})})};function ZV(e=`/ui/`){return e===`/ui/`?`/ui`:``}function QV(e,t=`/ui/`){return`${ZV(t)}${e.startsWith(`/`)?e:`/${e}`}`}function $V(e){return`${e.replace(/\/$/,``)}/`}var eH=new Map;function tH({boardById:e,sessionById:t,branchById:n,artifactById:r}){let i=qt(),a=fn(),o=Mi(),s=(0,U.useRef)(t??eH);s.current=t??eH;let c=(0,U.useRef)(n??eH);c.current=n??eH;let l=(0,U.useRef)(r??eH);l.current=r??eH;let u=(0,U.useRef)(e);u.current=e;let d=(0,U.useRef)(a.pathname);d.current=a.pathname;let f=(0,U.useCallback)((e,t)=>$V(e)===$V(d.current)?!1:(i(e,{replace:t?.replace??!1}),!0),[i]),p=(0,U.useCallback)((e,t)=>{f(So(e,u.current),t)},[f]),m=(0,U.useCallback)(e=>{f(`/`,e)},[f]),h=(0,U.useCallback)((e,t)=>{if(!f(Mt(e),t)){let t=s.current.get(e),n=t?.branch_id?c.current.get(t.branch_id):void 0;n?.board_id&&o(n.branch_id,{boardId:n.board_id})}},[f,o]),g=(0,U.useCallback)((e,t)=>{if(!f(kt(e),t)){let t=c.current.get(e);t?.board_id&&o(e,{boardId:t.board_id})}},[f,o]),_=(0,U.useCallback)((e,t)=>{if(!f(yt(e),t)){let t=l.current.get(e);t?.board_id&&o(e,{boardId:t.board_id})}},[f,o]);return(0,U.useMemo)(()=>({goToSession:h,goToBranch:g,goToArtifact:_,goToBoard:p,goHome:m}),[h,g,_,p,m])}var nH={react:`cyan`,"react-ts":`blue`,vanilla:`green`,"vanilla-ts":`geekblue`},rH=({artifactById:e,branchById:t,boardById:n,onUpdate:r,onDelete:i,onClose:a})=>{let[s,c]=(0,U.useState)(!1),[l,u]=(0,U.useState)(null),[d,f]=(0,U.useState)(``),[p]=B.useForm(),m=tH({boardById:n,artifactById:e}),g=(0,U.useCallback)(e=>{a?.(),m.goToArtifact(e.artifact_id)},[a,m]),_=e=>{u(e),p.setFieldsValue({name:e.name,description:e.description||``,board_id:e.board_id}),c(!0)},y=()=>{l&&p.validateFields().then(e=>{let t={},n=e.name,i=e.description||void 0,a=l.description||void 0;n!==l.name&&(t.name=n),i!==a&&(t.description=i),e.board_id&&e.board_id!==l.board_id&&(t.board_id=e.board_id),Object.keys(t).length>0&&r?.(l.artifact_id,t),p.resetFields(),c(!1),u(null)})},b=To(n).slice().sort((e,t)=>e.name.localeCompare(t.name)).map(e=>({value:e.board_id,label:`${e.icon||`📋`} ${e.name}`})),x=[{title:`Name`,dataIndex:`name`,key:`name`,render:(e,t)=>(0,W.jsxs)(z,{orientation:`vertical`,size:0,children:[(0,W.jsx)(o.Text,{strong:!0,children:(0,W.jsx)(No,{text:e,query:d})}),t.description&&(0,W.jsx)(o.Text,{type:`secondary`,style:{fontSize:12},children:(0,W.jsx)(No,{text:t.description,query:d})})]})},{title:`Template`,dataIndex:`template`,key:`template`,width:120,render:e=>(0,W.jsx)(v,{color:nH[e]||`default`,children:(0,W.jsx)(No,{text:e,query:d})})},{title:`Build`,dataIndex:`build_status`,key:`build_status`,width:110,render:e=>{let t={success:{status:`success`,text:`Success`},error:{status:`error`,text:`Error`},checking:{status:`processing`,text:`Checking`},unknown:{status:`default`,text:`Unknown`}},n=t[e]||t.unknown;return(0,W.jsx)(re,{status:n.status,text:n.text})}},{title:`Branch`,dataIndex:`branch_id`,key:`branch_id`,width:160,render:e=>{if(!e)return(0,W.jsx)(o.Text,{type:`secondary`,children:`—`});let n=t.get(e);return(0,W.jsx)(o.Text,{type:`secondary`,children:(0,W.jsx)(No,{text:n?.name||cn(e),query:d})})}},{title:`Board`,dataIndex:`board_id`,key:`board_id`,width:160,render:e=>{let t=n.get(e);return(0,W.jsx)(o.Text,{type:`secondary`,children:(0,W.jsx)(No,{text:t?`${t.icon||``} ${t.name}`.trim():cn(e),query:d})})}},{title:`Created`,dataIndex:`created_at`,key:`created_at`,width:110,render:e=>new Date(e).toLocaleDateString()},{title:`Actions`,key:`actions`,width:150,render:(e,t)=>(0,W.jsxs)(z,{size:`small`,children:[t.board_id&&(0,W.jsx)(M,{title:`Center map on artifact`,children:(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(h,{}),onClick:e=>{e.stopPropagation(),g(t)}})}),(0,W.jsx)(M,{title:`Open fullscreen`,children:(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(je,{}),href:QV(nn(t.artifact_id)),target:`_blank`,rel:`noopener noreferrer`,onClick:e=>e.stopPropagation()})}),(0,W.jsx)(M,{title:`Edit artifact`,children:(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(N,{}),onClick:()=>_(t)})}),(0,W.jsx)(A,{title:`Delete artifact?`,description:`This will remove "${t.name}" and its files.`,onConfirm:()=>i?.(t.artifact_id),okText:`Delete`,cancelText:`Cancel`,okButtonProps:{danger:!0},children:(0,W.jsx)(M,{title:`Delete artifact`,children:(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(te,{}),danger:!0})})})]})}],S=(0,U.useMemo)(()=>Ao(Eo(e,(e,t)=>e.name.localeCompare(t.name,void 0,{sensitivity:`base`})).filter(e=>!e.archived),d,[e=>e.name,e=>e.description,e=>e.template,e=>e.build_status,e=>e.artifact_id,e=>{let n=e.branch_id?t.get(e.branch_id):void 0;return[n?.name,n?.ref,e.branch_id]},e=>{let t=n.get(e.board_id);return[t?.name,t?.slug,e.board_id]}]),[e,d,t,n]);return(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`div`,{style:{marginBottom:16,display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,W.jsx)(o.Text,{type:`secondary`,children:`Live web application artifacts created by agents via MCP tools.`}),(0,W.jsx)(L,{allowClear:!0,placeholder:`Search name, description, template, branch, or board`,value:d,onChange:e=>f(e.target.value),style:{width:360}})]}),S.length===0?(0,W.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`,minHeight:400},children:(0,W.jsx)(ue,{description:`No artifacts yet`,children:(0,W.jsxs)(o.Text,{type:`secondary`,children:[`Artifacts are created by agents using the `,(0,W.jsx)(`code`,{children:`agor_artifacts_publish`}),` MCP tool.`]})})}):(0,W.jsx)(E,{dataSource:S,columns:x,rowKey:`artifact_id`,pagination:!1,size:`small`}),(0,W.jsx)(nt,{title:`Edit Artifact`,open:s,onOk:y,onCancel:()=>{p.resetFields(),c(!1),u(null)},okText:`Save`,children:(0,W.jsxs)(B,{form:p,layout:`vertical`,style:{marginTop:16},children:[(0,W.jsx)(B.Item,{label:`Name`,name:`name`,rules:[{required:!0,message:`Please enter a name`}],children:(0,W.jsx)(L,{placeholder:`My Artifact`})}),(0,W.jsx)(B.Item,{label:`Description`,name:`description`,children:(0,W.jsx)(L.TextArea,{rows:3,placeholder:`Optional description`})}),(0,W.jsx)(B.Item,{label:`Board`,name:`board_id`,tooltip:`Move this artifact to a different board. Its position on the board is preserved.`,rules:[{required:!0,message:`Please select a board`}],children:(0,W.jsx)(F,{showSearch:!0,placeholder:`Select board...`,options:b,filterOption:(e,t)=>(t?.label?.toString()??``).toLowerCase().includes(e.toLowerCase())})})]})})]})},iH=({branchById:e,repoById:t,boardById:n,sessionsByBranch:r,userById:i,onArchiveOrDelete:a,onRowClick:s,onCreateAssistant:c,onClose:l})=>{let u=tH({boardById:n,branchById:e}),d=(0,U.useCallback)(e=>{l?.(),u.goToBranch(e.branch_id)},[l,u]),{token:f}=I.useToken(),[p,g]=(0,U.useState)(``),[_,v]=(0,U.useState)(!1),[y,b]=(0,U.useState)(null),x=(0,U.useMemo)(()=>{let n=p.trim().toLowerCase(),r=Array.from(e.values()).filter(e=>!e.archived&&$t(e)).sort((e,t)=>{let n=an(e)?.displayName??e.name,r=an(t)?.displayName??t.name;return n.localeCompare(r,void 0,{sensitivity:`base`})});return n?r.filter(e=>{let r=an(e),a=t.get(e.repo_id),o=i.get(e.created_by);return[r?.displayName,e.name,e.notes,o?.name,o?.email,a?.name,a?.slug].some(e=>e?.toLowerCase().includes(n))}):r},[e,t,i,p]);return(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(z,{orientation:`vertical`,size:f.sizeUnit*2,style:{marginBottom:f.sizeUnit*2,width:`100%`},children:[(0,W.jsx)(o.Text,{type:`secondary`,children:`Assistants are persistent AI companions backed by a framework repo. They maintain memory, orchestrate work across branches, and run on scheduled heartbeats.`}),(0,W.jsxs)(z,{style:{width:`100%`,display:`flex`,justifyContent:`space-between`},children:[(0,W.jsx)(L,{allowClear:!0,placeholder:`Search assistants...`,value:p,onChange:e=>g(e.target.value),style:{maxWidth:f.sizeUnit*40}}),(0,W.jsx)(V,{type:`primary`,icon:(0,W.jsx)(fe,{}),onClick:c,disabled:!c,children:`Create Assistant`})]})]}),x.length===0&&!p&&(0,W.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`,minHeight:300},children:(0,W.jsx)(ue,{image:(0,W.jsx)(m,{style:{fontSize:48,color:f.colorTextDisabled}}),description:`No assistants yet`,children:(0,W.jsx)(o.Text,{type:`secondary`,children:`Create an assistant to get started, or use the onboarding wizard.`})})}),(x.length>0||p)&&(0,W.jsx)(E,{dataSource:x,columns:[{title:`Assistant`,key:`assistant`,width:220,render:(e,t)=>{let n=an(t);return(0,W.jsxs)(z,{children:[n?.emoji?(0,W.jsx)(`span`,{style:{fontSize:18},children:n.emoji}):(0,W.jsx)(m,{style:{color:f.colorInfo}}),(0,W.jsx)(o.Text,{strong:!0,children:(0,W.jsx)(No,{text:n?.displayName??t.name,query:p})})]})}},{title:`Description`,key:`description`,render:(e,t)=>{let n=(t.notes??``).trim();if(!n)return(0,W.jsx)(o.Text,{type:`secondary`,italic:!0,style:{fontSize:12},children:`No description`});let r=n.split(`
|
|
284
|
+
`).find(e=>e.trim().length>0)??n;return(0,W.jsx)(Ue,{content:(0,W.jsx)(`div`,{className:`markdown-compact`,style:{maxWidth:480,maxHeight:400,overflowY:`auto`,fontSize:12,lineHeight:1.5},children:(0,W.jsx)(wz,{content:n,showControls:!1})}),trigger:`hover`,placement:`topLeft`,mouseEnterDelay:.3,children:(0,W.jsx)(o.Text,{type:`secondary`,ellipsis:!0,style:{display:`block`,maxWidth:480,fontSize:12,cursor:`help`},children:(0,W.jsx)(No,{text:r,query:p})})})}},{title:`Creator`,key:`creator`,width:160,render:(e,t)=>{let n=i.get(t.created_by);return!n||t.created_by===`anonymous`?(0,W.jsx)(o.Text,{type:`secondary`,style:{fontSize:12},children:t.created_by===`anonymous`?`Anonymous`:`Unknown User`}):(0,W.jsx)(Js,{user:n,showName:!0,size:`small`})}},{title:`Actions`,key:`actions`,width:130,render:(e,t)=>(0,W.jsxs)(z,{size:`small`,children:[t.board_id&&(0,W.jsx)(M,{title:`Center map on assistant`,children:(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(h,{}),onClick:e=>{e.stopPropagation(),d(t)}})}),(0,W.jsx)(M,{title:`Edit assistant`,children:(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(N,{}),onClick:e=>{e.stopPropagation(),s?.(t)}})}),(0,W.jsx)(Fz,{tooltip:`Archive or delete assistant`,onClick:()=>{b(t),v(!0)}})]})}],rowKey:`branch_id`,pagination:{pageSize:10},size:`small`,onRow:e=>({onClick:()=>s?.(e),style:{cursor:s?`pointer`:`default`}})}),y&&(0,W.jsx)(Lz,{open:_,branch:y,sessionCount:(r.get(y.branch_id)||[]).length,environmentRunning:y.environment_instance?.status===`running`,onConfirm:e=>{a?.(y.branch_id,e),v(!1),b(null)},onCancel:()=>{v(!1),b(null)}})]})},aH=[{label:`Rainbow (7 colors)`,value:`linear-gradient(to right, #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #4b0082, #9400d3)`},{label:`Multi-color gradient`,value:`linear-gradient(124deg, #ff2400, #e81d1d, #e8b71d, #e3e81d, #1de840, #1ddde8, #2b1de8, #dd00f3, #dd00f3)`},{label:`Pink to blue gradient`,value:`linear-gradient(180deg, #f093fb 0%, #f5576c 25%, #4facfe 50%, #00f2fe 75%, #43e97b 100%)`},{label:`Gold shimmer`,value:`linear-gradient(135deg, #f5af19 0%, #f12711 30%, #f5af19 60%, #f12711 100%)`},{label:`Cyan/magenta grid`,value:`repeating-linear-gradient(0deg, transparent, transparent 2px, #0ff 2px, #0ff 4px), repeating-linear-gradient(90deg, transparent, transparent 2px, #f0f 2px, #f0f 4px), linear-gradient(180deg, #000, #001a1a)`},{label:`Diagonal stripes (colorful)`,value:`repeating-linear-gradient(45deg, #ff006e 0px, #ff006e 10px, #ffbe0b 10px, #ffbe0b 20px, #8338ec 20px, #8338ec 30px, #3a86ff 30px, #3a86ff 40px)`},{label:`Conic gradient (warm colors)`,value:`conic-gradient(from 45deg, #ff0080, #ff8c00, #40e0d0, #ff0080, #ff8c00, #40e0d0, #ff0080)`},{label:`Dark with purple/pink spots`,value:`radial-gradient(ellipse at top, #1b2735 0%, #090a0f 100%), radial-gradient(circle at 20% 50%, rgba(120, 0, 255, 0.3) 0%, transparent 50%), radial-gradient(circle at 80% 80%, rgba(255, 0, 120, 0.3) 0%, transparent 50%)`},{label:`Quadrant blocks (conic)`,value:`repeating-conic-gradient(from 0deg at 50% 50%, #ff006e 0deg 90deg, #8338ec 90deg 180deg, #3a86ff 180deg 270deg, #fb5607 270deg 360deg)`},{label:`RGB stripes`,value:`linear-gradient(90deg, #000 0%, #f00 20%, #000 21%, #0f0 40%, #000 41%, #00f 60%, #000 61%, #fff 80%, #000 81%)`},{label:`Fine diagonal lines (B&W)`,value:`repeating-linear-gradient(45deg, #000, #000 1px, #fff 1px, #fff 2px)`},{label:`Dark with magenta/cyan glow`,value:`radial-gradient(circle at 30% 50%, rgba(255, 0, 255, 0.5), transparent 50%), radial-gradient(circle at 70% 70%, rgba(0, 255, 255, 0.5), transparent 50%), linear-gradient(180deg, #0a0a0a, #1a1a2e)`},{label:`Sunburst (conic)`,value:`conic-gradient(from 0deg, #ffbe0b 0deg, #fb5607 60deg, #ff006e 120deg, #8338ec 180deg, #3a86ff 240deg, #ffbe0b 300deg, #fb5607 360deg)`},{label:`Checkerboard (purple)`,value:`repeating-linear-gradient(45deg, #606dbc, #606dbc 10px, #465298 10px, #465298 20px)`}],oH=[{label:`Slow gradient shift (12s)`,value:`background-size: 400% 400%;
|
|
285
|
+
animation: agorGradientShift 12s ease infinite;
|
|
286
|
+
|
|
287
|
+
@keyframes agorGradientShift {
|
|
288
|
+
0%, 100% { background-position: 0% 50%; }
|
|
289
|
+
50% { background-position: 100% 50%; }
|
|
290
|
+
}`},{label:`Fast gradient shift (4s)`,value:`background-size: 400% 400%;
|
|
291
|
+
animation: agorGradientFast 4s ease infinite;
|
|
292
|
+
|
|
293
|
+
@keyframes agorGradientFast {
|
|
294
|
+
0%, 100% { background-position: 0% 50%; }
|
|
295
|
+
50% { background-position: 100% 50%; }
|
|
296
|
+
}`},{label:`Diagonal sweep (8s)`,value:`background-size: 400% 400%;
|
|
297
|
+
animation: agorDiagonalSweep 8s linear infinite;
|
|
298
|
+
|
|
299
|
+
@keyframes agorDiagonalSweep {
|
|
300
|
+
0% { background-position: 0% 0%; }
|
|
301
|
+
50% { background-position: 100% 100%; }
|
|
302
|
+
100% { background-position: 0% 0%; }
|
|
303
|
+
}`},{label:`Pulse zoom (6s)`,value:`background-size: 200% 200%;
|
|
304
|
+
animation: agorPulse 6s ease-in-out infinite;
|
|
305
|
+
|
|
306
|
+
@keyframes agorPulse {
|
|
307
|
+
0%, 100% { background-size: 200% 200%; background-position: center; }
|
|
308
|
+
50% { background-size: 300% 300%; background-position: center; }
|
|
309
|
+
}`},{label:`Horizontal scroll (20s)`,value:`background-size: 200% 100%;
|
|
310
|
+
animation: agorHScroll 20s linear infinite;
|
|
311
|
+
|
|
312
|
+
@keyframes agorHScroll {
|
|
313
|
+
0% { background-position: 0% 50%; }
|
|
314
|
+
100% { background-position: 200% 50%; }
|
|
315
|
+
}`},{label:`Rotate (conic, 10s)`,value:`animation: agorRotate 10s linear infinite;
|
|
316
|
+
|
|
317
|
+
@keyframes agorRotate {
|
|
318
|
+
0% { filter: hue-rotate(0deg); }
|
|
319
|
+
100% { filter: hue-rotate(360deg); }
|
|
320
|
+
}`}];function sH(e){return e?!e.match(/^#[0-9a-fA-F]{3,8}$/)&&!e.match(/^rgba?\(/):!1}function cH(e){let t=e.getFieldsValue(!0),n=t.background_color;return{name:t.name,icon:t.icon||`📋`,description:t.description,background_color:n?typeof n==`string`?n:n.toHexString():null,custom_css:t.custom_css||null,access_mode:t.access_mode||`shared`,default_others_can:t.access_mode===`private`?`none`:t.default_others_can||`session`,default_others_fs_access:t.default_others_fs_access||`read`,default_dangerously_allow_session_sharing:!!t.default_dangerously_allow_session_sharing,custom_context:t.custom_context?JSON.parse(t.custom_context):null}}var lH=({form:e,autoFocus:t,extra:n,initialCustomCSS:r=!1,rbacEnabled:i=!1,allUsers:a=[],allGroups:s=[]})=>{let[c,l]=(0,U.useState)(r),u=(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(B.Item,{label:`Name`,required:!0,style:{marginBottom:24},children:(0,W.jsxs)(z.Compact,{style:{display:`flex`},children:[(0,W.jsx)(ai,{form:e,fieldName:`icon`,defaultEmoji:`📋`}),(0,W.jsx)(B.Item,{name:`name`,noStyle:!0,rules:[{required:!0,message:`Please enter a board name`}],children:(0,W.jsx)(L,{placeholder:`My Board`,style:{flex:1},autoFocus:t})})]})}),(0,W.jsx)(B.Item,{label:`Description`,name:`description`,children:(0,W.jsx)(L.TextArea,{placeholder:`Optional description...`,rows:3})})]}),d={form:e,preserve:!0},f=B.useWatch(`access_mode`,d)||`shared`,p=B.useWatch(`owner_ids`,d)||[],m=B.useWatch(`board_group_grants`,d)||[],h=B.useWatch(`default_others_can`,d)||`session`,g=B.useWatch(`default_others_fs_access`,d)||`read`,_=!!B.useWatch(`default_dangerously_allow_session_sharing`,d),v={visibility:f,ownerIds:p,groupGrants:m,othersCan:f===`private`?`none`:h,othersFsAccess:g,allowSessionSharing:_},y=(0,W.jsxs)(B,{layout:`horizontal`,colon:!1,component:!1,children:[(0,W.jsx)(k,{type:`info`,showIcon:!0,description:`Default branch permissions apply to new/aligned branches; branch overrides can still share individual branches.`,style:{marginBottom:24}}),(0,W.jsx)(sB,{value:v,onChange:(t,n)=>{t===`visibility`&&e.setFieldsValue({access_mode:n}),t===`ownerIds`&&e.setFieldsValue({owner_ids:n}),t===`groupGrants`&&e.setFieldsValue({board_group_grants:n}),t===`othersCan`&&e.setFieldsValue({default_others_can:n}),t===`othersFsAccess`&&e.setFieldsValue({default_others_fs_access:n}),t===`allowSessionSharing`&&e.setFieldsValue({default_dangerously_allow_session_sharing:n})},allUsers:a,allGroups:s,canEdit:!0,canEditOwners:i,canEditGroups:i,ownerHelp:`Manage board owners`,groupsHelp:`Inherited by aligned branches`,visibilityLabel:`Default branch permissions`,othersCanLabel:`Default others can`,othersFsAccessLabel:`Default filesystem access`}),!i&&(0,W.jsx)(B.Item,{wrapperCol:{offset:8,span:16},children:(0,W.jsx)(o.Text,{type:`secondary`,children:`Enable execution.branch_rbac to manage board owners and group grants.`})})]}),b=(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(z,{direction:`vertical`,style:{width:`100%`,marginBottom:16},children:[(0,W.jsx)(gt,{checked:c,onChange:t=>{if(l(t.target.checked),t.target.checked){let t=e.getFieldValue(`background_color`);t&&typeof t!=`string`&&e.setFieldsValue({background_color:t.toHexString()})}},children:`Use custom CSS background`}),c?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(F,{placeholder:`Load a preset...`,style:{width:`100%`,marginBottom:8},allowClear:!0,showSearch:!0,options:aH,onChange:t=>{t&&e.setFieldsValue({background_color:t})}}),(0,W.jsx)(B.Item,{name:`background_color`,noStyle:!0,children:(0,W.jsx)(L.TextArea,{placeholder:`Enter custom CSS background value (gradients, patterns, etc.)`,rows:3,style:{fontFamily:`monospace`,fontSize:`12px`}})})]}):(0,W.jsx)(B.Item,{name:`background_color`,noStyle:!0,children:(0,W.jsx)(Fe,{showText:!0,format:`hex`,allowClear:!0})})]}),c&&(0,W.jsxs)(z,{direction:`vertical`,style:{width:`100%`},children:[(0,W.jsx)(o.Text,{strong:!0,style:{fontSize:`13px`},children:`Animation CSS`}),(0,W.jsx)(F,{placeholder:`Load an animation preset...`,style:{width:`100%`,marginBottom:8},allowClear:!0,showSearch:!0,options:oH,onChange:t=>{t&&e.setFieldsValue({custom_css:t})}}),(0,W.jsx)(B.Item,{name:`custom_css`,noStyle:!0,children:(0,W.jsx)(L.TextArea,{rows:6,style:{fontFamily:`monospace`,fontSize:`12px`}})})]})]});return(0,W.jsx)(mt,{items:[{key:`general`,label:`General`,children:u},{key:`permissions`,label:`Permissions`,children:y},{key:`css`,label:`CSS`,children:b},...n?[{key:`advanced`,label:`Advanced`,children:n}]:[]]})},uH=({value:e,onChange:t,placeholder:n=`{"key": "value"}`,rows:r=4})=>(0,W.jsx)(Sc,{value:e??``,onChange:t,language:`json`,placeholder:n,rows:r}),dH=(e,t)=>{if(!t||t.trim()===``)return Promise.resolve();try{return JSON.parse(t),Promise.resolve()}catch{return Promise.reject(Error(`Invalid JSON`))}},fH=({client:e,boardById:t,sessionsByBranch:n,branchById:r,onCreate:i,onUpdate:a,onDelete:s,onArchive:c,onUnarchive:l})=>{let{modal:u}=vt.useApp(),{showSuccess:d,showError:f}=dn(),[p,m]=(0,U.useState)(!1),[h,g]=(0,U.useState)(!1),[_,v]=(0,U.useState)(null),[y,b]=(0,U.useState)(!1),[x,S]=(0,U.useState)([]),[C,w]=(0,U.useState)([]),[T,D]=(0,U.useState)(`active`),[O,k]=(0,U.useState)(``),[j]=B.useForm(),P=(0,U.useMemo)(()=>{let e=new Map;for(let i of t.values()){let t=[];for(let e of r.values())e.board_id===i.board_id&&t.push(e.branch_id);let a=t.flatMap(e=>n.get(e)||[]).length;e.set(i.board_id,a)}return e},[t,n,r]),ee=async t=>{if(!e||!y)return;let n=t,r=j.getFieldsValue(!0),i=r.access_mode===`private`,a=r.owner_ids||[],o=i?[]:r.board_group_grants||[],s=(await e.service(`boards/:id/owners`).find({route:{id:n}})).map(e=>e.user_id);await Promise.all([...a.filter(e=>!s.includes(e)).map(t=>e.service(`boards/:id/owners`).create({user_id:t},{route:{id:n}})),...s.filter(e=>!a.includes(e)).map(t=>e.service(`boards/:id/owners`).remove(t,{route:{id:n}}))]);let c=await e.service(`boards/:id/group-grants`).find({route:{id:n}}),l=new Map(o.map(e=>[e.group_id,e]));await Promise.all([...o.map(t=>e.service(`boards/:id/group-grants`).create(t,{route:{id:n}})),...c.filter(e=>!l.has(e.group_id)).map(t=>e.service(`boards/:id/group-grants`).remove(t.group_id,{route:{id:n}}))])},ne=()=>{j.validateFields().then(()=>{i?.(cH(j)),j.resetFields(),m(!1)}).catch(()=>{})},re=async t=>{v(t);let n=[],r=[];if(e)try{let[i,a,o,s]=await Promise.all([e.service(`users`).findAll({}),e.service(`groups`).findAll({query:{archived:!1}}),e.service(`boards/:id/owners`).find({route:{id:t.board_id}}),e.service(`boards/:id/group-grants`).find({route:{id:t.board_id}})]);b(!0),S(i),w(a),n=o.map(e=>e.user_id),n.length===0&&t.created_by&&(n=[t.created_by]),r=s.map(e=>({group_id:e.group_id,can:e.can,fs_access:e.fs_access}))}catch(e){b(!1),S([]),w([]),console.warn(`Board RBAC metadata unavailable:`,e)}j.setFieldsValue({name:t.name,icon:t.icon,description:t.description,background_color:t.background_color,custom_css:t.custom_css,access_mode:t.access_mode||`shared`,default_others_can:t.default_others_can||`session`,default_others_fs_access:t.default_others_fs_access||`read`,default_dangerously_allow_session_sharing:!!t.default_dangerously_allow_session_sharing,owner_ids:n,board_group_grants:r,custom_context:t.custom_context?JSON.stringify(t.custom_context,null,2):``}),g(!0)},ae=()=>{_&&j.validateFields().then(()=>{let e=j.getFieldsValue(!0);if(e.access_mode===`private`&&(e.owner_ids||[]).length!==1){f(`Private boards must have exactly one private user`);return}a?.(_.board_id,cH(j)),ee(_.board_id).catch(e=>{f(`Failed to update board permissions: ${e.message}`)}),j.resetFields(),g(!1),v(null)}).catch(()=>{})},I=e=>{s?.(e)},oe=t=>{let n=`${t.name} (Copy)`,r=n;u.confirm({title:`Clone Board`,content:(0,W.jsx)(L,{placeholder:`New board name`,defaultValue:n,onChange:e=>{r=e.target.value},onPressEnter:e=>{e.preventDefault()}}),onOk:()=>e?e.service(`boards`).clone({id:t.board_id,name:r}).then(e=>{d(`Board cloned: ${e.name}`),i?.(e)}).catch(e=>(f(`Clone failed: ${e instanceof Error?e.message:String(e)}`),Promise.reject(e))):(f(`Not connected to daemon`),Promise.reject(Error(`Not connected to daemon`)))})},se=async t=>{if(!e){f(`Not connected to daemon`);return}try{let n=await e.service(`boards`).toYaml({id:t.board_id}),r=new Blob([n],{type:`text/yaml`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`${t.slug||t.name.toLowerCase().replace(/\s+/g,`-`)}.agor-board.yaml`,a.click(),URL.revokeObjectURL(i),d(`Board exported`)}catch(e){f(`Export failed: ${e instanceof Error?e.message:String(e)}`)}},ce=()=>{let e=document.createElement(`input`);e.type=`file`,e.accept=`.yaml,.yml,.json`,e.onchange=e=>le(e.target.files?.[0]),e.click()},le=async t=>{if(!t)return;if(!e){f(`Not connected to daemon`);return}let n=await t.text();try{let r=e.service(`boards`),a;a=t.name.endsWith(`.json`)?await r.fromBlob(JSON.parse(n)):await r.fromYaml({yaml:n}),d(`Board imported: ${a.name}`),i?.(a)}catch(e){f(`Import failed: ${e instanceof Error?e.message:String(e)}`)}},ue=(0,W.jsx)(B.Item,{label:`Custom Context (JSON)`,name:`custom_context`,help:`Add custom fields for use in zone trigger templates (e.g., {{ board.context.yourField }})`,rules:[{validator:dH}],children:(0,W.jsx)(uH,{placeholder:`{"team": "Backend", "sprint": 42}`,rows:4})}),de=(0,U.useMemo)(()=>Ao(Eo(t,(e,t)=>e.name.localeCompare(t.name,void 0,{sensitivity:`base`})).filter(e=>T===`active`?!e.archived:T===`archived`?e.archived:!0),O,[e=>e.name,e=>e.slug,e=>e.description,e=>e.board_id]),[t,T,O]);return(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`div`,{style:{marginBottom:16,display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,W.jsx)(o.Text,{type:`secondary`,children:`Create and manage boards for organizing sessions.`}),(0,W.jsxs)(z,{children:[(0,W.jsx)(F,{value:T,onChange:e=>D(e),style:{width:120},options:[{value:`active`,label:`Active`},{value:`all`,label:`All`},{value:`archived`,label:`Archived`}]}),(0,W.jsx)(L,{allowClear:!0,placeholder:`Search name, slug, description, or ID`,value:O,onChange:e=>k(e.target.value),style:{width:300}}),(0,W.jsx)(V,{icon:(0,W.jsx)(Ae,{}),onClick:ce,children:`Import Board`}),(0,W.jsx)(V,{type:`primary`,icon:(0,W.jsx)(fe,{}),onClick:()=>m(!0),children:`New Board`})]})]}),(0,W.jsx)(E,{dataSource:de,columns:[{title:`Icon`,dataIndex:`icon`,key:`icon`,width:80,render:e=>(0,W.jsx)(`span`,{style:{fontSize:24},children:e||`📋`})},{title:`Name`,dataIndex:`name`,key:`name`,render:e=>(0,W.jsx)(No,{text:e,query:O})},{title:`Description`,dataIndex:`description`,key:`description`,render:e=>(0,W.jsx)(o.Text,{type:`secondary`,children:e?(0,W.jsx)(No,{text:e,query:O}):`—`})},{title:`Sessions`,key:`sessions`,width:100,render:(e,t)=>P.get(t.board_id)||0},{title:`Actions`,key:`actions`,width:280,render:(e,t)=>(0,W.jsxs)(z,{size:`small`,children:[(0,W.jsx)(Pz,{archived:!!t.archived,tooltip:t.archived?`Archived • Click to unarchive`:`Archive board`,stopPropagation:!1,onToggle:e=>{e?c?.(t.board_id):l?.(t.board_id)}}),(0,W.jsx)(M,{title:`Clone board (zones, configuration, and positions only)`,children:(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(We,{}),onClick:()=>oe(t)})}),(0,W.jsx)(M,{title:`Export board to YAML (zones, configuration, and positions only)`,children:(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(ie,{}),onClick:()=>se(t)})}),(0,W.jsx)(M,{title:`Edit board settings`,children:(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(N,{}),onClick:()=>re(t)})}),(0,W.jsx)(A,{title:`Delete board?`,description:`Are you sure you want to delete "${t.name}"? Sessions will not be deleted.`,onConfirm:()=>I(t.board_id),okText:`Delete`,cancelText:`Cancel`,okButtonProps:{danger:!0},children:(0,W.jsx)(M,{title:`Delete board (sessions will not be deleted)`,children:(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(te,{}),danger:!0})})})]})}],rowKey:`board_id`,pagination:!1,size:`small`,onRow:e=>({style:e.archived?{opacity:.5}:void 0})}),(0,W.jsx)(nt,{title:`Create Board`,open:p,width:760,onOk:ne,onCancel:()=>{j.resetFields(),m(!1)},okText:`Create`,children:(0,W.jsx)(B,{form:j,layout:`vertical`,preserve:!0,style:{marginTop:16},children:(0,W.jsx)(lH,{form:j,extra:ue})})}),(0,W.jsx)(nt,{title:`Edit Board`,open:h,width:760,onOk:ae,onCancel:()=>{j.resetFields(),g(!1),v(null)},okText:`Save`,children:(0,W.jsx)(B,{form:j,layout:`vertical`,preserve:!0,style:{marginTop:16},children:(0,W.jsx)(lH,{form:j,extra:ue,initialCustomCSS:sH(_?.background_color)||!!_?.custom_css,rbacEnabled:y,allUsers:x,allGroups:C},_?.board_id)})})]})};function pH(e){return typeof e==`string`&&Wt.includes(e)}function mH(e){let t=Array.isArray(e?.allowedModes)?e.allowedModes.filter(pH):[...Wt],n=t.length>0?t:[...Wt],r=pH(e?.defaultMode)?e.defaultMode:vn;return{defaultMode:n.includes(r)?r:n[0],allowedModes:n}}function hH(e,t){let n=mH(t);return pH(e)&&n.allowedModes.includes(e)?e:n.defaultMode}function gH(e){return e===`worktree`?`Worktree`:`Clone`}var _H=100,vH=({repoById:e,boardById:t=new Map,selectedRepoId:n,onRepoChange:r,defaultBranch:i,fieldPrefix:a=``,showUrlFields:s=!1,showBoardSelector:c=!1,requireBoard:l=!1,onFormChange:u,useSameBranchName:f,onUseSameBranchNameChange:p,branchStorageConfig:m})=>{let[h,g]=(0,U.useState)(!0),[_,v]=(0,U.useState)(`branch`),y=f??h,b=p??g,x=B.useFormInstance(),S=`${a}storage_mode`,{defaultMode:C,allowedModes:w}=(0,U.useMemo)(()=>mH(m),[m]),T=(0,U.useRef)(void 0);(0,U.useEffect)(()=>{let e=x.getFieldValue(S),t=T.current;(!e||!w.includes(e)||t!==void 0&&e===t&&e!==C)&&x.setFieldValue(S,C),T.current=C},[w,C,x,S]);let E=e=>{b(e),e&&x.setFieldValue(`${a}branchName`,void 0),u?.()};return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(B.Item,{name:`${a}repoId`,label:`Repository`,rules:[{required:!0,message:`Please select a repository`}],validateTrigger:[`onBlur`,`onChange`],children:(0,W.jsx)(F,{placeholder:`Select repository...`,showSearch:!0,filterOption:(e,t)=>String(t?.label??``).toLowerCase().includes(e.toLowerCase()),options:To(e).sort((e,t)=>(e.name||e.slug).localeCompare(t.name||t.slug)).map(e=>({value:e.repo_id,label:e.name||e.slug})),onChange:r})}),c&&(0,W.jsx)(B.Item,{name:`${a}boardId`,label:`Board`,tooltip:`Branches are created on a board and align with that board's default permissions`,rules:l?[{required:!0,message:`Please select a board`}]:void 0,validateTrigger:[`onBlur`,`onChange`],children:(0,W.jsx)(F,{placeholder:`Select board...`,allowClear:!l,showSearch:!0,filterOption:(e,t)=>String(t?.label??``).toLowerCase().includes(e.toLowerCase()),options:To(t).sort((e,t)=>e.name.localeCompare(t.name)).map(e=>({value:e.board_id,label:`${e.icon||`📋`} ${e.name}`})),onChange:u})}),(0,W.jsx)(B.Item,{name:`${a}refType`,label:`Source Type`,initialValue:`branch`,children:(0,W.jsxs)(d.Group,{onChange:e=>{v(e.target.value),e.target.value===`tag`?x.setFieldValue(`${a}sourceBranch`,void 0):x.setFieldValue(`${a}sourceBranch`,i),u?.()},children:[(0,W.jsx)(d,{value:`branch`,children:`Branch`}),(0,W.jsx)(d,{value:`tag`,children:`Tag`})]})}),(0,W.jsx)(B.Item,{name:`${a}sourceBranch`,label:_===`branch`?`Source Branch`:`Source Tag`,rules:[{required:!0,message:`Please enter source ${_}`}],validateTrigger:[`onBlur`,`onChange`],tooltip:`${_} to use as base for the new branch`,initialValue:i,children:(0,W.jsx)(L,{placeholder:_===`branch`?i:`v1.0.0`})}),(0,W.jsx)(B.Item,{name:`${a}name`,label:`Branch Name`,rules:[{required:!0,message:`Please enter a branch name`},{pattern:/^[a-z0-9-]+$/,message:`Only lowercase letters, numbers, and hyphens allowed`}],validateTrigger:[`onBlur`,`onChange`],tooltip:`URL-friendly name (e.g., 'feat-auth', 'fix-cors')`,children:(0,W.jsx)(L,{placeholder:`feat-auth`,autoFocus:!0})}),(0,W.jsx)(B.Item,{children:(0,W.jsx)(gt,{checked:y,onChange:e=>E(e.target.checked),children:_===`tag`?`Use the same name for the git branch (new branch from tag)`:`Use the same name for the git branch`})}),!y&&(0,W.jsx)(B.Item,{name:`${a}branchName`,label:`Git Branch Name`,rules:[{required:!0,message:`Please enter a git branch name`}],validateTrigger:[`onBlur`,`onChange`],children:(0,W.jsx)(L,{placeholder:`feature/auth`})}),(0,W.jsx)(B.Item,{name:S,label:`Storage`,initialValue:C,tooltip:`How the branch is materialised on disk. "Worktree" uses git's native shared-base model (legacy default). "Clone" gives this branch its own .git/ directory via a real git clone — credentials and config are isolated from sibling branches. See context/explorations/clone-redesign.md.`,extra:w.length===1?`${gH(w[0])} is the only storage mode enabled on this Agor instance. Administrators configure this with execution.branch_storage.allowed_modes.`:`Default on this Agor instance: ${gH(C)}.`,children:(0,W.jsx)(d.Group,{onChange:()=>u?.(),children:Wt.map(e=>{let t=!w.includes(e),n=e===C?` (default)`:``,r=`${gH(e)}${n}`;return(0,W.jsx)(M,{title:t?`${gH(e)} storage is disabled on this Agor instance by execution.branch_storage.allowed_modes.`:void 0,children:(0,W.jsx)(`span`,{children:(0,W.jsx)(d,{value:e,disabled:t,children:r})})},e)})})}),(0,W.jsx)(B.Item,{shouldUpdate:(e,t)=>e[`${a}storage_mode`]!==t[`${a}storage_mode`],noStyle:!0,children:({getFieldValue:e})=>e(`${a}storage_mode`)===`clone`?(0,W.jsx)(B.Item,{name:`${a}clone_depth`,label:`Depth`,initialValue:_H,tooltip:"Number of commits to keep (`git clone --depth N`). Defaults to 100 — usually plenty for a feature branch. Leave empty for a full clone with complete history.",rules:[{validator:(e,t)=>t==null||t===``||Number.isInteger(t)&&t>0?Promise.resolve():Promise.reject(Error(`Depth must be a positive integer, or empty for a full clone`))}],children:(0,W.jsx)($e,{min:1,placeholder:`100`,style:{width:160},onChange:()=>u?.()})}):null}),s&&(0,W.jsxs)(z,{orientation:`vertical`,style:{width:`100%`},children:[(0,W.jsx)(B.Item,{name:`${a}issue_url`,label:`Issue URL (optional)`,rules:[{type:`url`,message:`Please enter a valid URL`}],validateTrigger:[`onBlur`,`onChange`],children:(0,W.jsx)(L,{placeholder:`https://github.com/org/repo/issues/123`})}),(0,W.jsx)(B.Item,{name:`${a}pull_request_url`,label:`Pull Request URL (optional)`,rules:[{type:`url`,message:`Please enter a valid URL`}],validateTrigger:[`onBlur`,`onChange`],children:(0,W.jsx)(L,{placeholder:`https://github.com/org/repo/pull/123`})})]}),(0,W.jsxs)(o.Paragraph,{type:`secondary`,style:{marginTop:16},children:[(0,W.jsx)(`strong`,{children:`What will happen:`}),(0,W.jsx)(`br`,{}),`• Fetch latest from origin`,(0,W.jsx)(`br`,{}),`• Create new branch`,` `,(0,W.jsx)(o.Text,{code:!0,children:y?`<name>`:`<git-branch-name>`}),` `,`based on `,_===`tag`?`tag`:`branch`,` `,(0,W.jsx)(o.Text,{code:!0,children:x.getFieldValue(`${a}sourceBranch`)||(_===`tag`?`<tag-name>`:i)}),(0,W.jsx)(`br`,{}),`• Branch location:`,` `,(0,W.jsxs)(o.Text,{code:!0,children:[`~/.agor/worktrees/`,`<repo>`,`/`,(0,W.jsx)(o.Text,{italic:!0,children:`<name>`})]})]})]})};function yH(e){if(e.environment){let t=Zt(e.environment,e.environment.default);if(t)return{start:t.start,stop:t.stop,nuke:t.nuke,logs:t.logs,health:t.health,app:t.app,hasConfig:!!(t.start||t.stop)}}let t=e.environment_config;return t?{start:t.up_command,stop:t.down_command,nuke:t.nuke_command,logs:t.logs_command,health:t.health_check?.url_template,app:t.app_url_template,hasConfig:!!(t.up_command||t.down_command)}:{hasConfig:!1}}function bH(e,t){let n=e.environment_instance?.status,r=e.environment_instance?.last_health_check?.status;return!n||n===`stopped`?(0,W.jsx)(M,{title:`Environment stopped`,children:(0,W.jsx)(ae,{style:{color:t.colorTextDisabled}})}):n===`starting`||n===`stopping`?(0,W.jsx)(M,{title:`Environment ${n}`,children:(0,W.jsx)(be,{style:{color:t.colorPrimary}})}):n===`error`?(0,W.jsx)(M,{title:`Error: ${e.environment_instance?.last_health_check?.message||`Unknown`}`,children:(0,W.jsx)(Je,{style:{color:t.colorError}})}):n===`running`?r===`healthy`?(0,W.jsx)(M,{title:`Running (healthy)`,children:(0,W.jsx)(Re,{style:{color:t.colorSuccess}})}):r===`unhealthy`?(0,W.jsx)(M,{title:`Running (unhealthy): ${e.environment_instance?.last_health_check?.message||``}`,children:(0,W.jsx)(Ye,{style:{color:t.colorWarning}})}):(0,W.jsx)(M,{title:`Running`,children:(0,W.jsx)(re,{status:`processing`})}):null}function xH(e,t,n,r){let i=e.environment_instance?.status,o=e.environment_instance?.last_health_check?.status,s=!!(t?yH(t):void 0)?.hasConfig,c=i===`running`||i===`starting`||o===`healthy`,l=e.health_check_url;return(0,W.jsxs)(z,{size:4,children:[bH(e,n),s&&t&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(a,{}),disabled:c,onClick:t=>{t.stopPropagation(),r.onStartEnvironment?.(e.branch_id)},style:{padding:`0 4px`}}),(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(ne,{}),onClick:t=>{t.stopPropagation(),r.onStopEnvironment?.(e.branch_id)},style:{padding:`0 4px`}}),l&&(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(Te,{}),onClick:e=>{e.stopPropagation(),window.open(l,`_blank`)},style:{padding:`0 4px`}})]})]})}var SH=({client:e,branchById:t,repoById:n,boardById:r,sessionsByBranch:i,onArchiveOrDelete:a,onUnarchive:s,onCreate:c,onRowClick:l,onStartEnvironment:u,onStopEnvironment:d,onClose:f,branchStorageConfig:p})=>{let g=To(n),_=To(r),{token:v}=I.useToken(),y=tH({boardById:r,branchById:t}),b=(0,U.useCallback)(e=>{f?.(),y.goToBranch(e.branch_id)},[f,y]),[x,S]=(0,U.useState)(!1),[C]=B.useForm(),[w,T]=(0,U.useState)(!0),[D,O]=(0,U.useState)(null),[k,A]=(0,U.useState)(!1),[j,P]=(0,U.useState)(``),[ee,ne]=(0,U.useState)(`active`),[re,ie]=(0,U.useState)(!1),[ae,oe]=(0,U.useState)(null),[se,ce]=(0,U.useState)(`archive`),[le,pe]=(0,U.useState)([]),[me,he]=(0,U.useState)(!1),[ge,_e]=(0,U.useState)(!1),ve=(0,U.useRef)(!1);(0,U.useEffect)(()=>{if(ee!==`archived`&&ee!==`all`||me||ve.current||!e)return;let t=!1;return ve.current=!0,_e(!0),e.service(`branches`).findAll({query:{archived:!0,$limit:1e3,$sort:{created_at:-1}}}).then(e=>{t||(pe(e),he(!0))}).catch(()=>{}).finally(()=>{ve.current=!1,t||_e(!1)}),()=>{t=!0}},[ee,me,e]);let ye=(0,U.useCallback)(()=>{let e=C.getFieldsValue(),t=!!e.repoId,n=!!e.sourceBranch,r=!!e.name&&/^[a-z0-9-]+$/.test(e.name),i=w||!!e.branchName,a=!!e.boardId;A(t&&n&&r&&i&&a)},[C,w]),be=(0,U.useRef)(!1);(0,U.useEffect)(()=>{if(!x){be.current=!1;return}if(be.current||g.length===0)return;be.current=!0;let e=localStorage.getItem(`agor:lastUsedRepoId`),t=localStorage.getItem(`agor:lastUsedBoardId`),n=e&&g.find(t=>t.repo_id===e)?e:g[0].repo_id,r=t&&_.find(e=>e.board_id===t)?t:_.length>0?_[0].board_id:void 0;C.setFieldsValue({repoId:n,boardId:r,sourceBranch:g.find(e=>e.repo_id===n)?.default_branch||`main`}),O(n),ye()},[x,g,_,C,ye]);let xe=e=>n.get(e)?.name||`Unknown Repo`,Se=()=>D&&g.find(e=>e.repo_id===D)?.default_branch||`main`,Ce=e=>{O(e);let t=g.find(t=>t.repo_id===e)?.default_branch||`main`;C.setFieldValue(`sourceBranch`,t)},we=async(e,n)=>{try{await a?.(e,n)}catch{return}if(n.metadataAction===`archive`){let n=t.get(e)||le.find(t=>t.branch_id===e);if(n){let t={...n,archived:!0,archived_at:new Date().toISOString()};pe(n=>{let r=n.findIndex(t=>t.branch_id===e);if(r===-1)return[t,...n];let i=[...n];return i[r]=t,i})}return}pe(t=>t.filter(t=>t.branch_id!==e))},Te=async()=>{try{let e=await C.validateFields(),t=w?e.name:e.branchName;localStorage.setItem(`agor:lastUsedRepoId`,e.repoId),e.boardId&&localStorage.setItem(`agor:lastUsedBoardId`,e.boardId);let n=hH(e.storage_mode,p),r=n===`clone`&&typeof e.clone_depth==`number`&&e.clone_depth>0?e.clone_depth:void 0;c?.(e.repoId,{name:e.name,ref:t,createBranch:!0,sourceBranch:e.sourceBranch,pullLatest:!0,boardId:e.boardId,storage_mode:n,...r===void 0?{}:{clone_depth:r}}),S(!1),C.resetFields(),T(!0),O(null)}catch(e){console.error(`Validation failed:`,e)}},Ee=()=>{S(!1),C.resetFields(),T(!0),O(null),A(!1)},De=[{title:`Name`,dataIndex:`name`,key:`name`,render:(e,t)=>(0,W.jsxs)(z,{children:[$t(t)?(0,W.jsx)(m,{style:{color:v.colorInfo}}):(0,W.jsx)(dt,{}),(0,W.jsx)(o.Text,{strong:!0,children:(0,W.jsx)(No,{text:e,query:j})})]})},{title:`Env`,key:`env`,width:120,align:`center`,render:(e,t)=>xH(t,g.find(e=>e.repo_id===t.repo_id),v,{onStartEnvironment:u,onStopEnvironment:d})},{title:`Repo`,dataIndex:`repo_id`,key:`repo_id`,render:e=>(0,W.jsxs)(z,{children:[(0,W.jsx)(de,{}),(0,W.jsx)(o.Text,{children:(0,W.jsx)(No,{text:xe(e),query:j})})]})},{title:`Branch`,dataIndex:`ref`,key:`ref`,render:e=>(0,W.jsx)(o.Text,{code:!0,children:(0,W.jsx)(No,{text:e,query:j})})},{title:`Sessions`,key:`sessions`,width:100,render:(e,t)=>{let n=(i.get(t.branch_id)||[]).length;return(0,W.jsxs)(o.Text,{type:`secondary`,children:[n,` `,n===1?`session`:`sessions`]})}},{title:`Path`,key:`path`,width:60,align:`center`,render:(e,t)=>(0,W.jsx)(o.Text,{copyable:{text:t.path,tooltips:[`Copy path: ${t.path}`,`Copied!`]}})},{title:`Actions`,key:`actions`,width:160,render:(e,t)=>(0,W.jsxs)(z,{size:`small`,children:[!t.archived&&t.board_id&&(0,W.jsx)(M,{title:`Center map on branch`,children:(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(h,{}),onClick:e=>{e.stopPropagation(),b(t)}})}),(0,W.jsx)(Pz,{archived:t.archived,onToggle:e=>{if(!e){Promise.resolve(s?.(t.branch_id,t.board_id?{boardId:t.board_id}:void 0)).then(()=>{pe(e=>e.map(e=>e.branch_id===t.branch_id?{...e,archived:!1,archived_at:void 0,archived_by:void 0}:e))}).catch(()=>{});return}oe(t),ce(`archive`),ie(!0)}}),(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(N,{}),onClick:e=>{e.stopPropagation(),l?.(t)}}),(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(te,{}),danger:!0,onClick:e=>{e.stopPropagation(),oe(t),ce(`delete`),ie(!0)}})]})}],Oe=(0,U.useMemo)(()=>{let e=j.trim().toLowerCase(),r=Array.from(t.values()),i=new Map;for(let e of r)i.set(e.branch_id,e);for(let e of le)i.has(e.branch_id)||i.set(e.branch_id,e);let a=Array.from(i.values()).sort((e,t)=>new Date(t.created_at).getTime()-new Date(e.created_at).getTime()),o=a;return ee===`active`?o=a.filter(e=>!e.archived):ee===`archived`?o=a.filter(e=>e.archived):ee===`assistants`&&(o=a.filter(e=>!e.archived&&$t(e))),e?o.filter(t=>{let r=n.get(t.repo_id);return[t.name,t.ref,t.path,String(t.branch_unique_id),r?.name,r?.slug].some(t=>t==null?!1:t.toString().toLowerCase().includes(e))}):o},[ee,le,n,j,t]),ke=t.size>0||le.length>0;return(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(z,{orientation:`vertical`,size:v.sizeUnit*2,style:{marginBottom:v.sizeUnit*2,width:`100%`},children:[(0,W.jsx)(o.Text,{type:`secondary`,children:`Manage git branches for isolated development contexts across sessions.`}),(0,W.jsxs)(z,{style:{width:`100%`,display:`flex`,justifyContent:`space-between`},children:[(0,W.jsxs)(z,{children:[(0,W.jsx)(L,{allowClear:!0,placeholder:`Search by name, repo, slug, path, or ID`,value:j,onChange:e=>P(e.target.value),style:{maxWidth:v.sizeUnit*40}}),(0,W.jsx)(F,{value:ee,onChange:e=>ne(e),loading:ge&&(ee===`archived`||ee===`all`),style:{width:120},options:[{value:`active`,label:`Active`},{value:`assistants`,label:`Assistants`},{value:`all`,label:`All`},{value:`archived`,label:`Archived`}]})]}),(0,W.jsx)(V,{type:`primary`,icon:(0,W.jsx)(fe,{}),onClick:()=>S(!0),disabled:g.length===0,children:`Create Branch`})]})]}),g.length===0&&(0,W.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`,minHeight:400},children:(0,W.jsx)(ue,{description:`No repositories configured`,children:(0,W.jsx)(o.Text,{type:`secondary`,children:`Create a repository first in the Repositories tab to enable branches.`})})}),g.length>0&&!ke&&(0,W.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`,minHeight:400},children:(0,W.jsx)(ue,{description:`No branches yet`,children:(0,W.jsx)(o.Text,{type:`secondary`,children:`Branches will appear here once created from sessions or the CLI.`})})}),ke&&(0,W.jsx)(E,{dataSource:Oe,columns:De,rowKey:`branch_id`,pagination:{pageSize:10},size:`small`,onRow:e=>({onClick:()=>l?.(e),style:{cursor:l?`pointer`:`default`}})}),(0,W.jsx)(nt,{title:`Create Branch`,open:x,onOk:Te,onCancel:Ee,okText:`Create`,okButtonProps:{disabled:!k},children:(0,W.jsx)(B,{form:C,layout:`vertical`,onFieldsChange:ye,children:(0,W.jsx)(vH,{repoById:n,boardById:r,selectedRepoId:D,onRepoChange:Ce,defaultBranch:Se(),showBoardSelector:!0,requireBoard:!0,onFormChange:ye,useSameBranchName:w,onUseSameBranchNameChange:T,branchStorageConfig:p})})}),ae&&(0,W.jsx)(Lz,{open:re,branch:ae,sessionCount:(i.get(ae.branch_id)||[]).length,environmentRunning:ae.environment_instance?.status===`running`,initialMetadataAction:se,onConfirm:e=>{we(ae.branch_id,e),ie(!1),oe(null),ce(`archive`)},onCancel:()=>{ie(!1),oe(null),ce(`archive`)}})]})};function CH(e){try{let t=new URL(e);return[`http:`,`https:`,`mailto:`].includes(t.protocol)}catch{return!1}}var{TextArea:wH}=L,TH=U.memo(({open:e,card:t,board:n,zoneName:r,zoneColor:i,client:a,onClose:l,onCardUpdated:d,onCardDeleted:f})=>{let{token:m}=I.useToken(),{showSuccess:h,showError:g}=dn(),[_,y]=(0,U.useState)(!1),[b,x]=(0,U.useState)(!1),[S,C]=(0,U.useState)(``),[w,T]=(0,U.useState)(``),[E,D]=(0,U.useState)(!1);(0,U.useEffect)(()=>{t&&(C(t.note||``),T(t.description||``),y(!1),x(!1))},[t]);let O=S!==(t?.note||``)||w!==(t?.description||``),k=(0,U.useCallback)(async()=>{if(!(!t||!a||!O)){D(!0);try{let e=await a.service(`cards`).patch(t.card_id,{note:S,description:w});d?.(e),y(!1),x(!1),h(`Card saved`)}catch(e){console.error(`Failed to save card:`,e),g(`Failed to save card`)}finally{D(!1)}}},[t,a,S,w,O,d,h,g]),A=(0,U.useCallback)(async()=>{!t||!a||nt.confirm({title:`Archive card?`,content:`This will hide "${t.title}" from the board while preserving its data.`,okText:`Archive`,onOk:async()=>{try{let e=await a.service(`cards`).patch(t.card_id,{archived:!0,archived_at:new Date().toISOString()});d?.(e),l(),h(`Card archived`)}catch(e){console.error(`Failed to archive card:`,e),g(`Failed to archive card`)}}})},[t,a,d,l,h,g]),j=(0,U.useCallback)(async()=>{!t||!a||nt.confirm({title:`Delete card?`,content:`This will permanently delete "${t.title}".`,okText:`Delete`,okType:`danger`,onOk:async()=>{try{await a.service(`cards`).remove(t.card_id),f?.(t.card_id),l(),h(`Card deleted`)}catch(e){console.error(`Failed to delete card:`,e),g(`Failed to delete card`)}}})},[t,a,f,l,h,g]);if(!t)return null;let M=t.effective_emoji,P=t.effective_color||m.colorBorder;return(0,W.jsxs)(nt,{open:e,onCancel:l,width:560,footer:(0,W.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`},children:[(0,W.jsxs)(z,{children:[(0,W.jsx)(Fz,{tooltip:``,size:`middle`,onClick:A,children:`Archive`}),(0,W.jsx)(V,{danger:!0,icon:(0,W.jsx)(te,{}),onClick:j,children:`Delete`})]}),(0,W.jsx)(V,{type:`primary`,icon:(0,W.jsx)(u,{}),onClick:k,disabled:!O,loading:E,children:`Save`})]}),title:null,styles:{body:{padding:0}},children:[(0,W.jsxs)(`div`,{style:{padding:`16px 24px`,borderBottom:`1px solid ${m.colorBorderSecondary}`,borderLeft:`4px solid ${P}`,display:`flex`,alignItems:`center`,gap:10},children:[M&&(0,W.jsx)(`span`,{style:{fontSize:20},children:M}),(0,W.jsx)(o.Title,{level:5,style:{margin:0,flex:1},children:t.title}),t.url&&CH(t.url)&&(0,W.jsxs)(`a`,{href:t.url,target:`_blank`,rel:`noopener noreferrer`,style:{color:m.colorLink},children:[`Open `,(0,W.jsx)(s,{})]})]}),(0,W.jsxs)(`div`,{style:{padding:`12px 24px`,borderBottom:`1px solid ${m.colorBorderSecondary}`,display:`flex`,flexWrap:`wrap`,gap:8},children:[t.card_type&&(0,W.jsxs)(v,{children:[t.card_type.emoji&&`${t.card_type.emoji} `,t.card_type.name]}),n&&(0,W.jsxs)(v,{children:[n.icon?`${n.icon} `:``,n.name]}),r&&(0,W.jsx)(v,{icon:(0,W.jsx)(p,{style:i?{color:i}:void 0}),children:r})]}),(0,W.jsxs)(`div`,{style:{padding:`12px 24px`,borderBottom:`1px solid ${m.colorBorderSecondary}`},children:[(0,W.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:8},children:[(0,W.jsx)(o.Text,{strong:!0,style:{fontSize:12,color:m.colorTextSecondary},children:`Note`}),(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(N,{}),onClick:()=>y(!_),children:_?`Preview`:`Edit`})]}),_?(0,W.jsx)(wH,{value:S,onChange:e=>C(e.target.value),placeholder:`Agent's live commentary...`,autoSize:{minRows:2,maxRows:8},style:{background:m.colorFillQuaternary}}):S?(0,W.jsx)(`div`,{style:{background:m.colorFillQuaternary,borderRadius:m.borderRadiusSM,padding:`8px 12px`},children:(0,W.jsx)(wz,{content:S,compact:!0,showControls:!1})}):(0,W.jsx)(o.Text,{type:`secondary`,style:{fontSize:12,fontStyle:`italic`},children:`No note`})]}),(0,W.jsxs)(`div`,{style:{padding:`12px 24px`,borderBottom:`1px solid ${m.colorBorderSecondary}`},children:[(0,W.jsxs)(`div`,{style:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,marginBottom:8},children:[(0,W.jsx)(o.Text,{strong:!0,style:{fontSize:12,color:m.colorTextSecondary},children:`Description`}),(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(N,{}),onClick:()=>x(!b),children:b?`Preview`:`Edit`})]}),b?(0,W.jsx)(wH,{value:w,onChange:e=>T(e.target.value),placeholder:`Stable context about this entity...`,autoSize:{minRows:3,maxRows:12}}):w?(0,W.jsx)(wz,{content:w,compact:!0,showControls:!1}):(0,W.jsx)(o.Text,{type:`secondary`,style:{fontSize:12,fontStyle:`italic`},children:`No description`})]}),t.data&&Object.keys(t.data).length>0&&(0,W.jsx)(`div`,{style:{padding:`0 24px 12px`},children:(0,W.jsx)(c,{ghost:!0,items:[{key:`data`,label:(0,W.jsx)(o.Text,{strong:!0,style:{fontSize:12,color:m.colorTextSecondary},children:`Data`}),children:(0,W.jsx)(`pre`,{style:{background:m.colorFillQuaternary,borderRadius:m.borderRadiusSM,padding:`8px 12px`,fontSize:11,overflow:`auto`,maxHeight:300,margin:0},children:JSON.stringify(t.data,null,2)})}]})}),(0,W.jsxs)(`div`,{style:{padding:`8px 24px 12px`,color:m.colorTextTertiary,fontSize:11},children:[t.created_by&&`Created by: ${t.created_by}`,t.created_at&&` • ${new Date(t.created_at).toLocaleString()}`]})]})}),EH=({avatar:e,title:t,description:n,style:r})=>(0,W.jsxs)(`div`,{style:{display:`flex`,flex:1,alignItems:`flex-start`,maxWidth:`100%`,...r},children:[e!=null&&(0,W.jsx)(`div`,{style:{marginInlineEnd:16,flexShrink:0},children:e}),(0,W.jsxs)(`div`,{style:{flex:`1 0`,minWidth:0},children:[t!=null&&(0,W.jsx)(`div`,{style:{marginBottom:4},children:t}),n!=null&&(0,W.jsx)(`div`,{children:n})]})]}),{Sider:DH,Content:OH}=we,kH=({client:e,cardById:t,cardTypeById:n,boardById:r,boardObjects:i})=>{let{token:a}=I.useToken(),{showSuccess:s,showError:c}=dn(),[l,u]=(0,U.useState)(null),[d,f]=(0,U.useState)(!1),[m,h]=(0,U.useState)(!1),[g,_]=(0,U.useState)(null),[v,y]=(0,U.useState)(null),[b,x]=(0,U.useState)(``),[S,C]=(0,U.useState)(``),[w]=B.useForm(),T=(0,U.useMemo)(()=>To(n).sort((e,t)=>e.name.localeCompare(t.name)),[n]),D=(0,U.useMemo)(()=>Ao(T,b,[e=>e.name,e=>e.emoji,e=>JSON.stringify(e.json_schema??{})]),[T,b]),O=(0,U.useMemo)(()=>{let e=new Map;if(!i)return e;for(let t of i){if(!t.card_id||!t.zone_id)continue;let n=r.get(t.board_id)?.objects?.[t.zone_id];n&&n.type===`zone`&&e.set(t.card_id,{zoneName:n.label||`Unknown Zone`,zoneColor:n.borderColor||n.color})}return e},[i,r]),k=l?n.get(l)??null:null,j=(0,U.useMemo)(()=>l?Ao(To(t).filter(e=>e.card_type_id===l&&!e.archived).sort((e,t)=>e.title.localeCompare(t.title)),S,[e=>e.title,e=>{let t=r.get(e.board_id);return[t?.name,t?.slug,e.board_id]},e=>O.get(e.card_id)?.zoneName,e=>JSON.stringify(e.data??{})]):[],[t,l,S,r,O]),M=async()=>{if(e)try{let t=await w.validateFields(),n=typeof t.color==`string`?t.color:t.color?.toHexString?.()??void 0;await e.service(`card-types`).create({name:t.name,emoji:t.emoji||void 0,color:n||void 0,json_schema:t.json_schema?JSON.parse(t.json_schema):void 0}),w.resetFields(),f(!1),s(`Card type created`)}catch(e){if(e&&typeof e==`object`&&`errorFields`in e)return;console.error(`Failed to create card type:`,e),c(`Failed to create card type`)}},P=async()=>{if(!(!e||!g))try{let t=await w.validateFields(),n=typeof t.color==`string`?t.color:t.color?.toHexString?.()??void 0;await e.service(`card-types`).patch(g.card_type_id,{name:t.name,emoji:t.emoji||void 0,color:n||void 0,json_schema:t.json_schema?JSON.parse(t.json_schema):void 0}),w.resetFields(),h(!1),_(null),s(`Card type updated`)}catch(e){if(e&&typeof e==`object`&&`errorFields`in e)return;console.error(`Failed to update card type:`,e),c(`Failed to update card type`)}},ee=async t=>{if(e)try{await e.service(`card-types`).remove(t),l===t&&u(null),s(`Card type deleted`)}catch(e){console.error(`Failed to delete card type:`,e),c(`Failed to delete card type`)}},ne=e=>{_(e),w.setFieldsValue({name:e.name,emoji:e.emoji,color:e.color,json_schema:e.json_schema?JSON.stringify(e.json_schema,null,2):``}),h(!0)},re=[{title:`Title`,dataIndex:`title`,key:`title`,render:(e,t)=>(0,W.jsxs)(z,{children:[t.effective_emoji&&(0,W.jsx)(`span`,{children:t.effective_emoji}),(0,W.jsx)(o.Text,{children:(0,W.jsx)(No,{text:e,query:S})})]})},{title:`Board`,dataIndex:`board_id`,key:`board`,width:180,render:e=>{let t=r.get(e);return(0,W.jsx)(o.Text,{type:`secondary`,children:t?(0,W.jsx)(No,{text:`${t.icon?`${t.icon} `:``}${t.name}`,query:S}):`—`})}},{title:`Zone`,key:`zone`,width:180,render:(e,t)=>{let n=O.get(t.card_id);return n?(0,W.jsxs)(z,{size:4,children:[n.zoneColor&&(0,W.jsx)(p,{style:{color:n.zoneColor,fontSize:12}}),(0,W.jsx)(o.Text,{style:{fontSize:13},children:(0,W.jsx)(No,{text:n.zoneName,query:S})})]}):(0,W.jsx)(o.Text,{type:`secondary`,children:`—`})}}],ie=v?r.get(v.board_id)??null:null,ae=e=>{y(e)},F=e=>{y(null)},oe=(0,W.jsxs)(B,{form:w,layout:`vertical`,style:{marginTop:16},children:[(0,W.jsx)(B.Item,{label:`Name`,style:{marginBottom:24},children:(0,W.jsxs)(Ve,{gap:8,children:[(0,W.jsx)(B.Item,{name:`emoji`,noStyle:!0,children:(0,W.jsx)(ai,{form:w,fieldName:`emoji`,defaultEmoji:`📋`})}),(0,W.jsx)(B.Item,{name:`name`,noStyle:!0,rules:[{required:!0,message:`Name is required`}],children:(0,W.jsx)(L,{placeholder:`e.g. Support Ticket`,style:{flex:1}})})]})}),(0,W.jsx)(B.Item,{name:`color`,label:`Color`,children:(0,W.jsx)(Fe,{showText:!0,format:`hex`,allowClear:!0})}),(0,W.jsx)(B.Item,{name:`json_schema`,label:`JSON Schema (optional)`,help:`Define a JSON Schema to validate card data`,rules:[{validator:dH}],children:(0,W.jsx)(uH,{placeholder:`{"type": "object", "properties": {...}}`,rows:4})})]});return(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`div`,{style:{marginBottom:16,display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,W.jsxs)(z,{children:[(0,W.jsx)(o.Title,{level:5,style:{margin:0},children:`Cards`}),(0,W.jsx)(`span`,{style:{fontSize:11,fontWeight:600,padding:`1px 6px`,borderRadius:4,background:a.colorWarningBg,color:a.colorWarningText,border:`1px solid ${a.colorWarningBorder}`},children:`Beta`})]}),(0,W.jsx)(o.Text,{type:`secondary`,children:`Manage card types and view cards across all boards`})]}),(0,W.jsxs)(we,{style:{background:`transparent`,height:`calc(100% - 60px)`,minHeight:400},children:[(0,W.jsxs)(DH,{width:260,style:{background:a.colorBgElevated,borderRadius:a.borderRadiusLG,border:`1px solid ${a.colorBorderSecondary}`,overflow:`auto`,marginRight:16},children:[(0,W.jsxs)(`div`,{style:{padding:`12px 16px`,borderBottom:`1px solid ${a.colorBorderSecondary}`,display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,W.jsx)(o.Text,{strong:!0,children:`Card Types`}),(0,W.jsx)(V,{type:`primary`,size:`small`,icon:(0,W.jsx)(fe,{}),onClick:()=>{w.resetFields(),f(!0)},children:`New`})]}),T.length>0&&(0,W.jsx)(`div`,{style:{padding:`8px 12px`},children:(0,W.jsx)(L,{allowClear:!0,size:`small`,placeholder:`Search types`,value:b,onChange:e=>x(e.target.value)})}),T.length===0?(0,W.jsx)(`div`,{style:{padding:24,textAlign:`center`},children:(0,W.jsx)(ue,{image:ue.PRESENTED_IMAGE_SIMPLE,description:`No card types yet`})}):D.map(e=>(0,W.jsxs)(`div`,{onClick:()=>u(e.card_type_id),style:{padding:`8px 16px`,cursor:`pointer`,display:`flex`,alignItems:`center`,gap:16,background:l===e.card_type_id?a.colorBgTextHover:`transparent`,borderLeft:l===e.card_type_id?`3px solid ${e.color||a.colorPrimary}`:`3px solid transparent`},children:[(0,W.jsx)(EH,{avatar:(0,W.jsx)(`span`,{style:{fontSize:18},children:e.emoji||`📋`}),title:(0,W.jsx)(o.Text,{style:{fontSize:13},ellipsis:!0,children:(0,W.jsx)(No,{text:e.name,query:b})})}),(0,W.jsxs)(z,{size:`small`,onClick:e=>e.stopPropagation(),children:[(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(N,{}),onClick:t=>{t.stopPropagation(),ne(e)}}),(0,W.jsx)(A,{title:`Delete card type?`,description:`Cards using this type will become untyped.`,onConfirm:t=>{t?.stopPropagation(),ee(e.card_type_id)},onCancel:e=>e?.stopPropagation(),children:(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(te,{}),danger:!0,onClick:e=>e.stopPropagation()})})]})]},e.card_type_id))]}),(0,W.jsx)(OH,{style:{minWidth:0},children:k?(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`div`,{style:{marginBottom:12,display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,W.jsxs)(z,{children:[(0,W.jsx)(`span`,{style:{fontSize:20},children:k.emoji||`📋`}),(0,W.jsx)(o.Title,{level:5,style:{margin:0},children:k.name}),(0,W.jsxs)(o.Text,{type:`secondary`,children:[`(`,j.length,` card`,j.length===1?``:`s`,`)`]})]}),(0,W.jsx)(L,{allowClear:!0,placeholder:`Search title, board, zone, or data`,value:S,onChange:e=>C(e.target.value),style:{width:300}})]}),(0,W.jsx)(E,{dataSource:j,columns:re,rowKey:`card_id`,size:`small`,pagination:{pageSize:20,hideOnSinglePage:!0},onRow:e=>({onClick:()=>y(e),style:{cursor:`pointer`}}),locale:{emptyText:(0,W.jsx)(ue,{image:ue.PRESENTED_IMAGE_SIMPLE,description:`No cards of this type yet`})}})]}):(0,W.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`,height:`100%`,minHeight:300},children:(0,W.jsx)(ue,{image:ue.PRESENTED_IMAGE_SIMPLE,description:T.length===0?`Create a card type to get started`:`Select a card type to view its cards`})})})]}),(0,W.jsx)(nt,{title:`Create Card Type`,open:d,onOk:M,onCancel:()=>{w.resetFields(),f(!1)},okText:`Create`,children:oe}),(0,W.jsx)(nt,{title:`Edit Card Type`,open:m,onOk:P,onCancel:()=>{w.resetFields(),h(!1),_(null)},okText:`Save`,children:oe}),(0,W.jsx)(TH,{open:!!v,card:v,board:ie,client:e,onClose:()=>y(null),onCardUpdated:ae,onCardDeleted:F})]})},AH=({branchById:e,value:t,onChange:n,placeholder:r=`Select a branch`,disabled:i=!1,includeArchivedLabel:a=!0})=>(0,W.jsx)(F,{value:t,onChange:n,placeholder:r,disabled:i,showSearch:!0,optionFilterProp:`label`,options:(0,U.useMemo)(()=>Array.from(e.values()).sort((e,t)=>(e.name||e.ref||e.branch_id).localeCompare(t.name||t.ref||t.branch_id)).map(e=>({value:e.branch_id,label:`${e.name||e.ref||e.branch_id}${a&&e.archived?` (archived)`:``}`})),[a,e])}),jH=[{value:`slack`,label:`Slack`,icon:(0,W.jsx)(ht,{})},{value:`github`,label:`GitHub`,icon:(0,W.jsx)(Se,{})},{value:`teams`,label:`Microsoft Teams`,icon:(0,W.jsx)(Pe,{})},{value:`discord`,label:`Discord`,icon:(0,W.jsx)(g,{})},{value:`whatsapp`,label:`WhatsApp`,icon:(0,W.jsx)(g,{})},{value:`telegram`,label:`Telegram`,icon:(0,W.jsx)(g,{})}];function MH(e){switch(e){case`slack`:return(0,W.jsx)(ht,{});case`github`:return(0,W.jsx)(Se,{});case`teams`:return(0,W.jsx)(Pe,{});default:return(0,W.jsx)(g,{})}}function NH(e){switch(e){case`slack`:return`purple`;case`github`:return`default`;case`teams`:return`geekblue`;case`discord`:return`blue`;case`whatsapp`:return`green`;case`telegram`:return`cyan`;default:return`default`}}var PH=({icon:e,title:t,subtitle:n})=>(0,W.jsxs)(z,{size:`small`,children:[e,(0,W.jsxs)(`span`,{children:[(0,W.jsx)(o.Text,{strong:!0,children:t}),n&&(0,W.jsx)(o.Text,{type:`secondary`,style:{fontSize:12,marginLeft:8},children:n})]})]}),FH=({userById:e,placeholder:t=`Select a user`})=>(0,W.jsx)(F,{placeholder:t,showSearch:!0,optionFilterProp:`children`,children:Array.from(e.values()).sort((e,t)=>(e.name||e.email||e.user_id).localeCompare(t.name||t.email||t.user_id)).map(e=>(0,W.jsx)(F.Option,{value:e.user_id,children:e.name||e.email||e.user_id},e.user_id))}),IH=e=>e?`align users`:`run as selected user`,LH=({alignFieldName:e,alignLabel:t,alignDescription:n,alignUsers:r,alignedContent:i,userById:a})=>(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(o.Text,{type:`secondary`,style:{fontSize:12,display:`block`,marginBottom:12},children:`Choose which Agor user identity gateway-created sessions run as.`}),(0,W.jsx)(B.Item,{name:e,initialValue:!1,children:(0,W.jsx)(d.Group,{style:{width:`100%`},children:(0,W.jsxs)(z,{orientation:`vertical`,style:{width:`100%`},children:[(0,W.jsx)(d,{value:!0,children:(0,W.jsxs)(z,{orientation:`vertical`,size:0,children:[(0,W.jsx)(o.Text,{children:t}),(0,W.jsx)(o.Text,{type:`secondary`,style:{fontSize:12},children:n})]})}),(0,W.jsx)(d,{value:!1,children:(0,W.jsxs)(z,{orientation:`vertical`,size:0,children:[(0,W.jsx)(o.Text,{children:`Run as selected user`}),(0,W.jsx)(o.Text,{type:`secondary`,style:{fontSize:12},children:`Every message uses one configured Agor user.`})]})})]})})}),r?i:(0,W.jsx)(B.Item,{label:`Run as`,name:`agor_user_id`,rules:[{required:!0,message:`Please select a user`}],tooltip:`All sessions from this channel will run as this Agor user`,children:(0,W.jsx)(FH,{userById:a})})]}),RH=({value:e=[],onChange:t})=>{let n=(0,U.useRef)(0),r=(0,U.useRef)([]);for(;r.current.length<e.length;)r.current.push(n.current++);r.current.length>e.length&&(r.current.length=e.length);let i=()=>{r.current.push(n.current++),t?.([...e,{key:``,value:``,forceOverride:!1}])},a=(n,r,i)=>{let a=e.map((e,t)=>t===n?{...e,[r]:i}:e);t?.(a)},s=n=>{r.current.splice(n,1),t?.(e.filter((e,t)=>t!==n))};return(0,W.jsxs)(`div`,{children:[e.map((e,t)=>(0,W.jsxs)(`div`,{style:{display:`flex`,gap:8,marginBottom:8,alignItems:`flex-start`},children:[(0,W.jsx)(L,{placeholder:`KEY_NAME`,value:e.key,onChange:e=>a(t,`key`,e.target.value),style:{flex:`0 0 160px`,fontFamily:`monospace`,fontSize:12}}),e.value===`••••••••`?(0,W.jsx)(L,{placeholder:`click to replace value`,value:``,onFocus:()=>a(t,`value`,``),readOnly:!0,style:{flex:1,fontFamily:`monospace`,fontSize:12,color:`transparent`,textShadow:`0 0 6px rgba(255,255,255,0.5)`}}):(0,W.jsx)(L.Password,{placeholder:`value`,value:e.value,onChange:e=>a(t,`value`,e.target.value),style:{flex:1,fontFamily:`monospace`,fontSize:12}}),(0,W.jsx)(M,{title:`Force override: always use this value, even if the user has their own`,children:(0,W.jsx)(gt,{checked:e.forceOverride,onChange:e=>a(t,`forceOverride`,e.target.checked),style:{marginTop:5},children:(0,W.jsx)(o.Text,{style:{fontSize:11,whiteSpace:`nowrap`},children:`Force`})})}),(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(te,{}),danger:!0,onClick:()=>s(t),style:{marginTop:2}})]},r.current[t])),(0,W.jsx)(V,{type:`dashed`,size:`small`,icon:(0,W.jsx)(fe,{}),onClick:i,block:!0,children:`Add Variable`}),e.length>0&&(0,W.jsxs)(o.Text,{type:`secondary`,style:{fontSize:11,display:`block`,marginTop:8},children:[(0,W.jsx)(_t,{style:{marginRight:4}}),(0,W.jsx)(`strong`,{children:`Fallback`}),` (default): used only when the user hasn't set this key.`,` `,(0,W.jsx)(`strong`,{children:`Force`}),`: always overrides the user's value.`]})]})},zH=[{title:`Create App`},{title:`Credentials`},{title:`Configure`}],BH=({form:e,mode:t,channelType:n,onChannelTypeChange:r,branchById:i,userById:a,mcpServerById:s,selectedAgent:l,onAgentChange:u,editingChannel:d,onCopyKey:f,githubStep:p,onGithubStepChange:m,githubSetupParams:h,githubLoading:_,githubError:v})=>{let{showError:y}=dn(),b=B.useWatch(`enable_channels`,e)??!1,x=B.useWatch(`enable_groups`,e)??!1,S=B.useWatch(`enable_mpim`,e)??!1,w=B.useWatch(`require_mention`,e)??!0,T=B.useWatch(`align_slack_users`,e)??!1,E=B.useWatch(`github_align_users`,e)??!1,D=b||x||S;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(B.Item,{label:`Channel Type`,name:`channel_type`,initialValue:t===`create`?`slack`:void 0,rules:[{required:!0}],children:(0,W.jsx)(F,{onChange:e=>r(e),children:jH.map(e=>(0,W.jsx)(F.Option,{value:e.value,children:(0,W.jsxs)(z,{children:[e.icon,e.label]})},e.value))})}),(0,W.jsx)(B.Item,{label:`Name`,name:`name`,rules:[{required:!0,message:`Please enter a channel name`}],children:(0,W.jsx)(L,{placeholder:`e.g., Team Slack, Personal Discord`})}),(0,W.jsx)(B.Item,{label:`Target Branch`,name:`target_branch_id`,rules:[{required:!0,message:`Please select a target branch`}],tooltip:t===`create`?`New sessions from this channel will be created in this branch`:void 0,children:(0,W.jsx)(AH,{branchById:i})}),n!==`slack`&&n!==`github`&&(0,W.jsx)(B.Item,{label:`Post messages as`,name:`agor_user_id`,rules:[{required:!0,message:`Please select a user`}],tooltip:`Sessions from this channel will run as this Agor user`,children:(0,W.jsx)(FH,{userById:a})}),(0,W.jsx)(B.Item,{label:`Enabled`,name:`enabled`,valuePropName:`checked`,initialValue:t===`create`?!0:void 0,children:(0,W.jsx)(ve,{})}),n!==`slack`&&n!==`github`&&n!==`teams`&&(0,W.jsx)(k,{title:`${n.charAt(0).toUpperCase()+n.slice(1)} support coming soon`,description:`This platform integration is not yet available. Slack, GitHub, and Microsoft Teams are currently supported.`,type:`info`,showIcon:!0,style:{marginBottom:16}}),n===`github`&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(C,{current:p,size:`small`,items:zH,style:{marginBottom:24}}),_&&(0,W.jsxs)(`div`,{style:{textAlign:`center`,padding:`24px 0`},children:[(0,W.jsx)(De,{indicator:(0,W.jsx)(be,{spin:!0})}),(0,W.jsx)(o.Text,{type:`secondary`,style:{display:`block`,marginTop:8},children:`Loading GitHub App data...`})]}),v&&(0,W.jsx)(k,{type:`error`,showIcon:!0,title:`GitHub Setup Error`,description:v,style:{marginBottom:16}}),p===0&&!_&&t===`create`&&(0,W.jsxs)(`div`,{style:{marginBottom:16},children:[(0,W.jsx)(o.Paragraph,{type:`secondary`,style:{fontSize:13},children:`Create a GitHub App to connect Agor to your repositories. This uses GitHub's URL-parameters registration flow — you'll be redirected to GitHub with the form pre-filled, then brought back here to complete setup.`}),(0,W.jsx)(B.Item,{label:`App Name`,name:`github_app_name`,children:(0,W.jsx)(L,{placeholder:`Agor (optional — defaults to 'Agor')`})}),(0,W.jsx)(B.Item,{label:`Target Organization`,name:`github_org`,tooltip:`Leave empty to create the app under your personal GitHub account`,children:(0,W.jsx)(L,{placeholder:`my-org (optional)`})}),(0,W.jsx)(V,{type:`primary`,icon:(0,W.jsx)(Se,{}),block:!0,onClick:async()=>{let t=Ki(),n=new URLSearchParams,r=e.getFieldValue(`github_app_name`),i=e.getFieldValue(`github_org`);r&&n.set(`name`,r),i&&n.set(`org`,i);try{let e=localStorage.getItem(`agor-access-token`);if(!e){y(`You must be logged in as an admin to install the GitHub App.`);return}let r=await fetch(`${t}/api/github/setup/state`,{method:`POST`,headers:{Authorization:`Bearer ${e}`,"Content-Type":`application/json`}});if(!r.ok){let e=await r.json().catch(()=>({}));y(typeof e?.error==`string`?e.error:`Failed to start GitHub App install (HTTP ${r.status})`);return}let{state:i}=await r.json();if(!i){y(`Daemon did not return an install state token.`);return}n.set(`state`,i),window.open(`${t}/api/github/setup/new?${n.toString()}`,`_blank`)}catch(e){y(e instanceof Error?e.message:`Failed to initiate GitHub App install`)}},children:`Create GitHub App on GitHub`}),(0,W.jsx)(V,{type:`default`,block:!0,onClick:()=>m(1),style:{marginTop:12},children:`I've created the app — enter credentials`})]}),p>=1&&!_&&(0,W.jsxs)(`div`,{style:{marginBottom:16,display:p===1?void 0:`none`},children:[(0,W.jsx)(k,{type:`info`,showIcon:!0,title:`Enter your GitHub App credentials`,description:(0,W.jsxs)(`span`,{children:[`On your GitHub App's settings page:`,(0,W.jsx)(`br`,{}),`1. Copy the `,(0,W.jsx)(`strong`,{children:`App ID`}),` (shown at the top under "About")`,(0,W.jsx)(`br`,{}),`2. Scroll to "Private keys" and click`,` `,(0,W.jsx)(`strong`,{children:`"Generate a private key"`}),(0,W.jsx)(`br`,{}),`3. Paste the downloaded .pem file contents below`]}),style:{marginBottom:16}}),(0,W.jsx)(B.Item,{label:`App ID`,name:`github_app_id`,tooltip:`Found on your GitHub App's settings page (General → About)`,children:(0,W.jsx)(L,{placeholder:`123456`})}),(0,W.jsx)(B.Item,{label:`Private Key (PEM)`,name:`github_private_key`,tooltip:`Generate a private key on your GitHub App's settings page, then paste the .pem file contents`,children:(0,W.jsx)(L.TextArea,{rows:4,placeholder:`-----BEGIN RSA PRIVATE KEY-----
|
|
321
|
+
...`,style:{fontFamily:`monospace`,fontSize:11}})}),(0,W.jsx)(B.Item,{label:`Installation ID`,name:`github_installation_id`,tooltip:`Set automatically via the setup callback, or paste from your GitHub App's installation URL`,children:(0,W.jsx)(L,{placeholder:`123456789`})}),v&&(0,W.jsx)(k,{type:`error`,showIcon:!0,title:v,style:{marginBottom:12}}),(0,W.jsx)(V,{type:`primary`,onClick:()=>{let t=e.getFieldValue(`github_app_id`),n=e.getFieldValue(`github_private_key`);if(!t||!n){let r=[];t||r.push({name:`github_app_id`,errors:[`Enter your GitHub App ID`]}),n||r.push({name:`github_private_key`,errors:[`Paste your GitHub App private key`]}),e.setFields(r);return}m(2)},style:{marginTop:8},children:`Next: Configure Channel`})]}),p===2&&!_&&(0,W.jsx)(c,{ghost:!0,destroyOnHidden:!1,defaultActiveKey:t===`create`?[`identity`,`github-config`]:[],style:{marginLeft:-16,marginRight:-16},items:[...t===`edit`?[{key:`github-credentials`,label:(0,W.jsx)(PH,{icon:(0,W.jsx)(Se,{}),title:`App Credentials`,subtitle:d?.config&&d.config.private_key?`configured`:`not set`}),children:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(B.Item,{label:`App ID`,name:`github_app_id`,tooltip:`Found on your GitHub App's settings page (General → About)`,children:(0,W.jsx)(L,{placeholder:`123456`})}),(0,W.jsx)(B.Item,{label:`Private Key (PEM)`,name:`github_private_key`,tooltip:`Leave empty to keep the existing key. Paste a new .pem to replace it.`,children:(0,W.jsx)(L.TextArea,{rows:3,placeholder:d?.config&&d.config.private_key?`(private key is set — paste new key to replace)`:`-----BEGIN RSA PRIVATE KEY-----
|
|
322
|
+
...`,style:{fontFamily:`monospace`,fontSize:11}})}),(0,W.jsx)(B.Item,{label:`Installation ID`,name:`github_installation_id`,tooltip:`Set automatically via the setup callback, or paste from your GitHub App's installation URL`,children:(0,W.jsx)(L,{placeholder:`123456789`})})]})}]:[],{key:`github-config`,label:(0,W.jsx)(PH,{icon:(0,W.jsx)(Se,{}),title:`GitHub Settings`,subtitle:`polling & mentions`}),children:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(B.Item,{label:`Watch Repos`,name:`github_watch_repos`,rules:[{required:!0,message:`At least one repo is required`}],tooltip:`Repos to watch for @mentions, in owner/repo format`,children:(0,W.jsx)(F,{mode:`tags`,placeholder:`preset-io/agor`,tokenSeparators:[`,`,` `]})}),(0,W.jsx)(B.Item,{label:`Require @mention`,name:`github_require_mention`,valuePropName:`checked`,initialValue:!0,tooltip:`Only respond to PR/issue comments that @mention the bot`,children:(0,W.jsx)(ve,{})}),(0,W.jsx)(B.Item,{label:`Mention Name`,name:`github_mention_name`,tooltip:`The name users type to trigger the bot (e.g., 'agor' for @agor)`,initialValue:`agor`,children:(0,W.jsx)(L,{prefix:`@`,placeholder:`agor`})}),(0,W.jsx)(B.Item,{label:`Poll Interval (seconds)`,name:`github_poll_interval_s`,initialValue:30,tooltip:`How frequently to poll the GitHub API for new mentions`,children:(0,W.jsx)($e,{min:10,max:300,style:{width:`100%`}})})]})},{key:`identity`,label:(0,W.jsx)(PH,{icon:(0,W.jsx)(Be,{}),title:`Identity`,subtitle:IH(E)}),children:(0,W.jsx)(LH,{alignFieldName:`github_align_users`,alignLabel:`Align GitHub users`,alignDescription:`Map GitHub logins to Agor users. Unmapped users are rejected.`,alignUsers:E,userById:a,alignedContent:(0,W.jsx)(B.Item,{label:`User Map`,name:`github_user_map`,tooltip:`JSON object mapping GitHub logins to Agor email addresses`,rules:[{validator:dH}],children:(0,W.jsx)(uH,{rows:4,placeholder:`{
|
|
323
|
+
"octocat": "user@example.com"
|
|
324
|
+
}`})})})},{key:`agentic-tool-config`,label:(0,W.jsx)(PH,{icon:(0,W.jsx)(ct,{}),title:`Agent Configuration`,subtitle:l}),children:(0,W.jsxs)(z,{orientation:`vertical`,size:`middle`,style:{width:`100%`},children:[(0,W.jsx)(o.Text,{type:`secondary`,style:{fontSize:12},children:`Configure which agent and settings to use for sessions created from this channel.`}),(0,W.jsx)(dr,{agents:pr,selectedAgentId:l,onSelect:u,columns:2,showHelperText:!1,showComparisonLink:!1}),(0,W.jsx)(lV,{agenticTool:l,mcpServerById:s,showHelpText:!1})]})},{key:`env-vars`,label:(0,W.jsx)(PH,{icon:(0,W.jsx)(_t,{}),title:`Environment Variables`,subtitle:`channel-level secrets`}),children:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(o.Text,{type:`secondary`,style:{fontSize:12,display:`block`,marginBottom:12},children:`Define environment variables for sessions created from this channel. Useful for service account tokens or API keys for MCP servers.`}),(0,W.jsx)(B.Item,{name:`envVars`,noStyle:!0,children:(0,W.jsx)(RH,{})})]})}]})]}),n===`teams`&&(0,W.jsx)(c,{ghost:!0,destroyOnHidden:!1,defaultActiveKey:t===`create`?[`teams-credentials`]:[],style:{marginLeft:-16,marginRight:-16},items:[{key:`teams-credentials`,label:(0,W.jsx)(PH,{icon:(0,W.jsx)(_e,{}),title:`Azure Bot Credentials`,subtitle:t===`edit`?`leave blank to keep current`:void 0}),children:(0,W.jsxs)(W.Fragment,{children:[t===`edit`&&d&&(0,W.jsxs)(B.Item,{label:`Channel Key`,children:[(0,W.jsx)(L.Search,{value:d.channel_key,readOnly:!0,enterButton:(0,W.jsx)(We,{}),onSearch:()=>f?.(d.channel_key)}),(0,W.jsx)(o.Text,{type:`secondary`,style:{fontSize:12,marginTop:4,display:`block`},children:`Use this key to authenticate inbound messages from the platform.`})]}),(0,W.jsx)(B.Item,{label:`App ID`,name:`teams_app_id`,rules:t===`create`?[{required:!0,message:`Azure Bot App ID is required`}]:[],tooltip:`Azure Bot Registration Application (client) ID`,children:(0,W.jsx)(L,{placeholder:`00000000-0000-0000-0000-000000000000`})}),(0,W.jsx)(B.Item,{label:`App Password`,name:`teams_app_password`,rules:t===`create`?[{required:!0,message:`Azure Bot App Password is required`}]:[],tooltip:`Azure Bot Registration client secret (value, not the secret ID)`,children:(0,W.jsx)(L.Password,{placeholder:t===`edit`?`••••••••`:`Client secret value`})}),(0,W.jsx)(B.Item,{label:`Tenant ID`,name:`teams_tenant_id`,rules:[{required:!0,message:`Tenant ID is required for Teams bots`}],tooltip:`Azure AD Tenant ID. Required so the bot can acquire tokens to send replies.`,children:(0,W.jsx)(L,{placeholder:`00000000-0000-0000-0000-000000000000`})}),(0,W.jsx)(k,{type:`info`,showIcon:!0,message:`Azure Bot Setup`,description:(0,W.jsxs)(`span`,{children:[`Create an Azure Bot resource in the`,` `,(0,W.jsx)(o.Link,{href:`https://portal.azure.com/#create/Microsoft.AzureBotService`,target:`_blank`,rel:`noopener noreferrer`,children:`Azure Portal`}),`. Both single-tenant and multi-tenant bots are supported. The`,` `,(0,W.jsx)(`strong`,{children:`Tenant ID`}),` is required so the bot can send replies. Then sideload the bot as a Teams app via a custom manifest.`]}),style:{fontSize:12}})]})},{key:`teams-message-sources`,label:(0,W.jsx)(PH,{icon:(0,W.jsx)(g,{}),title:`Message Sources`,subtitle:`DMs & channels`}),children:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(o.Text,{type:`secondary`,style:{fontSize:12,display:`block`,marginBottom:16},children:`Configure how the bot responds in Teams channels vs 1:1 chats. Direct messages are always enabled.`}),(0,W.jsx)(B.Item,{label:`Require @mention in channels`,name:`teams_require_mention`,valuePropName:`checked`,initialValue:!0,tooltip:`When enabled, bot only responds when @mentioned in Teams channels (recommended)`,children:(0,W.jsx)(ve,{})})]})},{key:`teams-webhook`,label:(0,W.jsx)(PH,{icon:(0,W.jsx)(Ge,{}),title:`Webhook Configuration`,subtitle:`port & path`}),children:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(o.Text,{type:`secondary`,style:{fontSize:12,display:`block`,marginBottom:12},children:`The Teams connector runs an HTTP server for the Bot Framework messaging endpoint. Configure the port and path to match your Azure Bot's messaging endpoint URL.`}),(0,W.jsx)(B.Item,{label:`Webhook Port`,name:`teams_webhook_port`,initialValue:3978,tooltip:`Port for the Bot Framework HTTP endpoint`,children:(0,W.jsx)($e,{min:1024,max:65535,style:{width:`100%`}})}),(0,W.jsx)(B.Item,{label:`Webhook Path`,name:`teams_webhook_path`,initialValue:`/api/messages`,tooltip:`URL path for the Bot Framework messaging endpoint`,children:(0,W.jsx)(L,{placeholder:`/api/messages`})})]})},{key:`agentic-tool-config`,label:(0,W.jsx)(PH,{icon:(0,W.jsx)(ct,{}),title:`Agent Configuration`,subtitle:l}),children:(0,W.jsxs)(z,{orientation:`vertical`,size:`middle`,style:{width:`100%`},children:[(0,W.jsx)(o.Text,{type:`secondary`,style:{fontSize:12},children:`Configure which agent and settings to use for sessions created from this channel.`}),(0,W.jsx)(dr,{agents:pr,selectedAgentId:l,onSelect:u,columns:2,showHelperText:!1,showComparisonLink:!1}),(0,W.jsx)(lV,{agenticTool:l,mcpServerById:s,showHelpText:!1})]})},{key:`env-vars`,label:(0,W.jsx)(PH,{icon:(0,W.jsx)(_t,{}),title:`Environment Variables`,subtitle:`channel-level secrets`}),children:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(o.Text,{type:`secondary`,style:{fontSize:12,display:`block`,marginBottom:12},children:`Define environment variables for sessions created from this channel. Useful for service account tokens or API keys for MCP servers.`}),(0,W.jsx)(B.Item,{name:`envVars`,noStyle:!0,children:(0,W.jsx)(RH,{})})]})}]}),n===`slack`&&(0,W.jsx)(c,{ghost:!0,destroyOnHidden:!1,defaultActiveKey:t===`create`?[`identity`,`credentials`]:[],style:{marginLeft:-16,marginRight:-16},items:[{key:`identity`,label:(0,W.jsx)(PH,{icon:(0,W.jsx)(Pe,{}),title:`Identity`,subtitle:IH(T)}),children:(0,W.jsx)(LH,{alignFieldName:`align_slack_users`,alignLabel:`Align Slack users`,alignDescription:`Match Slack profile email to an Agor user. Unmatched users are rejected.`,alignUsers:T,userById:a,alignedContent:(0,W.jsx)(k,{type:`info`,showIcon:!0,title:`Requires users:read.email scope`,description:(0,W.jsxs)(`span`,{children:[`Add `,(0,W.jsx)(`code`,{children:`users:read.email`}),` to your Slack app so Agor can match Slack profiles by email.`]}),style:{fontSize:12}})})},{key:`credentials`,label:(0,W.jsx)(PH,{icon:(0,W.jsx)(_e,{}),title:`Credentials`,subtitle:t===`edit`?`leave blank to keep current`:void 0}),children:(0,W.jsxs)(W.Fragment,{children:[t===`edit`&&d&&(0,W.jsxs)(B.Item,{label:`Channel Key`,children:[(0,W.jsx)(L.Search,{value:d.channel_key,readOnly:!0,enterButton:(0,W.jsx)(We,{}),onSearch:()=>f?.(d.channel_key)}),(0,W.jsx)(o.Text,{type:`secondary`,style:{fontSize:12,marginTop:4,display:`block`},children:`Use this key to authenticate inbound messages from the platform.`})]}),(0,W.jsx)(B.Item,{label:`Bot Token`,name:`bot_token`,rules:t===`create`?[{required:!0,message:`Bot token is required`}]:[],tooltip:`Slack Bot User OAuth Token (xoxb-...)`,children:(0,W.jsx)(L.Password,{placeholder:t===`edit`?`••••••••`:`xoxb-...`})}),(0,W.jsx)(B.Item,{label:`App Token`,name:`app_token`,rules:t===`create`?[{required:!0,message:`App token is required`}]:[],tooltip:`Slack App-Level Token for Socket Mode (xapp-...)`,children:(0,W.jsx)(L.Password,{placeholder:t===`edit`?`••••••••`:`xapp-...`})}),(0,W.jsx)(k,{type:`info`,showIcon:!0,title:`Socket Mode Required`,description:`Enable Socket Mode in your Slack app settings and generate an app-level token with connections:write scope.`,style:{fontSize:12}})]})},{key:`message-sources`,label:(0,W.jsx)(PH,{icon:(0,W.jsx)(g,{}),title:`Message Sources`,subtitle:`DMs always enabled`}),children:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(o.Text,{type:`secondary`,style:{fontSize:12,display:`block`,marginBottom:16},children:`Choose where the bot listens for messages. Direct messages are always enabled.`}),(0,W.jsx)(B.Item,{label:`Public Channels`,name:`enable_channels`,valuePropName:`checked`,initialValue:!1,tooltip:`Bot will respond to messages in public channels it's added to`,children:(0,W.jsx)(ve,{})}),(0,W.jsx)(B.Item,{label:`Private Channels`,name:`enable_groups`,valuePropName:`checked`,initialValue:!1,tooltip:`Bot will respond to messages in private channels it's added to`,children:(0,W.jsx)(ve,{})}),(0,W.jsx)(B.Item,{label:`Group DMs`,name:`enable_mpim`,valuePropName:`checked`,initialValue:!1,tooltip:`Bot will respond to messages in multi-person direct messages`,children:(0,W.jsx)(ve,{})}),(0,W.jsx)(B.Item,{label:`Require @mention`,name:`require_mention`,valuePropName:`checked`,initialValue:!0,tooltip:`When enabled, bot only responds when explicitly @mentioned (recommended for channels)`,children:(0,W.jsx)(ve,{})}),D&&!w&&(0,W.jsx)(k,{type:`warning`,showIcon:!0,title:`Bot will respond to ALL messages in enabled channels. This can be noisy and expensive.`,style:{marginBottom:12}}),D&&(0,W.jsx)(k,{type:`info`,showIcon:!0,title:`Required Slack Scopes & Events`,description:(0,W.jsxs)(`ul`,{style:{margin:`8px 0 0 0`,paddingLeft:20,fontSize:12},children:[(0,W.jsxs)(`li`,{children:[(0,W.jsx)(`code`,{children:`chat:write`}),` (always required)`]}),b&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`li`,{children:[(0,W.jsx)(`code`,{children:`channels:history`}),` + `,(0,W.jsx)(`code`,{children:`app_mentions:read`})]}),(0,W.jsxs)(`li`,{children:[`Events: `,(0,W.jsx)(`code`,{children:`message.channels`}),`, `,(0,W.jsx)(`code`,{children:`app_mention`})]})]}),x&&(0,W.jsxs)(`li`,{children:[(0,W.jsx)(`code`,{children:`groups:history`}),` + event: `,(0,W.jsx)(`code`,{children:`message.groups`})]}),S&&(0,W.jsxs)(`li`,{children:[(0,W.jsx)(`code`,{children:`mpim:history`}),` + event: `,(0,W.jsx)(`code`,{children:`message.mpim`})]})]}),style:{fontSize:12}})]})},{key:`advanced`,label:(0,W.jsx)(PH,{icon:(0,W.jsx)(Ge,{}),title:`Advanced`,subtitle:`channel whitelist`}),children:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(o.Text,{type:`secondary`,style:{fontSize:12,display:`block`,marginBottom:12},children:`Restrict the bot to specific Slack channels by ID. Leave empty to allow all channels. Find channel IDs: right-click channel → View channel details → scroll to bottom.`}),(0,W.jsx)(B.Item,{name:`allowed_channel_ids`,tooltip:`Slack channel IDs (e.g., C01ABC123XY). Press Enter to add each ID.`,children:(0,W.jsx)(F,{mode:`tags`,placeholder:`Add channel IDs... (e.g., C01ABC123XY)`,style:{width:`100%`},tokenSeparators:[`,`,` `]})})]})},{key:`agentic-tool-config`,label:(0,W.jsx)(PH,{icon:(0,W.jsx)(ct,{}),title:`Agent Configuration`,subtitle:l}),children:(0,W.jsxs)(z,{orientation:`vertical`,size:`middle`,style:{width:`100%`},children:[(0,W.jsx)(o.Text,{type:`secondary`,style:{fontSize:12},children:`Configure which agent and settings to use for sessions created from this channel.`}),(0,W.jsx)(dr,{agents:pr,selectedAgentId:l,onSelect:u,columns:2,showHelperText:!1,showComparisonLink:!1}),(0,W.jsx)(lV,{agenticTool:l,mcpServerById:s,showHelpText:!1})]})},{key:`env-vars`,label:(0,W.jsx)(PH,{icon:(0,W.jsx)(_t,{}),title:`Environment Variables`,subtitle:`channel-level secrets`}),children:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(o.Text,{type:`secondary`,style:{fontSize:12,display:`block`,marginBottom:12},children:`Define environment variables for sessions created from this channel. Useful for service account tokens or API keys for MCP servers.`}),(0,W.jsx)(B.Item,{name:`envVars`,noStyle:!0,children:(0,W.jsx)(RH,{})})]})}]})]})},VH=({client:e,gatewayChannelById:t,branchById:n,userById:r,mcpServerById:i,currentUser:a,onCreate:s,onUpdate:c,onDelete:l})=>{let{showSuccess:u,showError:d}=dn(),{token:f}=I.useToken(),[p,m]=(0,U.useState)(!1),[h,_]=(0,U.useState)(!1),[y,b]=(0,U.useState)(null),[x,S]=(0,U.useState)(`slack`),[C,w]=(0,U.useState)(`claude-code`),[T,D]=(0,U.useState)(null),[O,j]=(0,U.useState)(null),[M,P]=(0,U.useState)(``),[ee]=B.useForm(),[ne]=B.useForm(),[ie,ae]=(0,U.useState)(()=>new Map),F=(0,U.useRef)(new Set),oe=(0,U.useRef)(new Map),[se,ce]=(0,U.useState)(0),[le,ue]=(0,U.useState)(!1),[de,pe]=(0,U.useState)(null),[me,he]=(0,U.useState)(null),ge=fn(),_e=qt();(0,U.useEffect)(()=>{let e=new URLSearchParams(ge.search).get(`installation_id`);e&&(he({installation_id:e}),S(`github`),ce(1),m(!0),_e(`/`,{replace:!0}))},[ge.search,_e]),(0,U.useEffect)(()=>{oe.current=ie},[ie]),(0,U.useEffect)(()=>{if(!e)return;let r=new Set;for(let e of t.values())e.target_branch_id&&r.add(e.target_branch_id);let i=Array.from(r).filter(e=>!n.has(e)&&!oe.current.has(e));if(i.length===0)return;let a=!1;return Promise.all(i.map(async t=>{if(F.current.has(t))return null;F.current.add(t);try{return await e.service(`branches`).get(t)}catch{return null}finally{F.current.delete(t)}})).then(e=>{if(a)return;let t=e.filter(e=>e!==null);t.length!==0&&ae(e=>{let n=new Map(e);for(let e of t)n.set(e.branch_id,e);return n})}),()=>{a=!0}},[e,t,n]);let ye=(0,U.useMemo)(()=>{let e=new Map;for(let t of n.values())e.set(t.branch_id,t);for(let t of ie.values())e.has(t.branch_id)||e.set(t.branch_id,t);return e},[ie,n]),be=(0,U.useCallback)(()=>{ce(0),ue(!1),pe(null),he(null)},[]);(0,U.useEffect)(()=>{let e=a?.default_agentic_config?.[C];e&&(h?ne:ee).setFieldsValue({permissionMode:e.permissionMode,modelConfig:e.modelConfig,mcpServerIds:e.mcpServerIds,codexSandboxMode:e.codexSandboxMode,codexApprovalPolicy:e.codexApprovalPolicy,codexNetworkAccess:e.codexNetworkAccess})},[C,a,ee,ne,h]);let Se=(e,t,n)=>{let r=[`bot_token`,`app_token`,`signing_secret`,`private_key`,`app_password`],i={...t||{}};for(let e of r)delete i[e];let a={...i};if(e.channel_type===`github`){if(e.github_app_id&&(a.app_id=Number(e.github_app_id)),e.github_private_key&&(a.private_key=e.github_private_key),e.github_installation_id&&(a.installation_id=Number(e.github_installation_id)),a.watch_repos=e.github_watch_repos??[],a.require_mention=e.github_require_mention??!0,a.mention_name=e.github_mention_name||`agor`,a.poll_interval_ms=(e.github_poll_interval_s??30)*1e3,a.align_github_users=e.github_align_users??!1,e.github_user_map)try{a.user_map=JSON.parse(e.github_user_map)}catch{}}else e.channel_type===`teams`?(e.teams_app_id&&(a.app_id=e.teams_app_id),e.teams_app_password&&(a.app_password=e.teams_app_password),a.tenant_id=e.teams_tenant_id,a.webhook_port=e.teams_webhook_port??3978,a.webhook_path=e.teams_webhook_path||`/api/messages`,a.require_mention=e.teams_require_mention??!0):e.channel_type===`slack`&&(e.bot_token&&(a.bot_token=e.bot_token),e.app_token&&(a.app_token=e.app_token),e.connection_mode&&(a.connection_mode=e.connection_mode),a.enable_channels=e.enable_channels??!1,a.enable_groups=e.enable_groups??!1,a.enable_mpim=e.enable_mpim??!1,a.require_mention=e.require_mention??!0,a.align_slack_users=e.align_slack_users??!1,a.allowed_channel_ids=e.allowed_channel_ids??[]);let o={agent:n||`claude-code`,...e.permissionMode?{permissionMode:e.permissionMode}:{},...e.modelConfig?{modelConfig:e.modelConfig}:{},...e.mcpServerIds?{mcpServerIds:e.mcpServerIds}:{},...e.codexSandboxMode?{codexSandboxMode:e.codexSandboxMode}:{},...e.codexApprovalPolicy?{codexApprovalPolicy:e.codexApprovalPolicy}:{},...e.codexNetworkAccess===void 0?{}:{codexNetworkAccess:e.codexNetworkAccess},...e.envVars===void 0?{}:{envVars:e.envVars.filter(e=>e.key.trim()!==``)}};return{name:e.name,channel_type:e.channel_type,target_branch_id:e.target_branch_id,agor_user_id:e.agor_user_id,config:a,agentic_config:o,enabled:e.enabled??!0}},Ce=async()=>{try{await ee.validateFields();let t=ee.getFieldsValue(!0),n=Se(t,void 0,C);if(!e){d(`Not connected to server`);return}let r=await e.service(`gateway-channels`).create(n);u(`Gateway channel created!`),j(t.channel_type),D(r.channel_key),ee.resetFields(),m(!1),S(`slack`),be()}catch(e){let t=e;t.errorFields?.length?d(t.errorFields[0].errors[0]||`Please fill in required fields`):d(`Failed to create channel: ${t.message||String(e)}`)}},we=e=>{b(e),S(e.channel_type),w(e.agentic_config?.agent||`claude-code`),ne.resetFields();let t=e.config,n={name:e.name,channel_type:e.channel_type,target_branch_id:e.target_branch_id,agor_user_id:e.agor_user_id,enabled:e.enabled,permissionMode:e.agentic_config?.permissionMode,modelConfig:e.agentic_config?.modelConfig,mcpServerIds:e.agentic_config?.mcpServerIds,codexSandboxMode:e.agentic_config?.codexSandboxMode,codexApprovalPolicy:e.agentic_config?.codexApprovalPolicy,codexNetworkAccess:e.agentic_config?.codexNetworkAccess,envVars:e.agentic_config?.envVars??[]};if(e.channel_type===`slack`)n.connection_mode=t?.connection_mode||`socket`,n.enable_channels=t?.enable_channels??!1,n.enable_groups=t?.enable_groups??!1,n.enable_mpim=t?.enable_mpim??!1,n.require_mention=t?.require_mention??!0,n.align_slack_users=t?.align_slack_users??!1,n.allowed_channel_ids=t?.allowed_channel_ids??[];else if(e.channel_type===`github`){n.github_app_id=t?.app_id,n.github_installation_id=t?.installation_id,n.github_watch_repos=t?.watch_repos??[],n.github_require_mention=t?.require_mention??!0,n.github_mention_name=t?.mention_name||`agor`,n.github_poll_interval_s=(t?.poll_interval_ms??3e4)/1e3,n.github_align_users=t?.align_github_users??!1;let e=t?.user_map;e&&typeof e==`object`&&Object.keys(e).length>0&&(n.github_user_map=JSON.stringify(e,null,2))}else e.channel_type===`teams`&&(n.teams_app_id=t?.app_id,n.teams_tenant_id=t?.tenant_id,n.teams_webhook_port=t?.webhook_port??3978,n.teams_webhook_path=t?.webhook_path||`/api/messages`,n.teams_require_mention=t?.require_mention??!0);ne.setFieldsValue(n),_(!0)},Te=()=>{y&&ne.validateFields().then(()=>{let e=Se(ne.getFieldsValue(!0),y.config,C);c?.(y.id,e),ne.resetFields(),_(!1),b(null),S(`slack`)}).catch(e=>{console.error(`Form validation failed:`,e),e.errorFields?.length>0&&d(e.errorFields[0].errors[0]||`Please fill in required fields`)})},Ee=e=>{c?.(e.id,{enabled:!e.enabled})},De=e=>{l?.(e)},Oe=async e=>{await on(e)?u(`Channel key copied to clipboard`):d(`Failed to copy to clipboard`)},ke=[{title:``,key:`status`,width:40,render:(e,t)=>(0,W.jsx)(re,{status:t.enabled?`success`:`default`,title:t.enabled?`Enabled`:`Disabled`})},{title:`Name`,dataIndex:`name`,key:`name`,width:180,render:e=>(0,W.jsx)(No,{text:e,query:M})},{title:`Type`,dataIndex:`channel_type`,key:`channel_type`,width:120,render:e=>(0,W.jsx)(v,{icon:MH(e),color:NH(e),children:e.charAt(0).toUpperCase()+e.slice(1)})},{title:`Target Branch`,dataIndex:`target_branch_id`,key:`target_branch_id`,width:180,render:e=>{let t=ye.get(e);return(0,W.jsx)(o.Text,{type:`secondary`,children:(0,W.jsx)(No,{text:t?`${t.name||t.ref||e}${t.archived?` (archived)`:``}`:e,query:M})})}},{title:`Last Message`,dataIndex:`last_message_at`,key:`last_message_at`,width:160,render:e=>e?(0,W.jsx)(o.Text,{type:`secondary`,style:{fontSize:12},children:new Date(e).toLocaleString()}):(0,W.jsx)(o.Text,{type:`secondary`,style:{fontSize:12},children:`Never`})},{title:`Actions`,key:`actions`,width:140,render:(e,t)=>(0,W.jsxs)(z,{size:`small`,children:[(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(N,{}),onClick:()=>we(t),title:`Edit`}),(0,W.jsx)(ve,{size:`small`,checked:t.enabled,onChange:()=>Ee(t),title:t.enabled?`Disable`:`Enable`}),(0,W.jsx)(A,{title:`Delete gateway channel?`,description:`Are you sure you want to delete "${t.name}"? All thread mappings will be lost.`,onConfirm:()=>De(t.id),okText:`Delete`,cancelText:`Cancel`,okButtonProps:{danger:!0},children:(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(te,{}),danger:!0,title:`Delete`})})]})}],Ae=(0,U.useMemo)(()=>Ao(Eo(t,(e,t)=>e.name.localeCompare(t.name,void 0,{sensitivity:`base`})),M,[e=>e.name,e=>e.channel_type,e=>e.channel_key,e=>e.enabled?`enabled`:`disabled`,e=>e.last_message_at,e=>{let t=ye.get(e.target_branch_id);return[t?.name,t?.ref,e.target_branch_id]},e=>JSON.stringify(e.config??{})]),[t,M,ye]);return(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`div`,{style:{marginBottom:16,display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,W.jsx)(o.Text,{type:`secondary`,children:`Route messages from Slack, GitHub, Microsoft Teams, and other platforms to Agor sessions.`}),(0,W.jsxs)(z,{children:[(0,W.jsx)(L,{allowClear:!0,placeholder:`Search name, type, target branch, key, or config`,value:M,onChange:e=>P(e.target.value),style:{width:360}}),(0,W.jsx)(V,{type:`primary`,icon:(0,W.jsx)(fe,{}),onClick:()=>m(!0),children:`Add Channel`})]})]}),(0,W.jsx)(k,{type:`warning`,showIcon:!0,style:{marginBottom:16},title:`Beta Feature — Security Notice`,description:(0,W.jsxs)(W.Fragment,{children:[`The Message Gateway is a `,(0,W.jsx)(`strong`,{children:`beta feature`}),`. Connecting external messaging platforms grants anyone who can message your bot potential access to Agor sessions and the underlying branch environment.`,` `,(0,W.jsx)(o.Link,{href:`https://agor.live/guide/message-gateway`,target:`_blank`,rel:`noopener noreferrer`,children:`Read the full security guidance`}),` `,`before enabling channels in production.`]})}),Ae.length===0?(0,W.jsxs)(`div`,{style:{padding:`60px 20px`,textAlign:`center`,color:f.colorTextTertiary},children:[(0,W.jsx)(g,{style:{fontSize:48,marginBottom:16,display:`block`}}),(0,W.jsx)(o.Text,{type:`secondary`,style:{display:`block`,marginBottom:8},children:`No channels configured.`}),(0,W.jsx)(o.Text,{type:`secondary`,style:{fontSize:12},children:`Add a channel to route messages from Slack, Teams, or other platforms to Agor sessions.`})]}):(0,W.jsx)(E,{dataSource:Ae,columns:ke,rowKey:`id`,pagination:{pageSize:10,showSizeChanger:!0},size:`small`}),(0,W.jsx)(nt,{title:`Add Gateway Channel`,open:p,onOk:Ce,onCancel:()=>{ee.resetFields(),m(!1),S(`slack`),w(`claude-code`),be()},okText:`Create`,okButtonProps:{style:x===`github`&&se<2?{display:`none`}:void 0},width:600,children:(0,W.jsx)(B,{form:ee,layout:`vertical`,preserve:!0,style:{marginTop:16},children:(0,W.jsx)(BH,{form:ee,mode:`create`,channelType:x,onChannelTypeChange:S,branchById:ye,userById:r,mcpServerById:i,selectedAgent:C,onAgentChange:w,githubStep:se,onGithubStepChange:ce,githubSetupParams:me,githubLoading:le,githubError:de})})}),(0,W.jsx)(nt,{title:`Edit Gateway Channel`,open:h,onOk:Te,onCancel:()=>{ne.resetFields(),_(!1),b(null),S(`slack`),w(`claude-code`)},okText:`Save`,width:600,children:(0,W.jsx)(B,{form:ne,layout:`vertical`,preserve:!0,style:{marginTop:16},children:(0,W.jsx)(BH,{form:ne,mode:`edit`,channelType:x,onChannelTypeChange:S,branchById:ye,userById:r,mcpServerById:i,selectedAgent:C,onAgentChange:w,editingChannel:y,onCopyKey:Oe,githubStep:2,onGithubStepChange:()=>{},githubSetupParams:null,githubLoading:!1,githubError:null})})}),(0,W.jsxs)(nt,{title:null,open:T!==null,footer:[(0,W.jsx)(V,{type:`primary`,onClick:()=>{D(null),j(null)},children:`Done`},`done`)],onCancel:()=>{D(null),j(null)},width:560,children:[(0,W.jsx)(xe,{status:`success`,title:`Channel Created`,subTitle:`Your gateway channel has been created. Use the channel key below to configure your platform integration.`}),T&&T!==`pending`&&(0,W.jsxs)(`div`,{style:{padding:`0 24px 16px`},children:[(0,W.jsx)(k,{title:`Channel Key`,description:(0,W.jsxs)(z,{orientation:`vertical`,style:{width:`100%`},children:[(0,W.jsx)(L.Search,{value:T,readOnly:!0,enterButton:(0,W.jsx)(We,{}),onSearch:()=>Oe(T),style:{fontFamily:`monospace`}}),(0,W.jsx)(o.Text,{type:`warning`,style:{fontSize:12},children:`Keep this key secret — it authenticates messages from the platform to Agor.`})]}),type:`warning`,showIcon:!0,style:{marginBottom:16}}),O===`slack`&&(0,W.jsx)(k,{title:`Slack Setup`,description:(0,W.jsxs)(`ol`,{style:{margin:0,paddingLeft:20,fontSize:12},children:[(0,W.jsx)(`li`,{children:`Install the Slack app to your workspace`}),(0,W.jsx)(`li`,{children:`Enable Socket Mode in your Slack app settings`}),(0,W.jsxs)(`li`,{children:[`Add required OAuth scopes: `,(0,W.jsx)(`code`,{children:`chat:write`}),` (and others based on enabled message sources)`]}),(0,W.jsxs)(`li`,{children:[`Subscribe to bot events: `,(0,W.jsx)(`code`,{children:`message.im`}),` (and others based on enabled message sources)`]}),(0,W.jsx)(`li`,{children:`The gateway will automatically connect when the channel is enabled`})]}),type:`info`,showIcon:!0}),O===`github`&&(0,W.jsx)(k,{title:`GitHub Channel Ready`,description:(0,W.jsxs)(`ol`,{style:{margin:0,paddingLeft:20,fontSize:12},children:[(0,W.jsx)(`li`,{children:`The GitHub App is connected and polling will begin automatically`}),(0,W.jsxs)(`li`,{children:[`Use `,(0,W.jsx)(`code`,{children:`@agor`}),` (or your configured mention name) in PR or issue comments to trigger the bot`]}),(0,W.jsx)(`li`,{children:`Agor will create a session for each conversation and respond in-line on GitHub`}),(0,W.jsx)(`li`,{children:`No webhooks needed — Agor polls the GitHub API on the configured interval`})]}),type:`info`,showIcon:!0}),O===`teams`&&(0,W.jsx)(k,{message:`Microsoft Teams Channel Ready`,description:(0,W.jsxs)(`ol`,{style:{margin:0,paddingLeft:20,fontSize:12},children:[(0,W.jsxs)(`li`,{children:[`Ensure your Azure Bot's messaging endpoint points to this Agor instance's webhook URL (e.g.`,` `,(0,W.jsx)(`code`,{children:`https://your-domain:3978/api/messages`}),`)`]}),(0,W.jsx)(`li`,{children:`Sideload the bot as a Teams app via a custom manifest (manifest.json + icons zip)`}),(0,W.jsx)(`li`,{children:`Send a message to the bot in 1:1 chat or @mention it in a channel to create a session`}),(0,W.jsxs)(`li`,{children:[`The app registration must be `,(0,W.jsx)(`strong`,{children:`multi-tenant`}),` for outbound replies to work`]})]}),type:`info`,showIcon:!0})]}),T===`pending`&&(0,W.jsx)(`div`,{style:{padding:`0 24px 16px`},children:(0,W.jsx)(k,{title:`Channel key will appear here after the server processes the request.`,type:`info`,showIcon:!0})})]})]})};function HH(e,t){let n=new Set(e),r=new Set(t);return{add:t.filter(e=>!n.has(e)),remove:e.filter(e=>!r.has(e))}}async function UH(e,t,n,r){let i=HH(e,t);await Promise.all([...i.add.map(e=>n(e)),...i.remove.map(e=>r(e))])}async function WH(e,t,n,r){await UH(n,r,n=>e.service(`group-memberships`).create({group_id:t,user_id:n}),n=>e.service(`group-memberships`).remove(n,{query:{group_id:t}}))}async function GH(e,t,n,r){await UH(n,r,n=>e.service(`group-memberships`).create({group_id:n,user_id:t}),n=>e.service(`group-memberships`).remove(t,{query:{group_id:n}}))}var KH=({client:e,currentUser:t,userById:n})=>{let{showError:r,showSuccess:i}=dn(),[a,s]=(0,U.useState)([]),[c,l]=(0,U.useState)([]),[u,d]=(0,U.useState)(null),[f,p]=(0,U.useState)([]),[m,h]=(0,U.useState)(!1),[g,_]=(0,U.useState)(``),[y]=B.useForm(),[b]=B.useForm(),x=(0,U.useRef)(!1),S=(0,U.useRef)(!1),C=bt(t?.role,Nt.ADMIN),w=(0,U.useCallback)(async()=>{if(!e||!C){s([]),l([]);return}let[t,n]=await Promise.all([e.service(`groups`).findAll({query:{archived:!1}}),e.service(`group-memberships`).findAll({})]);s(t),l(n)},[e,C]);(0,U.useEffect)(()=>{w().catch(e=>r(`Failed to load groups: ${e instanceof Error?e.message:String(e)}`))},[w,r]);let T=(0,U.useMemo)(()=>{let e=new Map;for(let t of c){let n=e.get(t.group_id)||[];n.push(t.user_id),e.set(t.group_id,n)}return e},[c]),D=async()=>{if(!e)return;let t=await y.validateFields();await e.service(`groups`).create(t),k(),i(`Group created`),await w()},O=()=>{x.current=!1,y.resetFields(),h(!0)},k=()=>{x.current=!1,y.resetFields(),h(!1)},j=e=>{if(Object.hasOwn(e,`slug`)){x.current=!0;return}Object.hasOwn(e,`name`)&&!x.current&&y.setFieldsValue({slug:$r(e.name||``)})},M=e=>{if(Object.hasOwn(e,`slug`)){S.current=!0;return}Object.hasOwn(e,`name`)&&!S.current&&!b.getFieldValue(`slug`)&&b.setFieldsValue({slug:$r(e.name||``)})},P=async()=>{if(!e||!u)return;let t=await b.validateFields();await e.service(`groups`).patch(u.group_id,t),await ne(u,f),d(null),p([]),i(`Group updated`),await w()},ee=async t=>{e&&(await e.service(`groups`).patch(t.group_id,{archived:!0}),i(`Group archived`),await w())},ne=async(t,n)=>{e&&await WH(e,t.group_id,T.get(t.group_id)||[],n)},re=async(e,t)=>{await ne(e,t),await w()};if(!C)return(0,W.jsx)(o.Text,{type:`secondary`,children:`Only admins can manage groups.`});let ie=Eo(n,(e,t)=>e.email.localeCompare(t.email)).map(eB),ae=Ao([...a].sort((e,t)=>e.name.localeCompare(t.name)),g,[e=>e.name,e=>e.slug,e=>e.description,e=>(T.get(e.group_id)||[]).map(e=>n.get(e)).filter(e=>!!e).flatMap(e=>[e.name,e.email,e.unix_username])]);return(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`div`,{style:{marginBottom:16,display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,W.jsx)(o.Text,{type:`secondary`,children:`Manage groups and user memberships.`}),(0,W.jsxs)(z,{children:[(0,W.jsx)(L,{allowClear:!0,placeholder:`Search name, slug, description, or members`,value:g,onChange:e=>_(e.target.value),style:{width:320}}),(0,W.jsx)(V,{type:`primary`,icon:(0,W.jsx)(fe,{}),onClick:O,children:`New Group`})]})]}),(0,W.jsx)(E,{rowKey:`group_id`,size:`small`,pagination:!1,dataSource:ae,columns:[{title:`Group`,dataIndex:`name`,render:(e,t)=>(0,W.jsxs)(z,{children:[(0,W.jsx)(Pe,{}),(0,W.jsx)(`span`,{children:(0,W.jsx)(No,{text:t.name,query:g})}),(0,W.jsx)(v,{children:(0,W.jsx)(No,{text:t.slug||``,query:g})})]})},{title:`Description`,dataIndex:`description`,render:e=>e?(0,W.jsx)(No,{text:e,query:g}):`—`},{title:`Members`,render:(e,t)=>(0,W.jsx)(F,{mode:`multiple`,style:{minWidth:320},value:T.get(t.group_id)||[],options:ie,...nB,onChange:e=>re(t,e)})},{title:`Actions`,width:110,render:(e,t)=>(0,W.jsxs)(z,{children:[(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(N,{}),onClick:()=>{S.current=!1,d(t),p(T.get(t.group_id)||[]),b.setFieldsValue(t)}}),(0,W.jsx)(A,{title:`Archive group?`,onConfirm:()=>ee(t),children:(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(te,{}),danger:!0})})]})}]}),(0,W.jsx)(nt,{title:`Create Group`,open:m,onOk:D,onCancel:k,children:(0,W.jsxs)(B,{form:y,layout:`vertical`,onValuesChange:j,children:[(0,W.jsx)(B.Item,{name:`name`,label:`Name`,rules:[{required:!0}],children:(0,W.jsx)(L,{})}),(0,W.jsx)(B.Item,{name:`slug`,label:`Slug`,extra:`Auto-filled from name; editable.`,children:(0,W.jsx)(L,{placeholder:`engineering`})}),(0,W.jsx)(B.Item,{name:`description`,label:`Description`,children:(0,W.jsx)(L.TextArea,{rows:3})})]})}),(0,W.jsx)(nt,{title:`Edit Group`,open:!!u,onOk:P,onCancel:()=>{d(null),p([])},children:(0,W.jsxs)(B,{form:b,layout:`vertical`,onValuesChange:M,children:[(0,W.jsx)(B.Item,{name:`name`,label:`Name`,rules:[{required:!0}],children:(0,W.jsx)(L,{})}),(0,W.jsx)(B.Item,{name:`slug`,label:`Slug`,extra:`Editable stable key used in URLs and APIs.`,children:(0,W.jsx)(L,{})}),(0,W.jsx)(B.Item,{name:`description`,label:`Description`,children:(0,W.jsx)(L.TextArea,{rows:3})}),(0,W.jsx)(B.Item,{label:`Members`,children:(0,W.jsx)(F,{mode:`multiple`,style:{width:`100%`},value:f,options:ie,...nB,onChange:p,placeholder:`Select users...`})})]})})]})},qH=({form:e,mode:t,repoMode:n,onRepoModeChange:r})=>{let i=t===`edit`,a=n===`local`;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(B.Item,{label:`Repository Type`,children:(0,W.jsxs)(d.Group,{value:n,onChange:r,disabled:i,buttonStyle:`solid`,children:[(0,W.jsx)(d.Button,{value:`remote`,children:`Remote (clone)`}),(0,W.jsx)(d.Button,{value:`local`,children:`Local (existing)`})]})}),!i&&!a&&(0,W.jsx)(B.Item,{label:`Repository URL`,name:`url`,rules:[{required:!0,message:`Please enter a git repository URL`},{pattern:/^((ssh:\/\/)?git@[\w.-]+(:\d+)?[:/][\w./-]+|https?:\/\/[\w.-]+(:\d+)?\/[\w./-]+)$/,message:`Please enter a valid git URL`}],extra:`HTTPS or SSH URL (e.g., git@github.com:org/repo.git)`,children:(0,W.jsx)(L,{placeholder:`https://github.com/apache/superset.git`,onChange:t=>{let n=t.target.value;if(n)try{let t=Ft(n);t&&e.setFieldsValue({slug:t})}catch{}},autoFocus:!0})}),!i&&a&&(0,W.jsx)(B.Item,{label:`Local Repository Path`,name:`path`,rules:[{required:!0,message:`Please enter an absolute path`}],extra:`Absolute path on this machine (supports ~/ expansion)`,children:(0,W.jsx)(L,{placeholder:`~/code/my-app`,onChange:t=>{let n=t.target.value;if(n){let t=Qr(n);t&&e.setFieldsValue({slug:t})}},autoFocus:!0})}),(0,W.jsx)(B.Item,{label:`Repository Slug`,name:`slug`,rules:[{required:!a||i,message:`Please enter a slug`},{pattern:/^[a-zA-Z0-9._-]+\/[a-zA-Z0-9._-]+$/,message:`Slug must be in org/repo format`}],extra:a?`Provide org/repo format (e.g., local/myapp)`:`Auto-detected from URL (editable)`,children:(0,W.jsx)(L,{placeholder:`apache/superset`,disabled:i})}),!a&&(0,W.jsx)(B.Item,{label:`Default Branch`,name:`default_branch`,rules:[{required:!0,message:`Please enter the default branch`}],extra:`The main branch to base new branches on`,children:(0,W.jsx)(L,{placeholder:`main`})}),!i&&(0,W.jsx)(o.Text,{type:`secondary`,style:{fontSize:12},children:a?`Link an existing git clone on this machine.`:`The repository will be cloned to the server.`})]})},JH=({repoById:e,onCreate:t,onCreateLocal:n,onUpdate:r,onDelete:i})=>{let a=(0,U.useMemo)(()=>To(e).sort((e,t)=>e.name.localeCompare(t.name)),[e]),[s,c]=(0,U.useState)(``),[l,u]=(0,U.useState)(!1),[d,f]=(0,U.useState)(null),[p,m]=(0,U.useState)(`remote`),[h]=B.useForm(),[g,_]=(0,U.useState)(!1),[v,y]=(0,U.useState)(null),b=!!d,x=(0,U.useMemo)(()=>Ao(a,s,[e=>e.name,e=>e.slug,e=>e.remote_url,e=>e.local_path,e=>e.default_branch,e=>e.repo_type]),[a,s]),S=e=>{y(e),_(!0)},C=e=>{v&&(i?.(v.repo_id,e),_(!1),y(null))},w=()=>{f(null),m(`remote`),h.resetFields(),h.setFieldsValue({default_branch:`main`}),u(!0)},T=e=>{f(e),m(e.repo_type??`remote`),h.setFieldsValue({slug:e.slug,default_branch:e.default_branch||`main`}),u(!0)},E=()=>{h.validateFields().then(e=>{if(b&&d){let t={slug:e.slug};e.default_branch&&(t.default_branch=e.default_branch),r?.(d.repo_id,t)}else p===`local`?n?.({path:e.path,slug:e.slug||void 0}):t?.({url:e.url,slug:e.slug,default_branch:e.default_branch});h.resetFields(),f(null),u(!1)})},D=()=>{h.resetFields(),f(null),m(`remote`),u(!1)},O=e=>{let t=e.target.value;m(t),h.resetFields(),h.setFieldsValue({url:void 0,path:void 0,slug:void 0,default_branch:t===`remote`?`main`:void 0})},k=b?`Edit Repository`:p===`local`?`Add Local Repository`:`Clone Repository`,A=b?`Save`:p===`local`?`Add`:`Clone`;return(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`div`,{style:{marginBottom:16,display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,W.jsx)(o.Text,{type:`secondary`,children:`Connect remote or local git repositories for your sessions.`}),(0,W.jsxs)(z,{children:[(0,W.jsx)(L,{allowClear:!0,placeholder:`Search name, slug, URL, path, type, or branch`,value:s,onChange:e=>c(e.target.value),style:{width:340}}),(0,W.jsx)(V,{type:`primary`,icon:(0,W.jsx)(fe,{}),onClick:w,children:`New Repository`})]})]}),a.length===0&&(0,W.jsx)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`center`,minHeight:400},children:(0,W.jsx)(ue,{description:`No repositories yet`,children:(0,W.jsxs)(o.Text,{type:`secondary`,children:[`Click "New Repository" to clone a remote repo or switch to "Local" mode to link an existing clone. You can also run `,(0,W.jsx)(`code`,{children:`agor repo add-local <path>`}),` from the CLI.`]})})}),a.length>0&&(0,W.jsx)(z,{orientation:`vertical`,size:16,style:{width:`100%`},children:x.map(e=>{let t=e.repo_type===`local`,n=t?`green`:`blue`,r=t?`Local`:`Remote`;return(0,W.jsx)(Ne,{size:`small`,title:(0,W.jsxs)(z,{children:[(0,W.jsx)(de,{}),(0,W.jsx)(o.Text,{strong:!0,children:(0,W.jsx)(No,{text:e.name,query:s})}),(0,W.jsx)(Zn,{color:n,style:{marginLeft:8},children:(0,W.jsx)(No,{text:r,query:s})})]}),extra:(0,W.jsxs)(z,{children:[(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(N,{}),onClick:()=>T(e)}),(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(te,{}),danger:!0,onClick:()=>S(e)})]}),children:(0,W.jsxs)(z,{orientation:`vertical`,size:8,style:{width:`100%`},children:[(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(o.Text,{type:`secondary`,style:{fontSize:12},children:[`Slug:`,` `]}),(0,W.jsx)(o.Text,{code:!0,style:{fontSize:12},children:(0,W.jsx)(No,{text:e.slug,query:s})})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(o.Text,{type:`secondary`,style:{fontSize:12},children:[`Type:`,` `]}),(0,W.jsx)(o.Text,{code:!0,style:{fontSize:11},children:(0,W.jsx)(No,{text:r.toLowerCase(),query:s})})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(o.Text,{type:`secondary`,style:{fontSize:12},children:[`Remote:`,` `]}),(0,W.jsx)(o.Text,{code:!0,style:{fontSize:11},children:e.remote_url?(0,W.jsx)(No,{text:e.remote_url,query:s}):`—`})]}),e.local_path&&(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(o.Text,{type:`secondary`,style:{fontSize:12},children:[`Path:`,` `]}),(0,W.jsx)(o.Text,{code:!0,style:{fontSize:11},children:(0,W.jsx)(No,{text:e.local_path,query:s})})]})]})},e.repo_id)})}),(0,W.jsx)(nt,{title:k,open:l,onOk:E,onCancel:D,okText:A,children:(0,W.jsx)(B,{form:h,layout:`vertical`,style:{marginTop:16},children:(0,W.jsx)(qH,{form:h,mode:b?`edit`:`create`,repoMode:p,onRepoModeChange:O})})}),(0,W.jsx)(nt,{title:`Delete Repository`,open:g,onCancel:()=>{_(!1),y(null)},footer:null,children:v&&(0,W.jsxs)(z,{orientation:`vertical`,size:16,style:{width:`100%`},children:[(0,W.jsxs)(o.Text,{children:[`How would you like to delete`,` `,(0,W.jsxs)(o.Text,{strong:!0,children:[`"`,v.name,`"`]}),`?`]}),v.repo_type===`local`?(0,W.jsx)(Ne,{style:{marginBottom:8},styles:{body:{padding:16}},children:(0,W.jsxs)(z,{orientation:`vertical`,size:8,style:{width:`100%`},children:[(0,W.jsx)(o.Text,{strong:!0,children:`Remove from Agor`}),(0,W.jsxs)(o.Text,{type:`secondary`,style:{fontSize:12},children:[`Remove this repository from Agor's database only. Your local files at`,` `,(0,W.jsx)(o.Text,{code:!0,children:v.local_path}),` will remain untouched.`]}),(0,W.jsx)(V,{danger:!0,onClick:()=>C(!1),style:{marginTop:8},children:`Remove from Agor`})]})}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Ne,{style:{marginBottom:8},styles:{body:{padding:16}},children:(0,W.jsxs)(z,{orientation:`vertical`,size:8,style:{width:`100%`},children:[(0,W.jsx)(o.Text,{strong:!0,children:`Remove from Agor (Keep Files)`}),(0,W.jsxs)(o.Text,{type:`secondary`,style:{fontSize:12},children:[`Remove from database only. Repository and branch directories in`,` `,(0,W.jsx)(o.Text,{code:!0,children:`~/.agor/repos/`}),` and`,` `,(0,W.jsx)(o.Text,{code:!0,children:`~/.agor/worktrees/`}),` will remain on disk.`]}),(0,W.jsx)(V,{onClick:()=>C(!1),style:{marginTop:8},children:`Keep Files`})]})}),(0,W.jsx)(Ne,{styles:{body:{padding:16}},children:(0,W.jsxs)(z,{orientation:`vertical`,size:8,style:{width:`100%`},children:[(0,W.jsx)(o.Text,{strong:!0,children:`Delete Completely (Remove Files)`}),(0,W.jsx)(o.Text,{type:`secondary`,style:{fontSize:12},children:`⚠️ Remove from database AND delete all filesystem directories (repository + branches). This will free up disk space but cannot be undone.`}),(0,W.jsx)(V,{danger:!0,onClick:()=>C(!0),style:{marginTop:8},children:`Delete Files`})]})})]})]})})]})},YH={"gentle-chime":`gentle-chime.mp3`,"notification-bell":`notification-bell.mp3`,"8bit-coin":`8bit-coin.mp3`,"retro-coin":`retro-coin.mp3`,"power-up":`power-up.mp3`,"you-got-mail":`you-got-mail.mp3`,"success-tone":`success-tone.mp3`};function XH(e){let t=e;(e===`bell`||e==="default")&&(t=`notification-bell`),YH[t]||(t=`gentle-chime`);let n=YH[t],r=`/ui/`,i=`${r.endsWith(`/`)?r.slice(0,-1):r}/sounds/${n}`;return typeof window<`u`?new URL(i,window.location.origin).href:i}var ZH={enabled:!1,chime:`gentle-chime`,volume:.5,minDurationSeconds:30},QH=!1;function $H(){if(QH)return;let e=()=>{QH=!0,document.removeEventListener(`click`,e),document.removeEventListener(`keydown`,e),document.removeEventListener(`touchstart`,e)};document.addEventListener(`click`,e,{once:!0}),document.addEventListener(`keydown`,e,{once:!0}),document.addEventListener(`touchstart`,e,{once:!0})}function eU(){return new Promise(e=>{let t=new Audio(`data:audio/mp3;base64,SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU4Ljc2LjEwMAAAAAAAAAAAAAAA//tQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWGluZwAAAA8AAAACAAADhAC7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7u7//////////////////////////////////////////////////////////////////8AAAAATGF2YzU4LjEzAAAAAAAAAAAAAAAAJAAAAAAAAAAAA4T0rBiNAAAAAAD/+xDEAAPAAAGkAAAAIAAANIAAAARMQU1FMy4xMDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/+xDEDwPAAAGkAAAAIAAANIAAAARMQU1FMy4xMDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/+xDEHwPAAAGkAAAAIAAANIAAAARMQU1FMy4xMDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==`);t.volume=0;let n=t.play();n===void 0?e(!1):n.then(()=>{t.pause(),e(!1)}).catch(t=>{t instanceof Error&&t.name===`NotAllowedError`?e(!0):e(!1)})})}function tU(e,t){if(t===0)return!0;if(e.duration_ms!=null)return e.duration_ms/1e3>=t;if(e.started_at&&e.completed_at){let n=new Date(e.started_at).getTime();return(new Date(e.completed_at).getTime()-n)/1e3>=t}return!0}async function nU(e,t){let n=t||ZH;if(!n.enabled||!tU(e,n.minDurationSeconds)||!Et(e.status))return;let r=XH(n.chime);if(!r){console.warn(`Unknown chime sound: ${n.chime}`);return}try{let e=new Audio(r);e.volume=Math.max(0,Math.min(1,n.volume));let t=e.play();t!==void 0&&await t}catch(e){if(e instanceof Error){let t=e.name;t===`NotAllowedError`?console.debug(`🔇 Audio chime blocked by browser autoplay policy. User needs to interact with the page first.`):t===`NotSupportedError`?console.warn(`🔇 Audio format not supported:`,r):console.debug(`Could not play task completion chime:`,e)}}}async function rU(e,t=.5){let n=XH(e);if(!n){console.warn(`Unknown chime sound: ${e}`);return}try{let e=n+`?t=${Date.now()}`,r=new Audio(e);r.volume=Math.max(0,Math.min(1,t)),await r.play()}catch(e){throw console.error(`Failed to preview chime:`,e),e}}function iU(e){return{"gentle-chime":`Gentle Chime`,"notification-bell":`Notification Bell`,"8bit-coin":`8-Bit Coin`,"retro-coin":`Retro Coin`,"power-up":`Power Up`,"you-got-mail":`You've Got Mail`,"success-tone":`Success Tone`}[e]||e}function aU(){return[`gentle-chime`,`notification-bell`,`8bit-coin`,`retro-coin`,`power-up`,`you-got-mail`,`success-tone`]}var{Text:oU}=o;function sU(e){return typeof e==`boolean`?{set:e,scope:`global`}:{set:!!e.set,scope:e.scope}}var cU={global:`Global`,session:`Session`,repo:`Repo`,mcp_server:`MCP server`,artifact_feature:`Artifact feature`,executor:`Executor`},lU={global:`blue`,session:`purple`,repo:`default`,mcp_server:`default`,artifact_feature:`default`,executor:`default`},uU=Ot.map(e=>({value:e,label:cU[e]})),dU=({envVars:e,onSave:t,onScopeChange:n,onDelete:r,loading:i={},disabled:a=!1})=>{let[o,s]=(0,U.useState)(``),[c,l]=(0,U.useState)(``),[u,d]=(0,U.useState)(`global`),[f,p]=(0,U.useState)(null),[m,h]=(0,U.useState)(``),[g,_]=(0,U.useState)(null),v=async()=>{if(!(!o.trim()||!c.trim()))try{_(null),await t(o.trim(),c.trim(),u),s(``),l(``),d(`global`)}catch(e){_(e instanceof Error?e.message:`Failed to save environment variable`)}},y=async(e,n)=>{if(m.trim())try{_(null),await t(e,m.trim(),n),p(null),h(``)}catch(e){_(e instanceof Error?e.message:`Failed to update environment variable`)}},b=async(e,t)=>{if(n)try{_(null),await n(e,t)}catch(e){_(e instanceof Error?e.message:`Failed to update scope`)}},x=async e=>{try{_(null),await r(e)}catch(e){_(e instanceof Error?e.message:`Failed to delete environment variable`)}},S=[{title:`Variable Name`,dataIndex:`key`,key:`key`,width:`30%`,ellipsis:!0,render:e=>(0,W.jsx)(`code`,{children:e})},{title:`Scope`,dataIndex:`scope`,key:`scope`,width:140,render:(e,t)=>n?(0,W.jsx)(F,{value:e,size:`small`,style:{width:`100%`,minWidth:0},popupMatchSelectWidth:!1,disabled:a||i[t.key],onChange:e=>b(t.key,e),options:uU}):(0,W.jsx)(Zn,{color:lU[e],children:cU[e]})},{title:`Value`,dataIndex:`isSet`,key:`value`,render:(e,t)=>f===t.key?(0,W.jsxs)(z.Compact,{style:{width:`100%`},children:[(0,W.jsx)(L.Password,{placeholder:`Enter new value`,value:m,onChange:e=>h(e.target.value),onPressEnter:()=>y(t.key,t.scope),autoFocus:!0,disabled:a,style:{flex:1,minWidth:180}}),(0,W.jsx)(V,{type:`primary`,onClick:()=>y(t.key,t.scope),loading:i[t.key],disabled:a||!m.trim(),children:`Save`}),(0,W.jsx)(V,{onClick:()=>p(null),disabled:a,children:`Cancel`})]}):(0,W.jsxs)(z,{children:[(0,W.jsx)(Zn,{color:e?`success`:`default`,children:e?`Set (encrypted)`:`Not Set`}),e&&(0,W.jsx)(V,{type:`link`,size:`small`,onClick:()=>{p(t.key),h(``)},disabled:a,children:`Update`})]})},{title:`Actions`,key:`actions`,width:72,align:`center`,render:(e,t)=>(0,W.jsx)(M,{title:`Delete`,children:(0,W.jsx)(V,{danger:!0,type:`text`,size:`small`,icon:(0,W.jsx)(te,{}),onClick:()=>x(t.key),loading:i[t.key],disabled:a,"aria-label":`Delete ${t.key}`})})}],C=Object.entries(e).map(([e,t])=>{let n=sU(t);return{key:e,isSet:n.set,scope:n.scope}});return(0,W.jsxs)(z,{orientation:`vertical`,size:`middle`,style:{width:`100%`},children:[(0,W.jsxs)(oU,{type:`secondary`,children:[`Environment variables are encrypted at rest. `,(0,W.jsx)(`b`,{children:`Global`}),` vars are exported to every session you own. `,(0,W.jsx)(`b`,{children:`Session`}),` vars are only exported to sessions where you explicitly select them (configure per-session under Session → Settings → Env vars).`]}),g&&(0,W.jsx)(`div`,{style:{color:`#ff4d4f`,padding:`8px`,borderRadius:`4px`,background:`#fff1f0`},children:(0,W.jsx)(oU,{type:`danger`,children:g})}),(0,W.jsx)(E,{columns:S,dataSource:C,pagination:!1,size:`small`,locale:{emptyText:`No environment variables configured`},style:{width:`100%`}}),(0,W.jsxs)(z,{orientation:`vertical`,size:`small`,style:{width:`100%`},children:[(0,W.jsx)(oU,{strong:!0,children:`Add New Variable`}),(0,W.jsxs)(z.Compact,{style:{width:`100%`},children:[(0,W.jsx)(L,{placeholder:`Variable name (e.g., GITHUB_TOKEN)`,value:o,onChange:e=>s(e.target.value),onPressEnter:v,style:{width:`30%`},disabled:a}),(0,W.jsx)(F,{value:u,onChange:d,style:{width:140},disabled:a,options:uU}),(0,W.jsx)(L.Password,{placeholder:`Value`,value:c,onChange:e=>l(e.target.value),onPressEnter:v,style:{flex:1},disabled:a}),(0,W.jsx)(V,{type:`primary`,icon:(0,W.jsx)(fe,{}),onClick:v,disabled:a||!o.trim()||!c.trim(),children:`Add`})]})]})]})},{Text:fU,Paragraph:pU}=o,mU=({user:e,form:t})=>{let{showError:n,showWarning:r,showInfo:i}=dn(),[o,s]=(0,U.useState)(!1),[c,l]=(0,U.useState)(null),[u,d]=(0,U.useState)(!1),f=e?.preferences?.audio||ZH;(0,U.useEffect)(()=>{eU().then(l)},[]);let p=async()=>{let e=t.getFieldValue(`chime`),r=t.getFieldValue(`volume`);s(!0),d(!1);try{await rU(e,r),l(!1)}catch{l(!0),d(!0),n(`Audio blocked by browser. See instructions below to enable.`)}finally{setTimeout(()=>s(!1),2e3)}};return(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`div`,{style:{marginBottom:16},children:[(0,W.jsxs)(fU,{strong:!0,style:{fontSize:16},children:[(0,W.jsx)(ze,{}),` Task Completion Chimes`]}),(0,W.jsx)(pU,{type:`secondary`,style:{marginTop:8,marginBottom:0},children:`Play a sound when agent tasks finish executing. Perfect for long-running tasks!`})]}),u&&c&&(0,W.jsx)(k,{type:`warning`,showIcon:!0,icon:(0,W.jsx)(S,{}),title:`Browser Audio Permissions Required`,description:(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`p`,{style:{marginBottom:8},children:`Your browser is blocking audio playback. To enable chimes:`}),(0,W.jsxs)(`ol`,{style:{marginLeft:16,marginBottom:8},children:[(0,W.jsxs)(`li`,{children:[`Click the `,(0,W.jsx)(`strong`,{children:`lock icon`}),` (🔒) or `,(0,W.jsx)(`strong`,{children:`site info icon`}),` in your browser's address bar`]}),(0,W.jsxs)(`li`,{children:[`Find `,(0,W.jsx)(`strong`,{children:`"Sound"`}),` or `,(0,W.jsx)(`strong`,{children:`"Autoplay"`}),` permissions`]}),(0,W.jsxs)(`li`,{children:[`Change the setting to `,(0,W.jsx)(`strong`,{children:`"Allow"`})]}),(0,W.jsx)(`li`,{children:`Refresh the page and click the Preview button again`})]}),(0,W.jsxs)(`p`,{style:{marginBottom:0,fontSize:`0.9em`,opacity:.8},children:[(0,W.jsx)(`strong`,{children:`Chrome/Edge:`}),` Click lock icon → Site settings → Sound → Allow`,(0,W.jsx)(`br`,{}),(0,W.jsx)(`strong`,{children:`Firefox:`}),` Click lock icon → Permissions → Autoplay → Allow Audio and Video`,(0,W.jsx)(`br`,{}),(0,W.jsx)(`strong`,{children:`Safari:`}),` Safari → Settings for this Website → Auto-Play → Allow All Auto-Play`]})]}),closable:!0,onClose:()=>d(!1),style:{marginBottom:16}}),(0,W.jsxs)(B,{form:t,layout:`vertical`,initialValues:{enabled:f.enabled,chime:f.chime,volume:f.volume,minDurationSeconds:f.minDurationSeconds},children:[(0,W.jsxs)(ge,{gutter:16,children:[(0,W.jsx)(ut,{span:12,children:(0,W.jsx)(B.Item,{name:`enabled`,label:`Enable Chimes`,valuePropName:`checked`,children:(0,W.jsx)(ve,{onChange:async e=>{if(e){let e=await eU();l(e),e?(d(!0),r(`Audio may be blocked. Click Preview to test and grant permissions.`)):i(`Audio notifications enabled. Use the preview button to test.`)}else d(!1)}})})}),(0,W.jsx)(ut,{span:12,children:(0,W.jsx)(B.Item,{noStyle:!0,shouldUpdate:(e,t)=>e.enabled!==t.enabled,children:()=>(0,W.jsx)(B.Item,{name:`volume`,label:`Volume`,children:(0,W.jsx)(Le,{min:0,max:1,step:.1,marks:{0:`0%`,.5:`50%`,1:`100%`},disabled:!t.getFieldValue(`enabled`),tooltip:{formatter:e=>`${Math.round((e||0)*100)}%`}})})})})]}),(0,W.jsxs)(ge,{gutter:16,children:[(0,W.jsx)(ut,{span:12,children:(0,W.jsx)(B.Item,{noStyle:!0,shouldUpdate:(e,t)=>e.enabled!==t.enabled,children:()=>{let e=t.getFieldValue(`enabled`);return(0,W.jsx)(B.Item,{label:`Chime Sound`,tooltip:`Choose your preferred notification sound`,children:(0,W.jsxs)(z.Compact,{style:{width:`100%`},children:[(0,W.jsx)(B.Item,{name:`chime`,noStyle:!0,children:(0,W.jsx)(F,{style:{flex:1},disabled:!e,options:aU().map(e=>({label:iU(e),value:e})).sort((e,t)=>e.label.localeCompare(t.label))})}),(0,W.jsx)(V,{icon:(0,W.jsx)(a,{}),onClick:p,disabled:!e||o,loading:o,children:`Preview`})]})})}})}),(0,W.jsx)(ut,{span:12,children:(0,W.jsx)(B.Item,{noStyle:!0,shouldUpdate:(e,t)=>e.enabled!==t.enabled,children:()=>(0,W.jsx)(B.Item,{label:`Minimum Task Duration`,tooltip:`Only play chime for tasks that take longer than this. Set to 0 to always play.`,children:(0,W.jsxs)(z.Compact,{style:{width:`100%`},children:[(0,W.jsx)(B.Item,{name:`minDurationSeconds`,noStyle:!0,children:(0,W.jsx)($e,{min:0,max:300,step:1,style:{width:`100%`},disabled:!t.getFieldValue(`enabled`)})}),(0,W.jsx)(L,{value:`seconds`,disabled:!0,style:{width:80,textAlign:`center`,pointerEvents:`none`}})]})})})})]})]}),(0,W.jsx)(Ne,{type:`inner`,size:`small`,style:{marginTop:16},children:(0,W.jsxs)(fU,{type:`secondary`,children:[(0,W.jsx)(`strong`,{children:`Note:`}),` Chimes will only play for tasks that complete naturally (finished or failed), not for tasks you manually stop. Make sure your browser allows audio playback - click the Preview button to test!`]})})]})},hU=({client:e})=>{let[t,n]=(0,U.useState)([]),[r,i]=(0,U.useState)(!1),[a,s]=(0,U.useState)(!1),[c,l]=(0,U.useState)(``),[u,d]=(0,U.useState)(!1),[f,p]=(0,U.useState)(null),[m,h]=(0,U.useState)(null),[g,_]=(0,U.useState)(``),{token:v}=I.useToken(),{showSuccess:y,showError:b}=dn(),x=(0,U.useCallback)(async()=>{if(e){i(!0);try{n(await e.service(`api/v1/user/api-keys`).findAll({}))}catch(e){console.error(`Failed to fetch API keys:`,e)}finally{i(!1)}}},[e]);(0,U.useEffect)(()=>{x()},[x]);let S=async()=>{if(!(!e||!c.trim())){s(!0);try{p((await e.service(`api/v1/user/api-keys`).create({name:c.trim()})).rawKey),l(``),await x()}catch(e){b(e?.message||`Failed to create API key`)}finally{s(!1)}}},C=async t=>{if(e){h(t);try{await e.service(`api/v1/user/api-keys`).remove(t),y(`API key revoked`),await x()}catch(e){b(e?.message||`Failed to delete API key`)}finally{h(null)}}},w=async e=>{await on(e)?y(`Copied to clipboard`):b(`Failed to copy to clipboard`)},T=[{title:`Name`,dataIndex:`name`,key:`name`,render:e=>(0,W.jsx)(No,{text:e,query:g})},{title:`Key`,dataIndex:`prefix`,key:`prefix`,render:e=>(0,W.jsxs)(o.Text,{code:!0,style:{fontSize:12},children:[(0,W.jsx)(No,{text:e,query:g}),`...`]})},{title:`Created`,dataIndex:`created_at`,key:`created_at`,render:e=>new Date(e).toLocaleDateString()},{title:`Last Used`,dataIndex:`last_used_at`,key:`last_used_at`,render:e=>e?new Date(e).toLocaleDateString():`Never`},{title:``,key:`actions`,width:80,render:(e,t)=>(0,W.jsx)(A,{title:`Revoke this API key?`,description:`Any applications using this key will lose access.`,onConfirm:()=>C(t.id),okText:`Revoke`,okType:`danger`,children:(0,W.jsx)(V,{type:`text`,danger:!0,size:`small`,icon:(0,W.jsx)(te,{}),loading:m===t.id})})}],D=(0,U.useMemo)(()=>Ao(t,g,[e=>e.name,e=>e.prefix,e=>e.id,e=>e.created_at,e=>e.last_used_at]),[t,g]);return(0,W.jsxs)(`div`,{children:[(0,W.jsx)(o.Paragraph,{type:`secondary`,style:{marginBottom:16},children:`Agor API tokens allow you to authenticate with the Agor API from scripts, CI pipelines, and external tools. Tokens have the same permissions as your user account.`}),(0,W.jsxs)(z,{style:{marginBottom:16,display:`flex`,justifyContent:`space-between`},children:[(0,W.jsx)(L,{allowClear:!0,placeholder:`Search name, prefix, or dates`,value:g,onChange:e=>_(e.target.value),style:{width:300}}),(0,W.jsx)(V,{type:`primary`,icon:(0,W.jsx)(fe,{}),onClick:()=>d(!0),children:`Create New Key`})]}),(0,W.jsx)(E,{dataSource:D,columns:T,rowKey:`id`,loading:r,pagination:!1,size:`small`,locale:{emptyText:`No API keys yet`}}),(0,W.jsxs)(nt,{title:`Create API Key`,open:u&&!f,onOk:S,onCancel:()=>{d(!1),l(``)},okText:`Create`,okButtonProps:{disabled:!c.trim(),loading:a},children:[(0,W.jsx)(o.Paragraph,{type:`secondary`,children:`Give your key a descriptive name so you can identify it later.`}),(0,W.jsx)(L,{placeholder:`e.g., CI Pipeline, Local Development`,value:c,onChange:e=>l(e.target.value),onPressEnter:S,maxLength:100,autoFocus:!0})]}),(0,W.jsxs)(nt,{title:(0,W.jsxs)(z,{children:[(0,W.jsx)(_e,{}),`API Key Created`]}),open:!!f,onOk:()=>{p(null),d(!1)},onCancel:()=>{p(null),d(!1)},okText:`Done`,cancelButtonProps:{style:{display:`none`}},children:[(0,W.jsx)(k,{type:`warning`,showIcon:!0,title:`Copy your API key now`,description:`This is the only time the full key will be shown. Store it securely.`,style:{marginBottom:16}}),(0,W.jsx)(L.TextArea,{value:f||``,readOnly:!0,autoSize:{minRows:2},style:{fontFamily:`monospace`,fontSize:13,marginBottom:8,background:v.colorBgContainer}}),(0,W.jsx)(V,{icon:(0,W.jsx)(We,{}),onClick:()=>f&&w(f),block:!0,children:`Copy to Clipboard`})]})]})},{Sider:gU,Content:_U}=we,vU=[`claude-code`,`claude-code-cli`,`codex`,`gemini`,`opencode`,`copilot`,`cursor`],yU=e=>vU.includes(e),bU=({open:e,onClose:t,user:n,mcpServerById:r,client:i,currentUser:a,onUpdate:s,onRestartOnboarding:c})=>{let[l]=B.useForm(),[u,d]=(0,U.useState)(`general`),f=bt(a?.role,Nt.ADMIN),[p]=B.useForm(),[h]=B.useForm(),[g]=B.useForm(),[_]=B.useForm(),[y]=B.useForm(),[b]=B.useForm(),[x]=B.useForm(),[S]=B.useForm(),C=(0,U.useMemo)(()=>({"claude-code":p,"claude-code-cli":h,codex:g,gemini:_,opencode:y,copilot:b,cursor:x}),[h,p,g,b,x,_,y]),[w,T]=(0,U.useState)({"claude-code":{},"claude-code-cli":{},codex:{},gemini:{},opencode:{},copilot:{},cursor:{}}),[E,D]=(0,U.useState)({}),[O,j]=(0,U.useState)({}),[M,N]=(0,U.useState)({}),[P,ee]=(0,U.useState)([]),[te,ne]=(0,U.useState)([]),[re,ie]=(0,U.useState)(!1),[ae,oe]=(0,U.useState)(!1),se=(0,U.useMemo)(()=>[...P].sort((e,t)=>e.name.localeCompare(t.name)).map(tB),[P]),[ce,le]=(0,U.useState)({"claude-code":!1,"claude-code-cli":!1,codex:!1,gemini:!1,opencode:!1,copilot:!1,cursor:!1}),[ue,de]=(0,U.useState)(()=>new Set),[fe,me]=(0,U.useState)({}),he=(0,U.useCallback)(e=>{de(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),n})},[]),ge=(0,U.useCallback)(e=>{d(`general`),de(new Set),me({}),l.setFieldsValue({email:e.email,name:e.name,emoji:e.emoji,role:e.role,unix_username:e.unix_username,groupIds:[],eventStreamEnabled:e.preferences?.eventStream?.enabled??!0,must_change_password:e.must_change_password??!1})},[l]),_e=(0,U.useCallback)(async()=>{if(!i||!n||!f){ee([]),ne([]),oe(!1),l.setFieldValue(`groupIds`,[]);return}ie(!0),oe(!1);try{let[e,t]=await Promise.all([i.service(`groups`).findAll({query:{archived:!1}}),i.service(`group-memberships`).findAll({query:{user_id:n.user_id}})]),r=t.map(e=>e.group_id);ee(e),ne(r),oe(!0),l.setFieldValue(`groupIds`,r)}catch(e){console.error(`Failed to load user groups:`,e)}finally{ie(!1)}},[i,l,f,n]);(0,U.useEffect)(()=>{e&&n&&(ge(n),_e())},[e,n,ge,_e]),(0,U.useEffect)(()=>{if(!(!e||!n)){if(yU(u)){C[u].setFieldsValue(fe[u]??uV(u,n.default_agentic_config?.[u]));return}if(u===`audio`){let e=n.preferences?.audio;S.setFieldsValue({enabled:e?.enabled??ZH.enabled,chime:e?.chime??ZH.chime,volume:e?.volume??ZH.volume,minDurationSeconds:e?.minDurationSeconds??ZH.minDurationSeconds})}}},[u,fe,S,C,e,n]),(0,U.useEffect)(()=>{if(!e)return;let t={"claude-code":{},"claude-code-cli":{},codex:{},gemini:{},opencode:{},copilot:{},cursor:{}},r=n?.agentic_tools;if(r)for(let e of Object.keys(t)){let n=r[e];n&&(t[e]={...n})}T(t),n?.env_vars?j(n.env_vars):j({})},[e,n]);let ye=()=>{l.resetFields(),ee([]),ne([]),oe(!1),de(new Set),me({}),d(`general`),t()},be=async e=>{!i||!n||!f||!ae||(await GH(i,n.user_id,te,e),ne(e))},xe=e=>[...new Set([...ue,...e?[e]:[]])],Se=async e=>{if(!n||e.length===0)return;let t={...n.default_agentic_config??{}};for(let n of e)t[n]=dV(n,fe[n]??C[n].getFieldsValue());await s?.(n.user_id,{default_agentic_config:t}),de(t=>{if(t.size===0)return t;let n=new Set(t);for(let t of e)n.delete(t);return n}),me(t=>{let n={...t};for(let t of e)delete n[t];return n})},Ce=async()=>{await Se(xe())},Te=async()=>{if(n)try{await l.validateFields([`email`,`name`,`emoji`,`role`,`unix_username`]);let e=l.getFieldsValue(),t={email:e.email,name:e.name,emoji:e.emoji,role:e.role,unix_username:e.unix_username,preferences:{...n.preferences,eventStream:{enabled:e.eventStreamEnabled??!0}}};e.password?.trim()&&(t.password=e.password),bt(a?.role,Nt.ADMIN)&&n.user_id!==a?.user_id&&(t.must_change_password=e.must_change_password),await s?.(n.user_id,t),await be(e.groupIds||[]),await Ce(),ye()}catch(e){console.error(`Validation failed:`,e)}},Ee=async(e,t,r)=>{if(!n)return;let i=`${e}.${t}`;try{D(e=>({...e,[i]:!0})),await s?.(n.user_id,{agentic_tools:{[e]:{[t]:r}}}),T(n=>({...n,[e]:{...n[e]??{},[t]:!0}}))}catch(n){throw console.error(`Failed to save ${e}.${t}:`,n),n}finally{D(e=>({...e,[i]:!1}))}},De=async(e,t)=>{if(!n)return;let r=`${e}.${t}`;try{D(e=>({...e,[r]:!0})),await s?.(n.user_id,{agentic_tools:{[e]:{[t]:null}}}),T(n=>{let r={...n[e]??{}};return delete r[t],{...n,[e]:r}})}catch(n){throw console.error(`Failed to clear ${e}.${t}:`,n),n}finally{D(e=>({...e,[r]:!1}))}},Oe=async(e,t,r)=>{if(n)try{N(t=>({...t,[e]:!0})),await s?.(n.user_id,{env_vars:{[e]:t},env_var_scopes:{[e]:r}}),j(t=>({...t,[e]:{set:!0,scope:r,resource_id:null}}))}catch(t){throw console.error(`Failed to save ${e}:`,t),t}finally{N(t=>({...t,[e]:!1}))}},ke=async(e,t)=>{if(n)try{N(t=>({...t,[e]:!0})),await s?.(n.user_id,{env_var_scopes:{[e]:t}}),j(n=>({...n,[e]:{...n[e]??{set:!0},set:!0,scope:t,resource_id:null}}))}catch(t){throw console.error(`Failed to update scope for ${e}:`,t),t}finally{N(t=>({...t,[e]:!1}))}},Ae=async e=>{if(n)try{N(t=>({...t,[e]:!0})),await s?.(n.user_id,{env_vars:{[e]:null}}),j(t=>{let n={...t};return delete n[e],n})}catch(t){throw console.error(`Failed to delete ${e}:`,t),t}finally{N(t=>({...t,[e]:!1}))}},je=async e=>{if(!n)return;let t=xe(e);try{le(e=>{let n={...e};for(let e of t)n[e]=!0;return n}),await Se(t),ye()}catch(t){throw console.error(`Failed to save ${e} config:`,t),t}finally{le(e=>{let n={...e};for(let e of t)n[e]=!1;return n})}},Ne=e=>{let t=mV(e);C[e].setFieldsValue(t),me(n=>({...n,[e]:t})),he(e)},R=async()=>{if(!(!n||!s))try{let e=S.getFieldsValue(),t={...n.preferences,audio:{enabled:e.enabled,chime:e.chime,volume:e.volume,minDurationSeconds:e.minDurationSeconds}};await s(n.user_id,{preferences:t}),await Ce(),ye()}catch(e){console.error(`Failed to save audio settings:`,e)}},Fe=async()=>{if(n)switch(u){case`general`:Te();break;case`env-vars`:case`personal-api-keys`:await Ce(),ye();break;case`groups`:await be(l.getFieldValue(`groupIds`)||[]),await Ce(),ye();break;case`audio`:await R();break;case`claude-code`:case`claude-code-cli`:case`codex`:case`gemini`:case`opencode`:case`copilot`:case`cursor`:await je(u);break}},{token:Ie}=I.useToken(),Le=[{key:`profile`,label:`Profile`,type:`group`,children:[{key:`general`,label:`General`,icon:(0,W.jsx)(Me,{})},{key:`env-vars`,label:`Env Vars`,icon:(0,W.jsx)(ct,{})},{key:`audio`,label:`Audio`,icon:(0,W.jsx)(ze,{})},...f?[{key:`groups`,label:`Groups`,icon:(0,W.jsx)(Pe,{})}]:[],{key:`personal-api-keys`,label:`Agor API Tokens`,icon:(0,W.jsx)(pt,{})}]},{key:`agentic-tools`,label:`Agentic Tools`,type:`group`,children:[{key:`claude-code`,label:`Claude Code`,icon:(0,W.jsx)(m,{})},{key:`codex`,label:`Codex`,icon:(0,W.jsx)(m,{})},{key:`gemini`,label:`Gemini`,icon:(0,W.jsx)(m,{})},{key:`opencode`,label:`OpenCode`,icon:(0,W.jsx)(m,{})},{key:`cursor`,label:`Cursor SDK`,icon:(0,W.jsx)(m,{})},{key:`copilot`,label:`GitHub Copilot`,icon:(0,W.jsx)(m,{})}]}];return(0,W.jsxs)(nt,{title:null,open:e,onCancel:ye,footer:(0,W.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:8,padding:`12px 24px`,background:Ie.colorBgContainer},children:[(0,W.jsx)(V,{onClick:ye,children:`Close`}),(0,W.jsx)(V,{type:`primary`,onClick:Fe,loading:u in ce?ce[u]:!1,children:`Save`})]}),closable:!0,width:`min(1050px, calc(100vw - 32px))`,style:{top:40},styles:{wrapper:{padding:0,overflow:`hidden`},container:{padding:0,borderRadius:8,overflow:`hidden`},header:{display:`none`},body:{padding:0,height:`calc(100vh - 280px)`,minHeight:450,maxHeight:650},footer:{padding:0,margin:0,background:Ie.colorBgContainer,borderTop:`1px solid ${Ie.colorBorderSecondary}`}},closeIcon:(0,W.jsx)(tt,{}),children:[(0,W.jsxs)(`div`,{hidden:!0,"aria-hidden":`true`,children:[u!==`audio`&&(0,W.jsx)(B,{component:!1,form:S}),vU.map(e=>u===e?null:(0,W.jsx)(B,{component:!1,form:C[e]},e))]}),(0,W.jsxs)(we,{style:{height:`100%`,background:Ie.colorBgContainer},children:[(0,W.jsxs)(gU,{width:200,style:{background:Ie.colorBgElevated,borderRight:`1px solid ${Ie.colorBorderSecondary}`,overflow:`auto`,padding:`20px 0`},children:[(0,W.jsx)(`div`,{style:{padding:`0 24px 16px`,fontWeight:600,fontSize:18,color:Ie.colorText},children:`User Settings`}),(0,W.jsx)(pe,{mode:`inline`,selectedKeys:[u],onClick:({key:e})=>d(e),items:Le,style:{border:`none`,background:`transparent`}})]}),(0,W.jsxs)(_U,{style:{padding:`24px 32px`,overflow:`auto`},children:[(0,W.jsx)(o.Title,{level:4,style:{marginTop:0,marginBottom:20},children:{general:`General`,"env-vars":`Environment Variables`,audio:`Audio`,groups:`Groups`,"personal-api-keys":`Agor API Tokens`,"claude-code":`Claude Code`,codex:`Codex`,gemini:`Gemini`,opencode:`OpenCode`,cursor:`Cursor SDK`,copilot:`GitHub Copilot`}[u]||`User Settings`}),(()=>{switch(u){case`general`:return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(B,{form:l,layout:`vertical`,children:[(0,W.jsx)(B.Item,{label:`Name`,style:{marginBottom:24},children:(0,W.jsxs)(Ve,{gap:8,children:[(0,W.jsx)(B.Item,{name:`emoji`,noStyle:!0,children:(0,W.jsx)(ai,{form:l,fieldName:`emoji`,defaultEmoji:`👤`})}),(0,W.jsx)(B.Item,{name:`name`,noStyle:!0,style:{flex:1},children:(0,W.jsx)(L,{placeholder:`John Doe`,style:{flex:1}})})]})}),(0,W.jsx)(B.Item,{label:`Email`,name:`email`,rules:[{required:!0,message:`Please enter an email`},{type:`email`,message:`Please enter a valid email`}],children:(0,W.jsx)(L,{placeholder:`user@example.com`})}),(0,W.jsx)(B.Item,{label:`Unix Username`,name:`unix_username`,help:bt(a?.role,Nt.ADMIN)?`Unix user for process impersonation (alphanumeric, hyphens, underscores only)`:`Maintained by administrators`,rules:[{pattern:/^[a-z0-9_-]+$/,message:`Only lowercase letters, numbers, hyphens, and underscores allowed`},{max:32,message:`Unix username must be 32 characters or less`}],children:(0,W.jsx)(L,{placeholder:`johnsmith`,maxLength:32,disabled:!bt(a?.role,Nt.ADMIN)})}),(0,W.jsx)(B.Item,{label:`Password`,name:`password`,help:`Leave blank to keep current password`,children:(0,W.jsx)(L.Password,{placeholder:`••••••••`})}),(0,W.jsx)(B.Item,{label:(0,W.jsxs)(z,{size:4,children:[`Enable Live Event Stream`,(0,W.jsx)(v,{color:Ie.colorPrimary,style:{fontSize:10,marginLeft:4},children:`BETA`})]}),name:`eventStreamEnabled`,valuePropName:`checked`,tooltip:`Show/hide the event stream icon in the navbar. When enabled, you can view live WebSocket events for debugging.`,children:(0,W.jsx)(ve,{})}),(0,W.jsx)(B.Item,{label:`Role`,name:`role`,rules:[{required:!0,message:`Please select a role`}],help:bt(a?.role,Nt.ADMIN)?void 0:`Maintained by administrators`,children:(0,W.jsx)(F,{disabled:!bt(a?.role,Nt.ADMIN),options:xn.map(e=>({value:e.value,label:e.label,title:e.description}))})}),f&&(0,W.jsx)(B.Item,{label:`Groups`,name:`groupIds`,help:`Group memberships affect group-aware branch permissions.`,children:(0,W.jsx)(F,{mode:`multiple`,loading:re,disabled:!ae&&!re,placeholder:`Select groups...`,options:se,...nB})}),bt(a?.role,Nt.ADMIN)&&n&&n.user_id!==a?.user_id&&(0,W.jsx)(B.Item,{name:`must_change_password`,valuePropName:`checked`,children:(0,W.jsx)(gt,{children:`Force password change on next login`})})]}),c&&n?.user_id===a?.user_id&&(0,W.jsxs)(`div`,{style:{marginTop:24,paddingTop:20,borderTop:`1px solid ${Ie.colorBorderSecondary}`},children:[(0,W.jsx)(o.Title,{level:5,style:{marginTop:0},children:`Onboarding`}),(0,W.jsx)(o.Paragraph,{type:`secondary`,children:`Reopen the assistant setup wizard from the beginning. Existing repos, boards, branches, and credentials stay in place.`}),(0,W.jsx)(A,{title:`Restart onboarding?`,description:`This clears saved wizard progress and opens onboarding again.`,okText:`Restart`,cancelText:`Cancel`,onConfirm:c,children:(0,W.jsx)(V,{children:`Restart onboarding`})})]})]});case`env-vars`:return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(o.Paragraph,{type:`secondary`,style:{marginBottom:16},children:`Environment variables are encrypted at rest and available to all sessions for this user.`}),(0,W.jsx)(k,{type:`info`,showIcon:!0,style:{marginBottom:16},title:`Looking for SDK credentials?`,description:(0,W.jsxs)(`span`,{children:[`API keys and SDK config (Anthropic, OpenAI, Gemini, Copilot) live under each tool's screen in the `,(0,W.jsx)(`strong`,{children:`Agentic Tools`}),` section. Per-tool config takes precedence over global env vars and is scoped so credentials never leak across SDKs.`]})}),(0,W.jsx)(dU,{envVars:O,onSave:Oe,onScopeChange:ke,onDelete:Ae,loading:M})]});case`audio`:return(0,W.jsx)(mU,{user:n,form:S});case`groups`:return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(o.Paragraph,{type:`secondary`,style:{marginBottom:16},children:`Add or remove this user from admin-managed groups.`}),(0,W.jsx)(B,{form:l,layout:`vertical`,children:(0,W.jsx)(B.Item,{label:`Groups`,name:`groupIds`,help:`Group memberships affect group-aware branch permissions.`,children:(0,W.jsx)(F,{mode:`multiple`,loading:re,disabled:!ae&&!re,placeholder:`Select groups...`,options:se,...nB})})})]});case`personal-api-keys`:return(0,W.jsx)(hU,{client:i});case`claude-code`:case`claude-code-cli`:case`codex`:case`gemini`:case`opencode`:case`copilot`:case`cursor`:{let e=u,t=C[e],i={"claude-code":`Claude Code`,"claude-code-cli":`Claude Code CLI`,codex:`Codex`,gemini:`Gemini`,opencode:`OpenCode`,copilot:`Copilot`,cursor:`Cursor SDK`},a=KV[e]??[],s=w[e]??{},c=Object.fromEntries(a.map(t=>[t.field,!!E[`${e}.${t.field}`]])),l=(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(o.Paragraph,{type:`secondary`,style:{marginBottom:16},children:[`Configure default settings for `,i[e],`. These will prepopulate session creation forms.`]}),(0,W.jsx)(B,{form:t,layout:`vertical`,onValuesChange:(t,n)=>{me(t=>({...t,[e]:n})),he(e)},children:(0,W.jsx)(lV,{agenticTool:e,mcpServerById:r,showHelpText:!1})},e),(0,W.jsx)(`div`,{style:{marginTop:16},children:(0,W.jsx)(V,{onClick:()=>Ne(e),children:`Clear Defaults`})})]});return a.length===0?l:(0,W.jsx)(mt,{defaultActiveKey:`auth`,items:[{key:`auth`,label:`Authentication`,children:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(o.Paragraph,{type:`secondary`,style:{marginBottom:16},children:[`Per-user credentials and config for `,i[e],`. Encrypted at rest; injected into the agent runtime, not the prompt transcript; and preferred over daemon globals and env vars.`]}),(0,W.jsx)(qV,{tool:e,fieldStatus:s,onSave:(t,n)=>Ee(e,t,n),onClear:t=>De(e,t),saving:c,publicValues:n?.agentic_tools_public_values?.[e]})]})},{key:`defaults`,label:`Defaults`,children:l}]})}default:return null}})()]})]})]})},xU=({userById:e,mcpServerById:t,client:n,currentUser:r,onCreate:i,onUpdate:a,onDelete:s})=>{let{showError:c}=dn(),[l,u]=(0,U.useState)(!1),[d,f]=(0,U.useState)(null),[p,m]=(0,U.useState)([]),[h,g]=(0,U.useState)([]),[_,y]=(0,U.useState)(``),[b]=B.useForm(),x=bt(r?.role,Nt.ADMIN),S=(0,U.useCallback)(async()=>{if(!n||!x){m([]),g([]);return}let[e,t]=await Promise.all([n.service(`groups`).findAll({query:{archived:!1}}),n.service(`group-memberships`).findAll({})]);m(e),g(t)},[n,x]);(0,U.useEffect)(()=>{S().catch(e=>c(`Failed to load user groups: ${e instanceof Error?e.message:String(e)}`))},[S,c]);let C=(0,U.useMemo)(()=>{let e=new Map;for(let t of h){let n=e.get(t.user_id)||[];n.push(t.group_id),e.set(t.user_id,n)}return e},[h]),w=(0,U.useMemo)(()=>new Map(p.map(e=>[e.group_id,e])),[p]),T=(0,U.useMemo)(()=>Ao(Eo(e,(e,t)=>e.email.localeCompare(t.email,void 0,{sensitivity:`base`})),_,[e=>e.email,e=>e.name,e=>e.unix_username,e=>e.role,e=>(C.get(e.user_id)||[]).map(e=>w.get(e)).filter(e=>!!e).flatMap(e=>[e.name,e.slug])]),[e,_,C,w]),D=e=>{s?.(e)},O=()=>{b.validateFields().then(e=>{i?.({email:e.email,password:e.password,name:e.name,emoji:e.emoji||`👤`,role:e.role||Nt.MEMBER,unix_username:e.unix_username,must_change_password:e.must_change_password||!1}),b.resetFields(),u(!1)}).catch(()=>{})},k=e=>{switch(e){case`superadmin`:return`purple`;case`admin`:return`red`;case`member`:return`blue`;case`viewer`:return`default`;default:return`default`}};return(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`div`,{style:{marginBottom:16,display:`flex`,justifyContent:`space-between`,alignItems:`center`},children:[(0,W.jsx)(o.Text,{type:`secondary`,children:`Manage user accounts and permissions.`}),(0,W.jsxs)(z,{children:[(0,W.jsx)(L,{allowClear:!0,placeholder:`Search name, email, username, role, or groups`,value:_,onChange:e=>y(e.target.value),style:{width:320}}),(0,W.jsx)(V,{type:`primary`,icon:(0,W.jsx)(fe,{}),onClick:()=>u(!0),children:`New User`})]})]}),(0,W.jsx)(E,{dataSource:T,columns:[{title:`User`,dataIndex:`email`,key:`email`,render:(e,t)=>(0,W.jsxs)(z,{children:[(0,W.jsx)(`span`,{style:{fontSize:20},children:t.emoji||`👤`}),(0,W.jsx)(`span`,{children:(0,W.jsx)(No,{text:e,query:_})})]})},{title:`Name`,dataIndex:`name`,key:`name`,render:e=>(0,W.jsx)(o.Text,{children:e?(0,W.jsx)(No,{text:e,query:_}):`—`})},{title:`Role`,dataIndex:`role`,key:`role`,width:120,render:e=>(0,W.jsx)(v,{color:k(e),children:e.toUpperCase()})},{title:`Groups`,key:`groups`,width:280,render:(e,t)=>{let n=C.get(t.user_id)||[];return n.length===0?(0,W.jsx)(o.Text,{type:`secondary`,children:`—`}):(0,W.jsx)(z,{size:[4,4],wrap:!0,children:n.map(e=>w.get(e)).filter(e=>!!e).sort((e,t)=>e.name.localeCompare(t.name)).map(e=>(0,W.jsx)(v,{children:(0,W.jsx)(No,{text:e.name,query:_})},e.group_id))})}},{title:`Actions`,key:`actions`,width:120,render:(e,t)=>(0,W.jsxs)(z,{size:`small`,children:[(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(N,{}),onClick:()=>f(t)}),(0,W.jsx)(A,{title:`Delete user?`,description:`Are you sure you want to delete user "${t.email}"?`,onConfirm:()=>D(t.user_id),okText:`Delete`,cancelText:`Cancel`,okButtonProps:{danger:!0},children:(0,W.jsx)(V,{type:`text`,size:`small`,icon:(0,W.jsx)(te,{}),danger:!0})})]})}],rowKey:`user_id`,pagination:!1,size:`small`}),(0,W.jsx)(nt,{title:`Create User`,open:l,onOk:O,onCancel:()=>{b.resetFields(),u(!1)},okText:`Create`,width:800,children:(0,W.jsxs)(B,{form:b,layout:`vertical`,style:{marginTop:16},children:[(0,W.jsx)(B.Item,{label:`Name`,style:{marginBottom:24},children:(0,W.jsxs)(Ve,{gap:8,children:[(0,W.jsx)(B.Item,{name:`emoji`,initialValue:`👤`,noStyle:!0,children:(0,W.jsx)(ai,{form:b,fieldName:`emoji`,defaultEmoji:`👤`})}),(0,W.jsx)(B.Item,{name:`name`,noStyle:!0,style:{flex:1},children:(0,W.jsx)(L,{placeholder:`John Doe`,style:{flex:1}})})]})}),(0,W.jsx)(B.Item,{label:`Email`,name:`email`,rules:[{required:!0,message:`Please enter an email`},{type:`email`,message:`Please enter a valid email`}],children:(0,W.jsx)(L,{placeholder:`user@example.com`})}),(0,W.jsx)(B.Item,{label:`Unix Username`,name:`unix_username`,help:`Optional. Unix user for process impersonation (alphanumeric, hyphens, underscores only)`,rules:[{pattern:/^[a-z0-9_-]+$/,message:`Only lowercase letters, numbers, hyphens, and underscores allowed`},{max:32,message:`Unix username must be 32 characters or less`}],children:(0,W.jsx)(L,{placeholder:`johnsmith`,maxLength:32})}),(0,W.jsx)(B.Item,{label:`Password`,name:`password`,rules:[{required:!0,message:`Please enter a password`},{min:8,message:`Password must be at least 8 characters`}],children:(0,W.jsx)(L.Password,{placeholder:`••••••••`})}),(0,W.jsx)(B.Item,{label:`Role`,name:`role`,initialValue:Nt.MEMBER,rules:[{required:!0,message:`Please select a role`}],children:(0,W.jsx)(F,{options:xn.map(e=>({value:e.value,label:e.label,title:e.description}))})}),(0,W.jsx)(B.Item,{name:`must_change_password`,valuePropName:`checked`,initialValue:!1,children:(0,W.jsx)(gt,{children:`Force password change on first login`})})]})}),(0,W.jsx)(bU,{open:!!d,onClose:()=>{f(null),S()},user:d,mcpServerById:t,client:n,currentUser:r,onUpdate:a})]})},{Sider:SU,Content:CU}=we,wU=({open:e,onClose:t,client:n,currentUser:r,boardById:i,boardObjects:a,repoById:o,branchById:s,sessionsByBranch:c,userById:l,mcpServerById:u,cardById:d=new Map,cardTypeById:p=new Map,activeTab:h=`boards`,onTabChange:_,onCreateBoard:v,onUpdateBoard:y,onDeleteBoard:b,onArchiveBoard:x,onUnarchiveBoard:C,onCreateRepo:w,onCreateLocalRepo:T,onUpdateRepo:E,onDeleteRepo:D,onArchiveOrDeleteBranch:O,onUnarchiveBranch:k,onUpdateBranch:A,onCreateBranch:j,onStartEnvironment:M,onStopEnvironment:N,onCreateUser:P,onUpdateUser:ee,onDeleteUser:te,onCreateMCPServer:ne,onDeleteMCPServer:re,gatewayChannelById:ie=new Map,onCreateGatewayChannel:ae,onUpdateGatewayChannel:F,onDeleteGatewayChannel:oe,artifactById:se=new Map,onUpdateArtifact:ce,onDeleteArtifact:le,onCreateAssistant:ue,branchStorageConfig:fe})=>{let[me,he]=(0,U.useState)(null),[ge,_e]=(0,U.useState)(null),[ve,ye]=(0,U.useState)([]),[be,xe]=(0,U.useState)(!1),Se=e=>{he(e),_e(o.get(e.repo_id)||null),ye(c.get(e.branch_id)||[]),xe(!0)},Ce=()=>{xe(!1),he(null),_e(null),ye([])},Te=async(e,t)=>{await O?.(e,t),Ce()},{token:Ee}=I.useToken(),De=(0,U.useMemo)(()=>new Set(po),[]),L=lo(`gateway`),Oe=lo(`mcp_servers`),ke=lo(`artifacts`),Ae=lo(`cards`),je=bt(r?.role,Nt.ADMIN),Me=(0,U.useMemo)(()=>[{key:`workspace`,label:`Workspace`,type:`group`,children:[{key:`boards`,label:`Boards`,icon:(0,W.jsx)(f,{})},{key:`repos`,label:`Repositories`,icon:(0,W.jsx)(de,{})},{key:`branches`,label:`Branches`,icon:(0,W.jsx)(dt,{})},{key:`assistants`,label:`Assistants`,icon:(0,W.jsx)(m,{})},...Ae?[{key:`cards`,label:(0,W.jsxs)(`span`,{children:[`Cards`,` `,(0,W.jsx)(`span`,{style:{fontSize:10,fontWeight:600,padding:`0 4px`,borderRadius:3,background:Ee.colorWarningBg,color:Ee.colorWarningText,border:`1px solid ${Ee.colorWarningBorder}`,marginLeft:4},children:`Beta`})]}),icon:(0,W.jsx)(Ie,{})}]:[],...ke?[{key:`artifacts`,label:`Artifacts`,icon:(0,W.jsx)(Qe,{})}]:[]]},{key:`integrations`,label:`Integrations`,type:`group`,children:[{key:`agentic-tools`,label:`Agentic Tools`,icon:(0,W.jsx)(ct,{})},...Oe&&je?[{key:`mcp`,label:`MCP Servers`,icon:(0,W.jsx)(pt,{})}]:[],...L&&je?[{key:`gateway`,label:`Gateway Channels`,icon:(0,W.jsx)(g,{})}]:[]]},{key:`admin`,label:`Admin`,type:`group`,children:[...je?[{key:`groups`,label:`Groups`,icon:(0,W.jsx)(Pe,{})}]:[],{key:`users`,label:`Users`,icon:(0,W.jsx)(Pe,{})}]},{key:`system`,label:`System`,type:`group`,children:[{key:`about`,label:`About`,icon:(0,W.jsx)(S,{})}]}],[L,Oe,ke,Ae,je,Ee]);return(0,W.jsxs)(nt,{title:null,open:e,onCancel:t,footer:null,closable:!0,width:1200,style:{top:40},styles:{wrapper:{padding:0,overflow:`hidden`},container:{padding:0,borderRadius:8,overflow:`hidden`},header:{display:`none`},body:{padding:0,height:`calc(100vh - 200px)`,minHeight:500,maxHeight:800}},closeIcon:(0,W.jsx)(tt,{}),children:[(0,W.jsxs)(we,{style:{height:`100%`,background:Ee.colorBgContainer},children:[(0,W.jsxs)(SU,{width:240,style:{background:Ee.colorBgElevated,borderRight:`1px solid ${Ee.colorBorderSecondary}`,overflow:`auto`,padding:`20px 0`},children:[(0,W.jsx)(`div`,{style:{padding:`0 24px 16px`,fontWeight:600,fontSize:18,color:Ee.colorText},children:`Settings`}),(0,W.jsx)(pe,{mode:`inline`,selectedKeys:[h],onClick:({key:e})=>{De.has(e)&&_?.(e)},items:Me,style:{border:`none`,background:`transparent`}})]}),(0,W.jsx)(CU,{style:{padding:`40px 32px 32px`,overflow:`auto`},children:(()=>{switch(h){case`boards`:return(0,W.jsx)(fH,{client:n,boardById:i,sessionsByBranch:c,branchById:s,onCreate:v,onUpdate:y,onDelete:b,onArchive:x,onUnarchive:C});case`repos`:return(0,W.jsx)(JH,{repoById:o,onCreate:w,onCreateLocal:T,onUpdate:E,onDelete:D});case`branches`:return(0,W.jsx)(SH,{client:n,branchById:s,repoById:o,boardById:i,sessionsByBranch:c,onArchiveOrDelete:O,onUnarchive:k,onCreate:j,onRowClick:Se,onStartEnvironment:M,onStopEnvironment:N,onClose:t,branchStorageConfig:fe});case`assistants`:return(0,W.jsx)(iH,{branchById:s,repoById:o,boardById:i,sessionsByBranch:c,userById:l,onArchiveOrDelete:O,onRowClick:Se,onCreateAssistant:ue,onClose:t});case`cards`:return(0,W.jsx)(kH,{client:n,cardById:d,cardTypeById:p,boardById:i,boardObjects:a});case`artifacts`:return(0,W.jsx)(rH,{artifactById:se,branchById:s,boardById:i,onUpdate:ce,onDelete:le,onClose:t});case`mcp`:return(0,W.jsx)(oc,{mcpServerById:u,client:n,onCreate:ne,onDelete:re});case`agentic-tools`:return(0,W.jsx)(XV,{client:n});case`gateway`:return(0,W.jsx)(VH,{client:n,gatewayChannelById:ie,branchById:s,userById:l,mcpServerById:u,currentUser:r,onCreate:ae,onUpdate:F,onDelete:oe});case`groups`:return(0,W.jsx)(KH,{client:n,currentUser:r,userById:l});case`users`:return(0,W.jsx)(xU,{userById:l,mcpServerById:u,client:n,currentUser:r,onCreate:P,onUpdate:ee,onDelete:te});case`about`:return(0,W.jsx)(UV,{client:n,connected:n?.io?.connected??!1,connectionError:void 0,isAdmin:bt(r?.role,Nt.ADMIN)});default:return null}})()})]}),(0,W.jsx)(BV,{open:be,onClose:Ce,branch:me,repo:ge,sessions:ve,boardById:i,boardObjects:a,mcpServerById:u,client:n,currentUser:r,onUpdateBranch:A,onUpdateRepo:E,onArchiveOrDelete:Te,onOpenSettings:t})]})},TU=new Map,EU=({open:e,user:t,client:n,mcpServerById:r=TU,onClose:i,onUpdateUser:a,onRefreshCurrentUser:o,onRestartOnboarding:s})=>(0,W.jsx)(bU,{open:e,onClose:i,user:t,currentUser:t,mcpServerById:r,client:n,onUpdate:async(e,t)=>{await a(e,t),await o()},onRestartOnboarding:s}),DU=e=>e.startsWith(`/`)?e:`/${e}`;function OU(e,t){return Gt({path:t,end:!0},DU(e))!==null}function kU(e,t){return e.routePaths.some(e=>OU(t,e))}function AU(e){return e}var jU=[`/knowledge`,`/knowledge/:namespaceSlug/*`,`/kb`,`/kb/:namespaceSlug/*`],MU=AU({id:`knowledge`,label:`Knowledge`,routePaths:jU,startsWorkspaceRuntime:!1,usesDeviceRouter:!1,usesSharedUserSettings:!0,branding:Nr(`Knowledge`)}),NU=[`/a/:artifactShortId/fullscreen`],PU=AU({id:`artifact-fullscreen`,label:`Artifact fullscreen`,routePaths:NU,startsWorkspaceRuntime:!1,usesDeviceRouter:!1,usesSharedUserSettings:!0,branding:Nr(`Artifact`)}),FU=AU({id:`demo`,label:`Demo`,routePaths:[`/demo/streamdown`,`/demo/marketing-screenshots`],startsWorkspaceRuntime:!1,usesDeviceRouter:!1,usesSharedUserSettings:!1,branding:Nr(`Demo`)}),IU=AU({id:`workspace`,label:`Workspace`,routePaths:[`/*`],startsWorkspaceRuntime:!0,usesDeviceRouter:!0,usesSharedUserSettings:!1,branding:`dynamic`}),LU=[MU,PU,FU,IU];function RU(e){return LU.find(t=>kU(t,e))??IU}function zU(e){return RU(e).usesDeviceRouter}function BU(e){let t=RU(e),n=t.startsWorkspaceRuntime,[r,i]=(0,U.useState)(n);return(0,U.useEffect)(()=>{n&&i(!0)},[n]),{currentSurface:t,routeRequiresWorkspaceSurface:n,workspaceSurfaceStarted:r,workspaceSurfaceShouldRun:n||r}}function VU(){return typeof window<`u`&&window.innerWidth<768?!0:typeof navigator<`u`?/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent):!1}async function HU(e,t,n,r){let i=new Set(n),a=new Set(r);await Promise.all([...r.filter(e=>!i.has(e)).map(n=>e.service(`sessions/${t}/mcp-servers`).create({mcpServerId:n})),...n.filter(e=>!a.has(e)).map(n=>e.service(`sessions/${t}/mcp-servers`).remove(n))])}var UU={start:{present:`start`,gerund:`Starting`},stop:{present:`stop`,gerund:`Stopping`},nuke:{present:`nuke`,gerund:`Nuking`}},WU=new Set;function GU(e,t,n){let r=null;return()=>(r??=t().then(t=>(WU.add(e),n(t))),r)}var KU=GU(`workspace`,()=>H(()=>import(`./App-DcEY8Ota.js`),__vite__mapDeps([126,1,127,128,129,2,3,4,130,131,132,133,104,105,134,135,136,137,138,139,140,141])),e=>({default:e.App})),qU=GU(`knowledge`,()=>H(()=>import(`./KnowledgePage-B2bzlXfn.js`),__vite__mapDeps([142,1,128,129,2,3,4,130,131,132,133,136,139,104,105])),e=>({default:e.KnowledgePage})),JU=GU(`artifact-fullscreen`,()=>H(()=>import(`./ArtifactFullscreenPage-CfsTEGKd.js`),__vite__mapDeps([143,1,2,3,4,135,129,130,136])),e=>({default:e.ArtifactFullscreenPage})),YU=GU(`mobile`,()=>H(()=>import(`./MobileApp-VgVnsnsN.js`),__vite__mapDeps([144,1,128,129,2,3,4,130,131,132,133,138,127,104,105])),e=>({default:e.MobileApp})),XU=GU(`demo`,()=>H(()=>import(`./StreamdownDemoPage-wzWaqWwr.js`),__vite__mapDeps([145,3,1,4])),e=>({default:e.StreamdownDemoPage})),ZU=(0,U.lazy)(()=>H(()=>import(`./MarketingScreenshotPage-zv5RUCuV.js`).then(e=>({default:e.MarketingScreenshotPage})),__vite__mapDeps([146,1,134,2,3,4,127,128,129,130,131,132,133,104,105,135,136,137,147]))),QU=(0,U.lazy)(KU),$U=(0,U.lazy)(qU),eW=(0,U.lazy)(JU),tW=(0,U.lazy)(YU),nW=(0,U.lazy)(XU),rW={workspace:KU,knowledge:qU,"artifact-fullscreen":JU,demo:XU,mobile:YU};function iW(e,t){return t.startsWith(`/m`)?`mobile`:e}function aW(e){return WU.has(e)?Promise.resolve():rW[e]()}function oW(){let e=fn(),t=qt();return(0,U.useEffect)(()=>{if(!zU(e.pathname))return;let n=()=>{let n=VU(),r=e.pathname.startsWith(`/m`);n&&!r?t(`/m`,{replace:!0}):!n&&r&&t(`/`,{replace:!0})};n();let r,i=()=>{clearTimeout(r),r=setTimeout(n,200)};return window.addEventListener(`resize`,i),()=>{window.removeEventListener(`resize`,i),clearTimeout(r)}},[e.pathname,t]),null}function sW(){let{showSuccess:e,showError:t,showWarning:n,showLoading:r,destroy:i}=dn(),a=qt(),o=fn(),{currentSurface:s,workspaceSurfaceShouldRun:c}=BU(o.pathname);wo(s);let l=s.usesSharedUserSettings,u=iW(s.id,o.pathname),[d,f]=(0,U.useState)(()=>WU.has(u));(0,U.useEffect)(()=>{let e=!1;return WU.has(u)||f(!1),aW(u).catch(()=>{}).finally(()=>{e||f(!0)}),()=>{e=!0}},[u]);let{config:p,instanceConfig:m,onboardingConfig:h,servicesConfig:g,featuresConfig:_,loading:v,error:y}=Ka(),{user:b,authenticated:x,loading:S,error:C,accessToken:w,login:T,logout:E,reAuthenticate:D}=Ga(),{client:O,connected:A,connecting:j,error:M,retryConnection:N}=fa({accessToken:x?w:null}),P=(0,U.useRef)(new Map);(0,U.useEffect)(()=>{if(!O)return;let n=O.service(`branches`),r=n=>{let r=P.current.get(n.branch_id);if(!r)return;let i=n.environment_instance?.last_command;if(!i||i.action!==r.action)return;let a=Date.parse(i.timestamp);if(Number.isFinite(a)&&a+1e3<r.requestedAt)return;let o=UU[r.action];if(i.status===`succeeded`)e(`Environment ${o.present} command executed successfully`,{key:r.key}),P.current.delete(n.branch_id);else if(i.status===`failed`){let e=i.message?`: ${i.message}`:``;t(`Environment ${o.present} command failed${e}`,{key:r.key}),P.current.delete(n.branch_id)}};return n.on(`patched`,r),()=>{n.removeListener(`patched`,r)}},[O,t,e]);let{capturedSha:ee,currentSha:te,outOfSync:ne}=so(O),re=o.pathname.match(/^\/s\/([^/]+)\/?$/)?.[1]??null,{sessionById:ie,sessionsByBranch:ae,boardById:F,boardObjectById:I,boardObjectsByBoardId:oe,commentById:se,cardById:ce,cardTypeById:le,repoById:ue,branchById:de,userById:fe,mcpServerById:pe,gatewayChannelById:me,artifactById:he,sessionMcpServerIds:ge,userAuthenticatedMcpServerIds:_e,initialLoadItems:ve,initialLoadComplete:ye,loadingStage:be,loading:xe,error:Se}=Ma(O,{enabled:c&&!b?.must_change_password,directSessionId:re}),{createSession:Ce,forkSession:we,btwForkSession:Te,spawnSession:Ee,updateSession:De,deleteSession:L}=fo(O),{createBoard:Oe,updateBoard:ke,deleteBoard:Ae,archiveBoard:je,unarchiveBoard:Me}=qa(O),[Ne,R]=(0,U.useState)(null),[Pe,Fe]=(0,U.useState)(!1),[Ie,Le]=(0,U.useState)(!1);(0,U.useEffect)(()=>{o.pathname===`/gateway/github/setup`&&o.search.includes(`installation_id`)&&R(`gateway`)},[o.pathname,o.search]);let[Re,ze]=(0,U.useState)(new Map),[Be,Ve]=(0,U.useState)(!1);(0,U.useEffect)(()=>{!xe&&!Se&&ye&&Ve(!0)},[xe,ye,Se]);let He=Xa({connecting:j,loading:xe,dataError:Se,mustChangePassword:!!b?.must_change_password,initialLoadComplete:ye&&d}),Ue=(0,W.jsx)(Ar,{phase:He===`done`?`fading`:He,connecting:j,loadingStage:be,items:ve}),We=c?Ue:(0,W.jsx)(Ar,{message:`Loading surface…`}),Ge=b?fe.get(b.user_id)||b:null;(0,U.useEffect)(()=>{hr({buildSha:ee,userEmail:Ge?.email??null})},[ee,Ge?.email]);let[Ke,qe]=(0,U.useState)(!1),[Je,Ye]=(0,U.useState)(0);(0,U.useEffect)(()=>{Ge&&Ge.onboarding_completed===!1&&!Ge.must_change_password&&A&&c&&s.startsWorkspaceRuntime&&!xe&&qe(!0)},[Ge,A,c,s.startsWorkspaceRuntime,xe]);let Xe=async e=>{if(qe(!1),Ge){if(B(Ge.user_id,{onboarding_completed:!0,preferences:{...Ge.preferences,mainBoardId:e.boardId||Ge.preferences?.mainBoardId,onboarding:{path:e.path,branchId:e.branchId,boardId:e.boardId}}},{silent:!0}).catch(()=>{}),e.path===`assistant`&&O)try{await O.service(`config`).patch(null,{onboarding:{assistantPending:!1}})}catch{}e.sessionId?a(Mt(e.sessionId)):e.boardId?a(tn(e.boardId,F.get(e.boardId)?.slug)):a(`/`)}};if(v)return(0,W.jsx)(Ar,{message:`Loading…`});if(y&&!p)return(0,W.jsx)(`div`,{style:{height:`100vh`,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`2rem`},children:(0,W.jsx)(k,{type:`warning`,title:`Could not fetch daemon configuration`,description:(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`p`,{children:y.message}),(0,W.jsx)(`p`,{children:`Defaulting to requiring authentication. Start the daemon with:`}),(0,W.jsx)(`p`,{children:(0,W.jsx)(`code`,{children:`cd apps/agor-daemon && pnpm dev`})})]}),showIcon:!0})});let Ze=typeof window<`u`&&!!(localStorage.getItem(`agor-access-token`)||localStorage.getItem(`agor-refresh-token`));if(!S&&!x&&!Ze)return(0,W.jsx)(Hr,{onLogin:T,error:C,externalLaunchLoginRedirectUrl:p?.externalLaunch?.enabled?p.externalLaunch.loginRedirectUrl:void 0});if(Ze&&(!A||!x)&&c&&!Be)return(0,W.jsx)(Ar,{message:`Reconnecting to daemon…`});if(S)return(0,W.jsx)(Ar,{message:`Authenticating…`});if(M)return(0,W.jsx)(`div`,{style:{height:`100vh`,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`2rem`},children:(0,W.jsx)(k,{type:`error`,title:`Failed to connect to Agor daemon`,description:(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`p`,{children:M}),(0,W.jsxs)(`p`,{children:[`Start the daemon with: `,(0,W.jsx)(`code`,{children:`cd apps/agor-daemon && pnpm dev`})]})]}),showIcon:!0})});if(c&&(He!==`done`||!d))return Ue;if(c&&Se&&!b?.must_change_password)return(0,W.jsx)(`div`,{style:{height:`100vh`,display:`flex`,alignItems:`center`,justifyContent:`center`,padding:`2rem`},children:(0,W.jsx)(k,{type:`error`,title:`Failed to load data`,description:Se,showIcon:!0})});let z=async(n,r)=>{try{let r=n.branch_id;if(!r)throw Error(`Branch ID is required to create a session`);let i=await Ce({...n,branch_id:r});if(i){if(n.mcpServerIds&&n.mcpServerIds.length>0)for(let e of n.mcpServerIds)try{await O?.service(`sessions/${i.session_id}/mcp-servers`).create({mcpServerId:e})}catch(t){console.error(`Failed to associate MCP server ${e}:`,t)}return n.envVarNames&&n.envVarNames.length>0&&await It(i.session_id,n.envVarNames),e(`Session created!`),n.initialPrompt?.trim()&&await rt(i.session_id,n.initialPrompt,n.permissionMode),i.session_id}else return t(`Failed to create session`),null}catch(e){return t(`Failed to create session: ${e instanceof Error?e.message:String(e)}`),null}},Qe=(e,t)=>{ze(n=>{let r=new Map(n);return t.trim()?r.set(e,t):r.delete(e),r})},$e=e=>{ze(t=>{let n=new Map(t);return n.delete(e),n})},et=async(n,r)=>{try{let t=await we(n,r);e(`Session forked successfully!`),Qe(t.session_id,r),$e(n)}catch(e){throw t(`Failed to fork session: ${e instanceof Error?e.message:`Failed to fork session`}`),e}},tt=async(n,r)=>{try{let t=await Te(n,r);e(`Side question sent via btw fork`),Qe(t.session_id,r),$e(n)}catch(e){throw t(`Failed to create btw fork: ${e instanceof Error?e.message:`Failed to create btw fork`}`),e}},nt=async(n,r)=>{let i=typeof r==`string`?{prompt:r}:r;try{let t=await Ee(n,i);e(`Subsession session spawned successfully!`),i.prompt?.trim()&&Qe(t.session_id,i.prompt),$e(n)}catch(e){throw t(`Failed to spawn session: ${e instanceof Error?e.message:`Failed to spawn session`}`),e}},rt=async(e,n,r)=>{if(O)try{await O.sessions.prompt(e,n,{permissionMode:r,messageSource:`agor`}),$e(e)}catch(e){t(`Failed to send prompt: ${e instanceof Error?e.message:String(e)}`),console.error(`Prompt error:`,e)}},it=async(n,r)=>{await De(n,r)?e(`Session updated successfully!`):t(`Failed to update session`)},at=async n=>{await L(n)?e(`Session deleted successfully!`):t(`Failed to delete session`)},ot=async n=>{if(O)try{await O.service(`users`).create(n),e(`User created successfully!`)}catch(e){t(`Failed to create user: ${e instanceof Error?e.message:String(e)}`)}},B=async(n,r,i={})=>{if(O)try{await O.service(`users`).patch(n,r),i.silent||e(`User updated successfully!`)}catch(e){throw i.silent||t(`Failed to update user: ${e instanceof Error?e.message:String(e)}`),e}},st=async()=>{if(!Ge)return;let e={...Ge.preferences??{}};delete e.onboarding;try{await B(Ge.user_id,{preferences:e},{silent:!0})}catch(e){t(`Failed to restart onboarding: ${e instanceof Error?e.message:String(e)}`);return}Fe(!1),Ye(e=>e+1),qe(!0)},ct=async n=>{if(O)try{await O.service(`users`).remove(n),e(`User deleted successfully!`)}catch(e){t(`Failed to delete user: ${e instanceof Error?e.message:String(e)}`)}},lt=async(t,n)=>{if(!O)throw Error(`Not connected`);await O.service(`users`).patch(t,{password:n}),e(`Password changed successfully!`),await D()},ut=async t=>{if(t.board_id)return t;let n=await Oe(t);return n&&e(`Board created successfully!`),n},dt=async(t,n)=>{await ke(t,n)&&e(`Board updated successfully!`)},ft=async t=>{await Ae(t)&&e(`Board deleted successfully!`)},V=async t=>{await je(t)&&e(`Board archived successfully!`)},pt=async t=>{await Me(t)&&e(`Board unarchived successfully!`)},mt=async i=>{if(!O){t(`Not connected to daemon — cannot clone repository`);return}let a=`clone-repo-${i.slug}`;r(`Cloning ${i.slug}...`,{key:a});let o=O.service(`repos`),s=!1,c=()=>{o.removeListener(`created`,l),o.removeListener(`patched`,u),O.io.off(`repo:cloneError`,d),clearTimeout(f)},l=t=>{s||t.slug!==i.slug||t.clone_status!==`cloning`&&(s=!0,e(`Cloned ${i.slug}`,{key:a}),c())},u=n=>{if(!(s||n.slug!==i.slug)){if(n.clone_status===`ready`)s=!0,e(`Cloned ${i.slug}`,{key:a}),c();else if(n.clone_status===`failed`){s=!0;let e=n.clone_error,r=e?.category===`auth_failed`?` — configure GITHUB_TOKEN in Settings → API Keys for private repos`:``;t(`Failed to clone ${i.slug}: ${e?.message??`unknown error`}${r}`,{key:a}),c()}}},d=e=>{s||e.slug!==i.slug&&e.url!==i.url||(s=!0,t(`Failed to clone ${i.slug}: ${e.error??`unknown error`}`,{key:a}),c())},f=setTimeout(()=>{s||(s=!0,t(`Clone of ${i.slug} timed out after 2 minutes. Check daemon logs.`,{key:a}),c())},12e4);o.on(`created`,l),o.on(`patched`,u),O.io.on(`repo:cloneError`,d);try{(await O.service(`repos/clone`).create({url:i.url,slug:i.slug,default_branch:i.default_branch}))?.status===`exists`&&!s&&(s=!0,n(`Repository "${i.slug}" is already added`,{key:a}),c())}catch(e){throw s||(s=!0,t(`Failed to clone repository: ${e instanceof Error?e.message:String(e)}`,{key:a}),c()),e}},ht=async n=>{if(!O){t(`Not connected to daemon — cannot add local repository`);return}try{r(`Adding local repository...`,{key:`add-local-repo`}),await O.service(`repos/local`).create({path:n.path,slug:n.slug}),e(`Local repository added successfully!`,{key:`add-local-repo`})}catch(e){throw t(`Failed to add local repository: ${e instanceof Error?e.message:String(e)}`,{key:`add-local-repo`}),e}},gt=async(n,r)=>{if(O)try{await O.service(`repos`).patch(n,r),e(`Repository updated successfully!`)}catch(e){t(`Failed to update repository: ${e instanceof Error?e.message:String(e)}`)}},_t=async(n,r)=>{if(O)try{await O.service(`repos`).remove(n,{query:{cleanup:r}}),e(r?`Repository and files deleted successfully!`:`Repository removed from Agor (files preserved)`)}catch(e){let n=e instanceof Error?e.message:String(e);n.includes(`Partial deletion occurred:`)?t(`⚠️ PARTIAL DELETION: Some files were permanently deleted. ${n}`):n.includes(`No files were deleted`)?t(`Deletion failed, but no files were removed. ${n}`):t(`Failed to delete repository: ${n}`)}},vt=async(n,i)=>{if(!O)throw Error(`Not connected to daemon`);try{let t=i.metadataAction===`archive`?`archived`:`deleted`;r(`${i.metadataAction===`archive`?`Archiving`:`Deleting`} branch...`,{key:`archive-delete`}),await O.service(`branches/${n}/archive-or-delete`).create(i),e(`Branch ${t} successfully!`,{key:`archive-delete`})}catch(e){throw t(`Failed to ${i.metadataAction} branch: ${e instanceof Error?e.message:String(e)}`,{key:`archive-delete`}),e}},yt=async(n,i)=>{if(!O)throw Error(`Not connected to daemon`);try{r(`Unarchiving branch...`,{key:`unarchive`}),await O.service(`branches/${n}/unarchive`).create(i||{}),e(`Branch unarchived successfully!`,{key:`unarchive`})}catch(e){throw t(`Failed to unarchive branch: ${e instanceof Error?e.message:String(e)}`,{key:`unarchive`}),e}},bt=async(n,r,i={})=>{if(O)try{await O.service(`branches`).patch(n,r),i.silent||e(`Branch updated successfully!`)}catch(e){t(`Failed to update branch: ${e instanceof Error?e.message:String(e)}`)}},St=async(e,n)=>{if(!O)return null;try{r(`Creating branch...`,{key:`create-branch`});let t=await O.service(`repos/${e}/branches`).create({name:n.name,ref:n.ref,refType:n.refType,createBranch:n.createBranch,pullLatest:n.pullLatest,sourceBranch:n.sourceBranch,issue_url:n.issue_url,pull_request_url:n.pull_request_url,boardId:n.boardId,custom_context:n.custom_context,notes:n.notes,position:n.position,storage_mode:n.storage_mode,clone_depth:n.clone_depth});return i(`create-branch`),t}catch(e){return t(`Failed to create branch: ${e instanceof Error?e.message:String(e)}`,{key:`create-branch`}),null}},Ct=async n=>{if(!O)return;let i=`start-env-${n}`;try{P.current.set(n,{action:`start`,key:i,requestedAt:Date.now()}),r(`Starting environment...`,{key:i}),await O.service(`branches/${n}/start`).create({}),e(`Environment start requested`,{key:i})}catch(e){P.current.delete(n),t(`Failed to start environment: ${e instanceof Error?e.message:String(e)}`,{key:i})}},wt=async n=>{if(!O)return;let i=`stop-env-${n}`;try{P.current.set(n,{action:`stop`,key:i,requestedAt:Date.now()}),r(`Stopping environment...`,{key:i}),await O.service(`branches/${n}/stop`).create({}),e(`Environment stop requested`,{key:i})}catch(e){P.current.delete(n),t(`Failed to stop environment: ${e instanceof Error?e.message:String(e)}`,{key:i})}},Tt=async n=>{if(!O)return;let i=`nuke-env-${n}`;try{P.current.set(n,{action:`nuke`,key:i,requestedAt:Date.now()}),r(`Nuking environment...`,{key:i}),await O.service(`branches/${n}/nuke`).create({}),e(`Environment nuke requested`,{key:i})}catch(e){P.current.delete(n),t(`Failed to nuke environment: ${e instanceof Error?e.message:String(e)}`,{key:i})}},Et=async n=>{if(O)try{r(`Starting scheduled run...`,{key:`execute-now`}),await O.service(`branches/${n}/execute-schedule-now`).create({}),e(`Scheduled run started!`,{key:`execute-now`})}catch(e){throw t(`Failed to start scheduled run: ${e instanceof Error?e.message:String(e)}`,{key:`execute-now`}),e}},Dt=async n=>{if(O)try{await O.service(`mcp-servers`).create(n),e(`MCP server added successfully!`)}catch(e){t(`Failed to add MCP server: ${e instanceof Error?e.message:String(e)}`)}},Ot=async n=>{if(O)try{await O.service(`mcp-servers`).remove(n),e(`MCP server deleted successfully!`)}catch(e){t(`Failed to delete MCP server: ${e instanceof Error?e.message:String(e)}`)}},kt=async n=>{if(O)try{await O.service(`gateway-channels`).create(n),e(`Gateway channel created!`)}catch(e){t(`Failed to create gateway channel: ${e instanceof Error?e.message:String(e)}`)}},At=async(n,r)=>{if(O)try{await O.service(`gateway-channels`).patch(n,r),e(`Gateway channel updated!`)}catch(e){t(`Failed to update gateway channel: ${e instanceof Error?e.message:String(e)}`)}},Nt=async n=>{if(O)try{await O.service(`gateway-channels`).remove(n),e(`Gateway channel deleted!`)}catch(e){t(`Failed to delete gateway channel: ${e instanceof Error?e.message:String(e)}`)}},Pt=async(n,r)=>{if(O)try{await O.service(`artifacts`).patch(n,r),e(`Artifact updated!`)}catch(e){t(`Failed to update artifact: ${e instanceof Error?e.message:String(e)}`)}},Ft=async n=>{if(O)try{await O.service(`artifacts`).remove(n),e(`Artifact deleted!`)}catch(e){t(`Failed to delete artifact: ${e instanceof Error?e.message:String(e)}`)}},It=async(e,n)=>{if(O)try{await O.service(`sessions/${e}/env-selections`).patch(null,{envVarNames:n})}catch(e){t(`Failed to update session env var selections: ${e instanceof Error?e.message:String(e)}`)}},Lt=async(e,n)=>{if(O)try{await HU(O,e,ge.get(e)||[],n)}catch(e){t(`Failed to update MCP servers: ${e instanceof Error?e.message:String(e)}`)}},Rt=async(e,n)=>{if(O)try{await O.service(`board-comments`).create({board_id:e,created_by:b?.user_id||`unknown`,content:n,content_preview:n.slice(0,200)})}catch(e){t(`Failed to send comment: ${e instanceof Error?e.message:String(e)}`)}},zt=async e=>{if(O)try{let t=se.get(e);await O.service(`board-comments`).patch(e,{resolved:!t?.resolved})}catch(e){t(`Failed to resolve comment: ${e instanceof Error?e.message:String(e)}`)}},Bt=async n=>{if(O)try{await O.service(`board-comments`).remove(n),e(`Comment deleted`)}catch(e){t(`Failed to delete comment: ${e instanceof Error?e.message:String(e)}`)}},Vt=async(e,n)=>{if(O)try{await O.service(`board-comments/${e}/reply`).create({content:n,created_by:b?.user_id||`unknown`})}catch(e){t(`Failed to send reply: ${e instanceof Error?e.message:String(e)}`)}},Ht=async(e,n)=>{if(O)try{await O.service(`board-comments/${e}/toggle-reaction`).create({user_id:b?.user_id||`unknown`,emoji:n})}catch(e){t(`Failed to toggle reaction: ${e instanceof Error?e.message:String(e)}`)}},Ut=xt(Array.from(ue.values()),Array.from(de.values()));Ut.filter(e=>e.type===`managed-branch`),Ut.filter(e=>e.type===`managed`);let Wt=()=>{R(null)},Gt=()=>{Fe(!1)},Kt=()=>{Le(!1)},Jt=(0,W.jsx)($U,{client:O,currentUser:Ge,userById:fe,onUserSettingsClick:()=>Fe(!0),onLogout:E}),Yt=(0,W.jsx)(eW,{client:O,currentUser:Ge,onUserSettingsClick:()=>Fe(!0),onLogout:E}),Xt=(0,W.jsx)(QU,{client:O,user:Ge,connected:A,connecting:j,sessionById:ie,sessionsByBranch:ae,availableAgents:pr,boardById:F,boardObjectById:I,boardObjectsByBoardId:oe,commentById:se,cardById:ce,cardTypeById:le,repoById:ue,branchById:de,userById:fe,mcpServerById:pe,sessionMcpServerIds:ge,userAuthenticatedMcpServerIds:_e,openSettingsTab:Ne,onSettingsClose:Wt,openUserSettings:Pe,onUserSettingsClose:Gt,openNewBranchModal:Ie,onNewBranchModalClose:Kt,suppressLeftPanel:Ke,onCreateSession:z,onForkSession:et,onBtwForkSession:tt,onSpawnSession:nt,onSendPrompt:rt,onUpdateSession:it,onDeleteSession:at,onCreateBoard:ut,onUpdateBoard:dt,onDeleteBoard:ft,onArchiveBoard:V,onUnarchiveBoard:pt,onCreateRepo:mt,onCreateLocalRepo:ht,onUpdateRepo:gt,onDeleteRepo:_t,onArchiveOrDeleteBranch:vt,onUnarchiveBranch:yt,onUpdateBranch:bt,onCreateBranch:St,onStartEnvironment:Ct,onStopEnvironment:wt,onNukeEnvironment:Tt,onExecuteScheduleNow:Et,onCreateUser:ot,onUpdateUser:B,onDeleteUser:ct,onCreateMCPServer:Dt,onDeleteMCPServer:Ot,gatewayChannelById:me,onCreateGatewayChannel:kt,onUpdateGatewayChannel:At,onDeleteGatewayChannel:Nt,artifactById:he,onUpdateArtifact:Pt,onDeleteArtifact:Ft,onUpdateSessionMcpServers:Lt,onUpdateSessionEnvSelections:It,onSendComment:Rt,onReplyComment:Vt,onResolveComment:zt,onToggleReaction:Ht,onDeleteComment:Bt,onLogout:E,onRetryConnection:N,instanceLabel:m?.label,instanceDescription:m?.description,webTerminalEnabled:_?.webTerminal===!0,branchStorageConfig:_?.branchStorage,onRestartOnboarding:st});return(0,W.jsx)(Ri.Provider,{value:g,children:(0,W.jsxs)(Pi,{value:{connected:A,connecting:j,outOfSync:ne,capturedSha:ee,currentSha:te},children:[(0,W.jsx)(Or,{open:!!Ge?.must_change_password,user:Ge,onChangePassword:lt,onLogout:E}),l&&(0,W.jsx)(EU,{open:Pe,onClose:()=>Fe(!1),user:Ge,client:O,mcpServerById:pe,onUpdateUser:B,onRefreshCurrentUser:D,onRestartOnboarding:st}),(0,W.jsx)(wi,{open:Ke,onComplete:Xe,repoById:ue,branchById:de,boardById:F,user:Ge,client:O,onCreateRepo:mt,onCreateLocalRepo:ht,onCreateBranch:St,onCreateSession:z,onUpdateUser:(e,t)=>B(e,t,{silent:!0}),onUpdateBranch:(e,t)=>bt(e,t,{silent:!0}),onCheckAuth:async(e,t)=>{if(!O)return{authenticated:!1,method:`none`};try{return await O.service(`check-auth`).create({tool:e,apiKey:t})}catch{return{authenticated:!1,method:`none`,hint:`Connection check failed.`}}},assistantPending:h?.assistantPending??h?.persistedAgentPending,frameworkRepoUrl:h?.frameworkRepoUrl},`${Ge?.user_id??`__anon__`}:${Je}`),(0,W.jsx)(oW,{}),(0,W.jsx)(U.Suspense,{fallback:We,children:(0,W.jsxs)(ln,{children:[(0,W.jsx)(sn,{path:`/demo/streamdown`,element:(0,W.jsx)(nW,{})}),(0,W.jsx)(sn,{path:`/demo/marketing-screenshots`,element:(0,W.jsx)(ZU,{})}),jU.map(e=>(0,W.jsx)(sn,{path:e,element:Jt},e)),NU.map(e=>(0,W.jsx)(sn,{path:e,element:Yt},e)),(0,W.jsx)(sn,{path:`/m/*`,element:(0,W.jsx)(tW,{client:O,user:b,sessionById:ie,sessionsByBranch:ae,boardById:F,commentById:se,repoById:ue,branchById:de,userById:fe,onSendPrompt:rt,onSendComment:Rt,onReplyComment:Vt,onResolveComment:zt,onToggleReaction:Ht,onDeleteComment:Bt,onLogout:E,promptDrafts:Re,onUpdateDraft:Qe})}),(0,W.jsx)(sn,{path:`/${jt.board}/:boardParam/`,element:Xt}),(0,W.jsx)(sn,{path:`/${jt.session}/:sessionShortId/`,element:Xt}),(0,W.jsx)(sn,{path:`/${jt.branch}/:branchShortId/`,element:Xt}),(0,W.jsx)(sn,{path:`/${jt.artifact}/:artifactShortId/`,element:Xt}),(0,W.jsx)(sn,{path:`/*`,element:Xt})]})})]})})}function cW(){let{getCurrentThemeConfig:e}=Gi(),t=fn().pathname===`/demo/marketing-screenshots`;return(0,W.jsx)(b,{theme:e(),children:(0,W.jsx)(vt,{children:(0,W.jsx)(Er,{variant:`global`,children:(0,W.jsx)(Di,{children:t?(0,W.jsx)(U.Suspense,{fallback:(0,W.jsx)(Ar,{message:`Loading demo fixture…`}),children:(0,W.jsx)(ZU,{})}):(0,W.jsx)(sW,{})})})})})}function lW(){return(0,W.jsx)(en,{basename:`/ui`,children:(0,W.jsx)(Wi,{children:(0,W.jsx)(cW,{})})})}function uW(e){return new Promise((t,n)=>{let r=document.createElement(`textarea`);r.value=e,r.style.position=`fixed`,r.style.left=`-999999px`,r.style.top=`-999999px`,document.body.appendChild(r),r.focus(),r.select();try{let e=document.execCommand(`copy`);document.body.removeChild(r),e?t():n(Error(`execCommand copy failed`))}catch(e){document.body.removeChild(r),n(e)}})}function dW(){navigator.clipboard?.writeText||Object.defineProperty(navigator,"clipboard",{value:{writeText:uW,readText:()=>Promise.reject(Error(`Reading clipboard not supported`))},writable:!1,configurable:!0})}dW(),(0,Yn.createRoot)(document.getElementById(`root`)).render((0,W.jsx)(lW,{}));export{vs as $,Kr as $t,zz as A,Ya as At,jc as B,Li as Bt,aV as C,mo as Ct,VB as D,eo as Dt,ZB as E,io as Et,bL as F,Ki as Ft,Ys as G,ri as Gt,ac as H,Mi as Ht,Kc as I,Gi as It,Ps as J,$r as Jt,Gs as K,ai as Kt,Vc as L,Pi as Lt,Lz as M,Ka as Mt,Fz as N,Xi as Nt,zB as O,Za as Ot,wz as P,ta as Pt,Cs as Q,Wr as Qt,zc as R,Fi as Rt,lV as S,ho as St,sV as T,lo as Tt,nc as U,Ai as Ut,vc as V,ji as Vt,Zs as W,ki as Wt,js as X,Xr as Xt,Ms as Y,Zr as Yt,Ws as Z,Ur as Zt,QV as _,Zo as _t,nU as a,pr as an,Us as at,AV as b,To as bt,TH as c,Zn as cn,Ns as ct,hH as d,Jn as dn,ls as dt,Fr as en,Es as et,uH as f,cs as ft,tH as g,Xo as gt,cH as h,es as ht,$H as i,Er as in,Hs as it,Rz as j,Ja as jt,nB as k,Qa as kt,yH as l,Kn as ln,gs as lt,lH as m,is as mt,wU as n,Mr as nn,Is as nt,qH as o,dr as on,Fs as ot,dH as p,os as pt,Ks as q,ni as qt,bU as r,Nr as rn,ws as rt,EH as s,cr as sn,xs as st,HU as t,jr as tn,Vs as tt,vH as u,qn as un,us as ut,BV as v,$o as vt,iV as w,fo as wt,uV as x,Co as xt,jV as y,No as yt,Pc as z,Ii as zt};
|