pi-web-ui 0.87.1 → 0.87.2

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/CHANGELOG.md CHANGED
@@ -8,6 +8,13 @@
8
8
  每个版本的内容按"实际合入该版本发布的提交"归档(以 `package.json` 的 version 变更提交为准),
9
9
  而不是按提交日期聚类——连续快速发布的 patch 版本以此为准最准确。
10
10
 
11
+ ## [0.87.2] — 2026-09-16
12
+
13
+ ### Fixed
14
+
15
+ - **关机/重启不再永久挂起**(#172)—— `disposeAll()` 卡在僵死会话/PTY/挂起句柄时进程以前永远退不出,第二次 Ctrl+C 还被吞掉。现在关机有 5 秒看门狗兜底(超时强制退出,未完成不等待);关机中再收到信号立即按信号退出(130/143)而不是吞掉;先 `terminate` 全部 WS 半开连接 + `closeAllConnections` 再 `close`,死掉的浏览器页/发不完 body 的半开请求不再拖住退出。回归:`tests/shutdown-test.mjs`(win32 下跨进程 SIGINT 到不了 handler,直接 SKIP;ubuntu CI 正常跑),已进冒烟清单。
16
+ - **没动过的空 shell 不再钉住对话** —— 点开终端 tab 自动建的那个空 shell(一次都没敲过键盘/没跑过命令/agent 没碰过)以前算“还有存活终端”,切对话/✕ 关对话时被拦截或赖在运行列表里。现在 `TerminalManager` 新增 `countBlockingLive()`(只统计存活**且用过**的 PTY:`inputChecked` 成功输入与 `noteAgentActivity` 置位,`runCommand`/ai-bash 天生即用过),pi 与 DSH 两端的对话保留(`displaceActive`/`listed`)、关闭拦截、空闲回收、项目切换回收统一切到该口径;空 shell 切走/✕ 时随对话一起释放(`removeConversation` 里 `killAll`)。回归:`terminal-smoke-test` 新增 pristine/ai-bash 口径断言。
17
+
11
18
  ## [0.87.1] — 2026-09-16
12
19
 
13
20
  ### Added
@@ -914,6 +921,7 @@ when?, children?}`,也收 `topbar` / `settings` 这类简写别名);宿主
914
921
  - 0.29.0(2026-08-23):全局搜索弹窗(Ctrl+K)+ 消息列表惰性窗口化。
915
922
 
916
923
  [Unreleased]: https://github.com/xing-shuyin/pi-web-ui/compare/v0.87.1...main
924
+ [0.87.2]: https://github.com/xing-shuyin/pi-web-ui/releases/tag/v0.87.2
917
925
  [0.87.1]: https://github.com/xing-shuyin/pi-web-ui/releases/tag/v0.87.1
918
926
  [0.87.0]: https://github.com/xing-shuyin/pi-web-ui/releases/tag/v0.87.0
919
927
  [0.86.2]: https://github.com/xing-shuyin/pi-web-ui/releases/tag/v0.86.2
@@ -4649,7 +4649,9 @@ export class ClientSession {
4649
4649
  wizardRunning: conv.wizardRunning,
4650
4650
  streaming: conv.session.isStreaming,
4651
4651
  compacting: conv.session.isCompacting,
4652
- openTerminals: conv.terminals.countLive(),
4652
+ // 只看“用过”的存活终端:没动过的空 shell(点开终端 tab 自动建的
4653
+ // 那个)不保留对话,切走即随对话释放(见 countBlockingLive)。
4654
+ openTerminals: conv.terminals.countBlockingLive(),
4653
4655
  listed: conv.listed,
4654
4656
  promptedSinceActive: conv.promptedSinceActive,
4655
4657
  hasActiveSubagentRun: () => hasActiveSubagentRun({ sessionId: conv.session.sessionFile }),
@@ -5084,7 +5086,8 @@ export class ClientSession {
5084
5086
  reviewing: conv.goal.reviewing,
5085
5087
  wizardRunning: conv.wizardRunning,
5086
5088
  streaming: false,
5087
- openTerminals: conv.terminals.countLive(),
5089
+ // 与 displaceActive 同口径:只看“用过”的存活终端。
5090
+ openTerminals: conv.terminals.countBlockingLive(),
5088
5091
  listed: false,
5089
5092
  promptedSinceActive: false,
5090
5093
  hasActiveSubagentRun: () => hasActiveSubagentRun({ sessionId: conv.session.sessionFile }),
@@ -5155,7 +5158,7 @@ export class ClientSession {
5155
5158
  });
5156
5159
  return;
5157
5160
  }
5158
- if (conv.terminals.countLive() > 0) {
5161
+ if (conv.terminals.countBlockingLive() > 0) {
5159
5162
  this.emit({
5160
5163
  type: "notice",
5161
5164
  level: "warning",
@@ -5164,6 +5167,8 @@ export class ClientSession {
5164
5167
  });
5165
5168
  return;
5166
5169
  }
5170
+ // 没动过的空 shell(点开终端 tab 自动建的那个)不拦截:随对话一起释放
5171
+ // (removeConversation 里 killAll)。
5167
5172
  if (shouldRetainActive({
5168
5173
  reviewing: conv.goal.reviewing,
5169
5174
  wizardRunning: conv.wizardRunning,
@@ -5416,7 +5421,8 @@ export class ClientSession {
5416
5421
  reviewing: conv.goal.reviewing,
5417
5422
  wizardRunning: conv.wizardRunning,
5418
5423
  streaming: false,
5419
- openTerminals: conv.terminals.countLive(),
5424
+ // 与 displaceActive 同口径:只看“用过”的存活终端。
5425
+ openTerminals: conv.terminals.countBlockingLive(),
5420
5426
  listed: false,
5421
5427
  promptedSinceActive: false,
5422
5428
  hasActiveSubagentRun: () => hasActiveSubagentRun({ sessionId: conv.session.sessionFile }),
@@ -399,7 +399,8 @@ export class DshClientSession {
399
399
  continue;
400
400
  if (conv.isStreaming)
401
401
  continue;
402
- if (conv.terminals.list().length > 0)
402
+ // 只看“用过”的存活终端:没动过的空 shell 不阻止空闲回收。
403
+ if (conv.terminals.countBlockingLive() > 0)
403
404
  continue;
404
405
  const idle = now - conv.lastEventAt;
405
406
  const limit = conv.listed ? DshClientSession.CONV_RECLAIM_LISTED_IDLE_MS : DshClientSession.CONV_RECLAIM_IDLE_MS;
@@ -1402,7 +1403,7 @@ export class DshClientSession {
1402
1403
  }
1403
1404
  // 旧对话保留(listed 生命周期简化:不主动移除)。
1404
1405
  const prevModel = this.model;
1405
- active.listed = active.isStreaming || active.terminals.list().length > 0 || active.promptedSinceActive;
1406
+ active.listed = active.isStreaming || active.terminals.countBlockingLive() > 0 || active.promptedSinceActive;
1406
1407
  const conv = this.addConversation(`chat-${randomUUID().slice(0, 12)}`, this.cwd, false, preset);
1407
1408
  this.activeId = conv.id;
1408
1409
  this.model = prevModel;
@@ -1417,7 +1418,8 @@ export class DshClientSession {
1417
1418
  if (!this.convs.has(id) || id === this.activeId)
1418
1419
  return;
1419
1420
  const prev = this.conv;
1420
- prev.listed = prev.isStreaming || prev.terminals.list().length > 0 || prev.promptedSinceActive;
1421
+ // 只看“用过”的存活终端:没动过的空 shell 不钉住 listed(与 pi displaceActive 同口径)。
1422
+ prev.listed = prev.isStreaming || prev.terminals.countBlockingLive() > 0 || prev.promptedSinceActive;
1421
1423
  this.activeId = id;
1422
1424
  // 后台列表可能属于另一项目 → 切会话同时切工作区(与 pi 一致:文件树/
1423
1425
  // 会话历史/最近项目跟着走)。DSH 单 runtime 换 cwd → 异步重启。
@@ -2112,7 +2114,7 @@ export class DshClientSession {
2112
2114
  });
2113
2115
  return;
2114
2116
  }
2115
- if (conv.terminals.list().length > 0 && !force) {
2117
+ if (conv.terminals.countBlockingLive() > 0 && !force) {
2116
2118
  this.emit({
2117
2119
  type: "notice",
2118
2120
  level: "warning",
@@ -2121,6 +2123,7 @@ export class DshClientSession {
2121
2123
  });
2122
2124
  return;
2123
2125
  }
2126
+ // 没动过的空 shell(点开终端 tab 自动建的那个)不拦截:随对话一起释放。
2124
2127
  // force + active:先让出 active(切到其他对话或新建),再移除。
2125
2128
  if (id === this.activeId) {
2126
2129
  const other = [...this.convs.values()].find((c) => c.id !== id);
@@ -2188,7 +2191,8 @@ export class DshClientSession {
2188
2191
  }
2189
2192
  }
2190
2193
  const prev = this.conv;
2191
- prev.listed = prev.isStreaming || prev.terminals.list().length > 0 || prev.promptedSinceActive;
2194
+ // 只看“用过”的存活终端:没动过的空 shell 不钉住 listed(与 pi displaceActive 同口径)。
2195
+ prev.listed = prev.isStreaming || prev.terminals.countBlockingLive() > 0 || prev.promptedSinceActive;
2192
2196
  const conv = this.addConversation(sessionId, this.cwd, true);
2193
2197
  conv.fromDisk = true; // 磁盘回放 → prompt 时 fork
2194
2198
  this.activeId = conv.id;
@@ -3855,7 +3859,8 @@ export class DshClientSession {
3855
3859
  })
3856
3860
  .join("\n");
3857
3861
  const prev = this.conv;
3858
- prev.listed = prev.isStreaming || prev.terminals.list().length > 0 || prev.promptedSinceActive;
3862
+ // 只看“用过”的存活终端:没动过的空 shell 不钉住 listed(与 pi displaceActive 同口径)。
3863
+ prev.listed = prev.isStreaming || prev.terminals.countBlockingLive() > 0 || prev.promptedSinceActive;
3859
3864
  this.activeId = fresh.id;
3860
3865
  // 编辑后的提问本身在 prompt 里;历史作为附加上下文(首条 prompt)。
3861
3866
  const headText = contextNote.trim()
@@ -3933,7 +3938,10 @@ export class DshClientSession {
3933
3938
  // (与 pi 的 displaceActive 语义一致);空白的直接弃(不列)。
3934
3939
  const prev = this.conv;
3935
3940
  prev.listed =
3936
- prev.isStreaming || prev.terminals.list().length > 0 || prev.promptedSinceActive || prev.messages.length > 0;
3941
+ prev.isStreaming ||
3942
+ prev.terminals.countBlockingLive() > 0 ||
3943
+ prev.promptedSinceActive ||
3944
+ prev.messages.length > 0;
3937
3945
  // 新项目 → 新会话。
3938
3946
  this.activeId = this.addConversation(`web-${randomUUID().slice(0, 12)}`, abs, false).id;
3939
3947
  // 旧项目非活跃 conversation 回收(pi 的 displaceActive 语义:切走后
@@ -3948,7 +3956,8 @@ export class DshClientSession {
3948
3956
  continue;
3949
3957
  if (c.isStreaming)
3950
3958
  continue;
3951
- if (c.terminals.list().length > 0)
3959
+ // 只看“用过”的存活终端:没动过的空 shell 不阻止项目切换时的旧会话回收。
3960
+ if (c.terminals.countBlockingLive() > 0)
3952
3961
  continue;
3953
3962
  this.removeConversation(id);
3954
3963
  }
@@ -1755,22 +1755,66 @@ if (BOOT_CATALOG_URL) {
1755
1755
  // Local control socket (status / quiesce / unquiesce) — same data dir the
1756
1756
  // CLI uses, so `pi-web-ui server status|quiesce|unquiesce` just works.
1757
1757
  const stopControl = startControlServer({ service, dataDir: DATA_DIR, port: PORT });
1758
+ /**
1759
+ * Graceful shutdown budget (issue #172): disposeAll() can hang forever on a
1760
+ * stuck session runtime / PTY / pending handle, and the process would then
1761
+ * sit forever with no way out. The watchdog guarantees the process is gone
1762
+ * within this long no matter what — unref'd so a clean shutdown never
1763
+ * waits on it.
1764
+ */
1765
+ const SHUTDOWN_FORCE_EXIT_MS = 5000;
1758
1766
  let shuttingDown = false;
1759
- async function shutdown() {
1760
- if (shuttingDown)
1761
- return;
1767
+ /**
1768
+ * SIGINT / SIGTERM handler. A second signal while a shutdown is already
1769
+ * running exits immediately (130 = killed by SIGINT, 143 = SIGTERM) instead
1770
+ * of being swallowed by the shuttingDown guard — previously a hung first
1771
+ * shutdown made Ctrl+C look completely dead (issue #172).
1772
+ */
1773
+ async function shutdown(signal = "SIGINT") {
1774
+ if (shuttingDown) {
1775
+ console.log("\n再次收到中断信号,强制退出…");
1776
+ process.exit(signal === "SIGTERM" ? 143 : 130);
1777
+ }
1762
1778
  shuttingDown = true;
1763
1779
  console.log("\nshutting down…");
1764
- clearInterval(heartbeatTimer);
1765
- stopControl();
1766
- pluginMgr.dispose();
1767
- pluginInstaller.dispose();
1768
- mcpHotReload.dispose();
1769
- mcpBridge.dispose();
1770
- await service.disposeAll();
1771
- wss.close();
1772
- httpServer.close();
1773
- process.exit(0);
1780
+ const forceExitTimer = setTimeout(() => {
1781
+ console.error("shutdown 超时仍未完成,强制退出…");
1782
+ process.exit(1);
1783
+ }, SHUTDOWN_FORCE_EXIT_MS);
1784
+ forceExitTimer.unref();
1785
+ let code = 0;
1786
+ try {
1787
+ clearInterval(heartbeatTimer);
1788
+ stopControl();
1789
+ pluginMgr.dispose();
1790
+ pluginInstaller.dispose();
1791
+ mcpHotReload.dispose();
1792
+ mcpBridge.dispose();
1793
+ await service.disposeAll();
1794
+ // Don't let dead browsers hold the exit open: half-open WebSocket /
1795
+ // keep-alive HTTP connections (e.g. test clients killed without
1796
+ // closing) would otherwise keep close() from ever finishing — drop
1797
+ // them first so shutdown stays prompt.
1798
+ for (const ws of wss.clients) {
1799
+ try {
1800
+ ws.terminate();
1801
+ }
1802
+ catch {
1803
+ /* already gone */
1804
+ }
1805
+ }
1806
+ wss.close();
1807
+ httpServer.closeAllConnections();
1808
+ httpServer.close();
1809
+ }
1810
+ catch (err) {
1811
+ code = 1;
1812
+ console.error("shutdown 释放资源时出错:", err);
1813
+ }
1814
+ finally {
1815
+ clearTimeout(forceExitTimer);
1816
+ process.exit(code);
1817
+ }
1774
1818
  }
1775
- process.on("SIGINT", () => void shutdown());
1776
- process.on("SIGTERM", () => void shutdown());
1819
+ process.on("SIGINT", () => void shutdown("SIGINT"));
1820
+ process.on("SIGTERM", () => void shutdown("SIGTERM"));
@@ -863,6 +863,10 @@ export class TerminalManager {
863
863
  idleTimer: null,
864
864
  watches: [],
865
865
  agentBash,
866
+ // 有命令的终端(runCommand)与 ai-bash 天生就是“用过”的;裸 shell
867
+ // 从 pristine 开始,第一次输入/agent 触碰时才置位(见 inputChecked /
868
+ // noteAgentActivity)。
869
+ used: agentBash || command !== undefined,
866
870
  locale,
867
871
  };
868
872
  this.terms.set(id, entry);
@@ -901,6 +905,7 @@ export class TerminalManager {
901
905
  if (!entry || entry.exited)
902
906
  return;
903
907
  entry.agentTouched = true;
908
+ entry.used = true;
904
909
  entry.lastActivityAt = Date.now();
905
910
  this.armIdleWatch(entry);
906
911
  }
@@ -1065,6 +1070,21 @@ export class TerminalManager {
1065
1070
  n++;
1066
1071
  return n;
1067
1072
  }
1073
+ /** Count of LIVE terminals that were actually used (typed into / ran a
1074
+ * command / touched by the agent / ai-bash). Pristine shells — e.g. the
1075
+ * one auto-created when the user opens the terminal tab but never types
1076
+ * anything — do NOT count: they hold no foreground work and no shell
1077
+ * state worth protecting, so they neither retain the conversation nor
1078
+ * block its dismissal (they are killed together with the conversation).
1079
+ * Retained-output history never counts either (same as countLive).
1080
+ * 存活且“用过”的终端数——对话保留/关闭拦截只看这个口径。 */
1081
+ countBlockingLive() {
1082
+ let n = 0;
1083
+ for (const entry of this.terms.values())
1084
+ if (!entry.exited && entry.used)
1085
+ n++;
1086
+ return n;
1087
+ }
1068
1088
  emitList() {
1069
1089
  this.emit({ type: "terminal_list", terminals: this.list() });
1070
1090
  }
@@ -1116,10 +1136,13 @@ export class TerminalManager {
1116
1136
  if (!entry || entry.exited)
1117
1137
  return pick(this.lang?.() ?? "en", "终端不存在或进程已退出", "Terminal not found or its process has exited", "terminals.not.found.exited");
1118
1138
  // 已武装的纪元里任何人(含用户手动敲键盘)写了输入都算新活动,重置倒计时。
1139
+ // 成功的输入同时把终端标为“用过”(见 used):动过的 shell 才参与对话保留/
1140
+ // 关闭拦截,没动过的空 shell 不算。
1119
1141
  entry.lastActivityAt = Date.now();
1120
1142
  if (entry.idleTimer)
1121
1143
  this.armIdleWatch(entry);
1122
1144
  entry.pty.write(data);
1145
+ entry.used = true;
1123
1146
  return null;
1124
1147
  }
1125
1148
  key(id, key, modifiers = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-web-ui",
3
- "version": "0.87.1",
3
+ "version": "0.87.2",
4
4
  "description": "Web chat interface for the pi coding agent, powered by the pi SDK (@earendil-works/pi-coding-agent) — one-command run, Docker/systemd/launchd deployable",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -322,7 +322,7 @@ It only opens after you confirm.`,settingsExtensions:"Extensions",settingsUiPlug
322
322
  ${ye.cwd}`,children:[s.jsx(Is,{className:"session-icon"}),s.jsxs("span",{className:"session-info",children:[s.jsxs("span",{className:"session-title",children:[s.jsx("span",{className:"elsewhere-badge",children:g("elsewhereBadge")}),ye.title]}),s.jsx("span",{className:"session-sub",children:Fe(ye.cwd)})]}),ye.isStreaming&&s.jsx("span",{className:"conv-streaming",title:g("streaming")})]})},ye.id);const rt=l===ye.id;return s.jsxs("div",{className:`lp-row${Oe>0?" lp-sub":""}`,style:Oe>0?{marginLeft:Oe*18}:void 0,onMouseLeave:()=>C(Ge=>Ge===`conv:${ye.id}`?null:Ge),onContextMenu:Ge=>Ne(Ge,{id:ye.id,kind:"running",label:ye.title}),children:[s.jsxs("button",{type:"button",className:`session-item ${rt?"active":""}`,title:`${ye.title}${L.isCurrent?"":` — ${L.cwd}`}`,onClick:()=>{rt||u({type:"switch_conversation",id:ye.id})},children:[s.jsx(Is,{className:"session-icon"}),s.jsxs("span",{className:"session-info",children:[Te===`conv:${ye.id}`?s.jsx("input",{autoFocus:!0,className:"session-rename-input",value:G,placeholder:g("renameSessionPlaceholder"),onClick:Ge=>Ge.stopPropagation(),onChange:Ge=>ee(Ge.target.value),onKeyDown:Ge=>{if(Ge.stopPropagation(),Ge.key==="Enter"&&!Ge.nativeEvent.isComposing){const D=G.trim();D&&u({type:"rename_conversation",id:ye.id,name:D}),xe(null)}else Ge.key==="Escape"&&xe(null)},onBlur:()=>xe(null)}):s.jsxs("span",{className:"session-title",children:[ye.isSubagent&&s.jsx("span",{className:"subagent-badge",children:g("subagentBadge")}),ye.agentPreset&&s.jsx("span",{className:"preset-badge",title:ye.agentPreset,children:N?.[ye.agentPreset]??ye.agentPreset}),ye.title,ye.error&&s.jsx("span",{className:"conv-error-badge",title:g("convErrorBadge",{error:ye.error})})]}),Te===`conv:${ye.id}`?null:s.jsx("span",{className:"session-sub",children:rt?g("current"):g("messageCount",{n:ye.messageCount})})]}),ye.isStreaming&&s.jsx("span",{className:"conv-streaming",title:g("streaming")})]}),s.jsx("button",{type:"button",className:"lp-del lp-rename",title:g("renameSession"),onClick:Ge=>{Ge.stopPropagation(),C(null),ee(ye.title),xe(`conv:${ye.id}`)},children:s.jsx(zs,{})}),(()=>{const Ge=`conv:${ye.id}`,D=q===Ge,$e=A(n,ye.id),it=P(n,ye.id),Xe=ue(n,ye.id);return Xe===0&&!ye.isStreaming?Ae(Ge,g("dismissConversation"),g("dismissConversationConfirm"),()=>u({type:"dismiss_conversation",id:ye.id}),s.jsx(bt,{})):Xe===0?Ae(Ge,g("dismissConversation"),g("dismissStreamingConfirm"),()=>u({type:"dismiss_conversation",id:ye.id,force:!0}),s.jsx(bt,{})):D?s.jsxs("span",{className:"lp-del-group",children:[$e>0&&s.jsx("button",{type:"button",className:"lp-del-opt",title:g("dismissFinishedSubagentsScoped",{n:$e}),onClick:U=>{U.stopPropagation(),C(null),u({type:"dismiss_finished_subagents",parentId:ye.id})},children:g("dismissFinishedOnly",{n:$e})}),s.jsx("button",{type:"button",className:"lp-del-opt danger",title:g("forceDismissTitle",{n:Xe,m:it}),onClick:U=>{U.stopPropagation(),C(null),u({type:"dismiss_conversation",id:ye.id,force:!0})},children:g("dismissForceAll",{n:Xe})})]}):s.jsx("button",{type:"button",className:"lp-del",title:g("dismissConversation"),onClick:U=>{U.stopPropagation(),C(Ge)},children:s.jsx(bt,{})})})(),Ee(),ye.isStreaming&&s.jsx("span",{className:"lp-row-stalled",title:g("streaming"),style:{position:"absolute",right:28,top:"50%",transform:"translateY(-50%)"}})]},ye.id)})})()]},L.cwd))})]}),Ie.length>0&&!F&&!se&&s.jsx("div",{className:"lp-sash",onPointerDown:ce("convs","sessions"),onDoubleClick:()=>Ke({...ga}),title:g("dragToResize")}),s.jsxs("div",{className:`lp-section lp-section-sessions panel-sessions ${se?"collapsed":""}`,style:se?void 0:{flex:`${we("sessions")} 1 0px`},children:[et(g("historySessions"),se,z,a.length),!se&&s.jsxs("div",{className:"lp-section-body sessions-scroll",children:[a.length===0&&s.jsx("div",{className:"panel-empty",children:g("noHistory")}),a.map(L=>{const W=R===L.path;return s.jsxs("div",{className:"lp-row",onMouseLeave:()=>C(oe=>oe===`sess:${L.path}`?null:oe),onContextMenu:oe=>Ne(oe,{id:L.path,kind:"history",label:pe(L)}),children:[s.jsxs("button",{type:"button",className:`session-item ${W?"active":""}`,title:L.path,onClick:()=>{Te||W||u({type:"switch_session",path:L.path})},children:[s.jsx(Is,{className:"session-icon"}),s.jsxs("span",{className:"session-info",children:[Te===L.path?s.jsx("input",{autoFocus:!0,className:"session-rename-input",value:G,placeholder:g("renameSessionPlaceholder"),onClick:oe=>oe.stopPropagation(),onChange:oe=>ee(oe.target.value),onKeyDown:oe=>{if(oe.stopPropagation(),oe.key==="Enter"&&!oe.nativeEvent.isComposing){const fe=G.trim();fe&&u({type:"rename_session",path:L.path,name:fe}),xe(null)}else oe.key==="Escape"&&xe(null)},onBlur:()=>xe(null)}):s.jsx("span",{className:"session-title",children:pe(L)}),Te===L.path?null:s.jsxs("span",{className:"session-sub",children:[W?g("current"):g("messageCount",{n:L.messageCount}),L.source==="tui"&&s.jsx("span",{className:"session-src",title:g("tuiTip"),children:"TUI"})]})]}),s.jsx("span",{className:"session-time",children:Wi(L.modified)})]}),s.jsx("button",{type:"button",className:"lp-del lp-rename",title:g("renameSession"),onClick:oe=>{oe.stopPropagation(),C(null),ee(L.name??""),xe(L.path)},children:s.jsx(zs,{})}),Ae(`sess:${L.path}`,g("deleteSession"),g("deleteSessionConfirm"),()=>u({type:"delete_session",path:L.path})),Ee()]},L.path)})]})]})]})});function tm(e,t){const n=t.assistantMessageEvent,r=e.stats.tokens,a=t.usage!==null?{...r,...t.usage}:r,c=a===r?e.stats:{...e.stats,tokens:a};if(n.type!=="text_delta"&&n.type!=="thinking_delta")return c===e.stats?e:{...e,stats:c};const l=n.delta??"";if(!l)return c===e.stats?e:{...e,stats:c};const u=e.streamingMessage??null,d=u&&u.id===t.messageId?u:{id:t.messageId,content:[]},m=[...d.content],f=n.type==="thinking_delta"?"thinking":"text",h=n.contentIndex??m.length-1;return h>=0&&h<m.length&&m[h].type===f?m[h]=f==="thinking"?{type:"thinking",thinking:(m[h].thinking??"")+l}:{type:"text",text:(m[h].text??"")+l}:m.push(f==="thinking"?{type:"thinking",thinking:l}:{type:"text",text:l}),{...e,stats:c,streamingMessage:{...d,id:t.messageId,content:m}}}function sm(e){const{current:t,source:n,snapshot:r,answered:a}=e;return r&&r.id&&!a.has(r.id)?t?.id===r.id?{changed:!1,question:t,source:n}:{changed:!0,question:r,source:"snapshot"}:!r&&t&&n==="snapshot"?{changed:!0,question:null,source:"live"}:{changed:!1,question:t,source:n}}const Gi="__piWebUiHost",nm=9,Ql=e=>new Promise(t=>setTimeout(t,e));async function am(e=3e3){const t=Date.now()+e;for(;;){const n=window.__piBridge;if(n&&typeof n.call=="function")return n;if(Date.now()>=t)return null;await Ql(100)}}function rm(e){const t=Math.max(1,Number(e.pollMs??100)),n=Math.max(t,Number(e.timeoutMs??8e3)),r=async c=>{const l=Date.now()+n;for(;;){if(c())return!0;if(Date.now()>=l)return c();await Ql(t)}},a=async(c,l)=>{const u=String(l.cwd??"").trim();if(u&&e.getCwd()!==u&&(e.send({type:"set_cwd",path:u}),await r(()=>e.getCwd()===u)),l.newChat!==!1){const d=e.getConversationId();e.send({type:"new_chat"}),await r(()=>e.getConversationId()!==d||e.isConversationBlank())}e.send({type:"prompt",text:c})};return{version:nm,setView(c){const l=String(c??"").trim();l&&e.setView(l)},startChat(c){const l=String(c?.prompt??"").trim();return!l||!e.isReady()?!1:(a(l,c??{}).catch(()=>{}),!0)},compose(c){return Ep()?Ol({text:typeof c?.text=="string"?c.text:void 0,attachments:Array.isArray(c?.attachments)?c.attachments:void 0}):!1},async openSession(c){const l=Array.isArray(c?.folders)?c.folders.filter(g=>typeof g=="string"&&g.trim().length>0).map(g=>g.trim()):[],u=Array.isArray(c?.roots)?c.roots.filter(g=>typeof g=="string"&&g.trim().length>0).map(g=>g.trim()):[],d=String(c?.cwd??"").trim(),m=[...new Set([...l,...u])],f=d||m[0]||"";if(!f)return{ok:!1,error:"openSession 需要 cwd / folders / roots(绝对路径)"};if(!e.isReady())return{ok:!1,error:"尚未连接到服务器(还没有快照)"};const h=m.filter(g=>g!==f).slice(0,7),b=new Set([...e.listProjects?.()??[],...e.grantedPaths?.()??[]]);for(const g of[f,...h]){if(b.has(g))continue;if(!(e.confirm?await e.confirm({path:g}).catch(()=>!1):!1))return{ok:!1,error:`用户拒绝了该目录的访问:${g}`};e.grantPath?.(g)}if(e.getCwd()!==f&&(e.send({type:"set_cwd",path:f}),!await r(()=>e.getCwd()===f)))return{ok:!1,error:`切换工作目录失败或超时:${f}`};(h.length>0||e.getWorkspaceRoots().length>0)&&e.send({type:"set_workspace_roots",roots:h});let E=e.getConversationId()??void 0;if(c?.newChat!==!1){const g=E;e.send({type:"new_chat"}),await r(()=>e.getConversationId()!==g||e.isConversationBlank()),E=e.getConversationId()??void 0}const N=String(c?.prompt??"").trim();return N&&e.send({type:"prompt",text:N}),{ok:!0,...E?{sessionId:E}:{}}},sessions:{list:()=>e.listSessions(),async open(c){const l=String(c??"").trim();if(!l)return{ok:!1,error:"sessions.open 需要一个会话 id(先调 list)"};if(!e.isReady())return{ok:!1,error:"尚未连接到服务器(还没有快照)"};const u=e.listSessions().find(f=>f.id===l);if(!u)return{ok:!1,error:`找不到会话:${l}`};if(u.cwd&&u.cwd!==e.getCwd()){if(!new Set([...e.listProjects?.()??[],...e.grantedPaths?.()??[]]).has(u.cwd)){if(!(e.confirm?await e.confirm({path:u.cwd}).catch(()=>!1):!1))return{ok:!1,error:`用户拒绝了该目录的访问:${u.cwd}`};e.grantPath?.(u.cwd)}if(e.send({type:"set_cwd",path:u.cwd}),!await r(()=>e.getCwd()===u.cwd))return{ok:!1,error:`切换工作目录失败或超时:${u.cwd}`}}const d=e.getConversationId();return u.kind==="running"?e.send({type:"switch_conversation",id:u.id}):e.send({type:"switch_session",path:u.id}),await r(()=>e.getConversationId()!==d)?{ok:!0,sessionId:e.getConversationId()??void 0}:{ok:!1,error:`切换会话超时:${u.title}`}}},async reloadCatalog(c,l){const u=String(c??"").trim();if(!u)return{ok:!1,error:"reloadCatalog 需要一个目录来源(http(s) URL 或本地文件路径)"};if(!e.isReady())return{ok:!1,error:"尚未连接到服务器(还没有快照)"};const d=qt();return new Promise(m=>{const f=setTimeout(()=>{xa.delete(d),m({ok:!1,error:"目录同步超时(服务端未在等待窗口内回执)"})},Math.max(1e3,Number(e.catalogTimeoutMs??18e4)));xa.set(d,h=>{clearTimeout(f),m(h)}),e.send({type:"plugin_catalog_sync",requestId:d,source:u,...l?.install?{install:!0}:{},...l?.replace?{replace:!0}:{}})})},onUiAction(c,l){return zi(hn,String(c??"").trim(),l)},onTopbarAction(c,l){return zi(hn,String(c??"").trim(),l)},async pageCall(c){const l=String(c?.op??"").trim();if(!l)return{ok:!1,error:"pageCall 需要一个动作名(op)"};if(Rl())return{ok:!1,error:"桌面版(Electron 外壳)不支持 browser_page:窗口里没有 Chrome 扩展运行时。请让用户改用系统浏览器打开同一个 pi-web-ui 地址(网页版)再试。/ The desktop app cannot run browser_page (no Chrome extension runtime); ask the user to open the same pi-web-ui address in a regular browser instead."};const u=await am(e.bridgeWaitMs??3e3);if(!u)return{ok:!1,error:"浏览器扩展的页面桥没就绪:确认已安装并启用 page-picker 扩展、本页地址已绑定,然后刷新本页"};try{const d=await u.call({op:l,...c.args===void 0?{}:{args:c.args},...c.target?{to:c.target}:{},...c.timeoutMs?{timeoutMs:c.timeoutMs}:{}});return d===void 0?{ok:!0}:{ok:!0,result:d}}catch(d){return{ok:!1,error:d instanceof Error?d.message:String(d)}}},dom:{anchors(){const c=l=>{try{return document.querySelector(`[data-pi-anchor="${l}"]`)}catch{return null}};return{app:c("app"),topbar:c("topbar"),composer:c("composer")}}},dialogs:{async select(c){try{const l=e.select;if(typeof l!="function")return{ok:!1};const u=Array.isArray(c?.options)?c.options:[],d=await l({title:String(c?.title??""),options:u.filter(f=>typeof f=="object"&&f!==null&&typeof f.label=="string").map(f=>({label:String(f.label),...typeof f.description=="string"?{description:f.description}:{}})),...c?.multi?{multi:!0}:{}});return!d||typeof d!="object"||d.ok!==!0?{ok:!1,...d&&typeof d=="object"&&typeof d.error=="string"?{error:d.error}:{}}:{ok:!0,selected:Array.isArray(d.selected)?d.selected.filter(f=>typeof f=="string"):[]}}catch{return{ok:!1}}},async confirm(c){const l=String(c?.title??""),u=typeof c?.detail=="string"?c.detail:"";try{if(typeof e.dialogConfirm=="function")try{return await e.dialogConfirm({title:l,...u?{detail:u}:{}})===!0}catch{}if(typeof window<"u"&&typeof window.confirm=="function")try{return window.confirm(u?`${l}
323
323
 
324
324
  ${u}`:l)}catch{return!1}return!1}catch{return!1}},async input(c){try{const l=e.input;if(typeof l!="function")return{ok:!1};const u=await l({title:String(c?.title??""),...typeof c?.placeholder=="string"?{placeholder:c.placeholder}:{},...typeof c?.initial=="string"?{initial:c.initial}:{}});return!u||typeof u!="object"||u.ok!==!0?{ok:!1}:typeof u.value=="string"?{ok:!0,value:u.value}:{ok:!0}}catch{return{ok:!1}}}},async notifyAction(c){const l=String(c?.text??""),u=(Array.isArray(c?.actions)?c.actions:[]).filter(d=>typeof d=="object"&&d!==null&&typeof d.id=="string"&&typeof d.label=="string");try{if(typeof e.notifyAction=="function"){const d=await e.notifyAction({text:l,actions:u});return typeof d=="string"?d:null}}catch{return null}try{typeof window<"u"&&typeof window.dispatchEvent=="function"&&window.dispatchEvent(new CustomEvent(im,{detail:{text:l}}))}catch{}return null},shortcuts:{register:(c,l)=>dm(String(c??""),l)},searchProviders:{register:c=>pm(c),list:()=>Tr()},composerProviders:{register:c=>mm(c),list:()=>ec()},onTheme:c=>gm(c),onLocale:c=>bm(c),onViewChange:c=>xm(c)}}function Yi(e){try{const t=window;e?t[Gi]=e:delete t[Gi]}catch{}}const Zn=new Map;let hn=null;async function Xl(e,t){const n=hn;hn=e;try{return await t()}finally{hn=n}}function zi(e,t,n){if(!t||typeof n!="function")return()=>{};const r=e?`${e}:${t}`:t;let a=Zn.get(r);a||(a=new Set,Zn.set(r,a));const c=a;return c.add(n),()=>{c.delete(n),c.size===0&&Zn.delete(r)}}async function Jl(e,t,n,r){const a=c=>{const l=Zn.get(c);if(!l||l.size===0)return!1;for(const u of[...l])try{u(n)}catch(d){console.error(`[plugin:${e}] 顶栏动作 ${t} 抛错:`,d)}return!0};if(a(`${e}:${t}`)||a(t))return!0;if(r?.loadBundle&&await r.loadBundle(e).catch(()=>!1)){const l=Date.now()+Math.max(100,Number(r.waitMs??1500));for(;;){if(a(`${e}:${t}`)||a(t))return!0;if(Date.now()>=l)break;await new Promise(u=>setTimeout(u,100))}}return!1}const im="pi-web-ui:toast",fn=new Map;let ba=!1;function om(e){const t=e.split("+").map(d=>d.trim().toLowerCase()).filter(d=>d.length>0);if(t.length===0)return null;let n=!1,r=!1,a=!1,c=!1;for(const d of t.slice(0,-1))if(d==="ctrl"||d==="control")n=!0;else if(d==="shift")r=!0;else if(d==="alt"||d==="option")a=!0;else if(d==="meta"||d==="cmd"||d==="command"||d==="win"||d==="super")c=!0;else return null;const l=t[t.length-1]??"";return!l||["ctrl","control","shift","alt","option","meta","cmd","command","win","super"].includes(l)?null:{combo:`${n?"ctrl+":""}${r?"shift+":""}${a?"alt+":""}${c?"meta+":""}${l}`,key:l,ctrl:n,shift:r,alt:a,meta:c}}function lm(){try{if(typeof document>"u")return!1;const e=document.activeElement;if(!e)return!1;const t=(e.tagName||"").toUpperCase();return!!(t==="INPUT"||t==="TEXTAREA"||t==="SELECT"||e.isContentEditable)}catch{return!1}}function Zl(e){try{if(lm())return;const t=`${e.ctrlKey?"ctrl+":""}${e.shiftKey?"shift+":""}${e.altKey?"alt+":""}${e.metaKey?"meta+":""}${(e.key??"").toLowerCase()}`,n=fn.get(t);if(!n||n.size===0)return;for(const r of[...n])try{r()}catch(a){console.error("[plugin-host] 快捷键处理器抛错:",a)}}catch{}}function cm(){if(!ba)try{if(typeof window>"u"||typeof window.addEventListener!="function")return;window.addEventListener("keydown",Zl),ba=!0}catch{}}function um(){if(!(fn.size>0||!ba))try{window.removeEventListener("keydown",Zl)}catch{}finally{ba=!1}}function dm(e,t){if(typeof t!="function")return()=>{};const n=om(e);if(!n)return()=>{};let r=fn.get(n.combo);r||(r=new Set,fn.set(n.combo,r));const a=r;return a.add(t),cm(),()=>{a.delete(t),a.size===0&&fn.delete(n.combo),um()}}const gn=new Map;function pm(e){const t=String(e?.id??"").trim();if(!t||typeof e?.search!="function")return()=>{};const n={id:t,label:String(e.label??t),search:e.search};return gn.set(t,n),()=>{gn.get(t)===n&&gn.delete(t)}}function Tr(){return[...gn.values()].map(e=>({id:e.id,label:e.label}))}const bn=new Map;function mm(e){const t=String(e?.id??"").trim();if(!t||typeof e?.search!="function")return()=>{};const n={id:t,label:String(e.label??t),search:e.search};return bn.set(t,n),()=>{bn.get(t)===n&&bn.delete(t)}}function ec(){return[...bn.values()].map(e=>({id:e.id,label:e.label}))}function hm(e){return bn.get(String(e??""))}function fm(e){return gn.get(String(e??""))}const kr=new Set,Nr=new Set,vr=new Set;function gm(e){return typeof e!="function"?()=>{}:(kr.add(e),()=>{kr.delete(e)})}function bm(e){return typeof e!="function"?()=>{}:(Nr.add(e),()=>{Nr.delete(e)})}function xm(e){return typeof e!="function"?()=>{}:(vr.add(e),()=>{vr.delete(e)})}function Vi(e){const t=String(e??"");for(const n of[...kr])try{n(t)}catch(r){console.error("[plugin-host] onTheme 处理器抛错:",r)}}function Qi(e){const t=String(e??"");for(const n of[...Nr])try{n(t)}catch(r){console.error("[plugin-host] onLocale 处理器抛错:",r)}}function Xi(e){const t=String(e??"");for(const n of[...vr])try{n(t)}catch(r){console.error("[plugin-host] onViewChange 处理器抛错:",r)}}const xa=new Map;function Em(e){const t=xa.get(e.requestId);if(t){if(xa.delete(e.requestId),!e.ok){t({ok:!1,error:e.error??"目录同步失败"});return}t({ok:!0,...e.entries?{entries:e.entries}:{},...e.installed?{installed:e.installed}:{}})}}const Cr="pi-web-ui:plugin-data";function ym(e,t){window.dispatchEvent(new CustomEvent(Cr,{detail:{pluginId:e,payload:t}}))}function Tm(e){const t=n=>{const r=n.detail;e(r.pluginId,r.payload)};return window.addEventListener(Cr,t),()=>window.removeEventListener(Cr,t)}const Ss=new Map,wr=new Set,_s=new Set;let Ji=-1;function tc(){return[...Ss.values()]}function sc(){const e=tc();for(const t of wr)t(e)}function km(e){return wr.add(e),e(tc()),()=>wr.delete(e)}async function nc(e,t){try{const r=(await Xl(e.id,()=>import(_t(`/plugins/${encodeURIComponent(e.id)}/client/entry.mjs?e=${t}`)))).default;return r&&typeof r.mount=="function"?(Ss.set(e.id,{info:e,module:r}),!0):(_s.add(e.id),console.error(`[plugin:${e.id}] entry.mjs 缺少 default.mount`),!1)}catch(n){return _s.add(e.id),console.error(`[plugin:${e.id}] 客户端加载失败:`,n),!1}}async function Sr(e,t){if(Ss.has(e.id))return!0;if(_s.has(e.id)||!e.hasClient)return!1;const n=await nc(e,t);return sc(),n}async function Nm(e,t){t!==Ji&&(Ji=t,Ss.clear(),_s.clear());const n=new Set(e.map(r=>r.id));for(const r of[...Ss.keys()])n.has(r)||Ss.delete(r);for(const r of[..._s])n.has(r)||_s.delete(r);await Promise.all(e.filter(r=>r.hasClient&&r.view!==!1&&!r.error&&!Ss.has(r.id)&&!_s.has(r.id)).map(r=>nc(r,t))),sc()}function ac(e,t){return{pluginId:e,send:n=>t({type:"plugin_message",pluginId:e,payload:n}),onData:n=>Tm((r,a)=>{r===e&&n(a)})}}const vm=17;function Cm(){return{flows:[],results:{}}}function Zi(e,t){const n=e.findIndex(r=>r.flowId===t.flowId);return n<0?[...e,t]:e.map((r,a)=>a===n?t:r)}function wm(e,t){switch(t.type){case"provider_oauth_started":{const n={...e.results};return delete n[t.provider],{flows:[...e.flows.filter(r=>r.provider!==t.provider),{flowId:t.flowId,provider:t.provider}],results:n}}case"provider_oauth_flows":return{...e,flows:t.flows.map(n=>({...n}))};case"provider_oauth_prompt":{const n=e.flows.find(r=>r.flowId===t.flowId);return{...e,flows:Zi(e.flows,{...n,flowId:t.flowId,provider:t.provider,promptId:t.promptId,prompt:t.prompt})}}case"provider_oauth_event":{const n=e.flows.find(r=>r.flowId===t.flowId);return{...e,flows:Zi(e.flows,{...n,flowId:t.flowId,provider:t.provider,event:t.event,promptId:void 0,prompt:void 0})}}case"provider_oauth_result":return{flows:e.flows.filter(n=>n.flowId!==t.flowId),results:{...e.results,[t.provider]:{ok:t.ok,...t.cancelled===void 0?{}:{cancelled:t.cancelled},...t.error===void 0?{}:{error:t.error}}}};case"provider_oauth_logout_result":return{...e,results:{...e.results,[t.provider]:{ok:t.ok,...t.error===void 0?{}:{error:t.error}}}}}}const Sm="pi-web-ui:lang";function eo(){try{return(localStorage.getItem(Sm)??"").trim()}catch{return""}}const to="pi-web-ui:locale",Ga=2e5,_m=2e5,Am="LIVE_OMIT",jm={conversationId:null,goal:null,reviewModel:null,maxRounds:3,locked:!0,reviewing:!1,round:0,status:"",verdict:"pending",wizard:{active:!1,draft:"",model:null,step:0,maxSteps:6,status:""}};function Im(){const e=new Map,t=new Map,n=(r,a)=>`${r}:${a}`;return{write(r,a,c){const l=n(r,a),u=e.get(l);if(u&&u.size>0){for(const f of u)try{f.write(c)}catch{}return}const d=t.get(l)??"",m=d.length+c.length>_m?c:d+c;t.set(l,m)},register(r,a,c){const l=n(r,a);let u=e.get(l);u||(u=new Set,e.set(l,u)),u.add(c);const d=t.get(l);if(d){try{c.write(d)}catch{}t.delete(l)}return()=>{const m=e.get(l);m&&(m.delete(c),m.size===0&&e.delete(l)),t.delete(l)}},clear(){e.clear(),t.clear()}}}function so(e,t){const n=new Set;for(const a of t.messages)a.role==="toolResult"&&a.toolCallId&&n.add(a.toolCallId),a.role==="bashExecution"&&n.add(`bash-${a.id}`);let r=!1;for(const a of e.keys())n.has(a)&&(e.delete(a),r=!0);return r?new Map(e):e}function no(e,t){if(e.size===0)return e;const n=new Set;for(const a of t.messages)a.role==="toolResult"&&a.toolCallId&&n.add(a.toolCallId);let r=!1;for(const a of e.keys())n.has(a)&&(e.delete(a),r=!0);return r?new Map(e):e}function Rm(e,t){switch(t.type){case"status":return{...e,status:t.status,ready:t.status==="open"?e.ready:!1,terminals:t.status==="closed"?[]:e.terminals};case"ready":return{...e,serverVersion:t.serverVersion,engine:t.engine,appVersion:t.appVersion,managed:t.managed===!0,tabs:t.tabs,ready:!0,protocolMismatch:t.protocolVersion!==void 0&&t.protocolVersion!==vm};case"snapshot":return{...e,ready:!0,state:t.state,activeConversationId:t.state.conversationId,liveOutputs:so(e.liveOutputs,t.state),toolStatuses:no(e.toolStatuses,t.state)};case"snapshot_delta":{const n=e.state,r=t.msg;if(!n||n.conversationId!==r.conversationId||n.rev!==r.baseRev)return e;const a={...n,...r.state,messages:r.appended.length>0?[...n.messages,...r.appended]:n.messages};return{...e,ready:!0,state:a,activeConversationId:a.conversationId,liveOutputs:so(e.liveOutputs,a),toolStatuses:no(e.toolStatuses,a)}}case"tool_delta":{const r=(e.liveOutputs.get(t.toolCallId)?.text??"")+t.delta,a=r.length>Ga?`…[${Am}:${r.length-Ga}]…
325
- `+r.slice(r.length-Ga):r,c=new Map(e.liveOutputs);return c.set(t.toolCallId,{toolName:t.toolName,text:a}),{...e,liveOutputs:c}}case"message_delta":{const n=e.state;return!n||n.conversationId!==t.msg.conversationId?e:{...e,state:tm(n,t.msg)}}case"tool_status":return{...e,toolStatuses:new Map(e.toolStatuses).set(t.status.toolCallId,t.status)};case"notice":return{...e,notices:[...e.notices,t.notice].slice(-6)};case"dismiss_notice":return{...e,notices:e.notices.filter(n=>n.id!==t.id)};case"sessions":return{...e,sessions:t.sessions};case"conversations":return{...e,conversations:t.conversations,elsewhere:t.elsewhere??[],activeConversationId:t.activeId};case"projects":return{...e,projects:t.projects};case"files":return{...e,files:t.files};case"file_changed":return{...e,fileChanged:{path:t.path}};case"file_content":return{...e,fileContent:t.content};case"models":return{...e,models:t.models,modelsLoading:t.loading};case"models_config":return{...e,modelsConfig:t.providers};case"providers_status":return{...e,providers:t.providers};case"provider_keys":return{...e,providerKeys:t.keys};case"provider_oauth":{const n=wm({flows:e.providerOAuthFlows,results:e.providerOAuthResults},t.message);return{...e,providerOAuthFlows:n.flows,providerOAuthResults:n.results}}case"fetch_models_result":return{...e,fetchModelsResult:t.result};case"refresh_provider_result":return{...e,refreshProviderResult:t.result};case"clone_provider_result":return{...e,cloneProviderResult:t.result};case"install_result":return{...e,installResult:t.result};case"scm_data":return{...e,scmData:t.data};case"file_search_result":return{...e,fileSearch:t.result};case"session_search_result":return{...e,sessionSearch:t.result};case"scm_changed":return{...e,scmDirty:e.scmDirty+1};case"path_completions":return{...e,pathCompletions:t.completions};case"update_status":return{...e,update:t.status};case"update_status_all":return{...e,updatesAll:t.items};case"updates_check_started":return{...e,updatesAll:null};case"widgets":return{...e,widgets:t.widgets};case"statuses":return{...e,statuses:t.statuses};case"dialog":return{...e,dialog:t.dialog};case"question":return{...e,question:t.question};case"commands":return{...e,commands:t.commands,commandsPath:t.path};case"slash_commands":return{...e,slashCommands:t.commands};case"goal_status":return{...e,goal:t.status};case"settings":return{...e,settings:t.settings};case"bg_servers":return{...e,bgServers:t.servers};case"plugins":return{...e,plugins:t.plugins,pluginsEpoch:t.epoch};case"plugin_catalog":return{...e,pluginCatalog:t.entries,pluginCatalogEpoch:t.epoch};case"plugin_grants":return{...e,pluginGrants:t.grants};case"plugin_path_request":return{...e,pathRequests:[...e.pathRequests.filter(n=>n.id!==t.req.id),t.req]};case"plugin_path_resolved":return{...e,pathRequests:e.pathRequests.filter(n=>n.id!==t.id)};case"plugin_job":{const n=e.pluginJobs[t.job.jobId],r=t.line?[...n?.lines??[],t.line].slice(-40):n?.lines??[],a={...n,...t.job,lines:r,startedAt:n?.startedAt??Date.now()};return{...e,pluginJobs:{...e.pluginJobs,[t.job.jobId]:a}}}case"plugin_catalog_sync_result":return{...e,catalogSync:{...t.result,receivedAt:Date.now()}};case"dsh_patches":return{...e,dshPatches:{patchDir:t.patchDir,files:t.files}};case"dsh_presets":return{...e,dshPresets:{presets:t.presets,defaultPreset:t.defaultPreset}};case"dsh_permission":return{...e,dshPermission:{options:t.options,defaultPreset:t.defaultPreset}};case"terminal_add":return{...e,terminals:[...e.terminals,t.meta]};case"terminal_remove":return{...e,terminals:e.terminals.filter(n=>n.id!==t.id)};case"terminal_exit":return t.conversationId&&(e.activeConversationId||e.state?.conversationId)&&t.conversationId!==(e.activeConversationId||e.state?.conversationId)?e:{...e,terminals:e.terminals.map(n=>n.id===t.terminalId?{...n,running:!1,exitCode:t.exitCode}:n)};case"terminal_restart":return{...e,terminals:e.terminals.map(n=>n.id===t.terminalId?{...n,running:!0,exitCode:null}:n)};case"terminal_list":return t.conversationId&&(e.activeConversationId||e.state?.conversationId)&&t.conversationId!==(e.activeConversationId||e.state?.conversationId)?e:{...e,terminals:t.terminals.map(n=>({...n,conversationId:t.conversationId??e.state?.conversationId??""}))};case"terminal_active":return{...e,terminalActiveId:t.id};default:return e}}const ao="pi-web-client-id";let Ya=null;function Ea(){if(Ya)return Ya;let e=null;try{e=sessionStorage.getItem(ao),e||(e=qt(),sessionStorage.setItem(ao,e))}catch{e=e??qt()}return Ya=e,e}const rc="pi-web-last-cwd";function Pm(){try{return localStorage.getItem(rc)}catch{return null}}function Lm(e){try{localStorage.setItem(rc,e)}catch{}}function Dm(){const e=location.protocol==="https:"?"wss:":"ws:";return hs(`${e}//${location.host}${_t("/ws")}`)}function Om(){const[e,t]=o.useReducer(Rm,{status:"connecting",ready:!1,state:null,liveOutputs:new Map,toolStatuses:new Map,notices:[],sessions:[],conversations:[],elsewhere:[],activeConversationId:"",projects:[],files:null,fileChanged:null,fileContent:null,models:[],modelsLoading:!1,modelsConfig:[],providers:[],providerKeys:{},providerOAuthFlows:[],providerOAuthResults:Cm().results,installResult:null,pathCompletions:[],update:null,updatesAll:null,widgets:[],statuses:[],dialog:null,question:null,commands:[],commandsPath:"",slashCommands:[],terminals:[],terminalActiveId:null,goal:jm,bgServers:[],settings:null,fetchModelsResult:null,refreshProviderResult:null,cloneProviderResult:null,scmData:null,fileSearch:null,sessionSearch:null,scmDirty:0,plugins:[],pluginsEpoch:0,pluginCatalog:[],pluginCatalogEpoch:0,pluginJobs:{},catalogSync:null,pluginGrants:[],pathRequests:[],dshPatches:null,dshPresets:null,dshPermission:null,protocolMismatch:!1}),n=o.useRef(null),r=o.useRef(Im()),a=o.useRef(0),c=o.useRef(null),l=o.useRef(!0),u=o.useRef(0),d=o.useRef(0),m=o.useRef(new Map),f=o.useRef(null),h=o.useRef(!1),b=o.useRef(null),E=o.useRef(new Set),N=o.useRef("live"),g=()=>{f.current||(f.current=setTimeout(()=>{f.current=null;const O=n.current;O&&O.readyState===WebSocket.OPEN&&O.send(JSON.stringify({type:"get_state"}))},300))},R=(O,F)=>{const w=m.current,se=w.get(O);if(se!==void 0&&F!==se+1){const z=Q.current.chat,A=z.activeConversationId||z.state?.conversationId;O===A&&g()}w.set(O,F)},M=o.useCallback((O,F)=>{const w=++d.current;t({type:"notice",notice:{id:w,level:O,text:F}})},[]),B=o.useCallback(O=>{const F=n.current;if(F&&F.readyState===WebSocket.OPEN){if(O.type==="check_updates_all"&&O.force===!0&&t({type:"updates_check_started"}),F.send(JSON.stringify(O)),O.type==="question_answer"){if(E.current.add(O.id),E.current.size>64){const w=E.current.values().next().value;w!==void 0&&E.current.delete(w)}N.current="live",t({type:"question",question:null})}return!0}return!1},[]),j=o.useCallback(O=>{const F=sm({current:Q.current.chat.question,source:N.current,snapshot:O,answered:E.current});F.changed&&(N.current=F.source,t({type:"question",question:F.question}))},[]);qp(B);const Y=o.useCallback(()=>{if(!l.current)return;t({type:"status",status:"connecting"});const O=new WebSocket(Dm());n.current=O,O.onopen=()=>{n.current===O&&(t({type:"status",status:"open"}),a.current=0,u.current=Date.now(),O.send(JSON.stringify({type:"hello",clientId:Ea(),locale:eo()})))},O.onmessage=F=>{if(n.current!==O)return;u.current=Date.now();let w;try{w=JSON.parse(F.data)}catch{return}switch(w.type){case"ready":{const se="20260916T02415";if((Q.current.chat.settings?.autoReload??!0)&&w.buildId&&se&&w.buildId!==se){const A=`pi-web-ui-reloaded-${w.buildId}`;if(!sessionStorage.getItem(A)){sessionStorage.setItem(A,"1"),location.reload();return}}$i({engine:w.engine??"pi",managed:!!w.managed,tabs:w.tabs,appVersion:w.appVersion,serverVersion:w.serverVersion,service:w.service}),t({type:"ready",serverVersion:w.serverVersion,protocolVersion:w.protocolVersion,engine:w.engine,appVersion:w.appVersion,managed:w.managed,tabs:w.tabs,service:w.service}),O.send(JSON.stringify({type:"get_state"})),O.send(JSON.stringify({type:"list_files"})),O.send(JSON.stringify({type:"list_models"})),O.send(JSON.stringify({type:"list_commands"})),O.send(JSON.stringify({type:"get_commands"})),w.managed||(O.send(JSON.stringify({type:"check_update"})),O.send(JSON.stringify({type:"check_updates_all"})));break}case"snapshot":m.current=new Map,t({type:"snapshot",state:w.state}),j(w.state.pendingQuestion);break;case"snapshot_delta":{const se=Q.current.chat.state;(!se||se.conversationId!==w.conversationId||se.rev!==w.baseRev)&&g(),t({type:"snapshot_delta",msg:w}),j(w.state.pendingQuestion);break}case"tool_delta":R(w.conversationId,w.seq),t({type:"tool_delta",toolCallId:w.toolCallId,toolName:w.toolName,delta:w.delta});break;case"tool_status":t({type:"tool_status",status:w});break;case"message_delta":{R(w.conversationId,w.seq),t({type:"message_delta",msg:w});break}case"notice":{const se=++d.current;t({type:"notice",notice:{id:se,level:w.level,text:w.text,textEn:w.textEn}});break}case"sessions":t({type:"sessions",sessions:w.sessions});break;case"conversations":t({type:"conversations",conversations:w.conversations,activeId:w.activeId,elsewhere:w.elsewhere});break;case"projects":t({type:"projects",projects:w.projects});break;case"files":t({type:"files",files:w});break;case"file_changed":t({type:"file_changed",path:w.path});break;case"file_content":t({type:"file_content",content:w});break;case"models":t({type:"models",models:w.models,loading:!1});break;case"models_config":t({type:"models_config",providers:w.providers});break;case"providers_status":t({type:"providers_status",providers:w.providers});break;case"provider_keys":t({type:"provider_keys",keys:w.keys});break;case"provider_oauth_started":case"provider_oauth_flows":case"provider_oauth_prompt":case"provider_oauth_event":case"provider_oauth_result":case"provider_oauth_logout_result":t({type:"provider_oauth",message:w});break;case"fetch_models_result":t({type:"fetch_models_result",result:{reqId:w.reqId,ok:w.ok,models:w.models,error:w.error}});break;case"refresh_provider_result":t({type:"refresh_provider_result",result:{reqId:w.reqId,ok:w.ok,added:w.added,total:w.total,error:w.error}});break;case"clone_provider_result":t({type:"clone_provider_result",result:{reqId:w.reqId,ok:w.ok,config:w.config,configs:w.configs,error:w.error}});break;case"scm_data":t({type:"scm_data",data:w});break;case"search_files_result":t({type:"file_search_result",result:{reqId:w.reqId,ok:w.ok,results:w.results,truncated:w.truncated}});break;case"session_search_results":t({type:"session_search_result",result:{reqId:w.reqId,ok:w.ok,results:w.results}});break;case"scm_changed":t({type:"scm_changed"});break;case"install_result":t({type:"install_result",result:w});break;case"path_completions":t({type:"path_completions",completions:w.completions});break;case"update_status":t({type:"update_status",status:w});break;case"update_status_all":t({type:"update_status_all",items:w.items});break;case"widgets":t({type:"widgets",widgets:w.widgets});break;case"statuses":t({type:"statuses",statuses:w.statuses});break;case"dialog":t({type:"dialog",dialog:{id:w.id,kind:w.kind,title:w.title,args:w.args}});break;case"dialog_closed":t({type:"dialog",dialog:null});break;case"question_pending":N.current="live",t({type:"question",question:{id:w.id,...w.deadline!==void 0?{deadline:w.deadline}:{},questions:w.questions}});break;case"page_request":{(async()=>{const se=window.__piWebUiHost;let z;if(!se?.pageCall)z={ok:!1,error:"宿主页面桥不可用(页面版本过旧?)—— 刷新本页后再试"};else try{z=await se.pageCall({op:w.op,...w.args===void 0?{}:{args:w.args},...w.target?{target:w.target}:{},timeoutMs:w.timeoutMs})}catch(A){z={ok:!1,error:A instanceof Error?A.message:String(A)}}B({type:"page_response",id:w.id,ok:z.ok===!0,...z.ok===!0?z.result===void 0?{}:{result:z.result}:{error:z.error??"页面操作失败"}})})();break}case"terminal_output":r.current.write(w.conversationId??Q.current.chat.activeConversationId,w.terminalId,w.data);break;case"terminal_exit":t({type:"terminal_exit",conversationId:w.conversationId,terminalId:w.terminalId,exitCode:w.exitCode});break;case"terminal_list":t({type:"terminal_list",conversationId:w.conversationId,terminals:w.terminals});break;case"commands":t({type:"commands",commands:w.commands,path:w.path});break;case"slash_commands":t({type:"slash_commands",commands:w.commands});break;case"goal_status":t({type:"goal_status",status:w.status});break;case"settings_state":t({type:"settings",settings:w.settings});break;case"bg_servers":t({type:"bg_servers",servers:w.servers});break;case"plugins":t({type:"plugins",plugins:w.plugins,epoch:w.epoch});break;case"plugin_catalog":t({type:"plugin_catalog",entries:w.entries,epoch:w.epoch});break;case"plugin_grants":t({type:"plugin_grants",grants:w.grants});break;case"plugin_path_request":t({type:"plugin_path_request",req:{id:w.id,pluginId:w.pluginId,path:w.path,...w.reason?{reason:w.reason}:{}}});break;case"plugin_job":t({type:"plugin_job",job:{jobId:w.jobId,action:w.action,pluginId:w.pluginId,phase:w.phase,...w.ok===void 0?{}:{ok:w.ok},...w.error?{error:w.error}:{},...w.output?{output:w.output}:{}},...w.line?{line:w.line}:{}});break;case"plugin_catalog_sync_result":Em(w),t({type:"plugin_catalog_sync_result",result:{requestId:String(w.requestId??""),ok:w.ok===!0,...w.error?{error:w.error}:{},...w.entries?{entryCount:w.entries.length}:{},...w.installed?{installed:w.installed}:{}}});break;case"dsh_patches":t({type:"dsh_patches",patchDir:w.patchDir,files:w.files});break;case"dsh_presets":t({type:"dsh_presets",presets:w.presets,defaultPreset:w.defaultPreset});break;case"dsh_permission":t({type:"dsh_permission",options:w.options,defaultPreset:w.defaultPreset});break;case"plugin_data":ym(w.pluginId,w.payload);break}},O.onclose=()=>{if(n.current===O&&(n.current=null),r.current.clear(),!l.current||n.current&&n.current!==O)return;t({type:"status",status:"closed"});const F=Math.min(1e3*2**a.current,1e4);a.current+=1,c.current=setTimeout(()=>{c.current=null,Y()},F)},O.onerror=()=>{}},[]);o.useEffect(()=>{const O=F=>{const w=F.detail??eo();w&&B({type:"set_locale",locale:w})};return window.addEventListener(to,O),()=>window.removeEventListener(to,O)},[B]),o.useEffect(()=>{l.current=!0,Y();const O=setInterval(()=>{if(!l.current)return;const F=n.current;F&&F.readyState===WebSocket.OPEN&&Date.now()-u.current>3e4&&F.close()},5e3);return()=>{l.current=!1,clearInterval(O),c.current&&(clearTimeout(c.current),c.current=null),n.current?.close(),n.current=null}},[Y]),o.useEffect(()=>{const O=e.state?.cwd;if(O){if(!h.current){h.current=!0;const F=Pm();if(F&&F!==O){B({type:"set_cwd",path:F});return}}b.current!==O&&(b.current=O,Lm(O))}},[e.state?.cwd,B]),o.useEffect(()=>{$i({ready:e.ready,status:e.status,cwd:e.state?.cwd??"",workspaceRoots:e.state?.workspaceRoots??[],homeDir:e.state?.homeDir??"",desktopDir:e.state?.desktopDir??""})},[e.ready,e.status,e.state?.cwd,e.state?.workspaceRoots,e.state?.homeDir,e.state?.desktopDir]);const q=o.useCallback(O=>t({type:"dismiss_notice",id:O}),[]),C=o.useCallback(O=>t({type:"terminal_add",meta:O}),[]),Te=o.useCallback(O=>t({type:"terminal_remove",id:O}),[]),xe=o.useCallback(O=>t({type:"terminal_restart",terminalId:O}),[]),G=o.useCallback(O=>t({type:"terminal_active",id:O}),[]),ee=o.useCallback((O,F,w)=>r.current.register(O,F,w),[]),Q=o.useRef({chat:e,send:B,pushNotice:M,dismissNotice:q,terminal:{create:C,close:Te,register:ee,restart:xe,select:G}});return Q.current={chat:e,send:B,pushNotice:M,dismissNotice:q,terminal:{create:C,close:Te,register:ee,restart:xe,select:G}},Q.current}const Mm=200*1024*1024,Bm=/windows/i.test(navigator.userAgent),Fm=/[<>:"/\\|?*\u0000-\u001f]/g,Hm=/[. ]+$/,Um=/^(con|prn|aux|nul|com[1-9]|lpt[1-9])(\..*)?$/i;function $m(e){const t=e.replace(Fm,"_").replace(Hm,"");return t?Um.test(t)?`_${t}`:t:"_"}function ro(e,t=!0){const n=new URLSearchParams({clientId:Ea(),path:e,...t?{download:"1"}:{}});return hs(_t(`/api/file?${n}`))}const ic="FILE_NOT_FOUND";async function qm(e,t){const n=Bm?$m(t):t;try{const r=await fetch(ro(e));if(!r.ok)return{ok:!1,cancelled:!1,error:await r.text().catch(()=>"")||(r.status===404?ic:`HTTP ${r.status}`)};if(Number(r.headers.get("content-length")??"0")>Mm)return window.location.assign(ro(e)),{ok:!0};const c=await r.blob();return window.showSaveFilePicker&&window.isSecureContext?Wm(c,n):_r(c,n)}catch(r){return{ok:!1,cancelled:!1,error:r instanceof Error?r.message:String(r)}}}async function Wm(e,t){let n;const r=window.showSaveFilePicker;if(!r)return _r(e,t);try{n=await r({suggestedName:t})}catch(a){return a instanceof DOMException&&a.name==="AbortError"?{ok:!1,cancelled:!0}:_r(e,t)}try{const a=await n.createWritable();return await a.write(e),await a.close(),{ok:!0}}catch(a){return{ok:!1,cancelled:!1,error:a instanceof Error?a.message:String(a)}}}function _r(e,t){const n=URL.createObjectURL(e),r=document.createElement("a");return r.href=n,r.download=t,document.body.appendChild(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(n),1e4),{ok:!0}}const ss=8;function oc(e,t,n){let r=e.left-ss,a=e.bottom+ss;return r+t.width>n.width-ss&&(r=Math.max(ss,e.right+ss-t.width)),a+t.height>n.height-ss&&(a=Math.max(ss,e.top-ss-t.height)),{left:r,top:a}}function Km(){return typeof window<"u"&&window.matchMedia?.("(hover: hover) and (pointer: fine)")?.matches===!0}function Et({text:e}){const t=o.useRef(null),n=o.useRef(null),[r,a]=o.useState(!1),[c,l]=o.useState({left:0,top:0}),u=()=>{const m=t.current?.getBoundingClientRect();m&&(l({left:Math.max(8,m.left-8),top:m.bottom+8}),a(!0))},d=()=>a(!1);return o.useEffect(()=>{if(!r)return;const m=n.current,f=t.current;if(!m||!f)return;const h=m.getBoundingClientRect(),b=f.getBoundingClientRect(),E=oc(b,h,{width:window.innerWidth,height:window.innerHeight});l(N=>N.left===E.left&&N.top===E.top?N:E)},[r,e]),o.useEffect(()=>{if(!r)return;const m=()=>a(!1);return window.addEventListener("scroll",m,!0),window.addEventListener("resize",m),()=>{window.removeEventListener("scroll",m,!0),window.removeEventListener("resize",m)}},[r]),s.jsxs("span",{ref:t,className:"set-tip",tabIndex:0,"aria-label":e,onMouseEnter:u,onMouseLeave:d,onFocus:u,onBlur:d,onKeyDown:m=>{m.key==="Escape"&&m.target.blur()},children:["?",r&&In.createPortal(s.jsx("span",{ref:n,className:"set-tip-bubble open",role:"tooltip",style:{position:"fixed",left:c.left,top:c.top},children:e}),document.body)]})}function Gm(e){return e instanceof Error?e.message:String(e)}function Ym(e,t,n,r){const a=n==="zh";switch(e.kind){case"no-client":return a?`插件 ${t} 没有客户端脚本(client/entry.mjs),无法显示这一页。`:`Plugin ${t} ships no client bundle (client/entry.mjs), so this page cannot be shown.`;case"load":return a?`插件 ${t} 的页面脚本加载失败:${e.detail}`:`Failed to load plugin ${t}'s page bundle: ${e.detail}`;case"mount":return`${r("pluginMountFailed",{name:t})}:${e.detail}`}}function lc({plugin:e,epoch:t,send:n,className:r}){const a=o.useRef(null),{locale:c}=Vt(),l=He(),[u,d]=o.useState(null),m=o.useRef(n);o.useEffect(()=>{m.current=n},[n]),o.useEffect(()=>{const h=a.current;if(!h)return;let b=!1,E,N=!1;if(d(null),!e.hasClient){d({kind:"no-client"});return}return(async()=>{try{if(await Sr(e,t),b)return;const g=await Xl(e.id,()=>import(_t(`/plugins/${encodeURIComponent(e.id)}/client/entry.mjs?e=${t}`)));if(b)return;const R=g.default;if(!R||typeof R.mount!="function")throw new Error("client/entry.mjs 没有导出 default.mount()");N=!0,E=R.mount(h,ac(e.id,M=>m.current(M)))}catch(g){if(b)return;console.error(`[plugin:${e.id}] 页面${N?"挂载":"加载"}失败:`,g),d({kind:N?"mount":"load",detail:Gm(g)})}})(),()=>{if(b=!0,typeof E=="function")try{E()}catch(g){console.error(`[plugin:${e.id}] cleanup 失败:`,g)}h.textContent=""}},[e.id,e.hasClient,t]);const f=r?`plugin-page ${r}`:"plugin-page";return s.jsxs("div",{className:f,children:[s.jsx("div",{className:"plugin-page-host",ref:a}),u&&s.jsx("div",{className:"plugin-page-error",role:"alert",children:Ym(u,e.name,c,l)})]})}function cc(e){return`pi-web-ui:${e}:tab`}function zm(e,t){try{const n=localStorage.getItem(cc(e));return n&&t.some(r=>r.id===n)?n:null}catch{return null}}function io(e,t){try{localStorage.setItem(cc(e),t)}catch{}}function Vm(e){return e.length>0&&!/[a-z]/i.test(e)}function oo(e){if(e.label)return e.label;const t=e.pluginPage;return t?.entry.label||t?.plugin.name||e.id}function Qm({storageKey:e,tabs:t,epoch:n,send:r,extra:a,className:c}){const l=o.useId(),[u,d]=o.useState(()=>zm(e,t)??t[0]?.id??""),m=o.useRef([]),f=o.useRef(""),h=t.findIndex(B=>B.id===u),b=h>=0?t[h]:t[0],E=b?t.indexOf(b):-1;o.useEffect(()=>{if(!b)return;u!==b.id&&d(b.id);const B=`${e}:${b.id}`;f.current!==B&&(f.current=B,io(e,b.id))},[b,u,e]);const N=B=>{d(B.id),f.current=`${e}:${B.id}`,io(e,B.id)},g=(B,j)=>{const Y=t.length;let q=-1;if(B.key==="ArrowRight")q=(j+1)%Y;else if(B.key==="ArrowLeft")q=(j-1+Y)%Y;else if(B.key==="Home")q=0;else if(B.key==="End")q=Y-1;else return;const C=t[q];C&&(B.preventDefault(),N(C),m.current[q]?.focus())};if(!b)return null;const R=`${l}-panel-${E}`,M=c?`slot-tabs ${c}`:"slot-tabs";return s.jsxs("div",{className:M,children:[s.jsxs("div",{className:"slot-tabs-bar",role:"tablist",children:[t.map((B,j)=>{const Y=j===E;return s.jsxs("button",{type:"button",role:"tab",id:`${l}-tab-${j}`,className:Y?"slot-tab active":"slot-tab",title:B.hint??oo(B),"aria-selected":Y,"aria-controls":`${l}-panel-${j}`,tabIndex:Y?0:-1,ref:q=>{m.current[j]=q},onClick:()=>N(B),onKeyDown:q=>g(q,j),children:[B.icon&&Vm(B.icon)?s.jsx("span",{className:"slot-tab-icon",children:B.icon}):null,s.jsx("span",{className:"slot-tab-label",children:oo(B)})]},B.id)}),a?s.jsx("div",{className:"slot-tabs-extra",children:a}):null]}),s.jsx("div",{className:"slot-tabs-body",id:R,role:"tabpanel","aria-labelledby":`${l}-tab-${E}`,children:b.pluginPage?s.jsx(lc,{plugin:b.pluginPage.plugin,epoch:n,send:r}):b.element??null})]})}const bs="@root",lo="pi-web-ui:rp-sizes",za={files:4,widgets:1},co=120,uo=56;function Xm(e,t){return t?Math.max(0,t.getBoundingClientRect().top-e.getBoundingClientRect().top):32}const Jm="files",Zm=[],eh=()=>{};function th(e){const t=e.endsWith("/")&&e!=="/"?e.slice(0,-1):e,n=t.lastIndexOf("/");return n<0?"":n===0?"/":t.slice(0,n)}function sn(e){return e===bs||e==="/"||/^[A-Za-z]:$/.test(e)}function sh(e){return e.startsWith("/")||/^[A-Za-z]:([/]|$)/.test(e)}const nh=o.memo(function({files:t,fileChanged:n,widgets:r,panelSend:a,onAttach:c,onPreview:l,onNotice:u,collapsible:d,onToggleCollapse:m,uiRightPanelTabs:f,uiContextFile:h,plugins:b,pluginsEpoch:E,send:N}){const g=He(),R=b??Zm,M=$t("cwd"),B=$t("workspaceRoots"),j=$t("homeDir"),Y=$t("desktopDir"),[q,C]=o.useState(""),[Te,xe]=o.useState(null),[G,ee]=o.useState(!1),Q=o.useRef(null),O=o.useRef(null),[F,w]=o.useState(()=>{try{return Yl(localStorage.getItem(lo),za)}catch{return{...za}}});o.useEffect(()=>{try{localStorage.setItem(lo,JSON.stringify(F))}catch{}},[F]);const se=r.some(v=>v.lines.length>0),z=o.useCallback(v=>{v.preventDefault();const te=Q.current;if(!te)return;const Be=v.currentTarget,ht=v.clientY,nt={above:F.files,below:F.widgets},yt=Math.max(120,te.clientHeight-Xm(te,O.current));Be.classList.add("dragging"),document.body.classList.add("rp-resizing");const Xt=ae=>{const{above:Se,below:Me}=zl({start:nt,deltaPx:ae.clientY-ht,availablePx:yt,totalWeight:nt.above+nt.below,minAbovePx:co,minBelowPx:uo});w({files:Se,widgets:Me})},k=()=>{window.removeEventListener("pointermove",Xt),window.removeEventListener("pointerup",k),Be.classList.remove("dragging"),document.body.classList.remove("rp-resizing")};window.addEventListener("pointermove",Xt),window.addEventListener("pointerup",k)},[F.files,F.widgets]),A=o.useRef(null),ue=o.useRef(0),P=o.useCallback(v=>{A.current=v,v&&(v.scrollTop=ue.current)},[]),[ie,I]=o.useState(null),he=o.useRef(null);o.useEffect(()=>()=>{he.current&&clearTimeout(he.current)},[]);const _=o.useCallback(v=>{I(v),he.current&&clearTimeout(he.current),he.current=setTimeout(()=>I(null),1200)},[]),re=v=>{try{const te=document.createElement("textarea");te.value=v,te.style.position="fixed",te.style.opacity="0",document.body.appendChild(te),te.select();const Be=document.execCommand("copy");return document.body.removeChild(te),Be}catch{return!1}},le=o.useCallback((v,te)=>{if(!v)return;const Be=()=>_(te),ht=()=>u("error",g("slashCopyFailed")),nt=navigator;nt.clipboard?.writeText?nt.clipboard.writeText(v).then(Be,()=>{re(v)?Be():ht()}):re(v)?Be():ht()},[_,u,g]),Ee=o.useCallback(v=>{if(!v)return M;if(/^[A-Za-z]:$/.test(v))return`${v}/`;if(v.startsWith("/")||/^[A-Za-z]:([/]|$)/.test(v))return v;const te=M.replace(/\\/g,"/").replace(/\/+$/,"");return te?`${te}/${v}`:v},[M]),Ne=o.useCallback(v=>!v||v===bs?null:v.startsWith("/")||/^[A-Za-z]:([/]|$)/.test(v)?v:`${M.replace(/\\/g,"/").replace(/\/+$/,"")}/${v}`,[M]),Ue=o.useCallback((v,te)=>{for(const Be of te){const ht=new FileReader;ht.onload=()=>{const nt=ht.result,yt=nt.slice(nt.indexOf(",")+1);yt&&a({type:"upload_file",dirPath:v,name:Be.name,data:yt})},ht.readAsDataURL(Be)}},[a]),ke=o.useRef(null),Ke=o.useRef(null),Ie=o.useCallback(()=>{const v=ke.current?.project;v&&a({type:"set_cwd",path:v.path})},[a]),ce=o.useCallback(()=>{Ke.current&&(Ke.current.value=""),Ke.current?.click()},[]),[pe,Fe]=o.useState(null),[Ae,et]=o.useState(null),[dt,Ve]=o.useState(""),[X,we]=o.useState(null),[L,W]=o.useState(""),oe=o.useCallback((v,te)=>{qm(v,te).then(Be=>{Be.ok||Be.cancelled||u("error",g("downloadFailed",{error:Be.error===ic?g("fileNotFoundShort"):Be.error}))})},[u,g]),fe=o.useCallback(()=>{const v=ke.current?.target;!v||v.kind==="list"||sn(v.id)||(we(null),Ve(v.label),et(v.id))},[]),de=o.useCallback(()=>{if(!Ae)return;const v=dt.trim();et(null),v&&a({type:"file_rename",path:Ae,newName:v})},[Ae,dt,a]),ge=o.useCallback(v=>{const te=ke.current?.dir??q;et(null),W(""),we({dir:te,kind:v})},[q]),Qe=o.useCallback(()=>{if(!X)return;const v=L.trim();we(null),v&&a({type:"file_create",dir:X.dir,name:v,kind:X.kind})},[X,L,a]),ye=(v,te,Be,ht)=>s.jsx("input",{autoFocus:!0,className:"session-rename-input",value:v,placeholder:g("fileNamePlaceholder"),onClick:nt=>nt.stopPropagation(),onChange:nt=>te(nt.target.value),onKeyDown:nt=>{nt.stopPropagation(),nt.key==="Enter"&&!nt.nativeEvent.isComposing?Be():nt.key==="Escape"&&ht()},onBlur:ht}),Oe=o.useCallback(()=>{const v=ke.current?.target;!v||v.kind==="list"||sn(v.id)||window.confirm(g("fileDeleteConfirm",{name:v.label}))&&(pe?.src===v.id&&Fe(null),Ae===v.id&&et(null),a({type:"file_delete",path:v.id}))},[a,g,pe,Ae]),rt=o.useCallback(()=>{const v=ke.current?.target;!v||v.kind==="list"||sn(v.id)||a({type:"file_copy",src:v.id,destDir:th(v.id)})},[a]),Ge=o.useCallback(v=>{const te=ke.current?.target;!te||te.kind==="list"||sn(te.id)||Fe({src:te.id,cut:v})},[]),D=o.useCallback(()=>{if(!pe)return;const v=ke.current?.dir??q;pe.cut?(a({type:"file_copy",src:pe.src,destDir:v,move:!0}),Fe(null)):a({type:"file_copy",src:pe.src,destDir:v})},[pe,a,q]),$e=o.useCallback(()=>{a({type:"list_files",path:q===""?void 0:q})},[a,q]),[it,Xe]=o.useState(!1);o.useEffect(()=>{if(!it)return;const v=Be=>{Be.target?.closest(".root-picker")||Xe(!1)},te=Be=>{Be.key==="Escape"&&Xe(!1)};return window.addEventListener("mousedown",v,!0),window.addEventListener("keydown",te),()=>{window.removeEventListener("mousedown",v,!0),window.removeEventListener("keydown",te)}},[it]);const U=o.useCallback(v=>{a({type:"set_workspace_roots",roots:v})},[a]),Pe=o.useCallback(()=>{const v=ke.current?.target;if(!v||v.kind!=="dir")return;const te=Ne(v.id);!te||B.includes(te)||U([...B,te])},[B,Ne,U]),Le=o.useCallback(v=>{Ue(ke.current?.dir??q,Array.from(v.target.files??[]))},[Ue,q]),ot=o.useCallback(v=>{const te=ke.current?.target;switch(v.id){case"host:file-open-project":Ie();break;case"host:file-upload":ce();break;case"host:file-add-root":Pe();break;case"host:file-open":te?.kind==="file"&&l(te.id,te.label);break;case"host:file-enter":te?.kind==="dir"&&Lt(te.id);break;case"host:file-download":te?.kind==="file"&&oe(te.id,te.label);break;case"host:file-attach-inline":te?.kind==="file"&&c(te.id,te.label,"inline");break;case"host:file-attach-ref":te?.kind==="file"&&c(te.id,te.label,"reference");break;case"host:file-attach-folder":te?.kind==="dir"&&c(te.id,te.label,"reference",!0);break;case"host:file-new-file":ge("file");break;case"host:file-new-dir":ge("dir");break;case"host:file-paste":D();break;case"host:file-rename":fe();break;case"host:file-duplicate":rt();break;case"host:file-cut":Ge(!0);break;case"host:file-copy":Ge(!1);break;case"host:file-copy-name":te&&te.kind!=="list"&&le(te.label,`name:${te.id}`);break;case"host:file-copy-path":te&&te.kind!=="list"&&le(Ee(te.id),`path:${te.id}`);break;case"host:file-copy-rel":te&&te.kind!=="list"&&le(te.id,`rel:${te.id}`);break;case"host:file-refresh":$e();break;case"host:file-delete":Oe();break}},[Ie,ce,Pe,l,c,le,Ee,oe,ge,D,fe,rt,Ge,$e,Oe]),Ye=o.useCallback((v,te)=>{const Be=te.kind==="dir"?Ne(te.id):null,ht={target:te,dir:te.kind==="dir"?te.id:q,project:Be?{path:Be,name:te.label}:null},nt=te.kind,yt=nt==="file",Xt=nt==="dir",k=nt==="list",ae=!k&&sn(te.id),Se=!k&&sh(te.id),Me=q===bs,We=(h??[]).map(De=>{if(De.source!=="host")return De;switch(De.id){case"host:file-upload":return yt||Me?{...De,hidden:!0}:{...De,label:ht.dir===q?g("uploadToCurrentDir"):g("uploadToFolder")};case"host:file-open-project":return Be?De:{...De,hidden:!0};case"host:file-add-root":return!!Be&&Be!==M&&!B.includes(Be)?De:{...De,hidden:!0};case"host:file-open":case"host:file-download":case"host:file-attach-inline":case"host:file-attach-ref":return yt?De:{...De,hidden:!0};case"host:file-enter":case"host:file-attach-folder":return Xt?De:{...De,hidden:!0};case"host:file-new-file":case"host:file-new-dir":return!yt&&!Me?De:{...De,hidden:!0};case"host:file-paste":return!yt&&!Me&&pe?De:{...De,hidden:!0};case"host:file-rename":case"host:file-duplicate":case"host:file-cut":case"host:file-copy":case"host:file-delete":return!k&&!ae?De:{...De,hidden:!0};case"host:file-copy-name":case"host:file-copy-path":return k?{...De,hidden:!0}:De;case"host:file-copy-rel":return!k&&!Se?De:{...De,hidden:!0};case"host:file-refresh":return k?De:{...De,hidden:!0};default:return De}});fa(We).length!==0&&(v.preventDefault(),v.stopPropagation(),ke.current=ht,Pa({x:v.clientX,y:v.clientY,slot:"contextmenu.file",target:te,entries:We,onHostAction:ot}))},[h,q,Ne,g,ot,M,B,pe]),ct=v=>Array.from(v.dataTransfer?.types??[]).includes("Files"),mt=o.useCallback(()=>{A.current?.querySelectorAll(".file-item.drop-target").forEach(v=>v.classList.remove("drop-target")),A.current?.classList.remove("drop-root")},[]),Mt=o.useCallback(v=>{if(mt(),v==null)return;const te=A.current?.querySelector(`.file-item[data-path="${CSS.escape(v)}"]`);te?te.classList.add("drop-target"):A.current?.classList.add("drop-root")},[mt]),$=v=>{const te=v instanceof Element?v.closest(".file-item"):null;return te?.dataset.type==="dir"?te.dataset.path??q:q},Z=o.useCallback(()=>{const v=document.querySelector(".app");v&&v.dispatchEvent(new DragEvent("dragleave",{bubbles:!0}))},[]),Re=1e4,je=o.useRef(0),Je=o.useRef(void 0),qe=o.useCallback((v,te)=>{const Be=++je.current;C(v),te?.silent||ee(!0),a({type:"list_files",path:v===""?void 0:v})||je.current===Be&&ee(!1)},[a]),At=o.useCallback(v=>{const te=B.filter(Be=>Be!==v);U(te),(q===v||q.startsWith(`${v}/`))&&qe("")},[B,U,q,qe]);o.useEffect(()=>{t&&t.path===q&&ee(!1)},[t,q]),o.useEffect(()=>{if(M!==Je.current){Je.current=M,qe("",{silent:!0});return}const v=setInterval(()=>{document.visibilityState!=="hidden"&&qe(q,{silent:!0})},Re);return()=>clearInterval(v)},[M,q,qe]),o.useEffect(()=>{n&&n.path===q&&qe(q,{silent:!0})},[n,q,qe]);const Lt=v=>qe(v),jt=()=>{t?.parent!==null&&t?.parent!==void 0&&qe(t.parent)},us=(()=>{if(q===""||q===bs)return[];const v=q.split("/").filter(te=>!!te&&te!==bs);return q.startsWith("/")?v.map((te,Be)=>({label:Be===0?"/":v[Be],path:"/"+v.slice(0,Be+1).join("/")})):v.map((te,Be)=>({label:v[Be],path:v.slice(0,Be+1).join("/")}))})(),Qt=[];for(const v of f??[]){if(v.source==="host"||v.hidden||v.kind==="divider")continue;const te=R.find(Be=>Be.id===v.source.slice(7));te&&Qt.push({id:v.id,label:v.label,icon:v.icon,hint:v.hint,pluginPage:{plugin:te,entry:v}})}const Ut=(f??[]).some(v=>v.id==="host:right-files"&&v.hidden);return s.jsxs("aside",{className:"panel panel-right",ref:Q,children:[d&&m&&s.jsx("button",{type:"button",className:"panel-collapse-btn",title:g("collapsePanel"),onClick:m,children:s.jsx(vl,{})}),s.jsx("div",{ref:O,style:{display:"flex",flexDirection:"column",flex:se?`${F.files} 1 0`:"1 1 0",minHeight:se?co:0},children:s.jsx(Qm,{storageKey:"rightpanel",epoch:E??0,send:N??eh,tabs:[...Ut?[]:[{id:Jm,label:g("openFiles"),element:s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"panel-crumbs",children:[s.jsx("button",{type:"button",className:`crumb ${q===""?"active":""}`,onClick:()=>qe(""),children:g("rootDir")}),s.jsx("button",{type:"button",className:`crumb ${q===bs?"active":""}`,title:g("computer"),onClick:()=>qe(bs),children:"💻"}),j!==""&&s.jsx("button",{type:"button",className:`crumb ${q===j||q.startsWith(`${j}/`)?"active":""}`,title:g("homeDir"),onClick:()=>qe(j),children:"🏠"}),Y!==""&&s.jsx("button",{type:"button",className:`crumb ${q===Y||q.startsWith(`${Y}/`)?"active":""}`,title:g("desktopDir"),onClick:()=>qe(Y),children:"🖥️"}),s.jsx(Et,{text:g("filesHelp")}),B.length>0&&s.jsxs("div",{className:"root-picker",children:[s.jsxs("button",{type:"button",className:"crumb root-picker-trigger","aria-haspopup":"menu","aria-expanded":it,title:g("workspaceRoots"),onClick:()=>Xe(v=>!v),children:[s.jsx(is,{}),s.jsx("span",{className:"root-picker-label",children:g("workspaceRoots")}),s.jsx("span",{className:"set-count",children:B.length+1}),"▾"]}),it&&s.jsxs("div",{className:"root-picker-menu",role:"menu",children:[s.jsx("div",{className:"root-picker-row",children:s.jsxs("button",{type:"button",role:"menuitem",className:q===""?"root-picker-item active":"root-picker-item",title:M,onClick:()=>{Xe(!1),qe("")},children:[g("rootDir"),s.jsx("span",{className:"root-picker-path",children:M})]})}),B.map(v=>s.jsxs("div",{className:"root-picker-row",children:[s.jsx("button",{type:"button",role:"menuitem",className:q===v?"root-picker-item active":"root-picker-item",title:v,onClick:()=>{Xe(!1),qe(v)},children:s.jsx("span",{className:"root-picker-path",children:v})}),s.jsx("button",{type:"button",className:"root-picker-remove",title:g("removeWorkspaceRoot"),"aria-label":g("removeWorkspaceRoot"),onClick:()=>At(v),children:s.jsx(bt,{})})]},v)),s.jsx("div",{className:"root-picker-hint",children:g("workspaceRootsHint")})]})]}),us.map(v=>s.jsxs("span",{className:"crumb-seg",children:[s.jsx(Os,{}),s.jsx("button",{type:"button",className:`crumb ${v.path===q?"active":""}`,onClick:()=>qe(v.path),children:v.label})]},v.path))]}),s.jsxs("div",{ref:P,className:"panel-body",onScroll:v=>{ue.current=v.currentTarget.scrollTop},onContextMenu:v=>Ye(v,{id:q,kind:"list",label:q===""?g("rootDir"):q===bs?g("computer"):q}),onDragOver:v=>{ct(v)&&(v.preventDefault(),v.stopPropagation(),v.dataTransfer.dropEffect="copy",Z(),Mt($(v.target)))},onDragLeave:v=>{v.relatedTarget&&v.currentTarget.contains(v.relatedTarget)||mt()},onDrop:v=>{if(mt(),!ct(v))return;v.preventDefault(),v.stopPropagation(),Z();const te=Array.from(v.dataTransfer?.files??[]);if(te.length===0){u("warning",g("foldersNotSupported"));return}Ue($(v.target),te)},onDragEnd:mt,children:[s.jsx("input",{ref:Ke,type:"file",multiple:!0,hidden:!0,onChange:Le}),X&&s.jsxs("div",{className:"file-item dir",children:[X.kind==="dir"?s.jsx(is,{className:"file-icon"}):s.jsx(vi,{className:"file-icon"}),ye(L,W,Qe,()=>we(null))]}),G&&s.jsx("div",{className:"panel-empty",children:g("loading")}),!G&&t&&t.path===q&&s.jsxs(s.Fragment,{children:[t.parent!=null&&s.jsxs("button",{type:"button",className:"file-item dir",onClick:jt,children:[s.jsx(is,{className:"file-icon"}),s.jsx("span",{className:"file-name",children:".."})]}),t.entries.map(v=>v.type==="dir"?s.jsxs("div",{className:`file-item dir${pe?.cut&&pe.src===v.path?" cut":""}`,"data-type":"dir","data-path":v.path,onContextMenu:te=>Ye(te,{id:v.path,kind:"dir",label:v.name}),children:[Ae===v.path?ye(dt,Ve,de,()=>et(null)):s.jsxs("button",{type:"button",className:"file-dir-main",onClick:()=>Lt(v.path),children:[s.jsx(is,{className:"file-icon"}),s.jsx("span",{className:"file-name",children:v.name})]}),s.jsx("button",{type:"button",className:"file-attach ref","data-tip":g("linkFolderTip"),"aria-label":g("linkFolderTip"),onClick:()=>c(v.path,v.name,"reference",!0),children:s.jsx(dr,{})}),s.jsx("button",{type:"button",className:`file-attach copy${ie===`name:${v.path}`?" copied":""}`,"data-tip":g("copyName"),"aria-label":g("copyName"),onClick:()=>le(v.name,`name:${v.path}`),children:ie===`name:${v.path}`?s.jsx(os,{}):s.jsx(cs,{})}),s.jsx("button",{type:"button",className:`file-attach copy${ie===`path:${v.path}`?" copied":""}`,"data-tip":g("copyPath"),"aria-label":g("copyPath"),onClick:()=>le(Ee(v.path),`path:${v.path}`),children:ie===`path:${v.path}`?s.jsx(os,{}):s.jsx(wi,{})})]},v.path):s.jsxs("div",{className:`file-item file${pe?.cut&&pe.src===v.path?" cut":""}`,"data-type":"file","data-path":v.path,onContextMenu:te=>Ye(te,{id:v.path,kind:"file",label:v.name}),children:[Ae===v.path?ye(dt,Ve,de,()=>et(null)):s.jsxs("button",{type:"button",className:"file-name",title:`${v.path} — ${g("previewFile")}`,onClick:()=>l(v.path,v.name),children:[s.jsx(vi,{className:"file-icon"}),s.jsx("span",{className:"file-name-text",children:v.name})]}),s.jsx("button",{type:"button",className:"file-attach download","data-tip":g("downloadFile"),onClick:()=>oe(v.path,v.name),children:s.jsx(Rs,{})}),s.jsx("button",{type:"button",className:"file-attach inline","data-tip":g("attachInlineTip"),onClick:()=>c(v.path,v.name,"inline"),children:s.jsx(Dt,{})}),s.jsx("button",{type:"button",className:"file-attach ref","data-tip":g("referenceTip"),"aria-label":g("referenceTip"),onClick:()=>c(v.path,v.name,"reference"),children:s.jsx(dr,{})}),s.jsx("button",{type:"button",className:`file-attach copy${ie===`name:${v.path}`?" copied":""}`,"data-tip":g("copyName"),"aria-label":g("copyName"),onClick:()=>le(v.name,`name:${v.path}`),children:ie===`name:${v.path}`?s.jsx(os,{}):s.jsx(cs,{})}),s.jsx("button",{type:"button",className:`file-attach copy${ie===`path:${v.path}`?" copied":""}`,"data-tip":g("copyPath"),"aria-label":g("copyPath"),onClick:()=>le(Ee(v.path),`path:${v.path}`),children:ie===`path:${v.path}`?s.jsx(os,{}):s.jsx(wi,{})})]},v.path)),t.truncated&&s.jsx("div",{className:"panel-empty files-truncated",children:g("filesTruncated")})]}),!G&&!t&&s.jsx("div",{className:"panel-empty",children:g("noFiles")})]})]})}],...Qt]})}),se&&s.jsx("div",{className:"rp-sash",onPointerDown:z,onDoubleClick:()=>w({...za}),title:g("dragToResize")}),se&&s.jsx("div",{className:"panel-widgets",style:{flexGrow:F.widgets,minHeight:uo},children:r.filter(v=>v.lines.length>0).map(v=>s.jsxs("div",{className:"widget",children:[s.jsxs("button",{type:"button",className:"widget-title widget-title-btn",title:g("widgetExpand"),onClick:()=>xe(v.key),children:[s.jsx("span",{children:v.key}),s.jsx(Fd,{})]}),s.jsx("pre",{className:"widget-lines",children:v.lines.join(`
325
+ `+r.slice(r.length-Ga):r,c=new Map(e.liveOutputs);return c.set(t.toolCallId,{toolName:t.toolName,text:a}),{...e,liveOutputs:c}}case"message_delta":{const n=e.state;return!n||n.conversationId!==t.msg.conversationId?e:{...e,state:tm(n,t.msg)}}case"tool_status":return{...e,toolStatuses:new Map(e.toolStatuses).set(t.status.toolCallId,t.status)};case"notice":return{...e,notices:[...e.notices,t.notice].slice(-6)};case"dismiss_notice":return{...e,notices:e.notices.filter(n=>n.id!==t.id)};case"sessions":return{...e,sessions:t.sessions};case"conversations":return{...e,conversations:t.conversations,elsewhere:t.elsewhere??[],activeConversationId:t.activeId};case"projects":return{...e,projects:t.projects};case"files":return{...e,files:t.files};case"file_changed":return{...e,fileChanged:{path:t.path}};case"file_content":return{...e,fileContent:t.content};case"models":return{...e,models:t.models,modelsLoading:t.loading};case"models_config":return{...e,modelsConfig:t.providers};case"providers_status":return{...e,providers:t.providers};case"provider_keys":return{...e,providerKeys:t.keys};case"provider_oauth":{const n=wm({flows:e.providerOAuthFlows,results:e.providerOAuthResults},t.message);return{...e,providerOAuthFlows:n.flows,providerOAuthResults:n.results}}case"fetch_models_result":return{...e,fetchModelsResult:t.result};case"refresh_provider_result":return{...e,refreshProviderResult:t.result};case"clone_provider_result":return{...e,cloneProviderResult:t.result};case"install_result":return{...e,installResult:t.result};case"scm_data":return{...e,scmData:t.data};case"file_search_result":return{...e,fileSearch:t.result};case"session_search_result":return{...e,sessionSearch:t.result};case"scm_changed":return{...e,scmDirty:e.scmDirty+1};case"path_completions":return{...e,pathCompletions:t.completions};case"update_status":return{...e,update:t.status};case"update_status_all":return{...e,updatesAll:t.items};case"updates_check_started":return{...e,updatesAll:null};case"widgets":return{...e,widgets:t.widgets};case"statuses":return{...e,statuses:t.statuses};case"dialog":return{...e,dialog:t.dialog};case"question":return{...e,question:t.question};case"commands":return{...e,commands:t.commands,commandsPath:t.path};case"slash_commands":return{...e,slashCommands:t.commands};case"goal_status":return{...e,goal:t.status};case"settings":return{...e,settings:t.settings};case"bg_servers":return{...e,bgServers:t.servers};case"plugins":return{...e,plugins:t.plugins,pluginsEpoch:t.epoch};case"plugin_catalog":return{...e,pluginCatalog:t.entries,pluginCatalogEpoch:t.epoch};case"plugin_grants":return{...e,pluginGrants:t.grants};case"plugin_path_request":return{...e,pathRequests:[...e.pathRequests.filter(n=>n.id!==t.req.id),t.req]};case"plugin_path_resolved":return{...e,pathRequests:e.pathRequests.filter(n=>n.id!==t.id)};case"plugin_job":{const n=e.pluginJobs[t.job.jobId],r=t.line?[...n?.lines??[],t.line].slice(-40):n?.lines??[],a={...n,...t.job,lines:r,startedAt:n?.startedAt??Date.now()};return{...e,pluginJobs:{...e.pluginJobs,[t.job.jobId]:a}}}case"plugin_catalog_sync_result":return{...e,catalogSync:{...t.result,receivedAt:Date.now()}};case"dsh_patches":return{...e,dshPatches:{patchDir:t.patchDir,files:t.files}};case"dsh_presets":return{...e,dshPresets:{presets:t.presets,defaultPreset:t.defaultPreset}};case"dsh_permission":return{...e,dshPermission:{options:t.options,defaultPreset:t.defaultPreset}};case"terminal_add":return{...e,terminals:[...e.terminals,t.meta]};case"terminal_remove":return{...e,terminals:e.terminals.filter(n=>n.id!==t.id)};case"terminal_exit":return t.conversationId&&(e.activeConversationId||e.state?.conversationId)&&t.conversationId!==(e.activeConversationId||e.state?.conversationId)?e:{...e,terminals:e.terminals.map(n=>n.id===t.terminalId?{...n,running:!1,exitCode:t.exitCode}:n)};case"terminal_restart":return{...e,terminals:e.terminals.map(n=>n.id===t.terminalId?{...n,running:!0,exitCode:null}:n)};case"terminal_list":return t.conversationId&&(e.activeConversationId||e.state?.conversationId)&&t.conversationId!==(e.activeConversationId||e.state?.conversationId)?e:{...e,terminals:t.terminals.map(n=>({...n,conversationId:t.conversationId??e.state?.conversationId??""}))};case"terminal_active":return{...e,terminalActiveId:t.id};default:return e}}const ao="pi-web-client-id";let Ya=null;function Ea(){if(Ya)return Ya;let e=null;try{e=sessionStorage.getItem(ao),e||(e=qt(),sessionStorage.setItem(ao,e))}catch{e=e??qt()}return Ya=e,e}const rc="pi-web-last-cwd";function Pm(){try{return localStorage.getItem(rc)}catch{return null}}function Lm(e){try{localStorage.setItem(rc,e)}catch{}}function Dm(){const e=location.protocol==="https:"?"wss:":"ws:";return hs(`${e}//${location.host}${_t("/ws")}`)}function Om(){const[e,t]=o.useReducer(Rm,{status:"connecting",ready:!1,state:null,liveOutputs:new Map,toolStatuses:new Map,notices:[],sessions:[],conversations:[],elsewhere:[],activeConversationId:"",projects:[],files:null,fileChanged:null,fileContent:null,models:[],modelsLoading:!1,modelsConfig:[],providers:[],providerKeys:{},providerOAuthFlows:[],providerOAuthResults:Cm().results,installResult:null,pathCompletions:[],update:null,updatesAll:null,widgets:[],statuses:[],dialog:null,question:null,commands:[],commandsPath:"",slashCommands:[],terminals:[],terminalActiveId:null,goal:jm,bgServers:[],settings:null,fetchModelsResult:null,refreshProviderResult:null,cloneProviderResult:null,scmData:null,fileSearch:null,sessionSearch:null,scmDirty:0,plugins:[],pluginsEpoch:0,pluginCatalog:[],pluginCatalogEpoch:0,pluginJobs:{},catalogSync:null,pluginGrants:[],pathRequests:[],dshPatches:null,dshPresets:null,dshPermission:null,protocolMismatch:!1}),n=o.useRef(null),r=o.useRef(Im()),a=o.useRef(0),c=o.useRef(null),l=o.useRef(!0),u=o.useRef(0),d=o.useRef(0),m=o.useRef(new Map),f=o.useRef(null),h=o.useRef(!1),b=o.useRef(null),E=o.useRef(new Set),N=o.useRef("live"),g=()=>{f.current||(f.current=setTimeout(()=>{f.current=null;const O=n.current;O&&O.readyState===WebSocket.OPEN&&O.send(JSON.stringify({type:"get_state"}))},300))},R=(O,F)=>{const w=m.current,se=w.get(O);if(se!==void 0&&F!==se+1){const z=Q.current.chat,A=z.activeConversationId||z.state?.conversationId;O===A&&g()}w.set(O,F)},M=o.useCallback((O,F)=>{const w=++d.current;t({type:"notice",notice:{id:w,level:O,text:F}})},[]),B=o.useCallback(O=>{const F=n.current;if(F&&F.readyState===WebSocket.OPEN){if(O.type==="check_updates_all"&&O.force===!0&&t({type:"updates_check_started"}),F.send(JSON.stringify(O)),O.type==="question_answer"){if(E.current.add(O.id),E.current.size>64){const w=E.current.values().next().value;w!==void 0&&E.current.delete(w)}N.current="live",t({type:"question",question:null})}return!0}return!1},[]),j=o.useCallback(O=>{const F=sm({current:Q.current.chat.question,source:N.current,snapshot:O,answered:E.current});F.changed&&(N.current=F.source,t({type:"question",question:F.question}))},[]);qp(B);const Y=o.useCallback(()=>{if(!l.current)return;t({type:"status",status:"connecting"});const O=new WebSocket(Dm());n.current=O,O.onopen=()=>{n.current===O&&(t({type:"status",status:"open"}),a.current=0,u.current=Date.now(),O.send(JSON.stringify({type:"hello",clientId:Ea(),locale:eo()})))},O.onmessage=F=>{if(n.current!==O)return;u.current=Date.now();let w;try{w=JSON.parse(F.data)}catch{return}switch(w.type){case"ready":{const se="20260916T04574";if((Q.current.chat.settings?.autoReload??!0)&&w.buildId&&se&&w.buildId!==se){const A=`pi-web-ui-reloaded-${w.buildId}`;if(!sessionStorage.getItem(A)){sessionStorage.setItem(A,"1"),location.reload();return}}$i({engine:w.engine??"pi",managed:!!w.managed,tabs:w.tabs,appVersion:w.appVersion,serverVersion:w.serverVersion,service:w.service}),t({type:"ready",serverVersion:w.serverVersion,protocolVersion:w.protocolVersion,engine:w.engine,appVersion:w.appVersion,managed:w.managed,tabs:w.tabs,service:w.service}),O.send(JSON.stringify({type:"get_state"})),O.send(JSON.stringify({type:"list_files"})),O.send(JSON.stringify({type:"list_models"})),O.send(JSON.stringify({type:"list_commands"})),O.send(JSON.stringify({type:"get_commands"})),w.managed||(O.send(JSON.stringify({type:"check_update"})),O.send(JSON.stringify({type:"check_updates_all"})));break}case"snapshot":m.current=new Map,t({type:"snapshot",state:w.state}),j(w.state.pendingQuestion);break;case"snapshot_delta":{const se=Q.current.chat.state;(!se||se.conversationId!==w.conversationId||se.rev!==w.baseRev)&&g(),t({type:"snapshot_delta",msg:w}),j(w.state.pendingQuestion);break}case"tool_delta":R(w.conversationId,w.seq),t({type:"tool_delta",toolCallId:w.toolCallId,toolName:w.toolName,delta:w.delta});break;case"tool_status":t({type:"tool_status",status:w});break;case"message_delta":{R(w.conversationId,w.seq),t({type:"message_delta",msg:w});break}case"notice":{const se=++d.current;t({type:"notice",notice:{id:se,level:w.level,text:w.text,textEn:w.textEn}});break}case"sessions":t({type:"sessions",sessions:w.sessions});break;case"conversations":t({type:"conversations",conversations:w.conversations,activeId:w.activeId,elsewhere:w.elsewhere});break;case"projects":t({type:"projects",projects:w.projects});break;case"files":t({type:"files",files:w});break;case"file_changed":t({type:"file_changed",path:w.path});break;case"file_content":t({type:"file_content",content:w});break;case"models":t({type:"models",models:w.models,loading:!1});break;case"models_config":t({type:"models_config",providers:w.providers});break;case"providers_status":t({type:"providers_status",providers:w.providers});break;case"provider_keys":t({type:"provider_keys",keys:w.keys});break;case"provider_oauth_started":case"provider_oauth_flows":case"provider_oauth_prompt":case"provider_oauth_event":case"provider_oauth_result":case"provider_oauth_logout_result":t({type:"provider_oauth",message:w});break;case"fetch_models_result":t({type:"fetch_models_result",result:{reqId:w.reqId,ok:w.ok,models:w.models,error:w.error}});break;case"refresh_provider_result":t({type:"refresh_provider_result",result:{reqId:w.reqId,ok:w.ok,added:w.added,total:w.total,error:w.error}});break;case"clone_provider_result":t({type:"clone_provider_result",result:{reqId:w.reqId,ok:w.ok,config:w.config,configs:w.configs,error:w.error}});break;case"scm_data":t({type:"scm_data",data:w});break;case"search_files_result":t({type:"file_search_result",result:{reqId:w.reqId,ok:w.ok,results:w.results,truncated:w.truncated}});break;case"session_search_results":t({type:"session_search_result",result:{reqId:w.reqId,ok:w.ok,results:w.results}});break;case"scm_changed":t({type:"scm_changed"});break;case"install_result":t({type:"install_result",result:w});break;case"path_completions":t({type:"path_completions",completions:w.completions});break;case"update_status":t({type:"update_status",status:w});break;case"update_status_all":t({type:"update_status_all",items:w.items});break;case"widgets":t({type:"widgets",widgets:w.widgets});break;case"statuses":t({type:"statuses",statuses:w.statuses});break;case"dialog":t({type:"dialog",dialog:{id:w.id,kind:w.kind,title:w.title,args:w.args}});break;case"dialog_closed":t({type:"dialog",dialog:null});break;case"question_pending":N.current="live",t({type:"question",question:{id:w.id,...w.deadline!==void 0?{deadline:w.deadline}:{},questions:w.questions}});break;case"page_request":{(async()=>{const se=window.__piWebUiHost;let z;if(!se?.pageCall)z={ok:!1,error:"宿主页面桥不可用(页面版本过旧?)—— 刷新本页后再试"};else try{z=await se.pageCall({op:w.op,...w.args===void 0?{}:{args:w.args},...w.target?{target:w.target}:{},timeoutMs:w.timeoutMs})}catch(A){z={ok:!1,error:A instanceof Error?A.message:String(A)}}B({type:"page_response",id:w.id,ok:z.ok===!0,...z.ok===!0?z.result===void 0?{}:{result:z.result}:{error:z.error??"页面操作失败"}})})();break}case"terminal_output":r.current.write(w.conversationId??Q.current.chat.activeConversationId,w.terminalId,w.data);break;case"terminal_exit":t({type:"terminal_exit",conversationId:w.conversationId,terminalId:w.terminalId,exitCode:w.exitCode});break;case"terminal_list":t({type:"terminal_list",conversationId:w.conversationId,terminals:w.terminals});break;case"commands":t({type:"commands",commands:w.commands,path:w.path});break;case"slash_commands":t({type:"slash_commands",commands:w.commands});break;case"goal_status":t({type:"goal_status",status:w.status});break;case"settings_state":t({type:"settings",settings:w.settings});break;case"bg_servers":t({type:"bg_servers",servers:w.servers});break;case"plugins":t({type:"plugins",plugins:w.plugins,epoch:w.epoch});break;case"plugin_catalog":t({type:"plugin_catalog",entries:w.entries,epoch:w.epoch});break;case"plugin_grants":t({type:"plugin_grants",grants:w.grants});break;case"plugin_path_request":t({type:"plugin_path_request",req:{id:w.id,pluginId:w.pluginId,path:w.path,...w.reason?{reason:w.reason}:{}}});break;case"plugin_job":t({type:"plugin_job",job:{jobId:w.jobId,action:w.action,pluginId:w.pluginId,phase:w.phase,...w.ok===void 0?{}:{ok:w.ok},...w.error?{error:w.error}:{},...w.output?{output:w.output}:{}},...w.line?{line:w.line}:{}});break;case"plugin_catalog_sync_result":Em(w),t({type:"plugin_catalog_sync_result",result:{requestId:String(w.requestId??""),ok:w.ok===!0,...w.error?{error:w.error}:{},...w.entries?{entryCount:w.entries.length}:{},...w.installed?{installed:w.installed}:{}}});break;case"dsh_patches":t({type:"dsh_patches",patchDir:w.patchDir,files:w.files});break;case"dsh_presets":t({type:"dsh_presets",presets:w.presets,defaultPreset:w.defaultPreset});break;case"dsh_permission":t({type:"dsh_permission",options:w.options,defaultPreset:w.defaultPreset});break;case"plugin_data":ym(w.pluginId,w.payload);break}},O.onclose=()=>{if(n.current===O&&(n.current=null),r.current.clear(),!l.current||n.current&&n.current!==O)return;t({type:"status",status:"closed"});const F=Math.min(1e3*2**a.current,1e4);a.current+=1,c.current=setTimeout(()=>{c.current=null,Y()},F)},O.onerror=()=>{}},[]);o.useEffect(()=>{const O=F=>{const w=F.detail??eo();w&&B({type:"set_locale",locale:w})};return window.addEventListener(to,O),()=>window.removeEventListener(to,O)},[B]),o.useEffect(()=>{l.current=!0,Y();const O=setInterval(()=>{if(!l.current)return;const F=n.current;F&&F.readyState===WebSocket.OPEN&&Date.now()-u.current>3e4&&F.close()},5e3);return()=>{l.current=!1,clearInterval(O),c.current&&(clearTimeout(c.current),c.current=null),n.current?.close(),n.current=null}},[Y]),o.useEffect(()=>{const O=e.state?.cwd;if(O){if(!h.current){h.current=!0;const F=Pm();if(F&&F!==O){B({type:"set_cwd",path:F});return}}b.current!==O&&(b.current=O,Lm(O))}},[e.state?.cwd,B]),o.useEffect(()=>{$i({ready:e.ready,status:e.status,cwd:e.state?.cwd??"",workspaceRoots:e.state?.workspaceRoots??[],homeDir:e.state?.homeDir??"",desktopDir:e.state?.desktopDir??""})},[e.ready,e.status,e.state?.cwd,e.state?.workspaceRoots,e.state?.homeDir,e.state?.desktopDir]);const q=o.useCallback(O=>t({type:"dismiss_notice",id:O}),[]),C=o.useCallback(O=>t({type:"terminal_add",meta:O}),[]),Te=o.useCallback(O=>t({type:"terminal_remove",id:O}),[]),xe=o.useCallback(O=>t({type:"terminal_restart",terminalId:O}),[]),G=o.useCallback(O=>t({type:"terminal_active",id:O}),[]),ee=o.useCallback((O,F,w)=>r.current.register(O,F,w),[]),Q=o.useRef({chat:e,send:B,pushNotice:M,dismissNotice:q,terminal:{create:C,close:Te,register:ee,restart:xe,select:G}});return Q.current={chat:e,send:B,pushNotice:M,dismissNotice:q,terminal:{create:C,close:Te,register:ee,restart:xe,select:G}},Q.current}const Mm=200*1024*1024,Bm=/windows/i.test(navigator.userAgent),Fm=/[<>:"/\\|?*\u0000-\u001f]/g,Hm=/[. ]+$/,Um=/^(con|prn|aux|nul|com[1-9]|lpt[1-9])(\..*)?$/i;function $m(e){const t=e.replace(Fm,"_").replace(Hm,"");return t?Um.test(t)?`_${t}`:t:"_"}function ro(e,t=!0){const n=new URLSearchParams({clientId:Ea(),path:e,...t?{download:"1"}:{}});return hs(_t(`/api/file?${n}`))}const ic="FILE_NOT_FOUND";async function qm(e,t){const n=Bm?$m(t):t;try{const r=await fetch(ro(e));if(!r.ok)return{ok:!1,cancelled:!1,error:await r.text().catch(()=>"")||(r.status===404?ic:`HTTP ${r.status}`)};if(Number(r.headers.get("content-length")??"0")>Mm)return window.location.assign(ro(e)),{ok:!0};const c=await r.blob();return window.showSaveFilePicker&&window.isSecureContext?Wm(c,n):_r(c,n)}catch(r){return{ok:!1,cancelled:!1,error:r instanceof Error?r.message:String(r)}}}async function Wm(e,t){let n;const r=window.showSaveFilePicker;if(!r)return _r(e,t);try{n=await r({suggestedName:t})}catch(a){return a instanceof DOMException&&a.name==="AbortError"?{ok:!1,cancelled:!0}:_r(e,t)}try{const a=await n.createWritable();return await a.write(e),await a.close(),{ok:!0}}catch(a){return{ok:!1,cancelled:!1,error:a instanceof Error?a.message:String(a)}}}function _r(e,t){const n=URL.createObjectURL(e),r=document.createElement("a");return r.href=n,r.download=t,document.body.appendChild(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(n),1e4),{ok:!0}}const ss=8;function oc(e,t,n){let r=e.left-ss,a=e.bottom+ss;return r+t.width>n.width-ss&&(r=Math.max(ss,e.right+ss-t.width)),a+t.height>n.height-ss&&(a=Math.max(ss,e.top-ss-t.height)),{left:r,top:a}}function Km(){return typeof window<"u"&&window.matchMedia?.("(hover: hover) and (pointer: fine)")?.matches===!0}function Et({text:e}){const t=o.useRef(null),n=o.useRef(null),[r,a]=o.useState(!1),[c,l]=o.useState({left:0,top:0}),u=()=>{const m=t.current?.getBoundingClientRect();m&&(l({left:Math.max(8,m.left-8),top:m.bottom+8}),a(!0))},d=()=>a(!1);return o.useEffect(()=>{if(!r)return;const m=n.current,f=t.current;if(!m||!f)return;const h=m.getBoundingClientRect(),b=f.getBoundingClientRect(),E=oc(b,h,{width:window.innerWidth,height:window.innerHeight});l(N=>N.left===E.left&&N.top===E.top?N:E)},[r,e]),o.useEffect(()=>{if(!r)return;const m=()=>a(!1);return window.addEventListener("scroll",m,!0),window.addEventListener("resize",m),()=>{window.removeEventListener("scroll",m,!0),window.removeEventListener("resize",m)}},[r]),s.jsxs("span",{ref:t,className:"set-tip",tabIndex:0,"aria-label":e,onMouseEnter:u,onMouseLeave:d,onFocus:u,onBlur:d,onKeyDown:m=>{m.key==="Escape"&&m.target.blur()},children:["?",r&&In.createPortal(s.jsx("span",{ref:n,className:"set-tip-bubble open",role:"tooltip",style:{position:"fixed",left:c.left,top:c.top},children:e}),document.body)]})}function Gm(e){return e instanceof Error?e.message:String(e)}function Ym(e,t,n,r){const a=n==="zh";switch(e.kind){case"no-client":return a?`插件 ${t} 没有客户端脚本(client/entry.mjs),无法显示这一页。`:`Plugin ${t} ships no client bundle (client/entry.mjs), so this page cannot be shown.`;case"load":return a?`插件 ${t} 的页面脚本加载失败:${e.detail}`:`Failed to load plugin ${t}'s page bundle: ${e.detail}`;case"mount":return`${r("pluginMountFailed",{name:t})}:${e.detail}`}}function lc({plugin:e,epoch:t,send:n,className:r}){const a=o.useRef(null),{locale:c}=Vt(),l=He(),[u,d]=o.useState(null),m=o.useRef(n);o.useEffect(()=>{m.current=n},[n]),o.useEffect(()=>{const h=a.current;if(!h)return;let b=!1,E,N=!1;if(d(null),!e.hasClient){d({kind:"no-client"});return}return(async()=>{try{if(await Sr(e,t),b)return;const g=await Xl(e.id,()=>import(_t(`/plugins/${encodeURIComponent(e.id)}/client/entry.mjs?e=${t}`)));if(b)return;const R=g.default;if(!R||typeof R.mount!="function")throw new Error("client/entry.mjs 没有导出 default.mount()");N=!0,E=R.mount(h,ac(e.id,M=>m.current(M)))}catch(g){if(b)return;console.error(`[plugin:${e.id}] 页面${N?"挂载":"加载"}失败:`,g),d({kind:N?"mount":"load",detail:Gm(g)})}})(),()=>{if(b=!0,typeof E=="function")try{E()}catch(g){console.error(`[plugin:${e.id}] cleanup 失败:`,g)}h.textContent=""}},[e.id,e.hasClient,t]);const f=r?`plugin-page ${r}`:"plugin-page";return s.jsxs("div",{className:f,children:[s.jsx("div",{className:"plugin-page-host",ref:a}),u&&s.jsx("div",{className:"plugin-page-error",role:"alert",children:Ym(u,e.name,c,l)})]})}function cc(e){return`pi-web-ui:${e}:tab`}function zm(e,t){try{const n=localStorage.getItem(cc(e));return n&&t.some(r=>r.id===n)?n:null}catch{return null}}function io(e,t){try{localStorage.setItem(cc(e),t)}catch{}}function Vm(e){return e.length>0&&!/[a-z]/i.test(e)}function oo(e){if(e.label)return e.label;const t=e.pluginPage;return t?.entry.label||t?.plugin.name||e.id}function Qm({storageKey:e,tabs:t,epoch:n,send:r,extra:a,className:c}){const l=o.useId(),[u,d]=o.useState(()=>zm(e,t)??t[0]?.id??""),m=o.useRef([]),f=o.useRef(""),h=t.findIndex(B=>B.id===u),b=h>=0?t[h]:t[0],E=b?t.indexOf(b):-1;o.useEffect(()=>{if(!b)return;u!==b.id&&d(b.id);const B=`${e}:${b.id}`;f.current!==B&&(f.current=B,io(e,b.id))},[b,u,e]);const N=B=>{d(B.id),f.current=`${e}:${B.id}`,io(e,B.id)},g=(B,j)=>{const Y=t.length;let q=-1;if(B.key==="ArrowRight")q=(j+1)%Y;else if(B.key==="ArrowLeft")q=(j-1+Y)%Y;else if(B.key==="Home")q=0;else if(B.key==="End")q=Y-1;else return;const C=t[q];C&&(B.preventDefault(),N(C),m.current[q]?.focus())};if(!b)return null;const R=`${l}-panel-${E}`,M=c?`slot-tabs ${c}`:"slot-tabs";return s.jsxs("div",{className:M,children:[s.jsxs("div",{className:"slot-tabs-bar",role:"tablist",children:[t.map((B,j)=>{const Y=j===E;return s.jsxs("button",{type:"button",role:"tab",id:`${l}-tab-${j}`,className:Y?"slot-tab active":"slot-tab",title:B.hint??oo(B),"aria-selected":Y,"aria-controls":`${l}-panel-${j}`,tabIndex:Y?0:-1,ref:q=>{m.current[j]=q},onClick:()=>N(B),onKeyDown:q=>g(q,j),children:[B.icon&&Vm(B.icon)?s.jsx("span",{className:"slot-tab-icon",children:B.icon}):null,s.jsx("span",{className:"slot-tab-label",children:oo(B)})]},B.id)}),a?s.jsx("div",{className:"slot-tabs-extra",children:a}):null]}),s.jsx("div",{className:"slot-tabs-body",id:R,role:"tabpanel","aria-labelledby":`${l}-tab-${E}`,children:b.pluginPage?s.jsx(lc,{plugin:b.pluginPage.plugin,epoch:n,send:r}):b.element??null})]})}const bs="@root",lo="pi-web-ui:rp-sizes",za={files:4,widgets:1},co=120,uo=56;function Xm(e,t){return t?Math.max(0,t.getBoundingClientRect().top-e.getBoundingClientRect().top):32}const Jm="files",Zm=[],eh=()=>{};function th(e){const t=e.endsWith("/")&&e!=="/"?e.slice(0,-1):e,n=t.lastIndexOf("/");return n<0?"":n===0?"/":t.slice(0,n)}function sn(e){return e===bs||e==="/"||/^[A-Za-z]:$/.test(e)}function sh(e){return e.startsWith("/")||/^[A-Za-z]:([/]|$)/.test(e)}const nh=o.memo(function({files:t,fileChanged:n,widgets:r,panelSend:a,onAttach:c,onPreview:l,onNotice:u,collapsible:d,onToggleCollapse:m,uiRightPanelTabs:f,uiContextFile:h,plugins:b,pluginsEpoch:E,send:N}){const g=He(),R=b??Zm,M=$t("cwd"),B=$t("workspaceRoots"),j=$t("homeDir"),Y=$t("desktopDir"),[q,C]=o.useState(""),[Te,xe]=o.useState(null),[G,ee]=o.useState(!1),Q=o.useRef(null),O=o.useRef(null),[F,w]=o.useState(()=>{try{return Yl(localStorage.getItem(lo),za)}catch{return{...za}}});o.useEffect(()=>{try{localStorage.setItem(lo,JSON.stringify(F))}catch{}},[F]);const se=r.some(v=>v.lines.length>0),z=o.useCallback(v=>{v.preventDefault();const te=Q.current;if(!te)return;const Be=v.currentTarget,ht=v.clientY,nt={above:F.files,below:F.widgets},yt=Math.max(120,te.clientHeight-Xm(te,O.current));Be.classList.add("dragging"),document.body.classList.add("rp-resizing");const Xt=ae=>{const{above:Se,below:Me}=zl({start:nt,deltaPx:ae.clientY-ht,availablePx:yt,totalWeight:nt.above+nt.below,minAbovePx:co,minBelowPx:uo});w({files:Se,widgets:Me})},k=()=>{window.removeEventListener("pointermove",Xt),window.removeEventListener("pointerup",k),Be.classList.remove("dragging"),document.body.classList.remove("rp-resizing")};window.addEventListener("pointermove",Xt),window.addEventListener("pointerup",k)},[F.files,F.widgets]),A=o.useRef(null),ue=o.useRef(0),P=o.useCallback(v=>{A.current=v,v&&(v.scrollTop=ue.current)},[]),[ie,I]=o.useState(null),he=o.useRef(null);o.useEffect(()=>()=>{he.current&&clearTimeout(he.current)},[]);const _=o.useCallback(v=>{I(v),he.current&&clearTimeout(he.current),he.current=setTimeout(()=>I(null),1200)},[]),re=v=>{try{const te=document.createElement("textarea");te.value=v,te.style.position="fixed",te.style.opacity="0",document.body.appendChild(te),te.select();const Be=document.execCommand("copy");return document.body.removeChild(te),Be}catch{return!1}},le=o.useCallback((v,te)=>{if(!v)return;const Be=()=>_(te),ht=()=>u("error",g("slashCopyFailed")),nt=navigator;nt.clipboard?.writeText?nt.clipboard.writeText(v).then(Be,()=>{re(v)?Be():ht()}):re(v)?Be():ht()},[_,u,g]),Ee=o.useCallback(v=>{if(!v)return M;if(/^[A-Za-z]:$/.test(v))return`${v}/`;if(v.startsWith("/")||/^[A-Za-z]:([/]|$)/.test(v))return v;const te=M.replace(/\\/g,"/").replace(/\/+$/,"");return te?`${te}/${v}`:v},[M]),Ne=o.useCallback(v=>!v||v===bs?null:v.startsWith("/")||/^[A-Za-z]:([/]|$)/.test(v)?v:`${M.replace(/\\/g,"/").replace(/\/+$/,"")}/${v}`,[M]),Ue=o.useCallback((v,te)=>{for(const Be of te){const ht=new FileReader;ht.onload=()=>{const nt=ht.result,yt=nt.slice(nt.indexOf(",")+1);yt&&a({type:"upload_file",dirPath:v,name:Be.name,data:yt})},ht.readAsDataURL(Be)}},[a]),ke=o.useRef(null),Ke=o.useRef(null),Ie=o.useCallback(()=>{const v=ke.current?.project;v&&a({type:"set_cwd",path:v.path})},[a]),ce=o.useCallback(()=>{Ke.current&&(Ke.current.value=""),Ke.current?.click()},[]),[pe,Fe]=o.useState(null),[Ae,et]=o.useState(null),[dt,Ve]=o.useState(""),[X,we]=o.useState(null),[L,W]=o.useState(""),oe=o.useCallback((v,te)=>{qm(v,te).then(Be=>{Be.ok||Be.cancelled||u("error",g("downloadFailed",{error:Be.error===ic?g("fileNotFoundShort"):Be.error}))})},[u,g]),fe=o.useCallback(()=>{const v=ke.current?.target;!v||v.kind==="list"||sn(v.id)||(we(null),Ve(v.label),et(v.id))},[]),de=o.useCallback(()=>{if(!Ae)return;const v=dt.trim();et(null),v&&a({type:"file_rename",path:Ae,newName:v})},[Ae,dt,a]),ge=o.useCallback(v=>{const te=ke.current?.dir??q;et(null),W(""),we({dir:te,kind:v})},[q]),Qe=o.useCallback(()=>{if(!X)return;const v=L.trim();we(null),v&&a({type:"file_create",dir:X.dir,name:v,kind:X.kind})},[X,L,a]),ye=(v,te,Be,ht)=>s.jsx("input",{autoFocus:!0,className:"session-rename-input",value:v,placeholder:g("fileNamePlaceholder"),onClick:nt=>nt.stopPropagation(),onChange:nt=>te(nt.target.value),onKeyDown:nt=>{nt.stopPropagation(),nt.key==="Enter"&&!nt.nativeEvent.isComposing?Be():nt.key==="Escape"&&ht()},onBlur:ht}),Oe=o.useCallback(()=>{const v=ke.current?.target;!v||v.kind==="list"||sn(v.id)||window.confirm(g("fileDeleteConfirm",{name:v.label}))&&(pe?.src===v.id&&Fe(null),Ae===v.id&&et(null),a({type:"file_delete",path:v.id}))},[a,g,pe,Ae]),rt=o.useCallback(()=>{const v=ke.current?.target;!v||v.kind==="list"||sn(v.id)||a({type:"file_copy",src:v.id,destDir:th(v.id)})},[a]),Ge=o.useCallback(v=>{const te=ke.current?.target;!te||te.kind==="list"||sn(te.id)||Fe({src:te.id,cut:v})},[]),D=o.useCallback(()=>{if(!pe)return;const v=ke.current?.dir??q;pe.cut?(a({type:"file_copy",src:pe.src,destDir:v,move:!0}),Fe(null)):a({type:"file_copy",src:pe.src,destDir:v})},[pe,a,q]),$e=o.useCallback(()=>{a({type:"list_files",path:q===""?void 0:q})},[a,q]),[it,Xe]=o.useState(!1);o.useEffect(()=>{if(!it)return;const v=Be=>{Be.target?.closest(".root-picker")||Xe(!1)},te=Be=>{Be.key==="Escape"&&Xe(!1)};return window.addEventListener("mousedown",v,!0),window.addEventListener("keydown",te),()=>{window.removeEventListener("mousedown",v,!0),window.removeEventListener("keydown",te)}},[it]);const U=o.useCallback(v=>{a({type:"set_workspace_roots",roots:v})},[a]),Pe=o.useCallback(()=>{const v=ke.current?.target;if(!v||v.kind!=="dir")return;const te=Ne(v.id);!te||B.includes(te)||U([...B,te])},[B,Ne,U]),Le=o.useCallback(v=>{Ue(ke.current?.dir??q,Array.from(v.target.files??[]))},[Ue,q]),ot=o.useCallback(v=>{const te=ke.current?.target;switch(v.id){case"host:file-open-project":Ie();break;case"host:file-upload":ce();break;case"host:file-add-root":Pe();break;case"host:file-open":te?.kind==="file"&&l(te.id,te.label);break;case"host:file-enter":te?.kind==="dir"&&Lt(te.id);break;case"host:file-download":te?.kind==="file"&&oe(te.id,te.label);break;case"host:file-attach-inline":te?.kind==="file"&&c(te.id,te.label,"inline");break;case"host:file-attach-ref":te?.kind==="file"&&c(te.id,te.label,"reference");break;case"host:file-attach-folder":te?.kind==="dir"&&c(te.id,te.label,"reference",!0);break;case"host:file-new-file":ge("file");break;case"host:file-new-dir":ge("dir");break;case"host:file-paste":D();break;case"host:file-rename":fe();break;case"host:file-duplicate":rt();break;case"host:file-cut":Ge(!0);break;case"host:file-copy":Ge(!1);break;case"host:file-copy-name":te&&te.kind!=="list"&&le(te.label,`name:${te.id}`);break;case"host:file-copy-path":te&&te.kind!=="list"&&le(Ee(te.id),`path:${te.id}`);break;case"host:file-copy-rel":te&&te.kind!=="list"&&le(te.id,`rel:${te.id}`);break;case"host:file-refresh":$e();break;case"host:file-delete":Oe();break}},[Ie,ce,Pe,l,c,le,Ee,oe,ge,D,fe,rt,Ge,$e,Oe]),Ye=o.useCallback((v,te)=>{const Be=te.kind==="dir"?Ne(te.id):null,ht={target:te,dir:te.kind==="dir"?te.id:q,project:Be?{path:Be,name:te.label}:null},nt=te.kind,yt=nt==="file",Xt=nt==="dir",k=nt==="list",ae=!k&&sn(te.id),Se=!k&&sh(te.id),Me=q===bs,We=(h??[]).map(De=>{if(De.source!=="host")return De;switch(De.id){case"host:file-upload":return yt||Me?{...De,hidden:!0}:{...De,label:ht.dir===q?g("uploadToCurrentDir"):g("uploadToFolder")};case"host:file-open-project":return Be?De:{...De,hidden:!0};case"host:file-add-root":return!!Be&&Be!==M&&!B.includes(Be)?De:{...De,hidden:!0};case"host:file-open":case"host:file-download":case"host:file-attach-inline":case"host:file-attach-ref":return yt?De:{...De,hidden:!0};case"host:file-enter":case"host:file-attach-folder":return Xt?De:{...De,hidden:!0};case"host:file-new-file":case"host:file-new-dir":return!yt&&!Me?De:{...De,hidden:!0};case"host:file-paste":return!yt&&!Me&&pe?De:{...De,hidden:!0};case"host:file-rename":case"host:file-duplicate":case"host:file-cut":case"host:file-copy":case"host:file-delete":return!k&&!ae?De:{...De,hidden:!0};case"host:file-copy-name":case"host:file-copy-path":return k?{...De,hidden:!0}:De;case"host:file-copy-rel":return!k&&!Se?De:{...De,hidden:!0};case"host:file-refresh":return k?De:{...De,hidden:!0};default:return De}});fa(We).length!==0&&(v.preventDefault(),v.stopPropagation(),ke.current=ht,Pa({x:v.clientX,y:v.clientY,slot:"contextmenu.file",target:te,entries:We,onHostAction:ot}))},[h,q,Ne,g,ot,M,B,pe]),ct=v=>Array.from(v.dataTransfer?.types??[]).includes("Files"),mt=o.useCallback(()=>{A.current?.querySelectorAll(".file-item.drop-target").forEach(v=>v.classList.remove("drop-target")),A.current?.classList.remove("drop-root")},[]),Mt=o.useCallback(v=>{if(mt(),v==null)return;const te=A.current?.querySelector(`.file-item[data-path="${CSS.escape(v)}"]`);te?te.classList.add("drop-target"):A.current?.classList.add("drop-root")},[mt]),$=v=>{const te=v instanceof Element?v.closest(".file-item"):null;return te?.dataset.type==="dir"?te.dataset.path??q:q},Z=o.useCallback(()=>{const v=document.querySelector(".app");v&&v.dispatchEvent(new DragEvent("dragleave",{bubbles:!0}))},[]),Re=1e4,je=o.useRef(0),Je=o.useRef(void 0),qe=o.useCallback((v,te)=>{const Be=++je.current;C(v),te?.silent||ee(!0),a({type:"list_files",path:v===""?void 0:v})||je.current===Be&&ee(!1)},[a]),At=o.useCallback(v=>{const te=B.filter(Be=>Be!==v);U(te),(q===v||q.startsWith(`${v}/`))&&qe("")},[B,U,q,qe]);o.useEffect(()=>{t&&t.path===q&&ee(!1)},[t,q]),o.useEffect(()=>{if(M!==Je.current){Je.current=M,qe("",{silent:!0});return}const v=setInterval(()=>{document.visibilityState!=="hidden"&&qe(q,{silent:!0})},Re);return()=>clearInterval(v)},[M,q,qe]),o.useEffect(()=>{n&&n.path===q&&qe(q,{silent:!0})},[n,q,qe]);const Lt=v=>qe(v),jt=()=>{t?.parent!==null&&t?.parent!==void 0&&qe(t.parent)},us=(()=>{if(q===""||q===bs)return[];const v=q.split("/").filter(te=>!!te&&te!==bs);return q.startsWith("/")?v.map((te,Be)=>({label:Be===0?"/":v[Be],path:"/"+v.slice(0,Be+1).join("/")})):v.map((te,Be)=>({label:v[Be],path:v.slice(0,Be+1).join("/")}))})(),Qt=[];for(const v of f??[]){if(v.source==="host"||v.hidden||v.kind==="divider")continue;const te=R.find(Be=>Be.id===v.source.slice(7));te&&Qt.push({id:v.id,label:v.label,icon:v.icon,hint:v.hint,pluginPage:{plugin:te,entry:v}})}const Ut=(f??[]).some(v=>v.id==="host:right-files"&&v.hidden);return s.jsxs("aside",{className:"panel panel-right",ref:Q,children:[d&&m&&s.jsx("button",{type:"button",className:"panel-collapse-btn",title:g("collapsePanel"),onClick:m,children:s.jsx(vl,{})}),s.jsx("div",{ref:O,style:{display:"flex",flexDirection:"column",flex:se?`${F.files} 1 0`:"1 1 0",minHeight:se?co:0},children:s.jsx(Qm,{storageKey:"rightpanel",epoch:E??0,send:N??eh,tabs:[...Ut?[]:[{id:Jm,label:g("openFiles"),element:s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"panel-crumbs",children:[s.jsx("button",{type:"button",className:`crumb ${q===""?"active":""}`,onClick:()=>qe(""),children:g("rootDir")}),s.jsx("button",{type:"button",className:`crumb ${q===bs?"active":""}`,title:g("computer"),onClick:()=>qe(bs),children:"💻"}),j!==""&&s.jsx("button",{type:"button",className:`crumb ${q===j||q.startsWith(`${j}/`)?"active":""}`,title:g("homeDir"),onClick:()=>qe(j),children:"🏠"}),Y!==""&&s.jsx("button",{type:"button",className:`crumb ${q===Y||q.startsWith(`${Y}/`)?"active":""}`,title:g("desktopDir"),onClick:()=>qe(Y),children:"🖥️"}),s.jsx(Et,{text:g("filesHelp")}),B.length>0&&s.jsxs("div",{className:"root-picker",children:[s.jsxs("button",{type:"button",className:"crumb root-picker-trigger","aria-haspopup":"menu","aria-expanded":it,title:g("workspaceRoots"),onClick:()=>Xe(v=>!v),children:[s.jsx(is,{}),s.jsx("span",{className:"root-picker-label",children:g("workspaceRoots")}),s.jsx("span",{className:"set-count",children:B.length+1}),"▾"]}),it&&s.jsxs("div",{className:"root-picker-menu",role:"menu",children:[s.jsx("div",{className:"root-picker-row",children:s.jsxs("button",{type:"button",role:"menuitem",className:q===""?"root-picker-item active":"root-picker-item",title:M,onClick:()=>{Xe(!1),qe("")},children:[g("rootDir"),s.jsx("span",{className:"root-picker-path",children:M})]})}),B.map(v=>s.jsxs("div",{className:"root-picker-row",children:[s.jsx("button",{type:"button",role:"menuitem",className:q===v?"root-picker-item active":"root-picker-item",title:v,onClick:()=>{Xe(!1),qe(v)},children:s.jsx("span",{className:"root-picker-path",children:v})}),s.jsx("button",{type:"button",className:"root-picker-remove",title:g("removeWorkspaceRoot"),"aria-label":g("removeWorkspaceRoot"),onClick:()=>At(v),children:s.jsx(bt,{})})]},v)),s.jsx("div",{className:"root-picker-hint",children:g("workspaceRootsHint")})]})]}),us.map(v=>s.jsxs("span",{className:"crumb-seg",children:[s.jsx(Os,{}),s.jsx("button",{type:"button",className:`crumb ${v.path===q?"active":""}`,onClick:()=>qe(v.path),children:v.label})]},v.path))]}),s.jsxs("div",{ref:P,className:"panel-body",onScroll:v=>{ue.current=v.currentTarget.scrollTop},onContextMenu:v=>Ye(v,{id:q,kind:"list",label:q===""?g("rootDir"):q===bs?g("computer"):q}),onDragOver:v=>{ct(v)&&(v.preventDefault(),v.stopPropagation(),v.dataTransfer.dropEffect="copy",Z(),Mt($(v.target)))},onDragLeave:v=>{v.relatedTarget&&v.currentTarget.contains(v.relatedTarget)||mt()},onDrop:v=>{if(mt(),!ct(v))return;v.preventDefault(),v.stopPropagation(),Z();const te=Array.from(v.dataTransfer?.files??[]);if(te.length===0){u("warning",g("foldersNotSupported"));return}Ue($(v.target),te)},onDragEnd:mt,children:[s.jsx("input",{ref:Ke,type:"file",multiple:!0,hidden:!0,onChange:Le}),X&&s.jsxs("div",{className:"file-item dir",children:[X.kind==="dir"?s.jsx(is,{className:"file-icon"}):s.jsx(vi,{className:"file-icon"}),ye(L,W,Qe,()=>we(null))]}),G&&s.jsx("div",{className:"panel-empty",children:g("loading")}),!G&&t&&t.path===q&&s.jsxs(s.Fragment,{children:[t.parent!=null&&s.jsxs("button",{type:"button",className:"file-item dir",onClick:jt,children:[s.jsx(is,{className:"file-icon"}),s.jsx("span",{className:"file-name",children:".."})]}),t.entries.map(v=>v.type==="dir"?s.jsxs("div",{className:`file-item dir${pe?.cut&&pe.src===v.path?" cut":""}`,"data-type":"dir","data-path":v.path,onContextMenu:te=>Ye(te,{id:v.path,kind:"dir",label:v.name}),children:[Ae===v.path?ye(dt,Ve,de,()=>et(null)):s.jsxs("button",{type:"button",className:"file-dir-main",onClick:()=>Lt(v.path),children:[s.jsx(is,{className:"file-icon"}),s.jsx("span",{className:"file-name",children:v.name})]}),s.jsx("button",{type:"button",className:"file-attach ref","data-tip":g("linkFolderTip"),"aria-label":g("linkFolderTip"),onClick:()=>c(v.path,v.name,"reference",!0),children:s.jsx(dr,{})}),s.jsx("button",{type:"button",className:`file-attach copy${ie===`name:${v.path}`?" copied":""}`,"data-tip":g("copyName"),"aria-label":g("copyName"),onClick:()=>le(v.name,`name:${v.path}`),children:ie===`name:${v.path}`?s.jsx(os,{}):s.jsx(cs,{})}),s.jsx("button",{type:"button",className:`file-attach copy${ie===`path:${v.path}`?" copied":""}`,"data-tip":g("copyPath"),"aria-label":g("copyPath"),onClick:()=>le(Ee(v.path),`path:${v.path}`),children:ie===`path:${v.path}`?s.jsx(os,{}):s.jsx(wi,{})})]},v.path):s.jsxs("div",{className:`file-item file${pe?.cut&&pe.src===v.path?" cut":""}`,"data-type":"file","data-path":v.path,onContextMenu:te=>Ye(te,{id:v.path,kind:"file",label:v.name}),children:[Ae===v.path?ye(dt,Ve,de,()=>et(null)):s.jsxs("button",{type:"button",className:"file-name",title:`${v.path} — ${g("previewFile")}`,onClick:()=>l(v.path,v.name),children:[s.jsx(vi,{className:"file-icon"}),s.jsx("span",{className:"file-name-text",children:v.name})]}),s.jsx("button",{type:"button",className:"file-attach download","data-tip":g("downloadFile"),onClick:()=>oe(v.path,v.name),children:s.jsx(Rs,{})}),s.jsx("button",{type:"button",className:"file-attach inline","data-tip":g("attachInlineTip"),onClick:()=>c(v.path,v.name,"inline"),children:s.jsx(Dt,{})}),s.jsx("button",{type:"button",className:"file-attach ref","data-tip":g("referenceTip"),"aria-label":g("referenceTip"),onClick:()=>c(v.path,v.name,"reference"),children:s.jsx(dr,{})}),s.jsx("button",{type:"button",className:`file-attach copy${ie===`name:${v.path}`?" copied":""}`,"data-tip":g("copyName"),"aria-label":g("copyName"),onClick:()=>le(v.name,`name:${v.path}`),children:ie===`name:${v.path}`?s.jsx(os,{}):s.jsx(cs,{})}),s.jsx("button",{type:"button",className:`file-attach copy${ie===`path:${v.path}`?" copied":""}`,"data-tip":g("copyPath"),"aria-label":g("copyPath"),onClick:()=>le(Ee(v.path),`path:${v.path}`),children:ie===`path:${v.path}`?s.jsx(os,{}):s.jsx(wi,{})})]},v.path)),t.truncated&&s.jsx("div",{className:"panel-empty files-truncated",children:g("filesTruncated")})]}),!G&&!t&&s.jsx("div",{className:"panel-empty",children:g("noFiles")})]})]})}],...Qt]})}),se&&s.jsx("div",{className:"rp-sash",onPointerDown:z,onDoubleClick:()=>w({...za}),title:g("dragToResize")}),se&&s.jsx("div",{className:"panel-widgets",style:{flexGrow:F.widgets,minHeight:uo},children:r.filter(v=>v.lines.length>0).map(v=>s.jsxs("div",{className:"widget",children:[s.jsxs("button",{type:"button",className:"widget-title widget-title-btn",title:g("widgetExpand"),onClick:()=>xe(v.key),children:[s.jsx("span",{children:v.key}),s.jsx(Fd,{})]}),s.jsx("pre",{className:"widget-lines",children:v.lines.join(`
326
326
  `)})]},v.key))}),Te&&(()=>{const v=r.find(te=>te.key===Te);return v?s.jsx("div",{className:"modal-backdrop",onClick:()=>xe(null),children:s.jsxs("div",{className:"widget-expand",onClick:te=>te.stopPropagation(),children:[s.jsxs("div",{className:"widget-expand-head",children:[s.jsx("span",{className:"widget-expand-title",children:v.key}),s.jsx("button",{type:"button",className:"btn",title:g("close"),onClick:()=>xe(null),children:s.jsx(bt,{})})]}),s.jsx("pre",{className:"widget-expand-lines",children:v.lines.join(`
327
327
  `)})]})}):null})()]})});function ah(e){ad(e,[/\r?\n|\r/g,rh])}function rh(){return{type:"break"}}function ih(){return function(e){ah(e)}}function oh(e){const t=String(e),n=[];return{toOffset:a,toPoint:r};function r(c){if(typeof c=="number"&&c>-1&&c<=t.length){let l=0;for(;;){let u=n[l];if(u===void 0){const d=po(t,n[l-1]);u=d===-1?t.length+1:d+1,n[l]=u}if(u>c)return{line:l+1,column:c-(l>0?n[l-1]:0)+1,offset:c};l++}}}function a(c){if(c&&typeof c.line=="number"&&typeof c.column=="number"&&!Number.isNaN(c.line)&&!Number.isNaN(c.column)){for(;n.length<c.line;){const u=n[n.length-1],d=po(t,u),m=d===-1?t.length+1:d+1;if(u===m)break;n.push(m)}const l=(c.line>1?n[c.line-2]:0)+c.column-1;if(l<n[c.line-1])return l}}}function po(e,t){const n=e.indexOf("\r",t),r=e.indexOf(`
328
328
  `,t);return r===-1?n:n===-1||n+1===r?r:n<r?n:r}const uc={}.hasOwnProperty,lh=Object.prototype;function ch(e,t){const n=t||{};return Xr({file:n.file||void 0,location:!1,schema:n.space==="svg"?Ia:Vr,verbose:n.verbose||!1},e)}function Xr(e,t){let n;switch(t.nodeName){case"#comment":{const r=t;return n={type:"comment",value:r.data},ea(e,r,n),n}case"#document":case"#document-fragment":{const r=t,a="mode"in r?r.mode==="quirks"||r.mode==="limited-quirks":!1;if(n={type:"root",children:dc(e,t.childNodes),data:{quirksMode:a}},e.file&&e.location){const c=String(e.file),l=oh(c),u=l.toPoint(0),d=l.toPoint(c.length);n.position={start:u,end:d}}return n}case"#documentType":{const r=t;return n={type:"doctype"},ea(e,r,n),n}case"#text":{const r=t;return n={type:"text",value:r.value},ea(e,r,n),n}default:return n=uh(e,t),n}}function dc(e,t){let n=-1;const r=[];for(;++n<t.length;){const a=Xr(e,t[n]);r.push(a)}return r}function uh(e,t){const n=e.schema;e.schema=t.namespaceURI===ws.svg?Ia:Vr;let r=-1;const a={};for(;++r<t.attrs.length;){const u=t.attrs[r],d=(u.prefix?u.prefix+":":"")+u.name;uc.call(lh,d)||(a[d]=u.value)}const l=(e.schema.space==="svg"?rd:id)(t.tagName,a,dc(e,t.childNodes));if(ea(e,t,l),l.tagName==="template"){const u=t,d=u.sourceCodeLocation,m=d&&d.startTag&&Us(d.startTag),f=d&&d.endTag&&Us(d.endTag),h=Xr(e,u.content);m&&f&&e.file&&(h.position={start:m.end,end:f.start}),l.content=h}return e.schema=n,l}function ea(e,t,n){if("sourceCodeLocation"in t&&t.sourceCodeLocation&&e.file){const r=dh(e,n,t.sourceCodeLocation);r&&(e.location=!0,n.position=r)}}function dh(e,t,n){const r=Us(n);if(t.type==="element"){const a=t.children[t.children.length-1];if(r&&!n.endTag&&a&&a.position&&a.position.end&&(r.end=Object.assign({},a.position.end)),e.verbose){const c={};let l;if(n.attrs)for(l in n.attrs)uc.call(n.attrs,l)&&(c[dl(e.schema,l).property]=Us(n.attrs[l]));ir(n.startTag);const u=Us(n.startTag),d=n.endTag?Us(n.endTag):void 0,m={opening:u};d&&(m.closing=d),m.properties=c,t.data={position:m}}}return r}function Us(e){const t=mo({line:e.startLine,column:e.startCol,offset:e.startOffset}),n=mo({line:e.endLine,column:e.endCol,offset:e.endOffset});return t||n?{start:t,end:n}:void 0}function mo(e){return e.line&&e.column?e:void 0}const ph={},mh={}.hasOwnProperty,pc=pl("type",{handlers:{root:fh,element:yh,text:xh,comment:Eh,doctype:bh}});function hh(e,t){const r=(t||ph).space;return pc(e,r==="svg"?Ia:Vr)}function fh(e,t){const n={nodeName:"#document",mode:(e.data||{}).quirksMode?"quirks":"no-quirks",childNodes:[]};return n.childNodes=Jr(e.children,n,t),Xs(e,n),n}function gh(e,t){const n={nodeName:"#document-fragment",childNodes:[]};return n.childNodes=Jr(e.children,n,t),Xs(e,n),n}function bh(e){const t={nodeName:"#documentType",name:"html",publicId:"",systemId:"",parentNode:null};return Xs(e,t),t}function xh(e){const t={nodeName:"#text",value:e.value,parentNode:null};return Xs(e,t),t}function Eh(e){const t={nodeName:"#comment",data:e.value,parentNode:null};return Xs(e,t),t}function yh(e,t){const n=t;let r=n;e.type==="element"&&e.tagName.toLowerCase()==="svg"&&n.space==="html"&&(r=Ia);const a=[];let c;if(e.properties){for(c in e.properties)if(c!=="children"&&mh.call(e.properties,c)){const d=Th(r,c,e.properties[c]);d&&a.push(d)}}const l=r.space,u={nodeName:e.tagName,tagName:e.tagName,attrs:a,namespaceURI:ws[l],childNodes:[],parentNode:null};return u.childNodes=Jr(e.children,u,r),Xs(e,u),e.tagName==="template"&&e.content&&(u.content=gh(e.content,r)),u}function Th(e,t,n){const r=dl(e,t);if(n===!1||n===null||n===void 0||typeof n=="number"&&Number.isNaN(n)||!n&&r.boolean)return;Array.isArray(n)&&(n=r.commaSeparated?od(n):ld(n));const a={name:r.attribute,value:n===!0?"":String(n)};if(r.space&&r.space!=="html"&&r.space!=="svg"){const c=a.name.indexOf(":");c<0?a.prefix="":(a.name=a.name.slice(c+1),a.prefix=r.attribute.slice(0,c)),a.namespace=ws[r.space]}return a}function Jr(e,t,n){let r=-1;const a=[];if(e)for(;++r<e.length;){const c=pc(e[r],n);c.parentNode=t,a.push(c)}return a}function Xs(e,t){const n=e.position;n&&n.start&&n.end&&(ir(typeof n.start.offset=="number"),ir(typeof n.end.offset=="number"),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})}const kh=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"],Nh=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]),gt="�";var x;(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"})(x||(x={}));const Ht={DASH_DASH:"--",CDATA_START:"[CDATA[",DOCTYPE:"doctype",SCRIPT:"script",PUBLIC:"public",SYSTEM:"system"};function mc(e){return e>=55296&&e<=57343}function vh(e){return e>=56320&&e<=57343}function Ch(e,t){return(e-55296)*1024+9216+t}function hc(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function fc(e){return e>=64976&&e<=65007||Nh.has(e)}var V;(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"})(V||(V={}));const wh=65536;class Sh{constructor(t){this.handler=t,this.html="",this.pos=-1,this.lastGapPos=-2,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=wh,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.line=1,this.lastErrOffset=-1}get col(){return this.pos-this.lineStartPos+ +(this.lastGapPos!==this.pos)}get offset(){return this.droppedBufferSize+this.pos}getError(t,n){const{line:r,col:a,offset:c}=this,l=a+n,u=c+n;return{code:t,startLine:r,endLine:r,startCol:l,endCol:l,startOffset:u,endOffset:u}}_err(t){this.handler.onParseError&&this.lastErrOffset!==this.offset&&(this.lastErrOffset=this.offset,this.handler.onParseError(this.getError(t,0)))}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(t){if(this.pos!==this.html.length-1){const n=this.html.charCodeAt(this.pos+1);if(vh(n))return this.pos++,this._addGap(),Ch(t,n)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,x.EOF;return this._err(V.surrogateInInputStream),t}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(t,n){this.html.length>0?this.html+=t:this.html=t,this.endOfChunkHit=!1,this.lastChunkWritten=n}insertHtmlAtCurrentPos(t){this.html=this.html.substring(0,this.pos+1)+t+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(t,n){if(this.pos+t.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(n)return this.html.startsWith(t,this.pos);for(let r=0;r<t.length;r++)if((this.html.charCodeAt(this.pos+r)|32)!==t.charCodeAt(r))return!1;return!0}peek(t){const n=this.pos+t;if(n>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,x.EOF;const r=this.html.charCodeAt(n);return r===x.CARRIAGE_RETURN?x.LINE_FEED:r}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,x.EOF;let t=this.html.charCodeAt(this.pos);return t===x.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,x.LINE_FEED):t===x.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,mc(t)&&(t=this._processSurrogate(t)),this.handler.onParseError===null||t>31&&t<127||t===x.LINE_FEED||t===x.CARRIAGE_RETURN||t>159&&t<64976||this._checkForProblematicCharacters(t),t)}_checkForProblematicCharacters(t){hc(t)?this._err(V.controlCharacterInInputStream):fc(t)&&this._err(V.noncharacterInInputStream)}retreat(t){for(this.pos-=t;this.pos<this.lastGapPos;)this.lastGapPos=this.gapStack.pop(),this.pos--;this.isEol=!1}}var Ze;(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"})(Ze||(Ze={}));function gc(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}const _h=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୕ୖ୪୼஡௫ఄ౞಄ದ೘ൡඅ櫬Āou୛୤ngruent;扢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;怳Ādp໩໮uct;戏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ǣጓ\0጖y;䐎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Ā;t፜᜷brk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓ᝛ᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯ᝱ᝳ;䎲;愶een;扬r;쀀𝔟g΀costuvwឍឝឳេ៕៛៞ƀ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Ā;e᜚᜜lƀ;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\0᫢aĀ;t᫞᫟䀬;䁀ƀ;fl᫨᫩᫫戁îᅠeĀmx᫱᫶ent»᫩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ↄⅪ←ٖ↛ǰ↉\0↎proø₞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肻 ଷ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;䅓Ācr⵩⵭ir;榿;쀀𝔬ͯ⵹\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\0⹻m;櫳;櫽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))),Ah=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]]);function jh(e){var t;return e>=55296&&e<=57343||e>1114111?65533:(t=Ah.get(e))!==null&&t!==void 0?t:e}var St;(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"})(St||(St={}));const Ih=32;var ys;(function(e){e[e.VALUE_LENGTH=49152]="VALUE_LENGTH",e[e.BRANCH_LENGTH=16256]="BRANCH_LENGTH",e[e.JUMP_TABLE=127]="JUMP_TABLE"})(ys||(ys={}));function Ar(e){return e>=St.ZERO&&e<=St.NINE}function Rh(e){return e>=St.UPPER_A&&e<=St.UPPER_F||e>=St.LOWER_A&&e<=St.LOWER_F}function Ph(e){return e>=St.UPPER_A&&e<=St.UPPER_Z||e>=St.LOWER_A&&e<=St.LOWER_Z||Ar(e)}function Lh(e){return e===St.EQUALS||Ph(e)}var Ct;(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"})(Ct||(Ct={}));var ms;(function(e){e[e.Legacy=0]="Legacy",e[e.Strict=1]="Strict",e[e.Attribute=2]="Attribute"})(ms||(ms={}));class Dh{constructor(t,n,r){this.decodeTree=t,this.emitCodePoint=n,this.errors=r,this.state=Ct.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=ms.Strict}startEntity(t){this.decodeMode=t,this.state=Ct.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(t,n){switch(this.state){case Ct.EntityStart:return t.charCodeAt(n)===St.NUM?(this.state=Ct.NumericStart,this.consumed+=1,this.stateNumericStart(t,n+1)):(this.state=Ct.NamedEntity,this.stateNamedEntity(t,n));case Ct.NumericStart:return this.stateNumericStart(t,n);case Ct.NumericDecimal:return this.stateNumericDecimal(t,n);case Ct.NumericHex:return this.stateNumericHex(t,n);case Ct.NamedEntity:return this.stateNamedEntity(t,n)}}stateNumericStart(t,n){return n>=t.length?-1:(t.charCodeAt(n)|Ih)===St.LOWER_X?(this.state=Ct.NumericHex,this.consumed+=1,this.stateNumericHex(t,n+1)):(this.state=Ct.NumericDecimal,this.stateNumericDecimal(t,n))}addToNumericResult(t,n,r,a){if(n!==r){const c=r-n;this.result=this.result*Math.pow(a,c)+Number.parseInt(t.substr(n,c),a),this.consumed+=c}}stateNumericHex(t,n){const r=n;for(;n<t.length;){const a=t.charCodeAt(n);if(Ar(a)||Rh(a))n+=1;else return this.addToNumericResult(t,r,n,16),this.emitNumericEntity(a,3)}return this.addToNumericResult(t,r,n,16),-1}stateNumericDecimal(t,n){const r=n;for(;n<t.length;){const a=t.charCodeAt(n);if(Ar(a))n+=1;else return this.addToNumericResult(t,r,n,10),this.emitNumericEntity(a,2)}return this.addToNumericResult(t,r,n,10),-1}emitNumericEntity(t,n){var r;if(this.consumed<=n)return(r=this.errors)===null||r===void 0||r.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(t===St.SEMI)this.consumed+=1;else if(this.decodeMode===ms.Strict)return 0;return this.emitCodePoint(jh(this.result),this.consumed),this.errors&&(t!==St.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(t,n){const{decodeTree:r}=this;let a=r[this.treeIndex],c=(a&ys.VALUE_LENGTH)>>14;for(;n<t.length;n++,this.excess++){const l=t.charCodeAt(n);if(this.treeIndex=Oh(r,a,this.treeIndex+Math.max(1,c),l),this.treeIndex<0)return this.result===0||this.decodeMode===ms.Attribute&&(c===0||Lh(l))?0:this.emitNotTerminatedNamedEntity();if(a=r[this.treeIndex],c=(a&ys.VALUE_LENGTH)>>14,c!==0){if(l===St.SEMI)return this.emitNamedEntityData(this.treeIndex,c,this.consumed+this.excess);this.decodeMode!==ms.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var t;const{result:n,decodeTree:r}=this,a=(r[n]&ys.VALUE_LENGTH)>>14;return this.emitNamedEntityData(n,a,this.consumed),(t=this.errors)===null||t===void 0||t.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(t,n,r){const{decodeTree:a}=this;return this.emitCodePoint(n===1?a[t]&~ys.VALUE_LENGTH:a[t+1],r),n===3&&this.emitCodePoint(a[t+2],r),r}end(){var t;switch(this.state){case Ct.NamedEntity:return this.result!==0&&(this.decodeMode!==ms.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case Ct.NumericDecimal:return this.emitNumericEntity(0,2);case Ct.NumericHex:return this.emitNumericEntity(0,3);case Ct.NumericStart:return(t=this.errors)===null||t===void 0||t.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case Ct.EntityStart:return 0}}}function Oh(e,t,n,r){const a=(t&ys.BRANCH_LENGTH)>>7,c=t&ys.JUMP_TABLE;if(a===0)return c!==0&&r===c?n:-1;if(c){const d=r-c;return d<0||d>=a?-1:e[n+d]-1}let l=n,u=l+a-1;for(;l<=u;){const d=l+u>>>1,m=e[d];if(m<r)l=d+1;else if(m>r)u=d-1;else return e[d+a]}return-1}var me;(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/"})(me||(me={}));var Ps;(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"})(Ps||(Ps={}));var Gt;(function(e){e.NO_QUIRKS="no-quirks",e.QUIRKS="quirks",e.LIMITED_QUIRKS="limited-quirks"})(Gt||(Gt={}));var H;(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"})(H||(H={}));var i;(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"})(i||(i={}));const Mh=new Map([[H.A,i.A],[H.ADDRESS,i.ADDRESS],[H.ANNOTATION_XML,i.ANNOTATION_XML],[H.APPLET,i.APPLET],[H.AREA,i.AREA],[H.ARTICLE,i.ARTICLE],[H.ASIDE,i.ASIDE],[H.B,i.B],[H.BASE,i.BASE],[H.BASEFONT,i.BASEFONT],[H.BGSOUND,i.BGSOUND],[H.BIG,i.BIG],[H.BLOCKQUOTE,i.BLOCKQUOTE],[H.BODY,i.BODY],[H.BR,i.BR],[H.BUTTON,i.BUTTON],[H.CAPTION,i.CAPTION],[H.CENTER,i.CENTER],[H.CODE,i.CODE],[H.COL,i.COL],[H.COLGROUP,i.COLGROUP],[H.DD,i.DD],[H.DESC,i.DESC],[H.DETAILS,i.DETAILS],[H.DIALOG,i.DIALOG],[H.DIR,i.DIR],[H.DIV,i.DIV],[H.DL,i.DL],[H.DT,i.DT],[H.EM,i.EM],[H.EMBED,i.EMBED],[H.FIELDSET,i.FIELDSET],[H.FIGCAPTION,i.FIGCAPTION],[H.FIGURE,i.FIGURE],[H.FONT,i.FONT],[H.FOOTER,i.FOOTER],[H.FOREIGN_OBJECT,i.FOREIGN_OBJECT],[H.FORM,i.FORM],[H.FRAME,i.FRAME],[H.FRAMESET,i.FRAMESET],[H.H1,i.H1],[H.H2,i.H2],[H.H3,i.H3],[H.H4,i.H4],[H.H5,i.H5],[H.H6,i.H6],[H.HEAD,i.HEAD],[H.HEADER,i.HEADER],[H.HGROUP,i.HGROUP],[H.HR,i.HR],[H.HTML,i.HTML],[H.I,i.I],[H.IMG,i.IMG],[H.IMAGE,i.IMAGE],[H.INPUT,i.INPUT],[H.IFRAME,i.IFRAME],[H.KEYGEN,i.KEYGEN],[H.LABEL,i.LABEL],[H.LI,i.LI],[H.LINK,i.LINK],[H.LISTING,i.LISTING],[H.MAIN,i.MAIN],[H.MALIGNMARK,i.MALIGNMARK],[H.MARQUEE,i.MARQUEE],[H.MATH,i.MATH],[H.MENU,i.MENU],[H.META,i.META],[H.MGLYPH,i.MGLYPH],[H.MI,i.MI],[H.MO,i.MO],[H.MN,i.MN],[H.MS,i.MS],[H.MTEXT,i.MTEXT],[H.NAV,i.NAV],[H.NOBR,i.NOBR],[H.NOFRAMES,i.NOFRAMES],[H.NOEMBED,i.NOEMBED],[H.NOSCRIPT,i.NOSCRIPT],[H.OBJECT,i.OBJECT],[H.OL,i.OL],[H.OPTGROUP,i.OPTGROUP],[H.OPTION,i.OPTION],[H.P,i.P],[H.PARAM,i.PARAM],[H.PLAINTEXT,i.PLAINTEXT],[H.PRE,i.PRE],[H.RB,i.RB],[H.RP,i.RP],[H.RT,i.RT],[H.RTC,i.RTC],[H.RUBY,i.RUBY],[H.S,i.S],[H.SCRIPT,i.SCRIPT],[H.SEARCH,i.SEARCH],[H.SECTION,i.SECTION],[H.SELECT,i.SELECT],[H.SOURCE,i.SOURCE],[H.SMALL,i.SMALL],[H.SPAN,i.SPAN],[H.STRIKE,i.STRIKE],[H.STRONG,i.STRONG],[H.STYLE,i.STYLE],[H.SUB,i.SUB],[H.SUMMARY,i.SUMMARY],[H.SUP,i.SUP],[H.TABLE,i.TABLE],[H.TBODY,i.TBODY],[H.TEMPLATE,i.TEMPLATE],[H.TEXTAREA,i.TEXTAREA],[H.TFOOT,i.TFOOT],[H.TD,i.TD],[H.TH,i.TH],[H.THEAD,i.THEAD],[H.TITLE,i.TITLE],[H.TR,i.TR],[H.TRACK,i.TRACK],[H.TT,i.TT],[H.U,i.U],[H.UL,i.UL],[H.SVG,i.SVG],[H.VAR,i.VAR],[H.WBR,i.WBR],[H.XMP,i.XMP]]);function Js(e){var t;return(t=Mh.get(e))!==null&&t!==void 0?t:i.UNKNOWN}const be=i,Bh={[me.HTML]:new Set([be.ADDRESS,be.APPLET,be.AREA,be.ARTICLE,be.ASIDE,be.BASE,be.BASEFONT,be.BGSOUND,be.BLOCKQUOTE,be.BODY,be.BR,be.BUTTON,be.CAPTION,be.CENTER,be.COL,be.COLGROUP,be.DD,be.DETAILS,be.DIR,be.DIV,be.DL,be.DT,be.EMBED,be.FIELDSET,be.FIGCAPTION,be.FIGURE,be.FOOTER,be.FORM,be.FRAME,be.FRAMESET,be.H1,be.H2,be.H3,be.H4,be.H5,be.H6,be.HEAD,be.HEADER,be.HGROUP,be.HR,be.HTML,be.IFRAME,be.IMG,be.INPUT,be.LI,be.LINK,be.LISTING,be.MAIN,be.MARQUEE,be.MENU,be.META,be.NAV,be.NOEMBED,be.NOFRAMES,be.NOSCRIPT,be.OBJECT,be.OL,be.P,be.PARAM,be.PLAINTEXT,be.PRE,be.SCRIPT,be.SECTION,be.SELECT,be.SOURCE,be.STYLE,be.SUMMARY,be.TABLE,be.TBODY,be.TD,be.TEMPLATE,be.TEXTAREA,be.TFOOT,be.TH,be.THEAD,be.TITLE,be.TR,be.TRACK,be.UL,be.WBR,be.XMP]),[me.MATHML]:new Set([be.MI,be.MO,be.MN,be.MS,be.MTEXT,be.ANNOTATION_XML]),[me.SVG]:new Set([be.TITLE,be.FOREIGN_OBJECT,be.DESC]),[me.XLINK]:new Set,[me.XML]:new Set,[me.XMLNS]:new Set},jr=new Set([be.H1,be.H2,be.H3,be.H4,be.H5,be.H6]);H.STYLE,H.SCRIPT,H.XMP,H.IFRAME,H.NOEMBED,H.NOFRAMES,H.PLAINTEXT;var y;(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"})(y||(y={}));const Tt={DATA:y.DATA,RCDATA:y.RCDATA,RAWTEXT:y.RAWTEXT,SCRIPT_DATA:y.SCRIPT_DATA,PLAINTEXT:y.PLAINTEXT,CDATA_SECTION:y.CDATA_SECTION};function Fh(e){return e>=x.DIGIT_0&&e<=x.DIGIT_9}function dn(e){return e>=x.LATIN_CAPITAL_A&&e<=x.LATIN_CAPITAL_Z}function Hh(e){return e>=x.LATIN_SMALL_A&&e<=x.LATIN_SMALL_Z}function xs(e){return Hh(e)||dn(e)}function ho(e){return xs(e)||Fh(e)}function qn(e){return e+32}function bc(e){return e===x.SPACE||e===x.LINE_FEED||e===x.TABULATION||e===x.FORM_FEED}function fo(e){return bc(e)||e===x.SOLIDUS||e===x.GREATER_THAN_SIGN}function Uh(e){return e===x.NULL?V.nullCharacterReference:e>1114111?V.characterReferenceOutsideUnicodeRange:mc(e)?V.surrogateCharacterReference:fc(e)?V.noncharacterCharacterReference:hc(e)||e===x.CARRIAGE_RETURN?V.controlCharacterReference:null}class $h{constructor(t,n){this.options=t,this.handler=n,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName="",this.active=!1,this.state=y.DATA,this.returnState=y.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new Sh(n),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new Dh(_h,(r,a)=>{this.preprocessor.pos=this.entityStartPos+a-1,this._flushCodePointConsumedAsCharacterReference(r)},n.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(V.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:r=>{this._err(V.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+r)},validateNumericCharacterReference:r=>{const a=Uh(r);a&&this._err(a,1)}}:void 0)}_err(t,n=0){var r,a;(a=(r=this.handler).onParseError)===null||a===void 0||a.call(r,this.preprocessor.getError(t,n))}getCurrentLocation(t){return this.options.sourceCodeLocationInfo?{startLine:this.preprocessor.line,startCol:this.preprocessor.col-t,startOffset:this.preprocessor.offset-t,endLine:-1,endCol:-1,endOffset:-1}:null}_runParsingLoop(){if(!this.inLoop){for(this.inLoop=!0;this.active&&!this.paused;){this.consumedAfterSnapshot=0;const t=this._consume();this._ensureHibernation()||this._callState(t)}this.inLoop=!1}}pause(){this.paused=!0}resume(t){if(!this.paused)throw new Error("Parser was already resumed");this.paused=!1,!this.inLoop&&(this._runParsingLoop(),this.paused||t?.())}write(t,n,r){this.active=!0,this.preprocessor.write(t,n),this._runParsingLoop(),this.paused||r?.()}insertHtmlAtCurrentPos(t){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(t),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(t){this.consumedAfterSnapshot+=t;for(let n=0;n<t;n++)this.preprocessor.advance()}_consumeSequenceIfMatch(t,n){return this.preprocessor.startsWith(t,n)?(this._advanceBy(t.length-1),!0):!1}_createStartTagToken(){this.currentToken={type:Ze.START_TAG,tagName:"",tagID:i.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(1)}}_createEndTagToken(){this.currentToken={type:Ze.END_TAG,tagName:"",tagID:i.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(2)}}_createCommentToken(t){this.currentToken={type:Ze.COMMENT,data:"",location:this.getCurrentLocation(t)}}_createDoctypeToken(t){this.currentToken={type:Ze.DOCTYPE,name:t,forceQuirks:!1,publicId:null,systemId:null,location:this.currentLocation}}_createCharacterToken(t,n){this.currentCharacterToken={type:t,chars:n,location:this.currentLocation}}_createAttr(t){this.currentAttr={name:t,value:""},this.currentLocation=this.getCurrentLocation(0)}_leaveAttrName(){var t,n;const r=this.currentToken;if(gc(r,this.currentAttr.name)===null){if(r.attrs.push(this.currentAttr),r.location&&this.currentLocation){const a=(t=(n=r.location).attrs)!==null&&t!==void 0?t:n.attrs=Object.create(null);a[this.currentAttr.name]=this.currentLocation,this._leaveAttrValue()}}else this._err(V.duplicateAttribute)}_leaveAttrValue(){this.currentLocation&&(this.currentLocation.endLine=this.preprocessor.line,this.currentLocation.endCol=this.preprocessor.col,this.currentLocation.endOffset=this.preprocessor.offset)}prepareToken(t){this._emitCurrentCharacterToken(t.location),this.currentToken=null,t.location&&(t.location.endLine=this.preprocessor.line,t.location.endCol=this.preprocessor.col+1,t.location.endOffset=this.preprocessor.offset+1),this.currentLocation=this.getCurrentLocation(-1)}emitCurrentTagToken(){const t=this.currentToken;this.prepareToken(t),t.tagID=Js(t.tagName),t.type===Ze.START_TAG?(this.lastStartTagName=t.tagName,this.handler.onStartTag(t)):(t.attrs.length>0&&this._err(V.endTagWithAttributes),t.selfClosing&&this._err(V.endTagWithTrailingSolidus),this.handler.onEndTag(t)),this.preprocessor.dropParsedChunk()}emitCurrentComment(t){this.prepareToken(t),this.handler.onComment(t),this.preprocessor.dropParsedChunk()}emitCurrentDoctype(t){this.prepareToken(t),this.handler.onDoctype(t),this.preprocessor.dropParsedChunk()}_emitCurrentCharacterToken(t){if(this.currentCharacterToken){switch(t&&this.currentCharacterToken.location&&(this.currentCharacterToken.location.endLine=t.startLine,this.currentCharacterToken.location.endCol=t.startCol,this.currentCharacterToken.location.endOffset=t.startOffset),this.currentCharacterToken.type){case Ze.CHARACTER:{this.handler.onCharacter(this.currentCharacterToken);break}case Ze.NULL_CHARACTER:{this.handler.onNullCharacter(this.currentCharacterToken);break}case Ze.WHITESPACE_CHARACTER:{this.handler.onWhitespaceCharacter(this.currentCharacterToken);break}}this.currentCharacterToken=null}}_emitEOFToken(){const t=this.getCurrentLocation(0);t&&(t.endLine=t.startLine,t.endCol=t.startCol,t.endOffset=t.startOffset),this._emitCurrentCharacterToken(t),this.handler.onEof({type:Ze.EOF,location:t}),this.active=!1}_appendCharToCurrentCharacterToken(t,n){if(this.currentCharacterToken)if(this.currentCharacterToken.type===t){this.currentCharacterToken.chars+=n;return}else this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk();this._createCharacterToken(t,n)}_emitCodePoint(t){const n=bc(t)?Ze.WHITESPACE_CHARACTER:t===x.NULL?Ze.NULL_CHARACTER:Ze.CHARACTER;this._appendCharToCurrentCharacterToken(n,String.fromCodePoint(t))}_emitChars(t){this._appendCharToCurrentCharacterToken(Ze.CHARACTER,t)}_startCharacterReference(){this.returnState=this.state,this.state=y.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?ms.Attribute:ms.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===y.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===y.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===y.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(t){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(t):this._emitCodePoint(t)}_callState(t){switch(this.state){case y.DATA:{this._stateData(t);break}case y.RCDATA:{this._stateRcdata(t);break}case y.RAWTEXT:{this._stateRawtext(t);break}case y.SCRIPT_DATA:{this._stateScriptData(t);break}case y.PLAINTEXT:{this._statePlaintext(t);break}case y.TAG_OPEN:{this._stateTagOpen(t);break}case y.END_TAG_OPEN:{this._stateEndTagOpen(t);break}case y.TAG_NAME:{this._stateTagName(t);break}case y.RCDATA_LESS_THAN_SIGN:{this._stateRcdataLessThanSign(t);break}case y.RCDATA_END_TAG_OPEN:{this._stateRcdataEndTagOpen(t);break}case y.RCDATA_END_TAG_NAME:{this._stateRcdataEndTagName(t);break}case y.RAWTEXT_LESS_THAN_SIGN:{this._stateRawtextLessThanSign(t);break}case y.RAWTEXT_END_TAG_OPEN:{this._stateRawtextEndTagOpen(t);break}case y.RAWTEXT_END_TAG_NAME:{this._stateRawtextEndTagName(t);break}case y.SCRIPT_DATA_LESS_THAN_SIGN:{this._stateScriptDataLessThanSign(t);break}case y.SCRIPT_DATA_END_TAG_OPEN:{this._stateScriptDataEndTagOpen(t);break}case y.SCRIPT_DATA_END_TAG_NAME:{this._stateScriptDataEndTagName(t);break}case y.SCRIPT_DATA_ESCAPE_START:{this._stateScriptDataEscapeStart(t);break}case y.SCRIPT_DATA_ESCAPE_START_DASH:{this._stateScriptDataEscapeStartDash(t);break}case y.SCRIPT_DATA_ESCAPED:{this._stateScriptDataEscaped(t);break}case y.SCRIPT_DATA_ESCAPED_DASH:{this._stateScriptDataEscapedDash(t);break}case y.SCRIPT_DATA_ESCAPED_DASH_DASH:{this._stateScriptDataEscapedDashDash(t);break}case y.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataEscapedLessThanSign(t);break}case y.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:{this._stateScriptDataEscapedEndTagOpen(t);break}case y.SCRIPT_DATA_ESCAPED_END_TAG_NAME:{this._stateScriptDataEscapedEndTagName(t);break}case y.SCRIPT_DATA_DOUBLE_ESCAPE_START:{this._stateScriptDataDoubleEscapeStart(t);break}case y.SCRIPT_DATA_DOUBLE_ESCAPED:{this._stateScriptDataDoubleEscaped(t);break}case y.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:{this._stateScriptDataDoubleEscapedDash(t);break}case y.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:{this._stateScriptDataDoubleEscapedDashDash(t);break}case y.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataDoubleEscapedLessThanSign(t);break}case y.SCRIPT_DATA_DOUBLE_ESCAPE_END:{this._stateScriptDataDoubleEscapeEnd(t);break}case y.BEFORE_ATTRIBUTE_NAME:{this._stateBeforeAttributeName(t);break}case y.ATTRIBUTE_NAME:{this._stateAttributeName(t);break}case y.AFTER_ATTRIBUTE_NAME:{this._stateAfterAttributeName(t);break}case y.BEFORE_ATTRIBUTE_VALUE:{this._stateBeforeAttributeValue(t);break}case y.ATTRIBUTE_VALUE_DOUBLE_QUOTED:{this._stateAttributeValueDoubleQuoted(t);break}case y.ATTRIBUTE_VALUE_SINGLE_QUOTED:{this._stateAttributeValueSingleQuoted(t);break}case y.ATTRIBUTE_VALUE_UNQUOTED:{this._stateAttributeValueUnquoted(t);break}case y.AFTER_ATTRIBUTE_VALUE_QUOTED:{this._stateAfterAttributeValueQuoted(t);break}case y.SELF_CLOSING_START_TAG:{this._stateSelfClosingStartTag(t);break}case y.BOGUS_COMMENT:{this._stateBogusComment(t);break}case y.MARKUP_DECLARATION_OPEN:{this._stateMarkupDeclarationOpen(t);break}case y.COMMENT_START:{this._stateCommentStart(t);break}case y.COMMENT_START_DASH:{this._stateCommentStartDash(t);break}case y.COMMENT:{this._stateComment(t);break}case y.COMMENT_LESS_THAN_SIGN:{this._stateCommentLessThanSign(t);break}case y.COMMENT_LESS_THAN_SIGN_BANG:{this._stateCommentLessThanSignBang(t);break}case y.COMMENT_LESS_THAN_SIGN_BANG_DASH:{this._stateCommentLessThanSignBangDash(t);break}case y.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:{this._stateCommentLessThanSignBangDashDash(t);break}case y.COMMENT_END_DASH:{this._stateCommentEndDash(t);break}case y.COMMENT_END:{this._stateCommentEnd(t);break}case y.COMMENT_END_BANG:{this._stateCommentEndBang(t);break}case y.DOCTYPE:{this._stateDoctype(t);break}case y.BEFORE_DOCTYPE_NAME:{this._stateBeforeDoctypeName(t);break}case y.DOCTYPE_NAME:{this._stateDoctypeName(t);break}case y.AFTER_DOCTYPE_NAME:{this._stateAfterDoctypeName(t);break}case y.AFTER_DOCTYPE_PUBLIC_KEYWORD:{this._stateAfterDoctypePublicKeyword(t);break}case y.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateBeforeDoctypePublicIdentifier(t);break}case y.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypePublicIdentifierDoubleQuoted(t);break}case y.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypePublicIdentifierSingleQuoted(t);break}case y.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateAfterDoctypePublicIdentifier(t);break}case y.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:{this._stateBetweenDoctypePublicAndSystemIdentifiers(t);break}case y.AFTER_DOCTYPE_SYSTEM_KEYWORD:{this._stateAfterDoctypeSystemKeyword(t);break}case y.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateBeforeDoctypeSystemIdentifier(t);break}case y.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypeSystemIdentifierDoubleQuoted(t);break}case y.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypeSystemIdentifierSingleQuoted(t);break}case y.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateAfterDoctypeSystemIdentifier(t);break}case y.BOGUS_DOCTYPE:{this._stateBogusDoctype(t);break}case y.CDATA_SECTION:{this._stateCdataSection(t);break}case y.CDATA_SECTION_BRACKET:{this._stateCdataSectionBracket(t);break}case y.CDATA_SECTION_END:{this._stateCdataSectionEnd(t);break}case y.CHARACTER_REFERENCE:{this._stateCharacterReference();break}case y.AMBIGUOUS_AMPERSAND:{this._stateAmbiguousAmpersand(t);break}default:throw new Error("Unknown state")}}_stateData(t){switch(t){case x.LESS_THAN_SIGN:{this.state=y.TAG_OPEN;break}case x.AMPERSAND:{this._startCharacterReference();break}case x.NULL:{this._err(V.unexpectedNullCharacter),this._emitCodePoint(t);break}case x.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRcdata(t){switch(t){case x.AMPERSAND:{this._startCharacterReference();break}case x.LESS_THAN_SIGN:{this.state=y.RCDATA_LESS_THAN_SIGN;break}case x.NULL:{this._err(V.unexpectedNullCharacter),this._emitChars(gt);break}case x.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRawtext(t){switch(t){case x.LESS_THAN_SIGN:{this.state=y.RAWTEXT_LESS_THAN_SIGN;break}case x.NULL:{this._err(V.unexpectedNullCharacter),this._emitChars(gt);break}case x.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptData(t){switch(t){case x.LESS_THAN_SIGN:{this.state=y.SCRIPT_DATA_LESS_THAN_SIGN;break}case x.NULL:{this._err(V.unexpectedNullCharacter),this._emitChars(gt);break}case x.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_statePlaintext(t){switch(t){case x.NULL:{this._err(V.unexpectedNullCharacter),this._emitChars(gt);break}case x.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateTagOpen(t){if(xs(t))this._createStartTagToken(),this.state=y.TAG_NAME,this._stateTagName(t);else switch(t){case x.EXCLAMATION_MARK:{this.state=y.MARKUP_DECLARATION_OPEN;break}case x.SOLIDUS:{this.state=y.END_TAG_OPEN;break}case x.QUESTION_MARK:{this._err(V.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=y.BOGUS_COMMENT,this._stateBogusComment(t);break}case x.EOF:{this._err(V.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break}default:this._err(V.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=y.DATA,this._stateData(t)}}_stateEndTagOpen(t){if(xs(t))this._createEndTagToken(),this.state=y.TAG_NAME,this._stateTagName(t);else switch(t){case x.GREATER_THAN_SIGN:{this._err(V.missingEndTagName),this.state=y.DATA;break}case x.EOF:{this._err(V.eofBeforeTagName),this._emitChars("</"),this._emitEOFToken();break}default:this._err(V.invalidFirstCharacterOfTagName),this._createCommentToken(2),this.state=y.BOGUS_COMMENT,this._stateBogusComment(t)}}_stateTagName(t){const n=this.currentToken;switch(t){case x.SPACE:case x.LINE_FEED:case x.TABULATION:case x.FORM_FEED:{this.state=y.BEFORE_ATTRIBUTE_NAME;break}case x.SOLIDUS:{this.state=y.SELF_CLOSING_START_TAG;break}case x.GREATER_THAN_SIGN:{this.state=y.DATA,this.emitCurrentTagToken();break}case x.NULL:{this._err(V.unexpectedNullCharacter),n.tagName+=gt;break}case x.EOF:{this._err(V.eofInTag),this._emitEOFToken();break}default:n.tagName+=String.fromCodePoint(dn(t)?qn(t):t)}}_stateRcdataLessThanSign(t){t===x.SOLIDUS?this.state=y.RCDATA_END_TAG_OPEN:(this._emitChars("<"),this.state=y.RCDATA,this._stateRcdata(t))}_stateRcdataEndTagOpen(t){xs(t)?(this.state=y.RCDATA_END_TAG_NAME,this._stateRcdataEndTagName(t)):(this._emitChars("</"),this.state=y.RCDATA,this._stateRcdata(t))}handleSpecialEndTag(t){if(!this.preprocessor.startsWith(this.lastStartTagName,!1))return!this._ensureHibernation();this._createEndTagToken();const n=this.currentToken;switch(n.tagName=this.lastStartTagName,this.preprocessor.peek(this.lastStartTagName.length)){case x.SPACE:case x.LINE_FEED:case x.TABULATION:case x.FORM_FEED:return this._advanceBy(this.lastStartTagName.length),this.state=y.BEFORE_ATTRIBUTE_NAME,!1;case x.SOLIDUS:return this._advanceBy(this.lastStartTagName.length),this.state=y.SELF_CLOSING_START_TAG,!1;case x.GREATER_THAN_SIGN:return this._advanceBy(this.lastStartTagName.length),this.emitCurrentTagToken(),this.state=y.DATA,!1;default:return!this._ensureHibernation()}}_stateRcdataEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=y.RCDATA,this._stateRcdata(t))}_stateRawtextLessThanSign(t){t===x.SOLIDUS?this.state=y.RAWTEXT_END_TAG_OPEN:(this._emitChars("<"),this.state=y.RAWTEXT,this._stateRawtext(t))}_stateRawtextEndTagOpen(t){xs(t)?(this.state=y.RAWTEXT_END_TAG_NAME,this._stateRawtextEndTagName(t)):(this._emitChars("</"),this.state=y.RAWTEXT,this._stateRawtext(t))}_stateRawtextEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=y.RAWTEXT,this._stateRawtext(t))}_stateScriptDataLessThanSign(t){switch(t){case x.SOLIDUS:{this.state=y.SCRIPT_DATA_END_TAG_OPEN;break}case x.EXCLAMATION_MARK:{this.state=y.SCRIPT_DATA_ESCAPE_START,this._emitChars("<!");break}default:this._emitChars("<"),this.state=y.SCRIPT_DATA,this._stateScriptData(t)}}_stateScriptDataEndTagOpen(t){xs(t)?(this.state=y.SCRIPT_DATA_END_TAG_NAME,this._stateScriptDataEndTagName(t)):(this._emitChars("</"),this.state=y.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=y.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEscapeStart(t){t===x.HYPHEN_MINUS?(this.state=y.SCRIPT_DATA_ESCAPE_START_DASH,this._emitChars("-")):(this.state=y.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEscapeStartDash(t){t===x.HYPHEN_MINUS?(this.state=y.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-")):(this.state=y.SCRIPT_DATA,this._stateScriptData(t))}_stateScriptDataEscaped(t){switch(t){case x.HYPHEN_MINUS:{this.state=y.SCRIPT_DATA_ESCAPED_DASH,this._emitChars("-");break}case x.LESS_THAN_SIGN:{this.state=y.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case x.NULL:{this._err(V.unexpectedNullCharacter),this._emitChars(gt);break}case x.EOF:{this._err(V.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptDataEscapedDash(t){switch(t){case x.HYPHEN_MINUS:{this.state=y.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-");break}case x.LESS_THAN_SIGN:{this.state=y.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case x.NULL:{this._err(V.unexpectedNullCharacter),this.state=y.SCRIPT_DATA_ESCAPED,this._emitChars(gt);break}case x.EOF:{this._err(V.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=y.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedDashDash(t){switch(t){case x.HYPHEN_MINUS:{this._emitChars("-");break}case x.LESS_THAN_SIGN:{this.state=y.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case x.GREATER_THAN_SIGN:{this.state=y.SCRIPT_DATA,this._emitChars(">");break}case x.NULL:{this._err(V.unexpectedNullCharacter),this.state=y.SCRIPT_DATA_ESCAPED,this._emitChars(gt);break}case x.EOF:{this._err(V.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=y.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedLessThanSign(t){t===x.SOLIDUS?this.state=y.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:xs(t)?(this._emitChars("<"),this.state=y.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(t)):(this._emitChars("<"),this.state=y.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagOpen(t){xs(t)?(this.state=y.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(t)):(this._emitChars("</"),this.state=y.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagName(t){this.handleSpecialEndTag(t)&&(this._emitChars("</"),this.state=y.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataDoubleEscapeStart(t){if(this.preprocessor.startsWith(Ht.SCRIPT,!1)&&fo(this.preprocessor.peek(Ht.SCRIPT.length))){this._emitCodePoint(t);for(let n=0;n<Ht.SCRIPT.length;n++)this._emitCodePoint(this._consume());this.state=y.SCRIPT_DATA_DOUBLE_ESCAPED}else this._ensureHibernation()||(this.state=y.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataDoubleEscaped(t){switch(t){case x.HYPHEN_MINUS:{this.state=y.SCRIPT_DATA_DOUBLE_ESCAPED_DASH,this._emitChars("-");break}case x.LESS_THAN_SIGN:{this.state=y.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case x.NULL:{this._err(V.unexpectedNullCharacter),this._emitChars(gt);break}case x.EOF:{this._err(V.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedDash(t){switch(t){case x.HYPHEN_MINUS:{this.state=y.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH,this._emitChars("-");break}case x.LESS_THAN_SIGN:{this.state=y.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case x.NULL:{this._err(V.unexpectedNullCharacter),this.state=y.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(gt);break}case x.EOF:{this._err(V.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=y.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedDashDash(t){switch(t){case x.HYPHEN_MINUS:{this._emitChars("-");break}case x.LESS_THAN_SIGN:{this.state=y.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case x.GREATER_THAN_SIGN:{this.state=y.SCRIPT_DATA,this._emitChars(">");break}case x.NULL:{this._err(V.unexpectedNullCharacter),this.state=y.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(gt);break}case x.EOF:{this._err(V.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=y.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedLessThanSign(t){t===x.SOLIDUS?(this.state=y.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=y.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateScriptDataDoubleEscapeEnd(t){if(this.preprocessor.startsWith(Ht.SCRIPT,!1)&&fo(this.preprocessor.peek(Ht.SCRIPT.length))){this._emitCodePoint(t);for(let n=0;n<Ht.SCRIPT.length;n++)this._emitCodePoint(this._consume());this.state=y.SCRIPT_DATA_ESCAPED}else this._ensureHibernation()||(this.state=y.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateBeforeAttributeName(t){switch(t){case x.SPACE:case x.LINE_FEED:case x.TABULATION:case x.FORM_FEED:break;case x.SOLIDUS:case x.GREATER_THAN_SIGN:case x.EOF:{this.state=y.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(t);break}case x.EQUALS_SIGN:{this._err(V.unexpectedEqualsSignBeforeAttributeName),this._createAttr("="),this.state=y.ATTRIBUTE_NAME;break}default:this._createAttr(""),this.state=y.ATTRIBUTE_NAME,this._stateAttributeName(t)}}_stateAttributeName(t){switch(t){case x.SPACE:case x.LINE_FEED:case x.TABULATION:case x.FORM_FEED:case x.SOLIDUS:case x.GREATER_THAN_SIGN:case x.EOF:{this._leaveAttrName(),this.state=y.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(t);break}case x.EQUALS_SIGN:{this._leaveAttrName(),this.state=y.BEFORE_ATTRIBUTE_VALUE;break}case x.QUOTATION_MARK:case x.APOSTROPHE:case x.LESS_THAN_SIGN:{this._err(V.unexpectedCharacterInAttributeName),this.currentAttr.name+=String.fromCodePoint(t);break}case x.NULL:{this._err(V.unexpectedNullCharacter),this.currentAttr.name+=gt;break}default:this.currentAttr.name+=String.fromCodePoint(dn(t)?qn(t):t)}}_stateAfterAttributeName(t){switch(t){case x.SPACE:case x.LINE_FEED:case x.TABULATION:case x.FORM_FEED:break;case x.SOLIDUS:{this.state=y.SELF_CLOSING_START_TAG;break}case x.EQUALS_SIGN:{this.state=y.BEFORE_ATTRIBUTE_VALUE;break}case x.GREATER_THAN_SIGN:{this.state=y.DATA,this.emitCurrentTagToken();break}case x.EOF:{this._err(V.eofInTag),this._emitEOFToken();break}default:this._createAttr(""),this.state=y.ATTRIBUTE_NAME,this._stateAttributeName(t)}}_stateBeforeAttributeValue(t){switch(t){case x.SPACE:case x.LINE_FEED:case x.TABULATION:case x.FORM_FEED:break;case x.QUOTATION_MARK:{this.state=y.ATTRIBUTE_VALUE_DOUBLE_QUOTED;break}case x.APOSTROPHE:{this.state=y.ATTRIBUTE_VALUE_SINGLE_QUOTED;break}case x.GREATER_THAN_SIGN:{this._err(V.missingAttributeValue),this.state=y.DATA,this.emitCurrentTagToken();break}default:this.state=y.ATTRIBUTE_VALUE_UNQUOTED,this._stateAttributeValueUnquoted(t)}}_stateAttributeValueDoubleQuoted(t){switch(t){case x.QUOTATION_MARK:{this.state=y.AFTER_ATTRIBUTE_VALUE_QUOTED;break}case x.AMPERSAND:{this._startCharacterReference();break}case x.NULL:{this._err(V.unexpectedNullCharacter),this.currentAttr.value+=gt;break}case x.EOF:{this._err(V.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAttributeValueSingleQuoted(t){switch(t){case x.APOSTROPHE:{this.state=y.AFTER_ATTRIBUTE_VALUE_QUOTED;break}case x.AMPERSAND:{this._startCharacterReference();break}case x.NULL:{this._err(V.unexpectedNullCharacter),this.currentAttr.value+=gt;break}case x.EOF:{this._err(V.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAttributeValueUnquoted(t){switch(t){case x.SPACE:case x.LINE_FEED:case x.TABULATION:case x.FORM_FEED:{this._leaveAttrValue(),this.state=y.BEFORE_ATTRIBUTE_NAME;break}case x.AMPERSAND:{this._startCharacterReference();break}case x.GREATER_THAN_SIGN:{this._leaveAttrValue(),this.state=y.DATA,this.emitCurrentTagToken();break}case x.NULL:{this._err(V.unexpectedNullCharacter),this.currentAttr.value+=gt;break}case x.QUOTATION_MARK:case x.APOSTROPHE:case x.LESS_THAN_SIGN:case x.EQUALS_SIGN:case x.GRAVE_ACCENT:{this._err(V.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=String.fromCodePoint(t);break}case x.EOF:{this._err(V.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(t)}}_stateAfterAttributeValueQuoted(t){switch(t){case x.SPACE:case x.LINE_FEED:case x.TABULATION:case x.FORM_FEED:{this._leaveAttrValue(),this.state=y.BEFORE_ATTRIBUTE_NAME;break}case x.SOLIDUS:{this._leaveAttrValue(),this.state=y.SELF_CLOSING_START_TAG;break}case x.GREATER_THAN_SIGN:{this._leaveAttrValue(),this.state=y.DATA,this.emitCurrentTagToken();break}case x.EOF:{this._err(V.eofInTag),this._emitEOFToken();break}default:this._err(V.missingWhitespaceBetweenAttributes),this.state=y.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(t)}}_stateSelfClosingStartTag(t){switch(t){case x.GREATER_THAN_SIGN:{const n=this.currentToken;n.selfClosing=!0,this.state=y.DATA,this.emitCurrentTagToken();break}case x.EOF:{this._err(V.eofInTag),this._emitEOFToken();break}default:this._err(V.unexpectedSolidusInTag),this.state=y.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(t)}}_stateBogusComment(t){const n=this.currentToken;switch(t){case x.GREATER_THAN_SIGN:{this.state=y.DATA,this.emitCurrentComment(n);break}case x.EOF:{this.emitCurrentComment(n),this._emitEOFToken();break}case x.NULL:{this._err(V.unexpectedNullCharacter),n.data+=gt;break}default:n.data+=String.fromCodePoint(t)}}_stateMarkupDeclarationOpen(t){this._consumeSequenceIfMatch(Ht.DASH_DASH,!0)?(this._createCommentToken(Ht.DASH_DASH.length+1),this.state=y.COMMENT_START):this._consumeSequenceIfMatch(Ht.DOCTYPE,!1)?(this.currentLocation=this.getCurrentLocation(Ht.DOCTYPE.length+1),this.state=y.DOCTYPE):this._consumeSequenceIfMatch(Ht.CDATA_START,!0)?this.inForeignNode?this.state=y.CDATA_SECTION:(this._err(V.cdataInHtmlContent),this._createCommentToken(Ht.CDATA_START.length+1),this.currentToken.data="[CDATA[",this.state=y.BOGUS_COMMENT):this._ensureHibernation()||(this._err(V.incorrectlyOpenedComment),this._createCommentToken(2),this.state=y.BOGUS_COMMENT,this._stateBogusComment(t))}_stateCommentStart(t){switch(t){case x.HYPHEN_MINUS:{this.state=y.COMMENT_START_DASH;break}case x.GREATER_THAN_SIGN:{this._err(V.abruptClosingOfEmptyComment),this.state=y.DATA;const n=this.currentToken;this.emitCurrentComment(n);break}default:this.state=y.COMMENT,this._stateComment(t)}}_stateCommentStartDash(t){const n=this.currentToken;switch(t){case x.HYPHEN_MINUS:{this.state=y.COMMENT_END;break}case x.GREATER_THAN_SIGN:{this._err(V.abruptClosingOfEmptyComment),this.state=y.DATA,this.emitCurrentComment(n);break}case x.EOF:{this._err(V.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="-",this.state=y.COMMENT,this._stateComment(t)}}_stateComment(t){const n=this.currentToken;switch(t){case x.HYPHEN_MINUS:{this.state=y.COMMENT_END_DASH;break}case x.LESS_THAN_SIGN:{n.data+="<",this.state=y.COMMENT_LESS_THAN_SIGN;break}case x.NULL:{this._err(V.unexpectedNullCharacter),n.data+=gt;break}case x.EOF:{this._err(V.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+=String.fromCodePoint(t)}}_stateCommentLessThanSign(t){const n=this.currentToken;switch(t){case x.EXCLAMATION_MARK:{n.data+="!",this.state=y.COMMENT_LESS_THAN_SIGN_BANG;break}case x.LESS_THAN_SIGN:{n.data+="<";break}default:this.state=y.COMMENT,this._stateComment(t)}}_stateCommentLessThanSignBang(t){t===x.HYPHEN_MINUS?this.state=y.COMMENT_LESS_THAN_SIGN_BANG_DASH:(this.state=y.COMMENT,this._stateComment(t))}_stateCommentLessThanSignBangDash(t){t===x.HYPHEN_MINUS?this.state=y.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:(this.state=y.COMMENT_END_DASH,this._stateCommentEndDash(t))}_stateCommentLessThanSignBangDashDash(t){t!==x.GREATER_THAN_SIGN&&t!==x.EOF&&this._err(V.nestedComment),this.state=y.COMMENT_END,this._stateCommentEnd(t)}_stateCommentEndDash(t){const n=this.currentToken;switch(t){case x.HYPHEN_MINUS:{this.state=y.COMMENT_END;break}case x.EOF:{this._err(V.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="-",this.state=y.COMMENT,this._stateComment(t)}}_stateCommentEnd(t){const n=this.currentToken;switch(t){case x.GREATER_THAN_SIGN:{this.state=y.DATA,this.emitCurrentComment(n);break}case x.EXCLAMATION_MARK:{this.state=y.COMMENT_END_BANG;break}case x.HYPHEN_MINUS:{n.data+="-";break}case x.EOF:{this._err(V.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="--",this.state=y.COMMENT,this._stateComment(t)}}_stateCommentEndBang(t){const n=this.currentToken;switch(t){case x.HYPHEN_MINUS:{n.data+="--!",this.state=y.COMMENT_END_DASH;break}case x.GREATER_THAN_SIGN:{this._err(V.incorrectlyClosedComment),this.state=y.DATA,this.emitCurrentComment(n);break}case x.EOF:{this._err(V.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="--!",this.state=y.COMMENT,this._stateComment(t)}}_stateDoctype(t){switch(t){case x.SPACE:case x.LINE_FEED:case x.TABULATION:case x.FORM_FEED:{this.state=y.BEFORE_DOCTYPE_NAME;break}case x.GREATER_THAN_SIGN:{this.state=y.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(t);break}case x.EOF:{this._err(V.eofInDoctype),this._createDoctypeToken(null);const n=this.currentToken;n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(V.missingWhitespaceBeforeDoctypeName),this.state=y.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(t)}}_stateBeforeDoctypeName(t){if(dn(t))this._createDoctypeToken(String.fromCharCode(qn(t))),this.state=y.DOCTYPE_NAME;else switch(t){case x.SPACE:case x.LINE_FEED:case x.TABULATION:case x.FORM_FEED:break;case x.NULL:{this._err(V.unexpectedNullCharacter),this._createDoctypeToken(gt),this.state=y.DOCTYPE_NAME;break}case x.GREATER_THAN_SIGN:{this._err(V.missingDoctypeName),this._createDoctypeToken(null);const n=this.currentToken;n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=y.DATA;break}case x.EOF:{this._err(V.eofInDoctype),this._createDoctypeToken(null);const n=this.currentToken;n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._createDoctypeToken(String.fromCodePoint(t)),this.state=y.DOCTYPE_NAME}}_stateDoctypeName(t){const n=this.currentToken;switch(t){case x.SPACE:case x.LINE_FEED:case x.TABULATION:case x.FORM_FEED:{this.state=y.AFTER_DOCTYPE_NAME;break}case x.GREATER_THAN_SIGN:{this.state=y.DATA,this.emitCurrentDoctype(n);break}case x.NULL:{this._err(V.unexpectedNullCharacter),n.name+=gt;break}case x.EOF:{this._err(V.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.name+=String.fromCodePoint(dn(t)?qn(t):t)}}_stateAfterDoctypeName(t){const n=this.currentToken;switch(t){case x.SPACE:case x.LINE_FEED:case x.TABULATION:case x.FORM_FEED:break;case x.GREATER_THAN_SIGN:{this.state=y.DATA,this.emitCurrentDoctype(n);break}case x.EOF:{this._err(V.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._consumeSequenceIfMatch(Ht.PUBLIC,!1)?this.state=y.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._consumeSequenceIfMatch(Ht.SYSTEM,!1)?this.state=y.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._ensureHibernation()||(this._err(V.invalidCharacterSequenceAfterDoctypeName),n.forceQuirks=!0,this.state=y.BOGUS_DOCTYPE,this._stateBogusDoctype(t))}}_stateAfterDoctypePublicKeyword(t){const n=this.currentToken;switch(t){case x.SPACE:case x.LINE_FEED:case x.TABULATION:case x.FORM_FEED:{this.state=y.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER;break}case x.QUOTATION_MARK:{this._err(V.missingWhitespaceAfterDoctypePublicKeyword),n.publicId="",this.state=y.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break}case x.APOSTROPHE:{this._err(V.missingWhitespaceAfterDoctypePublicKeyword),n.publicId="",this.state=y.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break}case x.GREATER_THAN_SIGN:{this._err(V.missingDoctypePublicIdentifier),n.forceQuirks=!0,this.state=y.DATA,this.emitCurrentDoctype(n);break}case x.EOF:{this._err(V.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(V.missingQuoteBeforeDoctypePublicIdentifier),n.forceQuirks=!0,this.state=y.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBeforeDoctypePublicIdentifier(t){const n=this.currentToken;switch(t){case x.SPACE:case x.LINE_FEED:case x.TABULATION:case x.FORM_FEED:break;case x.QUOTATION_MARK:{n.publicId="",this.state=y.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break}case x.APOSTROPHE:{n.publicId="",this.state=y.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break}case x.GREATER_THAN_SIGN:{this._err(V.missingDoctypePublicIdentifier),n.forceQuirks=!0,this.state=y.DATA,this.emitCurrentDoctype(n);break}case x.EOF:{this._err(V.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(V.missingQuoteBeforeDoctypePublicIdentifier),n.forceQuirks=!0,this.state=y.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateDoctypePublicIdentifierDoubleQuoted(t){const n=this.currentToken;switch(t){case x.QUOTATION_MARK:{this.state=y.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break}case x.NULL:{this._err(V.unexpectedNullCharacter),n.publicId+=gt;break}case x.GREATER_THAN_SIGN:{this._err(V.abruptDoctypePublicIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=y.DATA;break}case x.EOF:{this._err(V.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.publicId+=String.fromCodePoint(t)}}_stateDoctypePublicIdentifierSingleQuoted(t){const n=this.currentToken;switch(t){case x.APOSTROPHE:{this.state=y.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break}case x.NULL:{this._err(V.unexpectedNullCharacter),n.publicId+=gt;break}case x.GREATER_THAN_SIGN:{this._err(V.abruptDoctypePublicIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=y.DATA;break}case x.EOF:{this._err(V.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.publicId+=String.fromCodePoint(t)}}_stateAfterDoctypePublicIdentifier(t){const n=this.currentToken;switch(t){case x.SPACE:case x.LINE_FEED:case x.TABULATION:case x.FORM_FEED:{this.state=y.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS;break}case x.GREATER_THAN_SIGN:{this.state=y.DATA,this.emitCurrentDoctype(n);break}case x.QUOTATION_MARK:{this._err(V.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),n.systemId="",this.state=y.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case x.APOSTROPHE:{this._err(V.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),n.systemId="",this.state=y.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case x.EOF:{this._err(V.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(V.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=y.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBetweenDoctypePublicAndSystemIdentifiers(t){const n=this.currentToken;switch(t){case x.SPACE:case x.LINE_FEED:case x.TABULATION:case x.FORM_FEED:break;case x.GREATER_THAN_SIGN:{this.emitCurrentDoctype(n),this.state=y.DATA;break}case x.QUOTATION_MARK:{n.systemId="",this.state=y.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case x.APOSTROPHE:{n.systemId="",this.state=y.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case x.EOF:{this._err(V.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(V.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=y.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateAfterDoctypeSystemKeyword(t){const n=this.currentToken;switch(t){case x.SPACE:case x.LINE_FEED:case x.TABULATION:case x.FORM_FEED:{this.state=y.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER;break}case x.QUOTATION_MARK:{this._err(V.missingWhitespaceAfterDoctypeSystemKeyword),n.systemId="",this.state=y.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case x.APOSTROPHE:{this._err(V.missingWhitespaceAfterDoctypeSystemKeyword),n.systemId="",this.state=y.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case x.GREATER_THAN_SIGN:{this._err(V.missingDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=y.DATA,this.emitCurrentDoctype(n);break}case x.EOF:{this._err(V.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(V.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=y.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBeforeDoctypeSystemIdentifier(t){const n=this.currentToken;switch(t){case x.SPACE:case x.LINE_FEED:case x.TABULATION:case x.FORM_FEED:break;case x.QUOTATION_MARK:{n.systemId="",this.state=y.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case x.APOSTROPHE:{n.systemId="",this.state=y.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case x.GREATER_THAN_SIGN:{this._err(V.missingDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=y.DATA,this.emitCurrentDoctype(n);break}case x.EOF:{this._err(V.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(V.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=y.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateDoctypeSystemIdentifierDoubleQuoted(t){const n=this.currentToken;switch(t){case x.QUOTATION_MARK:{this.state=y.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break}case x.NULL:{this._err(V.unexpectedNullCharacter),n.systemId+=gt;break}case x.GREATER_THAN_SIGN:{this._err(V.abruptDoctypeSystemIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=y.DATA;break}case x.EOF:{this._err(V.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.systemId+=String.fromCodePoint(t)}}_stateDoctypeSystemIdentifierSingleQuoted(t){const n=this.currentToken;switch(t){case x.APOSTROPHE:{this.state=y.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break}case x.NULL:{this._err(V.unexpectedNullCharacter),n.systemId+=gt;break}case x.GREATER_THAN_SIGN:{this._err(V.abruptDoctypeSystemIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=y.DATA;break}case x.EOF:{this._err(V.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.systemId+=String.fromCodePoint(t)}}_stateAfterDoctypeSystemIdentifier(t){const n=this.currentToken;switch(t){case x.SPACE:case x.LINE_FEED:case x.TABULATION:case x.FORM_FEED:break;case x.GREATER_THAN_SIGN:{this.emitCurrentDoctype(n),this.state=y.DATA;break}case x.EOF:{this._err(V.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err(V.unexpectedCharacterAfterDoctypeSystemIdentifier),this.state=y.BOGUS_DOCTYPE,this._stateBogusDoctype(t)}}_stateBogusDoctype(t){const n=this.currentToken;switch(t){case x.GREATER_THAN_SIGN:{this.emitCurrentDoctype(n),this.state=y.DATA;break}case x.NULL:{this._err(V.unexpectedNullCharacter);break}case x.EOF:{this.emitCurrentDoctype(n),this._emitEOFToken();break}}}_stateCdataSection(t){switch(t){case x.RIGHT_SQUARE_BRACKET:{this.state=y.CDATA_SECTION_BRACKET;break}case x.EOF:{this._err(V.eofInCdata),this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateCdataSectionBracket(t){t===x.RIGHT_SQUARE_BRACKET?this.state=y.CDATA_SECTION_END:(this._emitChars("]"),this.state=y.CDATA_SECTION,this._stateCdataSection(t))}_stateCdataSectionEnd(t){switch(t){case x.GREATER_THAN_SIGN:{this.state=y.DATA;break}case x.RIGHT_SQUARE_BRACKET:{this._emitChars("]");break}default:this._emitChars("]]"),this.state=y.CDATA_SECTION,this._stateCdataSection(t)}}_stateCharacterReference(){let t=this.entityDecoder.write(this.preprocessor.html,this.preprocessor.pos);if(t<0)if(this.preprocessor.lastChunkWritten)t=this.entityDecoder.end();else{this.active=!1,this.preprocessor.pos=this.preprocessor.html.length-1,this.consumedAfterSnapshot=0,this.preprocessor.endOfChunkHit=!0;return}t===0?(this.preprocessor.pos=this.entityStartPos,this._flushCodePointConsumedAsCharacterReference(x.AMPERSAND),this.state=!this._isCharacterReferenceInAttribute()&&ho(this.preprocessor.peek(1))?y.AMBIGUOUS_AMPERSAND:this.returnState):this.state=this.returnState}_stateAmbiguousAmpersand(t){ho(t)?this._flushCodePointConsumedAsCharacterReference(t):(t===x.SEMICOLON&&this._err(V.unknownNamedCharacterReference),this.state=this.returnState,this._callState(t))}}const xc=new Set([i.DD,i.DT,i.LI,i.OPTGROUP,i.OPTION,i.P,i.RB,i.RP,i.RT,i.RTC]),go=new Set([...xc,i.CAPTION,i.COLGROUP,i.TBODY,i.TD,i.TFOOT,i.TH,i.THEAD,i.TR]),ya=new Set([i.APPLET,i.CAPTION,i.HTML,i.MARQUEE,i.OBJECT,i.TABLE,i.TD,i.TEMPLATE,i.TH]),qh=new Set([...ya,i.OL,i.UL]),Wh=new Set([...ya,i.BUTTON]),bo=new Set([i.ANNOTATION_XML,i.MI,i.MN,i.MO,i.MS,i.MTEXT]),xo=new Set([i.DESC,i.FOREIGN_OBJECT,i.TITLE]),Kh=new Set([i.TR,i.TEMPLATE,i.HTML]),Gh=new Set([i.TBODY,i.TFOOT,i.THEAD,i.TEMPLATE,i.HTML]),Yh=new Set([i.TABLE,i.TEMPLATE,i.HTML]),zh=new Set([i.TD,i.TH]);class Vh{get currentTmplContentOrNode(){return this._isInTemplate()?this.treeAdapter.getTemplateContent(this.current):this.current}constructor(t,n,r){this.treeAdapter=n,this.handler=r,this.items=[],this.tagIDs=[],this.stackTop=-1,this.tmplCount=0,this.currentTagId=i.UNKNOWN,this.current=t}_indexOf(t){return this.items.lastIndexOf(t,this.stackTop)}_isInTemplate(){return this.currentTagId===i.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===me.HTML}_updateCurrentElement(){this.current=this.items[this.stackTop],this.currentTagId=this.tagIDs[this.stackTop]}push(t,n){this.stackTop++,this.items[this.stackTop]=t,this.current=t,this.tagIDs[this.stackTop]=n,this.currentTagId=n,this._isInTemplate()&&this.tmplCount++,this.handler.onItemPush(t,n,!0)}pop(){const t=this.current;this.tmplCount>0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!0)}replace(t,n){const r=this._indexOf(t);this.items[r]=n,r===this.stackTop&&(this.current=n)}insertAfter(t,n,r){const a=this._indexOf(t)+1;this.items.splice(a,0,n),this.tagIDs.splice(a,0,r),this.stackTop++,a===this.stackTop&&this._updateCurrentElement(),this.current&&this.currentTagId!==void 0&&this.handler.onItemPush(this.current,this.currentTagId,a===this.stackTop)}popUntilTagNamePopped(t){let n=this.stackTop+1;do n=this.tagIDs.lastIndexOf(t,n-1);while(n>0&&this.treeAdapter.getNamespaceURI(this.items[n])!==me.HTML);this.shortenToLength(Math.max(n,0))}shortenToLength(t){for(;this.stackTop>=t;){const n=this.current;this.tmplCount>0&&this._isInTemplate()&&(this.tmplCount-=1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(n,this.stackTop<t)}}popUntilElementPopped(t){const n=this._indexOf(t);this.shortenToLength(Math.max(n,0))}popUntilPopped(t,n){const r=this._indexOfTagNames(t,n);this.shortenToLength(Math.max(r,0))}popUntilNumberedHeaderPopped(){this.popUntilPopped(jr,me.HTML)}popUntilTableCellPopped(){this.popUntilPopped(zh,me.HTML)}popAllUpToHtmlElement(){this.tmplCount=0,this.shortenToLength(1)}_indexOfTagNames(t,n){for(let r=this.stackTop;r>=0;r--)if(t.has(this.tagIDs[r])&&this.treeAdapter.getNamespaceURI(this.items[r])===n)return r;return-1}clearBackTo(t,n){const r=this._indexOfTagNames(t,n);this.shortenToLength(r+1)}clearBackToTableContext(){this.clearBackTo(Yh,me.HTML)}clearBackToTableBodyContext(){this.clearBackTo(Gh,me.HTML)}clearBackToTableRowContext(){this.clearBackTo(Kh,me.HTML)}remove(t){const n=this._indexOf(t);n>=0&&(n===this.stackTop?this.pop():(this.items.splice(n,1),this.tagIDs.splice(n,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===i.BODY?this.items[1]:null}contains(t){return this._indexOf(t)>-1}getCommonAncestor(t){const n=this._indexOf(t)-1;return n>=0?this.items[n]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.tagIDs[0]===i.HTML}hasInDynamicScope(t,n){for(let r=this.stackTop;r>=0;r--){const a=this.tagIDs[r];switch(this.treeAdapter.getNamespaceURI(this.items[r])){case me.HTML:{if(a===t)return!0;if(n.has(a))return!1;break}case me.SVG:{if(xo.has(a))return!1;break}case me.MATHML:{if(bo.has(a))return!1;break}}}return!0}hasInScope(t){return this.hasInDynamicScope(t,ya)}hasInListItemScope(t){return this.hasInDynamicScope(t,qh)}hasInButtonScope(t){return this.hasInDynamicScope(t,Wh)}hasNumberedHeaderInScope(){for(let t=this.stackTop;t>=0;t--){const n=this.tagIDs[t];switch(this.treeAdapter.getNamespaceURI(this.items[t])){case me.HTML:{if(jr.has(n))return!0;if(ya.has(n))return!1;break}case me.SVG:{if(xo.has(n))return!1;break}case me.MATHML:{if(bo.has(n))return!1;break}}}return!0}hasInTableScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===me.HTML)switch(this.tagIDs[n]){case t:return!0;case i.TABLE:case i.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===me.HTML)switch(this.tagIDs[t]){case i.TBODY:case i.THEAD:case i.TFOOT:return!0;case i.TABLE:case i.HTML:return!1}return!0}hasInSelectScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===me.HTML)switch(this.tagIDs[n]){case t:return!0;case i.OPTION:case i.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&xc.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&go.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(t){for(;this.currentTagId!==void 0&&this.currentTagId!==t&&go.has(this.currentTagId);)this.pop()}}const Va=3;var rs;(function(e){e[e.Marker=0]="Marker",e[e.Element=1]="Element"})(rs||(rs={}));const Eo={type:rs.Marker};class Qh{constructor(t){this.treeAdapter=t,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(t,n){const r=[],a=n.length,c=this.treeAdapter.getTagName(t),l=this.treeAdapter.getNamespaceURI(t);for(let u=0;u<this.entries.length;u++){const d=this.entries[u];if(d.type===rs.Marker)break;const{element:m}=d;if(this.treeAdapter.getTagName(m)===c&&this.treeAdapter.getNamespaceURI(m)===l){const f=this.treeAdapter.getAttrList(m);f.length===a&&r.push({idx:u,attrs:f})}}return r}_ensureNoahArkCondition(t){if(this.entries.length<Va)return;const n=this.treeAdapter.getAttrList(t),r=this._getNoahArkConditionCandidates(t,n);if(r.length<Va)return;const a=new Map(n.map(l=>[l.name,l.value]));let c=0;for(let l=0;l<r.length;l++){const u=r[l];u.attrs.every(d=>a.get(d.name)===d.value)&&(c+=1,c>=Va&&this.entries.splice(u.idx,1))}}insertMarker(){this.entries.unshift(Eo)}pushElement(t,n){this._ensureNoahArkCondition(t),this.entries.unshift({type:rs.Element,element:t,token:n})}insertElementAfterBookmark(t,n){const r=this.entries.indexOf(this.bookmark);this.entries.splice(r,0,{type:rs.Element,element:t,token:n})}removeEntry(t){const n=this.entries.indexOf(t);n!==-1&&this.entries.splice(n,1)}clearToLastMarker(){const t=this.entries.indexOf(Eo);t===-1?this.entries.length=0:this.entries.splice(0,t+1)}getElementEntryInScopeWithTagName(t){const n=this.entries.find(r=>r.type===rs.Marker||this.treeAdapter.getTagName(r.element)===t);return n&&n.type===rs.Element?n:null}getElementEntry(t){return this.entries.find(n=>n.type===rs.Element&&n.element===t)}}const Es={createDocument(){return{nodeName:"#document",mode:Gt.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){const 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){const a=e.childNodes.find(c=>c.nodeName==="#documentType");if(a)a.name=t,a.publicId=n,a.systemId=r;else{const c={nodeName:"#documentType",name:t,publicId:n,systemId:r,parentNode:null};Es.appendChild(e,c)}},setDocumentMode(e,t){e.mode=t},getDocumentMode(e){return e.mode},detachNode(e){if(e.parentNode){const t=e.parentNode.childNodes.indexOf(e);e.parentNode.childNodes.splice(t,1),e.parentNode=null}},insertText(e,t){if(e.childNodes.length>0){const n=e.childNodes[e.childNodes.length-1];if(Es.isTextNode(n)){n.value+=t;return}}Es.appendChild(e,Es.createTextNode(t))},insertTextBefore(e,t,n){const r=e.childNodes[e.childNodes.indexOf(n)-1];r&&Es.isTextNode(r)?r.value+=t:Es.insertBefore(e,Es.createTextNode(t),n)},adoptAttributes(e,t){const n=new Set(e.attrs.map(r=>r.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}}},Ec="html",Xh="about:legacy-compat",Jh="http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd",yc=["+//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//"],Zh=[...yc,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"],ef=new Set(["-//w3o//dtd w3 html strict 3.0//en//","-/w3c/dtd html 4.0 transitional/en","html"]),Tc=["-//w3c//dtd xhtml 1.0 frameset//","-//w3c//dtd xhtml 1.0 transitional//"],tf=[...Tc,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"];function yo(e,t){return t.some(n=>e.startsWith(n))}function sf(e){return e.name===Ec&&e.publicId===null&&(e.systemId===null||e.systemId===Xh)}function nf(e){if(e.name!==Ec)return Gt.QUIRKS;const{systemId:t}=e;if(t&&t.toLowerCase()===Jh)return Gt.QUIRKS;let{publicId:n}=e;if(n!==null){if(n=n.toLowerCase(),ef.has(n))return Gt.QUIRKS;let r=t===null?Zh:yc;if(yo(n,r))return Gt.QUIRKS;if(r=t===null?Tc:tf,yo(n,r))return Gt.LIMITED_QUIRKS}return Gt.NO_QUIRKS}const To={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"},af="definitionurl",rf="definitionURL",of=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"].map(e=>[e.toLowerCase(),e])),lf=new Map([["xlink:actuate",{prefix:"xlink",name:"actuate",namespace:me.XLINK}],["xlink:arcrole",{prefix:"xlink",name:"arcrole",namespace:me.XLINK}],["xlink:href",{prefix:"xlink",name:"href",namespace:me.XLINK}],["xlink:role",{prefix:"xlink",name:"role",namespace:me.XLINK}],["xlink:show",{prefix:"xlink",name:"show",namespace:me.XLINK}],["xlink:title",{prefix:"xlink",name:"title",namespace:me.XLINK}],["xlink:type",{prefix:"xlink",name:"type",namespace:me.XLINK}],["xml:lang",{prefix:"xml",name:"lang",namespace:me.XML}],["xml:space",{prefix:"xml",name:"space",namespace:me.XML}],["xmlns",{prefix:"",name:"xmlns",namespace:me.XMLNS}],["xmlns:xlink",{prefix:"xmlns",name:"xlink",namespace:me.XMLNS}]]),cf=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"].map(e=>[e.toLowerCase(),e])),uf=new Set([i.B,i.BIG,i.BLOCKQUOTE,i.BODY,i.BR,i.CENTER,i.CODE,i.DD,i.DIV,i.DL,i.DT,i.EM,i.EMBED,i.H1,i.H2,i.H3,i.H4,i.H5,i.H6,i.HEAD,i.HR,i.I,i.IMG,i.LI,i.LISTING,i.MENU,i.META,i.NOBR,i.OL,i.P,i.PRE,i.RUBY,i.S,i.SMALL,i.SPAN,i.STRONG,i.STRIKE,i.SUB,i.SUP,i.TABLE,i.TT,i.U,i.UL,i.VAR]);function df(e){const t=e.tagID;return t===i.FONT&&e.attrs.some(({name:r})=>r===Ps.COLOR||r===Ps.SIZE||r===Ps.FACE)||uf.has(t)}function kc(e){for(let t=0;t<e.attrs.length;t++)if(e.attrs[t].name===af){e.attrs[t].name=rf;break}}function Nc(e){for(let t=0;t<e.attrs.length;t++){const n=of.get(e.attrs[t].name);n!=null&&(e.attrs[t].name=n)}}function Zr(e){for(let t=0;t<e.attrs.length;t++){const n=lf.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 pf(e){const t=cf.get(e.tagName);t!=null&&(e.tagName=t,e.tagID=Js(e.tagName))}function mf(e,t){return t===me.MATHML&&(e===i.MI||e===i.MO||e===i.MN||e===i.MS||e===i.MTEXT)}function hf(e,t,n){if(t===me.MATHML&&e===i.ANNOTATION_XML){for(let r=0;r<n.length;r++)if(n[r].name===Ps.ENCODING){const a=n[r].value.toLowerCase();return a===To.TEXT_HTML||a===To.APPLICATION_XML}}return t===me.SVG&&(e===i.FOREIGN_OBJECT||e===i.DESC||e===i.TITLE)}function ff(e,t,n,r){return(!r||r===me.HTML)&&hf(e,t,n)||(!r||r===me.MATHML)&&mf(e,t)}const gf="hidden",bf=8,xf=3;var S;(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"})(S||(S={}));const Ef={startLine:-1,startCol:-1,startOffset:-1,endLine:-1,endCol:-1,endOffset:-1},vc=new Set([i.TABLE,i.TBODY,i.TFOOT,i.THEAD,i.TR]),ko={scriptingEnabled:!0,sourceCodeLocationInfo:!1,treeAdapter:Es,onParseError:null};class No{constructor(t,n,r=null,a=null){this.fragmentContext=r,this.scriptHandler=a,this.currentToken=null,this.stopped=!1,this.insertionMode=S.INITIAL,this.originalInsertionMode=S.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={...ko,...t},this.treeAdapter=this.options.treeAdapter,this.onParseError=this.options.onParseError,this.onParseError&&(this.options.sourceCodeLocationInfo=!0),this.document=n??this.treeAdapter.createDocument(),this.tokenizer=new $h(this.options,this),this.activeFormattingElements=new Qh(this.treeAdapter),this.fragmentContextID=r?Js(this.treeAdapter.getTagName(r)):i.UNKNOWN,this._setContextModes(r??this.document,this.fragmentContextID),this.openElements=new Vh(this.document,this.treeAdapter,this)}static parse(t,n){const r=new this(n);return r.tokenizer.write(t,!0),r.document}static getFragmentParser(t,n){const r={...ko,...n};t??(t=r.treeAdapter.createElement(H.TEMPLATE,me.HTML,[]));const a=r.treeAdapter.createElement("documentmock",me.HTML,[]),c=new this(r,a,t);return c.fragmentContextID===i.TEMPLATE&&c.tmplInsertionModeStack.unshift(S.IN_TEMPLATE),c._initTokenizerForFragmentParsing(),c._insertFakeRootElement(),c._resetInsertionMode(),c._findFormInFragmentContext(),c}getFragment(){const t=this.treeAdapter.getFirstChild(this.document),n=this.treeAdapter.createDocumentFragment();return this._adoptNodes(t,n),n}_err(t,n,r){var a;if(!this.onParseError)return;const c=(a=t.location)!==null&&a!==void 0?a:Ef,l={code:n,startLine:c.startLine,startCol:c.startCol,startOffset:c.startOffset,endLine:r?c.startLine:c.endLine,endCol:r?c.startCol:c.endCol,endOffset:r?c.startOffset:c.endOffset};this.onParseError(l)}onItemPush(t,n,r){var a,c;(c=(a=this.treeAdapter).onItemPush)===null||c===void 0||c.call(a,t),r&&this.openElements.stackTop>0&&this._setContextModes(t,n)}onItemPop(t,n){var r,a;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(t,this.currentToken),(a=(r=this.treeAdapter).onItemPop)===null||a===void 0||a.call(r,t,this.openElements.current),n){let c,l;this.openElements.stackTop===0&&this.fragmentContext?(c=this.fragmentContext,l=this.fragmentContextID):{current:c,currentTagId:l}=this.openElements,this._setContextModes(c,l)}}_setContextModes(t,n){const r=t===this.document||t&&this.treeAdapter.getNamespaceURI(t)===me.HTML;this.currentNotInHTML=!r,this.tokenizer.inForeignNode=!r&&t!==void 0&&n!==void 0&&!this._isIntegrationPoint(n,t)}_switchToTextParsing(t,n){this._insertElement(t,me.HTML),this.tokenizer.state=n,this.originalInsertionMode=this.insertionMode,this.insertionMode=S.TEXT}switchToPlaintextParsing(){this.insertionMode=S.TEXT,this.originalInsertionMode=S.IN_BODY,this.tokenizer.state=Tt.PLAINTEXT}_getAdjustedCurrentElement(){return this.openElements.stackTop===0&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let t=this.fragmentContext;for(;t;){if(this.treeAdapter.getTagName(t)===H.FORM){this.formElement=t;break}t=this.treeAdapter.getParentNode(t)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==me.HTML))switch(this.fragmentContextID){case i.TITLE:case i.TEXTAREA:{this.tokenizer.state=Tt.RCDATA;break}case i.STYLE:case i.XMP:case i.IFRAME:case i.NOEMBED:case i.NOFRAMES:case i.NOSCRIPT:{this.tokenizer.state=Tt.RAWTEXT;break}case i.SCRIPT:{this.tokenizer.state=Tt.SCRIPT_DATA;break}case i.PLAINTEXT:{this.tokenizer.state=Tt.PLAINTEXT;break}}}_setDocumentType(t){const n=t.name||"",r=t.publicId||"",a=t.systemId||"";if(this.treeAdapter.setDocumentType(this.document,n,r,a),t.location){const l=this.treeAdapter.getChildNodes(this.document).find(u=>this.treeAdapter.isDocumentTypeNode(u));l&&this.treeAdapter.setNodeSourceCodeLocation(l,t.location)}}_attachElementToTree(t,n){if(this.options.sourceCodeLocationInfo){const r=n&&{...n,startTag:n};this.treeAdapter.setNodeSourceCodeLocation(t,r)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(t);else{const r=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(r??this.document,t)}}_appendElement(t,n){const r=this.treeAdapter.createElement(t.tagName,n,t.attrs);this._attachElementToTree(r,t.location)}_insertElement(t,n){const r=this.treeAdapter.createElement(t.tagName,n,t.attrs);this._attachElementToTree(r,t.location),this.openElements.push(r,t.tagID)}_insertFakeElement(t,n){const r=this.treeAdapter.createElement(t,me.HTML,[]);this._attachElementToTree(r,null),this.openElements.push(r,n)}_insertTemplate(t){const n=this.treeAdapter.createElement(t.tagName,me.HTML,t.attrs),r=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(n,r),this._attachElementToTree(n,t.location),this.openElements.push(n,t.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(r,null)}_insertFakeRootElement(){const t=this.treeAdapter.createElement(H.HTML,me.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(t,null),this.treeAdapter.appendChild(this.openElements.current,t),this.openElements.push(t,i.HTML)}_appendCommentNode(t,n){const r=this.treeAdapter.createCommentNode(t.data);this.treeAdapter.appendChild(n,r),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(r,t.location)}_insertCharacters(t){let n,r;if(this._shouldFosterParentOnInsertion()?({parent:n,beforeElement:r}=this._findFosterParentingLocation(),r?this.treeAdapter.insertTextBefore(n,t.chars,r):this.treeAdapter.insertText(n,t.chars)):(n=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(n,t.chars)),!t.location)return;const a=this.treeAdapter.getChildNodes(n),c=r?a.lastIndexOf(r):a.length,l=a[c-1];if(this.treeAdapter.getNodeSourceCodeLocation(l)){const{endLine:d,endCol:m,endOffset:f}=t.location;this.treeAdapter.updateNodeSourceCodeLocation(l,{endLine:d,endCol:m,endOffset:f})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(l,t.location)}_adoptNodes(t,n){for(let r=this.treeAdapter.getFirstChild(t);r;r=this.treeAdapter.getFirstChild(t))this.treeAdapter.detachNode(r),this.treeAdapter.appendChild(n,r)}_setEndLocation(t,n){if(this.treeAdapter.getNodeSourceCodeLocation(t)&&n.location){const r=n.location,a=this.treeAdapter.getTagName(t),c=n.type===Ze.END_TAG&&a===n.tagName?{endTag:{...r},endLine:r.endLine,endCol:r.endCol,endOffset:r.endOffset}:{endLine:r.startLine,endCol:r.startCol,endOffset:r.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(t,c)}}shouldProcessStartTagTokenInForeignContent(t){if(!this.currentNotInHTML)return!1;let n,r;return this.openElements.stackTop===0&&this.fragmentContext?(n=this.fragmentContext,r=this.fragmentContextID):{current:n,currentTagId:r}=this.openElements,t.tagID===i.SVG&&this.treeAdapter.getTagName(n)===H.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(n)===me.MATHML?!1:this.tokenizer.inForeignNode||(t.tagID===i.MGLYPH||t.tagID===i.MALIGNMARK)&&r!==void 0&&!this._isIntegrationPoint(r,n,me.HTML)}_processToken(t){switch(t.type){case Ze.CHARACTER:{this.onCharacter(t);break}case Ze.NULL_CHARACTER:{this.onNullCharacter(t);break}case Ze.COMMENT:{this.onComment(t);break}case Ze.DOCTYPE:{this.onDoctype(t);break}case Ze.START_TAG:{this._processStartTag(t);break}case Ze.END_TAG:{this.onEndTag(t);break}case Ze.EOF:{this.onEof(t);break}case Ze.WHITESPACE_CHARACTER:{this.onWhitespaceCharacter(t);break}}}_isIntegrationPoint(t,n,r){const a=this.treeAdapter.getNamespaceURI(n),c=this.treeAdapter.getAttrList(n);return ff(t,a,c,r)}_reconstructActiveFormattingElements(){const t=this.activeFormattingElements.entries.length;if(t){const n=this.activeFormattingElements.entries.findIndex(a=>a.type===rs.Marker||this.openElements.contains(a.element)),r=n===-1?t-1:n-1;for(let a=r;a>=0;a--){const c=this.activeFormattingElements.entries[a];this._insertElement(c.token,this.treeAdapter.getNamespaceURI(c.element)),c.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=S.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(i.P),this.openElements.popUntilTagNamePopped(i.P)}_resetInsertionMode(){for(let t=this.openElements.stackTop;t>=0;t--)switch(t===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[t]){case i.TR:{this.insertionMode=S.IN_ROW;return}case i.TBODY:case i.THEAD:case i.TFOOT:{this.insertionMode=S.IN_TABLE_BODY;return}case i.CAPTION:{this.insertionMode=S.IN_CAPTION;return}case i.COLGROUP:{this.insertionMode=S.IN_COLUMN_GROUP;return}case i.TABLE:{this.insertionMode=S.IN_TABLE;return}case i.BODY:{this.insertionMode=S.IN_BODY;return}case i.FRAMESET:{this.insertionMode=S.IN_FRAMESET;return}case i.SELECT:{this._resetInsertionModeForSelect(t);return}case i.TEMPLATE:{this.insertionMode=this.tmplInsertionModeStack[0];return}case i.HTML:{this.insertionMode=this.headElement?S.AFTER_HEAD:S.BEFORE_HEAD;return}case i.TD:case i.TH:{if(t>0){this.insertionMode=S.IN_CELL;return}break}case i.HEAD:{if(t>0){this.insertionMode=S.IN_HEAD;return}break}}this.insertionMode=S.IN_BODY}_resetInsertionModeForSelect(t){if(t>0)for(let n=t-1;n>0;n--){const r=this.openElements.tagIDs[n];if(r===i.TEMPLATE)break;if(r===i.TABLE){this.insertionMode=S.IN_SELECT_IN_TABLE;return}}this.insertionMode=S.IN_SELECT}_isElementCausesFosterParenting(t){return vc.has(t)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this.openElements.currentTagId!==void 0&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let t=this.openElements.stackTop;t>=0;t--){const n=this.openElements.items[t];switch(this.openElements.tagIDs[t]){case i.TEMPLATE:{if(this.treeAdapter.getNamespaceURI(n)===me.HTML)return{parent:this.treeAdapter.getTemplateContent(n),beforeElement:null};break}case i.TABLE:{const r=this.treeAdapter.getParentNode(n);return r?{parent:r,beforeElement:n}:{parent:this.openElements.items[t-1],beforeElement:null}}}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(t){const n=this._findFosterParentingLocation();n.beforeElement?this.treeAdapter.insertBefore(n.parent,t,n.beforeElement):this.treeAdapter.appendChild(n.parent,t)}_isSpecialElement(t,n){const r=this.treeAdapter.getNamespaceURI(t);return Bh[r].has(n)}onCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){Vg(this,t);return}switch(this.insertionMode){case S.INITIAL:{nn(this,t);break}case S.BEFORE_HTML:{xn(this,t);break}case S.BEFORE_HEAD:{En(this,t);break}case S.IN_HEAD:{yn(this,t);break}case S.IN_HEAD_NO_SCRIPT:{Tn(this,t);break}case S.AFTER_HEAD:{kn(this,t);break}case S.IN_BODY:case S.IN_CAPTION:case S.IN_CELL:case S.IN_TEMPLATE:{wc(this,t);break}case S.TEXT:case S.IN_SELECT:case S.IN_SELECT_IN_TABLE:{this._insertCharacters(t);break}case S.IN_TABLE:case S.IN_TABLE_BODY:case S.IN_ROW:{Qa(this,t);break}case S.IN_TABLE_TEXT:{Rc(this,t);break}case S.IN_COLUMN_GROUP:{Ta(this,t);break}case S.AFTER_BODY:{ka(this,t);break}case S.AFTER_AFTER_BODY:{ta(this,t);break}}}onNullCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){zg(this,t);return}switch(this.insertionMode){case S.INITIAL:{nn(this,t);break}case S.BEFORE_HTML:{xn(this,t);break}case S.BEFORE_HEAD:{En(this,t);break}case S.IN_HEAD:{yn(this,t);break}case S.IN_HEAD_NO_SCRIPT:{Tn(this,t);break}case S.AFTER_HEAD:{kn(this,t);break}case S.TEXT:{this._insertCharacters(t);break}case S.IN_TABLE:case S.IN_TABLE_BODY:case S.IN_ROW:{Qa(this,t);break}case S.IN_COLUMN_GROUP:{Ta(this,t);break}case S.AFTER_BODY:{ka(this,t);break}case S.AFTER_AFTER_BODY:{ta(this,t);break}}}onComment(t){if(this.skipNextNewLine=!1,this.currentNotInHTML){Ir(this,t);return}switch(this.insertionMode){case S.INITIAL:case S.BEFORE_HTML:case S.BEFORE_HEAD:case S.IN_HEAD:case S.IN_HEAD_NO_SCRIPT:case S.AFTER_HEAD:case S.IN_BODY:case S.IN_TABLE:case S.IN_CAPTION:case S.IN_COLUMN_GROUP:case S.IN_TABLE_BODY:case S.IN_ROW:case S.IN_CELL:case S.IN_SELECT:case S.IN_SELECT_IN_TABLE:case S.IN_TEMPLATE:case S.IN_FRAMESET:case S.AFTER_FRAMESET:{Ir(this,t);break}case S.IN_TABLE_TEXT:{an(this,t);break}case S.AFTER_BODY:{wf(this,t);break}case S.AFTER_AFTER_BODY:case S.AFTER_AFTER_FRAMESET:{Sf(this,t);break}}}onDoctype(t){switch(this.skipNextNewLine=!1,this.insertionMode){case S.INITIAL:{_f(this,t);break}case S.BEFORE_HEAD:case S.IN_HEAD:case S.IN_HEAD_NO_SCRIPT:case S.AFTER_HEAD:{this._err(t,V.misplacedDoctype);break}case S.IN_TABLE_TEXT:{an(this,t);break}}}onStartTag(t){this.skipNextNewLine=!1,this.currentToken=t,this._processStartTag(t),t.selfClosing&&!t.ackSelfClosing&&this._err(t,V.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(t){this.shouldProcessStartTagTokenInForeignContent(t)?Qg(this,t):this._startTagOutsideForeignContent(t)}_startTagOutsideForeignContent(t){switch(this.insertionMode){case S.INITIAL:{nn(this,t);break}case S.BEFORE_HTML:{Af(this,t);break}case S.BEFORE_HEAD:{If(this,t);break}case S.IN_HEAD:{ns(this,t);break}case S.IN_HEAD_NO_SCRIPT:{Lf(this,t);break}case S.AFTER_HEAD:{Of(this,t);break}case S.IN_BODY:{Pt(this,t);break}case S.IN_TABLE:{Vs(this,t);break}case S.IN_TABLE_TEXT:{an(this,t);break}case S.IN_CAPTION:{Rg(this,t);break}case S.IN_COLUMN_GROUP:{si(this,t);break}case S.IN_TABLE_BODY:{Oa(this,t);break}case S.IN_ROW:{Ma(this,t);break}case S.IN_CELL:{Dg(this,t);break}case S.IN_SELECT:{Dc(this,t);break}case S.IN_SELECT_IN_TABLE:{Mg(this,t);break}case S.IN_TEMPLATE:{Fg(this,t);break}case S.AFTER_BODY:{Ug(this,t);break}case S.IN_FRAMESET:{$g(this,t);break}case S.AFTER_FRAMESET:{Wg(this,t);break}case S.AFTER_AFTER_BODY:{Gg(this,t);break}case S.AFTER_AFTER_FRAMESET:{Yg(this,t);break}}}onEndTag(t){this.skipNextNewLine=!1,this.currentToken=t,this.currentNotInHTML?Xg(this,t):this._endTagOutsideForeignContent(t)}_endTagOutsideForeignContent(t){switch(this.insertionMode){case S.INITIAL:{nn(this,t);break}case S.BEFORE_HTML:{jf(this,t);break}case S.BEFORE_HEAD:{Rf(this,t);break}case S.IN_HEAD:{Pf(this,t);break}case S.IN_HEAD_NO_SCRIPT:{Df(this,t);break}case S.AFTER_HEAD:{Mf(this,t);break}case S.IN_BODY:{Da(this,t);break}case S.TEXT:{kg(this,t);break}case S.IN_TABLE:{An(this,t);break}case S.IN_TABLE_TEXT:{an(this,t);break}case S.IN_CAPTION:{Pg(this,t);break}case S.IN_COLUMN_GROUP:{Lg(this,t);break}case S.IN_TABLE_BODY:{Rr(this,t);break}case S.IN_ROW:{Lc(this,t);break}case S.IN_CELL:{Og(this,t);break}case S.IN_SELECT:{Oc(this,t);break}case S.IN_SELECT_IN_TABLE:{Bg(this,t);break}case S.IN_TEMPLATE:{Hg(this,t);break}case S.AFTER_BODY:{Bc(this,t);break}case S.IN_FRAMESET:{qg(this,t);break}case S.AFTER_FRAMESET:{Kg(this,t);break}case S.AFTER_AFTER_BODY:{ta(this,t);break}}}onEof(t){switch(this.insertionMode){case S.INITIAL:{nn(this,t);break}case S.BEFORE_HTML:{xn(this,t);break}case S.BEFORE_HEAD:{En(this,t);break}case S.IN_HEAD:{yn(this,t);break}case S.IN_HEAD_NO_SCRIPT:{Tn(this,t);break}case S.AFTER_HEAD:{kn(this,t);break}case S.IN_BODY:case S.IN_TABLE:case S.IN_CAPTION:case S.IN_COLUMN_GROUP:case S.IN_TABLE_BODY:case S.IN_ROW:case S.IN_CELL:case S.IN_SELECT:case S.IN_SELECT_IN_TABLE:{jc(this,t);break}case S.TEXT:{Ng(this,t);break}case S.IN_TABLE_TEXT:{an(this,t);break}case S.IN_TEMPLATE:{Mc(this,t);break}case S.AFTER_BODY:case S.IN_FRAMESET:case S.AFTER_FRAMESET:case S.AFTER_AFTER_BODY:case S.AFTER_AFTER_FRAMESET:{ti(this,t);break}}}onWhitespaceCharacter(t){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,t.chars.charCodeAt(0)===x.LINE_FEED)){if(t.chars.length===1)return;t.chars=t.chars.substr(1)}if(this.tokenizer.inForeignNode){this._insertCharacters(t);return}switch(this.insertionMode){case S.IN_HEAD:case S.IN_HEAD_NO_SCRIPT:case S.AFTER_HEAD:case S.TEXT:case S.IN_COLUMN_GROUP:case S.IN_SELECT:case S.IN_SELECT_IN_TABLE:case S.IN_FRAMESET:case S.AFTER_FRAMESET:{this._insertCharacters(t);break}case S.IN_BODY:case S.IN_CAPTION:case S.IN_CELL:case S.IN_TEMPLATE:case S.AFTER_BODY:case S.AFTER_AFTER_BODY:case S.AFTER_AFTER_FRAMESET:{Cc(this,t);break}case S.IN_TABLE:case S.IN_TABLE_BODY:case S.IN_ROW:{Qa(this,t);break}case S.IN_TABLE_TEXT:{Ic(this,t);break}}}}function yf(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):Ac(e,t),n}function Tf(e,t){let n=null,r=e.openElements.stackTop;for(;r>=0;r--){const a=e.openElements.items[r];if(a===t.element)break;e._isSpecialElement(a,e.openElements.tagIDs[r])&&(n=a)}return n||(e.openElements.shortenToLength(Math.max(r,0)),e.activeFormattingElements.removeEntry(t)),n}function kf(e,t,n){let r=t,a=e.openElements.getCommonAncestor(t);for(let c=0,l=a;l!==n;c++,l=a){a=e.openElements.getCommonAncestor(l);const u=e.activeFormattingElements.getElementEntry(l),d=u&&c>=xf;!u||d?(d&&e.activeFormattingElements.removeEntry(u),e.openElements.remove(l)):(l=Nf(e,u),r===t&&(e.activeFormattingElements.bookmark=u),e.treeAdapter.detachNode(r),e.treeAdapter.appendChild(l,r),r=l)}return r}function Nf(e,t){const 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 vf(e,t,n){const r=e.treeAdapter.getTagName(t),a=Js(r);if(e._isElementCausesFosterParenting(a))e._fosterParentElement(n);else{const c=e.treeAdapter.getNamespaceURI(t);a===i.TEMPLATE&&c===me.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,n)}}function Cf(e,t,n){const r=e.treeAdapter.getNamespaceURI(n.element),{token:a}=n,c=e.treeAdapter.createElement(a.tagName,r,a.attrs);e._adoptNodes(t,c),e.treeAdapter.appendChild(t,c),e.activeFormattingElements.insertElementAfterBookmark(c,a),e.activeFormattingElements.removeEntry(n),e.openElements.remove(n.element),e.openElements.insertAfter(t,c,a.tagID)}function ei(e,t){for(let n=0;n<bf;n++){const r=yf(e,t);if(!r)break;const a=Tf(e,r);if(!a)break;e.activeFormattingElements.bookmark=r;const c=kf(e,a,r.element),l=e.openElements.getCommonAncestor(r.element);e.treeAdapter.detachNode(c),l&&vf(e,l,c),Cf(e,a,r)}}function Ir(e,t){e._appendCommentNode(t,e.openElements.currentTmplContentOrNode)}function wf(e,t){e._appendCommentNode(t,e.openElements.items[0])}function Sf(e,t){e._appendCommentNode(t,e.document)}function ti(e,t){if(e.stopped=!0,t.location){const 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){const r=e.openElements.items[0],a=e.treeAdapter.getNodeSourceCodeLocation(r);if(a&&!a.endTag&&(e._setEndLocation(r,t),e.openElements.stackTop>=1)){const c=e.openElements.items[1],l=e.treeAdapter.getNodeSourceCodeLocation(c);l&&!l.endTag&&e._setEndLocation(c,t)}}}}function _f(e,t){e._setDocumentType(t);const n=t.forceQuirks?Gt.QUIRKS:nf(t);sf(t)||e._err(t,V.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=S.BEFORE_HTML}function nn(e,t){e._err(t,V.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,Gt.QUIRKS),e.insertionMode=S.BEFORE_HTML,e._processToken(t)}function Af(e,t){t.tagID===i.HTML?(e._insertElement(t,me.HTML),e.insertionMode=S.BEFORE_HEAD):xn(e,t)}function jf(e,t){const n=t.tagID;(n===i.HTML||n===i.HEAD||n===i.BODY||n===i.BR)&&xn(e,t)}function xn(e,t){e._insertFakeRootElement(),e.insertionMode=S.BEFORE_HEAD,e._processToken(t)}function If(e,t){switch(t.tagID){case i.HTML:{Pt(e,t);break}case i.HEAD:{e._insertElement(t,me.HTML),e.headElement=e.openElements.current,e.insertionMode=S.IN_HEAD;break}default:En(e,t)}}function Rf(e,t){const n=t.tagID;n===i.HEAD||n===i.BODY||n===i.HTML||n===i.BR?En(e,t):e._err(t,V.endTagWithoutMatchingOpenElement)}function En(e,t){e._insertFakeElement(H.HEAD,i.HEAD),e.headElement=e.openElements.current,e.insertionMode=S.IN_HEAD,e._processToken(t)}function ns(e,t){switch(t.tagID){case i.HTML:{Pt(e,t);break}case i.BASE:case i.BASEFONT:case i.BGSOUND:case i.LINK:case i.META:{e._appendElement(t,me.HTML),t.ackSelfClosing=!0;break}case i.TITLE:{e._switchToTextParsing(t,Tt.RCDATA);break}case i.NOSCRIPT:{e.options.scriptingEnabled?e._switchToTextParsing(t,Tt.RAWTEXT):(e._insertElement(t,me.HTML),e.insertionMode=S.IN_HEAD_NO_SCRIPT);break}case i.NOFRAMES:case i.STYLE:{e._switchToTextParsing(t,Tt.RAWTEXT);break}case i.SCRIPT:{e._switchToTextParsing(t,Tt.SCRIPT_DATA);break}case i.TEMPLATE:{e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=S.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(S.IN_TEMPLATE);break}case i.HEAD:{e._err(t,V.misplacedStartTagForHeadElement);break}default:yn(e,t)}}function Pf(e,t){switch(t.tagID){case i.HEAD:{e.openElements.pop(),e.insertionMode=S.AFTER_HEAD;break}case i.BODY:case i.BR:case i.HTML:{yn(e,t);break}case i.TEMPLATE:{Ms(e,t);break}default:e._err(t,V.endTagWithoutMatchingOpenElement)}}function Ms(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==i.TEMPLATE&&e._err(t,V.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped(i.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,V.endTagWithoutMatchingOpenElement)}function yn(e,t){e.openElements.pop(),e.insertionMode=S.AFTER_HEAD,e._processToken(t)}function Lf(e,t){switch(t.tagID){case i.HTML:{Pt(e,t);break}case i.BASEFONT:case i.BGSOUND:case i.HEAD:case i.LINK:case i.META:case i.NOFRAMES:case i.STYLE:{ns(e,t);break}case i.NOSCRIPT:{e._err(t,V.nestedNoscriptInHead);break}default:Tn(e,t)}}function Df(e,t){switch(t.tagID){case i.NOSCRIPT:{e.openElements.pop(),e.insertionMode=S.IN_HEAD;break}case i.BR:{Tn(e,t);break}default:e._err(t,V.endTagWithoutMatchingOpenElement)}}function Tn(e,t){const n=t.type===Ze.EOF?V.openElementsLeftAfterEof:V.disallowedContentInNoscriptInHead;e._err(t,n),e.openElements.pop(),e.insertionMode=S.IN_HEAD,e._processToken(t)}function Of(e,t){switch(t.tagID){case i.HTML:{Pt(e,t);break}case i.BODY:{e._insertElement(t,me.HTML),e.framesetOk=!1,e.insertionMode=S.IN_BODY;break}case i.FRAMESET:{e._insertElement(t,me.HTML),e.insertionMode=S.IN_FRAMESET;break}case i.BASE:case i.BASEFONT:case i.BGSOUND:case i.LINK:case i.META:case i.NOFRAMES:case i.SCRIPT:case i.STYLE:case i.TEMPLATE:case i.TITLE:{e._err(t,V.abandonedHeadElementChild),e.openElements.push(e.headElement,i.HEAD),ns(e,t),e.openElements.remove(e.headElement);break}case i.HEAD:{e._err(t,V.misplacedStartTagForHeadElement);break}default:kn(e,t)}}function Mf(e,t){switch(t.tagID){case i.BODY:case i.HTML:case i.BR:{kn(e,t);break}case i.TEMPLATE:{Ms(e,t);break}default:e._err(t,V.endTagWithoutMatchingOpenElement)}}function kn(e,t){e._insertFakeElement(H.BODY,i.BODY),e.insertionMode=S.IN_BODY,La(e,t)}function La(e,t){switch(t.type){case Ze.CHARACTER:{wc(e,t);break}case Ze.WHITESPACE_CHARACTER:{Cc(e,t);break}case Ze.COMMENT:{Ir(e,t);break}case Ze.START_TAG:{Pt(e,t);break}case Ze.END_TAG:{Da(e,t);break}case Ze.EOF:{jc(e,t);break}}}function Cc(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function wc(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function Bf(e,t){e.openElements.tmplCount===0&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}function Ff(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e.openElements.tmplCount===0&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(n,t.attrs))}function Hf(e,t){const n=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&n&&(e.treeAdapter.detachNode(n),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,me.HTML),e.insertionMode=S.IN_FRAMESET)}function Uf(e,t){e.openElements.hasInButtonScope(i.P)&&e._closePElement(),e._insertElement(t,me.HTML)}function $f(e,t){e.openElements.hasInButtonScope(i.P)&&e._closePElement(),e.openElements.currentTagId!==void 0&&jr.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,me.HTML)}function qf(e,t){e.openElements.hasInButtonScope(i.P)&&e._closePElement(),e._insertElement(t,me.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}function Wf(e,t){const n=e.openElements.tmplCount>0;(!e.formElement||n)&&(e.openElements.hasInButtonScope(i.P)&&e._closePElement(),e._insertElement(t,me.HTML),n||(e.formElement=e.openElements.current))}function Kf(e,t){e.framesetOk=!1;const n=t.tagID;for(let r=e.openElements.stackTop;r>=0;r--){const a=e.openElements.tagIDs[r];if(n===i.LI&&a===i.LI||(n===i.DD||n===i.DT)&&(a===i.DD||a===i.DT)){e.openElements.generateImpliedEndTagsWithExclusion(a),e.openElements.popUntilTagNamePopped(a);break}if(a!==i.ADDRESS&&a!==i.DIV&&a!==i.P&&e._isSpecialElement(e.openElements.items[r],a))break}e.openElements.hasInButtonScope(i.P)&&e._closePElement(),e._insertElement(t,me.HTML)}function Gf(e,t){e.openElements.hasInButtonScope(i.P)&&e._closePElement(),e._insertElement(t,me.HTML),e.tokenizer.state=Tt.PLAINTEXT}function Yf(e,t){e.openElements.hasInScope(i.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(i.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,me.HTML),e.framesetOk=!1}function zf(e,t){const n=e.activeFormattingElements.getElementEntryInScopeWithTagName(H.A);n&&(ei(e,t),e.openElements.remove(n.element),e.activeFormattingElements.removeEntry(n)),e._reconstructActiveFormattingElements(),e._insertElement(t,me.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function Vf(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,me.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function Qf(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(i.NOBR)&&(ei(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,me.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function Xf(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,me.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}function Jf(e,t){e.treeAdapter.getDocumentMode(e.document)!==Gt.QUIRKS&&e.openElements.hasInButtonScope(i.P)&&e._closePElement(),e._insertElement(t,me.HTML),e.framesetOk=!1,e.insertionMode=S.IN_TABLE}function Sc(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,me.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function _c(e){const t=gc(e,Ps.TYPE);return t!=null&&t.toLowerCase()===gf}function Zf(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,me.HTML),_c(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}function eg(e,t){e._appendElement(t,me.HTML),t.ackSelfClosing=!0}function tg(e,t){e.openElements.hasInButtonScope(i.P)&&e._closePElement(),e._appendElement(t,me.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function sg(e,t){t.tagName=H.IMG,t.tagID=i.IMG,Sc(e,t)}function ng(e,t){e._insertElement(t,me.HTML),e.skipNextNewLine=!0,e.tokenizer.state=Tt.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=S.TEXT}function ag(e,t){e.openElements.hasInButtonScope(i.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,Tt.RAWTEXT)}function rg(e,t){e.framesetOk=!1,e._switchToTextParsing(t,Tt.RAWTEXT)}function vo(e,t){e._switchToTextParsing(t,Tt.RAWTEXT)}function ig(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,me.HTML),e.framesetOk=!1,e.insertionMode=e.insertionMode===S.IN_TABLE||e.insertionMode===S.IN_CAPTION||e.insertionMode===S.IN_TABLE_BODY||e.insertionMode===S.IN_ROW||e.insertionMode===S.IN_CELL?S.IN_SELECT_IN_TABLE:S.IN_SELECT}function og(e,t){e.openElements.currentTagId===i.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,me.HTML)}function lg(e,t){e.openElements.hasInScope(i.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,me.HTML)}function cg(e,t){e.openElements.hasInScope(i.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(i.RTC),e._insertElement(t,me.HTML)}function ug(e,t){e._reconstructActiveFormattingElements(),kc(t),Zr(t),t.selfClosing?e._appendElement(t,me.MATHML):e._insertElement(t,me.MATHML),t.ackSelfClosing=!0}function dg(e,t){e._reconstructActiveFormattingElements(),Nc(t),Zr(t),t.selfClosing?e._appendElement(t,me.SVG):e._insertElement(t,me.SVG),t.ackSelfClosing=!0}function Co(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,me.HTML)}function Pt(e,t){switch(t.tagID){case i.I:case i.S:case i.B:case i.U:case i.EM:case i.TT:case i.BIG:case i.CODE:case i.FONT:case i.SMALL:case i.STRIKE:case i.STRONG:{Vf(e,t);break}case i.A:{zf(e,t);break}case i.H1:case i.H2:case i.H3:case i.H4:case i.H5:case i.H6:{$f(e,t);break}case i.P:case i.DL:case i.OL:case i.UL:case i.DIV:case i.DIR:case i.NAV:case i.MAIN:case i.MENU:case i.ASIDE:case i.CENTER:case i.FIGURE:case i.FOOTER:case i.HEADER:case i.HGROUP:case i.DIALOG:case i.DETAILS:case i.ADDRESS:case i.ARTICLE:case i.SEARCH:case i.SECTION:case i.SUMMARY:case i.FIELDSET:case i.BLOCKQUOTE:case i.FIGCAPTION:{Uf(e,t);break}case i.LI:case i.DD:case i.DT:{Kf(e,t);break}case i.BR:case i.IMG:case i.WBR:case i.AREA:case i.EMBED:case i.KEYGEN:{Sc(e,t);break}case i.HR:{tg(e,t);break}case i.RB:case i.RTC:{lg(e,t);break}case i.RT:case i.RP:{cg(e,t);break}case i.PRE:case i.LISTING:{qf(e,t);break}case i.XMP:{ag(e,t);break}case i.SVG:{dg(e,t);break}case i.HTML:{Bf(e,t);break}case i.BASE:case i.LINK:case i.META:case i.STYLE:case i.TITLE:case i.SCRIPT:case i.BGSOUND:case i.BASEFONT:case i.TEMPLATE:{ns(e,t);break}case i.BODY:{Ff(e,t);break}case i.FORM:{Wf(e,t);break}case i.NOBR:{Qf(e,t);break}case i.MATH:{ug(e,t);break}case i.TABLE:{Jf(e,t);break}case i.INPUT:{Zf(e,t);break}case i.PARAM:case i.TRACK:case i.SOURCE:{eg(e,t);break}case i.IMAGE:{sg(e,t);break}case i.BUTTON:{Yf(e,t);break}case i.APPLET:case i.OBJECT:case i.MARQUEE:{Xf(e,t);break}case i.IFRAME:{rg(e,t);break}case i.SELECT:{ig(e,t);break}case i.OPTION:case i.OPTGROUP:{og(e,t);break}case i.NOEMBED:case i.NOFRAMES:{vo(e,t);break}case i.FRAMESET:{Hf(e,t);break}case i.TEXTAREA:{ng(e,t);break}case i.NOSCRIPT:{e.options.scriptingEnabled?vo(e,t):Co(e,t);break}case i.PLAINTEXT:{Gf(e,t);break}case i.COL:case i.TH:case i.TD:case i.TR:case i.HEAD:case i.FRAME:case i.TBODY:case i.TFOOT:case i.THEAD:case i.CAPTION:case i.COLGROUP:break;default:Co(e,t)}}function pg(e,t){if(e.openElements.hasInScope(i.BODY)&&(e.insertionMode=S.AFTER_BODY,e.options.sourceCodeLocationInfo)){const n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e._setEndLocation(n,t)}}function mg(e,t){e.openElements.hasInScope(i.BODY)&&(e.insertionMode=S.AFTER_BODY,Bc(e,t))}function hg(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n))}function fg(e){const t=e.openElements.tmplCount>0,{formElement:n}=e;t||(e.formElement=null),(n||t)&&e.openElements.hasInScope(i.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(i.FORM):n&&e.openElements.remove(n))}function gg(e){e.openElements.hasInButtonScope(i.P)||e._insertFakeElement(H.P,i.P),e._closePElement()}function bg(e){e.openElements.hasInListItemScope(i.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(i.LI),e.openElements.popUntilTagNamePopped(i.LI))}function xg(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n))}function Eg(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}function yg(e,t){const n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker())}function Tg(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(H.BR,i.BR),e.openElements.pop(),e.framesetOk=!1}function Ac(e,t){const n=t.tagName,r=t.tagID;for(let a=e.openElements.stackTop;a>0;a--){const c=e.openElements.items[a],l=e.openElements.tagIDs[a];if(r===l&&(r!==i.UNKNOWN||e.treeAdapter.getTagName(c)===n)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.stackTop>=a&&e.openElements.shortenToLength(a);break}if(e._isSpecialElement(c,l))break}}function Da(e,t){switch(t.tagID){case i.A:case i.B:case i.I:case i.S:case i.U:case i.EM:case i.TT:case i.BIG:case i.CODE:case i.FONT:case i.NOBR:case i.SMALL:case i.STRIKE:case i.STRONG:{ei(e,t);break}case i.P:{gg(e);break}case i.DL:case i.UL:case i.OL:case i.DIR:case i.DIV:case i.NAV:case i.PRE:case i.MAIN:case i.MENU:case i.ASIDE:case i.BUTTON:case i.CENTER:case i.FIGURE:case i.FOOTER:case i.HEADER:case i.HGROUP:case i.DIALOG:case i.ADDRESS:case i.ARTICLE:case i.DETAILS:case i.SEARCH:case i.SECTION:case i.SUMMARY:case i.LISTING:case i.FIELDSET:case i.BLOCKQUOTE:case i.FIGCAPTION:{hg(e,t);break}case i.LI:{bg(e);break}case i.DD:case i.DT:{xg(e,t);break}case i.H1:case i.H2:case i.H3:case i.H4:case i.H5:case i.H6:{Eg(e);break}case i.BR:{Tg(e);break}case i.BODY:{pg(e,t);break}case i.HTML:{mg(e,t);break}case i.FORM:{fg(e);break}case i.APPLET:case i.OBJECT:case i.MARQUEE:{yg(e,t);break}case i.TEMPLATE:{Ms(e,t);break}default:Ac(e,t)}}function jc(e,t){e.tmplInsertionModeStack.length>0?Mc(e,t):ti(e,t)}function kg(e,t){var n;t.tagID===i.SCRIPT&&((n=e.scriptHandler)===null||n===void 0||n.call(e,e.openElements.current)),e.openElements.pop(),e.insertionMode=e.originalInsertionMode}function Ng(e,t){e._err(t,V.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}function Qa(e,t){if(e.openElements.currentTagId!==void 0&&vc.has(e.openElements.currentTagId))switch(e.pendingCharacterTokens.length=0,e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=S.IN_TABLE_TEXT,t.type){case Ze.CHARACTER:{Rc(e,t);break}case Ze.WHITESPACE_CHARACTER:{Ic(e,t);break}}else Ln(e,t)}function vg(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,me.HTML),e.insertionMode=S.IN_CAPTION}function Cg(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,me.HTML),e.insertionMode=S.IN_COLUMN_GROUP}function wg(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(H.COLGROUP,i.COLGROUP),e.insertionMode=S.IN_COLUMN_GROUP,si(e,t)}function Sg(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,me.HTML),e.insertionMode=S.IN_TABLE_BODY}function _g(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(H.TBODY,i.TBODY),e.insertionMode=S.IN_TABLE_BODY,Oa(e,t)}function Ag(e,t){e.openElements.hasInTableScope(i.TABLE)&&(e.openElements.popUntilTagNamePopped(i.TABLE),e._resetInsertionMode(),e._processStartTag(t))}function jg(e,t){_c(t)?e._appendElement(t,me.HTML):Ln(e,t),t.ackSelfClosing=!0}function Ig(e,t){!e.formElement&&e.openElements.tmplCount===0&&(e._insertElement(t,me.HTML),e.formElement=e.openElements.current,e.openElements.pop())}function Vs(e,t){switch(t.tagID){case i.TD:case i.TH:case i.TR:{_g(e,t);break}case i.STYLE:case i.SCRIPT:case i.TEMPLATE:{ns(e,t);break}case i.COL:{wg(e,t);break}case i.FORM:{Ig(e,t);break}case i.TABLE:{Ag(e,t);break}case i.TBODY:case i.TFOOT:case i.THEAD:{Sg(e,t);break}case i.INPUT:{jg(e,t);break}case i.CAPTION:{vg(e,t);break}case i.COLGROUP:{Cg(e,t);break}default:Ln(e,t)}}function An(e,t){switch(t.tagID){case i.TABLE:{e.openElements.hasInTableScope(i.TABLE)&&(e.openElements.popUntilTagNamePopped(i.TABLE),e._resetInsertionMode());break}case i.TEMPLATE:{Ms(e,t);break}case i.BODY:case i.CAPTION:case i.COL:case i.COLGROUP:case i.HTML:case i.TBODY:case i.TD:case i.TFOOT:case i.TH:case i.THEAD:case i.TR:break;default:Ln(e,t)}}function Ln(e,t){const n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,La(e,t),e.fosterParentingEnabled=n}function Ic(e,t){e.pendingCharacterTokens.push(t)}function Rc(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function an(e,t){let n=0;if(e.hasNonWhitespacePendingCharacterToken)for(;n<e.pendingCharacterTokens.length;n++)Ln(e,e.pendingCharacterTokens[n]);else for(;n<e.pendingCharacterTokens.length;n++)e._insertCharacters(e.pendingCharacterTokens[n]);e.insertionMode=e.originalInsertionMode,e._processToken(t)}const Pc=new Set([i.CAPTION,i.COL,i.COLGROUP,i.TBODY,i.TD,i.TFOOT,i.TH,i.THEAD,i.TR]);function Rg(e,t){const n=t.tagID;Pc.has(n)?e.openElements.hasInTableScope(i.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(i.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=S.IN_TABLE,Vs(e,t)):Pt(e,t)}function Pg(e,t){const n=t.tagID;switch(n){case i.CAPTION:case i.TABLE:{e.openElements.hasInTableScope(i.CAPTION)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(i.CAPTION),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=S.IN_TABLE,n===i.TABLE&&An(e,t));break}case i.BODY:case i.COL:case i.COLGROUP:case i.HTML:case i.TBODY:case i.TD:case i.TFOOT:case i.TH:case i.THEAD:case i.TR:break;default:Da(e,t)}}function si(e,t){switch(t.tagID){case i.HTML:{Pt(e,t);break}case i.COL:{e._appendElement(t,me.HTML),t.ackSelfClosing=!0;break}case i.TEMPLATE:{ns(e,t);break}default:Ta(e,t)}}function Lg(e,t){switch(t.tagID){case i.COLGROUP:{e.openElements.currentTagId===i.COLGROUP&&(e.openElements.pop(),e.insertionMode=S.IN_TABLE);break}case i.TEMPLATE:{Ms(e,t);break}case i.COL:break;default:Ta(e,t)}}function Ta(e,t){e.openElements.currentTagId===i.COLGROUP&&(e.openElements.pop(),e.insertionMode=S.IN_TABLE,e._processToken(t))}function Oa(e,t){switch(t.tagID){case i.TR:{e.openElements.clearBackToTableBodyContext(),e._insertElement(t,me.HTML),e.insertionMode=S.IN_ROW;break}case i.TH:case i.TD:{e.openElements.clearBackToTableBodyContext(),e._insertFakeElement(H.TR,i.TR),e.insertionMode=S.IN_ROW,Ma(e,t);break}case i.CAPTION:case i.COL:case i.COLGROUP:case i.TBODY:case i.TFOOT:case i.THEAD:{e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=S.IN_TABLE,Vs(e,t));break}default:Vs(e,t)}}function Rr(e,t){const n=t.tagID;switch(t.tagID){case i.TBODY:case i.TFOOT:case i.THEAD:{e.openElements.hasInTableScope(n)&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=S.IN_TABLE);break}case i.TABLE:{e.openElements.hasTableBodyContextInTableScope()&&(e.openElements.clearBackToTableBodyContext(),e.openElements.pop(),e.insertionMode=S.IN_TABLE,An(e,t));break}case i.BODY:case i.CAPTION:case i.COL:case i.COLGROUP:case i.HTML:case i.TD:case i.TH:case i.TR:break;default:An(e,t)}}function Ma(e,t){switch(t.tagID){case i.TH:case i.TD:{e.openElements.clearBackToTableRowContext(),e._insertElement(t,me.HTML),e.insertionMode=S.IN_CELL,e.activeFormattingElements.insertMarker();break}case i.CAPTION:case i.COL:case i.COLGROUP:case i.TBODY:case i.TFOOT:case i.THEAD:case i.TR:{e.openElements.hasInTableScope(i.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=S.IN_TABLE_BODY,Oa(e,t));break}default:Vs(e,t)}}function Lc(e,t){switch(t.tagID){case i.TR:{e.openElements.hasInTableScope(i.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=S.IN_TABLE_BODY);break}case i.TABLE:{e.openElements.hasInTableScope(i.TR)&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=S.IN_TABLE_BODY,Rr(e,t));break}case i.TBODY:case i.TFOOT:case i.THEAD:{(e.openElements.hasInTableScope(t.tagID)||e.openElements.hasInTableScope(i.TR))&&(e.openElements.clearBackToTableRowContext(),e.openElements.pop(),e.insertionMode=S.IN_TABLE_BODY,Rr(e,t));break}case i.BODY:case i.CAPTION:case i.COL:case i.COLGROUP:case i.HTML:case i.TD:case i.TH:break;default:An(e,t)}}function Dg(e,t){const n=t.tagID;Pc.has(n)?(e.openElements.hasInTableScope(i.TD)||e.openElements.hasInTableScope(i.TH))&&(e._closeTableCell(),Ma(e,t)):Pt(e,t)}function Og(e,t){const n=t.tagID;switch(n){case i.TD:case i.TH:{e.openElements.hasInTableScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker(),e.insertionMode=S.IN_ROW);break}case i.TABLE:case i.TBODY:case i.TFOOT:case i.THEAD:case i.TR:{e.openElements.hasInTableScope(n)&&(e._closeTableCell(),Lc(e,t));break}case i.BODY:case i.CAPTION:case i.COL:case i.COLGROUP:case i.HTML:break;default:Da(e,t)}}function Dc(e,t){switch(t.tagID){case i.HTML:{Pt(e,t);break}case i.OPTION:{e.openElements.currentTagId===i.OPTION&&e.openElements.pop(),e._insertElement(t,me.HTML);break}case i.OPTGROUP:{e.openElements.currentTagId===i.OPTION&&e.openElements.pop(),e.openElements.currentTagId===i.OPTGROUP&&e.openElements.pop(),e._insertElement(t,me.HTML);break}case i.HR:{e.openElements.currentTagId===i.OPTION&&e.openElements.pop(),e.openElements.currentTagId===i.OPTGROUP&&e.openElements.pop(),e._appendElement(t,me.HTML),t.ackSelfClosing=!0;break}case i.INPUT:case i.KEYGEN:case i.TEXTAREA:case i.SELECT:{e.openElements.hasInSelectScope(i.SELECT)&&(e.openElements.popUntilTagNamePopped(i.SELECT),e._resetInsertionMode(),t.tagID!==i.SELECT&&e._processStartTag(t));break}case i.SCRIPT:case i.TEMPLATE:{ns(e,t);break}}}function Oc(e,t){switch(t.tagID){case i.OPTGROUP:{e.openElements.stackTop>0&&e.openElements.currentTagId===i.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===i.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===i.OPTGROUP&&e.openElements.pop();break}case i.OPTION:{e.openElements.currentTagId===i.OPTION&&e.openElements.pop();break}case i.SELECT:{e.openElements.hasInSelectScope(i.SELECT)&&(e.openElements.popUntilTagNamePopped(i.SELECT),e._resetInsertionMode());break}case i.TEMPLATE:{Ms(e,t);break}}}function Mg(e,t){const n=t.tagID;n===i.CAPTION||n===i.TABLE||n===i.TBODY||n===i.TFOOT||n===i.THEAD||n===i.TR||n===i.TD||n===i.TH?(e.openElements.popUntilTagNamePopped(i.SELECT),e._resetInsertionMode(),e._processStartTag(t)):Dc(e,t)}function Bg(e,t){const n=t.tagID;n===i.CAPTION||n===i.TABLE||n===i.TBODY||n===i.TFOOT||n===i.THEAD||n===i.TR||n===i.TD||n===i.TH?e.openElements.hasInTableScope(n)&&(e.openElements.popUntilTagNamePopped(i.SELECT),e._resetInsertionMode(),e.onEndTag(t)):Oc(e,t)}function Fg(e,t){switch(t.tagID){case i.BASE:case i.BASEFONT:case i.BGSOUND:case i.LINK:case i.META:case i.NOFRAMES:case i.SCRIPT:case i.STYLE:case i.TEMPLATE:case i.TITLE:{ns(e,t);break}case i.CAPTION:case i.COLGROUP:case i.TBODY:case i.TFOOT:case i.THEAD:{e.tmplInsertionModeStack[0]=S.IN_TABLE,e.insertionMode=S.IN_TABLE,Vs(e,t);break}case i.COL:{e.tmplInsertionModeStack[0]=S.IN_COLUMN_GROUP,e.insertionMode=S.IN_COLUMN_GROUP,si(e,t);break}case i.TR:{e.tmplInsertionModeStack[0]=S.IN_TABLE_BODY,e.insertionMode=S.IN_TABLE_BODY,Oa(e,t);break}case i.TD:case i.TH:{e.tmplInsertionModeStack[0]=S.IN_ROW,e.insertionMode=S.IN_ROW,Ma(e,t);break}default:e.tmplInsertionModeStack[0]=S.IN_BODY,e.insertionMode=S.IN_BODY,Pt(e,t)}}function Hg(e,t){t.tagID===i.TEMPLATE&&Ms(e,t)}function Mc(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(i.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):ti(e,t)}function Ug(e,t){t.tagID===i.HTML?Pt(e,t):ka(e,t)}function Bc(e,t){var n;if(t.tagID===i.HTML){if(e.fragmentContext||(e.insertionMode=S.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===i.HTML){e._setEndLocation(e.openElements.items[0],t);const r=e.openElements.items[1];r&&!(!((n=e.treeAdapter.getNodeSourceCodeLocation(r))===null||n===void 0)&&n.endTag)&&e._setEndLocation(r,t)}}else ka(e,t)}function ka(e,t){e.insertionMode=S.IN_BODY,La(e,t)}function $g(e,t){switch(t.tagID){case i.HTML:{Pt(e,t);break}case i.FRAMESET:{e._insertElement(t,me.HTML);break}case i.FRAME:{e._appendElement(t,me.HTML),t.ackSelfClosing=!0;break}case i.NOFRAMES:{ns(e,t);break}}}function qg(e,t){t.tagID===i.FRAMESET&&!e.openElements.isRootHtmlElementCurrent()&&(e.openElements.pop(),!e.fragmentContext&&e.openElements.currentTagId!==i.FRAMESET&&(e.insertionMode=S.AFTER_FRAMESET))}function Wg(e,t){switch(t.tagID){case i.HTML:{Pt(e,t);break}case i.NOFRAMES:{ns(e,t);break}}}function Kg(e,t){t.tagID===i.HTML&&(e.insertionMode=S.AFTER_AFTER_FRAMESET)}function Gg(e,t){t.tagID===i.HTML?Pt(e,t):ta(e,t)}function ta(e,t){e.insertionMode=S.IN_BODY,La(e,t)}function Yg(e,t){switch(t.tagID){case i.HTML:{Pt(e,t);break}case i.NOFRAMES:{ns(e,t);break}}}function zg(e,t){t.chars=gt,e._insertCharacters(t)}function Vg(e,t){e._insertCharacters(t),e.framesetOk=!1}function Fc(e){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==me.HTML&&e.openElements.currentTagId!==void 0&&!e._isIntegrationPoint(e.openElements.currentTagId,e.openElements.current);)e.openElements.pop()}function Qg(e,t){if(df(t))Fc(e),e._startTagOutsideForeignContent(t);else{const n=e._getAdjustedCurrentElement(),r=e.treeAdapter.getNamespaceURI(n);r===me.MATHML?kc(t):r===me.SVG&&(pf(t),Nc(t)),Zr(t),t.selfClosing?e._appendElement(t,r):e._insertElement(t,r),t.ackSelfClosing=!0}}function Xg(e,t){if(t.tagID===i.P||t.tagID===i.BR){Fc(e),e._endTagOutsideForeignContent(t);return}for(let n=e.openElements.stackTop;n>0;n--){const r=e.openElements.items[n];if(e.treeAdapter.getNamespaceURI(r)===me.HTML){e._endTagOutsideForeignContent(t);break}const a=e.treeAdapter.getTagName(r);if(a.toLowerCase()===t.tagName){t.tagName=a,e.openElements.shortenToLength(n);break}}}H.AREA,H.BASE,H.BASEFONT,H.BGSOUND,H.BR,H.COL,H.EMBED,H.FRAME,H.HR,H.IMG,H.INPUT,H.KEYGEN,H.LINK,H.META,H.PARAM,H.SOURCE,H.TRACK,H.WBR;const Jg=/<(\/?)(iframe|noembed|noframes|plaintext|script|style|textarea|title|xmp)(?=[\t\n\f\r />])/gi,Zg=new Set(["mdxFlowExpression","mdxJsxFlowElement","mdxJsxTextElement","mdxTextExpression","mdxjsEsm"]),wo={sourceCodeLocationInfo:!0,scriptingEnabled:!1};function Hc(e,t){const n=c0(e),r=pl("type",{handlers:{root:e0,element:t0,text:s0,comment:$c,doctype:n0,raw:r0},unknown:i0}),a={parser:n?new No(wo):No.getFragmentParser(void 0,wo),handle(u){r(u,a)},stitches:!1,options:t||{}};r(e,a),Zs(a,Ds());const c=n?a.parser.document:a.parser.getFragment(),l=ch(c,{file:a.options.file});return a.stitches&&cd(l,"comment",function(u,d,m){const f=u;if(f.value.stitch&&m&&d!==void 0){const h=m.children;return h[d]=f.value.stitch,d}}),l.type==="root"&&l.children.length===1&&l.children[0].type===e.type?l.children[0]:l}function Uc(e,t){let n=-1;if(e)for(;++n<e.length;)t.handle(e[n])}function e0(e,t){Uc(e.children,t)}function t0(e,t){o0(e,t),Uc(e.children,t),l0(e,t)}function s0(e,t){t.parser.tokenizer.state>4&&(t.parser.tokenizer.state=0);const n={type:Ze.CHARACTER,chars:e.value,location:Dn(e)};Zs(t,Ds(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function n0(e,t){const n={type:Ze.DOCTYPE,name:"html",forceQuirks:!1,publicId:"",systemId:"",location:Dn(e)};Zs(t,Ds(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function a0(e,t){t.stitches=!0;const n=u0(e);if("children"in e&&"children"in n){const r=Hc({type:"root",children:e.children},t.options);n.children=r.children}$c({type:"comment",value:{stitch:n}},t)}function $c(e,t){const n=e.value,r={type:Ze.COMMENT,data:n,location:Dn(e)};Zs(t,Ds(e)),t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken)}function r0(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,qc(t,Ds(e)),t.parser.tokenizer.write(t.options.tagfilter?e.value.replace(Jg,"&lt;$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;const n=t.parser.tokenizer._consume();t.parser.tokenizer._callState(n)}}function i0(e,t){const n=e;if(t.options.passThrough&&t.options.passThrough.includes(n.type))a0(n,t);else{let r="";throw Zg.has(n.type)&&(r=". 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"),new Error("Cannot compile `"+n.type+"` node"+r)}}function Zs(e,t){qc(e,t);const 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=Tt.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 qc(e,t){if(t&&t.offset!==void 0){const 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 o0(e,t){const n=e.tagName.toLowerCase();if(t.parser.tokenizer.state===Tt.PLAINTEXT)return;Zs(t,Ds(e));const r=t.parser.openElements.current;let a="namespaceURI"in r?r.namespaceURI:ws.html;a===ws.html&&n==="svg"&&(a=ws.svg);const c=hh({...e,children:[]},{space:a===ws.svg?"svg":"html"}),l={type:Ze.START_TAG,tagName:n,tagID:Js(n),selfClosing:!1,ackSelfClosing:!1,attrs:"attrs"in c?c.attrs:[],location:Dn(e)};t.parser.currentToken=l,t.parser._processToken(t.parser.currentToken),t.parser.tokenizer.lastStartTagName=n}function l0(e,t){const n=e.tagName.toLowerCase();if(!t.parser.tokenizer.inForeignNode&&kh.includes(n)||t.parser.tokenizer.state===Tt.PLAINTEXT)return;Zs(t,ml(e));const r={type:Ze.END_TAG,tagName:n,tagID:Js(n),selfClosing:!1,ackSelfClosing:!1,attrs:[],location:Dn(e)};t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken),n===t.parser.tokenizer.lastStartTagName&&(t.parser.tokenizer.state===Tt.RCDATA||t.parser.tokenizer.state===Tt.RAWTEXT||t.parser.tokenizer.state===Tt.SCRIPT_DATA)&&(t.parser.tokenizer.state=Tt.DATA)}function c0(e){const t=e.type==="root"?e.children[0]:e;return!!(t&&(t.type==="doctype"||t.type==="element"&&t.tagName.toLowerCase()==="html"))}function Dn(e){const t=Ds(e)||{line:void 0,column:void 0,offset:void 0},n=ml(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 u0(e){return"children"in e?mi({...e,children:[]}):mi(e)}function d0(e){return function(t,n){return Hc(t,{...e,file:n})}}const Na=o.memo(function({text:t}){const n=He(),[r,a]=o.useState(!1);return t?s.jsx("button",{type:"button",className:"copy-btn",title:n("copy"),onClick:()=>{navigator.clipboard.writeText(t).then(()=>{a(!0),setTimeout(()=>a(!1),1200)})},children:r?s.jsx(os,{}):s.jsx(cs,{})}):null});function p0(e){const t=r=>{if(typeof r=="string"||typeof r=="number"){const a=String(r);return a===""?[[]]:a.split(`
@@ -12,7 +12,7 @@
12
12
  <meta name="mobile-web-app-capable" content="yes" />
13
13
  <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
14
14
  <title>pi-web-ui — pi 编码智能体</title>
15
- <script type="module" crossorigin src="/assets/index-8xCnPMZP.js"></script>
15
+ <script type="module" crossorigin src="/assets/index-CYuoen3I.js"></script>
16
16
  <link rel="modulepreload" crossorigin href="/assets/markdown-D3PKeHAZ.js">
17
17
  <link rel="modulepreload" crossorigin href="/assets/react-w24rH0km.js">
18
18
  <link rel="modulepreload" crossorigin href="/assets/xterm-B96xOxS9.js">